vfs: add "device" tag to /proc/self/mountstats
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / bcma / core.c
blobced379f7b371a5622eba27967b7e3773154fd777
1 /*
2 * Broadcom specific AMBA
3 * Core ops
5 * Licensed under the GNU/GPL. See COPYING for details.
6 */
8 #include "bcma_private.h"
9 #include <linux/bcma/bcma.h>
11 bool bcma_core_is_enabled(struct bcma_device *core)
13 if ((bcma_aread32(core, BCMA_IOCTL) & (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC))
14 != BCMA_IOCTL_CLK)
15 return false;
16 if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
17 return false;
18 return true;
20 EXPORT_SYMBOL_GPL(bcma_core_is_enabled);
22 static void bcma_core_disable(struct bcma_device *core, u32 flags)
24 if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
25 return;
27 bcma_awrite32(core, BCMA_IOCTL, flags);
28 bcma_aread32(core, BCMA_IOCTL);
29 udelay(10);
31 bcma_awrite32(core, BCMA_RESET_CTL, BCMA_RESET_CTL_RESET);
32 udelay(1);
35 int bcma_core_enable(struct bcma_device *core, u32 flags)
37 bcma_core_disable(core, flags);
39 bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC | flags));
40 bcma_aread32(core, BCMA_IOCTL);
42 bcma_awrite32(core, BCMA_RESET_CTL, 0);
43 udelay(1);
45 bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | flags));
46 bcma_aread32(core, BCMA_IOCTL);
47 udelay(1);
49 return 0;
51 EXPORT_SYMBOL_GPL(bcma_core_enable);