This pull request contains Broadcom SoC drivers changes for 7.2, please

pull the following:
 
 - Justin changes the soc_device driver to be more modern and consolidate
   the initialization
 
 - Chen-Yu updates the BCM2835 firmware Kconfig dependency and adds
   COMPILE_TEST
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEm+Rq3+YGJdiR9yuFh9CWnEQHBwQFAmod65gACgkQh9CWnEQH
 BwRaSw//a9u6jb7iZcT0drzDynqLcRNR7qM8QPgBNhQRQEHhH1CKx81958ktN+cT
 lnMyYdNwYBdBYovzf0UMxc00XxiEp+nEHqHt29nkfTx+lNFOqg0Wz0C7rQSNBKtJ
 bmgkcYEZhPS2e8njuCaKhPGVJJjBDTMAVawaYnItv0lsx6pOQrzbIsJWXqDEhhUJ
 Hm5Rg8f9V314tbNHabt5ffDOQosuPDEaCamZWpzEX5gdx0KTC1MW3RtOfTYaFwNC
 Lm1P/lNr+17aqaO4mU4WkilwsrJ1vYEwXpsdKrUc9lvLKm1QrvU15rxnx8f6W9CF
 bXNJw8h+IG370Ef8GSKHdfaRzlt3o4OwShVgc8jz0HN5dTzQCuPF+ycd02o73ush
 PfepJiavlT5O0NW965etVNlNgT5tA3xlPRSAep5H7ill99iqGBqxnVJX38DLyvN1
 slh9W0gDgxDM2p2YQ8+s0tOxdgzx2uSSBu+A6FUWI1mRg15G+He9QHBPHBrp9OTz
 lhKeAXcGZARw5hl0XtOlUMGP7SnznLgx7DRd9CfV/Y17J9AUqAqJj3nn40waWveX
 cJPnR9utLdfnmbh2m9sNd+G8ZNWpDo794v0+ZL8LSdyJh8Th6Psj0svuiWlHOmjW
 qLj8zPQIsCtd9RFccuY55lNR1VWau4uGE6ilaTIUK+y9n8q7UAg=
 =n15T
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmooKfYACgkQmmx57+YA
 GNkWGg//YLp8e3usfDeilJDL4Ddw9VzoeCBx4lo6Nq/PqdrpWw8zckM1GLXLmxoa
 UbmIoKeeFixNukJaTTrcylOlCo3jKduF0frK8TQQpYbe9NXmrj0lU2JUT6noerPz
 iWTwCiw6SLc4VbW+2RXLN2yfW69pIh1Zl8ijaD9wWyBNzHz5lBNs/a6ElZrPC/Gu
 OLAOhC4iTD0EtnHciukZDTxZWVnPliWOoFfBxH8h+919DTtruyDTNNzelGmNlKdY
 O+r+cCCIN54PbUNgelOsyr6uSSZZO7Py9W6en+DSwwBd8EdaNNC7ZXlor/1Dd+YX
 Afu6T5yyVZY8VqCEbhxTcVXz4Dd5X2LINZoMIWkCI8nY3l+5+gJ491liEiNpjOxa
 9OmcDhHnTT6R8qp1gS25INPlQ+tZmmXRknLloS5nIaY2Fz5e4gvG24rn104wd/2D
 oz91BcwvuIx2BDfi7Tlf76csGF3cS3o8eKTnLcpRzkKEsCsolIH+TLDv1aXBQ+IO
 kekItVJYuj+AF5S06NazxRztFn3WIrQ0+KeSgQYQfemeI4tkfh61ORB45y3Aelsd
 jyqJnBUNhjffr+YA6tZ3v63s49+92tzawhXJy5XRsww/OvcyfouH3H13KlIhjYzO
 2iHqrO9Szyow8HYmCPmyYPTB8o7D7i9vEsYV7PLKXOqByzBtZGk=
 =Uzzq
 -----END PGP SIGNATURE-----

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

This pull request contains Broadcom SoC drivers changes for 7.2, please
pull the following:

- Justin changes the soc_device driver to be more modern and consolidate
  the initialization

- Chen-Yu updates the BCM2835 firmware Kconfig dependency and adds
  COMPILE_TEST

* tag 'arm-soc/for-7.2/drivers' of https://github.com/Broadcom/stblinux:
  firmware: raspberrypi: Change dependency to ARCH_BCM2835 and COMPILE_TEST
  soc: brcmstb: consolidate initcall functions

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2026-06-09 16:57:55 +02:00
commit 41be4c94b0
2 changed files with 55 additions and 48 deletions

View File

