8369ae33b7
Broadcom has released cards based on a new AMBA-based bus type. From a programming point of view, this new bus type differs from AMBA and does not use AMBA common registers. It also differs enough from SSB. We decided that a new bus driver is needed to keep the code clean. In its current form, the driver detects devices present on the bus and registers them in the system. It allows registering BCMA drivers for specified bus devices and provides them basic operations. The bus driver itself includes two important bus managing drivers: ChipCommon core driver and PCI(c) core driver. They are early used to allow correct initialization. Currently code is limited to supporting buses on PCI(e) devices, however the driver is designed to be used also on other hosts. The host abstraction layer is implemented and already used for PCI(e). Support for PCI(e) hosts is working and seems to be stable (access to 80211 core was tested successfully on a few devices). We can still optimize it by using some fixed windows, but this can be done later without affecting any external code. Windows are just ranges in MMIO used for accessing cores on the bus. Cc: Greg KH <greg@kroah.com> Cc: Michael Büsch <mb@bu3sch.de> Cc: Larry Finger <Larry.Finger@lwfinger.net> Cc: George Kashperko <george@znau.edu.ua> Cc: Arend van Spriel <arend@broadcom.com> Cc: linux-arm-kernel@lists.infradead.org Cc: Russell King <rmk@arm.linux.org.uk> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Andy Botting <andy@andybotting.com> Cc: linuxdriverproject <devel@linuxdriverproject.org> Cc: linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org> Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
/*
|
|
* Broadcom specific AMBA
|
|
* Core ops
|
|
*
|
|
* Licensed under the GNU/GPL. See COPYING for details.
|
|
*/
|
|
|
|
#include "bcma_private.h"
|
|
#include <linux/bcma/bcma.h>
|
|
|
|
bool bcma_core_is_enabled(struct bcma_device *core)
|
|
{
|
|
if ((bcma_aread32(core, BCMA_IOCTL) & (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC))
|
|
!= BCMA_IOCTL_CLK)
|
|
return false;
|
|
if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
|
|
return false;
|
|
return true;
|
|
}
|
|
EXPORT_SYMBOL_GPL(bcma_core_is_enabled);
|
|
|
|
static void bcma_core_disable(struct bcma_device *core, u32 flags)
|
|
{
|
|
if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
|
|
return;
|
|
|
|
bcma_awrite32(core, BCMA_IOCTL, flags);
|
|
bcma_aread32(core, BCMA_IOCTL);
|
|
udelay(10);
|
|
|
|
bcma_awrite32(core, BCMA_RESET_CTL, BCMA_RESET_CTL_RESET);
|
|
udelay(1);
|
|
}
|
|
|
|
int bcma_core_enable(struct bcma_device *core, u32 flags)
|
|
{
|
|
bcma_core_disable(core, flags);
|
|
|
|
bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC | flags));
|
|
bcma_aread32(core, BCMA_IOCTL);
|
|
|
|
bcma_awrite32(core, BCMA_RESET_CTL, 0);
|
|
udelay(1);
|
|
|
|
bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | flags));
|
|
bcma_aread32(core, BCMA_IOCTL);
|
|
udelay(1);
|
|
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(bcma_core_enable);
|