linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] bcma: preparation for brcmsmac using more bcma functions
@ 2013-03-27 16:23 Hauke Mehrtens
  2013-03-27 16:23 ` [PATCH 1/4] bcma: use BCMA_CC_PMU_CTL_* constants Hauke Mehrtens
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2013-03-27 16:23 UTC (permalink / raw)
  To: linville; +Cc: zajec5, linux-wireless, Hauke Mehrtens

This mostly contains patches in preparation for brcmsmac using the pmu 
functions from bcma and not using its own functions.
The first patch just replaces some magic numbers with the constants.

Hauke Mehrtens (4):
  bcma: use BCMA_CC_PMU_CTL_* constants
  bcma: handle more devices in bcma_pmu_get_alp_clock()
  bcma: export bcma_chipco_get_alp_clock()
  bcma: export some gpio functions

 drivers/bcma/driver_chipcommon.c            |    5 +++-
 drivers/bcma/driver_chipcommon_pmu.c        |   34 ++++++++++++++++++++-------
 include/linux/bcma/bcma_driver_chipcommon.h |    3 +++
 3 files changed, 32 insertions(+), 10 deletions(-)

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] bcma: use BCMA_CC_PMU_CTL_* constants
  2013-03-27 16:23 [PATCH 0/4] bcma: preparation for brcmsmac using more bcma functions Hauke Mehrtens
@ 2013-03-27 16:23 ` Hauke Mehrtens
  2013-03-27 16:23 ` [PATCH 2/4] bcma: handle more devices in bcma_pmu_get_alp_clock() Hauke Mehrtens
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2013-03-27 16:23 UTC (permalink / raw)
  To: linville; +Cc: zajec5, linux-wireless, Hauke Mehrtens

Instead of hard coding these values use the existing constants.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/bcma/driver_chipcommon_pmu.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
index 932b101..7e88fff 100644
--- a/drivers/bcma/driver_chipcommon_pmu.c
+++ b/drivers/bcma/driver_chipcommon_pmu.c
@@ -373,7 +373,7 @@ void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid)
 		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;
+		tmp = BCMA_CC_PMU_CTL_PLL_UPD;
 		break;
 
 	case BCMA_CHIP_ID_BCM4331:
@@ -394,7 +394,7 @@ void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid)
 			bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
 						     0x03000a08);
 		}
-		tmp = 1 << 10;
+		tmp = BCMA_CC_PMU_CTL_PLL_UPD;
 		break;
 
 	case BCMA_CHIP_ID_BCM43224:
@@ -427,7 +427,7 @@ void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid)
 			bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
 						     0x88888815);
 		}
-		tmp = 1 << 10;
+		tmp = BCMA_CC_PMU_CTL_PLL_UPD;
 		break;
 
 	case BCMA_CHIP_ID_BCM4716:
@@ -461,7 +461,7 @@ void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid)
 						     0x88888815);
 		}
 
-		tmp = 3 << 9;
+		tmp = BCMA_CC_PMU_CTL_PLL_UPD | BCMA_CC_PMU_CTL_NOILPONW;
 		break;
 
 	case BCMA_CHIP_ID_BCM43227:
@@ -497,7 +497,7 @@ void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid)
 			bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
 						     0x88888815);
 		}
-		tmp = 1 << 10;
+		tmp = BCMA_CC_PMU_CTL_PLL_UPD;
 		break;
 	default:
 		bcma_err(bus, "Unknown spuravoidance settings for chip 0x%04X, not changing PLL\n",
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] bcma: handle more devices in bcma_pmu_get_alp_clock()
  2013-03-27 16:23 [PATCH 0/4] bcma: preparation for brcmsmac using more bcma functions Hauke Mehrtens
  2013-03-27 16:23 ` [PATCH 1/4] bcma: use BCMA_CC_PMU_CTL_* constants Hauke Mehrtens
