Immutable branch between GPIO, MFD and ARM-SoC for v6.17-rc1

Remove struct bgpio_pdata after converting its users to generic device
 properties.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmhreU4ACgkQEacuoBRx
 13LIJQ//VJTGNN3xgAVop4t9aMa+4OBnE1F8l18Di8H8/ZOe7PiAc6BAleioHl+h
 zuc6uwgOZQUnUdEAYRVHkQJnI/1N65PO+DUFGQD4pABM7R1oW37aE7VNnW5HkjWh
 WQl1mxIBdKyuR65HbCS76Ek/WzP3Qh37yNSS1gI9ISbbbHW77A3w88miBZwFVRof
 KcNGM+oARbJC8ARAw+i+HsVODTouE7fH2Tr8aum2OExZs+wjroi3iLQQaup2lb9Y
 gZzNN/pdOktVjk0/7HRJI/9zRDDxR3N7S/KXsyBd7vBfvM/RDqFHq8/o7K+HrXR1
 pxp5fqqW29S82P2+7YTnU65pLJeyC2oEWwGJN+bB46dVG8BEBAa1s94UVCJF4Zq5
 /rC69U5NxBL7XUolQ9WxiEXXlh1c0unlH/CJMiXcllR3DpYls3MIfymWKQvomve8
 z7ub6gWTal0oW9TO3y8flPHBBslS0pZCgqmdenJdoLc+rc+cQRt2hmaquaOMbPqR
 kqK+NI4aBdJ9JessW7I4zrWLRD8LhzT2zidyLgDwN1ghck1WD/Of0g7M8I1U2AZN
 LmXRdPmDrHpKV7E/x3+Clsmq9n1A6q7i0PEcON1cv99LofK3vIWe3eBZvVyySnT7
 szjVqngNlzePbRTTlsRcaOYPCcHu3yNxmLPwynqvL/pjjmJqaPQ=
 =k0Ui
 -----END PGP SIGNATURE-----

Merge tag 'gpio-mmio-remove-bgpio-pdata-for-v6.17-rc1' into gpio/for-next

Immutable branch between GPIO, MFD and ARM-SoC for v6.17-rc1

Remove struct bgpio_pdata after converting its users to generic device
properties.
This commit is contained in:
Bartosz Golaszewski 2025-07-07 09:42:37 +02:00
commit 179a666951
5 changed files with 77 additions and 95 deletions

View file

