summaryrefslogtreecommitdiff
path: root/drivers/bcma
AgeCommit message (Collapse)Author
2012-12-10bcma: mips: fix clearing device IRQRafał Miłecki
We were using wrong IRQ number so clearing wasn't working at all. Depending on a platform this could result in a one device having two interrupts assigned. On BCM4706 this resulted in all IRQs being broken. Cc: Hauke Mehrtens <hauke@hauke-m.de> Cc: stable@vger.kernel.org Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-12-10bcma: unify naming schema for clock functionsRafał Miłecki
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-12-06bcma: register watchdog driverHauke Mehrtens
Register the watchdog driver to the system if this is a SoC. Using the watchdog on a non SoC device, like a PCIe card, will make the PCIe card die when the timeout expired, but starting it again is not supported by bcma. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-12-06bcma: add methods for watchdog driverHauke Mehrtens
The watchdog driver wants to set the watchdog timeout in ms and not in ticks, which is depending on the SoC type and the clock. Calculate the number of ticks per millisecond and provide two functions for the watchdog driver. Also return the ticks or millisecond the timer was set to in case the provided value was bigger than the max allowed value. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-12-06bcma: set the pmu watchdog if availableHauke Mehrtens
Mostly all bcma based devices have a PMU and the PMU watchdog should be used and not the old one in chip common. This patch also calculates the maximal number the watchdog could be set to. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-12-06bcma: add bcma_chipco_alp_clockHauke Mehrtens
For devices without a PMU the alp clock is always 20000000. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-11-30bcma: handle return value of pci_assign_resourceHauke Mehrtens
This fixes the following warning: CC drivers/bcma/driver_pci_host.o drivers/bcma/driver_pci_host.c: In function 'bcma_core_pci_fixup_addresses': drivers/bcma/driver_pci_host.c:555:23: error: ignoring return value of 'pci_assign_resource', declared with attribute warn_unused_result [-Werror=unused-result] Reported-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-11-22bcma: export PLL reading functionRafał Miłecki
This is required by NAND flash driver for initializing wait counters. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-11-21bcma: add GPIO driverHauke Mehrtens
Register a GPIO driver to access the GPIOs provided by the chip. The GPIOs of the SoC should always start at 0 and the other GPIOs could start at a random position. There is just one SoC in a system and when they start at 0 the number is predictable. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Patchwork: http://patchwork.linux-mips.org/patch/4587 Acked-by: Florian Fainelli <florian@openwrt.org>
2012-11-21bcma: add comment to bcma_chipco_gpio_controlHauke Mehrtens
Add description to the function. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Patchwork: http://patchwork.linux-mips.org/patch/4588 Acked-by: Florian Fainelli <florian@openwrt.org>
2012-11-21bcma: add bcma_chipco_gpio_pull{up,down}Hauke Mehrtens
Add functions to access the GPIO registers for pullup and pulldown. These are needed for handling gpio registration. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Patchwork: http://patchwork.linux-mips.org/patch/4586 Acked-by: Florian Fainelli <florian@openwrt.org>
2012-11-21bcma: add locking around GPIO register accessesHauke Mehrtens
The GPIOs are access through some registers in the chip common core. We need locking around these GPIO accesses, all GPIOs are accessed through the same registers and parallel writes will cause problems. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Patchwork: http://patchwork.linux-mips.org/patch/4585 Acked-by: Florian Fainelli <florian@openwrt.org>
2012-10-29bcma: suspend/resume callbacks should be conditionally compiled on ↵Yuanhan Liu
CONFIG_PM_SLEEP This will fix warnings like following when CONFIG_PM_SLEEP is not set: warning: 'xxx_suspend' defined but not used [-Wunused-function] warning: 'xxx_resume' defined but not used [-Wunused-function] Because SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) Only references the callbacks on CONFIG_PM_SLEEP (instead of CONFIG_PM). Cc: John W. Linville <linville@tuxdriver.com> Cc: "Rafał Miłecki" <zajec5@gmail.com> Cc: linux-wireless@vger.kernel.org Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-23Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless Conflicts: drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c net/mac80211/mlme.c
2012-10-19bcma: do not initialize deactivated PCIe coresHauke Mehrtens
Before it was tried to initialize the deactivated PCIe core in client mode, but this causes the SoC to hang. Just do not initialize it at all and ignore the core it is not working and nothing is connected to it when the specific bit is set in the boardflags. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-19bcma: add an extra pcie core structHauke Mehrtens
The BCM4706 has two PCIe host controller on the bcma bus. For PCIe client mode it is assumed that there is only one PCIe controller so the PCIe driver, like b43 and brcmsmac are accessing the first PCIe controller when they want to issue a operation on the host controller. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-19bcma: use fallback sprom if sprom on card was not validHauke Mehrtens
Sometimes the PCIe card indicates that it has a sprom somewhere and we are able to read the memory region, but it is empty and not valid. In these cases we should try to use the fallback sprom as a last chance. This is the case for the PCIe cards in my ASUS RT-N66U (BCM4706 + 2 times BCM4331) and I have heard of someone having the same problem with an other PCIe card connected to an other Broadcom SoC. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-19bcma: add some more flash chips for serial flashHauke Mehrtens
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-19bcma: extract drv_cc in bcma_core_mips_flash_detect()Hauke Mehrtens
This makes the code more readable Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-19bcma: mark nflash if it is the boot flashHauke Mehrtens
There are some devices which are able to boot from nand flash and other are using a serial flash for booting. Add a bool to indicate that the device is booted from that flash chip and not from some other chip also connected to the SoC. This is needed to find the nvram, as it is stored on the flash the devices booted from. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-19bcma: add and use constants for the flash windowsHauke Mehrtens
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-19bcma: mark pflash as present when availableHauke Mehrtens
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-19bcma: init sprom struct earlierHauke Mehrtens
The PCIe host driver and the chip common initialisation accesses the sprom struct, but it is not initialized when these functions are run. Move the sprom parsing up in to do it earlier. As we need the chip common core rev and some other attributes from the chip common core, the early initialization is done before accessing the sprom. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-19bcma: just do the necessary things in early register on SoCsHauke Mehrtens
Some parts of the initialization for chip common and the pcie core are accessing the sprom struct, but it is not initialized at that stage. Just do the necessary thing in the early register on SoCs and not the complete initialization to read out the nvram from the flash chip. After it is possible to read out the nvram, the sprom should be parsed from it and the full initialization of the cores should be run. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-15bcma: fix unregistration of coresPiotr Haber
When cores are unregistered, entries need to be removed from cores list in a safe manner. Reported-by: Stanislaw Gruszka <sgruszka@redhat.com> Reviewed-by: Arend Van Spriel <arend@broadcom.com> Signed-off-by: Piotr Haber <phaber@broadcom.com> Cc: stable@vger.kernel.org Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-09-28bcma: change delays to follow timers-howto guideRafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Cc: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-09-24bcma: handle BCM43227Rafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Tested-by: Jack <x6719620@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-09-07Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
2012-09-07bcma: don't leak memory for PCIE, MIPS, GBIT coresSaul St. John
bcma_scan_bus allocates a bcma_core for each core found on the bus, but the memory for cores handled by the bcma driver itself was not being freed when the bus was unregistered. This patch adds special handling for the PCIE, MIPS, and GBIT COMMON cores, to ensure that their memory allocation is freed as well. Note that this patch doesn't address the memory allocated for the CC core, as that was corrected in my previous patch "bcma: register cc core driver, device." Cc: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Saul St. John <saul.stjohn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-08-21bcma: detect and register NAND flash deviceRafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-08-21bcma: detect and register serial flash deviceRafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-08-10bcma: make some functions staticHauke Mehrtens
The functions and structs are not used in an other file and the prototypes are in no header file, just make them static so the compiler is able to optimize them better. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-08-02bcma: BCM43228 supportRafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-27Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem
2012-07-26bcma: fix invalid PMU chip control masksHauke Mehrtens
Commit b9562545ef0b ("bcma: complete workaround for BCMA43224 and BCM4313") introduced the wrong masks for setting the chip control registers - the "mask" parameter is inverse. It should be the mask of bits *not* changed, which is admittedly a bit non-intuitive. The incorrect mask not only causes the driver to not work correctly on the chips affected (eg the BCM43224 on the Macbook Air 4,2) but the state persists over a soft reset, causing the next boot to not necessarily see the device correctly. Reported-and-tested-by: Linus Torvalds <torvalds@linux-foundation.org> Tested-by: Seth Forshee <seth.forshee@canonical.com> Cc: Hauke Mehrtens <hauke@hauke-m.de> Cc: Arend Van Spriel <arend@broadcom.com> Cc: Pieter-Paul Giesberts <pieterpg@broadcom.com> Cc: Brett Rudley <brudley@broadcom.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-07-26bcma: add missing iounmap on error pathHauke Mehrtens
This should fix the problem reported by Fengguang: The coccinelle static checker emits these warnings: drivers/bcma/scan.c:466:3-9: ERROR: missing iounmap; ioremap on line 451 and execution via conditional on line 465 drivers/bcma/scan.c:540:3-9: ERROR: missing iounmap; ioremap on line 515 and execution via conditional on line 539 Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-26bcma: fix regression in interrupt assignment on mipsHauke Mehrtens
The wrong interrupts where assigned to the cores in bcma_core_mips_init(). This caused at least my serial console not to response to any input. This was caused by this patch which changed the order of the cores in the list: commit c334e25c9f3a95f2bd6b79fedc5170f17245b1c7 Author: Rafał Miłecki <zajec5@gmail.com> Date: Wed Jul 11 12:37:00 2012 +0200 bcma: add new cores at the end of list This should be fixed properly later so that the correct interrupt numbers are assigned to the cores independently from the ordering of the list. This patch restores the old behavior again. I will look into the problem more deeply later. I also changed the order of the list with the cores and their assigned interrupt number which gets printed to the log. Now they are printed in the same order like all the other lists of cores and like it was done before the patch which changed the order. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-17bcma: add place for flash memory supportRafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-12bcma: add new cores at the end of listRafał Miłecki
This makes order in list more natural and fixes core->core_unit for more than 2 cores. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-12bcma: add trivial GBIT MAC COMMON driverRafał Miłecki
GMAC COMMON core is present on BCM4706 and is used for example to access board PHYs (PHYs can not be accessed directly using GBIT MAC core). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-12bcma: fix typo - reading number of slave wrappersRafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-12bcma: support alternative (BCM4706) ChipCommon core idRafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-11bcma: add PMU clock support for BCM4706Hauke Mehrtens
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Tested-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-11bcma: fix CC driver compilation on MIPSRafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-09bcma: use custom printing functionsRafał Miłecki
Having bus number printed makes it much easier to anaylze logs on systems with more buses. For example Netgear WNDR4500 has 3 AMBA buses in total, which makes standard log really messy. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-09bcma: add mdelay bcma_pmu_resources_init()Hauke Mehrtens
This is based on code from brcmsmac. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-09bcma: add bcma_pmu_spuravoid_pllupdate()Hauke Mehrtens
This function is needed by brcmsmac. This code is based on code from the Broadcom SDK. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-09bcma: remove chip ids doing nothing from PMU initialization.Hauke Mehrtens
The list of devices where nothing has to be done in bcma_pmu_resources_init() and bcma_pmu_workarounds() is longer as all the SoCs are missing there and some new devices will be added in some time later. This patch changes the default case to just log on debug level and also let the other devices which do not need any special handling into the default case, instead of adding the missing 8 SoC chip ids. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-09bcma: remove bcma_pmu_{pll,swreg}_init()Hauke Mehrtens
These functions are doing nothing in the current code. I do not think we will need these function in the future as the corresponding functions in the Broadcom SDK are just doing something useful on chips supported by ssb or fullmac chips. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-09bcma: complete workaround for BCMA43224 and BCM4313Hauke Mehrtens
This code is based on the Broadcom SDK and brcmsmac. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>