This pull request contains Broadcom SoCs driver changes for 6.2, please

pull the following:
 
 - Yuan uses dev_err_probe() in the Raspberry Pi firmware provider to
   simplify the error handling code
 
 - Rafal adds support for initialiazing the BCM47xx NVMEM/NVRAM firmware
   provider out of memory-mapped flash devices.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEm+Rq3+YGJdiR9yuFh9CWnEQHBwQFAmOGWqQACgkQh9CWnEQH
 BwRXVRAA5ieip57Dr+TFlOKgVVsLR0lildCIEf8xBLS2248JpLOdcZiEH8A52l09
 zqWLjWkWmgHnVHJ8hxLGZojsuWZvTI1bg/Y6IOY6ZQRSpFGR9DMTmedAdmmOe6Wi
 tXApkgfsR5s/vkTye/Sd8x9vJRI+V6BEO2maH891Tqz533FpqPM67GXpW5dClu5D
 0hL/I9bnDoRtugfycLiH1y9I7wrQdAvkSYjgo7ncQLSb5Zw3b3993hRvQ2Afcq+F
 mnmsCoCeBsWFh8VO+qy3cmxQi7P031kxxH01+XHo+3glCx9TMzUSL71dT0kybXEU
 5yf2Ej7yuqUpsHQIj1ET6+wb8K2QXOv2onn3wIy1WncgWbZjOgFGUEb69U+vXBLa
 Y/0U81Ib421LspIM4/brIdX/UKeFy04gz9/r+i+pme5+WMBcamm8/TS79lxJdxKt
 gjOw2jEXM26cCCXkHRrLPFebi1c2Y2I/r6/YYLvwzt7uSBqaj2afw2ZCbRR3Om2j
 JJsA+wqql1iAx1vrPb6nSeBf/Dbl+HuFlynxn7rTnUcgeNmjLamdywE5TBpiKUws
 P1rXV3gKeMEk2IQksE/jukBmSW1efkbMA2u63BUmrwMmh17CBJddY2ttK0w7AFPU
 WmrncPB4WpvPBzeUOC4IvmbzYJHbhRZ6tkcOMP5UWRhcI1HKrg0=
 =7dAD
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmOHirEACgkQmmx57+YA
 GNkMNRAAtJfwKAc2/v/4R6bnqaSiN9Fc+i6LosszuXBVaac2D72js6oV2R26WfYN
 COlOXs6rV4HvHPtWban40NkrmNFxJixW1vrWfkWjjstX28VqzKJnv6oUOCUaigB4
 alHqOIB6jGo6BH5+Kro0/8G1F9pbZ0PWaTpY90ison+LKzVPn8ZGU03YHLYIpq2q
 zeACwCeNIqjP376QjLCf3dwsEuswaSRoCkOCjMzlOJhamy5XRivIpvPP+0Qkrvcu
 YN1wqrwXBJ7/YrlmKBwQBEtN0pEIIzvL+vvZKp99VOCB7ofx9SAUcwSDF7LA5+q3
 5JW38H8nFQGsDaWrw1E++fsd8o4wFbLn0K2altNwjTIMjoBbaFopnXdRW3Jp3lhS
 R+iQ8sobDkHIDvw2a7Ski8PursVo9hC8ZRdF6FPazLPQJrHe6SoWLzbRw5dovdsK
 tSFQ/DqjfmDlkrUfa8iXSQnTzdTObi3N5OHGTp+KHlJad34MhPuNW4JVGhXm2OGE
 mGKL/2HIN5w5GxE1D8YoKexaeBjvc0zi2zHvb/dIUbN3aeK2p3wQsMyvf424SAMe
 1zsg+AnwbASLmkEPjBTqxnec82FG0a6cvYJ5UtcdJ6J0YlSUVm07zimzYKJY2M1d
 ryjSN6dKpanyIcJInWfCecmvICS2KTerpcVyte6VST5TDKc5ZNo=
 =wHNl
 -----END PGP SIGNATURE-----

Merge tag 'arm-soc/for-6.2/drivers' of https://github.com/Broadcom/stblinux into soc/drivers

This pull request contains Broadcom SoCs driver changes for 6.2, please
pull the following:

- Yuan uses dev_err_probe() in the Raspberry Pi firmware provider to
  simplify the error handling code

- Rafal adds support for initialiazing the BCM47xx NVMEM/NVRAM firmware
  provider out of memory-mapped flash devices.

* tag 'arm-soc/for-6.2/drivers' of https://github.com/Broadcom/stblinux:
  firmware/nvram: bcm47xx: support init from IO memory
  firmware: raspberrypi: Use dev_err_probe() to simplify code

Link: https://lore.kernel.org/r/20221129191755.542584-3-f.fainelli@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2022-11-30 17:52:39 +01:00
commit 69a485191b
4 changed files with 30 additions and 6 deletions

View File

@ -110,6 +110,24 @@ found:
return 0;
}
int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size)
{
if (nvram_len) {
pr_warn("nvram already initialized\n");
return -EEXIST;
}
if (!bcm47xx_nvram_is_valid(nvram_start)) {
pr_err("No valid NVRAM found\n");
return -ENOENT;
}
bcm47xx_nvram_copy(nvram_start, res_size);
return 0;
}
EXPORT_SYMBOL_GPL(bcm47xx_nvram_init_from_iomem);
/*
* On bcm47xx we need access to the NVRAM very early, so we can't use mtd
* subsystem to access flash. We can't even use platform device / driver to

View File

@ -268,12 +268,9 @@ static int rpi_firmware_probe(struct platform_device *pdev)
fw->cl.tx_block = true;
fw->chan = mbox_request_channel(&fw->cl, 0);
if (IS_ERR(fw->chan)) {
int ret = PTR_ERR(fw->chan);
if (ret != -EPROBE_DEFER)
dev_err(dev, "Failed to get mbox channel: %d\n", ret);
return ret;
}
if (IS_ERR(fw->chan))
return dev_err_probe(dev, PTR_ERR(fw->chan),
"Failed to get mbox channel\n");
init_completion(&fw->c);
kref_init(&fw->consumers);

View File

@ -3,6 +3,7 @@
* Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
*/
#include <linux/bcm47xx_nvram.h>
#include <linux/io.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
@ -136,6 +137,8 @@ static int brcm_nvram_probe(struct platform_device *pdev)
if (err)
return err;
bcm47xx_nvram_init_from_iomem(priv->base, resource_size(res));
config.dev = dev;
config.cells = priv->cells;
config.ncells = priv->ncells;

View File

@ -11,6 +11,7 @@
#include <linux/vmalloc.h>
#ifdef CONFIG_BCM47XX_NVRAM
int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size);
int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
int bcm47xx_nvram_gpio_pin(const char *name);
@ -20,6 +21,11 @@ static inline void bcm47xx_nvram_release_contents(char *nvram)
vfree(nvram);
};
#else
static inline int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start,
size_t res_size)
{
return -ENOTSUPP;
}
static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
{
return -ENOTSUPP;