bcm43xx: support for PCI-E devices
Subsystems (3)
cover bcm43xx: support for PCI-E devices
Can somebody with a bcm4311 or bcm4312 board please test this. This patchset adds support for PCI-E devices and includes as well some minor fixes to powercontrol, wireless core management, PCI core management.
--
Ciao
Stefano
PATCH 1/10 bcm43xx: add core ID for PCI-E core
Add core ID for PCI-E core.
drivers/net/wireless/bcm43xx/bcm43xx.h +1 -0
@@ -202,6 +202,7 @@#define BCM43xx_COREID_USB20_HOST 0x819#define BCM43xx_COREID_USB20_DEV 0x81a#define BCM43xx_COREID_SDIO_HOST 0x81b +#define BCM43xx_COREID_PCIE 0x820/* Core Information Registers */ #define BCM43xx_CIR_BASE 0xf00
--
Ciao
Stefano
PATCH 2/10 bcm43xx: functions for access to PCI-E registers and PCI-E MDIO
In reply to Stefano BrivioAdd read and write functions for PCI-E registers
Add write function for MDIO slaves.
drivers/net/wireless/bcm43xx/bcm43xx_main.c +39 -0
@@ -2973,6 +2973,45 @@ out:return err; } +static u32 bcm43xx_pcie_reg_read (struct bcm43xx_private *bcm,u32 address) +{ +bcm43xx_write32 (bcm, BCM43xx_PCIECORE_REG_ADDR, address); +return bcm43xx_read32 (bcm, BCM43xx_PCIECORE_REG_DATA); +} + +static void bcm43xx_pcie_reg_write (struct bcm43xx_private *bcm,u32 address, +u32 data) +{ +bcm43xx_write32 (bcm, BCM43xx_PCIECORE_REG_ADDR, address); +bcm43xx_write32 (bcm, BCM43xx_PCIECORE_REG_DATA, data); +} + +static int bcm43xx_pcie_mdio_write (struct bcm43xx_private *bcm,u8 dev,u8 reg, +u16 data) +{ +int i; + +bcm43xx_write32 (bcm, BCM43xx_PCIECORE_MDIO_CTL,0x0082 ); +bcm43xx_write32 (bcm, BCM43xx_PCIECORE_MDIO_DATA, BCM43xx_PCIE_MDIO_ST | + BCM43xx_PCIE_MDIO_WT | (dev << BCM43xx_PCIE_MDIO_DEV) | + (reg << BCM43xx_PCIE_MDIO_REG) | BCM43xx_PCIE_MDIO_TA | + data); +udelay (10 ); + +for (i =0 ; i <10 ; i++) { +if (bcm43xx_read32 (bcm, BCM43xx_PCIECORE_MDIO_CTL) & + BCM43xx_PCIE_MDIO_TC) +return 0 ; +udelay (1000 ); + } +if (bcm43xx_read32 (bcm, BCM43xx_PCIECORE_MDIO_CTL) & + BCM43xx_PCIE_MDIO_TC) +return 0 ; + + printk(KERN_ERR PFX "Error: MDIO transaction failed\n"); +return -EIO ; +} +/* Make an I/O Core usable. "core_mask" is the bitmask of the cores to enable. * To enable core 0, pass a core_mask of 1<<0 */
drivers/net/wireless/bcm43xx/bcm43xx.h +18 -0
@@ -154,6 +154,24 @@#define BCM43xx_SBTOPCI2_PREFETCH 0x4#define BCM43xx_SBTOPCI2_BURST 0x8 +/* PCI-E core registers. */ +#define BCM43xx_PCIECORE_REG_ADDR 0x0130 +#define BCM43xx_PCIECORE_REG_DATA 0x0134 +#define BCM43xx_PCIECORE_MDIO_CTL 0x0128 +#define BCM43xx_PCIECORE_MDIO_DATA 0x012C + +/* PCI-E registers. */ +#define BCM43xx_PCIE_TLP_WORKAROUND 0x0004 +#define BCM43xx_PCIE_DLLP_LINKCTL 0x0100 + +/* PCI-E MDIO bits. */ +#define BCM43xx_PCIE_MDIO_ST 0x40000000 +#define BCM43xx_PCIE_MDIO_WT 0x10000000 +#define BCM43xx_PCIE_MDIO_DEV 22 +#define BCM43xx_PCIE_MDIO_REG 18 +#define BCM43xx_PCIE_MDIO_TA 0x00020000 +#define BCM43xx_PCIE_MDIO_TC 0x0100 +/* Chipcommon capabilities. */ #define BCM43xx_CAPABILITIES_PCTL 0x00040000#define BCM43xx_CAPABILITIES_PLLMASK 0x00030000
--
Ciao
Stefano
PATCH 3/10 bcm43xx: fix reading core ID and revision from sb_id_hi
In reply to Stefano BrivioFix reading core ID and revision from sb_id_hi.
drivers/net/wireless/bcm43xx/bcm43xx_main.c +2 -2
@@ -2565,8 +2565,8 @@ static int bcm43xx_probe_cores(struct bc/* fetch sb_id_hi from core information registers */ sb_id_hi =bcm43xx_read32 (bcm, BCM43xx_CIR_SB_ID_HI); - core_id = (sb_id_hi &0xFFF0 ) >>4 ; - core_rev = (sb_id_hi &0xF ); + core_id = (sb_id_hi &0x8FF0 ) >>4 ; + core_rev = (sb_id_hi &0x7000 ) >>8 | (sb_id_hi &0xF ); core_vendor = (sb_id_hi &0xFFFF0000 ) >>16 ;/* if present, chipcommon is always core 0; read the chipid from it */
--
Ciao
Stefano
PATCH 4/10 bcm43xx: use PCI-E core as a PCI core, allow wireless core with rev 10
In reply to Stefano BrivioAllow for PCI-E core to be considered as PCI core. Allow revision 10 of wireless core.
drivers/net/wireless/bcm43xx/bcm43xx_main.c +2 -0
@@ -2676,6 +2676,7 @@ static int bcm43xx_probe_cores(struct bc core =NULL ;switch (core_id) {case BCM43xx_COREID_PCI: +case BCM43xx_COREID_PCIE: core = &bcm->core_pci;if (core->available) { printk(KERN_WARNING PFX "Multiple PCI cores found.\n");
@@ -2714,6 +2715,7 @@ static int bcm43xx_probe_cores(struct bccase 6 :case 7 :case 9 : +case 10 :break ;default : printk(KERN_ERR PFX "Error: Unsupported 80211 core revision %u\n",
--
Ciao
Stefano
PATCH 5/10 bcm43xx: wireless core initialization for PCI-E devices
In reply to Stefano BrivioFix wireless core initialization in order to work with PCI-E devices.
drivers/net/wireless/bcm43xx/bcm43xx_main.c +2 -7
@@ -2832,16 +2832,11 @@ static int bcm43xx_wireless_core_init(stu32 sbimconfiglow;u8 limit; -if (bcm->chip_rev <5 ) { +if (bcm->core_pci.rev <=5 && bcm->core_pci.id != BCM43xx_COREID_PCIE) { sbimconfiglow =bcm43xx_read32 (bcm, BCM43xx_CIR_SBIMCONFIGLOW); sbimconfiglow &= ~ BCM43xx_SBIMCONFIGLOW_REQUEST_TOUT_MASK; sbimconfiglow &= ~ BCM43xx_SBIMCONFIGLOW_SERVICE_TOUT_MASK; -if (bcm->bustype == BCM43xx_BUSTYPE_PCI) - sbimconfiglow |=0x32 ; -else if (bcm->bustype == BCM43xx_BUSTYPE_SB) - sbimconfiglow |=0x53 ; -else -assert (0 ); + sbimconfiglow |=0x32 ;bcm43xx_write32 (bcm, BCM43xx_CIR_SBIMCONFIGLOW, sbimconfiglow); }
--
Ciao
Stefano
PATCH 6/10 bcm43xx: fix bcm43xx_wireless_core_mark_inactive
In reply to Stefano BrivioTrivial change in specs related to bcm43xx_wireless_core_mark_inactive.
drivers/net/wireless/bcm43xx/bcm43xx_main.c +0 -1
@@ -1431,7 +1431,6 @@ static int bcm43xx_wireless_core_mark_inif (err) goto out; sbtmstatelow =bcm43xx_read32 (bcm, BCM43xx_CIR_SBTMSTATELOW); - sbtmstatelow &= ~0x20000000 ; sbtmstatelow |=0x20000000 ;bcm43xx_write32 (bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); err =bcm43xx_switch_core (bcm, old_core);
--
Ciao
Stefano
PATCH 7/10 bcm43xx: allow PHY revision 8, dont give up on unknown phy_rev
In reply to Stefano BrivioAllow a GPHY to have revision 8. Issue a warning instead of giving up when dealing with an unknown core revision.
drivers/net/wireless/bcm43xx/bcm43xx_main.c +3 -4
@@ -2717,10 +2717,9 @@ static int bcm43xx_probe_cores(struct bccase 10 :break ;default : - printk(KERN_ERR PFX "Error: Unsupported 80211 core revision %u\n", + printk(KERN_WARNING PFX +"Unsupported 80211 core revision %u\n" , core_rev); - err = -ENODEV ; - goto out; } bcm->nr_80211_available++;bcm43xx_init_struct_phyinfo (&ext_80211->phy);
@@ -3377,7 +3376,7 @@ static int bcm43xx_read_phyinfo(struct b bcm->ieee->freq_band =IEEE80211_24GHZ_BAND ;break ;case BCM43xx_PHYTYPE_G: -if (phy_rev >7 ) +if (phy_rev >8 ) phy_rev_ok =0 ; bcm->ieee->modulation =IEEE80211_OFDM_MODULATION |IEEE80211_CCK_MODULATION ;
--
Ciao
Stefano
PATCH 8/10 bcm43xx: powercontrol support for PCI-E devices
In reply to Stefano BrivioAdd powercontrol support for PCI-E devices.
drivers/net/wireless/bcm43xx/bcm43xx.h +1 -0
@@ -140,6 +140,7 @@/* Chipcommon registers. */ #define BCM43xx_CHIPCOMMON_CAPABILITIES 0x04 +#define BCM43xx_CHIPCOMMON_CTL 0x28#define BCM43xx_CHIPCOMMON_PLLONDELAY 0xB0#define BCM43xx_CHIPCOMMON_FREFSELDELAY 0xB4#define BCM43xx_CHIPCOMMON_SLOWCLKCTL 0xB8
drivers/net/wireless/bcm43xx/bcm43xx_power.c +15 -2
@@ -153,8 +153,6 @@ int bcm43xx_pctl_init(struct bcm43xx_priint err, maxfreq;struct bcm43xx_coreinfo *old_core; -if (!(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL)) -return 0 ; old_core = bcm->current_core; err =bcm43xx_switch_core (bcm, &bcm->core_chipcommon);if (err == -ENODEV )
@@ -162,6 +160,21 @@ int bcm43xx_pctl_init(struct bcm43xx_priif (err) goto out; +if (bcm->chip_id ==0x4321 ) { +if (bcm->chip_rev ==1 ) +bcm43xx_write32 (bcm, BCM43xx_CHIPCOMMON_CTL,0x00A4 ); +if (bcm->chip_rev ==0 ) +bcm43xx_write32 (bcm, BCM43xx_CHIPCOMMON_CTL,0x03A4 ); + } + +if (!(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL)) +return 0 ; + +if (bcm->current_core->rev >=10 ) +bcm43xx_write32 (bcm, BCM43xx_CHIPCOMMON_SYSCLKCTL, + (bcm43xx_read32 (bcm, BCM43xx_CHIPCOMMON_SYSCLKCTL) + &0x0000FFFF ) |0x40000 ); + maxfreq =bcm43xx_pctl_clockfreqlimit (bcm,1 );bcm43xx_write32 (bcm, BCM43xx_CHIPCOMMON_PLLONDELAY, (maxfreq *150 +999999 ) /1000000 );
--
Ciao
Stefano
PATCH 9/10 bcm43xx: backplane setup for PCI-E devices and devices with PCI core ID > 10
In reply to Stefano BrivioBackplane setup for PCI-E devices and PCI devices with PCI Core ID > 10. Use chipcommon if possible while broadcasting PCI settings.
drivers/net/wireless/bcm43xx/bcm43xx.h +9 -0
@@ -154,6 +154,7 @@/* SBTOPCI2 values. */ #define BCM43xx_SBTOPCI2_PREFETCH 0x4#define BCM43xx_SBTOPCI2_BURST 0x8 +#define BCM43xx_SBTOPCI2_MEMREAD_MULTI 0x20/* PCI-E core registers. */ #define BCM43xx_PCIECORE_REG_ADDR 0x0130
@@ -173,6 +174,14 @@#define BCM43xx_PCIE_MDIO_TA 0x00020000#define BCM43xx_PCIE_MDIO_TC 0x0100 +/* MDIO devices. */ +#define BCM43xx_MDIO_SERDES_RX 0x1F + +/* SERDES RX registers. */ +#define BCM43xx_SERDES_RXTIMER 0x2 +#define BCM43xx_SERDES_CDR 0x6 +#define BCM43xx_SERDES_CDR_BW 0x7 +/* Chipcommon capabilities. */ #define BCM43xx_CAPABILITIES_PCTL 0x00040000#define BCM43xx_CAPABILITIES_PLLMASK 0x00030000
drivers/net/wireless/bcm43xx/bcm43xx_main.c +58 -24
104 lines not on this page · raw message
--
Ciao
Stefano
PATCH 10/10 bcm43xx: add PCI ID for bcm4311
In reply to Stefano BrivioAdd PCI ID for bcm4311 PCI-E device.
drivers/net/wireless/bcm43xx/bcm43xx_main.c +2 -0
@@ -130,6 +130,8 @@ MODULE_PARM_DESC(fwpostfix, "Postfix for { PCI_VENDOR_ID_BROADCOM, 0x4301, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },/* Broadcom 4307 802.11b */ { PCI_VENDOR_ID_BROADCOM, 0x4307, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, +/* Broadcom 4311 802.11(a)/b/g */ + { PCI_VENDOR_ID_BROADCOM, 0x4311, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },/* Broadcom 4318 802.11b/g */ { PCI_VENDOR_ID_BROADCOM, 0x4318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Broadcom 4306 802.11b/g */
--
Ciao
Stefano