@ -19,6 +19,7 @@
#include <linux/mtd/nand-gpio.h>
#include <linux/mtd/partitions.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
@ -175,20 +176,18 @@ static struct resource latch1_resources[] = {
#define LATCH1_LABEL "latch1"
static struct bgpio_pdata latch1_pdata = {
.label = LATCH1_LABEL,
.base = -1,
.ngpio = LATCH1_NGPIO,
static const struct property_entry latch1_gpio_props[] = {
PROPERTY_ENTRY_STRING("label", LATCH1_LABEL),
PROPERTY_ENTRY_U32("ngpios", LATCH1_NGPIO),
{ }
};
static struct platform_device latch1_gpio_device = {
static const struct platform_device_info latch1_gpio_devinfo = {
.name = "basic-mmio-gpio",
.id = 0,
.resource = latch1_resources,
.num_resources = ARRAY_SIZE(latch1_resources),
.dev = {
.platform_data = &latch1_pdata,
},
.res = latch1_resources,
.num_res = ARRAY_SIZE(latch1_resources),
.properties = latch1_gpio_props,
};
#define LATCH1_PIN_LED_CAMERA 0
@ -213,20 +212,18 @@ static struct resource latch2_resources[] = {
#define LATCH2_LABEL "latch2"
static struct bgpio_pdata latch2_pdata = {
.label = LATCH2_LABEL,
.base = -1,
.ngpio = LATCH2_NGPIO,
static const struct property_entry latch2_gpio_props[] = {
PROPERTY_ENTRY_STRING("label", LATCH2_LABEL),
PROPERTY_ENTRY_U32("ngpios", LATCH2_NGPIO),
{ }
};
static struct platform_device latch2_gpio_device = {
static struct platform_device_info latch2_gpio_devinfo = {
.name = "basic-mmio-gpio",
.id = 1,
.resource = latch2_resources,
.num_resources = ARRAY_SIZE(latch2_resources),
.dev = {
.platform_data = &latch2_pdata,
},
.res = latch2_resources,
.num_res = ARRAY_SIZE(latch2_resources),
.properties = latch2_gpio_props,
};
#define LATCH2_PIN_LCD_VBLEN 0
@ -542,8 +539,6 @@ static struct gpiod_lookup_table keybrd_pwr_gpio_table = {
};
static struct platform_device *ams_delta_devices[] __initdata = {
&latch1_gpio_device,
&latch2_gpio_device,
&ams_delta_kp_device,
&ams_delta_audio_device,
&ams_delta_serio_device,
@ -697,6 +692,9 @@ static void __init ams_delta_init(void)
omap1_usb_init(&ams_delta_usb_config);
platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
platform_device_register_full(&latch1_gpio_devinfo);
platform_device_register_full(&latch2_gpio_devinfo);
/*
* As soon as regulator consumers have been registered, assign their
* dev_names to consumer supply entries of respective regulators.

View file

@ -252,14 +252,17 @@ static struct resource crag6410_mmgpio_resource[] = {
[0] = DEFINE_RES_MEM_NAMED(S3C64XX_PA_XM0CSN4, 1, "dat"),
};
static struct platform_device crag6410_mmgpio = {
static const struct property_entry crag6410_mmgpio_props[] = {
PROPERTY_ENTRY_U32("gpio-mmio,base", MMGPIO_GPIO_BASE),
{ }
};
static struct platform_device_info crag6410_mmgpio_devinfo = {
.name = "basic-mmio-gpio",
.id = -1,
.resource = crag6410_mmgpio_resource,
.num_resources = ARRAY_SIZE(crag6410_mmgpio_resource),
.dev.platform_data = &(struct bgpio_pdata) {
.base = MMGPIO_GPIO_BASE,
},
.res = crag6410_mmgpio_resource,
.num_res = ARRAY_SIZE(crag6410_mmgpio_resource),
.properties = crag6410_mmgpio_props,
};
static struct platform_device speyside_device = {
@ -373,7 +376,6 @@ static struct platform_device *crag6410_devices[] __initdata = {
&crag6410_gpio_keydev,
&crag6410_dm9k_device,
&s3c64xx_device_spi0,
&crag6410_mmgpio,
&crag6410_lcd_powerdev,
&crag6410_backlight_device,
&speyside_device,
@ -871,6 +873,7 @@ static void __init crag6410_machine_init(void)
pwm_add_table(crag6410_pwm_lookup, ARRAY_SIZE(crag6410_pwm_lookup));
platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
platform_device_register_full(&crag6410_mmgpio_devinfo);
gpio_led_register_device(-1, &gpio_leds_pdata);

View file

@ -734,28 +734,6 @@ static const struct of_device_id bgpio_of_match[] = {
};
MODULE_DEVICE_TABLE(of, bgpio_of_match);
static struct bgpio_pdata *bgpio_parse_fw(struct device *dev, unsigned long *flags)
{
struct bgpio_pdata *pdata;
if (!dev_fwnode(dev))
return NULL;
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return ERR_PTR(-ENOMEM);
pdata->base = -1;
if (device_is_big_endian(dev))
*flags |= BGPIOF_BIG_ENDIAN_BYTE_ORDER;
if (device_property_read_bool(dev, "no-output"))
*flags |= BGPIOF_NO_OUTPUT;
return pdata;
}
static int bgpio_pdev_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@ -767,18 +745,10 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
void __iomem *dirin;
unsigned long sz;
unsigned long flags = 0;
unsigned int base;
int err;
struct gpio_chip *gc;
struct bgpio_pdata *pdata;
pdata = bgpio_parse_fw(dev, &flags);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
if (!pdata) {
pdata = dev_get_platdata(dev);
flags = pdev->id_entry->driver_data;
}
const char *label;
r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat");
if (!r)
@ -810,17 +780,27 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
if (!gc)
return -ENOMEM;
if (device_is_big_endian(dev))
flags |= BGPIOF_BIG_ENDIAN_BYTE_ORDER;
if (device_property_read_bool(dev, "no-output"))
flags |= BGPIOF_NO_OUTPUT;
err = bgpio_init(gc, dev, sz, dat, set, clr, dirout, dirin, flags);
if (err)
return err;
if (pdata) {
if (pdata->label)
gc->label = pdata->label;
gc->base = pdata->base;
if (pdata->ngpio > 0)
gc->ngpio = pdata->ngpio;
}
err = device_property_read_string(dev, "label", &label);
if (!err)
gc->label = label;
/*
* This property *must not* be used in device-tree sources, it's only
* meant to be passed to the driver from board files and MFD core.
*/
err = device_property_read_u32(dev, "gpio-mmio,base", &base);
if (!err && base <= INT_MAX)
gc->base = base;
platform_set_drvdata(pdev, gc);
@ -831,9 +811,6 @@ static const struct platform_device_id bgpio_id_table[] = {
{
.name = "basic-mmio-gpio",
.driver_data = 0,
}, {
.name = "basic-mmio-gpio-be",
.driver_data = BGPIOF_BIG_ENDIAN,
},
{ }
};

View file

@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>
#include <linux/stat.h>
@ -37,22 +38,34 @@
/* The sysreg block is just a random collection of various functions... */
static struct bgpio_pdata vexpress_sysreg_sys_led_pdata = {
.label = "sys_led",
.base = -1,
.ngpio = 8,
static const struct property_entry vexpress_sysreg_sys_led_props[] = {
PROPERTY_ENTRY_STRING("label", "sys_led"),
PROPERTY_ENTRY_U32("ngpios", 8),
{ }
};
static struct bgpio_pdata vexpress_sysreg_sys_mci_pdata = {
.label = "sys_mci",
.base = -1,
.ngpio = 2,
static const struct software_node vexpress_sysreg_sys_led_swnode = {
.properties = vexpress_sysreg_sys_led_props,
};
static struct bgpio_pdata vexpress_sysreg_sys_flash_pdata = {
.label = "sys_flash",
.base = -1,
.ngpio = 1,
static const struct property_entry vexpress_sysreg_sys_mci_props[] = {
PROPERTY_ENTRY_STRING("label", "sys_mci"),
PROPERTY_ENTRY_U32("ngpios", 2),
{ }
};
static const struct software_node vexpress_sysreg_sys_mci_swnode = {
.properties = vexpress_sysreg_sys_mci_props,
};
static const struct property_entry vexpress_sysreg_sys_flash_props[] = {
PROPERTY_ENTRY_STRING("label", "sys_flash"),
PROPERTY_ENTRY_U32("ngpios", 1),
{ }
};
static const struct software_node vexpress_sysreg_sys_flash_swnode = {
.properties = vexpress_sysreg_sys_flash_props,
};
static struct mfd_cell vexpress_sysreg_cells[] = {
@ -61,22 +74,19 @@ static struct mfd_cell vexpress_sysreg_cells[] = {
.of_compatible = "arm,vexpress-sysreg,sys_led",
.num_resources = 1,
.resources = &DEFINE_RES_MEM_NAMED(SYS_LED, 0x4, "dat"),
.platform_data = &vexpress_sysreg_sys_led_pdata,
.pdata_size = sizeof(vexpress_sysreg_sys_led_pdata),
.swnode = &vexpress_sysreg_sys_led_swnode,
}, {
.name = "basic-mmio-gpio",
.of_compatible = "arm,vexpress-sysreg,sys_mci",
.num_resources = 1,
.resources = &DEFINE_RES_MEM_NAMED(SYS_MCI, 0x4, "dat"),
.platform_data = &vexpress_sysreg_sys_mci_pdata,
.pdata_size = sizeof(vexpress_sysreg_sys_mci_pdata),
.swnode = &vexpress_sysreg_sys_mci_swnode,
}, {
.name = "basic-mmio-gpio",
.of_compatible = "arm,vexpress-sysreg,sys_flash",
.num_resources = 1,
.resources = &DEFINE_RES_MEM_NAMED(SYS_FLASH, 0x4, "dat"),
.platform_data = &vexpress_sysreg_sys_flash_pdata,
.pdata_size = sizeof(vexpress_sysreg_sys_flash_pdata),
.swnode = &vexpress_sysreg_sys_flash_swnode,
}, {
.name = "vexpress-syscfg",
.num_resources = 1,

View file

@ -718,12 +718,6 @@ const unsigned long *gpiochip_query_valid_mask(const struct gpio_chip *gc);
/* get driver data */
void *gpiochip_get_data(struct gpio_chip *gc);
struct bgpio_pdata {
const char *label;
int base;
int ngpio;
};
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
int gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *gc,