diff options
Diffstat (limited to 'arch/mips/bcm63xx/clk.c')
-rw-r--r-- | arch/mips/bcm63xx/clk.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c index b9e948d59430..c726a97fc798 100644 --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c | |||
@@ -15,7 +15,13 @@ | |||
15 | #include <bcm63xx_io.h> | 15 | #include <bcm63xx_io.h> |
16 | #include <bcm63xx_regs.h> | 16 | #include <bcm63xx_regs.h> |
17 | #include <bcm63xx_reset.h> | 17 | #include <bcm63xx_reset.h> |
18 | #include <bcm63xx_clk.h> | 18 | |
19 | struct clk { | ||
20 | void (*set)(struct clk *, int); | ||
21 | unsigned int rate; | ||
22 | unsigned int usage; | ||
23 | int id; | ||
24 | }; | ||
19 | 25 | ||
20 | static DEFINE_MUTEX(clocks_mutex); | 26 | static DEFINE_MUTEX(clocks_mutex); |
21 | 27 | ||
@@ -119,11 +125,18 @@ static struct clk clk_ephy = { | |||
119 | */ | 125 | */ |
120 | static void enetsw_set(struct clk *clk, int enable) | 126 | static void enetsw_set(struct clk *clk, int enable) |
121 | { | 127 | { |
122 | if (!BCMCPU_IS_6368()) | 128 | if (BCMCPU_IS_6328()) |
129 | bcm_hwclock_set(CKCTL_6328_ROBOSW_EN, enable); | ||
130 | else if (BCMCPU_IS_6362()) | ||
131 | bcm_hwclock_set(CKCTL_6362_ROBOSW_EN, enable); | ||
132 | else if (BCMCPU_IS_6368()) | ||
133 | bcm_hwclock_set(CKCTL_6368_ROBOSW_EN | | ||
134 | CKCTL_6368_SWPKT_USB_EN | | ||
135 | CKCTL_6368_SWPKT_SAR_EN, | ||
136 | enable); | ||
137 | else | ||
123 | return; | 138 | return; |
124 | bcm_hwclock_set(CKCTL_6368_ROBOSW_EN | | 139 | |
125 | CKCTL_6368_SWPKT_USB_EN | | ||
126 | CKCTL_6368_SWPKT_SAR_EN, enable); | ||
127 | if (enable) { | 140 | if (enable) { |
128 | /* reset switch core afer clock change */ | 141 | /* reset switch core afer clock change */ |
129 | bcm63xx_core_set_reset(BCM63XX_RESET_ENETSW, 1); | 142 | bcm63xx_core_set_reset(BCM63XX_RESET_ENETSW, 1); |
@@ -160,6 +173,8 @@ static void usbh_set(struct clk *clk, int enable) | |||
160 | bcm_hwclock_set(CKCTL_6328_USBH_EN, enable); | 173 | bcm_hwclock_set(CKCTL_6328_USBH_EN, enable); |
161 | else if (BCMCPU_IS_6348()) | 174 | else if (BCMCPU_IS_6348()) |
162 | bcm_hwclock_set(CKCTL_6348_USBH_EN, enable); | 175 | bcm_hwclock_set(CKCTL_6348_USBH_EN, enable); |
176 | else if (BCMCPU_IS_6362()) | ||
177 | bcm_hwclock_set(CKCTL_6362_USBH_EN, enable); | ||
163 | else if (BCMCPU_IS_6368()) | 178 | else if (BCMCPU_IS_6368()) |
164 | bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); | 179 | bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); |
165 | } | 180 | } |
@@ -175,6 +190,8 @@ static void usbd_set(struct clk *clk, int enable) | |||
175 | { | 190 | { |
176 | if (BCMCPU_IS_6328()) | 191 | if (BCMCPU_IS_6328()) |
177 | bcm_hwclock_set(CKCTL_6328_USBD_EN, enable); | 192 | bcm_hwclock_set(CKCTL_6328_USBD_EN, enable); |
193 | else if (BCMCPU_IS_6362()) | ||
194 | bcm_hwclock_set(CKCTL_6362_USBD_EN, enable); | ||
178 | else if (BCMCPU_IS_6368()) | 195 | else if (BCMCPU_IS_6368()) |
179 | bcm_hwclock_set(CKCTL_6368_USBD_EN, enable); | 196 | bcm_hwclock_set(CKCTL_6368_USBD_EN, enable); |
180 | } | 197 | } |
@@ -196,6 +213,8 @@ static void spi_set(struct clk *clk, int enable) | |||
196 | mask = CKCTL_6348_SPI_EN; | 213 | mask = CKCTL_6348_SPI_EN; |
197 | else if (BCMCPU_IS_6358()) | 214 | else if (BCMCPU_IS_6358()) |
198 | mask = CKCTL_6358_SPI_EN; | 215 | mask = CKCTL_6358_SPI_EN; |
216 | else if (BCMCPU_IS_6362()) | ||
217 | mask = CKCTL_6362_SPI_EN; | ||
199 | else | 218 | else |
200 | /* BCMCPU_IS_6368 */ | 219 | /* BCMCPU_IS_6368 */ |
201 | mask = CKCTL_6368_SPI_EN; | 220 | mask = CKCTL_6368_SPI_EN; |
@@ -236,7 +255,10 @@ static struct clk clk_xtm = { | |||
236 | */ | 255 | */ |
237 | static void ipsec_set(struct clk *clk, int enable) | 256 | static void ipsec_set(struct clk *clk, int enable) |
238 | { | 257 | { |
239 | bcm_hwclock_set(CKCTL_6368_IPSEC_EN, enable); | 258 | if (BCMCPU_IS_6362()) |
259 | bcm_hwclock_set(CKCTL_6362_IPSEC_EN, enable); | ||
260 | else if (BCMCPU_IS_6368()) | ||
261 | bcm_hwclock_set(CKCTL_6368_IPSEC_EN, enable); | ||
240 | } | 262 | } |
241 | 263 | ||
242 | static struct clk clk_ipsec = { | 264 | static struct clk clk_ipsec = { |
@@ -249,7 +271,10 @@ static struct clk clk_ipsec = { | |||
249 | 271 | ||
250 | static void pcie_set(struct clk *clk, int enable) | 272 | static void pcie_set(struct clk *clk, int enable) |
251 | { | 273 | { |
252 | bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable); | 274 | if (BCMCPU_IS_6328()) |
275 | bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable); | ||
276 | else if (BCMCPU_IS_6362()) | ||
277 | bcm_hwclock_set(CKCTL_6362_PCIE_EN, enable); | ||
253 | } | 278 | } |
254 | 279 | ||
255 | static struct clk clk_pcie = { | 280 | static struct clk clk_pcie = { |
@@ -315,9 +340,9 @@ struct clk *clk_get(struct device *dev, const char *id) | |||
315 | return &clk_periph; | 340 | return &clk_periph; |
316 | if (BCMCPU_IS_6358() && !strcmp(id, "pcm")) | 341 | if (BCMCPU_IS_6358() && !strcmp(id, "pcm")) |
317 | return &clk_pcm; | 342 | return &clk_pcm; |
318 | if (BCMCPU_IS_6368() && !strcmp(id, "ipsec")) | 343 | if ((BCMCPU_IS_6362() || BCMCPU_IS_6368()) && !strcmp(id, "ipsec")) |
319 | return &clk_ipsec; | 344 | return &clk_ipsec; |
320 | if (BCMCPU_IS_6328() && !strcmp(id, "pcie")) | 345 | if ((BCMCPU_IS_6328() || BCMCPU_IS_6362()) && !strcmp(id, "pcie")) |
321 | return &clk_pcie; | 346 | return &clk_pcie; |
322 | return ERR_PTR(-ENOENT); | 347 | return ERR_PTR(-ENOENT); |
323 | } | 348 | } |