aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware/broadcom
AgeCommit message (Collapse)AuthorFilesLines
2023-04-13MIPS: BCM47XX: remove MODULE_LICENSE in non-modulesNick Alcock1-1/+0
Since commit 8b41fc4454e ("kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations are used to identify modules. As a consequence, uses of the macro in non-modules will cause modprobe to misidentify their containing object file as a module when it is not (false positives), and modprobe might succeed rather than failing with a suitable error message. So remove it in the files in this commit, none of which can be built as modules. Signed-off-by: Nick Alcock <[email protected]> Suggested-by: Luis Chamberlain <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Cc: Luis Chamberlain <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Hitomi Hasegawa <[email protected]> Cc: "Rafał Miłecki" <[email protected]> Cc: [email protected] Signed-off-by: Luis Chamberlain <[email protected]>
2022-11-09firmware/nvram: bcm47xx: support init from IO memoryRafał Miłecki1-0/+18
Provide NVMEM content to the NVRAM driver from a simple memory resource. This is necessary to use NVRAM in a memory- mapped flash device. Patch taken from OpenWrts development tree. This patch makes it possible to use memory-mapped NVRAM on the D-Link DWL-8610AP and the D-Link DIR-890L. Cc: Hauke Mehrtens <[email protected]> Cc: [email protected] Cc: Florian Fainelli <[email protected]> Cc: [email protected] Cc: Thomas Bogendoerfer <[email protected]> Signed-off-by: Rafał Miłecki <[email protected]> [Added an export for modules potentially using the init symbol] Signed-off-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Florian Fainelli <[email protected]>
2022-05-05firmware: tee_bnxt: Use UUID API for exporting the UUIDAndy Shevchenko1-1/+1
There is export_uuid() function which exports uuid_t to the u8 array. Use it instead of open coding variant. This allows to hide the uuid_t internals. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2021-07-21firmware: tee_bnxt: Release TEE shm, session, and context during kexecAllen Pais1-3/+11
Implement a .shutdown hook that will be called during a kexec operation so that the TEE shared memory, session, and context that were set up during .probe can be properly freed/closed. Additionally, don't use dma-buf backed shared memory for the fw_shm_pool. dma-buf backed shared memory cannot be reliably freed and unregistered during a kexec operation even when tee_shm_free() is called on the shm from a .shutdown hook. The problem occurs because dma_buf_put() calls fput() which then uses task_work_add(), with the TWA_RESUME parameter, to queue tee_shm_release() to be called before the current task returns to user mode. However, the current task never returns to user mode before the kexec completes so the memory is never freed nor unregistered. Use tee_shm_alloc_kernel_buf() to avoid dma-buf backed shared memory allocation so that tee_shm_free() can directly call tee_shm_release(). This will ensure that the shm can be freed and unregistered during a kexec operation. Fixes: 246880958ac9 ("firmware: broadcom: add OP-TEE based BNXT f/w manager") Cc: [email protected] Signed-off-by: Allen Pais <[email protected]> Co-developed-by: Tyler Hicks <[email protected]> Signed-off-by: Tyler Hicks <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Acked-by: Florian Fainelli <[email protected]> Signed-off-by: Jens Wiklander <[email protected]>
2021-03-12firmware: bcm47xx_nvram: inline code checking NVRAM sizeRafał Miłecki1-18/+7
Separated function was not improving code quality much (or at all). Moreover it expected possible flash end address as argument and it was returning NVRAM size. The new code always operates on offsets which means less logic and less calculations. Signed-off-by: Rafał Miłecki <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-03-12firmware: bcm47xx_nvram: look for NVRAM with for instead of whileRafał Miłecki1-3/+1
This loop requires variable initialization, stop condition and post iteration increment. It's pretty much a for loop definition. Signed-off-by: Rafał Miłecki <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-03-12firmware: bcm47xx_nvram: extract code copying NVRAMRafał Miłecki1-18/+25
This simplifies function finding NVRAM. It doesn't directly deal with NVRAM structure anymore and is a bit smaller. Signed-off-by: Rafał Miłecki <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-03-12firmware: bcm47xx_nvram: add helper checking for NVRAMRafał Miłecki1-12/+18
This avoids duplicating code doing casting and checking for NVRAM magic. Signed-off-by: Rafał Miłecki <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-03-12firmware: bcm47xx_nvram: rename finding function and its variablesRafał Miłecki1-11/+13
1. Use "bcm47xx_" function name prefix for consistency 2. It takes flash start as argument so s/iobase/flash_start/ 3. "off" was used for finding flash end so just call it "flash_size" Signed-off-by: Rafał Miłecki <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2020-08-17firmware: bcm47xx_sprom: Fix -Wmissing-prototypes warningsFlorian Fainelli1-0/+1
bcm47xx_sprom.h did not include a prototype for bcm47xx_fill_sprom() therefore add one, and make sure we do include that header to fix -Wmissing-prototypes warnings. Reported-by: kernel test robot <[email protected]> Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2020-01-27Merge tag 'ioremap-5.6' of git://git.infradead.org/users/hch/ioremapLinus Torvalds1-1/+1
Pull ioremap updates from Christoph Hellwig: "Remove the ioremap_nocache API (plus wrappers) that are always identical to ioremap" * tag 'ioremap-5.6' of git://git.infradead.org/users/hch/ioremap: remove ioremap_nocache and devm_ioremap_nocache MIPS: define ioremap_nocache to ioremap
2020-01-06firmware: tee_bnxt: Fix multiple call to tee_client_close_contextVikas Gupta1-1/+0
Fix calling multiple tee_client_close_context in case of shm allocation fails. Fixes: 246880958ac9 (“firmware: broadcom: add OP-TEE based BNXT f/w manager”) Signed-off-by: Vikas Gupta <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2020-01-06remove ioremap_nocache and devm_ioremap_nocacheChristoph Hellwig1-1/+1
ioremap has provided non-cached semantics by default since the Linux 2.6 days, so remove the additional ioremap_nocache interface. Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Arnd Bergmann <[email protected]>
2019-10-31firmware: broadcom: add OP-TEE based BNXT f/w managerVikas Gupta3-0/+288
This driver registers on TEE bus to interact with OP-TEE based BNXT firmware management modules Cc: Jakub Kicinski <[email protected]> Reported-by: kbuild test robot <[email protected]> Signed-off-by: Vikas Gupta <[email protected]> Signed-off-by: Sheetal Tigadoli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-09-22firmware: bcm47xx_nvram: _really_ correct size_t printf formatLinus Torvalds1-1/+1
Commit feb4eb060c3a ("firmware: bcm47xx_nvram: Correct size_t printf format") was wrong, and changed a printout of 'header.len' - which is an u32 type - to use '%zu'. It apparently did pattern matching on the other case, where it printed out 'nvram_len', which is indeed of type 'size_t'. Rather than undoing the change, this just makes it use the variable that the change seemed to expect to be used. Cc: Florian Fainelli <[email protected]> Cc: Philippe Mathieu-Daudé <[email protected]> Cc: Paul Burton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2019-08-26firmware: bcm47xx_nvram: Allow COMPILE_TESTFlorian Fainelli1-1/+1
Allow building building the BCM47xx NVRAM and SPROM drivers using COMPILE_TEST. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: Paul Burton <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Rafał Miłecki <[email protected]> Cc: [email protected] Cc: [email protected]
2019-08-26firmware: bcm47xx_nvram: Correct size_t printf formatFlorian Fainelli1-2/+2
When building on a 64-bit host, we will get warnings like those: drivers/firmware/broadcom/bcm47xx_nvram.c:103:3: note: in expansion of macro 'pr_err' pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", ^~~~~~ drivers/firmware/broadcom/bcm47xx_nvram.c:103:28: note: format string is defined here pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n", ~^ %li Use %zu instead for that purpose. Signed-off-by: Florian Fainelli <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Paul Burton <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Rafał Miłecki <[email protected]> Cc: [email protected] Cc: [email protected]
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner1-5/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner2-0/+2
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-04-23firmware: bcm47xx_nvram: Support small (0x6000 B) NVRAM partitionsRafał Miłecki1-1/+1
Some old devices with 4 MiB flashes were using 0x1000 block size and could use smaller (0x6000 bytes) flash partition for storing NVRAM content. This adds support for reading NVRAM on Netgear WNR1000 V3. Signed-off-by: Rafał Miłecki <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Hauke Mehrtens <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/19005/ Signed-off-by: James Hogan <[email protected]>
2018-03-09FIRMWARE: bcm47xx_nvram: Replace mac address parsingAndy Shevchenko2-15/+4
Replace sscanf() with mac_pton(). Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Hauke Mehrtens <[email protected]> Cc: David S. Miller <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/17982/ Signed-off-by: James Hogan <[email protected]>
2016-08-04tree-wide: replace config_enabled() with IS_ENABLED()Masahiro Yamada1-1/+1
The use of config_enabled() against config options is ambiguous. In practical terms, config_enabled() is equivalent to IS_BUILTIN(), but the author might have used it for the meaning of IS_ENABLED(). Using IS_ENABLED(), IS_BUILTIN(), IS_MODULE() etc. makes the intention clearer. This commit replaces config_enabled() with IS_ENABLED() where possible. This commit is only touching bool config options. I noticed two cases where config_enabled() is used against a tristate option: - config_enabled(CONFIG_HWMON) [ drivers/net/wireless/ath/ath10k/thermal.c ] - config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE) [ drivers/gpu/drm/gma500/opregion.c ] I did not touch them because they should be converted to IS_BUILTIN() in order to keep the logic, but I was not sure it was the authors' intention. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Kees Cook <[email protected]> Cc: Stas Sergeev <[email protected]> Cc: Matt Redfearn <[email protected]> Cc: Joshua Kinard <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Markos Chandras <[email protected]> Cc: "Dmitry V. Levin" <[email protected]> Cc: yu-cheng yu <[email protected]> Cc: James Hogan <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Johannes Berg <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Al Viro <[email protected]> Cc: Will Drewry <[email protected]> Cc: Nikolay Martynov <[email protected]> Cc: Huacai Chen <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Leonid Yegoshin <[email protected]> Cc: Rafal Milecki <[email protected]> Cc: James Cowgill <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Alex Smith <[email protected]> Cc: Adam Buchbinder <[email protected]> Cc: Qais Yousef <[email protected]> Cc: Jiang Liu <[email protected]> Cc: Mikko Rapeli <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: Brian Norris <[email protected]> Cc: Hidehiro Kawai <[email protected]> Cc: "Luis R. Rodriguez" <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Dave Hansen <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Roland McGrath <[email protected]> Cc: Paul Burton <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Viresh Kumar <[email protected]> Cc: Tony Wu <[email protected]> Cc: Huaitong Han <[email protected]> Cc: Sumit Semwal <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Jason Cooper <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Andrea Gelmini <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Rabin Vincent <[email protected]> Cc: "Maciej W. Rozycki" <[email protected]> Cc: David Daney <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-05-13MIPS: BCM47xx: Move SPROM driver to drivers/firmware/Rafał Miłecki3-0/+749
Broadcom ARM home routers store SPROM content in NVRAM just like MIPS ones. To share SPROM code we need to move it out of arch/mips/ to some common place. We already have bcm47xx_nvram in firmware path and SPROM should fit there as well. This driver is responsible for parsing SoC configuration data into a struct shared between ssb and bcma buses. This was tested with BCM4706 & BCM5357C0 (BCM47XX) and BCM4708A0 (ARCH_BCM_5301X). Signed-off-by: Rafał Miłecki <[email protected]> Cc: Hauke Mehrtens <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/12210/ Signed-off-by: Ralf Baechle <[email protected]>
2016-03-17drivers/firmware/broadcom/bcm47xx_nvram.c: fix incorrect __ioread32_copyAaro Koskinen1-3/+2
Commit 1f330c327900 ("drivers/firmware/broadcom/bcm47xx_nvram.c: use __ioread32_copy() instead of open-coding") switched to use a generic copy function, but failed to notice that the header pointer is updated between the two copies, resulting in bogus data being copied in the latter one. Fix by keeping the old header pointer. The patch fixes totally broken networking on WRT54GL router (both LAN and WLAN interfaces fail to probe). Fixes: 1f330c327900 ("drivers/firmware/broadcom/bcm47xx_nvram.c: use __ioread32_copy() instead of open-coding") Signed-off-by: Aaro Koskinen <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Cc: Rafal Milecki <[email protected]> Cc: Hauke Mehrtens <[email protected]> Cc: <[email protected]> [4.4.x] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-01-20drivers/firmware/broadcom/bcm47xx_nvram.c: use __ioread32_copy() instead of ↵Stephen Boyd1-8/+3
open-coding Now that we have a generic library function for this, replace the open-coded instance. Signed-off-by: Stephen Boyd <[email protected]> Cc: Hauke Mehrtens <[email protected]> Cc: <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Bjorn Andersson <[email protected]> Cc: David Howells <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2015-08-19FIRMWARE: bcm47xx_nvram: Fix module license.Axel Lin1-1/+1
Signed-off-by: Axel Lin <[email protected]> Cc: Hauke Mehrtens <[email protected]> Cc: Rafał Miłecki <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/11020/ Signed-off-by: Ralf Baechle <[email protected]>
2015-06-21MIPS: BCM47xx: Move NVRAM driver to the drivers/firmware/Rafał Miłecki3-0/+260
After Broadcom switched from MIPS to ARM for their home routers we need to have NVRAM driver in some common place (not arch/mips/). As explained in Kconfig, this driver is responsible for parsing SoC configuration data that is passed to the kernel in flash from the bootloader firmware called "CFE". We were thinking about putting it in bus directory, however there are two possible buses for MIPS: drivers/ssb/ and drivers/bcma/. So this won't fit there and this is why I would like to move this driver to the drivers/firmware/. Signed-off-by: Rafał Miłecki <[email protected]> Reviewed-by: Paul Walmsley <[email protected]> Cc: [email protected] Cc: Hauke Mehrtens <[email protected]> Cc: Seiji Aguchi <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Mike Waychison <[email protected]> Cc: Roy Franz <[email protected]> Cc: Matt Fleming <[email protected]> Cc: Linus Torvalds <[email protected]> Patchwork: https://patchwork.linux-mips.org/patch/10544/ Signed-off-by: Ralf Baechle <[email protected]>