aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-brcmstb.c
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-01-12 15:50:28 +0000
committersaturneric <[email protected]>2025-01-12 15:50:28 +0000
commitb7c94eb866dd341a28367bdfabd7c2d1b14d688e (patch)
treeb6df897425af99dbfef5ad4d91a969f1e58fdae6 /drivers/gpio/gpio-brcmstb.c
parentMerge tag 'hwmon-for-v6.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/... (diff)
downloadkernel-b7c94eb866dd341a28367bdfabd7c2d1b14d688e.tar.gz
kernel-b7c94eb866dd341a28367bdfabd7c2d1b14d688e.zip
fix: drivers patch make raspberry pi 5 work properly
Diffstat (limited to 'drivers/gpio/gpio-brcmstb.c')
-rw-r--r--drivers/gpio/gpio-brcmstb.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index 491b529d25f8..0a7a4fe9e1c6 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -633,6 +633,8 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
#if defined(CONFIG_MIPS) && defined(__BIG_ENDIAN)
flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER;
#endif
+ if (of_property_read_bool(np, "brcm,gpio-direct"))
+ flags |= BGPIOF_REG_DIRECT;
of_property_for_each_u32(np, "brcm,gpio-bank-widths", bank_width) {
struct brcmstb_gpio_bank *bank;
@@ -681,7 +683,9 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
}
gc->owner = THIS_MODULE;
- gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pOF", np);
+ gc->label = devm_kasprintf(dev, GFP_KERNEL, "gpio-brcmstb@%zx",
+ (size_t)res->start +
+ GIO_BANK_OFF(bank->id, 0));
if (!gc->label) {
err = -ENOMEM;
goto fail;
@@ -689,7 +693,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
gc->of_gpio_n_cells = 2;
gc->of_xlate = brcmstb_gpio_of_xlate;
/* not all ngpio lines are valid, will use bank width later */
- gc->ngpio = MAX_GPIO_PER_BANK;
+ gc->ngpio = bank_width;
gc->offset = bank->id * MAX_GPIO_PER_BANK;
gc->request = gpiochip_generic_request;
gc->free = gpiochip_generic_free;
@@ -700,8 +704,10 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
* Mask all interrupts by default, since wakeup interrupts may
* be retained from S5 cold boot
*/
- need_wakeup_event |= !!__brcmstb_gpio_get_active_irqs(bank);
- gc->write_reg(reg_base + GIO_MASK(bank->id), 0);
+ if (priv->parent_irq > 0) {
+ need_wakeup_event |= !!__brcmstb_gpio_get_active_irqs(bank);
+ gc->write_reg(reg_base + GIO_MASK(bank->id), 0);
+ }
err = gpiochip_add_data(gc, bank);
if (err) {