mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-10-03 03:31:37 +02:00
pinctrl: bcm283x: Read address from DT in ofdata_to_platdata
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). Cc: Matthias Brugger <mbrugger@suse.com> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
This commit is contained in:
parent
bab9be9e0d
commit
e020c07a02
@ -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;
|
struct bcm283x_pinctrl_priv *priv;
|
||||||
int ret;
|
|
||||||
struct udevice *pdev;
|
|
||||||
|
|
||||||
priv = dev_get_priv(dev);
|
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);
|
priv->base_reg = dev_read_addr_ptr(dev);
|
||||||
if (!priv->base_reg) {
|
if (!priv->base_reg) {
|
||||||
@ -122,6 +116,14 @@ int bcm283x_pinctl_probe(struct udevice *dev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bcm283x_pinctl_probe(struct udevice *dev)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct udevice *pdev;
|
||||||
|
|
||||||
/* Create GPIO device as well */
|
/* Create GPIO device as well */
|
||||||
ret = device_bind(dev, lists_driver_lookup_name("gpio_bcm2835"),
|
ret = device_bind(dev, lists_driver_lookup_name("gpio_bcm2835"),
|
||||||
"gpio_bcm2835", NULL, dev_of_offset(dev), &pdev);
|
"gpio_bcm2835", NULL, dev_of_offset(dev), &pdev);
|
||||||
@ -147,6 +149,7 @@ U_BOOT_DRIVER(pinctrl_bcm283x) = {
|
|||||||
.name = "bcm283x_pinctrl",
|
.name = "bcm283x_pinctrl",
|
||||||
.id = UCLASS_PINCTRL,
|
.id = UCLASS_PINCTRL,
|
||||||
.of_match = of_match_ptr(bcm2835_pinctrl_id),
|
.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),
|
.priv_auto_alloc_size = sizeof(struct bcm283x_pinctrl_priv),
|
||||||
.ops = &bcm283x_pinctrl_ops,
|
.ops = &bcm283x_pinctrl_ops,
|
||||||
.probe = bcm283x_pinctl_probe,
|
.probe = bcm283x_pinctl_probe,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user