aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9/rbtx4939
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-10-20 10:28:50 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-10-27 12:18:27 -0400
commitbc89b2bdefa5f56133d0b19a220880d4ada62560 (patch)
tree0b5698b5c9d47c3771e27660a10d51b79001b9db /arch/mips/txx9/rbtx4939
parentf591eb1e6896e26675e91a319cc93f3800dbaad4 (diff)
MIPS: TXx9: 7 segment LED support
Add sysfs interface for 7 segment LED and implement access routine for RBTX4939. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/txx9/rbtx4939')
-rw-r--r--arch/mips/txx9/rbtx4939/setup.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c
index 9855d7bccc20..c88517774910 100644
--- a/arch/mips/txx9/rbtx4939/setup.c
+++ b/arch/mips/txx9/rbtx4939/setup.c
@@ -239,6 +239,32 @@ static inline void rbtx4939_led_setup(void)
239} 239}
240#endif 240#endif
241 241
242static void __rbtx4939_7segled_putc(unsigned int pos, unsigned char val)
243{
244#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
245 unsigned long flags;
246 local_irq_save(flags);
247 /* bit7: reserved for LED class */
248 led_val[pos] = (led_val[pos] & 0x80) | (val & 0x7f);
249 val = led_val[pos];
250 local_irq_restore(flags);
251#endif
252 writeb(val, rbtx4939_7seg_addr(pos / 4, pos % 4));
253}
254
255static void rbtx4939_7segled_putc(unsigned int pos, unsigned char val)
256{
257 /* convert from map_to_seg7() notation */
258 val = (val & 0x88) |
259 ((val & 0x40) >> 6) |
260 ((val & 0x20) >> 4) |
261 ((val & 0x10) >> 2) |
262 ((val & 0x04) << 2) |
263 ((val & 0x02) << 4) |
264 ((val & 0x01) << 6);
265 __rbtx4939_7segled_putc(pos, val);
266}
267
242static void __init rbtx4939_arch_init(void) 268static void __init rbtx4939_arch_init(void)
243{ 269{
244 rbtx4939_pci_setup(); 270 rbtx4939_pci_setup();
@@ -269,6 +295,8 @@ static void __init rbtx4939_device_init(void)
269 295
270static void __init rbtx4939_setup(void) 296static void __init rbtx4939_setup(void)
271{ 297{
298 int i;
299
272 rbtx4939_ebusc_setup(); 300 rbtx4939_ebusc_setup();
273 /* always enable ATA0 */ 301 /* always enable ATA0 */
274 txx9_set64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_ATA0MODE); 302 txx9_set64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_ATA0MODE);
@@ -279,6 +307,9 @@ static void __init rbtx4939_setup(void)
279 307
280 _machine_restart = rbtx4939_machine_restart; 308 _machine_restart = rbtx4939_machine_restart;
281 309
310 txx9_7segled_init(RBTX4939_MAX_7SEGLEDS, rbtx4939_7segled_putc);
311 for (i = 0; i < RBTX4939_MAX_7SEGLEDS; i++)
312 txx9_7segled_putc(i, '-');
282 pr_info("RBTX4939 (Rev %02x) --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", 313 pr_info("RBTX4939 (Rev %02x) --- FPGA(Rev %02x) DIPSW:%02x,%02x\n",
283 readb(rbtx4939_board_rev_addr), readb(rbtx4939_ioc_rev_addr), 314 readb(rbtx4939_board_rev_addr), readb(rbtx4939_ioc_rev_addr),
284 readb(rbtx4939_udipsw_addr), readb(rbtx4939_bdipsw_addr)); 315 readb(rbtx4939_udipsw_addr), readb(rbtx4939_bdipsw_addr));