@ -114,7 +114,10 @@ config ISCSI_IBFT
config RASPBERRYPI_FIRMWARE
tristate "Raspberry Pi Firmware Driver"
depends on BCM2835_MBOX
depends on ARCH_BCM2835 || COMPILE_TEST
depends on ARM || ARM64
depends on MAILBOX
default ARCH_BCM2835
help
This option enables support for communicating with the firmware on the
Raspberry Pi.

View File

@ -11,18 +11,22 @@
#include <linux/soc/brcmstb/brcmstb.h>
#include <linux/sys_soc.h>
static u32 family_id;
static u32 product_id;
struct brcmstb_soc_info {
u32 family_id;
u32 product_id;
};
static struct brcmstb_soc_info *soc_info;
u32 brcmstb_get_family_id(void)
{
return family_id;
return soc_info ? soc_info->family_id : 0;
}
EXPORT_SYMBOL(brcmstb_get_family_id);
u32 brcmstb_get_product_id(void)
{
return product_id;
return soc_info ? soc_info->product_id : 0;
}
EXPORT_SYMBOL(brcmstb_get_product_id);
@ -40,38 +44,11 @@ static const struct of_device_id sun_top_ctrl_match[] = {
{ }
};
static int __init brcmstb_soc_device_early_init(void)
{
struct device_node *sun_top_ctrl;
void __iomem *sun_top_ctrl_base;
int ret = 0;
/* We could be on a multi-platform kernel, don't make this fatal but
* bail out early
*/
sun_top_ctrl = of_find_matching_node(NULL, sun_top_ctrl_match);
if (!sun_top_ctrl)
return ret;
sun_top_ctrl_base = of_iomap(sun_top_ctrl, 0);
if (!sun_top_ctrl_base) {
ret = -ENODEV;
goto out;
}
family_id = readl(sun_top_ctrl_base);
product_id = readl(sun_top_ctrl_base + 0x4);
iounmap(sun_top_ctrl_base);
out:
of_node_put(sun_top_ctrl);
return ret;
}
early_initcall(brcmstb_soc_device_early_init);
static int __init brcmstb_soc_device_init(void)
{
struct soc_device_attribute *soc_dev_attr;
struct device_node *sun_top_ctrl;
void __iomem *sun_top_ctrl_base;
struct soc_device *soc_dev;
int ret = 0;
@ -80,34 +57,61 @@ static int __init brcmstb_soc_device_init(void)
*/
sun_top_ctrl = of_find_matching_node(NULL, sun_top_ctrl_match);
if (!sun_top_ctrl)
return ret;
return 0;
sun_top_ctrl_base = of_iomap(sun_top_ctrl, 0);
if (!sun_top_ctrl_base) {
ret = -ENODEV;
goto out_put_node;
}
soc_info = kzalloc(sizeof(*soc_info), GFP_KERNEL);
if (!soc_info) {
ret = -ENOMEM;
goto out_unmap;
}
soc_info->family_id = readl(sun_top_ctrl_base);
soc_info->product_id = readl(sun_top_ctrl_base + 0x4);
soc_dev_attr = kzalloc_obj(*soc_dev_attr);
if (!soc_dev_attr) {
ret = -ENOMEM;
goto out;
goto out_free_info;
}
soc_dev_attr->family = kasprintf(GFP_KERNEL, "%x",
family_id >> 28 ?
family_id >> 16 : family_id >> 8);
soc_info->family_id >> 28 ?
soc_info->family_id >> 16 : soc_info->family_id >> 8);
soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%x",
product_id >> 28 ?
product_id >> 16 : product_id >> 8);
soc_info->product_id >> 28 ?
soc_info->product_id >> 16 : soc_info->product_id >> 8);
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c%d",
((product_id & 0xf0) >> 4) + 'A',
product_id & 0xf);
((soc_info->product_id & 0xf0) >> 4) + 'A',
soc_info->product_id & 0xf);
soc_dev = soc_device_register(soc_dev_attr);
if (IS_ERR(soc_dev)) {
kfree(soc_dev_attr->family);
kfree(soc_dev_attr->soc_id);
kfree(soc_dev_attr->revision);
kfree(soc_dev_attr);
ret = -ENOMEM;
ret = PTR_ERR(soc_dev);
goto out_free_attr;
}
out:
iounmap(sun_top_ctrl_base);
of_node_put(sun_top_ctrl);
return 0;
out_free_attr:
kfree(soc_dev_attr->revision);
kfree(soc_dev_attr->soc_id);
kfree(soc_dev_attr->family);
kfree(soc_dev_attr);
out_free_info:
kfree(soc_info);
soc_info = NULL;
out_unmap:
iounmap(sun_top_ctrl_base);
out_put_node:
of_node_put(sun_top_ctrl);
return ret;
}
arch_initcall(brcmstb_soc_device_init);
early_initcall(brcmstb_soc_device_init);