1 From 6d174f732e198aae8583cc5414b11b988bfd37a9 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Mon, 30 Jan 2012 22:44:15 +0100
4 Subject: [PATCH 4/4] ssb: add support for bcm5354
6 This patch adds support the the BCM5354 SoC.
7 It has a PMU and a constant not configurable clock.
9 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
11 drivers/ssb/driver_chipcommon_pmu.c | 48 +++++++++++++++++++++++++++++++---
12 drivers/ssb/driver_mipscore.c | 3 ++
13 drivers/ssb/main.c | 3 ++
14 drivers/ssb/ssb_private.h | 4 +++
15 4 files changed, 53 insertions(+), 5 deletions(-)
17 --- a/drivers/ssb/driver_chipcommon_pmu.c
18 +++ b/drivers/ssb/driver_chipcommon_pmu.c
20 #include <linux/ssb/ssb_driver_chipcommon.h>
21 #include <linux/delay.h>
22 #include <linux/export.h>
23 +#ifdef CONFIG_BCM47XX
24 +#include <asm/mach-bcm47xx/nvram.h>
27 #include "ssb_private.h"
29 @@ -92,10 +95,6 @@ static void ssb_pmu0_pllinit_r0(struct s
30 u32 pmuctl, tmp, pllctl;
33 - if ((bus->chip_id == 0x5354) && !crystalfreq) {
34 - /* The 5354 crystal freq is 25MHz */
35 - crystalfreq = 25000;
38 e = pmu0_plltab_find_entry(crystalfreq);
40 @@ -321,7 +320,11 @@ static void ssb_pmu_pll_init(struct ssb_
41 u32 crystalfreq = 0; /* in kHz. 0 = keep default freq. */
43 if (bus->bustype == SSB_BUSTYPE_SSB) {
44 - /* TODO: The user may override the crystal frequency. */
45 +#ifdef CONFIG_BCM47XX
47 + if (nvram_getenv("xtalfreq", buf, sizeof(buf)) >= 0)
48 + crystalfreq = simple_strtoul(buf, NULL, 0);
52 switch (bus->chip_id) {
53 @@ -330,7 +333,11 @@ static void ssb_pmu_pll_init(struct ssb_
54 ssb_pmu1_pllinit_r0(cc, crystalfreq);
57 + ssb_pmu0_pllinit_r0(cc, crystalfreq);
60 + if (crystalfreq == 0)
61 + crystalfreq = 25000;
62 ssb_pmu0_pllinit_r0(cc, crystalfreq);
65 @@ -607,3 +614,34 @@ void ssb_pmu_set_ldo_paref(struct ssb_ch
67 EXPORT_SYMBOL(ssb_pmu_set_ldo_voltage);
68 EXPORT_SYMBOL(ssb_pmu_set_ldo_paref);
70 +u32 ssb_pmu_get_cpu_clock(struct ssb_chipcommon *cc)
72 + struct ssb_bus *bus = cc->dev->bus;
74 + switch (bus->chip_id) {
76 + /* 5354 chip uses a non programmable PLL of frequency 240MHz */
79 + ssb_printk(KERN_ERR PFX
80 + "ERROR: PMU cpu clock unknown for device %04X\n",
86 +u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc)
88 + struct ssb_bus *bus = cc->dev->bus;
90 + switch (bus->chip_id) {
94 + ssb_printk(KERN_ERR PFX
95 + "ERROR: PMU controlclock unknown for device %04X\n",
100 --- a/drivers/ssb/driver_mipscore.c
101 +++ b/drivers/ssb/driver_mipscore.c
102 @@ -232,6 +232,9 @@ u32 ssb_cpu_clock(struct ssb_mipscore *m
103 struct ssb_bus *bus = mcore->dev->bus;
104 u32 pll_type, n, m, rate = 0;
106 + if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU)
107 + return ssb_pmu_get_cpu_clock(&bus->chipco);
109 if (bus->extif.dev) {
110 ssb_extif_get_clockcontrol(&bus->extif, &pll_type, &n, &m);
111 } else if (bus->chipco.dev) {
112 --- a/drivers/ssb/main.c
113 +++ b/drivers/ssb/main.c
114 @@ -1094,6 +1094,9 @@ u32 ssb_clockspeed(struct ssb_bus *bus)
116 u32 clkctl_n, clkctl_m;
118 + if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU)
119 + return ssb_pmu_get_controlclock(&bus->chipco);
121 if (ssb_extif_available(&bus->extif))
122 ssb_extif_get_clockcontrol(&bus->extif, &plltype,
123 &clkctl_n, &clkctl_m);
124 --- a/drivers/ssb/ssb_private.h
125 +++ b/drivers/ssb/ssb_private.h
126 @@ -211,4 +211,8 @@ static inline void b43_pci_ssb_bridge_ex
128 #endif /* CONFIG_SSB_B43_PCI_BRIDGE */
130 +/* driver_chipcommon_pmu.c */
131 +extern u32 ssb_pmu_get_cpu_clock(struct ssb_chipcommon *cc);
132 +extern u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc);
134 #endif /* LINUX_SSB_PRIVATE_H_ */