06f48328e4e1235cfef5eef75ba5d423ca5608bb
2 * MikroTik RouterBOARD 750 support
4 * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <asm/mach-ar71xx/ar71xx.h>
12 #include <asm/mach-ar71xx/mach-rb750.h>
15 #include "dev-ap91-eth.h"
17 int rb750_latch_change(u32 mask_clr
, u32 mask_set
)
19 static DEFINE_SPINLOCK(lock
);
20 static u32 latch_set
= RB750_LED_BITS
| RB750_LVC573_LE
;
27 spin_lock_irqsave(&lock
, flags
);
29 if ((mask_clr
& BIT(31)) != 0 &&
30 (latch_set
& RB750_LVC573_LE
) == 0) {
34 latch_set
= (latch_set
| mask_set
) & ~mask_clr
;
35 latch_clr
= (latch_clr
| mask_clr
) & ~mask_set
;
38 latch_oe
= __raw_readl(ar71xx_gpio_base
+ GPIO_REG_OE
);
40 if (likely(latch_set
& RB750_LVC573_LE
)) {
41 void __iomem
*base
= ar71xx_gpio_base
;
43 t
= __raw_readl(base
+ GPIO_REG_OE
);
44 t
|= mask_clr
| latch_oe
| mask_set
;
46 __raw_writel(t
, base
+ GPIO_REG_OE
);
47 __raw_writel(latch_clr
, base
+ GPIO_REG_CLEAR
);
48 __raw_writel(latch_set
, base
+ GPIO_REG_SET
);
49 } else if (mask_clr
& RB750_LVC573_LE
) {
50 void __iomem
*base
= ar71xx_gpio_base
;
52 latch_oe
= __raw_readl(base
+ GPIO_REG_OE
);
53 __raw_writel(RB750_LVC573_LE
, base
+ GPIO_REG_CLEAR
);
55 __raw_readl(base
+ GPIO_REG_CLEAR
);
61 spin_unlock_irqrestore(&lock
, flags
);
64 EXPORT_SYMBOL_GPL(rb750_latch_change
);
66 static void __init
rb750_setup(void)
71 MIPS_MACHINE(AR71XX_MACH_RB_750
, "750i", "MikroTik RouterBOARD 750",