bcma misc updates
cover bcma misc updates
These are some updates for bcma. Some are extending or completing some workarounds for PCIe based wireless cards. A patch adds bcma_pmu_spuravoid_pllupdate, used by brcmsmac and an other patch adds constants for the chip ids. This code is mostly based on code from brcmsmac and the Broadcom SDK for BCM47XX SoCs.
This was tested on a BCM4718 SoC with a BCM43224 PCIe and a BCM5357. The Wifi part of the BCM4718 and BCM43224 is more or less working with brcmsmac, which need some more patches for that, but it has low speed and some times or with some access points I still get errors. The wifi of the BCM5357 does not work.
Hauke Mehrtens (8):
bcma: extend workaround for bcm4331
bcma: add constants for chip ids
bcma: Fix for 4329b0 bad LPOM is detection
bcma: add PCI ID for BCM43224
bcma: complete workaround for BCMA43224 and BCM4313
bcma: handle SoCs in pmu initialization
bcma: add bcma_pmu_spuravoid_pllupdate()
bcma: add mdelay bcma_pmu_resources_init()
drivers/bcma/driver_chipcommon_pmu.c | 355 +++++++++++++++++++++++---- drivers/bcma/driver_mips.c | 8 +- drivers/bcma/driver_pci_host.c | 8 +- drivers/bcma/host_pci.c | 1 + drivers/bcma/sprom.c | 18 +- include/linux/bcma/bcma.h | 30 +++ include/linux/bcma/bcma_driver_chipcommon.h | 23 ++ 7 files changed, 381 insertions(+), 62 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/8 bcma: extend workaround for bcm4331
This patch is based on a recent version of the Broadcom SDK.
--- drivers/bcma/driver_chipcommon_pmu.c | 3 +++ include/linux/bcma/bcma_driver_chipcommon.h | 1 + 2 files changed, 4 insertions(+)
drivers/bcma/driver_chipcommon_pmu.c +3 -0
@@ -123,8 +123,11 @@ void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable) val |=BCMA_CHIPCTL_4331_EXTPA_EN ;if (bus->chipinfo.pkg ==9 || bus->chipinfo.pkg ==11 ) val |=BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5 ; +else if (bus->chipinfo.rev >0 ) + val |=BCMA_CHIPCTL_4331_EXTPA_EN2 ; }else { val &= ~BCMA_CHIPCTL_4331_EXTPA_EN ; + val &= ~BCMA_CHIPCTL_4331_EXTPA_EN2 ; val &= ~BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5 ; }bcma_cc_write32 (cc,BCMA_CC_CHIPCTL , val);
include/linux/bcma/bcma_driver_chipcommon.h +1 -0
@@ -321,6 +321,7 @@#define BCMA_CHIPCTL_4331_OVR_PIPEAUXPWRDOWN BIT(9)/* override core control on pipe_AuxPowerDown */ #define BCMA_CHIPCTL_4331_PCIE_AUXCLKEN BIT(10)/* pcie_auxclkenable */ #define BCMA_CHIPCTL_4331_PCIE_PIPE_PLLDOWN BIT(11)/* pcie_pipe_pllpowerdown */ +#define BCMA_CHIPCTL_4331_EXTPA_EN2 BIT(12)/* 0 ext pa disable, 1 ext pa enabled */ #define BCMA_CHIPCTL_4331_BT_SHD0_ON_GPIO4 BIT(16)/* enable bt_shd0 at gpio4 */ #define BCMA_CHIPCTL_4331_BT_SHD1_ON_GPIO5 BIT(17)/* enable bt_shd1 at gpio5 */
Signature · 1 line
1.7.9.5
PATCH 2/8 bcma: add constants for chip ids
In reply to Hauke MehrtensThe chip IDs are used all over bcma and no constants where defined. This patch adds the constants and makes bcma use them.
--- drivers/bcma/driver_chipcommon_pmu.c | 81 +++++++++++++++++----------------- drivers/bcma/driver_mips.c | 8 ++-- drivers/bcma/driver_pci_host.c | 8 ++-- drivers/bcma/sprom.c | 18 ++++---- include/linux/bcma/bcma.h | 30 +++++++++++++ 5 files changed, 90 insertions(+), 55 deletions(-)
drivers/bcma/driver_chipcommon_pmu.c +41 -40
@@ -59,10 +59,10 @@ static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)struct bcma_bus *bus = cc->core->bus;switch (bus->chipinfo.id) { -case 0x4313 : -case 0x4331 : -case 43224 : -case 43225 : +case BCMA_CHIP_ID_BCM4313 : +case BCMA_CHIP_ID_BCM4331 : +case BCMA_CHIP_ID_BCM43224 : +case BCMA_CHIP_ID_BCM43225 :break ;default : pr_err("PLL init unknown for device 0x%04X\n",
@@ -76,13 +76,13 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)u32 min_msk =0 , max_msk =0 ;switch (bus->chipinfo.id) { -case 0x4313 : +case BCMA_CHIP_ID_BCM4313 : min_msk =0x200D ; max_msk =0xFFFF ;break ; -case 0x4331 : -case 43224 : -case 43225 : +case BCMA_CHIP_ID_BCM4331 : +case BCMA_CHIP_ID_BCM43224 : +case BCMA_CHIP_ID_BCM43225 :break ;default : pr_err("PMU resource config unknown for device 0x%04X\n",
@@ -101,10 +101,10 @@ static void bcma_pmu_swreg_init(struct bcma_drv_cc *cc)struct bcma_bus *bus = cc->core->bus;switch (bus->chipinfo.id) { -case 0x4313 : -case 0x4331 : -case 43224 : -case 43225 : +case BCMA_CHIP_ID_BCM4313 : +case BCMA_CHIP_ID_BCM4331 : +case BCMA_CHIP_ID_BCM43224 : +case BCMA_CHIP_ID_BCM43225 :break ;default : pr_err("PMU switch/regulators init unknown for device "
@@ -138,15 +138,15 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)struct bcma_bus *bus = cc->core->bus;switch (bus->chipinfo.id) { -case 0x4313 : +case BCMA_CHIP_ID_BCM4313 :bcma_chipco_chipctl_maskset (cc,0 , ~0 ,0x7 );break ; -case 0x4331 : -case 43431 : +case BCMA_CHIP_ID_BCM4331 : +case BCMA_CHIP_ID_BCM43431 :/* Ext PA lines must be enabled for tx on BCM4331 */ bcma_chipco_bcm4331_ext_pa_lines_ctl (cc, true);break ; -case 43224 : +case BCMA_CHIP_ID_BCM43224 :if (bus->chipinfo.rev ==0 ) {pr_err ("Workarounds for 43224 rev 0 not fully " "implemented\n" );
@@ -155,7 +155,7 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)bcma_chipco_chipctl_maskset (cc,0 , ~0 ,0xF0 ); }break ; -case 43225 : +case BCMA_CHIP_ID_BCM43225 :break ;default : pr_err("Workarounds unknown for device 0x%04X\n",
@@ -194,17 +194,17 @@ u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc)struct bcma_bus *bus = cc->core->bus;switch (bus->chipinfo.id) { -case 0x4716 : -case 0x4748 : -case 47162 : -case 0x4313 : -case 0x5357 : -case 0x4749 : -case 53572 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4313 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM53572 :/* always 20Mhz */ return 20000 *1000 ; -case 0x5356 : -case 0x5300 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM4706 :/* always 25Mhz */ return 25000 *1000 ;default :
@@ -227,7 +227,8 @@ static u32 bcma_pmu_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m)BUG_ON (!m || m >4 ); -if (bus->chipinfo.id ==0x5357 || bus->chipinfo.id ==0x4749 ) { +if (bus->chipinfo.id ==BCMA_CHIP_ID_BCM5357 || + bus->chipinfo.id ==BCMA_CHIP_ID_BCM4749 ) {/* Detect failure in clock setting */ tmp =bcma_cc_read32 (cc,BCMA_CC_CHIPSTAT );if (tmp &0x40000 )
@@ -259,22 +260,22 @@ static u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc)struct bcma_bus *bus = cc->core->bus;switch (bus->chipinfo.id) { -case 0x4716 : -case 0x4748 : -case 47162 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 :return bcma_pmu_clock (cc,BCMA_CC_PMU4716_MAINPLL_PLL0 ,BCMA_CC_PMU5_MAINPLL_SSB ); -case 0x5356 : +case BCMA_CHIP_ID_BCM5356 :return bcma_pmu_clock (cc,BCMA_CC_PMU5356_MAINPLL_PLL0 ,BCMA_CC_PMU5_MAINPLL_SSB ); -case 0x5357 : -case 0x4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM4749 :return bcma_pmu_clock (cc,BCMA_CC_PMU5357_MAINPLL_PLL0 ,BCMA_CC_PMU5_MAINPLL_SSB ); -case 0x5300 : +case BCMA_CHIP_ID_BCM4706 :return bcma_pmu_clock (cc,BCMA_CC_PMU4706_MAINPLL_PLL0 ,BCMA_CC_PMU5_MAINPLL_SSB ); -case 53572 : +case BCMA_CHIP_ID_BCM53572 :return 75000000 ;default : pr_warn("No backplane clock specified for %04X device, "
@@ -289,17 +290,17 @@ u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc) {struct bcma_bus *bus = cc->core->bus; -if (bus->chipinfo.id ==53572 ) +if (bus->chipinfo.id ==BCMA_CHIP_ID_BCM53572 )return 300000000 ;if (cc->pmu.rev >=5 ) {u32 pll;switch (bus->chipinfo.id) { -case 0x5356 : +case BCMA_CHIP_ID_BCM5356 : pll =BCMA_CC_PMU5356_MAINPLL_PLL0 ;break ; -case 0x5357 : -case 0x4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM4749 : pll =BCMA_CC_PMU5357_MAINPLL_PLL0 ;break ;default :
@@ -307,7 +308,7 @@ u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc)break ; } -/* TODO: if (bus->chipinfo.id == 0x5300) +/* TODO: if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) return si_4706_pmu_clock(sih, osh, cc, PMU4706_MAINPLL_PLL0, PMU5_MAINPLL_CPU); */ return bcma_pmu_clock (cc, pll,BCMA_CC_PMU5_MAINPLL_CPU ); }
drivers/bcma/driver_mips.c +4 -4
@@ -22,15 +22,15 @@/* The 47162a0 hangs when reading MIPS DMP registers registers */ static inline bool bcma_core_mips_bcm47162a0_quirk (struct bcma_device *dev) { -return dev->bus->chipinfo.id ==47162 && dev->bus->chipinfo.rev ==0 && - dev->id.id ==BCMA_CORE_MIPS_74K ; +return dev->bus->chipinfo.id ==BCMA_CHIP_ID_BCM47162 && + dev->bus->chipinfo.rev ==0 && dev->id.id ==BCMA_CORE_MIPS_74K ; }/* The 5357b0 hangs when reading USB20H DMP registers */ static inline bool bcma_core_mips_bcm5357b0_quirk (struct bcma_device *dev) { -return (dev->bus->chipinfo.id ==0x5357 || - dev->bus->chipinfo.id ==0x4749 ) && +return (dev->bus->chipinfo.id ==BCMA_CHIP_ID_BCM5357 || + dev->bus->chipinfo.id ==BCMA_CHIP_ID_BCM4749 ) && dev->bus->chipinfo.pkg ==11 && dev->id.id ==BCMA_CORE_USB20_HOST ; }
drivers/bcma/driver_pci_host.c +5 -3
@@ -215,7 +215,8 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev, }else {writel (val, mmio); -if (chipid ==0x4716 || chipid ==0x4748 ) +if (chipid ==BCMA_CHIP_ID_BCM4716 || + chipid ==BCMA_CHIP_ID_BCM4748 )readl (mmio); }
@@ -434,13 +435,14 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc)* as mips can't generate 64-bit address on the * backplane. */ -if (bus->chipinfo.id ==0x4716 || bus->chipinfo.id ==0x4748 ) { +if (bus->chipinfo.id ==BCMA_CHIP_ID_BCM4716 || + bus->chipinfo.id ==BCMA_CHIP_ID_BCM4748 ) { pc_host->mem_resource.start =BCMA_SOC_PCI_MEM ; pc_host->mem_resource.end =BCMA_SOC_PCI_MEM +BCMA_SOC_PCI_MEM_SZ -1 ;pcicore_write32 (pc,BCMA_CORE_PCI_SBTOPCI0 ,BCMA_CORE_PCI_SBTOPCI_MEM |BCMA_SOC_PCI_MEM ); - }else if (bus->chipinfo.id ==0x5300 ) { + }else if (bus->chipinfo.id ==BCMA_CHIP_ID_BCM4706 ) { tmp =BCMA_CORE_PCI_SBTOPCI_MEM ; tmp |=BCMA_CORE_PCI_SBTOPCI_PREF ; tmp |=BCMA_CORE_PCI_SBTOPCI_BURST ;
drivers/bcma/sprom.c +10 -8
@@ -468,11 +468,11 @@ static bool bcma_sprom_ext_available(struct bcma_bus *bus)/* older chipcommon revisions use chip status register */ chip_status =bcma_read32 (bus->drv_cc.core,BCMA_CC_CHIPSTAT );switch (bus->chipinfo.id) { -case 0x4313 : +case BCMA_CHIP_ID_BCM4313 : present_mask =BCMA_CC_CHIPST_4313_SPROM_PRESENT ;break ; -case 0x4331 : +case BCMA_CHIP_ID_BCM4331 : present_mask =BCMA_CC_CHIPST_4331_SPROM_PRESENT ;break ;
@@ -494,16 +494,16 @@ static bool bcma_sprom_onchip_available(struct bcma_bus *bus) chip_status =bcma_read32 (bus->drv_cc.core,BCMA_CC_CHIPSTAT );switch (bus->chipinfo.id) { -case 0x4313 : +case BCMA_CHIP_ID_BCM4313 : present = chip_status &BCMA_CC_CHIPST_4313_OTP_PRESENT ;break ; -case 0x4331 : +case BCMA_CHIP_ID_BCM4331 : present = chip_status &BCMA_CC_CHIPST_4331_OTP_PRESENT ;break ; -case 43224 : -case 43225 : +case BCMA_CHIP_ID_BCM43224 : +case BCMA_CHIP_ID_BCM43225 :/* for these chips OTP is always available */ present = true;break ;
@@ -579,13 +579,15 @@ int bcma_sprom_get(struct bcma_bus *bus)if (!sprom)return -ENOMEM ; -if (bus->chipinfo.id ==0x4331 || bus->chipinfo.id ==43431 ) +if (bus->chipinfo.id ==BCMA_CHIP_ID_BCM4331 || + bus->chipinfo.id ==BCMA_CHIP_ID_BCM43431 )bcma_chipco_bcm4331_ext_pa_lines_ctl (&bus->drv_cc, false);pr_debug ("SPROM offset 0x%x\n" , offset);bcma_sprom_read (bus, offset, sprom); -if (bus->chipinfo.id ==0x4331 || bus->chipinfo.id ==43431 ) +if (bus->chipinfo.id ==BCMA_CHIP_ID_BCM4331 || + bus->chipinfo.id ==BCMA_CHIP_ID_BCM43431 )bcma_chipco_bcm4331_ext_pa_lines_ctl (&bus->drv_cc, true); err =bcma_sprom_valid (sprom);
include/linux/bcma/bcma.h +30 -0
@@ -130,6 +130,36 @@ struct bcma_host_ops {#define BCMA_MAX_NR_CORES 16 +/* Chip IDs of PCIe devices */ +#define BCMA_CHIP_ID_BCM4313 0x4313 +#define BCMA_CHIP_ID_BCM43224 43224 +#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8 +#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa +#define BCMA_CHIP_ID_BCM43225 43225 +#define BCMA_CHIP_ID_BCM43227 43227 +#define BCMA_CHIP_ID_BCM43228 43228 +#define BCMA_CHIP_ID_BCM43421 43421 +#define BCMA_CHIP_ID_BCM43428 43428 +#define BCMA_CHIP_ID_BCM43431 43431 +#define BCMA_CHIP_ID_BCM43460 43460 +#define BCMA_CHIP_ID_BCM4331 0x4331 +#define BCMA_CHIP_ID_BCM6362 0x6362 +#define BCMA_CHIP_ID_BCM4360 0x4360 +#define BCMA_CHIP_ID_BCM4352 0x4352 + +/* Chip IDs of SoCs */ +#define BCMA_CHIP_ID_BCM4706 0x5300 +#define BCMA_CHIP_ID_BCM4716 0x4716 +#define BCMA_PKG_ID_BCM4716 8 +#define BCMA_PKG_ID_BCM4717 9 +#define BCMA_PKG_ID_BCM4718 10 +#define BCMA_CHIP_ID_BCM47162 47162 +#define BCMA_CHIP_ID_BCM4748 0x4748 +#define BCMA_CHIP_ID_BCM4749 0x4749 +#define BCMA_CHIP_ID_BCM5356 0x5356 +#define BCMA_CHIP_ID_BCM5357 0x5357 +#define BCMA_CHIP_ID_BCM53572 53572 +struct bcma_device {struct bcma_bus *bus;struct bcma_device_id id;
Signature · 1 line
1.7.9.5
PATCH 2/8 bcma: add constants for chip ids
Quoted 2 lines · Hauke Mehrtens
The chip IDs are used all over bcma and no constants where defined. This patch adds the constants and makes bcma use them.
Quoted 8 lines
Signed-off-by Hauke Mehrtens <[email protected]>--- drivers/bcma/driver_chipcommon_pmu.c | 81 +++++++++++++++++----------------- drivers/bcma/driver_mips.c | 8 ++-- drivers/bcma/driver_pci_host.c | 8 ++-- drivers/bcma/sprom.c | 18 ++++---- include/linux/bcma/bcma.h | 30 +++++++++++++ 5 files changed, 90 insertions(+), 55 deletions(-)
PATCH 3/8 bcma: Fix for 4329b0 bad LPOM is detection
In reply to Hauke MehrtensThis workaround should be triggered based on the chipid and rev and not the core id and rev. This is based on code in the Broadcom SDK.
--- drivers/bcma/driver_chipcommon_pmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bcma/driver_chipcommon_pmu.c +2 -1
@@ -166,6 +166,7 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)void bcma_pmu_init (struct bcma_drv_cc *cc) {u32 pmucap; +struct bcma_bus *bus = cc->core->bus; pmucap =bcma_cc_read32 (cc,BCMA_CC_PMU_CAP ); cc->pmu.rev = (pmucap &BCMA_CC_PMU_CAP_REVISION );
@@ -180,7 +181,7 @@ void bcma_pmu_init(struct bcma_drv_cc *cc)bcma_cc_set32 (cc,BCMA_CC_PMU_CTL ,BCMA_CC_PMU_CTL_NOILPONW ); -if (cc->core->id.id ==0x4329 && cc->core->id.rev ==2 ) +if (bus->chipinfo.id ==0x4329 && bus->chipinfo.rev ==2 )pr_err ("Fix for 4329b0 bad LPOM state not implemented!\n" );bcma_pmu_pll_init (cc);
Signature · 1 line
1.7.9.5
PATCH 3/8 bcma: Fix for 4329b0 bad LPOM is detection
Hi Hauke,
Review
Quoted 9 lines · On Tuesday 05 June 2012 23:55:02 Hauke Mehrtens wrote:
This workaround should be triggered based on the chipid and rev and not the core id and rev. This is based on code in the Broadcom SDK.
Signed-off-by Hauke Mehrtens <[email protected]>--- drivers/bcma/driver_chipcommon_pmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/bcma/driver_chipcommon_pmu.c
Quoted 12 lines
index da8769e..dd2b55d 100644
drivers/bcma/driver_chipcommon_pmu.c +1
-0@@ -166,6 +166,7 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)void bcma_pmu_init (struct bcma_drv_cc *cc) {u32 pmucap; +struct bcma_bus *bus = cc->core->bus; pmucap =bcma_cc_read32 (cc,BCMA_CC_PMU_CAP ); cc->pmu.rev = (pmucap &BCMA_CC_PMU_CAP_REVISION );
drivers/bcma/driver_chipcommon_pmu.c void bcma_pmu_init(struct bcma_drv_cc *cc) · line 185
Quoted 6 lines
drivers/bcma/driver_chipcommon_pmu.c +1
-1@@ -180,7 +181,7 @@ void bcma_pmu_init(struct bcma_drv_cc *cc)bcma_cc_set32 (cc,BCMA_CC_PMU_CTL ,BCMA_CC_PMU_CTL_NOILPONW ); -if (cc->core->id.id ==0x4329 && cc->core->id.rev ==2 ) +if (bus->chipinfo.id ==0x4329 && bus->chipinfo.rev ==2 )pr_err ("Fix for 4329b0 bad LPOM state not implemented!\n" );
Does not that deserve a new define to be in line with your previous patch? --
Florian
PATCH 3/8 bcma: Fix for 4329b0 bad LPOM is detection
Quoted 28 lines · Florian Fainelli
Hi Hauke,
Review
Quoted 9 lines · On Tuesday 05 June 2012 23:55:02 Hauke Mehrtens wrote:
This workaround should be triggered based on the chipid and rev and not the core id and rev. This is based on code in the Broadcom SDK.
Signed-off-by Hauke Mehrtens <[email protected]>--- drivers/bcma/driver_chipcommon_pmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/bcma/driver_chipcommon_pmu.cQuoted 15 lines
index da8769e..dd2b55d 100644
drivers/bcma/driver_chipcommon_pmu.c +1
-0@@ -166,6 +166,7 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)void bcma_pmu_init (struct bcma_drv_cc *cc) {u32 pmucap; +struct bcma_bus *bus = cc->core->bus; pmucap =bcma_cc_read32 (cc,BCMA_CC_PMU_CAP ); cc->pmu.rev = (pmucap &BCMA_CC_PMU_CAP_REVISION );@@ -180,7 +181,7 @@ void bcma_pmu_init(struct bcma_drv_cc *cc)bcma_cc_set32 (cc,BCMA_CC_PMU_CTL ,BCMA_CC_PMU_CTL_NOILPONW );
Quoted 7 lines
drivers/bcma/driver_chipcommon_pmu.c void bcma_pmu_init(struct bcma_drv_cc *cc) · line 185
Quoted 3 lines
drivers/bcma/driver_chipcommon_pmu.c +1
-1-if (cc->core->id.id ==0x4329 && cc->core->id.rev ==2 ) +if (bus->chipinfo.id ==0x4329 && bus->chipinfo.rev ==2 )pr_err ("Fix for 4329b0 bad LPOM state not implemented!\n" );Does not that deserve a new define to be in line with your previous patch? --
Florian
Probably we can remove this completely. The BCM4329 is a fullmac chip mostly used in phones and this part is done in the firmware.
Hauke
PATCH 3/8 bcma: Fix for 4329b0 bad LPOM is detection
Quoted 13 lines · Hauke Mehrtens
Quoted 11 lines · Florian Fainelli
Hi Hauke,
drivers/bcma/driver_chipcommon_pmu.c void bcma_pmu_init(struct bcma_drv_cc *cc) · line 185
Quoted 4 lines · On Tuesday 05 June 2012 23:55:02 Hauke Mehrtens wrote:
drivers/bcma/driver_chipcommon_pmu.c +1
-1-if (cc->core->id.id ==0x4329 && cc->core->id.rev ==2 ) +if (bus->chipinfo.id ==0x4329 && bus->chipinfo.rev ==2 )pr_err ("Fix for 4329b0 bad LPOM state not implemented!\n" );Does not that deserve a new define to be in line with your previous patch? --
Florian
Quoted 2 lines
Probably we can remove this completely. The BCM4329 is a fullmac chip mostly used in phones and this part is done in the firmware.
That is correct. PMU initialization is done in the firmware for a fullmac device.
Gr. AvS
PATCH 4/8 bcma: add PCI ID for BCM43224
In reply to Hauke MehrtensThis ID was found on the PCIe wireless card on the board of a Netgear WNDR3400 using a bcm4716. The device with this ID is identified by b43 as "Broadcom 43224 WLAN".
--- drivers/bcma/host_pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/bcma/host_pci.c +1 -0
@@ -269,6 +269,7 @@ static SIMPLE_DEV_PM_OPS(bcma_pm_ops, bcma_host_pci_suspend,static DEFINE_PCI_DEVICE_TABLE (bcma_pci_bridge_tbl) = { {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x0576 ) }, + {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,43224 ) }, {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4331 ) }, {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4353 ) }, {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4357 ) },
Signature · 1 line
1.7.9.5
PATCH 5/8 bcma: complete workaround for BCMA43224 and BCM4313
In reply to Hauke MehrtensThis code is based on the Broadcom SDK and brcmsmac.
--- drivers/bcma/driver_chipcommon_pmu.c | 22 +++++++++++++++++----- include/linux/bcma/bcma_driver_chipcommon.h | 8 ++++++++ 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/bcma/driver_chipcommon_pmu.c +17 -5
@@ -139,7 +139,11 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)switch (bus->chipinfo.id) {case BCMA_CHIP_ID_BCM4313 : -bcma_chipco_chipctl_maskset (cc,0 , ~0 ,0x7 ); +/* enable 12 mA drive strenth for 4313 and set chipControl +register bit 1 */ +bcma_chipco_chipctl_maskset (cc,0 , +BCMA_CCTRL_4313_12MA_LED_DRIVE , +BCMA_CCTRL_4313_12MA_LED_DRIVE );break ;case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43431 :
@@ -147,12 +151,20 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)bcma_chipco_bcm4331_ext_pa_lines_ctl (cc, true);break ;case BCMA_CHIP_ID_BCM43224 : +case BCMA_CHIP_ID_BCM43421 : +/* enable 12 mA drive strenth for 43224 and set chipControl +register bit 15 */ if (bus->chipinfo.rev ==0 ) { -pr_err ("Workarounds for 43224 rev 0 not fully " -"implemented\n" ); -bcma_chipco_chipctl_maskset (cc,0 , ~0 ,0x00F000F0 ); +bcma_cc_maskset32 (cc,BCMA_CC_CHIPCTL , +BCMA_CCTRL_43224_GPIO_TOGGLE , +BCMA_CCTRL_43224_GPIO_TOGGLE ); +bcma_chipco_chipctl_maskset (cc,0 , +BCMA_CCTRL_43224A0_12MA_LED_DRIVE , +BCMA_CCTRL_43224A0_12MA_LED_DRIVE ); }else { -bcma_chipco_chipctl_maskset (cc,0 , ~0 ,0xF0 ); +bcma_chipco_chipctl_maskset (cc,0 , +BCMA_CCTRL_43224B0_12MA_LED_DRIVE , +BCMA_CCTRL_43224B0_12MA_LED_DRIVE ); }break ;case BCMA_CHIP_ID_BCM43225 :
include/linux/bcma/bcma_driver_chipcommon.h +8 -0
@@ -325,6 +325,14 @@#define BCMA_CHIPCTL_4331_BT_SHD0_ON_GPIO4 BIT(16)/* enable bt_shd0 at gpio4 */ #define BCMA_CHIPCTL_4331_BT_SHD1_ON_GPIO5 BIT(17)/* enable bt_shd1 at gpio5 */ +/* 43224 chip-specific ChipControl register bits */ +#define BCMA_CCTRL_43224_GPIO_TOGGLE 0x8000/* gpio[3:0] pins as btcoex or s/w gpio */ +#define BCMA_CCTRL_43224A0_12MA_LED_DRIVE 0x00F000F0/* 12 mA drive strength */ +#define BCMA_CCTRL_43224B0_12MA_LED_DRIVE 0xF0/* 12 mA drive strength for later 43224s */ + +/* 4313 Chip specific ChipControl register bits */ +#define BCMA_CCTRL_4313_12MA_LED_DRIVE 0x00000007/* 12 mA drive strengh for later 4313 */ +/* Data for the PMU, if available. * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) */
Signature · 1 line
1.7.9.5
PATCH 6/8 bcma: handle SoCs in pmu initialization
In reply to Hauke MehrtensThe SoCs do not need any special handling in bcma_pmu_pll_init(), bcma_pmu_resources_init(), bcma_pmu_swreg_init() and bcma_pmu_workarounds. This patches suppresses some warnings in the log.
--- drivers/bcma/driver_chipcommon_pmu.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/bcma/driver_chipcommon_pmu.c +32 -0
@@ -63,6 +63,14 @@ static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43224 :case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("PLL init unknown for device 0x%04X\n",
@@ -83,6 +91,14 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43224 :case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("PMU resource config unknown for device 0x%04X\n",
@@ -105,6 +121,14 @@ static void bcma_pmu_swreg_init(struct bcma_drv_cc *cc)case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43224 :case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("PMU switch/regulators init unknown for device "
@@ -168,6 +192,14 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc) }break ;case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("Workarounds unknown for device 0x%04X\n",
Signature · 1 line
1.7.9.5
PATCH 6/8 bcma: handle SoCs in pmu initialization
Hi Hauke,
Quoted 3 lines · On Tuesday 05 June 2012 23:55:05 Hauke Mehrtens wrote:
The SoCs do not need any special handling in
bcma_pmu_pll_init(),bcma_pmu_resources_init(),bcma_pmu_swreg_init()andbcma_pmu_workarounds. This patches suppresses some warnings in the log.
This does not look like it scales very good, how about you turn the pr_err() into a pr_debug() so that developpers porting bcma on a new chip need to turn on the appropriate debug knobs to get the message?
Quoted 4 lines
Signed-off-by Hauke Mehrtens <[email protected]>--- drivers/bcma/driver_chipcommon_pmu.c | 32
++++++++++++++++++++++++++++++++
Review
Quoted 3 lines
1 file changed, 32 insertions(+)(quoted diff) +0
-0
b/drivers/bcma/driver_chipcommon_pmu.c
drivers/bcma/driver_chipcommon_pmu.c static void bcma_pmu_resources_init(struct bcma_drv_cc
Quoted 19 lines
index 2ebba9c..9bf2dff 100644
drivers/bcma/driver_chipcommon_pmu.c +8
-0@@ -63,6 +63,14 @@ static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43224 :case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("PLL init unknown for device 0x%04X\n",@@ -83,6 +91,14 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc
*cc)
drivers/bcma/driver_chipcommon_pmu.c static void bcma_pmu_workarounds(struct bcma_drv_cc
Quoted 30 lines
drivers/bcma/driver_chipcommon_pmu.c +16
-0case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43224 :case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("PMU resource config unknown for device 0x%04X\n",@@ -105,6 +121,14 @@ static void bcma_pmu_swreg_init(struct bcma_drv_cc *cc)case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43224 :case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("PMU switch/regulators init unknown for device "@@ -168,6 +192,14 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc
*cc)
Quoted 21 lines
drivers/bcma/driver_chipcommon_pmu.c +8
-0}break ;case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("Workarounds unknown for device 0x%04X\n",Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Florian
PATCH 6/8 bcma: handle SoCs in pmu initialization
Quoted 10 lines · Florian Fainelli
Hi Hauke,
Quoted 3 lines · On Tuesday 05 June 2012 23:55:05 Hauke Mehrtens wrote:
The SoCs do not need any special handling in
bcma_pmu_pll_init(),bcma_pmu_resources_init(),bcma_pmu_swreg_init()andbcma_pmu_workarounds. This patches suppresses some warnings in the log.This does not look like it scales very good, how about you turn the
pr_err()into apr_debug()so that developpers porting bcma on a new chip need to turn on the appropriate debug knobs to get the message?
I would more like to remove this message completely so that the default case does nothing. A developer should be capable of finding this function without any debug message when he wants to add support for a new device.
Quoted 75 lines
Quoted 3 lines
Signed-off-by Hauke Mehrtens <[email protected]>--- drivers/bcma/driver_chipcommon_pmu.c | 32++++++++++++++++++++++++++++++++
Review
Quoted 3 lines
1 file changed, 32 insertions(+)(quoted diff) +0
-0
b/drivers/bcma/driver_chipcommon_pmu.cdrivers/bcma/driver_chipcommon_pmu.c static void bcma_pmu_resources_init(struct bcma_drv_cc
Quoted 19 lines
index 2ebba9c..9bf2dff 100644
drivers/bcma/driver_chipcommon_pmu.c +8
-0@@ -63,6 +63,14 @@ static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43224 :case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("PLL init unknown for device 0x%04X\n",@@ -83,6 +91,14 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc*cc)
drivers/bcma/driver_chipcommon_pmu.c static void bcma_pmu_workarounds(struct bcma_drv_cc
Quoted 30 lines
drivers/bcma/driver_chipcommon_pmu.c +16
-0case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43224 :case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("PMU resource config unknown for device 0x%04X\n",@@ -105,6 +121,14 @@ static void bcma_pmu_swreg_init(struct bcma_drv_cc *cc)case BCMA_CHIP_ID_BCM4331 :case BCMA_CHIP_ID_BCM43224 :case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("PMU switch/regulators init unknown for device "@@ -168,6 +192,14 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc*cc)
Quoted 16 lines
drivers/bcma/driver_chipcommon_pmu.c +8
-0}break ;case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM5356 : +case BCMA_CHIP_ID_BCM53572 : +case BCMA_CHIP_ID_BCM4706 :break ;default : pr_err("Workarounds unknown for device 0x%04X\n",Signature · 1 line
1.7.9.5
Rafał Miłecki
maintainerPATCH 6/8 bcma: handle SoCs in pmu initialization
In reply to Florian Fainelli2012/6/6 Florian Fainelli <[email protected]>:
Quoted 10 lines
Hi Hauke,
Quoted 3 lines · On Tuesday 05 June 2012 23:55:05 Hauke Mehrtens wrote:
The SoCs do not need any special handling in
bcma_pmu_pll_init(),bcma_pmu_resources_init(),bcma_pmu_swreg_init()andbcma_pmu_workarounds. This patches suppresses some warnings in the log.This does not look like it scales very good, how about you turn the
pr_err()into apr_debug()so that developpers porting bcma on a new chip need to turn on the appropriate debug knobs to get the message?
debug sounds fine for me
Signature · 1 line
Rafa?
PATCH 6/8 bcma: handle SoCs in pmu initialization
Quoted 8 lines · Rafa? Mi?ecki
2012/6/6 Florian Fainelli <[email protected]>:
Quoted 7 lines
Hi Hauke,
Quoted 3 lines · On Tuesday 05 June 2012 23:55:05 Hauke Mehrtens wrote:
The SoCs do not need any special handling in
bcma_pmu_pll_init(),bcma_pmu_resources_init(),bcma_pmu_swreg_init()andbcma_pmu_workarounds. This patches suppresses some warnings in the log.
Quoted 6 lines
Quoted 3 lines
This does not look like it scales very good, how about you turn the
pr_err()into apr_debug()so that developpers porting bcma on a new chip need to turn on the appropriate debug knobs to get the message?debug sounds fine for me
Hi Rafa?,
bcma_pmu_swreg_init() and bcma_pmu_pll_init() are doing nothing should they get removed? In the current version of the patch I also removed the chip ids of the PCIe based cards from the switch case statement if they just ended in a break, is that ok with you?
Hauke
Rafał Miłecki
maintainerPATCH 6/8 bcma: handle SoCs in pmu initialization
2012/6/10 Hauke Mehrtens <[email protected]>:
Quoted 13 lines · Rafa? Mi?ecki
Quoted 12 lines
2012/6/6 Florian Fainelli <[email protected]>:
Quoted 10 lines
Hi Hauke,
Quoted 3 lines · On Tuesday 05 June 2012 23:55:05 Hauke Mehrtens wrote:
The SoCs do not need any special handling in
bcma_pmu_pll_init(),bcma_pmu_resources_init(),bcma_pmu_swreg_init()andbcma_pmu_workarounds. This patches suppresses some warnings in the log.This does not look like it scales very good, how about you turn the
pr_err()into apr_debug()so that developpers porting bcma on a new chip need to turn on the appropriate debug knobs to get the message?
Quoted 8 lines
Quoted 2 lines
debug sounds fine for me
Hi Rafa?,
bcma_pmu_swreg_init()andbcma_pmu_pll_init()are doing nothing should they get removed? In the current version of the patch I also removed the chip ids of the PCIe based cards from the switch case statement if they just ended in a break, is that ok with you?
Original si_pmu_pll_init had some meaning for BCM4329, BCM4319, BCM4336 and BCM4330. I guess all of them are fullmac devices, right?
Original si_pmu_swreg_init got meaning for BCM4336 and BCM4336.
Seems both can be dropped?
Signature · 1 line
Rafa?
PATCH 6/8 bcma: handle SoCs in pmu initialization
Quoted 23 lines · Rafa? Mi?ecki
2012/6/10 Hauke Mehrtens <[email protected]>:
Quoted 13 lines · Rafa? Mi?ecki
Quoted 12 lines
2012/6/6 Florian Fainelli <[email protected]>:
Quoted 10 lines
Hi Hauke,
Quoted 3 lines · On Tuesday 05 June 2012 23:55:05 Hauke Mehrtens wrote:
The SoCs do not need any special handling in
bcma_pmu_pll_init(),bcma_pmu_resources_init(),bcma_pmu_swreg_init()andbcma_pmu_workarounds. This patches suppresses some warnings in the log.This does not look like it scales very good, how about you turn the
pr_err()into apr_debug()so that developpers porting bcma on a new chip need to turn on the appropriate debug knobs to get the message?Quoted 8 lines
Quoted 2 lines
debug sounds fine for me
Hi Rafa?,
bcma_pmu_swreg_init()andbcma_pmu_pll_init()are doing nothing should they get removed? In the current version of the patch I also removed the chip ids of the PCIe based cards from the switch case statement if they just ended in a break, is that ok with you?
Quoted 7 lines
Original
si_pmu_pll_inithad some meaning for BCM4329, BCM4319, BCM4336 and BCM4330. I guess all of them are fullmac devices, right?Original
si_pmu_swreg_initgot meaning for BCM4336 and BCM4336.Seems both can be dropped?
I also check it with the BSD licensed code I have here and these functions are only containing code for fullmac chips as I see.
I am for dropping them.
Hauke
PATCH 7/8 bcma: add bcma_pmu_spuravoid_pllupdate()
In reply to Hauke MehrtensThis function is needed by brcmsmac. This code is based on code from the Broadcom SDK.
--- drivers/bcma/driver_chipcommon_pmu.c | 211 ++++++++++++++++++++++++++- include/linux/bcma/bcma_driver_chipcommon.h | 14 ++ 2 files changed, 224 insertions(+), 1 deletion(-)
drivers/bcma/driver_chipcommon_pmu.c +210 -1
@@ -3,7 +3,8 @@* ChipCommon Power Management Unit driver * * Copyright 2009, Michael Buesch <[email protected]> -* Copyright 2007, Broadcom Corporation +* Copyright 2007, 2011, Broadcom Corporation +* Copyright 2011, 2012, Hauke Mehrtens <[email protected]> * * Licensed under the GNU/GPL. See COPYING for details. */
@@ -360,3 +361,211 @@ u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc)return bcma_pmu_get_clockcontrol (cc); } + +void bcma_pmu_spuravoid_pllupdate (struct bcma_drv_cc *cc,int spuravoid) +{ +u32 tmp =0 ; +u8 phypll_offset =0 ; +u8 bcm5357_bcm43236_p1div[] = {0x1 ,0x5 ,0x5 }; +u8 bcm5357_bcm43236_ndiv[] = {0x30 ,0xf6 ,0xfc }; +struct bcma_bus *bus = cc->core->bus; + +switch (bus->chipinfo.id) { +case BCMA_CHIP_ID_BCM5357 : +case BCMA_CHIP_ID_BCM4749 : +case BCMA_CHIP_ID_BCM6362 : +case BCMA_CHIP_ID_BCM53572 : + +if (bus->chipinfo.id ==BCMA_CHIP_ID_BCM6362 && + bus->chipinfo.rev ==0 ) { +/* 6362a0 (same clks as 4322[4-6]) */ +if (spuravoid ==1 ) { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11500010 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL1 , +0x000C0C06 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x0F600a08 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL3 , +0x00000000 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL4 , +0x2001E920 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL5 , +0x88888815 ); + }else { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11100010 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL1 , +0x000c0c06 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x03000a08 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL3 , +0x00000000 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL4 , +0x200005c0 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL5 , +0x88888815 ); + } + + }else { +/* 5357[ab]0, 43236[ab]0, and 6362b0 */ + +/* BCM5357 needs to touch PLL1_PLLCTL[02], +so offset PLL0_PLLCTL[02] by 6 */ + phypll_offset = (bus->chipinfo.id ==BCMA_CHIP_ID_BCM5357 || + bus->chipinfo.id ==BCMA_CHIP_ID_BCM4749 || + bus->chipinfo.id ==BCMA_CHIP_ID_BCM53572 ) ?6 :0 ; + +/* RMW only the P1 divider */ +bcma_cc_write32 (cc,BCMA_CC_PLLCTL_ADDR , +BCMA_CC_PMU_PLL_CTL0 + phypll_offset); + tmp =bcma_cc_read32 (cc,BCMA_CC_PLLCTL_DATA ); + tmp &= (~(BCMA_CC_PMU1_PLL0_PC0_P1DIV_MASK )); + tmp |= (bcm5357_bcm43236_p1div[spuravoid] <<BCMA_CC_PMU1_PLL0_PC0_P1DIV_SHIFT ); +bcma_cc_write32 (cc,BCMA_CC_PLLCTL_DATA , tmp); + +/* RMW only the int feedback divider */ +bcma_cc_write32 (cc,BCMA_CC_PLLCTL_ADDR , +BCMA_CC_PMU_PLL_CTL2 + phypll_offset); + tmp =bcma_cc_read32 (cc,BCMA_CC_PLLCTL_DATA ); + tmp &= ~(BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK ); + tmp |= (bcm5357_bcm43236_ndiv[spuravoid]) <<BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT ; +bcma_cc_write32 (cc,BCMA_CC_PLLCTL_DATA , tmp); + } + + tmp =1 <<10 ; +break ; + +case BCMA_CHIP_ID_BCM4331 : +case BCMA_CHIP_ID_BCM43431 : +if (spuravoid ==2 ) { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11500014 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x0FC00a08 ); + }else if (spuravoid ==1 ) { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11500014 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x0F600a08 ); + }else { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11100014 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x03000a08 ); + } + tmp =1 <<10 ; +break ; + +case BCMA_CHIP_ID_BCM43224 : +case BCMA_CHIP_ID_BCM43225 : +case BCMA_CHIP_ID_BCM43421 : +if (spuravoid ==1 ) { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11500010 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL1 , +0x000C0C06 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x0F600a08 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL3 , +0x00000000 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL4 , +0x2001E920 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL5 , +0x88888815 ); + }else { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11100010 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL1 , +0x000c0c06 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x03000a08 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL3 , +0x00000000 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL4 , +0x200005c0 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL5 , +0x88888815 ); + } + tmp =1 <<10 ; +break ; + +case BCMA_CHIP_ID_BCM4716 : +case BCMA_CHIP_ID_BCM4748 : +case BCMA_CHIP_ID_BCM47162 : +if (spuravoid ==1 ) { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11500060 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL1 , +0x080C0C06 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x0F600000 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL3 , +0x00000000 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL4 , +0x2001E924 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL5 , +0x88888815 ); + }else { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11100060 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL1 , +0x080c0c06 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x03000000 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL3 , +0x00000000 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL4 , +0x200005c0 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL5 , +0x88888815 ); + } + + tmp =3 <<9 ; +break ; + +case BCMA_CHIP_ID_BCM43227 : +case BCMA_CHIP_ID_BCM43228 : +case BCMA_CHIP_ID_BCM43428 : +/* LCNXN */ +/* PLL Settings for spur avoidance on/off mode, +no on2 support for 43228A0 */ +if (spuravoid ==1 ) { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x01100014 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL1 , +0x040C0C06 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x03140A08 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL3 , +0x00333333 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL4 , +0x202C2820 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL5 , +0x88888815 ); + }else { +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL0 , +0x11100014 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL1 , +0x040c0c06 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL2 , +0x03000a08 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL3 , +0x00000000 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL4 , +0x200005c0 ); +bcma_chipco_pll_write (cc,BCMA_CC_PMU_PLL_CTL5 , +0x88888815 ); + } + tmp =1 <<10 ; +break ; +default : +pr_err ("unknown spuravoidance settings for chip 0x%04X, not" +" changing PLL\n" , bus->chipinfo.id); +break ; + } + + tmp |=bcma_cc_read32 (cc,BCMA_CC_PMU_CTL ); +bcma_cc_write32 (cc,BCMA_CC_PMU_CTL , tmp); +} +EXPORT_SYMBOL_GPL (bcma_pmu_spuravoid_pllupdate);
include/linux/bcma/bcma_driver_chipcommon.h +14 -0
@@ -308,6 +308,19 @@#define BCMA_CC_PPL_PCHI_OFF 5#define BCMA_CC_PPL_PCHI_MASK 0x0000003f +#define BCMA_CC_PMU_PLL_CTL0 0 +#define BCMA_CC_PMU_PLL_CTL1 1 +#define BCMA_CC_PMU_PLL_CTL2 2 +#define BCMA_CC_PMU_PLL_CTL3 3 +#define BCMA_CC_PMU_PLL_CTL4 4 +#define BCMA_CC_PMU_PLL_CTL5 5 + +#define BCMA_CC_PMU1_PLL0_PC0_P1DIV_MASK 0x00f00000 +#define BCMA_CC_PMU1_PLL0_PC0_P1DIV_SHIFT 20 + +#define BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK 0x1ff00000 +#define BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT 20 +/* BCM4331 ChipControl numbers. */ #define BCMA_CHIPCTL_4331_BT_COEXIST BIT(0)/* 0 disable */ #define BCMA_CHIPCTL_4331_SECI BIT(1)/* 0 SECI is disabled (JATG functional) */
@@ -420,5 +433,6 @@ extern void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask, u32 set);extern void bcma_chipco_regctl_maskset (struct bcma_drv_cc *cc,u32 offset,u32 mask,u32 set); +extern void bcma_pmu_spuravoid_pllupdate (struct bcma_drv_cc *cc,int spuravoid);#endif /* LINUX_BCMA_DRIVER_CC_H_ */
Signature · 1 line
1.7.9.5
Rafał Miłecki
maintainerPATCH 7/8 bcma: add bcma_pmu_spuravoid_pllupdate()
2012/6/5 Hauke Mehrtens <[email protected]>:
Quoted 2 lines
This function is needed by brcmsmac. This code is based on code from the Broadcom SDK.
This is already implemented in b43/phy_n.c:
/* http://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */ static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid)
I guess we should replace b43 code with a call to introduced function.
Signature · 1 line
Rafa?
PATCH 7/8 bcma: add bcma_pmu_spuravoid_pllupdate()
Quoted 11 lines · Rafa? Mi?ecki
2012/6/5 Hauke Mehrtens <[email protected]>:
Quoted 2 lines
This function is needed by brcmsmac. This code is based on code from the Broadcom SDK.
This is already implemented in
b43/phy_n.c:/* http://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */ static void
b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid)I guess we should replace b43 code with a call to introduced function.
Thanks, I looked into b43 but not long enough to find this function. I will also create a patch replacing this function in b43.
Hauke
PATCH 8/8 bcma: add mdelay bcma_pmu_resources_init()
In reply to Hauke MehrtensThis is based on code from brcmsmac.
--- drivers/bcma/driver_chipcommon_pmu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bcma/driver_chipcommon_pmu.c +3 -0
@@ -111,6 +111,9 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)bcma_cc_write32 (cc,BCMA_CC_PMU_MINRES_MSK , min_msk);if (max_msk)bcma_cc_write32 (cc,BCMA_CC_PMU_MAXRES_MSK , max_msk); + +/* Add some delay; allow resources to come up and settle. */ +mdelay (2 ); }static void bcma_pmu_swreg_init (struct bcma_drv_cc *cc)
Signature · 1 line
1.7.9.5
Rafał Miłecki
maintainercover bcma misc updates
In reply to Hauke Mehrtens2012/6/5 Hauke Mehrtens <[email protected]>:
Quoted 12 lines
These are some updates for bcma. Some are extending or completing some workarounds for PCIe based wireless cards. A patch adds
bcma_pmu_spuravoid_pllupdate, used by brcmsmac and an other patch adds constants for the chip ids. This code is mostly based on code from brcmsmac and the Broadcom SDK for BCM47XX SoCs.This was tested on a BCM4718 SoC with a BCM43224 PCIe and a BCM5357. The Wifi part of the BCM4718 and BCM43224 is more or less working with brcmsmac, which need some more patches for that, but it has low speed and some times or with some access points I still get errors. The wifi of the BCM5357 does not work.
Quoted 9 lines
Hauke Mehrtens (8):
?bcma: extend workaround for bcm4331
?bcma: add constants for chip ids
?bcma: Fix for 4329b0 bad LPOM is detection ?bcma: add PCI ID for BCM43224
?bcma: complete workaround for BCMA43224 and BCM4313 ?bcma: handle SoCs in pmu initialization ?bcma: addbcma_pmu_spuravoid_pllupdate()?bcma: add mdelaybcma_pmu_resources_init()
John: can you take the following patches from this patchset? 1/8
2/8
4/8
5/8
7/8
Following patches should be dropped:
3/8 - BCM4329 fix should be dropped, not improved
6/8 - functions touched by patch should be dropper, not improved 8/8 - patch is fine, but doesn't apply cleanly
Signature · 1 line
Rafa?
cover bcma misc updates
Quoted 30 lines · Rafa? Mi?ecki
2012/6/5 Hauke Mehrtens <[email protected]>:
Quoted 12 lines
These are some updates for bcma. Some are extending or completing some workarounds for PCIe based wireless cards. A patch adds
bcma_pmu_spuravoid_pllupdate, used by brcmsmac and an other patch adds constants for the chip ids. This code is mostly based on code from brcmsmac and the Broadcom SDK for BCM47XX SoCs.This was tested on a BCM4718 SoC with a BCM43224 PCIe and a BCM5357. The Wifi part of the BCM4718 and BCM43224 is more or less working with brcmsmac, which need some more patches for that, but it has low speed and some times or with some access points I still get errors. The wifi of the BCM5357 does not work.
Quoted 9 lines
Hauke Mehrtens (8):
?bcma: extend workaround for bcm4331
?bcma: add constants for chip ids
?bcma: Fix for 4329b0 bad LPOM is detection ?bcma: add PCI ID for BCM43224
?bcma: complete workaround for BCMA43224 and BCM4313 ?bcma: handle SoCs in pmu initialization ?bcma: addbcma_pmu_spuravoid_pllupdate()?bcma: add mdelaybcma_pmu_resources_init()John: can you take the following patches from this patchset? 1/8
2/8
4/8
5/8
7/8
Quoted 4 lines
Following patches should be dropped:
3/8 - BCM4329 fix should be dropped, not improved
6/8 - functions touched by patch should be dropper, not improved 8/8 - patch is fine, but doesn't apply cleanly
I seem to have dropped the series some time ago. Perhaps Hauke could repost the appropriate collection?
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
cover bcma misc updates
In reply to Rafał MiłeckiQuoted 30 lines · Rafa? Mi?ecki
2012/6/5 Hauke Mehrtens <[email protected]>:
Quoted 12 lines
These are some updates for bcma. Some are extending or completing some workarounds for PCIe based wireless cards. A patch adds
bcma_pmu_spuravoid_pllupdate, used by brcmsmac and an other patch adds constants for the chip ids. This code is mostly based on code from brcmsmac and the Broadcom SDK for BCM47XX SoCs.This was tested on a BCM4718 SoC with a BCM43224 PCIe and a BCM5357. The Wifi part of the BCM4718 and BCM43224 is more or less working with brcmsmac, which need some more patches for that, but it has low speed and some times or with some access points I still get errors. The wifi of the BCM5357 does not work.
Quoted 9 lines
Hauke Mehrtens (8):
bcma: extend workaround for bcm4331
bcma: add constants for chip ids
bcma: Fix for 4329b0 bad LPOM is detection
bcma: add PCI ID for BCM43224
bcma: complete workaround for BCMA43224 and BCM4313
bcma: handle SoCs in pmu initialization
bcma: addbcma_pmu_spuravoid_pllupdate()
bcma: add mdelaybcma_pmu_resources_init()John: can you take the following patches from this patchset? 1/8
2/8
4/8
5/8
7/8
Quoted 5 lines
Following patches should be dropped:
3/8 - BCM4329 fix should be dropped, not improved
6/8 - functions touched by patch should be dropper, not improved 8/8 - patch is fine, but doesn't apply cleanly
I am ok with that, but I am also planing to send a v2 of these patch series and the one for brcmsmac today.
Hauke
Rafał Miłecki
maintainercover bcma misc updates
2012/6/29 Hauke Mehrtens <[email protected]>:
Quoted 31 lines · Rafa? Mi?ecki
Quoted 30 lines
2012/6/5 Hauke Mehrtens <[email protected]>:
Quoted 12 lines
These are some updates for bcma. Some are extending or completing some workarounds for PCIe based wireless cards. A patch adds
bcma_pmu_spuravoid_pllupdate, used by brcmsmac and an other patch adds constants for the chip ids. This code is mostly based on code from brcmsmac and the Broadcom SDK for BCM47XX SoCs.This was tested on a BCM4718 SoC with a BCM43224 PCIe and a BCM5357. The Wifi part of the BCM4718 and BCM43224 is more or less working with brcmsmac, which need some more patches for that, but it has low speed and some times or with some access points I still get errors. The wifi of the BCM5357 does not work.
Quoted 9 lines
Hauke Mehrtens (8):
?bcma: extend workaround for bcm4331
?bcma: add constants for chip ids
?bcma: Fix for 4329b0 bad LPOM is detection ?bcma: add PCI ID for BCM43224
?bcma: complete workaround for BCMA43224 and BCM4313 ?bcma: handle SoCs in pmu initialization ?bcma: addbcma_pmu_spuravoid_pllupdate()?bcma: add mdelaybcma_pmu_resources_init()John: can you take the following patches from this patchset? 1/8
2/8
4/8
5/8
7/8
Quoted 7 lines
Quoted 5 lines
Following patches should be dropped:
3/8 - BCM4329 fix should be dropped, not improved
6/8 - functions touched by patch should be dropper, not improved 8/8 - patch is fine, but doesn't apply cleanlyI am ok with that, but I am also planing to send a v2 of these patch series and the one for brcmsmac today.
Hm, do you mean to change anything in 1, 2, 4, 5 or 8? To make everything apply cleanly I'd love to see your new patches based on top of my
[PATCH] bcma: use custom printing functions
Signature · 1 line
Rafa?