pinctrl: bcm283x: DM_FLAG_PRE_RELOC: Remove OF_CONTROL check
Subsystems (3)
PATCH RESEND 1/3 pinctrl: bcm283x: DM_FLAG_PRE_RELOC: Remove OF_CONTROL check
From: Ovidiu Panait <[email protected]>
Remove CONFIG_IS_ENABLED(OF_CONTROL) check from DM_FLAG_PRE_RELOC, since this driver only supports OF_CONTROL.
drivers/pinctrl/broadcom/Kconfig:
config PINCTRL_BCM283X
depends on ARCH_BCM283X && PINCTRL_FULL && OF_CONTROL
--- drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/broadcom/pinctrl-bcm283x.c +1 -1
@@ -150,7 +150,7 @@ U_BOOT_DRIVER(pinctrl_bcm283x) = { .priv_auto_alloc_size = sizeof(struct bcm283x_pinctrl_priv), .ops = &bcm283x_pinctrl_ops, .probe = bcm283x_pinctl_probe, -#if !CONFIG_IS_ENABLED (OF_CONTROL ) ||CONFIG_IS_ENABLED (OF_BOARD ) +#if CONFIG_IS_ENABLED (OF_BOARD ) .flags = DM_FLAG_PRE_RELOC,#endif };
Signature · 1 line
2.25.1
PATCH RESEND 2/3 pinctrl: bcm283x: Read address from DT in ofdata_to_platdata
From: Ovidiu Panait <[email protected]>
Factor out reading IP base address to ofdata_to_platdata function, which is designed for this purpose. Also, drop the dev->priv NULL check, since this is already done by the dm core when allocating space using priv_auto_alloc_size feature. (in drivers/core/device.c -> device_ofdata_to_platdata).
--- drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/pinctrl/broadcom/pinctrl-bcm283x.c +10 -7
@@ -104,17 +104,11 @@ static const struct udevice_id bcm2835_pinctrl_id[] = { {} }; -int bcm283x_pinctl_probe (struct udevice *dev) +int bcm283x_pinctl_ofdata_to_platdata (struct udevice *dev) {struct bcm283x_pinctrl_priv *priv; -int ret; -struct udevice *pdev; priv =dev_get_priv (dev); -if (!priv) { -debug ("%s: Failed to get private\n" , __func__); -return -EINVAL ; - } priv->base_reg =dev_read_addr_ptr (dev);if (!priv->base_reg) {
@@ -122,6 +116,14 @@ int bcm283x_pinctl_probe(struct udevice *dev)return -EINVAL ; } +return 0 ; +} + +int bcm283x_pinctl_probe (struct udevice *dev) +{ +int ret; +struct udevice *pdev; +/* Create GPIO device as well */ ret =device_bind (dev,lists_driver_lookup_name ("gpio_bcm2835" ),"gpio_bcm2835" ,NULL ,dev_of_offset (dev), &pdev);
@@ -147,6 +149,7 @@ U_BOOT_DRIVER(pinctrl_bcm283x) = { .name = "bcm283x_pinctrl", .id = UCLASS_PINCTRL, .of_match = of_match_ptr(bcm2835_pinctrl_id), + .ofdata_to_platdata = bcm283x_pinctl_ofdata_to_platdata, .priv_auto_alloc_size = sizeof(struct bcm283x_pinctrl_priv), .ops = &bcm283x_pinctrl_ops, .probe = bcm283x_pinctl_probe,
Signature · 1 line
2.25.1
PATCH RESEND 3/3 pinctrl: bcm283x: Store the return value of dev_read_u32_default to int
In reply to Ovidiu PanaitFrom: Ovidiu Panait <[email protected]>
Currently, the return value of dev_read_u32_default is stored in an u32, causing the subsequent "if (function < 0)" to always be false:
u32 function;
...
function = dev_read_u32_default(config, "brcm,function", -1);
if (function < 0) {
debug("Failed reading function for pinconfig %s (%d)\n",
config->name, function);
return -EINVAL;
}Make "function" variable an int to fix this.
--- drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/broadcom/pinctrl-bcm283x.c +1 -1
@@ -63,7 +63,7 @@ static int bcm2835_gpio_get_func_id(struct udevice *dev, unsigned int gpio)int bcm283x_pinctrl_set_state (struct udevice *dev,struct udevice *config) {u32 pin_arr[MAX_PINS_PER_BANK ]; -u32 function; +int function;int i, len, pin_count =0 ; if (!dev_read_prop(config, "brcm,pins", &len) || !len ||
Signature · 1 line
2.25.1