@ 2013-03-27 16:23 ` Hauke Mehrtens
  2013-03-27 16:23 ` [PATCH 3/4] bcma: export bcma_chipco_get_alp_clock() Hauke Mehrtens
  2013-03-27 16:23 ` [PATCH 4/4] bcma: export some gpio functions Hauke Mehrtens
  3 siblings, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2013-03-27 16:23 UTC (permalink / raw)
  To: linville; +Cc: zajec5, linux-wireless, Hauke Mehrtens

Add some more chip IDs to bcma_pmu_get_alp_clock()

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/bcma/driver_chipcommon_pmu.c        |   24 ++++++++++++++++++++----
 include/linux/bcma/bcma_driver_chipcommon.h |    1 +
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
index 7e88fff..edca73a 100644
--- a/drivers/bcma/driver_chipcommon_pmu.c
+++ b/drivers/bcma/driver_chipcommon_pmu.c
@@ -174,19 +174,35 @@ u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc)
 	struct bcma_bus *bus = cc->core->bus;
 
 	switch (bus->chipinfo.id) {
+	case BCMA_CHIP_ID_BCM4313:
+	case BCMA_CHIP_ID_BCM43224:
+	case BCMA_CHIP_ID_BCM43225:
+	case BCMA_CHIP_ID_BCM43227:
+	case BCMA_CHIP_ID_BCM43228:
+	case BCMA_CHIP_ID_BCM4331:
+	case BCMA_CHIP_ID_BCM43421:
+	case BCMA_CHIP_ID_BCM43428:
+	case BCMA_CHIP_ID_BCM43431:
 	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_BCM4748:
 	case BCMA_CHIP_ID_BCM4749:
+	case BCMA_CHIP_ID_BCM5357:
 	case BCMA_CHIP_ID_BCM53572:
+	case BCMA_CHIP_ID_BCM6362:
 		/* always 20Mhz */
 		return 20000 * 1000;
-	case BCMA_CHIP_ID_BCM5356:
 	case BCMA_CHIP_ID_BCM4706:
+	case BCMA_CHIP_ID_BCM5356:
 		/* always 25Mhz */
 		return 25000 * 1000;
+	case BCMA_CHIP_ID_BCM43460:
+	case BCMA_CHIP_ID_BCM4352:
+	case BCMA_CHIP_ID_BCM4360:
+		if (cc->status & BCMA_CC_CHIPST_4360_XTAL_40MZ)
+			return 40000 * 1000;
+		else
+			return 20000 * 1000;
 	default:
 		bcma_warn(bus, "No ALP clock specified for %04X device, pmu rev. %d, using default %d Hz\n",
 			  bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_ALP_CLOCK);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 8390c47..1db4c6d 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -104,6 +104,7 @@
 #define  BCMA_CC_CHIPST_4706_MIPS_BENDIAN	BIT(3) /* 0: little, 1: big endian */
 #define  BCMA_CC_CHIPST_4706_PCIE1_DISABLE	BIT(5) /* PCIE1 enable strap pin */
 #define  BCMA_CC_CHIPST_5357_NAND_BOOT		BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */
+#define  BCMA_CC_CHIPST_4360_XTAL_40MZ		0x00000001
 #define BCMA_CC_JCMD			0x0030		/* Rev >= 10 only */
 #define  BCMA_CC_JCMD_START		0x80000000
 #define  BCMA_CC_JCMD_BUSY		0x80000000
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] bcma: export bcma_chipco_get_alp_clock()
  2013-03-27 16:23 [PATCH 0/4] bcma: preparation for brcmsmac using more bcma functions Hauke Mehrtens
  2013-03-27 16:23 ` [PATCH 1/4] bcma: use BCMA_CC_PMU_CTL_* constants Hauke Mehrtens
  2013-03-27 16:23 ` [PATCH 2/4] bcma: handle more devices in bcma_pmu_get_alp_clock() Hauke Mehrtens
@ 2013-03-27 16:23 ` Hauke Mehrtens
  2013-03-27 16:23 ` [PATCH 4/4] bcma: export some gpio functions Hauke Mehrtens
  3 siblings, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2013-03-27 16:23 UTC (permalink / raw)
  To: linville; +Cc: zajec5, linux-wireless, Hauke Mehrtens

This function will be used by brcmsmac.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/bcma/driver_chipcommon.c            |    3 ++-
 include/linux/bcma/bcma_driver_chipcommon.h |    2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index 28fa50a..88db0cb 100644
--- a/drivers/bcma/driver_chipcommon.c
+++ b/drivers/bcma/driver_chipcommon.c
@@ -25,13 +25,14 @@ static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
 	return value;
 }
 
-static u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc)
+u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc)
 {
 	if (cc->capabilities & BCMA_CC_CAP_PMU)
 		return bcma_pmu_get_alp_clock(cc);
 
 	return 20000000;
 }
+EXPORT_SYMBOL_GPL(bcma_chipco_get_alp_clock);
 
 static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc)
 {
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 1db4c6d..453fcc9 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -608,6 +608,8 @@ void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
 
 extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
 
+extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
+
 void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);
 
 u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] bcma: export some gpio functions
  2013-03-27 16:23 [PATCH 0/4] bcma: preparation for brcmsmac using more bcma functions Hauke Mehrtens
                   ` (2 preceding siblings ...)
  2013-03-27 16:23 ` [PATCH 3/4] bcma: export bcma_chipco_get_alp_clock() Hauke Mehrtens
@ 2013-03-27 16:23 ` Hauke Mehrtens
  3 siblings, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2013-03-27 16:23 UTC (permalink / raw)
  To: linville; +Cc: zajec5, linux-wireless, Hauke Mehrtens

These functions will be used by brcmsmac.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/bcma/driver_chipcommon.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index 88db0cb..036c674 100644
--- a/drivers/bcma/driver_chipcommon.c
+++ b/drivers/bcma/driver_chipcommon.c
@@ -214,6 +214,7 @@ u32 bcma_chipco_gpio_out(struct bcma_drv_cc *cc, u32 mask, u32 value)
 
 	return res;
 }
+EXPORT_SYMBOL_GPL(bcma_chipco_gpio_out);
 
 u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value)
 {
@@ -226,6 +227,7 @@ u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value)
 
 	return res;
 }
+EXPORT_SYMBOL_GPL(bcma_chipco_gpio_outen);
 
 /*
  * If the bit is set to 0, chipcommon controlls this GPIO,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-27 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-27 16:23 [PATCH 0/4] bcma: preparation for brcmsmac using more bcma functions Hauke Mehrtens
2013-03-27 16:23 ` [PATCH 1/4] bcma: use BCMA_CC_PMU_CTL_* constants Hauke Mehrtens
2013-03-27 16:23 ` [PATCH 2/4] bcma: handle more devices in bcma_pmu_get_alp_clock() Hauke Mehrtens
2013-03-27 16:23 ` [PATCH 3/4] bcma: export bcma_chipco_get_alp_clock() Hauke Mehrtens
2013-03-27 16:23 ` [PATCH 4/4] bcma: export some gpio functions Hauke Mehrtens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).