bcm63xx: add 3.9 support
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.9 / 029-MIPS-BCM63XX-add-missing-clocks-for-BCM6328-and-BCM6.patch
1 From d31454bc822e1957e758e75d4367bcd12af89743 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Thu, 18 Apr 2013 21:23:11 +0200
4 Subject: [PATCH] MIPS: BCM63XX: add missing clocks for BCM6328 and BCM6362
5
6 Add currently unused missing clocks for BCM6328 and BCM6362.
7
8 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
9 ---
10 arch/mips/bcm63xx/clk.c | 33 +++++++++++++++++++++++++--------
11 1 file changed, 25 insertions(+), 8 deletions(-)
12
13 --- a/arch/mips/bcm63xx/clk.c
14 +++ b/arch/mips/bcm63xx/clk.c
15 @@ -125,11 +125,18 @@ static struct clk clk_ephy = {
16 */
17 static void enetsw_set(struct clk *clk, int enable)
18 {
19 - if (!BCMCPU_IS_6368())
20 + if (BCMCPU_IS_6328())
21 + bcm_hwclock_set(CKCTL_6328_ROBOSW_EN, enable);
22 + else if (BCMCPU_IS_6362())
23 + bcm_hwclock_set(CKCTL_6362_ROBOSW_EN, enable);
24 + else if (BCMCPU_IS_6368())
25 + bcm_hwclock_set(CKCTL_6368_ROBOSW_EN |
26 + CKCTL_6368_SWPKT_USB_EN |
27 + CKCTL_6368_SWPKT_SAR_EN,
28 + enable);
29 + else
30 return;
31 - bcm_hwclock_set(CKCTL_6368_ROBOSW_EN |
32 - CKCTL_6368_SWPKT_USB_EN |
33 - CKCTL_6368_SWPKT_SAR_EN, enable);
34 +
35 if (enable) {
36 /* reset switch core afer clock change */
37 bcm63xx_core_set_reset(BCM63XX_RESET_ENETSW, 1);
38 @@ -166,6 +173,8 @@ static void usbh_set(struct clk *clk, in
39 bcm_hwclock_set(CKCTL_6328_USBH_EN, enable);
40 else if (BCMCPU_IS_6348())
41 bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
42 + else if (BCMCPU_IS_6362())
43 + bcm_hwclock_set(CKCTL_6362_USBH_EN, enable);
44 else if (BCMCPU_IS_6368())
45 bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
46 }
47 @@ -181,6 +190,8 @@ static void usbd_set(struct clk *clk, in
48 {
49 if (BCMCPU_IS_6328())
50 bcm_hwclock_set(CKCTL_6328_USBD_EN, enable);
51 + else if (BCMCPU_IS_6362())
52 + bcm_hwclock_set(CKCTL_6362_USBD_EN, enable);
53 else if (BCMCPU_IS_6368())
54 bcm_hwclock_set(CKCTL_6368_USBD_EN, enable);
55 }
56 @@ -244,7 +255,10 @@ static struct clk clk_xtm = {
57 */
58 static void ipsec_set(struct clk *clk, int enable)
59 {
60 - bcm_hwclock_set(CKCTL_6368_IPSEC_EN, enable);
61 + if (BCMCPU_IS_6362())
62 + bcm_hwclock_set(CKCTL_6362_IPSEC_EN, enable);
63 + else if (BCMCPU_IS_6368())
64 + bcm_hwclock_set(CKCTL_6368_IPSEC_EN, enable);
65 }
66
67 static struct clk clk_ipsec = {
68 @@ -257,7 +271,10 @@ static struct clk clk_ipsec = {
69
70 static void pcie_set(struct clk *clk, int enable)
71 {
72 - bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable);
73 + if (BCMCPU_IS_6328())
74 + bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable);
75 + else if (BCMCPU_IS_6362())
76 + bcm_hwclock_set(CKCTL_6362_PCIE_EN, enable);
77 }
78
79 static struct clk clk_pcie = {
80 @@ -323,9 +340,9 @@ struct clk *clk_get(struct device *dev,
81 return &clk_periph;
82 if (BCMCPU_IS_6358() && !strcmp(id, "pcm"))
83 return &clk_pcm;
84 - if (BCMCPU_IS_6368() && !strcmp(id, "ipsec"))
85 + if ((BCMCPU_IS_6362() || BCMCPU_IS_6368()) && !strcmp(id, "ipsec"))
86 return &clk_ipsec;
87 - if (BCMCPU_IS_6328() && !strcmp(id, "pcie"))
88 + if ((BCMCPU_IS_6328() || BCMCPU_IS_6362()) && !strcmp(id, "pcie"))
89 return &clk_pcie;
90 return ERR_PTR(-ENOENT);
91 }