Commit cfc806a7ee38e68a9363584dd2b00421fda6dfed

Authored by Paul Mundt
1 parent ec20a81562

sh: hwblk: Kill off remaining bits of hwblk API.

Now that everything has been migrated, kill off the remaining
infrastructure bits.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

Showing 4 changed files with 0 additions and 233 deletions Side-by-side Diff

arch/sh/include/asm/hwblk.h
1   -#ifndef __ASM_SH_HWBLK_H
2   -#define __ASM_SH_HWBLK_H
3   -
4   -#include <asm/clock.h>
5   -#include <asm/io.h>
6   -
7   -#define HWBLK_CNT_USAGE 0
8   -#define HWBLK_CNT_IDLE 1
9   -#define HWBLK_CNT_DEVICES 2
10   -#define HWBLK_CNT_NR 3
11   -
12   -#define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */
13   -
14   -#define HWBLK_AREA(_flags, _parent) \
15   -{ \
16   - .flags = _flags, \
17   - .parent = _parent, \
18   -}
19   -
20   -struct hwblk_area {
21   - int cnt[HWBLK_CNT_NR];
22   - unsigned char parent;
23   - unsigned char flags;
24   -};
25   -
26   -#define HWBLK(_mstp, _bit, _area) \
27   -{ \
28   - .mstp = (void __iomem *)_mstp, \
29   - .bit = _bit, \
30   - .area = _area, \
31   -}
32   -
33   -struct hwblk {
34   - void __iomem *mstp;
35   - unsigned char bit;
36   - unsigned char area;
37   - int cnt[HWBLK_CNT_NR];
38   -};
39   -
40   -struct hwblk_info {
41   - struct hwblk_area *areas;
42   - int nr_areas;
43   - struct hwblk *hwblks;
44   - int nr_hwblks;
45   -};
46   -
47   -#if !defined(CONFIG_CPU_SUBTYPE_SH7722) && \
48   - !defined(CONFIG_CPU_SUBTYPE_SH7723) && \
49   - !defined(CONFIG_CPU_SUBTYPE_SH7724)
50   -/* Should be defined by processor-specific code */
51   -int arch_hwblk_init(void);
52   -
53   -int hwblk_register(struct hwblk_info *info);
54   -int hwblk_init(void);
55   -
56   -void hwblk_enable(struct hwblk_info *info, int hwblk);
57   -void hwblk_disable(struct hwblk_info *info, int hwblk);
58   -
59   -void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt);
60   -void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt);
61   -
62   -/* allow clocks to enable and disable hardware blocks */
63   -#define SH_HWBLK_CLK(_hwblk, _parent, _flags) \
64   -[_hwblk] = { \
65   - .parent = _parent, \
66   - .arch_flags = _hwblk, \
67   - .flags = _flags, \
68   -}
69   -
70   -int sh_hwblk_clk_register(struct clk *clks, int nr);
71   -#else
72   -#define hwblk_init() 0
73   -#endif
74   -#endif /* __ASM_SH_HWBLK_H */
arch/sh/kernel/cpu/Makefile
... ... @@ -19,7 +19,4 @@
19 19 obj-$(CONFIG_SH_CLK_CPG_LEGACY) += clock-cpg.o
20 20  
21 21 obj-y += irq/ init.o clock.o fpu.o proc.o
22   -ifneq ($(CONFIG_CPU_SUBTYPE_SH7722)$(CONFIG_CPU_SUBTYPE_SH7723)$(CONFIG_CPU_SUBTYPE_SH7724),y)
23   -obj-y += hwblk.o
24   -endif
arch/sh/kernel/cpu/hwblk.c
1   -#include <linux/clk.h>
2   -#include <linux/compiler.h>
3   -#include <linux/io.h>
4   -#include <linux/spinlock.h>
5   -#include <asm/suspend.h>
6   -#include <asm/hwblk.h>
7   -#include <asm/clock.h>
8   -
9   -static DEFINE_SPINLOCK(hwblk_lock);
10   -
11   -static void hwblk_area_mod_cnt(struct hwblk_info *info,
12   - int area, int counter, int value, int goal)
13   -{
14   - struct hwblk_area *hap = info->areas + area;
15   -
16   - hap->cnt[counter] += value;
17   -
18   - if (hap->cnt[counter] != goal)
19   - return;
20   -
21   - if (hap->flags & HWBLK_AREA_FLAG_PARENT)
22   - hwblk_area_mod_cnt(info, hap->parent, counter, value, goal);
23   -}
24   -
25   -
26   -static int __hwblk_mod_cnt(struct hwblk_info *info, int hwblk,
27   - int counter, int value, int goal)
28   -{
29   - struct hwblk *hp = info->hwblks + hwblk;
30   -
31   - hp->cnt[counter] += value;
32   - if (hp->cnt[counter] == goal)
33   - hwblk_area_mod_cnt(info, hp->area, counter, value, goal);
34   -
35   - return hp->cnt[counter];
36   -}
37   -
38   -static void hwblk_mod_cnt(struct hwblk_info *info, int hwblk,
39   - int counter, int value, int goal)
40   -{
41   - unsigned long flags;
42   -
43   - spin_lock_irqsave(&hwblk_lock, flags);
44   - __hwblk_mod_cnt(info, hwblk, counter, value, goal);
45   - spin_unlock_irqrestore(&hwblk_lock, flags);
46   -}
47   -
48   -void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int counter)
49   -{
50   - hwblk_mod_cnt(info, hwblk, counter, 1, 1);
51   -}
52   -
53   -void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int counter)
54   -{
55   - hwblk_mod_cnt(info, hwblk, counter, -1, 0);
56   -}
57   -
58   -void hwblk_enable(struct hwblk_info *info, int hwblk)
59   -{
60   - struct hwblk *hp = info->hwblks + hwblk;
61   - unsigned long tmp;
62   - unsigned long flags;
63   - int ret;
64   -
65   - spin_lock_irqsave(&hwblk_lock, flags);
66   -
67   - ret = __hwblk_mod_cnt(info, hwblk, HWBLK_CNT_USAGE, 1, 1);
68   - if (ret == 1) {
69   - tmp = __raw_readl(hp->mstp);
70   - tmp &= ~(1 << hp->bit);
71   - __raw_writel(tmp, hp->mstp);
72   - }
73   -
74   - spin_unlock_irqrestore(&hwblk_lock, flags);
75   -}
76   -
77   -void hwblk_disable(struct hwblk_info *info, int hwblk)
78   -{
79   - struct hwblk *hp = info->hwblks + hwblk;
80   - unsigned long tmp;
81   - unsigned long flags;
82   - int ret;
83   -
84   - spin_lock_irqsave(&hwblk_lock, flags);
85   -
86   - ret = __hwblk_mod_cnt(info, hwblk, HWBLK_CNT_USAGE, -1, 0);
87   - if (ret == 0) {
88   - tmp = __raw_readl(hp->mstp);
89   - tmp |= 1 << hp->bit;
90   - __raw_writel(tmp, hp->mstp);
91   - }
92   -
93   - spin_unlock_irqrestore(&hwblk_lock, flags);
94   -}
95   -
96   -struct hwblk_info *hwblk_info;
97   -
98   -int __init hwblk_register(struct hwblk_info *info)
99   -{
100   - hwblk_info = info;
101   - return 0;
102   -}
103   -
104   -int __init __weak arch_hwblk_init(void)
105   -{
106   - return 0;
107   -}
108   -
109   -int __init hwblk_init(void)
110   -{
111   - return arch_hwblk_init();
112   -}
113   -
114   -/* allow clocks to enable and disable hardware blocks */
115   -static int sh_hwblk_clk_enable(struct clk *clk)
116   -{
117   - if (!hwblk_info)
118   - return -ENOENT;
119   -
120   - hwblk_enable(hwblk_info, clk->arch_flags);
121   - return 0;
122   -}
123   -
124   -static void sh_hwblk_clk_disable(struct clk *clk)
125   -{
126   - if (hwblk_info)
127   - hwblk_disable(hwblk_info, clk->arch_flags);
128   -}
129   -
130   -static struct clk_ops sh_hwblk_clk_ops = {
131   - .enable = sh_hwblk_clk_enable,
132   - .disable = sh_hwblk_clk_disable,
133   - .recalc = followparent_recalc,
134   -};
135   -
136   -int __init sh_hwblk_clk_register(struct clk *clks, int nr)
137   -{
138   - struct clk *clkp;
139   - int ret = 0;
140   - int k;
141   -
142   - for (k = 0; !ret && (k < nr); k++) {
143   - clkp = clks + k;
144   -
145   - /* skip over clocks using hwblk 0 (HWBLK_UNKNOWN) */
146   - if (!clkp->arch_flags)
147   - continue;
148   -
149   - clkp->ops = &sh_hwblk_clk_ops;
150   - ret |= clk_register(clkp);
151   - }
152   -
153   - return ret;
154   -}
arch/sh/kernel/time.c
... ... @@ -21,7 +21,6 @@
21 21 #include <linux/smp.h>
22 22 #include <linux/rtc.h>
23 23 #include <asm/clock.h>
24   -#include <asm/hwblk.h>
25 24 #include <asm/rtc.h>
26 25  
27 26 /* Dummy RTC ops */
... ... @@ -110,7 +109,6 @@
110 109 if (board_time_init)
111 110 board_time_init();
112 111  
113   - hwblk_init();
114 112 clk_init();
115 113  
116 114 late_time_init = sh_late_time_init;