26 #include <linux/kernel.h>
33 const char *
via_slap =
"Please slap VIA Technologies to motivate them "
34 "releasing full documentation for your platform!\n";
45 return ((pll.
divisor - 2) << 16)
57 static inline void cle266_set_primary_pll_encoded(
u32 data)
59 via_write_reg_mask(
VIASR, 0x40, 0x02, 0x02);
60 via_write_reg(
VIASR, 0x46, data & 0xFF);
61 via_write_reg(
VIASR, 0x47, (data >> 8) & 0xFF);
62 via_write_reg_mask(
VIASR, 0x40, 0x00, 0x02);
65 static inline void k800_set_primary_pll_encoded(
u32 data)
67 via_write_reg_mask(
VIASR, 0x40, 0x02, 0x02);
68 via_write_reg(
VIASR, 0x44, data & 0xFF);
69 via_write_reg(
VIASR, 0x45, (data >> 8) & 0xFF);
70 via_write_reg(
VIASR, 0x46, (data >> 16) & 0xFF);
71 via_write_reg_mask(
VIASR, 0x40, 0x00, 0x02);
74 static inline void cle266_set_secondary_pll_encoded(
u32 data)
76 via_write_reg_mask(
VIASR, 0x40, 0x04, 0x04);
77 via_write_reg(
VIASR, 0x44, data & 0xFF);
78 via_write_reg(
VIASR, 0x45, (data >> 8) & 0xFF);
79 via_write_reg_mask(
VIASR, 0x40, 0x00, 0x04);
82 static inline void k800_set_secondary_pll_encoded(
u32 data)
84 via_write_reg_mask(
VIASR, 0x40, 0x04, 0x04);
85 via_write_reg(
VIASR, 0x4A, data & 0xFF);
86 via_write_reg(
VIASR, 0x4B, (data >> 8) & 0xFF);
87 via_write_reg(
VIASR, 0x4C, (data >> 16) & 0xFF);
88 via_write_reg_mask(
VIASR, 0x40, 0x00, 0x04);
91 static inline void set_engine_pll_encoded(
u32 data)
93 via_write_reg_mask(
VIASR, 0x40, 0x01, 0x01);
94 via_write_reg(
VIASR, 0x47, data & 0xFF);
95 via_write_reg(
VIASR, 0x48, (data >> 8) & 0xFF);
96 via_write_reg(
VIASR, 0x49, (data >> 16) & 0xFF);
97 via_write_reg_mask(
VIASR, 0x40, 0x00, 0x01);
102 cle266_set_primary_pll_encoded(cle266_encode_pll(config));
107 k800_set_primary_pll_encoded(k800_encode_pll(config));
112 k800_set_primary_pll_encoded(vx855_encode_pll(config));
115 static void cle266_set_secondary_pll(
struct via_pll_config config)
117 cle266_set_secondary_pll_encoded(cle266_encode_pll(config));
122 k800_set_secondary_pll_encoded(k800_encode_pll(config));
127 k800_set_secondary_pll_encoded(vx855_encode_pll(config));
132 set_engine_pll_encoded(k800_encode_pll(config));
137 set_engine_pll_encoded(vx855_encode_pll(config));
140 static void set_primary_pll_state(
u8 state)
155 via_write_reg_mask(
VIASR, 0x2D, value, 0x30);
158 static void set_secondary_pll_state(
u8 state)
173 via_write_reg_mask(
VIASR, 0x2D, value, 0x0C);
176 static void set_engine_pll_state(
u8 state)
191 via_write_reg_mask(
VIASR, 0x2D, value, 0x03);
194 static void set_primary_clock_state(
u8 state)
209 via_write_reg_mask(
VIASR, 0x1B, value, 0x30);
212 static void set_secondary_clock_state(
u8 state)
227 via_write_reg_mask(
VIASR, 0x1B, value, 0xC0);
261 static void set_primary_clock_source(
enum via_clksrc source,
bool use_pll)
263 u8 data = set_clock_source_common(source, use_pll) << 4;
264 via_write_reg_mask(
VIACR, 0x6C, data, 0xF0);
267 static void set_secondary_clock_source(
enum via_clksrc source,
bool use_pll)
269 u8 data = set_clock_source_common(source, use_pll);
270 via_write_reg_mask(
VIACR, 0x6C, data, 0x0F);
273 static void dummy_set_clock_state(
u8 state)
278 static void dummy_set_clock_source(
enum via_clksrc source,
bool use_pll)
283 static void dummy_set_pll_state(
u8 state)
293 static void noop_set_clock_state(
u8 state)
355 if (machine_is_olpc()) {