diff options
Diffstat (limited to 'drivers')
1036 files changed, 5809 insertions, 5222 deletions
diff --git a/drivers/adc/adc-uclass.c b/drivers/adc/adc-uclass.c index d435667..8781f32 100644 --- a/drivers/adc/adc-uclass.c +++ b/drivers/adc/adc-uclass.c @@ -15,7 +15,7 @@ #include <linux/delay.h> #include <power/regulator.h> -#define ADC_UCLASS_PLATDATA_SIZE sizeof(struct adc_uclass_platdata) +#define ADC_UCLASS_PLATDATA_SIZE sizeof(struct adc_uclass_plat) #define CHECK_NUMBER true #define CHECK_MASK (!CHECK_NUMBER) @@ -29,7 +29,7 @@ extern void sdelay(unsigned long loops); static int check_channel(struct udevice *dev, int value, bool number_or_mask, const char *caller_function) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); unsigned mask = number_or_mask ? (1 << value) : value; /* For the real ADC hardware, some ADC channels can be inactive. @@ -48,7 +48,7 @@ static int check_channel(struct udevice *dev, int value, bool number_or_mask, static int adc_supply_enable(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); const char *supply_type; int ret = 0; @@ -70,7 +70,7 @@ static int adc_supply_enable(struct udevice *dev) int adc_data_mask(struct udevice *dev, unsigned int *data_mask) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) return -ENOSYS; @@ -81,7 +81,7 @@ int adc_data_mask(struct udevice *dev, unsigned int *data_mask) int adc_channel_mask(struct udevice *dev, unsigned int *channel_mask) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) return -ENOSYS; @@ -141,7 +141,7 @@ int adc_start_channels(struct udevice *dev, unsigned int channel_mask) int adc_channel_data(struct udevice *dev, int channel, unsigned int *data) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); const struct adc_ops *ops = dev_get_driver_ops(dev); unsigned int timeout_us = uc_pdata->data_timeout_us; int ret; @@ -168,7 +168,7 @@ int adc_channel_data(struct udevice *dev, int channel, unsigned int *data) int adc_channels_data(struct udevice *dev, unsigned int channel_mask, struct adc_channel *channels) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); unsigned int timeout_us = uc_pdata->multidata_timeout_us; const struct adc_ops *ops = dev_get_driver_ops(dev); int ret; @@ -267,9 +267,9 @@ try_manual: return _adc_channels_single_shot(dev, channel_mask, channels); } -static int adc_vdd_platdata_update(struct udevice *dev) +static int adc_vdd_plat_update(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); int ret; /* Warning! @@ -290,9 +290,9 @@ static int adc_vdd_platdata_update(struct udevice *dev) return 0; } -static int adc_vss_platdata_update(struct udevice *dev) +static int adc_vss_plat_update(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); int ret; if (!uc_pdata->vss_supply) @@ -309,11 +309,11 @@ static int adc_vss_platdata_update(struct udevice *dev) int adc_vdd_value(struct udevice *dev, int *uV) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); int ret, value_sign = uc_pdata->vdd_polarity_negative ? -1 : 1; /* Update the regulator Value. */ - ret = adc_vdd_platdata_update(dev); + ret = adc_vdd_plat_update(dev); if (ret) return ret; @@ -327,11 +327,11 @@ int adc_vdd_value(struct udevice *dev, int *uV) int adc_vss_value(struct udevice *dev, int *uV) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); int ret, value_sign = uc_pdata->vss_polarity_negative ? -1 : 1; /* Update the regulator Value. */ - ret = adc_vss_platdata_update(dev); + ret = adc_vss_plat_update(dev); if (ret) return ret; @@ -367,9 +367,9 @@ int adc_raw_to_uV(struct udevice *dev, unsigned int raw, int *uV) return 0; } -static int adc_vdd_platdata_set(struct udevice *dev) +static int adc_vdd_plat_set(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); int ret; char *prop; @@ -380,7 +380,7 @@ static int adc_vdd_platdata_set(struct udevice *dev) ret = device_get_supply_regulator(dev, "vdd-supply", &uc_pdata->vdd_supply); if (!ret) - return adc_vdd_platdata_update(dev); + return adc_vdd_plat_update(dev); if (ret != -ENOENT) return ret; @@ -392,9 +392,9 @@ static int adc_vdd_platdata_set(struct udevice *dev) return 0; } -static int adc_vss_platdata_set(struct udevice *dev) +static int adc_vss_plat_set(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); int ret; char *prop; @@ -404,7 +404,7 @@ static int adc_vss_platdata_set(struct udevice *dev) ret = device_get_supply_regulator(dev, "vss-supply", &uc_pdata->vss_supply); if (!ret) - return adc_vss_platdata_update(dev); + return adc_vss_plat_update(dev); if (ret != -ENOENT) return ret; @@ -420,13 +420,13 @@ static int adc_pre_probe(struct udevice *dev) { int ret; - /* Set ADC VDD platdata: polarity, uV, regulator (phandle). */ - ret = adc_vdd_platdata_set(dev); + /* Set ADC VDD plat: polarity, uV, regulator (phandle). */ + ret = adc_vdd_plat_set(dev); if (ret) pr_err("%s: Can't update Vdd. Error: %d", dev->name, ret); - /* Set ADC VSS platdata: polarity, uV, regulator (phandle). */ - ret = adc_vss_platdata_set(dev); + /* Set ADC VSS plat: polarity, uV, regulator (phandle). */ + ret = adc_vss_plat_set(dev); if (ret) pr_err("%s: Can't update Vss. Error: %d", dev->name, ret); @@ -437,5 +437,5 @@ UCLASS_DRIVER(adc) = { .id = UCLASS_ADC, .name = "adc", .pre_probe = adc_pre_probe, - .per_device_platdata_auto_alloc_size = ADC_UCLASS_PLATDATA_SIZE, + .per_device_plat_auto = ADC_UCLASS_PLATDATA_SIZE, }; diff --git a/drivers/adc/exynos-adc.c b/drivers/adc/exynos-adc.c index b459b57..6589817 100644 --- a/drivers/adc/exynos-adc.c +++ b/drivers/adc/exynos-adc.c @@ -101,9 +101,9 @@ int exynos_adc_probe(struct udevice *dev) return 0; } -int exynos_adc_ofdata_to_platdata(struct udevice *dev) +int exynos_adc_of_to_plat(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); struct exynos_adc_priv *priv = dev_get_priv(dev); priv->regs = dev_read_addr_ptr(dev); @@ -139,6 +139,6 @@ U_BOOT_DRIVER(exynos_adc) = { .of_match = exynos_adc_ids, .ops = &exynos_adc_ops, .probe = exynos_adc_probe, - .ofdata_to_platdata = exynos_adc_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct exynos_adc_priv), + .of_to_plat = exynos_adc_of_to_plat, + .priv_auto = sizeof(struct exynos_adc_priv), }; diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c index 72b0cc4..13a8f49 100644 --- a/drivers/adc/meson-saradc.c +++ b/drivers/adc/meson-saradc.c @@ -675,9 +675,9 @@ static int meson_saradc_probe(struct udevice *dev) return 0; } -int meson_saradc_ofdata_to_platdata(struct udevice *dev) +int meson_saradc_of_to_plat(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); struct meson_saradc_priv *priv = dev_get_priv(dev); priv->data = (struct meson_saradc_data *)dev_get_driver_data(dev); @@ -720,6 +720,6 @@ U_BOOT_DRIVER(meson_saradc) = { .of_match = meson_saradc_ids, .ops = &meson_saradc_ops, .probe = meson_saradc_probe, - .ofdata_to_platdata = meson_saradc_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct meson_saradc_priv), + .of_to_plat = meson_saradc_of_to_plat, + .priv_auto = sizeof(struct meson_saradc_priv), }; diff --git a/drivers/adc/rockchip-saradc.c b/drivers/adc/rockchip-saradc.c index 561740f6..e464d33 100644 --- a/drivers/adc/rockchip-saradc.c +++ b/drivers/adc/rockchip-saradc.c @@ -44,7 +44,7 @@ int rockchip_saradc_channel_data(struct udevice *dev, int channel, unsigned int *data) { struct rockchip_saradc_priv *priv = dev_get_priv(dev); - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); if (channel != priv->active_channel) { pr_err("Requested channel is not active!"); @@ -117,9 +117,9 @@ int rockchip_saradc_probe(struct udevice *dev) return 0; } -int rockchip_saradc_ofdata_to_platdata(struct udevice *dev) +int rockchip_saradc_of_to_plat(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); struct rockchip_saradc_priv *priv = dev_get_priv(dev); struct rockchip_saradc_data *data; @@ -179,6 +179,6 @@ U_BOOT_DRIVER(rockchip_saradc) = { .of_match = rockchip_saradc_ids, .ops = &rockchip_saradc_ops, .probe = rockchip_saradc_probe, - .ofdata_to_platdata = rockchip_saradc_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct rockchip_saradc_priv), + .of_to_plat = rockchip_saradc_of_to_plat, + .priv_auto = sizeof(struct rockchip_saradc_priv), }; diff --git a/drivers/adc/sandbox.c b/drivers/adc/sandbox.c index 1f32289..6e43546 100644 --- a/drivers/adc/sandbox.c +++ b/drivers/adc/sandbox.c @@ -135,9 +135,9 @@ int sandbox_adc_probe(struct udevice *dev) return 0; } -int sandbox_adc_ofdata_to_platdata(struct udevice *dev) +int sandbox_adc_of_to_plat(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); uc_pdata->data_mask = SANDBOX_ADC_DATA_MASK; uc_pdata->data_format = ADC_DATA_FORMAT_BIN; @@ -168,6 +168,6 @@ U_BOOT_DRIVER(sandbox_adc) = { .of_match = sandbox_adc_ids, .ops = &sandbox_adc_ops, .probe = sandbox_adc_probe, - .ofdata_to_platdata = sandbox_adc_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct sandbox_adc_priv), + .of_to_plat = sandbox_adc_of_to_plat, + .priv_auto = sizeof(struct sandbox_adc_priv), }; diff --git a/drivers/adc/stm32-adc-core.c b/drivers/adc/stm32-adc-core.c index f20c46f..6c17696 100644 --- a/drivers/adc/stm32-adc-core.c +++ b/drivers/adc/stm32-adc-core.c @@ -209,5 +209,5 @@ U_BOOT_DRIVER(stm32_adc_core) = { .id = UCLASS_SIMPLE_BUS, .of_match = stm32_adc_core_ids, .probe = stm32_adc_core_probe, - .priv_auto_alloc_size = sizeof(struct stm32_adc_common), + .priv_auto = sizeof(struct stm32_adc_common), }; diff --git a/drivers/adc/stm32-adc.c b/drivers/adc/stm32-adc.c index 3f0ed48..ad8d1a3 100644 --- a/drivers/adc/stm32-adc.c +++ b/drivers/adc/stm32-adc.c @@ -80,7 +80,7 @@ static int stm32_adc_stop(struct udevice *dev) static int stm32_adc_start_channel(struct udevice *dev, int channel) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); struct stm32_adc_common *common = dev_get_priv(dev_get_parent(dev)); struct stm32_adc *adc = dev_get_priv(dev); int ret; @@ -164,7 +164,7 @@ static int stm32_adc_channel_data(struct udevice *dev, int channel, static int stm32_adc_chan_of_init(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); struct stm32_adc *adc = dev_get_priv(dev); u32 chans[STM32_ADC_CH_MAX]; unsigned int i, num_channels; @@ -206,7 +206,7 @@ static int stm32_adc_chan_of_init(struct udevice *dev) static int stm32_adc_probe(struct udevice *dev) { - struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); struct stm32_adc_common *common = dev_get_priv(dev_get_parent(dev)); struct stm32_adc *adc = dev_get_priv(dev); int offset; @@ -258,5 +258,5 @@ U_BOOT_DRIVER(stm32_adc) = { .of_match = stm32_adc_ids, .probe = stm32_adc_probe, .ops = &stm32_adc_ops, - .priv_auto_alloc_size = sizeof(struct stm32_adc), + .priv_auto = sizeof(struct stm32_adc), }; diff --git a/drivers/ata/ahci-uclass.c b/drivers/ata/ahci-uclass.c index 42bbff9..c4c7a03 100644 --- a/drivers/ata/ahci-uclass.c +++ b/drivers/ata/ahci-uclass.c @@ -11,5 +11,5 @@ UCLASS_DRIVER(ahci) = { .id = UCLASS_AHCI, .name = "ahci", - .per_device_auto_alloc_size = sizeof(struct ahci_uc_priv), + .per_device_auto = sizeof(struct ahci_uc_priv), }; diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 22bc0d3..2ef21ec 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -172,7 +172,7 @@ static int ahci_host_init(struct ahci_uc_priv *uc_priv) #if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI) # ifdef CONFIG_DM_PCI struct udevice *dev = uc_priv->dev; - struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); + struct pci_child_plat *pplat = dev_get_parent_plat(dev); # else pci_dev_t pdev = uc_priv->dev; unsigned short vendor; @@ -474,7 +474,7 @@ static int ahci_init_one(struct ahci_uc_priv *uc_priv, pci_dev_t dev) pci_write_config_byte(dev, 0x41, 0xa1); #endif #else - struct scsi_platdata *plat = dev_get_uclass_platdata(dev); + struct scsi_plat *plat = dev_get_uclass_plat(dev); uc_priv->mmio_base = (void *)plat->base; #endif @@ -1163,14 +1163,14 @@ int ahci_bind_scsi(struct udevice *ahci_dev, struct udevice **devp) int ahci_probe_scsi(struct udevice *ahci_dev, ulong base) { struct ahci_uc_priv *uc_priv; - struct scsi_platdata *uc_plat; + struct scsi_plat *uc_plat; struct udevice *dev; int ret; device_find_first_child(ahci_dev, &dev); if (!dev) return -ENODEV; - uc_plat = dev_get_uclass_platdata(dev); + uc_plat = dev_get_uclass_plat(dev); uc_plat->base = base; uc_plat->max_lun = 1; uc_plat->max_id = 2; diff --git a/drivers/ata/dwc_ahci.c b/drivers/ata/dwc_ahci.c index ed0527c..826fea7 100644 --- a/drivers/ata/dwc_ahci.c +++ b/drivers/ata/dwc_ahci.c @@ -29,7 +29,7 @@ static int dwc_ahci_bind(struct udevice *dev) return ahci_bind_scsi(dev, &scsi_dev); } -static int dwc_ahci_ofdata_to_platdata(struct udevice *dev) +static int dwc_ahci_of_to_plat(struct udevice *dev) { struct dwc_ahci_priv *priv = dev_get_priv(dev); fdt_addr_t addr; @@ -92,8 +92,8 @@ U_BOOT_DRIVER(dwc_ahci) = { .id = UCLASS_AHCI, .of_match = dwc_ahci_ids, .bind = dwc_ahci_bind, - .ofdata_to_platdata = dwc_ahci_ofdata_to_platdata, + .of_to_plat = dwc_ahci_of_to_plat, .ops = &scsi_ops, .probe = dwc_ahci_probe, - .priv_auto_alloc_size = sizeof(struct dwc_ahci_priv), + .priv_auto = sizeof(struct dwc_ahci_priv), }; diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c index 562e982..6d42548 100644 --- a/drivers/ata/dwc_ahsata.c +++ b/drivers/ata/dwc_ahsata.c @@ -1019,7 +1019,7 @@ int dwc_ahsata_scan(struct udevice *dev) } } - desc = dev_get_uclass_platdata(blk); + desc = dev_get_uclass_plat(blk); ret = dwc_ahsata_scan_common(uc_priv, desc); if (ret) { debug("%s: Failed to scan bus\n", __func__); @@ -1054,7 +1054,7 @@ int dwc_ahsata_probe(struct udevice *dev) static ulong dwc_ahsata_read(struct udevice *blk, lbaint_t blknr, lbaint_t blkcnt, void *buffer) { - struct blk_desc *desc = dev_get_uclass_platdata(blk); + struct blk_desc *desc = dev_get_uclass_plat(blk); struct udevice *dev = dev_get_parent(blk); struct ahci_uc_priv *uc_priv; @@ -1065,7 +1065,7 @@ static ulong dwc_ahsata_read(struct udevice *blk, lbaint_t blknr, static ulong dwc_ahsata_write(struct udevice *blk, lbaint_t blknr, lbaint_t blkcnt, const void *buffer) { - struct blk_desc *desc = dev_get_uclass_platdata(blk); + struct blk_desc *desc = dev_get_uclass_plat(blk); struct udevice *dev = dev_get_parent(blk); struct ahci_uc_priv *uc_priv; diff --git a/drivers/ata/fsl_sata.c b/drivers/ata/fsl_sata.c index 8c6726a..e44db0a 100644 --- a/drivers/ata/fsl_sata.c +++ b/drivers/ata/fsl_sata.c @@ -746,7 +746,7 @@ ulong sata_read(int dev, ulong blknr, lbaint_t blkcnt, void *buffer) static ulong sata_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer) { - struct fsl_ata_priv *priv = dev_get_platdata(dev); + struct fsl_ata_priv *priv = dev_get_plat(dev); fsl_sata_t *sata = priv->fsl_sata; #endif u32 rc; @@ -768,7 +768,7 @@ ulong sata_write(int dev, ulong blknr, lbaint_t blkcnt, const void *buffer) static ulong sata_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, const void *buffer) { - struct fsl_ata_priv *priv = dev_get_platdata(dev); + struct fsl_ata_priv *priv = dev_get_plat(dev); fsl_sata_t *sata = priv->fsl_sata; #endif u32 rc; @@ -808,8 +808,8 @@ int scan_sata(int dev) #else static int scan_sata(struct udevice *dev) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); - struct fsl_ata_priv *priv = dev_get_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); + struct fsl_ata_priv *priv = dev_get_plat(dev); fsl_sata_t *sata = priv->fsl_sata; #endif @@ -900,10 +900,10 @@ U_BOOT_DRIVER(sata_fsl_driver) = { .name = "sata_fsl_blk", .id = UCLASS_BLK, .ops = &sata_fsl_blk_ops, - .platdata_auto_alloc_size = sizeof(struct fsl_ata_priv), + .plat_auto = sizeof(struct fsl_ata_priv), }; -static int fsl_ata_ofdata_to_platdata(struct udevice *dev) +static int fsl_ata_of_to_plat(struct udevice *dev) { struct fsl_ata_priv *priv = dev_get_priv(dev); @@ -969,7 +969,7 @@ static int fsl_ata_probe(struct udevice *dev) continue; } - blk_priv = dev_get_platdata(blk); + blk_priv = dev_get_plat(blk); blk_priv->fsl_sata = priv->fsl_sata; /* Scan SATA port */ ret = scan_sata(blk); @@ -1026,9 +1026,9 @@ U_BOOT_DRIVER(fsl_ahci) = { .id = UCLASS_AHCI, .of_match = fsl_ata_ids, .ops = &sata_fsl_ahci_ops, - .ofdata_to_platdata = fsl_ata_ofdata_to_platdata, + .of_to_plat = fsl_ata_of_to_plat, .probe = fsl_ata_probe, .remove = fsl_ata_remove, - .priv_auto_alloc_size = sizeof(struct fsl_ata_priv), + .priv_auto = sizeof(struct fsl_ata_priv), }; #endif diff --git a/drivers/ata/mtk_ahci.c b/drivers/ata/mtk_ahci.c index 4ad260a..46b7677 100644 --- a/drivers/ata/mtk_ahci.c +++ b/drivers/ata/mtk_ahci.c @@ -40,7 +40,7 @@ static int mtk_ahci_bind(struct udevice *dev) return ahci_bind_scsi(dev, &scsi_dev); } -static int mtk_ahci_ofdata_to_platdata(struct udevice *dev) +static int mtk_ahci_of_to_plat(struct udevice *dev) { struct mtk_ahci_priv *priv = dev_get_priv(dev); @@ -68,7 +68,8 @@ static int mtk_ahci_parse_property(struct ahci_uc_priv *hpriv, SYS_CFG_SATA_MSK, SYS_CFG_SATA_EN); } - ofnode_read_u32(dev->node, "ports-implemented", &hpriv->port_map); + ofnode_read_u32(dev_ofnode(dev), "ports-implemented", + &hpriv->port_map); return 0; } @@ -121,8 +122,8 @@ U_BOOT_DRIVER(mtk_ahci) = { .id = UCLASS_AHCI, .of_match = mtk_ahci_ids, .bind = mtk_ahci_bind, - .ofdata_to_platdata = mtk_ahci_ofdata_to_platdata, + .of_to_plat = mtk_ahci_of_to_plat, .ops = &scsi_ops, .probe = mtk_ahci_probe, - .priv_auto_alloc_size = sizeof(struct mtk_ahci_priv), + .priv_auto = sizeof(struct mtk_ahci_priv), }; diff --git a/drivers/ata/sata_ceva.c b/drivers/ata/sata_ceva.c index 77508aa..87e6a90 100644 --- a/drivers/ata/sata_ceva.c +++ b/drivers/ata/sata_ceva.c @@ -199,7 +199,7 @@ static const struct udevice_id sata_ceva_ids[] = { { } }; -static int sata_ceva_ofdata_to_platdata(struct udevice *dev) +static int sata_ceva_of_to_plat(struct udevice *dev) { struct ceva_sata_priv *priv = dev_get_priv(dev); struct resource res_regs; @@ -233,7 +233,7 @@ U_BOOT_DRIVER(ceva_host_blk) = { .of_match = sata_ceva_ids, .bind = sata_ceva_bind, .ops = &scsi_ops, - .priv_auto_alloc_size = sizeof(struct ceva_sata_priv), + .priv_auto = sizeof(struct ceva_sata_priv), .probe = sata_ceva_probe, - .ofdata_to_platdata = sata_ceva_ofdata_to_platdata, + .of_to_plat = sata_ceva_of_to_plat, }; diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index b2b5c69..b78e311 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -290,7 +290,7 @@ static int ata_wait_register(u32 *addr, u32 mask, u32 val, u32 timeout_msec) /* Cut from sata_mv in linux kernel */ static int mv_stop_edma_engine(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); int i; /* Disable eDMA. The disable bit auto clears. */ @@ -311,7 +311,7 @@ static int mv_stop_edma_engine(struct udevice *dev, int port) static int mv_start_edma_engine(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); u32 tmp; /* Check preconditions */ @@ -363,7 +363,7 @@ static int mv_start_edma_engine(struct udevice *dev, int port) static int mv_reset_channel(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); /* Make sure edma is stopped */ mv_stop_edma_engine(dev, port); @@ -378,7 +378,7 @@ static int mv_reset_channel(struct udevice *dev, int port) static void mv_reset_port(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); mv_reset_channel(dev, port); @@ -404,7 +404,7 @@ static void mv_reset_one_hc(void) static int probe_port(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); int tries, tries2, set15 = 0; u32 tmp; @@ -467,7 +467,7 @@ static int probe_port(struct udevice *dev, int port) /* Get request queue in pointer */ static int get_reqip(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); u32 tmp; tmp = in_le32(priv->regbase + EDMA_RQIPR) & EDMA_RQIPR_IPMASK; @@ -478,7 +478,7 @@ static int get_reqip(struct udevice *dev, int port) static void set_reqip(struct udevice *dev, int port, int reqin) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); u32 tmp; tmp = in_le32(priv->regbase + EDMA_RQIPR) & ~EDMA_RQIPR_IPMASK; @@ -497,7 +497,7 @@ static int get_next_reqip(struct udevice *dev, int port) /* Get response queue in pointer */ static int get_rspip(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); u32 tmp; tmp = in_le32(priv->regbase + EDMA_RSIPR) & EDMA_RSIPR_IPMASK; @@ -509,7 +509,7 @@ static int get_rspip(struct udevice *dev, int port) /* Get response queue out pointer */ static int get_rspop(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); u32 tmp; tmp = in_le32(priv->regbase + EDMA_RSOPR) & EDMA_RSOPR_OPMASK; @@ -526,7 +526,7 @@ static int get_next_rspop(struct udevice *dev, int port) /* Set response queue pointer */ static void set_rspop(struct udevice *dev, int port, int reqin) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); u32 tmp; tmp = in_le32(priv->regbase + EDMA_RSOPR) & ~EDMA_RSOPR_OPMASK; @@ -552,7 +552,7 @@ static int wait_dma_completion(struct udevice *dev, int port, int index, static void process_responses(struct udevice *dev, int port) { #ifdef DEBUG - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); #endif u32 tmp; u32 outind = get_rspop(dev, port); @@ -580,7 +580,7 @@ static int mv_ata_exec_ata_cmd(struct udevice *dev, int port, struct sata_fis_h2d *cfis, u8 *buffer, u32 len, u32 iswrite) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); struct crqb *req; int slot; u32 start; @@ -727,7 +727,7 @@ static u32 mv_sata_rw_cmd(struct udevice *dev, int port, lbaint_t start, static u32 ata_low_level_rw(struct udevice *dev, int port, lbaint_t blknr, lbaint_t blkcnt, void *buffer, int is_write) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); lbaint_t start, blks; u8 *addr; int max_blks; @@ -772,7 +772,7 @@ static int mv_ata_exec_ata_cmd_nondma(struct udevice *dev, int port, struct sata_fis_h2d *cfis, u8 *buffer, u32 len, u32 iswrite) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); int i; u16 *tp; @@ -823,7 +823,7 @@ static int mv_sata_identify(struct udevice *dev, int port, u16 *id) static void mv_sata_xfer_mode(struct udevice *dev, int port, u16 *id) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); priv->pio = id[ATA_ID_PIO_MODES]; priv->mwdma = id[ATA_ID_MWDMA_MODES]; @@ -834,7 +834,7 @@ static void mv_sata_xfer_mode(struct udevice *dev, int port, u16 *id) static void mv_sata_set_features(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); struct sata_fis_h2d cfis; u8 udma_cap; @@ -886,7 +886,7 @@ static void mvsata_ide_conf_mbus_windows(void) static int sata_mv_init_sata(struct udevice *dev, int port) { - struct mv_priv *priv = dev_get_platdata(dev); + struct mv_priv *priv = dev_get_plat(dev); debug("Initialize sata dev: %d\n", port); @@ -943,8 +943,8 @@ static int sata_mv_init_sata(struct udevice *dev, int port) static int sata_mv_scan_sata(struct udevice *dev, int port) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); - struct mv_priv *priv = dev_get_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); + struct mv_priv *priv = dev_get_plat(dev); unsigned char serial[ATA_ID_SERNO_LEN + 1]; unsigned char firmware[ATA_ID_FW_REV_LEN + 1]; unsigned char product[ATA_ID_PROD_LEN + 1]; @@ -1006,7 +1006,7 @@ static int sata_mv_scan_sata(struct udevice *dev, int port) static ulong sata_mv_read(struct udevice *blk, lbaint_t blknr, lbaint_t blkcnt, void *buffer) { - struct mv_priv *priv = dev_get_platdata(blk); + struct mv_priv *priv = dev_get_plat(blk); return ata_low_level_rw(blk, priv->dev_nr, blknr, blkcnt, buffer, READ_CMD); @@ -1015,7 +1015,7 @@ static ulong sata_mv_read(struct udevice *blk, lbaint_t blknr, static ulong sata_mv_write(struct udevice *blk, lbaint_t blknr, lbaint_t blkcnt, const void *buffer) { - struct mv_priv *priv = dev_get_platdata(blk); + struct mv_priv *priv = dev_get_plat(blk); return ata_low_level_rw(blk, priv->dev_nr, blknr, blkcnt, (void *)buffer, WRITE_CMD); @@ -1030,7 +1030,7 @@ U_BOOT_DRIVER(sata_mv_driver) = { .name = "sata_mv_blk", .id = UCLASS_BLK, .ops = &sata_mv_blk_ops, - .platdata_auto_alloc_size = sizeof(struct mv_priv), + .plat_auto = sizeof(struct mv_priv), }; static int sata_mv_probe(struct udevice *dev) @@ -1055,7 +1055,7 @@ static int sata_mv_probe(struct udevice *dev) return ret; } - priv = dev_get_platdata(blk); + priv = dev_get_plat(blk); priv->dev_nr = i; /* Init SATA port */ diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index d5ba94c..7e4e97d 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c @@ -492,7 +492,7 @@ ulong sata_read(int dev, ulong blknr, lbaint_t blkcnt, void *buffer) static ulong sata_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer) { - struct sil_sata_priv *priv = dev_get_platdata(dev); + struct sil_sata_priv *priv = dev_get_plat(dev); int port_number = priv->port_num; struct sil_sata *sata = priv->sil_sata_desc[port_number]; #endif @@ -517,7 +517,7 @@ ulong sata_write(int dev, ulong blknr, lbaint_t blkcnt, const void *buffer) ulong sata_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, const void *buffer) { - struct sil_sata_priv *priv = dev_get_platdata(dev); + struct sil_sata_priv *priv = dev_get_plat(dev); int port_number = priv->port_num; struct sil_sata *sata = priv->sil_sata_desc[port_number]; #endif @@ -542,7 +542,7 @@ static int sil_init_sata(int dev) #else static int sil_init_sata(struct udevice *uc_dev, int dev) { - struct sil_sata_priv *priv = dev_get_platdata(uc_dev); + struct sil_sata_priv *priv = dev_get_plat(uc_dev); #endif struct sil_sata *sata; void *port; @@ -708,8 +708,8 @@ int scan_sata(int dev) #else static int scan_sata(struct udevice *blk_dev, int dev) { - struct blk_desc *desc = dev_get_uclass_platdata(blk_dev); - struct sil_sata_priv *priv = dev_get_platdata(blk_dev); + struct blk_desc *desc = dev_get_uclass_plat(blk_dev); + struct sil_sata_priv *priv = dev_get_plat(blk_dev); struct sil_sata *sata = priv->sil_sata_desc[dev]; #endif unsigned char serial[ATA_ID_SERNO_LEN + 1]; @@ -772,7 +772,7 @@ U_BOOT_DRIVER(sata_sil_driver) = { .name = "sata_sil_blk", .id = UCLASS_BLK, .ops = &sata_sil_blk_ops, - .platdata_auto_alloc_size = sizeof(struct sil_sata_priv), + .plat_auto = sizeof(struct sil_sata_priv), }; static int sil_unbind_device(struct udevice *dev) @@ -920,7 +920,7 @@ U_BOOT_DRIVER(sil_ahci_pci) = { .ops = &sata_sil_ops, .probe = sil_pci_probe, .remove = sil_pci_remove, - .priv_auto_alloc_size = sizeof(struct sil_sata_priv), + .priv_auto = sizeof(struct sil_sata_priv), }; U_BOOT_PCI_DEVICE(sil_ahci_pci, supported); diff --git a/drivers/axi/ihs_axi.c b/drivers/axi/ihs_axi.c index 3945511..a7e9761 100644 --- a/drivers/axi/ihs_axi.c +++ b/drivers/axi/ihs_axi.c @@ -291,6 +291,6 @@ U_BOOT_DRIVER(ihs_axi_bus) = { .id = UCLASS_AXI, .of_match = ihs_axi_ids, .ops = &ihs_axi_ops, - .priv_auto_alloc_size = sizeof(struct ihs_axi_priv), + .priv_auto = sizeof(struct ihs_axi_priv), .probe = ihs_axi_probe, }; diff --git a/drivers/axi/sandbox_store.c b/drivers/axi/sandbox_store.c index 42bcae6..ef349a5 100644 --- a/drivers/axi/sandbox_store.c +++ b/drivers/axi/sandbox_store.c @@ -119,7 +119,7 @@ U_BOOT_DRIVER(sandbox_axi_store) = { .id = UCLASS_AXI_EMUL, .of_match = sandbox_store_ids, .ops = &sandbox_store_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_store_priv), + .priv_auto = sizeof(struct sandbox_store_priv), .probe = sandbox_store_probe, .remove = sandbox_store_remove, }; diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 2fb9f6b7..d0d91db 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -79,7 +79,7 @@ struct blk_desc *blk_get_devnum_by_type(enum if_type if_type, int devnum) ret = blk_get_device(if_type, devnum, &dev); if (ret) return NULL; - desc = dev_get_uclass_platdata(dev); + desc = dev_get_uclass_plat(dev); return desc; } @@ -114,7 +114,7 @@ struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum) if (ret) return NULL; uclass_foreach_dev(dev, uc) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__, if_type, devnum, dev->name, desc->if_type, desc->devnum); @@ -154,7 +154,7 @@ struct blk_desc *blk_get_by_device(struct udevice *dev) if (device_get_uclass_id(child_dev) != UCLASS_BLK) continue; - return dev_get_uclass_platdata(child_dev); + return dev_get_uclass_plat(child_dev); } debug("%s: No block device found\n", __func__); @@ -184,7 +184,7 @@ static int get_desc(enum if_type if_type, int devnum, struct blk_desc **descp) if (ret) return ret; uclass_foreach_dev(dev, uc) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__, if_type, devnum, dev->name, desc->if_type, desc->devnum); @@ -368,7 +368,7 @@ int blk_first_device(int if_type, struct udevice **devp) if (!*devp) return -ENODEV; do { - desc = dev_get_uclass_platdata(*devp); + desc = dev_get_uclass_plat(*devp); if (desc->if_type == if_type) return 0; ret = uclass_find_next_device(devp); @@ -384,7 +384,7 @@ int blk_next_device(struct udevice **devp) struct blk_desc *desc; int ret, if_type; - desc = dev_get_uclass_platdata(*devp); + desc = dev_get_uclass_plat(*devp); if_type = desc->if_type; do { ret = uclass_find_next_device(devp); @@ -392,7 +392,7 @@ int blk_next_device(struct udevice **devp) return ret; if (!*devp) return -ENODEV; - desc = dev_get_uclass_platdata(*devp); + desc = dev_get_uclass_plat(*devp); if (desc->if_type == if_type) return 0; } while (1); @@ -408,7 +408,7 @@ int blk_find_device(int if_type, int devnum, struct udevice **devp) if (ret) return ret; uclass_foreach_dev(dev, uc) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__, if_type, devnum, dev->name, desc->if_type, desc->devnum); @@ -516,7 +516,7 @@ int blk_find_max_devnum(enum if_type if_type) if (ret) return ret; uclass_foreach_dev(dev, uc) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); if (desc->if_type == if_type && desc->devnum > max_devnum) max_devnum = desc->devnum; @@ -548,7 +548,7 @@ static int blk_claim_devnum(enum if_type if_type, int devnum) if (ret) return ret; uclass_foreach_dev(dev, uc) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); if (desc->if_type == if_type && desc->devnum == devnum) { int next = blk_next_free_devnum(if_type); @@ -583,7 +583,7 @@ int blk_create_device(struct udevice *parent, const char *drv_name, ret = device_bind_driver(parent, drv_name, name, &dev); if (ret) return ret; - desc = dev_get_uclass_platdata(dev); + desc = dev_get_uclass_plat(dev); desc->if_type = if_type; desc->blksz = blksz; desc->log2blksz = LOG2(desc->blksz); @@ -629,7 +629,7 @@ int blk_unbind_all(int if_type) if (ret) return ret; uclass_foreach_dev_safe(dev, next, uc) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); if (desc->if_type == if_type) { ret = device_remove(dev, DM_REMOVE_NORMAL); @@ -648,7 +648,7 @@ static int blk_post_probe(struct udevice *dev) { if (IS_ENABLED(CONFIG_PARTITIONS) && IS_ENABLED(CONFIG_HAVE_BLOCK_DEVICE)) { - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); part_init(desc); } @@ -660,5 +660,5 @@ UCLASS_DRIVER(blk) = { .id = UCLASS_BLK, .name = "blk", .post_probe = blk_post_probe, - .per_device_platdata_auto_alloc_size = sizeof(struct blk_desc), + .per_device_plat_auto = sizeof(struct blk_desc), }; diff --git a/drivers/block/ide.c b/drivers/block/ide.c index a766b5c..43a0776 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -940,7 +940,7 @@ ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt, #endif { #ifdef CONFIG_BLK - struct blk_desc *block_dev = dev_get_uclass_platdata(dev); + struct blk_desc *block_dev = dev_get_uclass_plat(dev); #endif int device = block_dev->devnum; ulong n = 0; @@ -1067,7 +1067,7 @@ ulong ide_write(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt, #endif { #ifdef CONFIG_BLK - struct blk_desc *block_dev = dev_get_uclass_platdata(dev); + struct blk_desc *block_dev = dev_get_uclass_plat(dev); #endif int device = block_dev->devnum; ulong n = 0; @@ -1160,7 +1160,7 @@ int ide_device_present(int dev) #ifdef CONFIG_BLK static int ide_blk_probe(struct udevice *udev) { - struct blk_desc *desc = dev_get_uclass_platdata(udev); + struct blk_desc *desc = dev_get_uclass_plat(udev); /* fill in device vendor/product/rev strings */ strncpy(desc->vendor, ide_dev_desc[desc->devnum].vendor, diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index cca2237..34c26cd 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -34,8 +34,8 @@ static unsigned long host_block_read(struct udevice *dev, unsigned long start, lbaint_t blkcnt, void *buffer) { - struct host_block_dev *host_dev = dev_get_platdata(dev); - struct blk_desc *block_dev = dev_get_uclass_platdata(dev); + struct host_block_dev *host_dev = dev_get_plat(dev); + struct blk_desc *block_dev = dev_get_uclass_plat(dev); #else static unsigned long host_block_read(struct blk_desc *block_dev, @@ -65,8 +65,8 @@ static unsigned long host_block_write(struct udevice *dev, unsigned long start, lbaint_t blkcnt, const void *buffer) { - struct host_block_dev *host_dev = dev_get_platdata(dev); - struct blk_desc *block_dev = dev_get_uclass_platdata(dev); + struct host_block_dev *host_dev = dev_get_plat(dev); + struct blk_desc *block_dev = dev_get_uclass_plat(dev); #else static unsigned long host_block_write(struct blk_desc *block_dev, unsigned long start, lbaint_t blkcnt, @@ -133,7 +133,7 @@ int host_dev_bind(int devnum, char *filename) if (ret) goto err_file; - host_dev = dev_get_platdata(dev); + host_dev = dev_get_plat(dev); host_dev->fd = fd; host_dev->filename = fname; @@ -202,7 +202,7 @@ int host_get_dev_err(int devnum, struct blk_desc **blk_devp) ret = blk_get_device(IF_TYPE_HOST, devnum, &dev); if (ret) return ret; - *blk_devp = dev_get_uclass_platdata(dev); + *blk_devp = dev_get_uclass_plat(dev); #else struct host_block_dev *host_dev = find_host_device(devnum); @@ -228,7 +228,7 @@ U_BOOT_DRIVER(sandbox_host_blk) = { .name = "sandbox_host_blk", .id = UCLASS_BLK, .ops = &sandbox_host_blk_ops, - .platdata_auto_alloc_size = sizeof(struct host_block_dev), + .plat_auto = sizeof(struct host_block_dev), }; #else U_BOOT_LEGACY_BLK(sandbox_host) = { diff --git a/drivers/bootcount/bootcount.c b/drivers/bootcount/bootcount.c index e8db854..343b8a3 100644 --- a/drivers/bootcount/bootcount.c +++ b/drivers/bootcount/bootcount.c @@ -136,7 +136,7 @@ static const struct udevice_id bootcount_mem_ids[] = { U_BOOT_DRIVER(bootcount_mem) = { .name = "bootcount-mem", .id = UCLASS_BOOTCOUNT, - .priv_auto_alloc_size = sizeof(struct bootcount_mem_priv), + .priv_auto = sizeof(struct bootcount_mem_priv), .probe = bootcount_mem_probe, .of_match = bootcount_mem_ids, .ops = &bootcount_mem_ops, diff --git a/drivers/bootcount/i2c-eeprom.c b/drivers/bootcount/i2c-eeprom.c index a3aa0cf..709be09 100644 --- a/drivers/bootcount/i2c-eeprom.c +++ b/drivers/bootcount/i2c-eeprom.c @@ -89,7 +89,7 @@ static const struct udevice_id bootcount_i2c_eeprom_ids[] = { U_BOOT_DRIVER(bootcount_spi_flash) = { .name = "bootcount-i2c-eeprom", .id = UCLASS_BOOTCOUNT, - .priv_auto_alloc_size = sizeof(struct bootcount_i2c_eeprom_priv), + .priv_auto = sizeof(struct bootcount_i2c_eeprom_priv), .probe = bootcount_i2c_eeprom_probe, .of_match = bootcount_i2c_eeprom_ids, .ops = &bootcount_i2c_eeprom_ops, diff --git a/drivers/bootcount/rtc.c b/drivers/bootcount/rtc.c index 076a8bb..483caaa 100644 --- a/drivers/bootcount/rtc.c +++ b/drivers/bootcount/rtc.c @@ -83,7 +83,7 @@ static const struct udevice_id bootcount_rtc_ids[] = { U_BOOT_DRIVER(bootcount_rtc) = { .name = "bootcount-rtc", .id = UCLASS_BOOTCOUNT, - .priv_auto_alloc_size = sizeof(struct bootcount_rtc_priv), + .priv_auto = sizeof(struct bootcount_rtc_priv), .probe = bootcount_rtc_probe, .of_match = bootcount_rtc_ids, .ops = &bootcount_rtc_ops, diff --git a/drivers/bootcount/spi-flash.c b/drivers/bootcount/spi-flash.c index 7cd388e..03050e6 100644 --- a/drivers/bootcount/spi-flash.c +++ b/drivers/bootcount/spi-flash.c @@ -118,7 +118,7 @@ static const struct udevice_id bootcount_spi_flash_ids[] = { U_BOOT_DRIVER(bootcount_spi_flash) = { .name = "bootcount-spi-flash", .id = UCLASS_BOOTCOUNT, - .priv_auto_alloc_size = sizeof(struct bootcount_spi_flash_priv), + .priv_auto = sizeof(struct bootcount_spi_flash_priv), .probe = bootcount_spi_flash_probe, .of_match = bootcount_spi_flash_ids, .ops = &bootcount_spi_flash_ops, diff --git a/drivers/button/button-gpio.c b/drivers/button/button-gpio.c index 985ae7f..dbb0006 100644 --- a/drivers/button/button-gpio.c +++ b/drivers/button/button-gpio.c @@ -31,7 +31,7 @@ static enum button_state_t button_gpio_get_state(struct udevice *dev) static int button_gpio_probe(struct udevice *dev) { - struct button_uc_plat *uc_plat = dev_get_uclass_platdata(dev); + struct button_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct button_gpio_priv *priv = dev_get_priv(dev); int ret; @@ -83,7 +83,7 @@ static int button_gpio_bind(struct udevice *parent) node, &dev); if (ret) return ret; - uc_plat = dev_get_uclass_platdata(dev); + uc_plat = dev_get_uclass_plat(dev); uc_plat->label = label; } @@ -105,7 +105,7 @@ U_BOOT_DRIVER(button_gpio) = { .id = UCLASS_BUTTON, .of_match = button_gpio_ids, .ops = &button_gpio_ops, - .priv_auto_alloc_size = sizeof(struct button_gpio_priv), + .priv_auto = sizeof(struct button_gpio_priv), .bind = button_gpio_bind, .probe = button_gpio_probe, .remove = button_gpio_remove, diff --git a/drivers/button/button-uclass.c b/drivers/button/button-uclass.c index 1c742c2..e06d3eb 100644 --- a/drivers/button/button-uclass.c +++ b/drivers/button/button-uclass.c @@ -16,7 +16,7 @@ int button_get_by_label(const char *label, struct udevice **devp) struct uclass *uc; uclass_id_foreach_dev(UCLASS_BUTTON, dev, uc) { - struct button_uc_plat *uc_plat = dev_get_uclass_platdata(dev); + struct button_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Ignore the top-level button node */ if (uc_plat->label && !strcmp(label, uc_plat->label)) @@ -39,5 +39,5 @@ enum button_state_t button_get_state(struct udevice *dev) UCLASS_DRIVER(button) = { .id = UCLASS_BUTTON, .name = "button", - .per_device_platdata_auto_alloc_size = sizeof(struct button_uc_plat), + .per_device_plat_auto = sizeof(struct button_uc_plat), }; diff --git a/drivers/cache/cache-v5l2.c b/drivers/cache/cache-v5l2.c index 51c074b..cb9ebbb 100644 --- a/drivers/cache/cache-v5l2.c +++ b/drivers/cache/cache-v5l2.c @@ -73,7 +73,7 @@ struct v5l2_plat { static int v5l2_enable(struct udevice *dev) { - struct v5l2_plat *plat = dev_get_platdata(dev); + struct v5l2_plat *plat = dev_get_plat(dev); volatile struct l2cache *regs = plat->regs; if (regs) @@ -84,7 +84,7 @@ static int v5l2_enable(struct udevice *dev) static int v5l2_disable(struct udevice *dev) { - struct v5l2_plat *plat = dev_get_platdata(dev); + struct v5l2_plat *plat = dev_get_plat(dev); volatile struct l2cache *regs = plat->regs; u8 hart = gd->arch.boot_hart; void __iomem *cctlcmd = (void __iomem *)CCTL_CMD_REG(regs, hart); @@ -104,9 +104,9 @@ static int v5l2_disable(struct udevice *dev) return 0; } -static int v5l2_ofdata_to_platdata(struct udevice *dev) +static int v5l2_of_to_plat(struct udevice *dev) { - struct v5l2_plat *plat = dev_get_platdata(dev); + struct v5l2_plat *plat = dev_get_plat(dev); struct l2cache *regs; regs = (struct l2cache *)dev_read_addr(dev); @@ -130,7 +130,7 @@ static int v5l2_ofdata_to_platdata(struct udevice *dev) static int v5l2_probe(struct udevice *dev) { - struct v5l2_plat *plat = dev_get_platdata(dev); + struct v5l2_plat *plat = dev_get_plat(dev); struct l2cache *regs = plat->regs; u32 ctl_val; @@ -180,9 +180,9 @@ U_BOOT_DRIVER(v5l2_cache) = { .name = "v5l2_cache", .id = UCLASS_CACHE, .of_match = v5l2_cache_ids, - .ofdata_to_platdata = v5l2_ofdata_to_platdata, + .of_to_plat = v5l2_of_to_plat, .probe = v5l2_probe, - .platdata_auto_alloc_size = sizeof(struct v5l2_plat), + .plat_auto = sizeof(struct v5l2_plat), .ops = &v5l2_cache_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/clk/altera/clk-agilex.c b/drivers/clk/altera/clk-agilex.c index a539889..bac1d98 100644 --- a/drivers/clk/altera/clk-agilex.c +++ b/drivers/clk/altera/clk-agilex.c @@ -17,7 +17,7 @@ DECLARE_GLOBAL_DATA_PTR; -struct socfpga_clk_platdata { +struct socfpga_clk_plat { void __iomem *regs; }; @@ -25,20 +25,20 @@ struct socfpga_clk_platdata { * function to write the bypass register which requires a poll of the * busy bit */ -static void clk_write_bypass_mainpll(struct socfpga_clk_platdata *plat, u32 val) +static void clk_write_bypass_mainpll(struct socfpga_clk_plat *plat, u32 val) { CM_REG_WRITEL(plat, val, CLKMGR_MAINPLL_BYPASS); cm_wait_for_fsm(); } -static void clk_write_bypass_perpll(struct socfpga_clk_platdata *plat, u32 val) +static void clk_write_bypass_perpll(struct socfpga_clk_plat *plat, u32 val) { CM_REG_WRITEL(plat, val, CLKMGR_PERPLL_BYPASS); cm_wait_for_fsm(); } /* function to write the ctrl register which requires a poll of the busy bit */ -static void clk_write_ctrl(struct socfpga_clk_platdata *plat, u32 val) +static void clk_write_ctrl(struct socfpga_clk_plat *plat, u32 val) { CM_REG_WRITEL(plat, val, CLKMGR_CTRL); cm_wait_for_fsm(); @@ -108,7 +108,7 @@ static const struct { }, }; -static int membus_wait_for_req(struct socfpga_clk_platdata *plat, u32 pll, +static int membus_wait_for_req(struct socfpga_clk_plat *plat, u32 pll, int timeout) { int cnt = 0; @@ -133,7 +133,7 @@ static int membus_wait_for_req(struct socfpga_clk_platdata *plat, u32 pll, return 0; } -static int membus_write_pll(struct socfpga_clk_platdata *plat, u32 pll, +static int membus_write_pll(struct socfpga_clk_plat *plat, u32 pll, u32 addr_offset, u32 wdat, int timeout) { u32 addr; @@ -154,7 +154,7 @@ static int membus_write_pll(struct socfpga_clk_platdata *plat, u32 pll, return membus_wait_for_req(plat, pll, timeout); } -static int membus_read_pll(struct socfpga_clk_platdata *plat, u32 pll, +static int membus_read_pll(struct socfpga_clk_plat *plat, u32 pll, u32 addr_offset, u32 *rdata, int timeout) { u32 addr; @@ -184,7 +184,7 @@ static int membus_read_pll(struct socfpga_clk_platdata *plat, u32 pll, return 0; } -static void membus_pll_configs(struct socfpga_clk_platdata *plat, u32 pll) +static void membus_pll_configs(struct socfpga_clk_plat *plat, u32 pll) { int i; u32 rdata; @@ -236,7 +236,7 @@ static u32 calc_vocalib_pll(u32 pllm, u32 pllglob) static void clk_basic_init(struct udevice *dev, const struct cm_config * const cfg) { - struct socfpga_clk_platdata *plat = dev_get_platdata(dev); + struct socfpga_clk_plat *plat = dev_get_plat(dev); u32 vcocalib; if (!cfg) @@ -342,7 +342,7 @@ static void clk_basic_init(struct udevice *dev, CM_REG_READL(plat, CLKMGR_CTRL) & ~CLKMGR_CTRL_BOOTMODE); } -static u64 clk_get_vco_clk_hz(struct socfpga_clk_platdata *plat, +static u64 clk_get_vco_clk_hz(struct socfpga_clk_plat *plat, u32 pllglob_reg, u32 pllm_reg) { u64 fref, arefdiv, mdiv, reg, vco; @@ -375,26 +375,26 @@ static u64 clk_get_vco_clk_hz(struct socfpga_clk_platdata *plat, return vco; } -static u64 clk_get_main_vco_clk_hz(struct socfpga_clk_platdata *plat) +static u64 clk_get_main_vco_clk_hz(struct socfpga_clk_plat *plat) { return clk_get_vco_clk_hz(plat, CLKMGR_MAINPLL_PLLGLOB, CLKMGR_MAINPLL_PLLM); } -static u64 clk_get_per_vco_clk_hz(struct socfpga_clk_platdata *plat) +static u64 clk_get_per_vco_clk_hz(struct socfpga_clk_plat *plat) { return clk_get_vco_clk_hz(plat, CLKMGR_PERPLL_PLLGLOB, CLKMGR_PERPLL_PLLM); } -static u32 clk_get_5_1_clk_src(struct socfpga_clk_platdata *plat, u64 reg) +static u32 clk_get_5_1_clk_src(struct socfpga_clk_plat *plat, u64 reg) { u32 clksrc = CM_REG_READL(plat, reg); return (clksrc & CLKMGR_CLKSRC_MASK) >> CLKMGR_CLKSRC_OFFSET; } -static u64 clk_get_clksrc_hz(struct socfpga_clk_platdata *plat, u32 clksrc_reg, +static u64 clk_get_clksrc_hz(struct socfpga_clk_plat *plat, u32 clksrc_reg, u32 main_reg, u32 per_reg) { u64 clock; @@ -431,7 +431,7 @@ static u64 clk_get_clksrc_hz(struct socfpga_clk_platdata *plat, u32 clksrc_reg, return clock; } -static u64 clk_get_mpu_clk_hz(struct socfpga_clk_platdata *plat) +static u64 clk_get_mpu_clk_hz(struct socfpga_clk_plat *plat) { u64 clock = clk_get_clksrc_hz(plat, CLKMGR_MAINPLL_MPUCLK, CLKMGR_MAINPLL_PLLC0, @@ -443,14 +443,14 @@ static u64 clk_get_mpu_clk_hz(struct socfpga_clk_platdata *plat) return clock; } -static u32 clk_get_l3_main_clk_hz(struct socfpga_clk_platdata *plat) +static u32 clk_get_l3_main_clk_hz(struct socfpga_clk_plat *plat) { return clk_get_clksrc_hz(plat, CLKMGR_MAINPLL_NOCCLK, CLKMGR_MAINPLL_PLLC1, CLKMGR_PERPLL_PLLC1); } -static u32 clk_get_l4_main_clk_hz(struct socfpga_clk_platdata *plat) +static u32 clk_get_l4_main_clk_hz(struct socfpga_clk_plat *plat) { u64 clock = clk_get_l3_main_clk_hz(plat); @@ -461,7 +461,7 @@ static u32 clk_get_l4_main_clk_hz(struct socfpga_clk_platdata *plat) return clock; } -static u32 clk_get_sdmmc_clk_hz(struct socfpga_clk_platdata *plat) +static u32 clk_get_sdmmc_clk_hz(struct socfpga_clk_plat *plat) { u64 clock = clk_get_clksrc_hz(plat, CLKMGR_ALTR_SDMMCCTR, CLKMGR_MAINPLL_PLLC3, @@ -473,7 +473,7 @@ static u32 clk_get_sdmmc_clk_hz(struct socfpga_clk_platdata *plat) return clock / 4; } -static u32 clk_get_l4_sp_clk_hz(struct socfpga_clk_platdata *plat) +static u32 clk_get_l4_sp_clk_hz(struct socfpga_clk_plat *plat) { u64 clock = clk_get_l3_main_clk_hz(plat); @@ -484,7 +484,7 @@ static u32 clk_get_l4_sp_clk_hz(struct socfpga_clk_platdata *plat) return clock; } -static u32 clk_get_l4_mp_clk_hz(struct socfpga_clk_platdata *plat) +static u32 clk_get_l4_mp_clk_hz(struct socfpga_clk_plat *plat) { u64 clock = clk_get_l3_main_clk_hz(plat); @@ -495,7 +495,7 @@ static u32 clk_get_l4_mp_clk_hz(struct socfpga_clk_platdata *plat) return clock; } -static u32 clk_get_l4_sys_free_clk_hz(struct socfpga_clk_platdata *plat) +static u32 clk_get_l4_sys_free_clk_hz(struct socfpga_clk_plat *plat) { if (CM_REG_READL(plat, CLKMGR_STAT) & CLKMGR_STAT_BOOTMODE) return clk_get_l3_main_clk_hz(plat) / 2; @@ -503,7 +503,7 @@ static u32 clk_get_l4_sys_free_clk_hz(struct socfpga_clk_platdata *plat) return clk_get_l3_main_clk_hz(plat) / 4; } -static u32 clk_get_emac_clk_hz(struct socfpga_clk_platdata *plat, u32 emac_id) +static u32 clk_get_emac_clk_hz(struct socfpga_clk_plat *plat, u32 emac_id) { bool emacsel_a; u32 ctl; @@ -585,7 +585,7 @@ static u32 clk_get_emac_clk_hz(struct socfpga_clk_platdata *plat, u32 emac_id) static ulong socfpga_clk_get_rate(struct clk *clk) { - struct socfpga_clk_platdata *plat = dev_get_platdata(clk->dev); + struct socfpga_clk_plat *plat = dev_get_plat(clk->dev); switch (clk->id) { case AGILEX_MPU_CLK: @@ -628,9 +628,9 @@ static int socfpga_clk_probe(struct udevice *dev) return 0; } -static int socfpga_clk_ofdata_to_platdata(struct udevice *dev) +static int socfpga_clk_of_to_plat(struct udevice *dev) { - struct socfpga_clk_platdata *plat = dev_get_platdata(dev); + struct socfpga_clk_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -657,6 +657,6 @@ U_BOOT_DRIVER(socfpga_agilex_clk) = { .of_match = socfpga_clk_match, .ops = &socfpga_clk_ops, .probe = socfpga_clk_probe, - .ofdata_to_platdata = socfpga_clk_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct socfpga_clk_platdata), + .of_to_plat = socfpga_clk_of_to_plat, + .plat_auto = sizeof(struct socfpga_clk_plat), }; diff --git a/drivers/clk/altera/clk-arria10.c b/drivers/clk/altera/clk-arria10.c index 732ed4d..1812152 100644 --- a/drivers/clk/altera/clk-arria10.c +++ b/drivers/clk/altera/clk-arria10.c @@ -24,7 +24,7 @@ enum socfpga_a10_clk_type { SOCFPGA_A10_CLK_UNKNOWN_CLK, }; -struct socfpga_a10_clk_platdata { +struct socfpga_a10_clk_plat { enum socfpga_a10_clk_type type; struct clk_bulk clks; u32 regs; @@ -43,7 +43,7 @@ struct socfpga_a10_clk_platdata { static int socfpga_a10_clk_get_upstream(struct clk *clk, struct clk **upclk) { - struct socfpga_a10_clk_platdata *plat = dev_get_platdata(clk->dev); + struct socfpga_a10_clk_plat *plat = dev_get_plat(clk->dev); u32 reg, maxval; if (plat->clks.count == 0) @@ -84,7 +84,7 @@ static int socfpga_a10_clk_get_upstream(struct clk *clk, struct clk **upclk) static int socfpga_a10_clk_endisable(struct clk *clk, bool enable) { - struct socfpga_a10_clk_platdata *plat = dev_get_platdata(clk->dev); + struct socfpga_a10_clk_plat *plat = dev_get_plat(clk->dev); struct clk *upclk = NULL; int ret; @@ -120,7 +120,7 @@ static int socfpga_a10_clk_disable(struct clk *clk) static ulong socfpga_a10_clk_get_rate(struct clk *clk) { - struct socfpga_a10_clk_platdata *plat = dev_get_platdata(clk->dev); + struct socfpga_a10_clk_plat *plat = dev_get_plat(clk->dev); struct clk *upclk = NULL; ulong rate = 0, reg, numer, denom; int ret; @@ -190,7 +190,7 @@ static struct clk_ops socfpga_a10_clk_ops = { */ static void socfpga_a10_handoff_workaround(struct udevice *dev) { - struct socfpga_a10_clk_platdata *plat = dev_get_platdata(dev); + struct socfpga_a10_clk_plat *plat = dev_get_plat(dev); const void *fdt = gd->fdt_blob; struct clk_bulk *bulk = &plat->clks; int i, ret, offset = dev_of_offset(dev); @@ -274,8 +274,8 @@ static int socfpga_a10_clk_bind(struct udevice *dev) static int socfpga_a10_clk_probe(struct udevice *dev) { - struct socfpga_a10_clk_platdata *plat = dev_get_platdata(dev); - struct socfpga_a10_clk_platdata *pplat; + struct socfpga_a10_clk_plat *plat = dev_get_plat(dev); + struct socfpga_a10_clk_plat *pplat; struct udevice *pdev; const void *fdt = gd->fdt_blob; int offset = dev_of_offset(dev); @@ -291,7 +291,7 @@ static int socfpga_a10_clk_probe(struct udevice *dev) if (!pdev) return -ENODEV; - pplat = dev_get_platdata(pdev); + pplat = dev_get_plat(pdev); if (!pplat) return -EINVAL; @@ -319,9 +319,9 @@ static int socfpga_a10_clk_probe(struct udevice *dev) return 0; } -static int socfpga_a10_ofdata_to_platdata(struct udevice *dev) +static int socfpga_a10_of_to_plat(struct udevice *dev) { - struct socfpga_a10_clk_platdata *plat = dev_get_platdata(dev); + struct socfpga_a10_clk_plat *plat = dev_get_plat(dev); unsigned int divreg[3], gatereg[2]; int ret; @@ -357,7 +357,7 @@ U_BOOT_DRIVER(socfpga_a10_clk) = { .ops = &socfpga_a10_clk_ops, .bind = socfpga_a10_clk_bind, .probe = socfpga_a10_clk_probe, - .ofdata_to_platdata = socfpga_a10_ofdata_to_platdata, + .of_to_plat = socfpga_a10_of_to_plat, - .platdata_auto_alloc_size = sizeof(struct socfpga_a10_clk_platdata), + .plat_auto = sizeof(struct socfpga_a10_clk_plat), }; diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c index aab7d14..a090671 100644 --- a/drivers/clk/aspeed/clk_ast2500.c +++ b/drivers/clk/aspeed/clk_ast2500.c @@ -491,7 +491,7 @@ struct clk_ops ast2500_clk_ops = { .enable = ast2500_clk_enable, }; -static int ast2500_clk_ofdata_to_platdata(struct udevice *dev) +static int ast2500_clk_of_to_plat(struct udevice *dev) { struct ast2500_clk_priv *priv = dev_get_priv(dev); @@ -523,8 +523,8 @@ U_BOOT_DRIVER(aspeed_ast2500_scu) = { .name = "aspeed_ast2500_scu", .id = UCLASS_CLK, .of_match = ast2500_clk_ids, - .priv_auto_alloc_size = sizeof(struct ast2500_clk_priv), + .priv_auto = sizeof(struct ast2500_clk_priv), .ops = &ast2500_clk_ops, .bind = ast2500_clk_bind, - .ofdata_to_platdata = ast2500_clk_ofdata_to_platdata, + .of_to_plat = ast2500_clk_of_to_plat, }; diff --git a/drivers/clk/at91/compat.c b/drivers/clk/at91/compat.c index 9563285..e514f26 100644 --- a/drivers/clk/at91/compat.c +++ b/drivers/clk/at91/compat.c @@ -21,7 +21,7 @@ DECLARE_GLOBAL_DATA_PTR; -struct pmc_platdata { +struct pmc_plat { struct at91_pmc *reg_base; struct regmap *regmap_sfr; }; @@ -45,7 +45,7 @@ U_BOOT_DRIVER(at91_pmc) = { static int at91_pmc_core_probe(struct udevice *dev) { - struct pmc_platdata *plat = dev_get_platdata(dev); + struct pmc_plat *plat = dev_get_plat(dev); dev = dev_get_parent(dev); @@ -62,34 +62,30 @@ static int at91_pmc_core_probe(struct udevice *dev) */ int at91_clk_sub_device_bind(struct udevice *dev, const char *drv_name) { - const void *fdt = gd->fdt_blob; - int offset = dev_of_offset(dev); + ofnode parent = dev_ofnode(dev); + ofnode node; bool pre_reloc_only = !(gd->flags & GD_FLG_RELOC); const char *name; int ret; - for (offset = fdt_first_subnode(fdt, offset); - offset > 0; - offset = fdt_next_subnode(fdt, offset)) { - if (pre_reloc_only && - !ofnode_pre_reloc(offset_to_ofnode(offset))) + ofnode_for_each_subnode(node, parent) { + if (pre_reloc_only && !ofnode_pre_reloc(node)) continue; /* * If this node has "compatible" property, this is not * a clock sub-node, but a normal device. skip. */ - fdt_get_property(fdt, offset, "compatible", &ret); - if (ret >= 0) + if (ofnode_read_prop(node, "compatible", NULL)) continue; if (ret != -FDT_ERR_NOTFOUND) return ret; - name = fdt_get_name(fdt, offset, NULL); + name = ofnode_get_name(node); if (!name) return -EINVAL; - ret = device_bind_driver_to_node(dev, drv_name, name, - offset_to_ofnode(offset), NULL); + ret = device_bind_driver_to_node(dev, drv_name, name, node, + NULL); if (ret) return ret; } @@ -119,7 +115,7 @@ int at91_clk_of_xlate(struct clk *clk, struct ofnode_phandle_args *args) int at91_clk_probe(struct udevice *dev) { struct udevice *dev_periph_container, *dev_pmc; - struct pmc_platdata *plat = dev_get_platdata(dev); + struct pmc_plat *plat = dev_get_plat(dev); dev_periph_container = dev_get_parent(dev); dev_pmc = dev_get_parent(dev_periph_container); @@ -195,7 +191,7 @@ U_BOOT_DRIVER(at91_master_clk) = { /* Main osc clock specific code. */ static int main_osc_clk_enable(struct clk *clk) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; if (readl(&pmc->sr) & AT91_PMC_MOSCSELS) @@ -229,14 +225,14 @@ U_BOOT_DRIVER(at91sam9x5_main_osc_clk) = { .id = UCLASS_CLK, .of_match = main_osc_clk_match, .probe = main_osc_clk_probe, - .platdata_auto_alloc_size = sizeof(struct pmc_platdata), + .plat_auto = sizeof(struct pmc_plat), .ops = &main_osc_clk_ops, }; /* PLLA clock specific code. */ static int plla_clk_enable(struct clk *clk) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; if (readl(&pmc->sr) & AT91_PMC_LOCKA) @@ -270,7 +266,7 @@ U_BOOT_DRIVER(at91_plla_clk) = { .id = UCLASS_CLK, .of_match = plla_clk_match, .probe = plla_clk_probe, - .platdata_auto_alloc_size = sizeof(struct pmc_platdata), + .plat_auto = sizeof(struct pmc_plat), .ops = &plla_clk_ops, }; @@ -282,7 +278,7 @@ static int at91_plladiv_clk_enable(struct clk *clk) static ulong at91_plladiv_clk_get_rate(struct clk *clk) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; struct clk source; ulong clk_rate; @@ -301,7 +297,7 @@ static ulong at91_plladiv_clk_get_rate(struct clk *clk) static ulong at91_plladiv_clk_set_rate(struct clk *clk, ulong rate) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; struct clk source; ulong parent_rate; @@ -344,7 +340,7 @@ U_BOOT_DRIVER(at91_plladiv_clk) = { .id = UCLASS_CLK, .of_match = at91_plladiv_clk_match, .probe = at91_plladiv_clk_probe, - .platdata_auto_alloc_size = sizeof(struct pmc_platdata), + .plat_auto = sizeof(struct pmc_plat), .ops = &at91_plladiv_clk_ops, }; @@ -405,7 +401,7 @@ static ulong system_clk_set_rate(struct clk *clk, ulong rate) static int system_clk_enable(struct clk *clk) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; u32 mask; @@ -441,7 +437,7 @@ U_BOOT_DRIVER(system_clk) = { .name = "system-clk", .id = UCLASS_CLK, .probe = at91_clk_probe, - .platdata_auto_alloc_size = sizeof(struct pmc_platdata), + .plat_auto = sizeof(struct pmc_plat), .ops = &system_clk_ops, }; @@ -487,7 +483,7 @@ U_BOOT_DRIVER(sam9x5_periph_clk) = { static int periph_clk_enable(struct clk *clk) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; enum periph_clk_type clk_type; void *addr; @@ -540,7 +536,7 @@ static struct clk_ops periph_clk_ops = { U_BOOT_DRIVER(clk_periph) = { .name = "periph-clk", .id = UCLASS_CLK, - .platdata_auto_alloc_size = sizeof(struct pmc_platdata), + .plat_auto = sizeof(struct pmc_plat), .probe = at91_clk_probe, .ops = &periph_clk_ops, }; @@ -556,7 +552,7 @@ U_BOOT_DRIVER(clk_periph) = { static int utmi_clk_enable(struct clk *clk) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; struct clk clk_dev; ulong clk_rate; @@ -642,9 +638,9 @@ static struct clk_ops utmi_clk_ops = { .get_rate = utmi_clk_get_rate, }; -static int utmi_clk_ofdata_to_platdata(struct udevice *dev) +static int utmi_clk_of_to_plat(struct udevice *dev) { - struct pmc_platdata *plat = dev_get_platdata(dev); + struct pmc_plat *plat = dev_get_plat(dev); struct udevice *syscon; uclass_get_device_by_phandle(UCLASS_SYSCON, dev, @@ -671,8 +667,8 @@ U_BOOT_DRIVER(at91sam9x5_utmi_clk) = { .id = UCLASS_CLK, .of_match = utmi_clk_match, .probe = utmi_clk_probe, - .ofdata_to_platdata = utmi_clk_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct pmc_platdata), + .of_to_plat = utmi_clk_of_to_plat, + .plat_auto = sizeof(struct pmc_plat), .ops = &utmi_clk_ops, }; @@ -685,7 +681,7 @@ U_BOOT_DRIVER(at91sam9x5_utmi_clk) = { static ulong sama5d4_h32mx_clk_get_rate(struct clk *clk) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; ulong rate = gd->arch.mck_rate_hz; @@ -717,7 +713,7 @@ U_BOOT_DRIVER(sama5d4_h32mx_clk) = { .id = UCLASS_CLK, .of_match = sama5d4_h32mx_clk_match, .probe = sama5d4_h32mx_clk_probe, - .platdata_auto_alloc_size = sizeof(struct pmc_platdata), + .plat_auto = sizeof(struct pmc_plat), .ops = &sama5d4_h32mx_clk_ops, }; @@ -758,7 +754,7 @@ struct generic_clk_priv { static ulong generic_clk_get_rate(struct clk *clk) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; struct clk parent; ulong clk_rate; @@ -786,7 +782,7 @@ static ulong generic_clk_get_rate(struct clk *clk) static ulong generic_clk_set_rate(struct clk *clk, ulong rate) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; struct generic_clk_priv *priv = dev_get_priv(clk->dev); struct clk parent, best_parent; @@ -857,7 +853,7 @@ static struct clk_ops generic_clk_ops = { .set_rate = generic_clk_set_rate, }; -static int generic_clk_ofdata_to_platdata(struct udevice *dev) +static int generic_clk_of_to_plat(struct udevice *dev) { struct generic_clk_priv *priv = dev_get_priv(dev); u32 cells[GENERATED_SOURCE_MAX]; @@ -879,9 +875,9 @@ U_BOOT_DRIVER(generic_clk) = { .name = "generic-clk", .id = UCLASS_CLK, .probe = at91_clk_probe, - .ofdata_to_platdata = generic_clk_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct generic_clk_priv), - .platdata_auto_alloc_size = sizeof(struct pmc_platdata), + .of_to_plat = generic_clk_of_to_plat, + .priv_auto = sizeof(struct generic_clk_priv), + .plat_auto = sizeof(struct pmc_plat), .ops = &generic_clk_ops, }; @@ -899,7 +895,7 @@ struct at91_usb_clk_priv { static ulong at91_usb_clk_get_rate(struct clk *clk) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; struct clk source; u32 tmp, usbdiv; @@ -920,7 +916,7 @@ static ulong at91_usb_clk_get_rate(struct clk *clk) static ulong at91_usb_clk_set_rate(struct clk *clk, ulong rate) { - struct pmc_platdata *plat = dev_get_platdata(clk->dev); + struct pmc_plat *plat = dev_get_plat(clk->dev); struct at91_pmc *pmc = plat->reg_base; struct at91_usb_clk_priv *priv = dev_get_priv(clk->dev); struct clk source, best_source; @@ -981,7 +977,7 @@ static struct clk_ops at91_usb_clk_ops = { .set_rate = at91_usb_clk_set_rate, }; -static int at91_usb_clk_ofdata_to_platdata(struct udevice *dev) +static int at91_usb_clk_of_to_plat(struct udevice *dev) { struct at91_usb_clk_priv *priv = dev_get_priv(dev); u32 cells[AT91_USB_CLK_SOURCE_MAX]; @@ -1015,9 +1011,9 @@ U_BOOT_DRIVER(at91_usb_clk) = { .id = UCLASS_CLK, .of_match = at91_usb_clk_match, .probe = at91_usb_clk_probe, - .ofdata_to_platdata = at91_usb_clk_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct at91_usb_clk_priv), - .platdata_auto_alloc_size = sizeof(struct pmc_platdata), + .of_to_plat = at91_usb_clk_of_to_plat, + .priv_auto = sizeof(struct at91_usb_clk_priv), + .plat_auto = sizeof(struct pmc_plat), .ops = &at91_usb_clk_ops, }; diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c index dd62dc5..34ce611 100644 --- a/drivers/clk/at91/sckc.c +++ b/drivers/clk/at91/sckc.c @@ -165,7 +165,7 @@ U_BOOT_DRIVER(at91_sckc) = { .name = UBOOT_DM_CLK_AT91_SCKC, .id = UCLASS_CLK, .of_match = sam9x60_sckc_ids, - .priv_auto_alloc_size = sizeof(struct sam9x60_sckc) * 2, + .priv_auto = sizeof(struct sam9x60_sckc) * 2, .ops = &sam9x60_sckc_ops, .probe = at91_sam9x60_sckc_probe, .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/clk/clk-cdce9xx.c b/drivers/clk/clk-cdce9xx.c index fd47872..6634b7b 100644 --- a/drivers/clk/clk-cdce9xx.c +++ b/drivers/clk/clk-cdce9xx.c @@ -251,6 +251,6 @@ U_BOOT_DRIVER(cdce9xx_clk) = { .id = UCLASS_CLK, .of_match = cdce9xx_clk_of_match, .probe = cdce9xx_clk_probe, - .priv_auto_alloc_size = sizeof(struct cdce9xx_clk_data), + .priv_auto = sizeof(struct cdce9xx_clk_data), .ops = &cdce9xx_clk_ops, }; diff --git a/drivers/clk/clk-hsdk-cgu.c b/drivers/clk/clk-hsdk-cgu.c index 3eb93a5..449b430 100644 --- a/drivers/clk/clk-hsdk-cgu.c +++ b/drivers/clk/clk-hsdk-cgu.c @@ -774,6 +774,6 @@ U_BOOT_DRIVER(hsdk_cgu_clk) = { .id = UCLASS_CLK, .of_match = hsdk_cgu_clk_id, .probe = hsdk_cgu_clk_probe, - .priv_auto_alloc_size = sizeof(struct hsdk_cgu_clk), + .priv_auto = sizeof(struct hsdk_cgu_clk), .ops = &hsdk_cgu_ops, }; diff --git a/drivers/clk/clk-ti-sci.c b/drivers/clk/clk-ti-sci.c index 7a9a645..6f0fdaa 100644 --- a/drivers/clk/clk-ti-sci.c +++ b/drivers/clk/clk-ti-sci.c @@ -220,6 +220,6 @@ U_BOOT_DRIVER(ti_sci_clk) = { .id = UCLASS_CLK, .of_match = ti_sci_clk_of_match, .probe = ti_sci_clk_probe, - .priv_auto_alloc_size = sizeof(struct ti_sci_clk_data), + .priv_auto = sizeof(struct ti_sci_clk_data), .ops = &ti_sci_clk_ops, }; diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index ac954a3..5cfd00c 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -345,7 +345,7 @@ int clk_set_defaults(struct udevice *dev, int stage) { int ret; - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) return 0; /* If this not in SPL and pre-reloc state, don't take any action. */ diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 319808d..1efb7fe 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -36,7 +36,7 @@ int clk_register(struct clk *clk, const char *drv_name, return -ENOENT; } - ret = device_bind(parent, drv, name, NULL, -1, &clk->dev); + ret = device_bind(parent, drv, name, NULL, ofnode_null(), &clk->dev); if (ret) { printf("%s: CLK: %s driver bind error [%d]!\n", __func__, name, ret); @@ -44,8 +44,10 @@ int clk_register(struct clk *clk, const char *drv_name, } clk->enable_count = 0; + /* Store back pointer to clk from udevice */ - clk->dev->uclass_priv = clk; + /* FIXME: This is not allowed...should be allocated by driver model */ + dev_set_uclass_priv(clk->dev, clk); return 0; } @@ -65,7 +67,7 @@ const char *clk_hw_get_name(const struct clk *hw) bool clk_dev_binded(struct clk *clk) { - if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND)) + if (clk->dev && (dev_get_flags(clk->dev) & DM_FLAG_BOUND)) return true; return false; diff --git a/drivers/clk/clk_bcm6345.c b/drivers/clk/clk_bcm6345.c index b850b9f..8c22ed2 100644 --- a/drivers/clk/clk_bcm6345.c +++ b/drivers/clk/clk_bcm6345.c @@ -70,5 +70,5 @@ U_BOOT_DRIVER(clk_bcm6345) = { .of_match = bcm6345_clk_ids, .ops = &bcm6345_clk_ops, .probe = bcm63xx_clk_probe, - .priv_auto_alloc_size = sizeof(struct bcm6345_clk_priv), + .priv_auto = sizeof(struct bcm6345_clk_priv), }; diff --git a/drivers/clk/clk_boston.c b/drivers/clk/clk_boston.c index 2318dcf..2e81777 100644 --- a/drivers/clk/clk_boston.c +++ b/drivers/clk/clk_boston.c @@ -28,7 +28,7 @@ static uint32_t ext_field(uint32_t val, uint32_t mask) static ulong clk_boston_get_rate(struct clk *clk) { - struct clk_boston *state = dev_get_platdata(clk->dev); + struct clk_boston *state = dev_get_plat(clk->dev); uint32_t in_rate, mul, div; uint mmcmdiv; int err; @@ -58,9 +58,9 @@ const struct clk_ops clk_boston_ops = { .get_rate = clk_boston_get_rate, }; -static int clk_boston_ofdata_to_platdata(struct udevice *dev) +static int clk_boston_of_to_plat(struct udevice *dev) { - struct clk_boston *state = dev_get_platdata(dev); + struct clk_boston *state = dev_get_plat(dev); struct udevice *syscon; int err; @@ -91,7 +91,7 @@ U_BOOT_DRIVER(clk_boston) = { .name = "boston_clock", .id = UCLASS_CLK, .of_match = clk_boston_match, - .ofdata_to_platdata = clk_boston_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct clk_boston), + .of_to_plat = clk_boston_of_to_plat, + .plat_auto = sizeof(struct clk_boston), .ops = &clk_boston_ops, }; diff --git a/drivers/clk/clk_fixed_factor.c b/drivers/clk/clk_fixed_factor.c index cf9c4ae..e51f94a 100644 --- a/drivers/clk/clk_fixed_factor.c +++ b/drivers/clk/clk_fixed_factor.c @@ -18,7 +18,7 @@ struct clk_fixed_factor { }; #define to_clk_fixed_factor(dev) \ - ((struct clk_fixed_factor *)dev_get_platdata(dev)) + ((struct clk_fixed_factor *)dev_get_plat(dev)) static ulong clk_fixed_factor_get_rate(struct clk *clk) { @@ -38,7 +38,7 @@ const struct clk_ops clk_fixed_factor_ops = { .get_rate = clk_fixed_factor_get_rate, }; -static int clk_fixed_factor_ofdata_to_platdata(struct udevice *dev) +static int clk_fixed_factor_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) int err; @@ -66,7 +66,7 @@ U_BOOT_DRIVER(clk_fixed_factor) = { .name = "fixed_factor_clock", .id = UCLASS_CLK, .of_match = clk_fixed_factor_match, - .ofdata_to_platdata = clk_fixed_factor_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct clk_fixed_factor), + .of_to_plat = clk_fixed_factor_of_to_plat, + .plat_auto = sizeof(struct clk_fixed_factor), .ops = &clk_fixed_factor_ops, }; diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c index f86b4a0..3c5a83c 100644 --- a/drivers/clk/clk_fixed_rate.c +++ b/drivers/clk/clk_fixed_rate.c @@ -6,6 +6,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <dm/device-internal.h> #include <linux/clk-provider.h> static ulong clk_fixed_rate_get_rate(struct clk *clk) @@ -24,7 +25,7 @@ const struct clk_ops clk_fixed_rate_ops = { .enable = dummy_enable, }; -static int clk_fixed_rate_ofdata_to_platdata(struct udevice *dev) +static int clk_fixed_rate_of_to_plat(struct udevice *dev) { struct clk *clk = &to_clk_fixed_rate(dev)->clk; #if !CONFIG_IS_ENABLED(OF_PLATDATA) @@ -32,7 +33,8 @@ static int clk_fixed_rate_ofdata_to_platdata(struct udevice *dev) dev_read_u32_default(dev, "clock-frequency", 0); #endif /* Make fixed rate clock accessible from higher level struct clk */ - dev->uclass_priv = clk; + /* FIXME: This is not allowed */ + dev_set_uclass_priv(dev, clk); clk->dev = dev; clk->enable_count = 0; @@ -50,8 +52,8 @@ U_BOOT_DRIVER(fixed_clock) = { .name = "fixed_clock", .id = UCLASS_CLK, .of_match = clk_fixed_rate_match, - .ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct clk_fixed_rate), + .of_to_plat = clk_fixed_rate_of_to_plat, + .plat_auto = sizeof(struct clk_fixed_rate), .ops = &clk_fixed_rate_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/clk/clk_octeon.c b/drivers/clk/clk_octeon.c index fd559e0..ce27454 100644 --- a/drivers/clk/clk_octeon.c +++ b/drivers/clk/clk_octeon.c @@ -68,5 +68,5 @@ U_BOOT_DRIVER(clk_octeon) = { .of_match = octeon_clk_ids, .ops = &octeon_clk_ops, .probe = octeon_clk_probe, - .priv_auto_alloc_size = sizeof(struct octeon_clk_priv), + .priv_auto = sizeof(struct octeon_clk_priv), }; diff --git a/drivers/clk/clk_pic32.c b/drivers/clk/clk_pic32.c index dc46de2..5a10d46 100644 --- a/drivers/clk/clk_pic32.c +++ b/drivers/clk/clk_pic32.c @@ -423,5 +423,5 @@ U_BOOT_DRIVER(pic32_clk) = { .of_match = pic32_clk_ids, .ops = &pic32_pic32_clk_ops, .probe = pic32_clk_probe, - .priv_auto_alloc_size = sizeof(struct pic32_clk_priv), + .priv_auto = sizeof(struct pic32_clk_priv), }; diff --git a/drivers/clk/clk_sandbox.c b/drivers/clk/clk_sandbox.c index 0ff1b49..2c6c0e2 100644 --- a/drivers/clk/clk_sandbox.c +++ b/drivers/clk/clk_sandbox.c @@ -130,7 +130,7 @@ U_BOOT_DRIVER(sandbox_clk) = { .of_match = sandbox_clk_ids, .ops = &sandbox_clk_ops, .probe = sandbox_clk_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_clk_priv), + .priv_auto = sizeof(struct sandbox_clk_priv), }; ulong sandbox_clk_query_rate(struct udevice *dev, int id) diff --git a/drivers/clk/clk_sandbox_test.c b/drivers/clk/clk_sandbox_test.c index 8733838..e9eb738 100644 --- a/drivers/clk/clk_sandbox_test.c +++ b/drivers/clk/clk_sandbox_test.c @@ -189,5 +189,5 @@ U_BOOT_DRIVER(sandbox_clk_test) = { .id = UCLASS_MISC, .of_match = sandbox_clk_test_ids, .probe = sandbox_clk_test_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_clk_test), + .priv_auto = sizeof(struct sandbox_clk_test), }; diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/clk_stm32f.c index 93722f7..7e67895 100644 --- a/drivers/clk/clk_stm32f.c +++ b/drivers/clk/clk_stm32f.c @@ -726,6 +726,6 @@ U_BOOT_DRIVER(stm32fx_clk) = { .id = UCLASS_CLK, .ops = &stm32_clk_ops, .probe = stm32_clk_probe, - .priv_auto_alloc_size = sizeof(struct stm32_clk), + .priv_auto = sizeof(struct stm32_clk), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/clk/clk_stm32h7.c b/drivers/clk/clk_stm32h7.c index edf90ee..0171fe8 100644 --- a/drivers/clk/clk_stm32h7.c +++ b/drivers/clk/clk_stm32h7.c @@ -868,6 +868,6 @@ U_BOOT_DRIVER(stm32h7_clk) = { .id = UCLASS_CLK, .ops = &stm32_clk_ops, .probe = stm32_clk_probe, - .priv_auto_alloc_size = sizeof(struct stm32_clk), + .priv_auto = sizeof(struct stm32_clk), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c index c8840b9..5bea2b6 100644 --- a/drivers/clk/clk_stm32mp1.c +++ b/drivers/clk/clk_stm32mp1.c @@ -2253,7 +2253,7 @@ int soc_clk_dump(void) int ret; ret = uclass_get_device_by_driver(UCLASS_CLK, - DM_GET_DRIVER(stm32mp1_clock), + DM_DRIVER_GET(stm32mp1_clock), &dev); if (ret) return ret; @@ -2332,6 +2332,6 @@ U_BOOT_DRIVER(stm32mp1_clock) = { .name = "stm32mp1_clk", .id = UCLASS_CLK, .ops = &stm32mp1_clk_ops, - .priv_auto_alloc_size = sizeof(struct stm32mp1_clk_priv), + .priv_auto = sizeof(struct stm32mp1_clk_priv), .probe = stm32mp1_clk_probe, }; diff --git a/drivers/clk/clk_versal.c b/drivers/clk/clk_versal.c index d93b860..908bc75 100644 --- a/drivers/clk/clk_versal.c +++ b/drivers/clk/clk_versal.c @@ -734,5 +734,5 @@ U_BOOT_DRIVER(versal_clk) = { .of_match = versal_clk_ids, .probe = versal_clk_probe, .ops = &versal_clk_ops, - .priv_auto_alloc_size = sizeof(struct versal_clk_priv), + .priv_auto = sizeof(struct versal_clk_priv), }; diff --git a/drivers/clk/clk_vexpress_osc.c b/drivers/clk/clk_vexpress_osc.c index b48319b..3b1e020 100644 --- a/drivers/clk/clk_vexpress_osc.c +++ b/drivers/clk/clk_vexpress_osc.c @@ -107,6 +107,6 @@ U_BOOT_DRIVER(vexpress_osc_clk) = { .id = UCLASS_CLK, .of_match = vexpress_osc_clk_ids, .ops = &vexpress_osc_clk_ops, - .priv_auto_alloc_size = sizeof(struct vexpress_osc_clk_priv), + .priv_auto = sizeof(struct vexpress_osc_clk_priv), .probe = vexpress_osc_clk_probe, }; diff --git a/drivers/clk/clk_zynq.c b/drivers/clk/clk_zynq.c index a699a36..bf32d83 100644 --- a/drivers/clk/clk_zynq.c +++ b/drivers/clk/clk_zynq.c @@ -485,6 +485,6 @@ U_BOOT_DRIVER(zynq_clk) = { .id = UCLASS_CLK, .of_match = zynq_clk_ids, .ops = &zynq_clk_ops, - .priv_auto_alloc_size = sizeof(struct zynq_clk_priv), + .priv_auto = sizeof(struct zynq_clk_priv), .probe = zynq_clk_probe, }; diff --git a/drivers/clk/clk_zynqmp.c b/drivers/clk/clk_zynqmp.c index 7795119..e8acca0 100644 --- a/drivers/clk/clk_zynqmp.c +++ b/drivers/clk/clk_zynqmp.c @@ -617,7 +617,7 @@ int soc_clk_dump(void) int i, ret; ret = uclass_get_device_by_driver(UCLASS_CLK, - DM_GET_DRIVER(zynqmp_clk), &dev); + DM_DRIVER_GET(zynqmp_clk), &dev); if (ret) return ret; @@ -715,5 +715,5 @@ U_BOOT_DRIVER(zynqmp_clk) = { .of_match = zynqmp_clk_ids, .probe = zynqmp_clk_probe, .ops = &zynqmp_clk_ops, - .priv_auto_alloc_size = sizeof(struct zynqmp_clk_priv), + .priv_auto = sizeof(struct zynqmp_clk_priv), }; diff --git a/drivers/clk/exynos/clk-exynos7420.c b/drivers/clk/exynos/clk-exynos7420.c index 4a023ea..7d869eb 100644 --- a/drivers/clk/exynos/clk-exynos7420.c +++ b/drivers/clk/exynos/clk-exynos7420.c @@ -199,7 +199,7 @@ U_BOOT_DRIVER(exynos7420_clk_topc) = { .id = UCLASS_CLK, .of_match = exynos7420_clk_topc_compat, .probe = exynos7420_clk_topc_probe, - .priv_auto_alloc_size = sizeof(struct exynos7420_clk_topc_priv), + .priv_auto = sizeof(struct exynos7420_clk_topc_priv), .ops = &exynos7420_clk_topc_ops, }; @@ -213,7 +213,7 @@ U_BOOT_DRIVER(exynos7420_clk_top0) = { .id = UCLASS_CLK, .of_match = exynos7420_clk_top0_compat, .probe = exynos7420_clk_top0_probe, - .priv_auto_alloc_size = sizeof(struct exynos7420_clk_top0_priv), + .priv_auto = sizeof(struct exynos7420_clk_top0_priv), .ops = &exynos7420_clk_top0_ops, }; diff --git a/drivers/clk/ics8n3qv01.c b/drivers/clk/ics8n3qv01.c index 76b27ad..6bc1b8b 100644 --- a/drivers/clk/ics8n3qv01.c +++ b/drivers/clk/ics8n3qv01.c @@ -226,5 +226,5 @@ U_BOOT_DRIVER(ics8n3qv01) = { .ops = &ics8n3qv01_ops, .of_match = ics8n3qv01_ids, .probe = ics8n3qv01_probe, - .priv_auto_alloc_size = sizeof(struct ics8n3qv01_priv), + .priv_auto = sizeof(struct ics8n3qv01_priv), }; diff --git a/drivers/clk/imx/clk-imx8.c b/drivers/clk/imx/clk-imx8.c index 27a652a..8484613 100644 --- a/drivers/clk/imx/clk-imx8.c +++ b/drivers/clk/imx/clk-imx8.c @@ -51,7 +51,7 @@ int soc_clk_dump(void) int i, ret; ret = uclass_get_device_by_driver(UCLASS_CLK, - DM_GET_DRIVER(imx8_clk), &dev); + DM_DRIVER_GET(imx8_clk), &dev); if (ret) return ret; diff --git a/drivers/clk/mediatek/clk-mt7622.c b/drivers/clk/mediatek/clk-mt7622.c index 0246149..259ea33 100644 --- a/drivers/clk/mediatek/clk-mt7622.c +++ b/drivers/clk/mediatek/clk-mt7622.c @@ -716,7 +716,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = { .id = UCLASS_CLK, .of_match = mt7622_apmixed_compat, .probe = mt7622_apmixedsys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_apmixedsys_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -726,7 +726,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen) = { .id = UCLASS_CLK, .of_match = mt7622_topckgen_compat, .probe = mt7622_topckgen_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_topckgen_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -736,7 +736,7 @@ U_BOOT_DRIVER(mtk_clk_infracfg) = { .id = UCLASS_CLK, .of_match = mt7622_infracfg_compat, .probe = mt7622_infracfg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -746,7 +746,7 @@ U_BOOT_DRIVER(mtk_clk_pericfg) = { .id = UCLASS_CLK, .of_match = mt7622_pericfg_compat, .probe = mt7622_pericfg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -757,7 +757,7 @@ U_BOOT_DRIVER(mtk_clk_pciesys) = { .of_match = mt7622_pciesys_compat, .probe = mt7622_pciesys_probe, .bind = mt7622_pciesys_bind, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; @@ -767,7 +767,7 @@ U_BOOT_DRIVER(mtk_clk_ethsys) = { .of_match = mt7622_ethsys_compat, .probe = mt7622_ethsys_probe, .bind = mt7622_ethsys_bind, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; @@ -776,7 +776,7 @@ U_BOOT_DRIVER(mtk_clk_sgmiisys) = { .id = UCLASS_CLK, .of_match = mt7622_sgmiisys_compat, .probe = mt7622_sgmiisys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; @@ -785,6 +785,6 @@ U_BOOT_DRIVER(mtk_clk_ssusbsys) = { .id = UCLASS_CLK, .of_match = mt7622_ssusbsys_compat, .probe = mt7622_ssusbsys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; diff --git a/drivers/clk/mediatek/clk-mt7623.c b/drivers/clk/mediatek/clk-mt7623.c index a15fb45..0c7411e 100644 --- a/drivers/clk/mediatek/clk-mt7623.c +++ b/drivers/clk/mediatek/clk-mt7623.c @@ -859,7 +859,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = { .id = UCLASS_CLK, .of_match = mt7623_apmixed_compat, .probe = mt7623_apmixedsys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_apmixedsys_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -869,7 +869,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen) = { .id = UCLASS_CLK, .of_match = mt7623_topckgen_compat, .probe = mt7623_topckgen_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_topckgen_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -879,7 +879,7 @@ U_BOOT_DRIVER(mtk_clk_infracfg) = { .id = UCLASS_CLK, .of_match = mt7623_infracfg_compat, .probe = mt7623_infracfg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -889,7 +889,7 @@ U_BOOT_DRIVER(mtk_clk_pericfg) = { .id = UCLASS_CLK, .of_match = mt7623_pericfg_compat, .probe = mt7623_pericfg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -900,7 +900,7 @@ U_BOOT_DRIVER(mtk_clk_hifsys) = { .of_match = mt7623_hifsys_compat, .probe = mt7623_hifsys_probe, .bind = mt7623_ethsys_hifsys_bind, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; @@ -910,6 +910,6 @@ U_BOOT_DRIVER(mtk_clk_ethsys) = { .of_match = mt7623_ethsys_compat, .probe = mt7623_ethsys_probe, .bind = mt7623_ethsys_hifsys_bind, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; diff --git a/drivers/clk/mediatek/clk-mt7629.c b/drivers/clk/mediatek/clk-mt7629.c index 5b2aa5f..31b6fa0 100644 --- a/drivers/clk/mediatek/clk-mt7629.c +++ b/drivers/clk/mediatek/clk-mt7629.c @@ -704,7 +704,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = { .id = UCLASS_CLK, .of_match = mt7629_apmixed_compat, .probe = mt7629_apmixedsys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_apmixedsys_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -714,7 +714,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen) = { .id = UCLASS_CLK, .of_match = mt7629_topckgen_compat, .probe = mt7629_topckgen_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_topckgen_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -724,7 +724,7 @@ U_BOOT_DRIVER(mtk_clk_infracfg) = { .id = UCLASS_CLK, .of_match = mt7629_infracfg_compat, .probe = mt7629_infracfg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -734,7 +734,7 @@ U_BOOT_DRIVER(mtk_clk_pericfg) = { .id = UCLASS_CLK, .of_match = mt7629_pericfg_compat, .probe = mt7629_pericfg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -745,7 +745,7 @@ U_BOOT_DRIVER(mtk_clk_ethsys) = { .of_match = mt7629_ethsys_compat, .probe = mt7629_ethsys_probe, .bind = mt7629_ethsys_bind, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; @@ -754,7 +754,7 @@ U_BOOT_DRIVER(mtk_clk_sgmiisys) = { .id = UCLASS_CLK, .of_match = mt7629_sgmiisys_compat, .probe = mt7629_sgmiisys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; @@ -763,6 +763,6 @@ U_BOOT_DRIVER(mtk_clk_ssusbsys) = { .id = UCLASS_CLK, .of_match = mt7629_ssusbsys_compat, .probe = mt7629_ssusbsys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, }; diff --git a/drivers/clk/mediatek/clk-mt8512.c b/drivers/clk/mediatek/clk-mt8512.c index ad254d1..193e069 100644 --- a/drivers/clk/mediatek/clk-mt8512.c +++ b/drivers/clk/mediatek/clk-mt8512.c @@ -838,7 +838,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = { .id = UCLASS_CLK, .of_match = mt8512_apmixed_compat, .probe = mt8512_apmixedsys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_apmixedsys_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -848,7 +848,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen) = { .id = UCLASS_CLK, .of_match = mt8512_topckgen_compat, .probe = mt8512_topckgen_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_topckgen_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -858,7 +858,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen_cg) = { .id = UCLASS_CLK, .of_match = mt8512_topckgen_cg_compat, .probe = mt8512_topckgen_cg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -868,7 +868,7 @@ U_BOOT_DRIVER(mtk_clk_infracfg) = { .id = UCLASS_CLK, .of_match = mt8512_infracfg_compat, .probe = mt8512_infracfg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/clk/mediatek/clk-mt8516.c b/drivers/clk/mediatek/clk-mt8516.c index cd1db25..29f7062 100644 --- a/drivers/clk/mediatek/clk-mt8516.c +++ b/drivers/clk/mediatek/clk-mt8516.c @@ -777,7 +777,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = { .id = UCLASS_CLK, .of_match = mt8516_apmixed_compat, .probe = mt8516_apmixedsys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_apmixedsys_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -787,7 +787,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen) = { .id = UCLASS_CLK, .of_match = mt8516_topckgen_compat, .probe = mt8516_topckgen_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_topckgen_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -797,7 +797,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen_cg) = { .id = UCLASS_CLK, .of_match = mt8516_topckgen_cg_compat, .probe = mt8516_topckgen_cg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/clk/mediatek/clk-mt8518.c b/drivers/clk/mediatek/clk-mt8518.c index 985a0c1..2386514 100644 --- a/drivers/clk/mediatek/clk-mt8518.c +++ b/drivers/clk/mediatek/clk-mt8518.c @@ -1533,7 +1533,7 @@ U_BOOT_DRIVER(mtk_clk_apmixedsys) = { .id = UCLASS_CLK, .of_match = mt8518_apmixed_compat, .probe = mt8518_apmixedsys_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_apmixedsys_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -1543,7 +1543,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen) = { .id = UCLASS_CLK, .of_match = mt8518_topckgen_compat, .probe = mt8518_topckgen_probe, - .priv_auto_alloc_size = sizeof(struct mtk_clk_priv), + .priv_auto = sizeof(struct mtk_clk_priv), .ops = &mtk_clk_topckgen_ops, .flags = DM_FLAG_PRE_RELOC, }; @@ -1553,7 +1553,7 @@ U_BOOT_DRIVER(mtk_clk_topckgen_cg) = { .id = UCLASS_CLK, .of_match = mt8518_topckgen_cg_compat, .probe = mt8518_topckgen_cg_probe, - .priv_auto_alloc_size = sizeof(struct mtk_cg_priv), + .priv_auto = sizeof(struct mtk_cg_priv), .ops = &mtk_clk_gate_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index 388471b..d43b8a0 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -296,7 +296,7 @@ static ulong mtk_topckgen_get_factor_rate(struct clk *clk, u32 off) switch (fdiv->flags & CLK_PARENT_MASK) { case CLK_PARENT_APMIXED: rate = mtk_clk_find_parent_rate(clk, fdiv->parent, - DM_GET_DRIVER(mtk_clk_apmixedsys)); + DM_DRIVER_GET(mtk_clk_apmixedsys)); break; case CLK_PARENT_TOPCKGEN: rate = mtk_clk_find_parent_rate(clk, fdiv->parent, NULL); @@ -474,11 +474,11 @@ static ulong mtk_clk_gate_get_rate(struct clk *clk) switch (gate->flags & CLK_PARENT_MASK) { case CLK_PARENT_APMIXED: return mtk_clk_find_parent_rate(clk, gate->parent, - DM_GET_DRIVER(mtk_clk_apmixedsys)); + DM_DRIVER_GET(mtk_clk_apmixedsys)); break; case CLK_PARENT_TOPCKGEN: return mtk_clk_find_parent_rate(clk, gate->parent, - DM_GET_DRIVER(mtk_clk_topckgen)); + DM_DRIVER_GET(mtk_clk_topckgen)); break; default: diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c index 6ef8b41..d6da59d 100644 --- a/drivers/clk/meson/axg.c +++ b/drivers/clk/meson/axg.c @@ -289,7 +289,7 @@ static int meson_clk_probe(struct udevice *dev) { struct meson_clk *priv = dev_get_priv(dev); - priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node); + priv->map = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev))); if (IS_ERR(priv->map)) return PTR_ERR(priv->map); @@ -320,7 +320,7 @@ U_BOOT_DRIVER(meson_clk_axg) = { .name = "meson_clk_axg", .id = UCLASS_CLK, .of_match = meson_clk_ids, - .priv_auto_alloc_size = sizeof(struct meson_clk), + .priv_auto = sizeof(struct meson_clk), .ops = &meson_clk_ops, .probe = meson_clk_probe, }; diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c index bf2f357..5058db1 100644 --- a/drivers/clk/meson/g12a.c +++ b/drivers/clk/meson/g12a.c @@ -979,7 +979,7 @@ static int meson_clk_probe(struct udevice *dev) { struct meson_clk *priv = dev_get_priv(dev); - priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node); + priv->map = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev))); if (IS_ERR(priv->map)) return PTR_ERR(priv->map); @@ -1014,7 +1014,7 @@ U_BOOT_DRIVER(meson_clk_g12a) = { .name = "meson_clk_g12a", .id = UCLASS_CLK, .of_match = meson_clk_ids, - .priv_auto_alloc_size = sizeof(struct meson_clk), + .priv_auto = sizeof(struct meson_clk), .ops = &meson_clk_ops, .probe = meson_clk_probe, }; diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index b9353c0..e379540 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -885,7 +885,7 @@ static int meson_clk_probe(struct udevice *dev) { struct meson_clk *priv = dev_get_priv(dev); - priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node); + priv->map = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev))); if (IS_ERR(priv->map)) return PTR_ERR(priv->map); @@ -919,7 +919,7 @@ U_BOOT_DRIVER(meson_clk) = { .name = "meson_clk", .id = UCLASS_CLK, .of_match = meson_clk_ids, - .priv_auto_alloc_size = sizeof(struct meson_clk), + .priv_auto = sizeof(struct meson_clk), .ops = &meson_clk_ops, .probe = meson_clk_probe, }; diff --git a/drivers/clk/mpc83xx_clk.c b/drivers/clk/mpc83xx_clk.c index 8d96ec7..c5ced1f 100644 --- a/drivers/clk/mpc83xx_clk.c +++ b/drivers/clk/mpc83xx_clk.c @@ -389,7 +389,7 @@ U_BOOT_DRIVER(mpc83xx_clk) = { .of_match = mpc83xx_clk_match, .ops = &mpc83xx_clk_ops, .probe = mpc83xx_clk_probe, - .priv_auto_alloc_size = sizeof(struct mpc83xx_clk_priv), + .priv_auto = sizeof(struct mpc83xx_clk_priv), .bind = mpc83xx_clk_bind, }; diff --git a/drivers/clk/mtmips/clk-mt7628.c b/drivers/clk/mtmips/clk-mt7628.c index 35780de..4d3ac84 100644 --- a/drivers/clk/mtmips/clk-mt7628.c +++ b/drivers/clk/mtmips/clk-mt7628.c @@ -153,6 +153,6 @@ U_BOOT_DRIVER(mt7628_clk) = { .id = UCLASS_CLK, .of_match = mt7628_clk_ids, .probe = mt7628_clk_probe, - .priv_auto_alloc_size = sizeof(struct mt7628_clk_priv), + .priv_auto = sizeof(struct mt7628_clk_priv), .ops = &mt7628_clk_ops, }; diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c index 223da22..0132fcb 100644 --- a/drivers/clk/mvebu/armada-37xx-periph.c +++ b/drivers/clk/mvebu/armada-37xx-periph.c @@ -624,6 +624,6 @@ U_BOOT_DRIVER(armada_37xx_periph_clk) = { .id = UCLASS_CLK, .of_match = armada_37xx_periph_clk_ids, .ops = &armada_37xx_periph_clk_ops, - .priv_auto_alloc_size = sizeof(struct a37xx_periphclk), + .priv_auto = sizeof(struct a37xx_periphclk), .probe = armada_37xx_periph_clk_probe, }; diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c index 233926e..b1c0852 100644 --- a/drivers/clk/mvebu/armada-37xx-tbg.c +++ b/drivers/clk/mvebu/armada-37xx-tbg.c @@ -150,6 +150,6 @@ U_BOOT_DRIVER(armada_37xx_tbg_clk) = { .id = UCLASS_CLK, .of_match = armada_37xx_tbg_clk_ids, .ops = &armada_37xx_tbg_clk_ops, - .priv_auto_alloc_size = sizeof(struct a37xx_tbgclk), + .priv_auto = sizeof(struct a37xx_tbgclk), .probe = armada_37xx_tbg_clk_probe, }; diff --git a/drivers/clk/owl/clk_owl.c b/drivers/clk/owl/clk_owl.c index 1999c87..96ab7fe 100644 --- a/drivers/clk/owl/clk_owl.c +++ b/drivers/clk/owl/clk_owl.c @@ -161,6 +161,6 @@ U_BOOT_DRIVER(clk_owl) = { .id = UCLASS_CLK, .of_match = owl_clk_ids, .ops = &owl_clk_ops, - .priv_auto_alloc_size = sizeof(struct owl_clk_priv), + .priv_auto = sizeof(struct owl_clk_priv), .probe = owl_clk_probe, }; diff --git a/drivers/clk/renesas/r8a774a1-cpg-mssr.c b/drivers/clk/renesas/r8a774a1-cpg-mssr.c index 6997054..1c54eca 100644 --- a/drivers/clk/renesas/r8a774a1-cpg-mssr.c +++ b/drivers/clk/renesas/r8a774a1-cpg-mssr.c @@ -336,7 +336,7 @@ U_BOOT_DRIVER(clk_r8a774a1) = { .name = "clk_r8a774a1", .id = UCLASS_CLK, .of_match = r8a774a1_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a774b1-cpg-mssr.c b/drivers/clk/renesas/r8a774b1-cpg-mssr.c index 7b6947b..03851d0 100644 --- a/drivers/clk/renesas/r8a774b1-cpg-mssr.c +++ b/drivers/clk/renesas/r8a774b1-cpg-mssr.c @@ -329,7 +329,7 @@ U_BOOT_DRIVER(clk_r8a774b1) = { .name = "clk_r8a774b1", .id = UCLASS_CLK, .of_match = r8a774b1_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a774c0-cpg-mssr.c b/drivers/clk/renesas/r8a774c0-cpg-mssr.c index c9f0f72..37a7123 100644 --- a/drivers/clk/renesas/r8a774c0-cpg-mssr.c +++ b/drivers/clk/renesas/r8a774c0-cpg-mssr.c @@ -301,7 +301,7 @@ U_BOOT_DRIVER(clk_r8a774c0) = { .name = "clk_r8a774c0", .id = UCLASS_CLK, .of_match = r8a774c0_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a774e1-cpg-mssr.c b/drivers/clk/renesas/r8a774e1-cpg-mssr.c index 6cce007..c969ec6 100644 --- a/drivers/clk/renesas/r8a774e1-cpg-mssr.c +++ b/drivers/clk/renesas/r8a774e1-cpg-mssr.c @@ -351,7 +351,7 @@ U_BOOT_DRIVER(clk_r8a774e1) = { .name = "clk_r8a774e1", .id = UCLASS_CLK, .of_match = r8a774e1_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a7790-cpg-mssr.c b/drivers/clk/renesas/r8a7790-cpg-mssr.c index 7451f53..09e7dbd 100644 --- a/drivers/clk/renesas/r8a7790-cpg-mssr.c +++ b/drivers/clk/renesas/r8a7790-cpg-mssr.c @@ -283,7 +283,7 @@ U_BOOT_DRIVER(clk_r8a7790) = { .name = "clk_r8a7790", .id = UCLASS_CLK, .of_match = r8a7790_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen2_clk_priv), + .priv_auto = sizeof(struct gen2_clk_priv), .ops = &gen2_clk_ops, .probe = gen2_clk_probe, .remove = gen2_clk_remove, diff --git a/drivers/clk/renesas/r8a7791-cpg-mssr.c b/drivers/clk/renesas/r8a7791-cpg-mssr.c index 25fd489..675ac83 100644 --- a/drivers/clk/renesas/r8a7791-cpg-mssr.c +++ b/drivers/clk/renesas/r8a7791-cpg-mssr.c @@ -289,7 +289,7 @@ U_BOOT_DRIVER(clk_r8a7791) = { .name = "clk_r8a7791", .id = UCLASS_CLK, .of_match = r8a7791_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen2_clk_priv), + .priv_auto = sizeof(struct gen2_clk_priv), .ops = &gen2_clk_ops, .probe = gen2_clk_probe, .remove = gen2_clk_remove, diff --git a/drivers/clk/renesas/r8a7792-cpg-mssr.c b/drivers/clk/renesas/r8a7792-cpg-mssr.c index d47ab99..d2225a3 100644 --- a/drivers/clk/renesas/r8a7792-cpg-mssr.c +++ b/drivers/clk/renesas/r8a7792-cpg-mssr.c @@ -235,7 +235,7 @@ U_BOOT_DRIVER(clk_r8a7792) = { .name = "clk_r8a7792", .id = UCLASS_CLK, .of_match = r8a7792_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen2_clk_priv), + .priv_auto = sizeof(struct gen2_clk_priv), .ops = &gen2_clk_ops, .probe = gen2_clk_probe, .remove = gen2_clk_remove, diff --git a/drivers/clk/renesas/r8a7794-cpg-mssr.c b/drivers/clk/renesas/r8a7794-cpg-mssr.c index 7093e0d..1fcac9b 100644 --- a/drivers/clk/renesas/r8a7794-cpg-mssr.c +++ b/drivers/clk/renesas/r8a7794-cpg-mssr.c @@ -264,7 +264,7 @@ U_BOOT_DRIVER(clk_r8a7794) = { .name = "clk_r8a7794", .id = UCLASS_CLK, .of_match = r8a7794_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen2_clk_priv), + .priv_auto = sizeof(struct gen2_clk_priv), .ops = &gen2_clk_ops, .probe = gen2_clk_probe, .remove = gen2_clk_remove, diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c index dcd96ad..101f658 100644 --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c @@ -373,7 +373,7 @@ U_BOOT_DRIVER(clk_r8a7795) = { .name = "clk_r8a7795", .id = UCLASS_CLK, .of_match = r8a7795_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c index 89dc141..3c17bcb 100644 --- a/drivers/clk/renesas/r8a7796-cpg-mssr.c +++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c @@ -351,7 +351,7 @@ U_BOOT_DRIVER(clk_r8a7796) = { .name = "clk_r8a7796", .id = UCLASS_CLK, .of_match = r8a7796_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a77965-cpg-mssr.c b/drivers/clk/renesas/r8a77965-cpg-mssr.c index 6ed8829..5f37f62 100644 --- a/drivers/clk/renesas/r8a77965-cpg-mssr.c +++ b/drivers/clk/renesas/r8a77965-cpg-mssr.c @@ -349,7 +349,7 @@ U_BOOT_DRIVER(clk_r8a77965) = { .name = "clk_r8a77965", .id = UCLASS_CLK, .of_match = r8a77965_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a77970-cpg-mssr.c b/drivers/clk/renesas/r8a77970-cpg-mssr.c index df07120..bafe4bb 100644 --- a/drivers/clk/renesas/r8a77970-cpg-mssr.c +++ b/drivers/clk/renesas/r8a77970-cpg-mssr.c @@ -226,7 +226,7 @@ U_BOOT_DRIVER(clk_r8a77970) = { .name = "clk_r8a77970", .id = UCLASS_CLK, .of_match = r8a77970_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a77980-cpg-mssr.c b/drivers/clk/renesas/r8a77980-cpg-mssr.c index c8d7a94..a202005 100644 --- a/drivers/clk/renesas/r8a77980-cpg-mssr.c +++ b/drivers/clk/renesas/r8a77980-cpg-mssr.c @@ -249,7 +249,7 @@ U_BOOT_DRIVER(clk_r8a77980) = { .name = "clk_r8a77980", .id = UCLASS_CLK, .of_match = r8a77980_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a77990-cpg-mssr.c b/drivers/clk/renesas/r8a77990-cpg-mssr.c index 357e7b5..5cc9270 100644 --- a/drivers/clk/renesas/r8a77990-cpg-mssr.c +++ b/drivers/clk/renesas/r8a77990-cpg-mssr.c @@ -308,7 +308,7 @@ U_BOOT_DRIVER(clk_r8a77990) = { .name = "clk_r8a77990", .id = UCLASS_CLK, .of_match = r8a77990_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/renesas/r8a77995-cpg-mssr.c b/drivers/clk/renesas/r8a77995-cpg-mssr.c index d62aeba..eef154b 100644 --- a/drivers/clk/renesas/r8a77995-cpg-mssr.c +++ b/drivers/clk/renesas/r8a77995-cpg-mssr.c @@ -247,7 +247,7 @@ U_BOOT_DRIVER(clk_r8a77995) = { .name = "clk_r8a77995", .id = UCLASS_CLK, .of_match = r8a77995_clk_ids, - .priv_auto_alloc_size = sizeof(struct gen3_clk_priv), + .priv_auto = sizeof(struct gen3_clk_priv), .ops = &gen3_clk_ops, .probe = gen3_clk_probe, .remove = gen3_clk_remove, diff --git a/drivers/clk/rockchip/clk_px30.c b/drivers/clk/rockchip/clk_px30.c index 71916db..a2a5939 100644 --- a/drivers/clk/rockchip/clk_px30.c +++ b/drivers/clk/rockchip/clk_px30.c @@ -15,6 +15,7 @@ #include <asm/arch-rockchip/cru_px30.h> #include <asm/arch-rockchip/hardware.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <dt-bindings/clock/px30-cru.h> #include <linux/bitops.h> @@ -1432,7 +1433,7 @@ static int px30_clk_probe(struct udevice *dev) return 0; } -static int px30_clk_ofdata_to_platdata(struct udevice *dev) +static int px30_clk_of_to_plat(struct udevice *dev) { struct px30_clk_priv *priv = dev_get_priv(dev); @@ -1458,7 +1459,7 @@ static int px30_clk_bind(struct udevice *dev) glb_srst_fst); priv->glb_srst_snd_value = offsetof(struct px30_cru, glb_srst_snd); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -1480,8 +1481,8 @@ U_BOOT_DRIVER(rockchip_px30_cru) = { .name = "rockchip_px30_cru", .id = UCLASS_CLK, .of_match = px30_clk_ids, - .priv_auto_alloc_size = sizeof(struct px30_clk_priv), - .ofdata_to_platdata = px30_clk_ofdata_to_platdata, + .priv_auto = sizeof(struct px30_clk_priv), + .of_to_plat = px30_clk_of_to_plat, .ops = &px30_clk_ops, .bind = px30_clk_bind, .probe = px30_clk_probe, @@ -1609,7 +1610,7 @@ static int px30_pmuclk_probe(struct udevice *dev) return 0; } -static int px30_pmuclk_ofdata_to_platdata(struct udevice *dev) +static int px30_pmuclk_of_to_plat(struct udevice *dev) { struct px30_pmuclk_priv *priv = dev_get_priv(dev); @@ -1627,8 +1628,8 @@ U_BOOT_DRIVER(rockchip_px30_pmucru) = { .name = "rockchip_px30_pmucru", .id = UCLASS_CLK, .of_match = px30_pmuclk_ids, - .priv_auto_alloc_size = sizeof(struct px30_pmuclk_priv), - .ofdata_to_platdata = px30_pmuclk_ofdata_to_platdata, + .priv_auto = sizeof(struct px30_pmuclk_priv), + .of_to_plat = px30_pmuclk_of_to_plat, .ops = &px30_pmuclk_ops, .probe = px30_pmuclk_probe, }; diff --git a/drivers/clk/rockchip/clk_rk3036.c b/drivers/clk/rockchip/clk_rk3036.c index 274572f..0268584 100644 --- a/drivers/clk/rockchip/clk_rk3036.c +++ b/drivers/clk/rockchip/clk_rk3036.c @@ -14,6 +14,7 @@ #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3036.h> #include <asm/arch-rockchip/hardware.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <dt-bindings/clock/rk3036-cru.h> #include <linux/delay.h> @@ -318,7 +319,7 @@ static struct clk_ops rk3036_clk_ops = { .set_rate = rk3036_clk_set_rate, }; -static int rk3036_clk_ofdata_to_platdata(struct udevice *dev) +static int rk3036_clk_of_to_plat(struct udevice *dev) { struct rk3036_clk_priv *priv = dev_get_priv(dev); @@ -353,7 +354,7 @@ static int rk3036_clk_bind(struct udevice *dev) cru_glb_srst_fst_value); priv->glb_srst_snd_value = offsetof(struct rk3036_cru, cru_glb_srst_snd_value); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -375,8 +376,8 @@ U_BOOT_DRIVER(rockchip_rk3036_cru) = { .name = "clk_rk3036", .id = UCLASS_CLK, .of_match = rk3036_clk_ids, - .priv_auto_alloc_size = sizeof(struct rk3036_clk_priv), - .ofdata_to_platdata = rk3036_clk_ofdata_to_platdata, + .priv_auto = sizeof(struct rk3036_clk_priv), + .of_to_plat = rk3036_clk_of_to_plat, .ops = &rk3036_clk_ops, .bind = rk3036_clk_bind, .probe = rk3036_clk_probe, diff --git a/drivers/clk/rockchip/clk_rk3128.c b/drivers/clk/rockchip/clk_rk3128.c index 61f823e..d5b2b63 100644 --- a/drivers/clk/rockchip/clk_rk3128.c +++ b/drivers/clk/rockchip/clk_rk3128.c @@ -15,6 +15,7 @@ #include <asm/arch-rockchip/cru_rk3128.h> #include <asm/arch-rockchip/hardware.h> #include <bitfield.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <dt-bindings/clock/rk3128-cru.h> #include <linux/delay.h> @@ -546,7 +547,7 @@ static struct clk_ops rk3128_clk_ops = { .set_rate = rk3128_clk_set_rate, }; -static int rk3128_clk_ofdata_to_platdata(struct udevice *dev) +static int rk3128_clk_of_to_plat(struct udevice *dev) { struct rk3128_clk_priv *priv = dev_get_priv(dev); @@ -581,7 +582,7 @@ static int rk3128_clk_bind(struct udevice *dev) cru_glb_srst_fst_value); priv->glb_srst_snd_value = offsetof(struct rk3128_cru, cru_glb_srst_snd_value); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } return 0; @@ -597,8 +598,8 @@ U_BOOT_DRIVER(rockchip_rk3128_cru) = { .name = "clk_rk3128", .id = UCLASS_CLK, .of_match = rk3128_clk_ids, - .priv_auto_alloc_size = sizeof(struct rk3128_clk_priv), - .ofdata_to_platdata = rk3128_clk_ofdata_to_platdata, + .priv_auto = sizeof(struct rk3128_clk_priv), + .of_to_plat = rk3128_clk_of_to_plat, .ops = &rk3128_clk_ops, .bind = rk3128_clk_bind, .probe = rk3128_clk_probe, diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c index aacc8cf..1b62d8d 100644 --- a/drivers/clk/rockchip/clk_rk3188.c +++ b/drivers/clk/rockchip/clk_rk3188.c @@ -538,7 +538,7 @@ static struct clk_ops rk3188_clk_ops = { .set_rate = rk3188_clk_set_rate, }; -static int rk3188_clk_ofdata_to_platdata(struct udevice *dev) +static int rk3188_clk_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3188_clk_priv *priv = dev_get_priv(dev); @@ -561,7 +561,7 @@ static int rk3188_clk_probe(struct udevice *dev) #ifdef CONFIG_SPL_BUILD #if CONFIG_IS_ENABLED(OF_PLATDATA) - struct rk3188_clk_plat *plat = dev_get_platdata(dev); + struct rk3188_clk_plat *plat = dev_get_plat(dev); priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); #endif @@ -593,7 +593,7 @@ static int rk3188_clk_bind(struct udevice *dev) cru_glb_srst_fst_value); priv->glb_srst_snd_value = offsetof(struct rk3188_cru, cru_glb_srst_snd_value); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -616,10 +616,10 @@ U_BOOT_DRIVER(rockchip_rk3188_cru) = { .name = "rockchip_rk3188_cru", .id = UCLASS_CLK, .of_match = rk3188_clk_ids, - .priv_auto_alloc_size = sizeof(struct rk3188_clk_priv), - .platdata_auto_alloc_size = sizeof(struct rk3188_clk_plat), + .priv_auto = sizeof(struct rk3188_clk_priv), + .plat_auto = sizeof(struct rk3188_clk_plat), .ops = &rk3188_clk_ops, .bind = rk3188_clk_bind, - .ofdata_to_platdata = rk3188_clk_ofdata_to_platdata, + .of_to_plat = rk3188_clk_of_to_plat, .probe = rk3188_clk_probe, }; diff --git a/drivers/clk/rockchip/clk_rk322x.c b/drivers/clk/rockchip/clk_rk322x.c index 054b2fd..dbef606 100644 --- a/drivers/clk/rockchip/clk_rk322x.c +++ b/drivers/clk/rockchip/clk_rk322x.c @@ -14,6 +14,7 @@ #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk322x.h> #include <asm/arch-rockchip/hardware.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <dt-bindings/clock/rk3228-cru.h> #include <linux/bitops.h> @@ -475,7 +476,7 @@ static struct clk_ops rk322x_clk_ops = { .set_parent = rk322x_clk_set_parent, }; -static int rk322x_clk_ofdata_to_platdata(struct udevice *dev) +static int rk322x_clk_of_to_plat(struct udevice *dev) { struct rk322x_clk_priv *priv = dev_get_priv(dev); @@ -510,7 +511,7 @@ static int rk322x_clk_bind(struct udevice *dev) cru_glb_srst_fst_value); priv->glb_srst_snd_value = offsetof(struct rk322x_cru, cru_glb_srst_snd_value); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -532,8 +533,8 @@ U_BOOT_DRIVER(rockchip_rk322x_cru) = { .name = "clk_rk322x", .id = UCLASS_CLK, .of_match = rk322x_clk_ids, - .priv_auto_alloc_size = sizeof(struct rk322x_clk_priv), - .ofdata_to_platdata = rk322x_clk_ofdata_to_platdata, + .priv_auto = sizeof(struct rk322x_clk_priv), + .of_to_plat = rk322x_clk_of_to_plat, .ops = &rk322x_clk_ops, .bind = rk322x_clk_bind, .probe = rk322x_clk_probe, diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c index a1dd642..6226d55 100644 --- a/drivers/clk/rockchip/clk_rk3288.c +++ b/drivers/clk/rockchip/clk_rk3288.c @@ -954,7 +954,7 @@ static struct clk_ops rk3288_clk_ops = { #endif }; -static int rk3288_clk_ofdata_to_platdata(struct udevice *dev) +static int rk3288_clk_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3288_clk_priv *priv = dev_get_priv(dev); @@ -975,7 +975,7 @@ static int rk3288_clk_probe(struct udevice *dev) return PTR_ERR(priv->grf); #ifdef CONFIG_SPL_BUILD #if CONFIG_IS_ENABLED(OF_PLATDATA) - struct rk3288_clk_plat *plat = dev_get_platdata(dev); + struct rk3288_clk_plat *plat = dev_get_plat(dev); priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); #endif @@ -1018,7 +1018,7 @@ static int rk3288_clk_bind(struct udevice *dev) cru_glb_srst_fst_value); priv->glb_srst_snd_value = offsetof(struct rockchip_cru, cru_glb_srst_snd_value); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -1040,10 +1040,10 @@ U_BOOT_DRIVER(rockchip_rk3288_cru) = { .name = "rockchip_rk3288_cru", .id = UCLASS_CLK, .of_match = rk3288_clk_ids, - .priv_auto_alloc_size = sizeof(struct rk3288_clk_priv), - .platdata_auto_alloc_size = sizeof(struct rk3288_clk_plat), + .priv_auto = sizeof(struct rk3288_clk_priv), + .plat_auto = sizeof(struct rk3288_clk_plat), .ops = &rk3288_clk_ops, .bind = rk3288_clk_bind, - .ofdata_to_platdata = rk3288_clk_ofdata_to_platdata, + .of_to_plat = rk3288_clk_of_to_plat, .probe = rk3288_clk_probe, }; diff --git a/drivers/clk/rockchip/clk_rk3308.c b/drivers/clk/rockchip/clk_rk3308.c index d3633b6..a05efcf 100644 --- a/drivers/clk/rockchip/clk_rk3308.c +++ b/drivers/clk/rockchip/clk_rk3308.c @@ -15,6 +15,7 @@ #include <asm/arch/cru_rk3308.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/hardware.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <dt-bindings/clock/rk3308-cru.h> #include <linux/bitops.h> @@ -1019,7 +1020,7 @@ static int rk3308_clk_probe(struct udevice *dev) return ret; } -static int rk3308_clk_ofdata_to_platdata(struct udevice *dev) +static int rk3308_clk_of_to_plat(struct udevice *dev) { struct rk3308_clk_priv *priv = dev_get_priv(dev); @@ -1045,7 +1046,7 @@ static int rk3308_clk_bind(struct udevice *dev) glb_srst_fst); priv->glb_srst_snd_value = offsetof(struct rk3308_cru, glb_srst_snd); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -1067,8 +1068,8 @@ U_BOOT_DRIVER(rockchip_rk3308_cru) = { .name = "rockchip_rk3308_cru", .id = UCLASS_CLK, .of_match = rk3308_clk_ids, - .priv_auto_alloc_size = sizeof(struct rk3308_clk_priv), - .ofdata_to_platdata = rk3308_clk_ofdata_to_platdata, + .priv_auto = sizeof(struct rk3308_clk_priv), + .of_to_plat = rk3308_clk_of_to_plat, .ops = &rk3308_clk_ops, .bind = rk3308_clk_bind, .probe = rk3308_clk_probe, diff --git a/drivers/clk/rockchip/clk_rk3328.c b/drivers/clk/rockchip/clk_rk3328.c index bf4f106..b825ff4 100644 --- a/drivers/clk/rockchip/clk_rk3328.c +++ b/drivers/clk/rockchip/clk_rk3328.c @@ -16,6 +16,7 @@ #include <asm/arch-rockchip/hardware.h> #include <asm/arch-rockchip/grf_rk3328.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <dt-bindings/clock/rk3328-cru.h> #include <linux/bitops.h> @@ -797,7 +798,7 @@ static int rk3328_clk_probe(struct udevice *dev) return 0; } -static int rk3328_clk_ofdata_to_platdata(struct udevice *dev) +static int rk3328_clk_of_to_plat(struct udevice *dev) { struct rk3328_clk_priv *priv = dev_get_priv(dev); @@ -823,7 +824,7 @@ static int rk3328_clk_bind(struct udevice *dev) glb_srst_fst_value); priv->glb_srst_snd_value = offsetof(struct rk3328_cru, glb_srst_snd_value); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -845,8 +846,8 @@ U_BOOT_DRIVER(rockchip_rk3328_cru) = { .name = "rockchip_rk3328_cru", .id = UCLASS_CLK, .of_match = rk3328_clk_ids, - .priv_auto_alloc_size = sizeof(struct rk3328_clk_priv), - .ofdata_to_platdata = rk3328_clk_ofdata_to_platdata, + .priv_auto = sizeof(struct rk3328_clk_priv), + .of_to_plat = rk3328_clk_of_to_plat, .ops = &rk3328_clk_ops, .bind = rk3328_clk_bind, .probe = rk3328_clk_probe, diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index d1804c6..780b49c 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -19,6 +19,7 @@ #include <asm/arch-rockchip/cru_rk3368.h> #include <asm/arch-rockchip/hardware.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <dt-bindings/clock/rk3368-cru.h> #include <linux/delay.h> @@ -582,7 +583,7 @@ static int rk3368_clk_probe(struct udevice *dev) { struct rk3368_clk_priv __maybe_unused *priv = dev_get_priv(dev); #if CONFIG_IS_ENABLED(OF_PLATDATA) - struct rk3368_clk_plat *plat = dev_get_platdata(dev); + struct rk3368_clk_plat *plat = dev_get_plat(dev); priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); #endif @@ -593,7 +594,7 @@ static int rk3368_clk_probe(struct udevice *dev) return 0; } -static int rk3368_clk_ofdata_to_platdata(struct udevice *dev) +static int rk3368_clk_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3368_clk_priv *priv = dev_get_priv(dev); @@ -621,7 +622,7 @@ static int rk3368_clk_bind(struct udevice *dev) glb_srst_fst_val); priv->glb_srst_snd_value = offsetof(struct rk3368_cru, glb_srst_snd_val); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -643,11 +644,11 @@ U_BOOT_DRIVER(rockchip_rk3368_cru) = { .name = "rockchip_rk3368_cru", .id = UCLASS_CLK, .of_match = rk3368_clk_ids, - .priv_auto_alloc_size = sizeof(struct rk3368_clk_priv), + .priv_auto = sizeof(struct rk3368_clk_priv), #if CONFIG_IS_ENABLED(OF_PLATDATA) - .platdata_auto_alloc_size = sizeof(struct rk3368_clk_plat), + .plat_auto = sizeof(struct rk3368_clk_plat), #endif - .ofdata_to_platdata = rk3368_clk_ofdata_to_platdata, + .of_to_plat = rk3368_clk_of_to_plat, .ops = &rk3368_clk_ops, .bind = rk3368_clk_bind, .probe = rk3368_clk_probe, diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index 3fd863e..55ebac7 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -18,6 +18,7 @@ #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru.h> #include <asm/arch-rockchip/hardware.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <dt-bindings/clock/rk3399-cru.h> #include <linux/bitops.h> @@ -1378,7 +1379,7 @@ static int rk3399_clk_probe(struct udevice *dev) bool init_clocks = false; #if CONFIG_IS_ENABLED(OF_PLATDATA) - struct rk3399_clk_plat *plat = dev_get_platdata(dev); + struct rk3399_clk_plat *plat = dev_get_plat(dev); priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); #endif @@ -1398,7 +1399,7 @@ static int rk3399_clk_probe(struct udevice *dev) return 0; } -static int rk3399_clk_ofdata_to_platdata(struct udevice *dev) +static int rk3399_clk_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3399_clk_priv *priv = dev_get_priv(dev); @@ -1425,7 +1426,7 @@ static int rk3399_clk_bind(struct udevice *dev) glb_srst_fst_value); priv->glb_srst_snd_value = offsetof(struct rockchip_cru, glb_srst_snd_value); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -1447,13 +1448,13 @@ U_BOOT_DRIVER(clk_rk3399) = { .name = "rockchip_rk3399_cru", .id = UCLASS_CLK, .of_match = rk3399_clk_ids, - .priv_auto_alloc_size = sizeof(struct rk3399_clk_priv), - .ofdata_to_platdata = rk3399_clk_ofdata_to_platdata, + .priv_auto = sizeof(struct rk3399_clk_priv), + .of_to_plat = rk3399_clk_of_to_plat, .ops = &rk3399_clk_ops, .bind = rk3399_clk_bind, .probe = rk3399_clk_probe, #if CONFIG_IS_ENABLED(OF_PLATDATA) - .platdata_auto_alloc_size = sizeof(struct rk3399_clk_plat), + .plat_auto = sizeof(struct rk3399_clk_plat), #endif }; @@ -1599,7 +1600,7 @@ static int rk3399_pmuclk_probe(struct udevice *dev) #endif #if CONFIG_IS_ENABLED(OF_PLATDATA) - struct rk3399_pmuclk_plat *plat = dev_get_platdata(dev); + struct rk3399_pmuclk_plat *plat = dev_get_plat(dev); priv->pmucru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); #endif @@ -1610,7 +1611,7 @@ static int rk3399_pmuclk_probe(struct udevice *dev) return 0; } -static int rk3399_pmuclk_ofdata_to_platdata(struct udevice *dev) +static int rk3399_pmuclk_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3399_pmuclk_priv *priv = dev_get_priv(dev); @@ -1642,12 +1643,12 @@ U_BOOT_DRIVER(rockchip_rk3399_pmuclk) = { .name = "rockchip_rk3399_pmucru", .id = UCLASS_CLK, .of_match = rk3399_pmuclk_ids, - .priv_auto_alloc_size = sizeof(struct rk3399_pmuclk_priv), - .ofdata_to_platdata = rk3399_pmuclk_ofdata_to_platdata, + .priv_auto = sizeof(struct rk3399_pmuclk_priv), + .of_to_plat = rk3399_pmuclk_of_to_plat, .ops = &rk3399_pmuclk_ops, .probe = rk3399_pmuclk_probe, .bind = rk3399_pmuclk_bind, #if CONFIG_IS_ENABLED(OF_PLATDATA) - .platdata_auto_alloc_size = sizeof(struct rk3399_pmuclk_plat), + .plat_auto = sizeof(struct rk3399_pmuclk_plat), #endif }; diff --git a/drivers/clk/rockchip/clk_rv1108.c b/drivers/clk/rockchip/clk_rv1108.c index aa1d98c..1e22db0 100644 --- a/drivers/clk/rockchip/clk_rv1108.c +++ b/drivers/clk/rockchip/clk_rv1108.c @@ -16,6 +16,7 @@ #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rv1108.h> #include <asm/arch-rockchip/hardware.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <dt-bindings/clock/rv1108-cru.h> #include <linux/delay.h> @@ -662,7 +663,7 @@ static void rkclk_init(struct rv1108_cru *cru) aclk_bus, aclk_peri, hclk_peri, pclk_peri); } -static int rv1108_clk_ofdata_to_platdata(struct udevice *dev) +static int rv1108_clk_of_to_plat(struct udevice *dev) { struct rv1108_clk_priv *priv = dev_get_priv(dev); @@ -697,7 +698,7 @@ static int rv1108_clk_bind(struct udevice *dev) glb_srst_fst_val); priv->glb_srst_snd_value = offsetof(struct rv1108_cru, glb_srst_snd_val); - sys_child->priv = priv; + dev_set_priv(sys_child, priv); } #if CONFIG_IS_ENABLED(RESET_ROCKCHIP) @@ -719,9 +720,9 @@ U_BOOT_DRIVER(clk_rv1108) = { .name = "clk_rv1108", .id = UCLASS_CLK, .of_match = rv1108_clk_ids, - .priv_auto_alloc_size = sizeof(struct rv1108_clk_priv), + .priv_auto = sizeof(struct rv1108_clk_priv), .ops = &rv1108_clk_ops, .bind = rv1108_clk_bind, - .ofdata_to_platdata = rv1108_clk_ofdata_to_platdata, + .of_to_plat = rv1108_clk_of_to_plat, .probe = rv1108_clk_probe, }; diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c index 1b4d81d..b3882d0 100644 --- a/drivers/clk/sifive/fu540-prci.c +++ b/drivers/clk/sifive/fu540-prci.c @@ -537,7 +537,7 @@ static int __prci_consumer_reset(const char *rst_name, bool trigger) int ret; ret = uclass_get_device_by_driver(UCLASS_RESET, - DM_GET_DRIVER(sifive_reset), + DM_DRIVER_GET(sifive_reset), &dev); if (ret) { dev_err(dev, "Reset driver not found: %d\n", ret); @@ -807,6 +807,6 @@ U_BOOT_DRIVER(sifive_fu540_prci) = { .of_match = sifive_fu540_prci_ids, .probe = sifive_fu540_prci_probe, .ops = &sifive_fu540_prci_ops, - .priv_auto_alloc_size = sizeof(struct __prci_data), + .priv_auto = sizeof(struct __prci_data), .bind = sifive_fu540_clk_bind, }; diff --git a/drivers/clk/sunxi/clk_a10.c b/drivers/clk/sunxi/clk_a10.c index 67507c5..1b5de86 100644 --- a/drivers/clk/sunxi/clk_a10.c +++ b/drivers/clk/sunxi/clk_a10.c @@ -79,7 +79,7 @@ U_BOOT_DRIVER(clk_sun4i_a10) = { .name = "sun4i_a10_ccu", .id = UCLASS_CLK, .of_match = a10_ccu_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = a10_clk_bind, diff --git a/drivers/clk/sunxi/clk_a10s.c b/drivers/clk/sunxi/clk_a10s.c index d11a4b5..184f61a 100644 --- a/drivers/clk/sunxi/clk_a10s.c +++ b/drivers/clk/sunxi/clk_a10s.c @@ -66,7 +66,7 @@ U_BOOT_DRIVER(clk_sun5i_a10s) = { .name = "sun5i_a10s_ccu", .id = UCLASS_CLK, .of_match = a10s_ccu_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = a10s_clk_bind, diff --git a/drivers/clk/sunxi/clk_a23.c b/drivers/clk/sunxi/clk_a23.c index 4d562bf..5750514 100644 --- a/drivers/clk/sunxi/clk_a23.c +++ b/drivers/clk/sunxi/clk_a23.c @@ -82,7 +82,7 @@ U_BOOT_DRIVER(clk_sun8i_a23) = { .name = "sun8i_a23_ccu", .id = UCLASS_CLK, .of_match = a23_clk_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = a23_clk_bind, diff --git a/drivers/clk/sunxi/clk_a31.c b/drivers/clk/sunxi/clk_a31.c index 4a9454e..9226112 100644 --- a/drivers/clk/sunxi/clk_a31.c +++ b/drivers/clk/sunxi/clk_a31.c @@ -99,7 +99,7 @@ U_BOOT_DRIVER(clk_sun6i_a31) = { .name = "sun6i_a31_ccu", .id = UCLASS_CLK, .of_match = a31_clk_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = a31_clk_bind, diff --git a/drivers/clk/sunxi/clk_a64.c b/drivers/clk/sunxi/clk_a64.c index d96cb1a..0553ffa 100644 --- a/drivers/clk/sunxi/clk_a64.c +++ b/drivers/clk/sunxi/clk_a64.c @@ -87,7 +87,7 @@ U_BOOT_DRIVER(clk_sun50i_a64) = { .name = "sun50i_a64_ccu", .id = UCLASS_CLK, .of_match = a64_ccu_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = a64_clk_bind, diff --git a/drivers/clk/sunxi/clk_a80.c b/drivers/clk/sunxi/clk_a80.c index 80d7407..68973d5 100644 --- a/drivers/clk/sunxi/clk_a80.c +++ b/drivers/clk/sunxi/clk_a80.c @@ -94,7 +94,7 @@ U_BOOT_DRIVER(clk_sun9i_a80) = { .name = "sun9i_a80_ccu", .id = UCLASS_CLK, .of_match = a80_ccu_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = a80_clk_bind, diff --git a/drivers/clk/sunxi/clk_a83t.c b/drivers/clk/sunxi/clk_a83t.c index d6f23dd..880c7d7 100644 --- a/drivers/clk/sunxi/clk_a83t.c +++ b/drivers/clk/sunxi/clk_a83t.c @@ -84,7 +84,7 @@ U_BOOT_DRIVER(clk_sun8i_a83t) = { .name = "sun8i_a83t_ccu", .id = UCLASS_CLK, .of_match = a83t_clk_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = a83t_clk_bind, diff --git a/drivers/clk/sunxi/clk_h3.c b/drivers/clk/sunxi/clk_h3.c index 7e844f4..f81633b 100644 --- a/drivers/clk/sunxi/clk_h3.c +++ b/drivers/clk/sunxi/clk_h3.c @@ -102,7 +102,7 @@ U_BOOT_DRIVER(clk_sun8i_h3) = { .name = "sun8i_h3_ccu", .id = UCLASS_CLK, .of_match = h3_ccu_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = h3_clk_bind, diff --git a/drivers/clk/sunxi/clk_h6.c b/drivers/clk/sunxi/clk_h6.c index a1cb895..ac8656f 100644 --- a/drivers/clk/sunxi/clk_h6.c +++ b/drivers/clk/sunxi/clk_h6.c @@ -95,7 +95,7 @@ U_BOOT_DRIVER(clk_sun50i_h6) = { .name = "sun50i_h6_ccu", .id = UCLASS_CLK, .of_match = h6_ccu_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = h6_clk_bind, diff --git a/drivers/clk/sunxi/clk_r40.c b/drivers/clk/sunxi/clk_r40.c index ac360b2..ee1e86d 100644 --- a/drivers/clk/sunxi/clk_r40.c +++ b/drivers/clk/sunxi/clk_r40.c @@ -107,7 +107,7 @@ U_BOOT_DRIVER(clk_sun8i_r40) = { .name = "sun8i_r40_ccu", .id = UCLASS_CLK, .of_match = r40_clk_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = r40_clk_bind, diff --git a/drivers/clk/sunxi/clk_v3s.c b/drivers/clk/sunxi/clk_v3s.c index f3fc06a..2962219 100644 --- a/drivers/clk/sunxi/clk_v3s.c +++ b/drivers/clk/sunxi/clk_v3s.c @@ -65,7 +65,7 @@ U_BOOT_DRIVER(clk_sun8i_v3s) = { .name = "sun8i_v3s_ccu", .id = UCLASS_CLK, .of_match = v3s_clk_ids, - .priv_auto_alloc_size = sizeof(struct ccu_priv), + .priv_auto = sizeof(struct ccu_priv), .ops = &sunxi_clk_ops, .probe = sunxi_clk_probe, .bind = v3s_clk_bind, diff --git a/drivers/clk/uniphier/clk-uniphier-core.c b/drivers/clk/uniphier/clk-uniphier-core.c index 4e25db3..c31e596 100644 --- a/drivers/clk/uniphier/clk-uniphier-core.c +++ b/drivers/clk/uniphier/clk-uniphier-core.c @@ -342,6 +342,6 @@ U_BOOT_DRIVER(uniphier_clk) = { .id = UCLASS_CLK, .of_match = uniphier_clk_match, .probe = uniphier_clk_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_clk_priv), + .priv_auto = sizeof(struct uniphier_clk_priv), .ops = &uniphier_clk_ops, }; diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index ffae6f9..65a503e 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -113,6 +113,22 @@ config SPL_DM_SEQ_ALIAS numbered devices (e.g. serial0 = &serial0). This feature can be disabled if it is not required, to save code space in SPL. +config SPL_DM_INLINE_OFNODE + bool "Inline some ofnode functions which are seldom used in SPL" + depends on SPL_DM + default y + help + This applies to several ofnode functions (see ofnode.h) which are + seldom used. Inlining them can help reduce code size. + +config TPL_DM_INLINE_OFNODE + bool "Inline some ofnode functions which are seldom used in TPL" + depends on TPL_DM + default y + help + This applies to several ofnode functions (see ofnode.h) which are + seldom used. Inlining them can help reduce code size. + config REGMAP bool "Support register maps" depends on DM diff --git a/drivers/core/acpi.c b/drivers/core/acpi.c index 63a791f..0901b92 100644 --- a/drivers/core/acpi.c +++ b/drivers/core/acpi.c @@ -269,7 +269,7 @@ int acpi_recurse_method(struct acpi_ctx *ctx, struct udevice *parent, void *start = ctx->current; log_debug("- method %d, %s %p\n", method, parent->name, func); - ret = device_ofdata_to_platdata(parent); + ret = device_of_to_plat(parent); if (ret) return log_msg_ret("ofdata", ret); ret = func(parent, ctx); diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 0924a57..7e8f3af 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -69,10 +69,10 @@ int device_unbind(struct udevice *dev) if (!dev) return log_msg_ret("dev", -EINVAL); - if (dev->flags & DM_FLAG_ACTIVATED) + if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) return log_msg_ret("active", -EINVAL); - if (!(dev->flags & DM_FLAG_BOUND)) + if (!(dev_get_flags(dev) & DM_FLAG_BOUND)) return log_msg_ret("not-bound", -EINVAL); drv = dev->driver; @@ -88,17 +88,17 @@ int device_unbind(struct udevice *dev) if (ret) return log_msg_ret("child unbind", ret); - if (dev->flags & DM_FLAG_ALLOC_PDATA) { - free(dev->platdata); - dev->platdata = NULL; + if (dev_get_flags(dev) & DM_FLAG_ALLOC_PDATA) { + free(dev_get_plat(dev)); + dev_set_plat(dev, NULL); } - if (dev->flags & DM_FLAG_ALLOC_UCLASS_PDATA) { - free(dev->uclass_platdata); - dev->uclass_platdata = NULL; + if (dev_get_flags(dev) & DM_FLAG_ALLOC_UCLASS_PDATA) { + free(dev_get_uclass_plat(dev)); + dev_set_uclass_plat(dev, NULL); } - if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) { - free(dev->parent_platdata); - dev->parent_platdata = NULL; + if (dev_get_flags(dev) & DM_FLAG_ALLOC_PARENT_PDATA) { + free(dev_get_parent_plat(dev)); + dev_set_parent_plat(dev, NULL); } ret = uclass_unbind_device(dev); if (ret) @@ -109,7 +109,7 @@ int device_unbind(struct udevice *dev) devres_release_all(dev); - if (dev->flags & DM_FLAG_NAME_ALLOCED) + if (dev_get_flags(dev) & DM_FLAG_NAME_ALLOCED) free((char *)dev->name); free(dev); @@ -124,27 +124,27 @@ void device_free(struct udevice *dev) { int size; - if (dev->driver->priv_auto_alloc_size) { - free(dev->priv); - dev->priv = NULL; + if (dev->driver->priv_auto) { + free(dev_get_priv(dev)); + dev_set_priv(dev, NULL); } - size = dev->uclass->uc_drv->per_device_auto_alloc_size; + size = dev->uclass->uc_drv->per_device_auto; if (size) { - free(dev->uclass_priv); - dev->uclass_priv = NULL; + free(dev_get_uclass_priv(dev)); + dev_set_uclass_priv(dev, NULL); } if (dev->parent) { - size = dev->parent->driver->per_child_auto_alloc_size; + size = dev->parent->driver->per_child_auto; if (!size) { size = dev->parent->uclass->uc_drv-> - per_child_auto_alloc_size; + per_child_auto; } if (size) { - free(dev->parent_priv); - dev->parent_priv = NULL; + free(dev_get_parent_priv(dev)); + dev_set_parent_priv(dev, NULL); } } - dev->flags &= ~DM_FLAG_PLATDATA_VALID; + dev_bic_flags(dev, DM_FLAG_PLATDATA_VALID); devres_release_probe(dev); } @@ -166,7 +166,7 @@ int device_remove(struct udevice *dev, uint flags) if (!dev) return -EINVAL; - if (!(dev->flags & DM_FLAG_ACTIVATED)) + if (!(dev_get_flags(dev) & DM_FLAG_ACTIVATED)) return 0; drv = dev->driver; @@ -207,8 +207,7 @@ int device_remove(struct udevice *dev, uint flags) if (flags_remove(flags, drv->flags)) { device_free(dev); - dev->seq = -1; - dev->flags &= ~DM_FLAG_ACTIVATED; + dev_bic_flags(dev, DM_FLAG_ACTIVATED); } return ret; diff --git a/drivers/core/device.c b/drivers/core/device.c index 4b3dcb3..aeab383 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -34,13 +34,15 @@ DECLARE_GLOBAL_DATA_PTR; static int device_bind_common(struct udevice *parent, const struct driver *drv, - const char *name, void *platdata, + const char *name, void *plat, ulong driver_data, ofnode node, - uint of_platdata_size, struct udevice **devp) + uint of_plat_size, struct udevice **devp) { struct udevice *dev; struct uclass *uc; int size, ret = 0; + bool auto_seq = true; + void *ptr; if (devp) *devp = NULL; @@ -63,88 +65,79 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, #ifdef CONFIG_DEVRES INIT_LIST_HEAD(&dev->devres_head); #endif - dev->platdata = platdata; + dev_set_plat(dev, plat); dev->driver_data = driver_data; dev->name = name; - dev->node = node; + dev_set_ofnode(dev, node); dev->parent = parent; dev->driver = drv; dev->uclass = uc; - dev->seq = -1; - dev->req_seq = -1; + dev->seq_ = -1; if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) && (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) { /* * Some devices, such as a SPI bus, I2C bus and serial ports * are numbered using aliases. - * - * This is just a 'requested' sequence, and will be - * resolved (and ->seq updated) when the device is probed. */ if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { - if (uc->uc_drv->name && ofnode_valid(node)) - dev_read_alias_seq(dev, &dev->req_seq); -#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE) - if (dev->req_seq == -1) - dev->req_seq = - uclass_find_next_free_req_seq(drv->id); -#endif - } else { - dev->req_seq = uclass_find_next_free_req_seq(drv->id); + if (uc->uc_drv->name && ofnode_valid(node)) { + if (!dev_read_alias_seq(dev, &dev->seq_)) + auto_seq = false; + } } } + if (auto_seq && !(uc->uc_drv->flags & DM_UC_FLAG_NO_AUTO_SEQ)) + dev->seq_ = uclass_find_next_free_seq(uc); - if (drv->platdata_auto_alloc_size) { - bool alloc = !platdata; + if (drv->plat_auto) { + bool alloc = !plat; if (CONFIG_IS_ENABLED(OF_PLATDATA)) { - if (of_platdata_size) { - dev->flags |= DM_FLAG_OF_PLATDATA; - if (of_platdata_size < - drv->platdata_auto_alloc_size) + if (of_plat_size) { + dev_or_flags(dev, DM_FLAG_OF_PLATDATA); + if (of_plat_size < drv->plat_auto) alloc = true; } } if (alloc) { - dev->flags |= DM_FLAG_ALLOC_PDATA; - dev->platdata = calloc(1, - drv->platdata_auto_alloc_size); - if (!dev->platdata) { + dev_or_flags(dev, DM_FLAG_ALLOC_PDATA); + ptr = calloc(1, drv->plat_auto); + if (!ptr) { ret = -ENOMEM; goto fail_alloc1; } - if (CONFIG_IS_ENABLED(OF_PLATDATA) && platdata) { - memcpy(dev->platdata, platdata, - of_platdata_size); - } + if (CONFIG_IS_ENABLED(OF_PLATDATA) && plat) + memcpy(ptr, plat, of_plat_size); + dev_set_plat(dev, ptr); } } - size = uc->uc_drv->per_device_platdata_auto_alloc_size; + size = uc->uc_drv->per_device_plat_auto; if (size) { - dev->flags |= DM_FLAG_ALLOC_UCLASS_PDATA; - dev->uclass_platdata = calloc(1, size); - if (!dev->uclass_platdata) { + dev_or_flags(dev, DM_FLAG_ALLOC_UCLASS_PDATA); + ptr = calloc(1, size); + if (!ptr) { ret = -ENOMEM; goto fail_alloc2; } + dev_set_uclass_plat(dev, ptr); } if (parent) { - size = parent->driver->per_child_platdata_auto_alloc_size; + size = parent->driver->per_child_plat_auto; if (!size) { - size = parent->uclass->uc_drv-> - per_child_platdata_auto_alloc_size; + size = parent->uclass->uc_drv->per_child_plat_auto; } if (size) { - dev->flags |= DM_FLAG_ALLOC_PARENT_PDATA; - dev->parent_platdata = calloc(1, size); - if (!dev->parent_platdata) { + dev_or_flags(dev, DM_FLAG_ALLOC_PARENT_PDATA); + ptr = calloc(1, size); + if (!ptr) { ret = -ENOMEM; goto fail_alloc3; } + dev_set_parent_plat(dev, ptr); } /* put dev into parent's successor list */ list_add_tail(&dev->sibling_node, &parent->child_head); @@ -176,7 +169,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, if (devp) *devp = dev; - dev->flags |= DM_FLAG_BOUND; + dev_or_flags(dev, DM_FLAG_BOUND); return 0; @@ -200,20 +193,20 @@ fail_bind: fail_uclass_bind: if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) { list_del(&dev->sibling_node); - if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) { - free(dev->parent_platdata); - dev->parent_platdata = NULL; + if (dev_get_flags(dev) & DM_FLAG_ALLOC_PARENT_PDATA) { + free(dev_get_parent_plat(dev)); + dev_set_parent_plat(dev, NULL); } } fail_alloc3: - if (dev->flags & DM_FLAG_ALLOC_UCLASS_PDATA) { - free(dev->uclass_platdata); - dev->uclass_platdata = NULL; + if (dev_get_flags(dev) & DM_FLAG_ALLOC_UCLASS_PDATA) { + free(dev_get_uclass_plat(dev)); + dev_set_uclass_plat(dev, NULL); } fail_alloc2: - if (dev->flags & DM_FLAG_ALLOC_PDATA) { - free(dev->platdata); - dev->platdata = NULL; + if (dev_get_flags(dev) & DM_FLAG_ALLOC_PDATA) { + free(dev_get_plat(dev)); + dev_set_plat(dev, NULL); } fail_alloc1: devres_release_all(dev); @@ -233,18 +226,10 @@ int device_bind_with_driver_data(struct udevice *parent, } int device_bind(struct udevice *parent, const struct driver *drv, - const char *name, void *platdata, int of_offset, + const char *name, void *plat, ofnode node, struct udevice **devp) { - return device_bind_common(parent, drv, name, platdata, 0, - offset_to_ofnode(of_offset), 0, devp); -} - -int device_bind_ofnode(struct udevice *parent, const struct driver *drv, - const char *name, void *platdata, ofnode node, - struct udevice **devp) -{ - return device_bind_common(parent, drv, name, platdata, 0, node, 0, + return device_bind_common(parent, drv, name, plat, 0, node, 0, devp); } @@ -252,7 +237,7 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only, const struct driver_info *info, struct udevice **devp) { struct driver *drv; - uint platdata_size = 0; + uint plat_size = 0; int ret; drv = lists_driver_lookup_name(info->name); @@ -262,11 +247,10 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only, return -EPERM; #if CONFIG_IS_ENABLED(OF_PLATDATA) - platdata_size = info->platdata_size; + plat_size = info->plat_size; #endif - ret = device_bind_common(parent, drv, info->name, - (void *)info->platdata, 0, ofnode_null(), - platdata_size, devp); + ret = device_bind_common(parent, drv, info->name, (void *)info->plat, 0, + ofnode_null(), plat_size, devp); if (ret) return ret; @@ -339,21 +323,68 @@ static void *alloc_priv(int size, uint flags) return priv; } -int device_ofdata_to_platdata(struct udevice *dev) +/** + * device_alloc_priv() - Allocate priv/plat data required by the device + * + * @dev: Device to process + * @return 0 if OK, -ENOMEM if out of memory + */ +static int device_alloc_priv(struct udevice *dev) +{ + const struct driver *drv; + void *ptr; + int size; + + drv = dev->driver; + assert(drv); + + /* Allocate private data if requested and not reentered */ + if (drv->priv_auto && !dev_get_priv(dev)) { + ptr = alloc_priv(drv->priv_auto, drv->flags); + if (!ptr) + return -ENOMEM; + dev_set_priv(dev, ptr); + } + + /* Allocate private data if requested and not reentered */ + size = dev->uclass->uc_drv->per_device_auto; + if (size && !dev_get_uclass_priv(dev)) { + ptr = alloc_priv(size, dev->uclass->uc_drv->flags); + if (!ptr) + return -ENOMEM; + dev_set_uclass_priv(dev, ptr); + } + + /* Allocate parent data for this child */ + if (dev->parent) { + size = dev->parent->driver->per_child_auto; + if (!size) + size = dev->parent->uclass->uc_drv->per_child_auto; + if (size && !dev_get_parent_priv(dev)) { + ptr = alloc_priv(size, drv->flags); + if (!ptr) + return -ENOMEM; + dev_set_parent_priv(dev, ptr); + } + } + + return 0; +} + +int device_of_to_plat(struct udevice *dev) { const struct driver *drv; - int size = 0; int ret; if (!dev) return -EINVAL; - if (dev->flags & DM_FLAG_PLATDATA_VALID) + if (dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID) return 0; /* Ensure all parents have ofdata */ if (dev->parent) { - ret = device_ofdata_to_platdata(dev->parent); + ret = device_of_to_plat(dev->parent); if (ret) goto fail; @@ -363,56 +394,25 @@ int device_ofdata_to_platdata(struct udevice *dev) * (e.g. PCI bridge devices). Test the flags again * so that we don't mess up the device. */ - if (dev->flags & DM_FLAG_PLATDATA_VALID) + if (dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID) return 0; } + ret = device_alloc_priv(dev); + if (ret) + goto fail; + drv = dev->driver; assert(drv); - /* Allocate private data if requested and not reentered */ - if (drv->priv_auto_alloc_size && !dev->priv) { - dev->priv = alloc_priv(drv->priv_auto_alloc_size, drv->flags); - if (!dev->priv) { - ret = -ENOMEM; - goto fail; - } - } - /* Allocate private data if requested and not reentered */ - size = dev->uclass->uc_drv->per_device_auto_alloc_size; - if (size && !dev->uclass_priv) { - dev->uclass_priv = alloc_priv(size, - dev->uclass->uc_drv->flags); - if (!dev->uclass_priv) { - ret = -ENOMEM; - goto fail; - } - } - - /* Allocate parent data for this child */ - if (dev->parent) { - size = dev->parent->driver->per_child_auto_alloc_size; - if (!size) { - size = dev->parent->uclass->uc_drv-> - per_child_auto_alloc_size; - } - if (size && !dev->parent_priv) { - dev->parent_priv = alloc_priv(size, drv->flags); - if (!dev->parent_priv) { - ret = -ENOMEM; - goto fail; - } - } - } - - if (drv->ofdata_to_platdata && - (CONFIG_IS_ENABLED(OF_PLATDATA) || dev_has_of_node(dev))) { - ret = drv->ofdata_to_platdata(dev); + if (drv->of_to_plat && + (CONFIG_IS_ENABLED(OF_PLATDATA) || dev_has_ofnode(dev))) { + ret = drv->of_to_plat(dev); if (ret) goto fail; } - dev->flags |= DM_FLAG_PLATDATA_VALID; + dev_or_flags(dev, DM_FLAG_PLATDATA_VALID); return 0; fail: @@ -425,18 +425,17 @@ int device_probe(struct udevice *dev) { const struct driver *drv; int ret; - int seq; if (!dev) return -EINVAL; - if (dev->flags & DM_FLAG_ACTIVATED) + if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) return 0; drv = dev->driver; assert(drv); - ret = device_ofdata_to_platdata(dev); + ret = device_of_to_plat(dev); if (ret) goto fail; @@ -452,18 +451,11 @@ int device_probe(struct udevice *dev) * (e.g. PCI bridge devices). Test the flags again * so that we don't mess up the device. */ - if (dev->flags & DM_FLAG_ACTIVATED) + if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) return 0; } - seq = uclass_resolve_seq(dev); - if (seq < 0) { - ret = seq; - goto fail; - } - dev->seq = seq; - - dev->flags |= DM_FLAG_ACTIVATED; + dev_or_flags(dev, DM_FLAG_ACTIVATED); /* * Process pinctrl for everything except the root device, and @@ -493,7 +485,7 @@ int device_probe(struct udevice *dev) } /* Only handle devices that have a valid ofnode */ - if (dev_of_valid(dev)) { + if (dev_has_ofnode(dev)) { /* * Process 'assigned-{clocks/clock-parents/clock-rates}' * properties @@ -523,42 +515,41 @@ fail_uclass: __func__, dev->name); } fail: - dev->flags &= ~DM_FLAG_ACTIVATED; + dev_bic_flags(dev, DM_FLAG_ACTIVATED); - dev->seq = -1; device_free(dev); return ret; } -void *dev_get_platdata(const struct udevice *dev) +void *dev_get_plat(const struct udevice *dev) { if (!dev) { dm_warn("%s: null device\n", __func__); return NULL; } - return dev->platdata; + return dev->plat_; } -void *dev_get_parent_platdata(const struct udevice *dev) +void *dev_get_parent_plat(const struct udevice *dev) { if (!dev) { dm_warn("%s: null device\n", __func__); return NULL; } - return dev->parent_platdata; + return dev->parent_plat_; } -void *dev_get_uclass_platdata(const struct udevice *dev) +void *dev_get_uclass_plat(const struct udevice *dev) { if (!dev) { dm_warn("%s: null device\n", __func__); return NULL; } - return dev->uclass_platdata; + return dev->uclass_plat_; } void *dev_get_priv(const struct udevice *dev) @@ -568,7 +559,7 @@ void *dev_get_priv(const struct udevice *dev) return NULL; } - return dev->priv; + return dev->priv_; } void *dev_get_uclass_priv(const struct udevice *dev) @@ -578,7 +569,7 @@ void *dev_get_uclass_priv(const struct udevice *dev) return NULL; } - return dev->uclass_priv; + return dev->uclass_priv_; } void *dev_get_parent_priv(const struct udevice *dev) @@ -588,7 +579,7 @@ void *dev_get_parent_priv(const struct udevice *dev) return NULL; } - return dev->parent_priv; + return dev->parent_priv_; } static int device_get_device_tail(struct udevice *dev, int ret, @@ -622,7 +613,7 @@ static int device_find_by_ofnode(ofnode node, struct udevice **devp) struct udevice *dev; int ret; - list_for_each_entry(uc, &gd->uclass_root, sibling_node) { + list_for_each_entry(uc, gd->uclass_root, sibling_node) { ret = uclass_find_device_by_ofnode(uc->uc_drv->id, node, &dev); if (!ret || dev) { @@ -659,18 +650,15 @@ int device_get_child_count(const struct udevice *parent) return count; } -int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq, - bool find_req_seq, struct udevice **devp) +int device_find_child_by_seq(const struct udevice *parent, int seq, + struct udevice **devp) { struct udevice *dev; *devp = NULL; - if (seq_or_req_seq == -1) - return -ENODEV; list_for_each_entry(dev, &parent->child_head, sibling_node) { - if ((find_req_seq ? dev->req_seq : dev->seq) == - seq_or_req_seq) { + if (dev->seq_ == seq) { *devp = dev; return 0; } @@ -686,14 +674,8 @@ int device_get_child_by_seq(const struct udevice *parent, int seq, int ret; *devp = NULL; - ret = device_find_child_by_seq(parent, seq, false, &dev); - if (ret == -ENODEV) { - /* - * We didn't find it in probed devices. See if there is one - * that will request this seq if probed. - */ - ret = device_find_child_by_seq(parent, seq, true, &dev); - } + ret = device_find_child_by_seq(parent, seq, &dev); + return device_get_device_tail(dev, ret, devp); } @@ -895,7 +877,7 @@ int device_first_child_ofdata_err(struct udevice *parent, struct udevice **devp) if (!dev) return -ENODEV; - ret = device_ofdata_to_platdata(dev); + ret = device_of_to_plat(dev); if (ret) return ret; @@ -913,7 +895,7 @@ int device_next_child_ofdata_err(struct udevice **devp) if (!dev) return -ENODEV; - ret = device_ofdata_to_platdata(dev); + ret = device_of_to_plat(dev); if (ret) return ret; @@ -983,7 +965,7 @@ bool device_is_last_sibling(const struct udevice *dev) void device_set_name_alloced(struct udevice *dev) { - dev->flags |= DM_FLAG_NAME_ALLOCED; + dev_or_flags(dev, DM_FLAG_NAME_ALLOCED); } int device_set_name(struct udevice *dev, const char *name) @@ -997,6 +979,36 @@ int device_set_name(struct udevice *dev, const char *name) return 0; } +void dev_set_priv(struct udevice *dev, void *priv) +{ + dev->priv_ = priv; +} + +void dev_set_parent_priv(struct udevice *dev, void *parent_priv) +{ + dev->parent_priv_ = parent_priv; +} + +void dev_set_uclass_priv(struct udevice *dev, void *uclass_priv) +{ + dev->uclass_priv_ = uclass_priv; +} + +void dev_set_plat(struct udevice *dev, void *plat) +{ + dev->plat_ = plat; +} + +void dev_set_parent_plat(struct udevice *dev, void *parent_plat) +{ + dev->parent_plat_ = parent_plat; +} + +void dev_set_uclass_plat(struct udevice *dev, void *uclass_plat) +{ + dev->uclass_plat_ = uclass_plat; +} + #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) bool device_is_compatible(const struct udevice *dev, const char *compat) { @@ -1020,7 +1032,7 @@ int dev_disable_by_path(const char *path) if (!of_live_active()) return -ENOSYS; - list_for_each_entry(uc, &gd->uclass_root, sibling_node) { + list_for_each_entry(uc, gd->uclass_root, sibling_node) { ret = uclass_find_device_by_ofnode(uc->uc_drv->id, node, &dev); if (!ret) break; diff --git a/drivers/core/devres.c b/drivers/core/devres.c index 8824469..313ddc7 100644 --- a/drivers/core/devres.c +++ b/drivers/core/devres.c @@ -23,7 +23,7 @@ /** enum devres_phase - Shows where resource was allocated * * DEVRES_PHASE_BIND: In the bind() method - * DEVRES_PHASE_OFDATA: In the ofdata_to_platdata() method + * DEVRES_PHASE_OFDATA: In the of_to_plat() method * DEVRES_PHASE_PROBE: In the probe() method */ enum devres_phase { @@ -107,9 +107,9 @@ void devres_add(struct udevice *dev, void *res) devres_log(dev, dr, "ADD"); assert_noisy(list_empty(&dr->entry)); - if (dev->flags & DM_FLAG_PLATDATA_VALID) + if (dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID) dr->phase = DEVRES_PHASE_PROBE; - else if (dev->flags & DM_FLAG_BOUND) + else if (dev_get_flags(dev) & DM_FLAG_BOUND) dr->phase = DEVRES_PHASE_OFDATA; else dr->phase = DEVRES_PHASE_BIND; diff --git a/drivers/core/dump.c b/drivers/core/dump.c index 6debaf9..f8afea3 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -14,11 +14,13 @@ static void show_devices(struct udevice *dev, int depth, int last_flag) { int i, is_last; struct udevice *child; + u32 flags = dev_get_flags(dev); /* print the first 20 characters to not break the tree-format. */ - printf(" %-10.10s %3d [ %c ] %-20.20s ", dev->uclass->uc_drv->name, + printf(IS_ENABLED(CONFIG_SPL_BUILD) ? " %s %d [ %c ] %s " : + " %-10.10s %3d [ %c ] %-20.20s ", dev->uclass->uc_drv->name, dev_get_uclass_index(dev, NULL), - dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name); + flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name); for (i = depth; i >= 0; i--) { is_last = (last_flag >> i) & 1; @@ -65,10 +67,10 @@ void dm_dump_all(void) static void dm_display_line(struct udevice *dev, int index) { printf("%-3i %c %s @ %08lx", index, - dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ', + dev_get_flags(dev) & DM_FLAG_ACTIVATED ? '*' : ' ', dev->name, (ulong)map_to_sysmem(dev)); - if (dev->seq != -1 || dev->req_seq != -1) - printf(", seq %d, (req %d)", dev->seq, dev->req_seq); + if (dev->seq_ != -1) + printf(", seq %d", dev_seq(dev)); puts("\n"); } @@ -170,6 +172,6 @@ void dm_dump_static_driver_info(void) puts("---------------------------------\n"); for (entry = drv; entry != drv + n_ents; entry++) { printf("%-25.25s @%08lx\n", entry->name, - (ulong)map_to_sysmem(entry->platdata)); + (ulong)map_to_sysmem(entry->plat)); } } diff --git a/drivers/core/lists.c b/drivers/core/lists.c index b23ee30..e214306 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -39,8 +39,8 @@ struct driver *lists_driver_lookup_name(const char *name) struct uclass_driver *lists_uclass_lookup(enum uclass_id id) { struct uclass_driver *uclass = - ll_entry_start(struct uclass_driver, uclass); - const int n_ents = ll_entry_count(struct uclass_driver, uclass); + ll_entry_start(struct uclass_driver, uclass_driver); + const int n_ents = ll_entry_count(struct uclass_driver, uclass_driver); struct uclass_driver *entry; for (entry = uclass; entry != uclass + n_ents; entry++) { @@ -251,7 +251,7 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp, if (ret) { dm_warn("Error binding driver '%s': %d\n", entry->name, ret); - return ret; + return log_msg_ret("bind", ret); } else { found = true; if (devp) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index a68076b..2a6e43d 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -226,6 +226,17 @@ int ofnode_read_u32_array(ofnode node, const char *propname, } } +#if !CONFIG_IS_ENABLED(DM_INLINE_OFNODE) +bool ofnode_is_enabled(ofnode node) +{ + if (ofnode_is_np(node)) { + return of_device_is_available(ofnode_to_np(node)); + } else { + return fdtdec_get_is_enabled(gd->fdt_blob, + ofnode_to_offset(node)); + } +} + ofnode ofnode_first_subnode(ofnode node) { assert(ofnode_valid(node)); @@ -245,6 +256,7 @@ ofnode ofnode_next_subnode(ofnode node) return offset_to_ofnode( fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node))); } +#endif /* !DM_INLINE_OFNODE */ ofnode ofnode_get_parent(ofnode node) { diff --git a/drivers/core/read.c b/drivers/core/read.c index 0761258..fc74d64 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -281,8 +281,10 @@ int dev_read_alias_seq(const struct udevice *dev, int *devnump) if (ofnode_is_np(node)) { ret = of_alias_get_id(ofnode_to_np(node), uc_name); - if (ret >= 0) + if (ret >= 0) { *devnump = ret; + ret = 0; + } } else { #if CONFIG_IS_ENABLED(OF_CONTROL) ret = fdtdec_get_alias_seq(gd->fdt_blob, uc_name, diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c index c2bed88..4baacab 100644 --- a/drivers/core/regmap.c +++ b/drivers/core/regmap.c @@ -60,8 +60,8 @@ static struct regmap *regmap_alloc(int count) } #if CONFIG_IS_ENABLED(OF_PLATDATA) -int regmap_init_mem_platdata(struct udevice *dev, fdt_val_t *reg, int count, - struct regmap **mapp) +int regmap_init_mem_plat(struct udevice *dev, fdt_val_t *reg, int count, + struct regmap **mapp) { struct regmap_range *range; struct regmap *map; diff --git a/drivers/core/root.c b/drivers/core/root.c index 5f10d7a..78de7cd 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -45,8 +45,8 @@ void dm_fixup_for_gd_move(struct global_data *new_gd) { /* The sentinel node has moved, so update things that point to it */ if (gd->dm_root) { - new_gd->uclass_root.next->prev = &new_gd->uclass_root; - new_gd->uclass_root.prev->next = &new_gd->uclass_root; + new_gd->uclass_root->next->prev = new_gd->uclass_root; + new_gd->uclass_root->prev->next = new_gd->uclass_root; } } @@ -69,8 +69,8 @@ void fix_drivers(void) entry->remove += gd->reloc_off; if (entry->unbind) entry->unbind += gd->reloc_off; - if (entry->ofdata_to_platdata) - entry->ofdata_to_platdata += gd->reloc_off; + if (entry->of_to_plat) + entry->of_to_plat += gd->reloc_off; if (entry->child_post_bind) entry->child_post_bind += gd->reloc_off; if (entry->child_pre_probe) @@ -86,8 +86,8 @@ void fix_drivers(void) void fix_uclass(void) { struct uclass_driver *uclass = - ll_entry_start(struct uclass_driver, uclass); - const int n_ents = ll_entry_count(struct uclass_driver, uclass); + ll_entry_start(struct uclass_driver, uclass_driver); + const int n_ents = ll_entry_count(struct uclass_driver, uclass_driver); struct uclass_driver *entry; for (entry = uclass; entry != uclass + n_ents; entry++) { @@ -123,8 +123,8 @@ void fix_devices(void) struct driver_info *entry; for (entry = dev; entry != dev + n_ents; entry++) { - if (entry->platdata) - entry->platdata += gd->reloc_off; + if (entry->plat) + entry->plat += gd->reloc_off; } } @@ -136,7 +136,8 @@ int dm_init(bool of_live) dm_warn("Virtual root driver already exists!\n"); return -EINVAL; } - INIT_LIST_HEAD(&DM_UCLASS_ROOT_NON_CONST); + gd->uclass_root = &DM_UCLASS_ROOT_S_NON_CONST; + INIT_LIST_HEAD(DM_UCLASS_ROOT_NON_CONST); if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) { fix_drivers(); @@ -147,12 +148,8 @@ int dm_init(bool of_live) ret = device_bind_by_name(NULL, false, &root_info, &DM_ROOT_NON_CONST); if (ret) return ret; -#if CONFIG_IS_ENABLED(OF_CONTROL) - if (CONFIG_IS_ENABLED(OF_LIVE) && of_live) - DM_ROOT_NON_CONST->node = np_to_ofnode(gd_of_root()); - else - DM_ROOT_NON_CONST->node = offset_to_ofnode(0); -#endif + if (CONFIG_IS_ENABLED(OF_CONTROL)) + dev_set_ofnode(DM_ROOT_NON_CONST, ofnode_root()); ret = device_probe(DM_ROOT_NON_CONST); if (ret) return ret; @@ -178,7 +175,7 @@ int dm_remove_devices_flags(uint flags) } #endif -int dm_scan_platdata(bool pre_reloc_only) +int dm_scan_plat(bool pre_reloc_only) { int ret; @@ -203,33 +200,6 @@ int dm_scan_platdata(bool pre_reloc_only) } #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -static int dm_scan_fdt_live(struct udevice *parent, - const struct device_node *node_parent, - bool pre_reloc_only) -{ - struct device_node *np; - int ret = 0, err; - - for (np = node_parent->child; np; np = np->sibling) { - - if (!of_device_is_available(np)) { - pr_debug(" - ignoring disabled device\n"); - continue; - } - err = lists_bind_fdt(parent, np_to_ofnode(np), NULL, - pre_reloc_only); - if (err && !ret) { - ret = err; - debug("%s: ret=%d\n", np->name, ret); - } - } - - if (ret) - dm_warn("Some drivers failed to bind\n"); - - return ret; -} - /** * dm_scan_fdt_node() - Scan the device tree and bind drivers for a node * @@ -237,28 +207,30 @@ static int dm_scan_fdt_live(struct udevice *parent, * for each one. * * @parent: Parent device for the devices that will be created - * @blob: Pointer to device tree blob - * @offset: Offset of node to scan + * @node: Node to scan * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC * flag. If false bind all drivers. * @return 0 if OK, -ve on error */ -static int dm_scan_fdt_node(struct udevice *parent, const void *blob, - int offset, bool pre_reloc_only) +static int dm_scan_fdt_node(struct udevice *parent, ofnode parent_node, + bool pre_reloc_only) { int ret = 0, err; + ofnode node; - for (offset = fdt_first_subnode(blob, offset); - offset > 0; - offset = fdt_next_subnode(blob, offset)) { - const char *node_name = fdt_get_name(blob, offset, NULL); + if (!ofnode_valid(parent_node)) + return 0; + + for (node = ofnode_first_subnode(parent_node); + ofnode_valid(node); + node = ofnode_next_subnode(node)) { + const char *node_name = ofnode_get_name(node); - if (!fdtdec_get_is_enabled(blob, offset)) { + if (!ofnode_is_enabled(node)) { pr_debug(" - ignoring disabled device\n"); continue; } - err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL, - pre_reloc_only); + err = lists_bind_fdt(parent, node, NULL, pre_reloc_only); if (err && !ret) { ret = err; debug("%s: ret=%d\n", node_name, ret); @@ -273,43 +245,25 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob, int dm_scan_fdt_dev(struct udevice *dev) { - if (!dev_of_valid(dev)) - return 0; - - if (of_live_active()) - return dm_scan_fdt_live(dev, dev_np(dev), - gd->flags & GD_FLG_RELOC ? false : true); - - return dm_scan_fdt_node(dev, gd->fdt_blob, dev_of_offset(dev), + return dm_scan_fdt_node(dev, dev_ofnode(dev), gd->flags & GD_FLG_RELOC ? false : true); } -int dm_scan_fdt(const void *blob, bool pre_reloc_only) +int dm_scan_fdt(bool pre_reloc_only) { - if (of_live_active()) - return dm_scan_fdt_live(gd->dm_root, gd_of_root(), - pre_reloc_only); - - return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only); + return dm_scan_fdt_node(gd->dm_root, ofnode_root(), pre_reloc_only); } -static int dm_scan_fdt_ofnode_path(const void *blob, const char *path, - bool pre_reloc_only) +static int dm_scan_fdt_ofnode_path(const char *path, bool pre_reloc_only) { ofnode node; node = ofnode_path(path); - if (!ofnode_valid(node)) - return 0; - - if (of_live_active()) - return dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only); - return dm_scan_fdt_node(gd->dm_root, blob, node.of_offset, - pre_reloc_only); + return dm_scan_fdt_node(gd->dm_root, node, pre_reloc_only); } -int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only) +int dm_extended_scan(bool pre_reloc_only) { int ret, i; const char * const nodes[] = { @@ -318,7 +272,7 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only) "/firmware" }; - ret = dm_scan_fdt(blob, pre_reloc_only); + ret = dm_scan_fdt(pre_reloc_only); if (ret) { debug("dm_scan_fdt() failed: %d\n", ret); return ret; @@ -326,7 +280,7 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only) /* Some nodes aren't devices themselves but may contain some */ for (i = 0; i < ARRAY_SIZE(nodes); i++) { - ret = dm_scan_fdt_ofnode_path(blob, nodes[i], pre_reloc_only); + ret = dm_scan_fdt_ofnode_path(nodes[i], pre_reloc_only); if (ret) { debug("dm_scan_fdt() scan for %s failed: %d\n", nodes[i], ret); @@ -343,28 +297,30 @@ __weak int dm_scan_other(bool pre_reloc_only) return 0; } -int dm_init_and_scan(bool pre_reloc_only) +/** + * dm_scan() - Scan tables to bind devices + * + * Runs through the driver_info tables and binds the devices it finds. Then runs + * through the devicetree nodes. Finally calls dm_scan_other() to add any + * special devices + * + * @pre_reloc_only: If true, bind only nodes with special devicetree properties, + * or drivers with the DM_FLAG_PRE_RELOC flag. If false bind all drivers. + */ +static int dm_scan(bool pre_reloc_only) { int ret; - if (CONFIG_IS_ENABLED(OF_PLATDATA)) - dm_populate_phandle_data(); - - ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE)); + ret = dm_scan_plat(pre_reloc_only); if (ret) { - debug("dm_init() failed: %d\n", ret); - return ret; - } - ret = dm_scan_platdata(pre_reloc_only); - if (ret) { - debug("dm_scan_platdata() failed: %d\n", ret); + debug("dm_scan_plat() failed: %d\n", ret); return ret; } if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { - ret = dm_extended_scan_fdt(gd->fdt_blob, pre_reloc_only); + ret = dm_extended_scan(pre_reloc_only); if (ret) { - debug("dm_extended_scan_dt() failed: %d\n", ret); + debug("dm_extended_scan() failed: %d\n", ret); return ret; } } @@ -376,6 +332,24 @@ int dm_init_and_scan(bool pre_reloc_only) return 0; } +int dm_init_and_scan(bool pre_reloc_only) +{ + int ret; + + ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE)); + if (ret) { + debug("dm_init() failed: %d\n", ret); + return ret; + } + ret = dm_scan(pre_reloc_only); + if (ret) { + log_debug("dm_scan() failed: %d\n", ret); + return ret; + } + + return 0; +} + #ifdef CONFIG_ACPIGEN static int root_acpi_get_name(const struct udevice *dev, char *out_name) { diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c index 7cc1d46..b0c2c20 100644 --- a/drivers/core/simple-bus.c +++ b/drivers/core/simple-bus.c @@ -5,16 +5,11 @@ #include <common.h> #include <dm.h> - -struct simple_bus_plat { - u32 base; - u32 size; - u32 target; -}; +#include <dm/simple_bus.h> fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr) { - struct simple_bus_plat *plat = dev_get_uclass_platdata(dev); + struct simple_bus_plat *plat = dev_get_uclass_plat(dev); if (addr >= plat->base && addr < plat->base + plat->size) addr = (addr - plat->base) + plat->target; @@ -32,7 +27,7 @@ static int simple_bus_post_bind(struct udevice *dev) ret = dev_read_u32_array(dev, "ranges", cell, ARRAY_SIZE(cell)); if (!ret) { - struct simple_bus_plat *plat = dev_get_uclass_platdata(dev); + struct simple_bus_plat *plat = dev_get_uclass_plat(dev); plat->base = cell[0]; plat->target = cell[1]; @@ -47,18 +42,20 @@ UCLASS_DRIVER(simple_bus) = { .id = UCLASS_SIMPLE_BUS, .name = "simple_bus", .post_bind = simple_bus_post_bind, - .per_device_platdata_auto_alloc_size = sizeof(struct simple_bus_plat), + .per_device_plat_auto = sizeof(struct simple_bus_plat), }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id generic_simple_bus_ids[] = { { .compatible = "simple-bus" }, { .compatible = "simple-mfd" }, { } }; +#endif U_BOOT_DRIVER(simple_bus) = { .name = "simple_bus", .id = UCLASS_SIMPLE_BUS, - .of_match = generic_simple_bus_ids, + .of_match = of_match_ptr(generic_simple_bus_ids), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/core/simple-pm-bus.c b/drivers/core/simple-pm-bus.c index 51dc9b2..7a18953 100644 --- a/drivers/core/simple-pm-bus.c +++ b/drivers/core/simple-pm-bus.c @@ -51,6 +51,6 @@ U_BOOT_DRIVER(simple_pm_bus_drv) = { .of_match = simple_pm_bus_ids, .probe = simple_pm_bus_probe, .remove = simple_pm_bus_remove, - .priv_auto_alloc_size = sizeof(struct clk_bulk), + .priv_auto = sizeof(struct clk_bulk), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c index 567d0a4..cb33fac 100644 --- a/drivers/core/syscon-uclass.c +++ b/drivers/core/syscon-uclass.c @@ -56,9 +56,9 @@ static int syscon_pre_probe(struct udevice *dev) * using OF_PLATDATA will need to ensure that this is true. */ #if CONFIG_IS_ENABLED(OF_PLATDATA) - struct syscon_base_platdata *plat = dev_get_platdata(dev); + struct syscon_base_plat *plat = dev_get_plat(dev); - return regmap_init_mem_platdata(dev, plat->reg, ARRAY_SIZE(plat->reg), + return regmap_init_mem_plat(dev, plat->reg, ARRAY_SIZE(plat->reg), &priv->regmap); #else return regmap_init_mem(dev_ofnode(dev), &priv->regmap); @@ -174,7 +174,7 @@ void *syscon_get_first_range(ulong driver_data) UCLASS_DRIVER(syscon) = { .id = UCLASS_SYSCON, .name = "syscon", - .per_device_auto_alloc_size = sizeof(struct syscon_uc_info), + .per_device_auto = sizeof(struct syscon_uc_info), .pre_probe = syscon_pre_probe, }; diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index c3f1b73..cdb975d 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -33,7 +33,7 @@ struct uclass *uclass_find(enum uclass_id key) * node to the start of the list, or creating a linear array mapping * id to node. */ - list_for_each_entry(uc, &gd->uclass_root, sibling_node) { + list_for_each_entry(uc, gd->uclass_root, sibling_node) { if (uc->uc_drv->id == key) return uc; } @@ -71,17 +71,20 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp) uc = calloc(1, sizeof(*uc)); if (!uc) return -ENOMEM; - if (uc_drv->priv_auto_alloc_size) { - uc->priv = calloc(1, uc_drv->priv_auto_alloc_size); - if (!uc->priv) { + if (uc_drv->priv_auto) { + void *ptr; + + ptr = calloc(1, uc_drv->priv_auto); + if (!ptr) { ret = -ENOMEM; goto fail_mem; } + uclass_set_priv(uc, ptr); } uc->uc_drv = uc_drv; INIT_LIST_HEAD(&uc->sibling_node); INIT_LIST_HEAD(&uc->dev_head); - list_add(&uc->sibling_node, &DM_UCLASS_ROOT_NON_CONST); + list_add(&uc->sibling_node, DM_UCLASS_ROOT_NON_CONST); if (uc_drv->init) { ret = uc_drv->init(uc); @@ -93,9 +96,9 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp) return 0; fail: - if (uc_drv->priv_auto_alloc_size) { - free(uc->priv); - uc->priv = NULL; + if (uc_drv->priv_auto) { + free(uclass_get_priv(uc)); + uclass_set_priv(uc, NULL); } list_del(&uc->sibling_node); fail_mem: @@ -131,8 +134,8 @@ int uclass_destroy(struct uclass *uc) if (uc_drv->destroy) uc_drv->destroy(uc); list_del(&uc->sibling_node); - if (uc_drv->priv_auto_alloc_size) - free(uc->priv); + if (uc_drv->priv_auto) + free(uclass_get_priv(uc)); free(uc); return 0; @@ -160,6 +163,16 @@ const char *uclass_get_name(enum uclass_id id) return uc->uc_drv->name; } +void *uclass_get_priv(const struct uclass *uc) +{ + return uc->priv_; +} + +void uclass_set_priv(struct uclass *uc, void *priv) +{ + uc->priv_ = priv; +} + enum uclass_id uclass_get_by_name(const char *name) { int i; @@ -272,48 +285,46 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name, return -ENODEV; } -int uclass_find_next_free_req_seq(enum uclass_id id) +int uclass_find_next_free_seq(struct uclass *uc) { - struct uclass *uc; struct udevice *dev; - int ret; int max = -1; - ret = uclass_get(id, &uc); - if (ret) - return ret; + /* If using aliases, start with the highest alias value */ + if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) && + (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) + max = dev_read_alias_highest_id(uc->uc_drv->name); + /* Avoid conflict with existing devices */ list_for_each_entry(dev, &uc->dev_head, uclass_node) { - if ((dev->req_seq != -1) && (dev->req_seq > max)) - max = dev->req_seq; + if (dev->seq_ > max) + max = dev->seq_; } - - if (max == -1) - return 0; + /* + * At this point, max will be -1 if there are no existing aliases or + * devices + */ return max + 1; } -int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq, - bool find_req_seq, struct udevice **devp) +int uclass_find_device_by_seq(enum uclass_id id, int seq, struct udevice **devp) { struct uclass *uc; struct udevice *dev; int ret; *devp = NULL; - log_debug("%d %d\n", find_req_seq, seq_or_req_seq); - if (seq_or_req_seq == -1) + log_debug("%d\n", seq); + if (seq == -1) return -ENODEV; ret = uclass_get(id, &uc); if (ret) return ret; uclass_foreach_dev(dev, uc) { - log_debug(" - %d %d '%s'\n", - dev->req_seq, dev->seq, dev->name); - if ((find_req_seq ? dev->req_seq : dev->seq) == - seq_or_req_seq) { + log_debug(" - %d '%s'\n", dev->seq_, dev->name); + if (dev->seq_ == seq) { *devp = dev; log_debug(" - found\n"); return 0; @@ -473,14 +484,8 @@ int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice **devp) int ret; *devp = NULL; - ret = uclass_find_device_by_seq(id, seq, false, &dev); - if (ret == -ENODEV) { - /* - * We didn't find it in probed devices. See if there is one - * that will request this seq if probed. - */ - ret = uclass_find_device_by_seq(id, seq, true, &dev); - } + ret = uclass_find_device_by_seq(id, seq, &dev); + return uclass_get_device_tail(dev, ret, devp); } @@ -687,46 +692,6 @@ int uclass_unbind_device(struct udevice *dev) } #endif -int uclass_resolve_seq(struct udevice *dev) -{ - struct uclass *uc = dev->uclass; - struct uclass_driver *uc_drv = uc->uc_drv; - struct udevice *dup; - int seq = 0; - int ret; - - assert(dev->seq == -1); - ret = uclass_find_device_by_seq(uc_drv->id, dev->req_seq, false, &dup); - if (!ret) { - dm_warn("Device '%s': seq %d is in use by '%s'\n", - dev->name, dev->req_seq, dup->name); - } else if (ret == -ENODEV) { - /* Our requested sequence number is available */ - if (dev->req_seq != -1) - return dev->req_seq; - } else { - return ret; - } - - if (CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(DM_SEQ_ALIAS) && - (uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) { - /* - * dev_read_alias_highest_id() will return -1 if there no - * alias. Thus we can always add one. - */ - seq = dev_read_alias_highest_id(uc_drv->name) + 1; - } - - for (; seq < DM_MAX_SEQ; seq++) { - ret = uclass_find_device_by_seq(uc_drv->id, seq, false, &dup); - if (ret == -ENODEV) - break; - if (ret) - return ret; - } - return seq; -} - int uclass_pre_probe_device(struct udevice *dev) { struct uclass_driver *uc_drv; diff --git a/drivers/cpu/at91_cpu.c b/drivers/cpu/at91_cpu.c index 058ae3a..9ef1b31 100644 --- a/drivers/cpu/at91_cpu.c +++ b/drivers/cpu/at91_cpu.c @@ -11,7 +11,7 @@ #include <div64.h> #include <linux/clk-provider.h> -struct at91_cpu_platdata { +struct at91_cpu_plat { const char *name; ulong cpufreq_mhz; ulong mckfreq_mhz; @@ -27,7 +27,7 @@ const char *at91_cpu_get_name(void) int at91_cpu_get_desc(const struct udevice *dev, char *buf, int size) { - struct at91_cpu_platdata *plat = dev_get_platdata(dev); + struct at91_cpu_plat *plat = dev_get_plat(dev); snprintf(buf, size, "%s\n" "Crystal frequency: %8lu MHz\n" @@ -41,7 +41,7 @@ int at91_cpu_get_desc(const struct udevice *dev, char *buf, int size) static int at91_cpu_get_info(const struct udevice *dev, struct cpu_info *info) { - struct at91_cpu_platdata *plat = dev_get_platdata(dev); + struct at91_cpu_plat *plat = dev_get_plat(dev); info->cpu_freq = plat->cpufreq_mhz * 1000000; info->features = BIT(CPU_FEAT_L1_CACHE); @@ -75,7 +75,7 @@ static const struct udevice_id at91_cpu_ids[] = { static int at91_cpu_probe(struct udevice *dev) { - struct at91_cpu_platdata *plat = dev_get_platdata(dev); + struct at91_cpu_plat *plat = dev_get_plat(dev); struct clk clk; ulong rate; int ret; @@ -118,6 +118,6 @@ U_BOOT_DRIVER(cpu_at91_drv) = { .of_match = at91_cpu_ids, .ops = &at91_cpu_ops, .probe = at91_cpu_probe, - .platdata_auto_alloc_size = sizeof(struct at91_cpu_platdata), + .plat_auto = sizeof(struct at91_cpu_plat), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/cpu/bmips_cpu.c b/drivers/cpu/bmips_cpu.c index 421cc7a..172bc99 100644 --- a/drivers/cpu/bmips_cpu.c +++ b/drivers/cpu/bmips_cpu.c @@ -425,7 +425,7 @@ static const struct cpu_ops bmips_cpu_ops = { /* BMIPS CPU driver */ int bmips_cpu_bind(struct udevice *dev) { - struct cpu_platdata *plat = dev_get_parent_platdata(dev); + struct cpu_plat *plat = dev_get_parent_plat(dev); plat->cpu_id = dev_read_u32_default(dev, "reg", -1); plat->device_id = read_c0_prid(); @@ -489,7 +489,7 @@ U_BOOT_DRIVER(bmips_cpu_drv) = { .of_match = bmips_cpu_ids, .bind = bmips_cpu_bind, .probe = bmips_cpu_probe, - .priv_auto_alloc_size = sizeof(struct bmips_cpu_priv), + .priv_auto = sizeof(struct bmips_cpu_priv), .ops = &bmips_cpu_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c index 37e3cf2..1c338ba 100644 --- a/drivers/cpu/cpu-uclass.c +++ b/drivers/cpu/cpu-uclass.c @@ -115,7 +115,7 @@ int cpu_get_vendor(const struct udevice *dev, char *buf, int size) U_BOOT_DRIVER(cpu_bus) = { .name = "cpu_bus", .id = UCLASS_SIMPLE_BUS, - .per_child_platdata_auto_alloc_size = sizeof(struct cpu_platdata), + .per_child_plat_auto = sizeof(struct cpu_plat), }; static int uclass_cpu_init(struct uclass *uc) diff --git a/drivers/cpu/cpu_sandbox.c b/drivers/cpu/cpu_sandbox.c index 4ba0d1b..fe6772b 100644 --- a/drivers/cpu/cpu_sandbox.c +++ b/drivers/cpu/cpu_sandbox.c @@ -64,7 +64,7 @@ static const struct cpu_ops cpu_sandbox_ops = { static int cpu_sandbox_bind(struct udevice *dev) { int ret; - struct cpu_platdata *plat = dev_get_parent_platdata(dev); + struct cpu_plat *plat = dev_get_parent_plat(dev); /* first examine the property in current cpu node */ ret = dev_read_u32(dev, "timebase-frequency", &plat->timebase_freq); diff --git a/drivers/cpu/imx8_cpu.c b/drivers/cpu/imx8_cpu.c index 502c8eb..1d1e49e 100644 --- a/drivers/cpu/imx8_cpu.c +++ b/drivers/cpu/imx8_cpu.c @@ -16,7 +16,7 @@ DECLARE_GLOBAL_DATA_PTR; -struct cpu_imx_platdata { +struct cpu_imx_plat { const char *name; const char *rev; const char *type; @@ -55,7 +55,7 @@ const char *get_imx8_rev(u32 rev) static void set_core_data(struct udevice *dev) { - struct cpu_imx_platdata *plat = dev_get_platdata(dev); + struct cpu_imx_plat *plat = dev_get_plat(dev); if (device_is_compatible(dev, "arm,cortex-a35")) { plat->cpu_rsrc = SC_R_A35; @@ -73,7 +73,7 @@ static void set_core_data(struct udevice *dev) } #if IS_ENABLED(CONFIG_IMX_SCU_THERMAL) -static int cpu_imx_get_temp(struct cpu_imx_platdata *plat) +static int cpu_imx_get_temp(struct cpu_imx_plat *plat) { struct udevice *thermal_dev; int cpu_tmp, ret; @@ -94,7 +94,7 @@ static int cpu_imx_get_temp(struct cpu_imx_platdata *plat) return cpu_tmp; } #else -static int cpu_imx_get_temp(struct cpu_imx_platdata *plat) +static int cpu_imx_get_temp(struct cpu_imx_plat *plat) { return 0; } @@ -102,7 +102,7 @@ static int cpu_imx_get_temp(struct cpu_imx_platdata *plat) int cpu_imx_get_desc(const struct udevice *dev, char *buf, int size) { - struct cpu_imx_platdata *plat = dev_get_platdata(dev); + struct cpu_imx_plat *plat = dev_get_plat(dev); int ret, temp; if (size < 100) @@ -128,7 +128,7 @@ int cpu_imx_get_desc(const struct udevice *dev, char *buf, int size) static int cpu_imx_get_info(const struct udevice *dev, struct cpu_info *info) { - struct cpu_imx_platdata *plat = dev_get_platdata(dev); + struct cpu_imx_plat *plat = dev_get_plat(dev); info->cpu_freq = plat->freq_mhz * 1000; info->features = BIT(CPU_FEAT_L1_CACHE) | BIT(CPU_FEAT_MMU); @@ -165,7 +165,7 @@ static int cpu_imx_get_vendor(const struct udevice *dev, char *buf, int size) static int cpu_imx_is_current(struct udevice *dev) { - struct cpu_imx_platdata *plat = dev_get_platdata(dev); + struct cpu_imx_plat *plat = dev_get_plat(dev); if (plat->mpidr == (read_mpidr() & 0xffff)) return 1; @@ -190,7 +190,7 @@ static const struct udevice_id cpu_imx8_ids[] = { static ulong imx8_get_cpu_rate(struct udevice *dev) { - struct cpu_imx_platdata *plat = dev_get_platdata(dev); + struct cpu_imx_plat *plat = dev_get_plat(dev); ulong rate; int ret; @@ -206,7 +206,7 @@ static ulong imx8_get_cpu_rate(struct udevice *dev) static int imx8_cpu_probe(struct udevice *dev) { - struct cpu_imx_platdata *plat = dev_get_platdata(dev); + struct cpu_imx_plat *plat = dev_get_plat(dev); u32 cpurev; set_core_data(dev); @@ -230,6 +230,6 @@ U_BOOT_DRIVER(cpu_imx8_drv) = { .of_match = cpu_imx8_ids, .ops = &cpu_imx8_ops, .probe = imx8_cpu_probe, - .platdata_auto_alloc_size = sizeof(struct cpu_imx_platdata), + .plat_auto = sizeof(struct cpu_imx_plat), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/cpu/mpc83xx_cpu.c b/drivers/cpu/mpc83xx_cpu.c index 5f1592f..e451c11 100644 --- a/drivers/cpu/mpc83xx_cpu.c +++ b/drivers/cpu/mpc83xx_cpu.c @@ -348,7 +348,7 @@ U_BOOT_DRIVER(mpc83xx_cpu) = { .id = UCLASS_CPU, .of_match = mpc83xx_cpu_ids, .probe = mpc83xx_cpu_probe, - .priv_auto_alloc_size = sizeof(struct mpc83xx_cpu_priv), + .priv_auto = sizeof(struct mpc83xx_cpu_priv), .ops = &mpc83xx_cpu_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c index 93ce708..0b10c17 100644 --- a/drivers/cpu/riscv_cpu.c +++ b/drivers/cpu/riscv_cpu.c @@ -91,7 +91,7 @@ static int riscv_cpu_get_count(const struct udevice *dev) static int riscv_cpu_bind(struct udevice *dev) { - struct cpu_platdata *plat = dev_get_parent_platdata(dev); + struct cpu_plat *plat = dev_get_parent_plat(dev); struct driver *drv; int ret; diff --git a/drivers/crypto/fsl/fsl_rsa.c b/drivers/crypto/fsl/fsl_rsa.c index ed2a54f..897ee85 100644 --- a/drivers/crypto/fsl/fsl_rsa.c +++ b/drivers/crypto/fsl/fsl_rsa.c @@ -55,6 +55,6 @@ U_BOOT_DRIVER(fsl_rsa_mod_exp) = { .ops = &fsl_mod_exp_ops, }; -U_BOOT_DEVICE(fsl_rsa) = { +U_BOOT_DRVINFO(fsl_rsa) = { .name = "fsl_rsa_mod_exp", }; diff --git a/drivers/crypto/fsl/rng.c b/drivers/crypto/fsl/rng.c index 3c0c2b0..0636494 100644 --- a/drivers/crypto/fsl/rng.c +++ b/drivers/crypto/fsl/rng.c @@ -83,6 +83,6 @@ U_BOOT_DRIVER(caam_rng) = { .id = UCLASS_RNG, .ops = &caam_rng_ops, .probe = caam_rng_probe, - .priv_auto_alloc_size = sizeof(struct caam_rng_priv), + .priv_auto = sizeof(struct caam_rng_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/crypto/rsa_mod_exp/mod_exp_sw.c b/drivers/crypto/rsa_mod_exp/mod_exp_sw.c index 4ce85b3..7bed444 100644 --- a/drivers/crypto/rsa_mod_exp/mod_exp_sw.c +++ b/drivers/crypto/rsa_mod_exp/mod_exp_sw.c @@ -35,6 +35,6 @@ U_BOOT_DRIVER(mod_exp_sw) = { .flags = DM_FLAG_PRE_RELOC, }; -U_BOOT_DEVICE(mod_exp_sw) = { +U_BOOT_DRVINFO(mod_exp_sw) = { .name = "mod_exp_sw", }; diff --git a/drivers/ddr/altera/sdram_agilex.c b/drivers/ddr/altera/sdram_agilex.c index d6e7a17..a4ceb36 100644 --- a/drivers/ddr/altera/sdram_agilex.c +++ b/drivers/ddr/altera/sdram_agilex.c @@ -25,7 +25,7 @@ DECLARE_GLOBAL_DATA_PTR; int sdram_mmr_init_full(struct udevice *dev) { - struct altera_sdram_platdata *plat = dev->platdata; + struct altera_sdram_plat *plat = dev_get_plat(dev); struct altera_sdram_priv *priv = dev_get_priv(dev); u32 i; int ret; diff --git a/drivers/ddr/altera/sdram_gen5.c b/drivers/ddr/altera/sdram_gen5.c index 1360bd0..8d3ce49 100644 --- a/drivers/ddr/altera/sdram_gen5.c +++ b/drivers/ddr/altera/sdram_gen5.c @@ -27,7 +27,7 @@ struct altera_gen5_sdram_priv { struct ram_info info; }; -struct altera_gen5_sdram_platdata { +struct altera_gen5_sdram_plat { struct socfpga_sdr *sdr; }; @@ -563,9 +563,9 @@ static unsigned long sdram_calculate_size(struct socfpga_sdr_ctrl *sdr_ctrl) return temp; } -static int altera_gen5_sdram_ofdata_to_platdata(struct udevice *dev) +static int altera_gen5_sdram_of_to_plat(struct udevice *dev) { - struct altera_gen5_sdram_platdata *plat = dev->platdata; + struct altera_gen5_sdram_plat *plat = dev_get_plat(dev); plat->sdr = (struct socfpga_sdr *)devfdt_get_addr_index(dev, 0); if (!plat->sdr) @@ -578,7 +578,7 @@ static int altera_gen5_sdram_probe(struct udevice *dev) { int ret; unsigned long sdram_size; - struct altera_gen5_sdram_platdata *plat = dev->platdata; + struct altera_gen5_sdram_plat *plat = dev_get_plat(dev); struct altera_gen5_sdram_priv *priv = dev_get_priv(dev); struct socfpga_sdr_ctrl *sdr_ctrl = &plat->sdr->sdr_ctrl; struct reset_ctl_bulk resets; @@ -646,10 +646,10 @@ U_BOOT_DRIVER(altera_gen5_sdram) = { .id = UCLASS_RAM, .of_match = altera_gen5_sdram_ids, .ops = &altera_gen5_sdram_ops, - .ofdata_to_platdata = altera_gen5_sdram_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct altera_gen5_sdram_platdata), + .of_to_plat = altera_gen5_sdram_of_to_plat, + .plat_auto = sizeof(struct altera_gen5_sdram_plat), .probe = altera_gen5_sdram_probe, - .priv_auto_alloc_size = sizeof(struct altera_gen5_sdram_priv), + .priv_auto = sizeof(struct altera_gen5_sdram_priv), }; #endif /* CONFIG_SPL_BUILD */ diff --git a/drivers/ddr/altera/sdram_s10.c b/drivers/ddr/altera/sdram_s10.c index 2945f1e..03a270f 100644 --- a/drivers/ddr/altera/sdram_s10.c +++ b/drivers/ddr/altera/sdram_s10.c @@ -70,7 +70,7 @@ int match_ddr_conf(u32 ddr_conf) */ int sdram_mmr_init_full(struct udevice *dev) { - struct altera_sdram_platdata *plat = dev->platdata; + struct altera_sdram_plat *plat = dev_get_plat(dev); struct altera_sdram_priv *priv = dev_get_priv(dev); u32 update_value, io48_value, ddrioctl; u32 i; diff --git a/drivers/ddr/altera/sdram_soc64.c b/drivers/ddr/altera/sdram_soc64.c index 8cb75fe..5aba655 100644 --- a/drivers/ddr/altera/sdram_soc64.c +++ b/drivers/ddr/altera/sdram_soc64.c @@ -27,29 +27,29 @@ #define PGTABLE_OFF 0x4000 -u32 hmc_readl(struct altera_sdram_platdata *plat, u32 reg) +u32 hmc_readl(struct altera_sdram_plat *plat, u32 reg) { return readl(plat->iomhc + reg); } -u32 hmc_ecc_readl(struct altera_sdram_platdata *plat, u32 reg) +u32 hmc_ecc_readl(struct altera_sdram_plat *plat, u32 reg) { return readl(plat->hmc + reg); } -u32 hmc_ecc_writel(struct altera_sdram_platdata *plat, +u32 hmc_ecc_writel(struct altera_sdram_plat *plat, u32 data, u32 reg) { return writel(data, plat->hmc + reg); } -u32 ddr_sch_writel(struct altera_sdram_platdata *plat, u32 data, +u32 ddr_sch_writel(struct altera_sdram_plat *plat, u32 data, u32 reg) { return writel(data, plat->ddr_sch + reg); } -int emif_clear(struct altera_sdram_platdata *plat) +int emif_clear(struct altera_sdram_plat *plat) { hmc_ecc_writel(plat, 0, RSTHANDSHAKECTRL); @@ -59,7 +59,7 @@ int emif_clear(struct altera_sdram_platdata *plat) false, 1000, false); } -int emif_reset(struct altera_sdram_platdata *plat) +int emif_reset(struct altera_sdram_plat *plat) { u32 c2s, s2c, ret; @@ -214,7 +214,7 @@ void sdram_size_check(struct bd_info *bd) * Calculate SDRAM device size based on SDRAM controller parameters. * Size is specified in bytes. */ -phys_size_t sdram_calculate_size(struct altera_sdram_platdata *plat) +phys_size_t sdram_calculate_size(struct altera_sdram_plat *plat) { u32 dramaddrw = hmc_readl(plat, DRAMADDRW); @@ -230,9 +230,9 @@ phys_size_t sdram_calculate_size(struct altera_sdram_platdata *plat) return size; } -static int altera_sdram_ofdata_to_platdata(struct udevice *dev) +static int altera_sdram_of_to_plat(struct udevice *dev) { - struct altera_sdram_platdata *plat = dev->platdata; + struct altera_sdram_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr_index(dev, 0); @@ -303,8 +303,8 @@ U_BOOT_DRIVER(altera_sdram) = { .id = UCLASS_RAM, .of_match = altera_sdram_ids, .ops = &altera_sdram_ops, - .ofdata_to_platdata = altera_sdram_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct altera_sdram_platdata), + .of_to_plat = altera_sdram_of_to_plat, + .plat_auto = sizeof(struct altera_sdram_plat), .probe = altera_sdram_probe, - .priv_auto_alloc_size = sizeof(struct altera_sdram_priv), + .priv_auto = sizeof(struct altera_sdram_priv), }; diff --git a/drivers/ddr/altera/sdram_soc64.h b/drivers/ddr/altera/sdram_soc64.h index 4a830e7..8af0afc 100644 --- a/drivers/ddr/altera/sdram_soc64.h +++ b/drivers/ddr/altera/sdram_soc64.h @@ -14,7 +14,7 @@ struct altera_sdram_priv { struct reset_ctl_bulk resets; }; -struct altera_sdram_platdata { +struct altera_sdram_plat { void __iomem *hmc; void __iomem *ddr_sch; void __iomem *iomhc; @@ -169,19 +169,19 @@ struct altera_sdram_platdata { #define FW_HMC_ADAPTOR_REG_ADDR 0xf8020004 #define FW_HMC_ADAPTOR_MPU_MASK BIT(0) -u32 hmc_readl(struct altera_sdram_platdata *plat, u32 reg); -u32 hmc_ecc_readl(struct altera_sdram_platdata *plat, u32 reg); -u32 hmc_ecc_writel(struct altera_sdram_platdata *plat, +u32 hmc_readl(struct altera_sdram_plat *plat, u32 reg); +u32 hmc_ecc_readl(struct altera_sdram_plat *plat, u32 reg); +u32 hmc_ecc_writel(struct altera_sdram_plat *plat, u32 data, u32 reg); -u32 ddr_sch_writel(struct altera_sdram_platdata *plat, u32 data, +u32 ddr_sch_writel(struct altera_sdram_plat *plat, u32 data, u32 reg); -int emif_clear(struct altera_sdram_platdata *plat); -int emif_reset(struct altera_sdram_platdata *plat); +int emif_clear(struct altera_sdram_plat *plat); +int emif_reset(struct altera_sdram_plat *plat); int poll_hmc_clock_status(void); void sdram_clear_mem(phys_addr_t addr, phys_size_t size); void sdram_init_ecc_bits(struct bd_info *bd); void sdram_size_check(struct bd_info *bd); -phys_size_t sdram_calculate_size(struct altera_sdram_platdata *plat); +phys_size_t sdram_calculate_size(struct altera_sdram_plat *plat); int sdram_mmr_init_full(struct udevice *dev); #endif /* _SDRAM_SOC64_H_ */ diff --git a/drivers/demo/demo-pdata.c b/drivers/demo/demo-pdata.c index 2f434f8..818f775 100644 --- a/drivers/demo/demo-pdata.c +++ b/drivers/demo/demo-pdata.c @@ -20,27 +20,27 @@ static const struct dm_demo_pdata yellow_hexagon = { .sides = 6. }; -U_BOOT_DEVICE(demo0) = { +U_BOOT_DRVINFO(demo0) = { .name = "demo_shape_drv", - .platdata = &red_square, + .plat = &red_square, }; -U_BOOT_DEVICE(demo1) = { +U_BOOT_DRVINFO(demo1) = { .name = "demo_simple_drv", - .platdata = &red_square, + .plat = &red_square, }; -U_BOOT_DEVICE(demo2) = { +U_BOOT_DRVINFO(demo2) = { .name = "demo_shape_drv", - .platdata = &green_triangle, + .plat = &green_triangle, }; -U_BOOT_DEVICE(demo3) = { +U_BOOT_DRVINFO(demo3) = { .name = "demo_simple_drv", - .platdata = &yellow_hexagon, + .plat = &yellow_hexagon, }; -U_BOOT_DEVICE(demo4) = { +U_BOOT_DRVINFO(demo4) = { .name = "demo_shape_drv", - .platdata = &yellow_hexagon, + .plat = &yellow_hexagon, }; diff --git a/drivers/demo/demo-shape.c b/drivers/demo/demo-shape.c index 8686c99..8129317 100644 --- a/drivers/demo/demo-shape.c +++ b/drivers/demo/demo-shape.c @@ -28,7 +28,7 @@ struct shape_data { /* Crazy little function to draw shapes on the console */ static int shape_hello(struct udevice *dev, int ch) { - const struct dm_demo_pdata *pdata = dev_get_platdata(dev); + const struct dm_demo_pdata *pdata = dev_get_plat(dev); struct shape_data *data = dev_get_priv(dev); static const struct shape { int start; @@ -140,9 +140,9 @@ static const struct demo_ops shape_ops = { .set_light = set_light, }; -static int shape_ofdata_to_platdata(struct udevice *dev) +static int shape_of_to_plat(struct udevice *dev) { - struct dm_demo_pdata *pdata = dev_get_platdata(dev); + struct dm_demo_pdata *pdata = dev_get_plat(dev); int ret; /* Parse the data that is common with all demo devices */ @@ -189,10 +189,10 @@ U_BOOT_DRIVER(demo_shape_drv) = { .name = "demo_shape_drv", .of_match = demo_shape_id, .id = UCLASS_DEMO, - .ofdata_to_platdata = shape_ofdata_to_platdata, + .of_to_plat = shape_of_to_plat, .ops = &shape_ops, .probe = dm_shape_probe, .remove = dm_shape_remove, - .priv_auto_alloc_size = sizeof(struct shape_data), - .platdata_auto_alloc_size = sizeof(struct dm_demo_pdata), + .priv_auto = sizeof(struct shape_data), + .plat_auto = sizeof(struct dm_demo_pdata), }; diff --git a/drivers/demo/demo-simple.c b/drivers/demo/demo-simple.c index 68972c7..28b271f 100644 --- a/drivers/demo/demo-simple.c +++ b/drivers/demo/demo-simple.c @@ -14,7 +14,7 @@ static int simple_hello(struct udevice *dev, int ch) { - const struct dm_demo_pdata *pdata = dev_get_platdata(dev); + const struct dm_demo_pdata *pdata = dev_get_plat(dev); printf("Hello from %08x: %s %d\n", (uint)map_to_sysmem(dev), pdata->colour, pdata->sides); @@ -26,7 +26,7 @@ static const struct demo_ops simple_ops = { .hello = simple_hello, }; -static int demo_shape_ofdata_to_platdata(struct udevice *dev) +static int demo_shape_of_to_plat(struct udevice *dev) { /* Parse the data that is common with all demo devices */ return demo_parse_dt(dev); @@ -41,7 +41,7 @@ U_BOOT_DRIVER(demo_simple_drv) = { .name = "demo_simple_drv", .of_match = demo_shape_id, .id = UCLASS_DEMO, - .ofdata_to_platdata = demo_shape_ofdata_to_platdata, + .of_to_plat = demo_shape_of_to_plat, .ops = &simple_ops, - .platdata_auto_alloc_size = sizeof(struct dm_demo_pdata), + .plat_auto = sizeof(struct dm_demo_pdata), }; diff --git a/drivers/demo/demo-uclass.c b/drivers/demo/demo-uclass.c index 6c36f03..a020ecb 100644 --- a/drivers/demo/demo-uclass.c +++ b/drivers/demo/demo-uclass.c @@ -65,7 +65,7 @@ int demo_set_light(struct udevice *dev, int light) int demo_parse_dt(struct udevice *dev) { - struct dm_demo_pdata *pdata = dev_get_platdata(dev); + struct dm_demo_pdata *pdata = dev_get_plat(dev); int dn = dev_of_offset(dev); pdata->sides = fdtdec_get_int(gd->fdt_blob, dn, "sides", 0); diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c index 36cd4e9..b34975d 100644 --- a/drivers/dfu/dfu_mtd.c +++ b/drivers/dfu/dfu_mtd.c @@ -21,7 +21,7 @@ static bool mtd_is_aligned_with_block_size(struct mtd_info *mtd, u64 size) static int mtd_block_op(enum dfu_op op, struct dfu_entity *dfu, u64 offset, void *buf, long *len) { - u64 off, lim, remaining; + u64 off, lim, remaining, lock_ofs, lock_len; struct mtd_info *mtd = dfu->data.mtd.info; struct mtd_oob_ops io_op = {}; int ret = 0; @@ -34,7 +34,7 @@ static int mtd_block_op(enum dfu_op op, struct dfu_entity *dfu, return 0; } - off = dfu->data.mtd.start + offset + dfu->bad_skip; + off = lock_ofs = dfu->data.mtd.start + offset + dfu->bad_skip; lim = dfu->data.mtd.start + dfu->data.mtd.size; if (off >= lim) { @@ -56,12 +56,19 @@ static int mtd_block_op(enum dfu_op op, struct dfu_entity *dfu, if (op == DFU_OP_WRITE) { struct erase_info erase_op = {}; - remaining = round_up(*len, mtd->erasesize); + remaining = lock_len = round_up(*len, mtd->erasesize); erase_op.mtd = mtd; erase_op.addr = off; erase_op.len = mtd->erasesize; erase_op.scrub = 0; + debug("Unlocking the mtd device\n"); + ret = mtd_unlock(mtd, lock_ofs, lock_len); + if (ret && ret != -EOPNOTSUPP) { + printf("MTD device unlock failed\n"); + return 0; + } + while (remaining) { if (erase_op.addr + remaining > lim) { printf("Limit reached 0x%llx while erasing at offset 0x%llx\n", @@ -139,6 +146,13 @@ static int mtd_block_op(enum dfu_op op, struct dfu_entity *dfu, io_op.len = mtd->writesize; } + if (op == DFU_OP_WRITE) { + /* Write done, lock again */ + debug("Locking the mtd device\n"); + ret = mtd_lock(mtd, lock_ofs, lock_len); + if (ret && ret != -EOPNOTSUPP) + printf("MTD device lock failed\n"); + } return ret; } diff --git a/drivers/dma/bcm6348-iudma.c b/drivers/dma/bcm6348-iudma.c index 91172d4..9857760 100644 --- a/drivers/dma/bcm6348-iudma.c +++ b/drivers/dma/bcm6348-iudma.c @@ -649,6 +649,6 @@ U_BOOT_DRIVER(bcm6348_iudma) = { .id = UCLASS_DMA, .of_match = bcm6348_iudma_ids, .ops = &bcm6348_iudma_ops, - .priv_auto_alloc_size = sizeof(struct bcm6348_iudma_priv), + .priv_auto = sizeof(struct bcm6348_iudma_priv), .probe = bcm6348_iudma_probe, }; diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c index 5040314..a93b0b7 100644 --- a/drivers/dma/dma-uclass.c +++ b/drivers/dma/dma-uclass.c @@ -254,5 +254,5 @@ UCLASS_DRIVER(dma) = { .id = UCLASS_DMA, .name = "dma", .flags = DM_UC_FLAG_SEQ_ALIAS, - .per_device_auto_alloc_size = sizeof(struct dma_dev_priv), + .per_device_auto = sizeof(struct dma_dev_priv), }; diff --git a/drivers/dma/sandbox-dma-test.c b/drivers/dma/sandbox-dma-test.c index 838596b..aebf3ee 100644 --- a/drivers/dma/sandbox-dma-test.c +++ b/drivers/dma/sandbox-dma-test.c @@ -280,5 +280,5 @@ U_BOOT_DRIVER(sandbox_dma) = { .of_match = sandbox_dma_ids, .ops = &sandbox_dma_ops, .probe = sandbox_dma_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_dma_dev), + .priv_auto = sizeof(struct sandbox_dma_dev), }; diff --git a/drivers/dma/ti-edma3.c b/drivers/dma/ti-edma3.c index 13ab967..ec3dc62 100644 --- a/drivers/dma/ti-edma3.c +++ b/drivers/dma/ti-edma3.c @@ -542,7 +542,7 @@ static int ti_edma3_transfer(struct udevice *dev, int direction, void *dst, return 0; } -static int ti_edma3_ofdata_to_platdata(struct udevice *dev) +static int ti_edma3_of_to_plat(struct udevice *dev) { struct ti_edma3_priv *priv = dev_get_priv(dev); @@ -574,8 +574,8 @@ U_BOOT_DRIVER(ti_edma3) = { .id = UCLASS_DMA, .of_match = ti_edma3_ids, .ops = &ti_edma3_ops, - .ofdata_to_platdata = ti_edma3_ofdata_to_platdata, + .of_to_plat = ti_edma3_of_to_plat, .probe = ti_edma3_probe, - .priv_auto_alloc_size = sizeof(struct ti_edma3_priv), + .priv_auto = sizeof(struct ti_edma3_priv), }; #endif /* CONFIG_DMA */ diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index 9421604..f3ec827 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -1933,5 +1933,5 @@ U_BOOT_DRIVER(ti_edma3) = { .of_match = udma_ids, .ops = &udma_ops, .probe = udma_probe, - .priv_auto_alloc_size = sizeof(struct udma_dev), + .priv_auto = sizeof(struct udma_dev), }; diff --git a/drivers/firmware/scmi/mailbox_agent.c b/drivers/firmware/scmi/mailbox_agent.c index a85cff1..3f4b04a 100644 --- a/drivers/firmware/scmi/mailbox_agent.c +++ b/drivers/firmware/scmi/mailbox_agent.c @@ -97,7 +97,7 @@ U_BOOT_DRIVER(scmi_mbox) = { .name = "scmi-over-mailbox", .id = UCLASS_SCMI_AGENT, .of_match = scmi_mbox_ids, - .priv_auto_alloc_size = sizeof(struct scmi_mbox_channel), + .priv_auto = sizeof(struct scmi_mbox_channel), .probe = scmi_mbox_probe, .ops = &scmi_mbox_ops, }; diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c index 5b6a423..35de68c 100644 --- a/drivers/firmware/scmi/sandbox-scmi_agent.c +++ b/drivers/firmware/scmi/sandbox-scmi_agent.c @@ -403,7 +403,7 @@ U_BOOT_DRIVER(sandbox_scmi_agent) = { .name = "sandbox-scmi_agent", .id = UCLASS_SCMI_AGENT, .of_match = sandbox_scmi_test_ids, - .priv_auto_alloc_size = sizeof(struct sandbox_scmi_agent), + .priv_auto = sizeof(struct sandbox_scmi_agent), .probe = sandbox_scmi_test_probe, .remove = sandbox_scmi_test_remove, .ops = &sandbox_scmi_test_ops, diff --git a/drivers/firmware/scmi/sandbox-scmi_devices.c b/drivers/firmware/scmi/sandbox-scmi_devices.c index c69967b..414da6f 100644 --- a/drivers/firmware/scmi/sandbox-scmi_devices.c +++ b/drivers/firmware/scmi/sandbox-scmi_devices.c @@ -107,7 +107,7 @@ U_BOOT_DRIVER(sandbox_scmi_devices) = { .name = "sandbox-scmi_devices", .id = UCLASS_MISC, .of_match = sandbox_scmi_devices_ids, - .priv_auto_alloc_size = sizeof(struct sandbox_scmi_device_priv), + .priv_auto = sizeof(struct sandbox_scmi_device_priv), .remove = sandbox_scmi_devices_remove, .probe = sandbox_scmi_devices_probe, }; diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index 7dc5331..516e690 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -73,11 +73,11 @@ static int scmi_bind_protocols(struct udevice *dev) switch (protocol_id) { case SCMI_PROTOCOL_ID_CLOCK: if (IS_ENABLED(CONFIG_CLK_SCMI)) - drv = DM_GET_DRIVER(scmi_clock); + drv = DM_DRIVER_GET(scmi_clock); break; case SCMI_PROTOCOL_ID_RESET_DOMAIN: if (IS_ENABLED(CONFIG_RESET_SCMI)) - drv = DM_GET_DRIVER(scmi_reset_domain); + drv = DM_DRIVER_GET(scmi_reset_domain); break; default: break; @@ -89,8 +89,8 @@ static int scmi_bind_protocols(struct udevice *dev) continue; } - ret = device_bind_ofnode(dev, drv, ofnode_get_name(node), - NULL, node, NULL); + ret = device_bind(dev, drv, ofnode_get_name(node), NULL, node, + NULL); if (ret) break; } diff --git a/drivers/firmware/scmi/smccc_agent.c b/drivers/firmware/scmi/smccc_agent.c index 85dbf91..64d0929 100644 --- a/drivers/firmware/scmi/smccc_agent.c +++ b/drivers/firmware/scmi/smccc_agent.c @@ -83,7 +83,7 @@ U_BOOT_DRIVER(scmi_smccc) = { .name = "scmi-over-smccc", .id = UCLASS_SCMI_AGENT, .of_match = scmi_smccc_ids, - .priv_auto_alloc_size = sizeof(struct scmi_smccc_channel), + .priv_auto = sizeof(struct scmi_smccc_channel), .probe = scmi_smccc_probe, .ops = &scmi_smccc_ops, }; diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index a2beb00..0cdfb0e 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -3166,5 +3166,5 @@ U_BOOT_DRIVER(ti_sci) = { .id = UCLASS_FIRMWARE, .of_match = ti_sci_ids, .probe = ti_sci_probe, - .priv_auto_alloc_size = sizeof(struct ti_sci_info), + .priv_auto = sizeof(struct ti_sci_info), }; diff --git a/drivers/gpio/74x164_gpio.c b/drivers/gpio/74x164_gpio.c index 64717a6..0c06301 100644 --- a/drivers/gpio/74x164_gpio.c +++ b/drivers/gpio/74x164_gpio.c @@ -187,6 +187,6 @@ U_BOOT_DRIVER(74x164) = { .id = UCLASS_GPIO, .ops = &gen_74x164_ops, .probe = gen_74x164_probe, - .priv_auto_alloc_size = sizeof(struct gen_74x164_priv), + .priv_auto = sizeof(struct gen_74x164_priv), .of_match = gen_74x164_ids, }; diff --git a/drivers/gpio/altera_pio.c b/drivers/gpio/altera_pio.c index 75800d9..f4582b1 100644 --- a/drivers/gpio/altera_pio.c +++ b/drivers/gpio/altera_pio.c @@ -19,7 +19,7 @@ struct altera_pio_regs { u32 direction; /* Direction register */ }; -struct altera_pio_platdata { +struct altera_pio_plat { struct altera_pio_regs *regs; int gpio_count; const char *bank_name; @@ -27,7 +27,7 @@ struct altera_pio_platdata { static int altera_pio_direction_input(struct udevice *dev, unsigned pin) { - struct altera_pio_platdata *plat = dev_get_platdata(dev); + struct altera_pio_plat *plat = dev_get_plat(dev); struct altera_pio_regs *const regs = plat->regs; clrbits_le32(®s->direction, 1 << pin); @@ -38,7 +38,7 @@ static int altera_pio_direction_input(struct udevice *dev, unsigned pin) static int altera_pio_direction_output(struct udevice *dev, unsigned pin, int val) { - struct altera_pio_platdata *plat = dev_get_platdata(dev); + struct altera_pio_plat *plat = dev_get_plat(dev); struct altera_pio_regs *const regs = plat->regs; if (val) @@ -53,7 +53,7 @@ static int altera_pio_direction_output(struct udevice *dev, unsigned pin, static int altera_pio_get_value(struct udevice *dev, unsigned pin) { - struct altera_pio_platdata *plat = dev_get_platdata(dev); + struct altera_pio_plat *plat = dev_get_plat(dev); struct altera_pio_regs *const regs = plat->regs; return !!(readl(®s->data) & (1 << pin)); @@ -62,7 +62,7 @@ static int altera_pio_get_value(struct udevice *dev, unsigned pin) static int altera_pio_set_value(struct udevice *dev, unsigned pin, int val) { - struct altera_pio_platdata *plat = dev_get_platdata(dev); + struct altera_pio_plat *plat = dev_get_plat(dev); struct altera_pio_regs *const regs = plat->regs; if (val) @@ -76,7 +76,7 @@ static int altera_pio_set_value(struct udevice *dev, unsigned pin, int val) static int altera_pio_probe(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); - struct altera_pio_platdata *plat = dev_get_platdata(dev); + struct altera_pio_plat *plat = dev_get_plat(dev); uc_priv->gpio_count = plat->gpio_count; uc_priv->bank_name = plat->bank_name; @@ -84,9 +84,9 @@ static int altera_pio_probe(struct udevice *dev) return 0; } -static int altera_pio_ofdata_to_platdata(struct udevice *dev) +static int altera_pio_of_to_plat(struct udevice *dev) { - struct altera_pio_platdata *plat = dev_get_platdata(dev); + struct altera_pio_plat *plat = dev_get_plat(dev); plat->regs = map_physmem(dev_read_addr(dev), sizeof(struct altera_pio_regs), @@ -116,7 +116,7 @@ U_BOOT_DRIVER(altera_pio) = { .id = UCLASS_GPIO, .of_match = altera_pio_ids, .ops = &altera_pio_ops, - .ofdata_to_platdata = altera_pio_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct altera_pio_platdata), + .of_to_plat = altera_pio_of_to_plat, + .plat_auto = sizeof(struct altera_pio_plat), .probe = altera_pio_probe, }; diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index ef79843..1409db5 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -590,7 +590,7 @@ static const struct dm_gpio_ops gpio_at91_ops = { static int at91_gpio_probe(struct udevice *dev) { struct at91_port_priv *port = dev_get_priv(dev); - struct at91_port_platdata *plat = dev_get_platdata(dev); + struct at91_port_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct clk clk; int ret; @@ -629,10 +629,10 @@ U_BOOT_DRIVER(atmel_at91rm9200_gpio) = { .id = UCLASS_GPIO, #if CONFIG_IS_ENABLED(OF_CONTROL) .of_match = at91_gpio_ids, - .platdata_auto_alloc_size = sizeof(struct at91_port_platdata), + .plat_auto = sizeof(struct at91_port_plat), #endif .ops = &gpio_at91_ops, .probe = at91_gpio_probe, - .priv_auto_alloc_size = sizeof(struct at91_port_priv), + .priv_auto = sizeof(struct at91_port_priv), }; #endif diff --git a/drivers/gpio/atmel_pio4.c b/drivers/gpio/atmel_pio4.c index 18f365f..e7b8f23 100644 --- a/drivers/gpio/atmel_pio4.c +++ b/drivers/gpio/atmel_pio4.c @@ -176,14 +176,14 @@ struct atmel_pioctrl_data { u32 nbanks; }; -struct atmel_pio4_platdata { +struct atmel_pio4_plat { struct atmel_pio4_port *reg_base; }; static struct atmel_pio4_port *atmel_pio4_bank_base(struct udevice *dev, u32 bank) { - struct atmel_pio4_platdata *plat = dev_get_platdata(dev); + struct atmel_pio4_plat *plat = dev_get_plat(dev); struct atmel_pio4_port *port_base = (struct atmel_pio4_port *)((u32)plat->reg_base + ATMEL_PIO_BANK_OFFSET * bank); @@ -281,7 +281,7 @@ static int atmel_pio4_bind(struct udevice *dev) static int atmel_pio4_probe(struct udevice *dev) { - struct atmel_pio4_platdata *plat = dev_get_platdata(dev); + struct atmel_pio4_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct atmel_pioctrl_data *pioctrl_data; struct clk clk; @@ -338,7 +338,7 @@ U_BOOT_DRIVER(gpio_atmel_pio4) = { .probe = atmel_pio4_probe, .bind = atmel_pio4_bind, .of_match = atmel_pio4_ids, - .platdata_auto_alloc_size = sizeof(struct atmel_pio4_platdata), + .plat_auto = sizeof(struct atmel_pio4_plat), }; #endif diff --git a/drivers/gpio/bcm2835_gpio.c b/drivers/gpio/bcm2835_gpio.c index 0dff9ac..704a6fa 100644 --- a/drivers/gpio/bcm2835_gpio.c +++ b/drivers/gpio/bcm2835_gpio.c @@ -102,7 +102,7 @@ static const struct dm_gpio_ops gpio_bcm2835_ops = { static int bcm2835_gpio_probe(struct udevice *dev) { struct bcm2835_gpios *gpios = dev_get_priv(dev); - struct bcm2835_gpio_platdata *plat = dev_get_platdata(dev); + struct bcm2835_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); uc_priv->bank_name = "GPIO"; @@ -116,9 +116,9 @@ static int bcm2835_gpio_probe(struct udevice *dev) } #if CONFIG_IS_ENABLED(OF_CONTROL) -static int bcm2835_gpio_ofdata_to_platdata(struct udevice *dev) +static int bcm2835_gpio_of_to_plat(struct udevice *dev) { - struct bcm2835_gpio_platdata *plat = dev_get_platdata(dev); + struct bcm2835_gpio_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -133,10 +133,10 @@ static int bcm2835_gpio_ofdata_to_platdata(struct udevice *dev) U_BOOT_DRIVER(gpio_bcm2835) = { .name = "gpio_bcm2835", .id = UCLASS_GPIO, - .ofdata_to_platdata = of_match_ptr(bcm2835_gpio_ofdata_to_platdata), - .platdata_auto_alloc_size = sizeof(struct bcm2835_gpio_platdata), + .of_to_plat = of_match_ptr(bcm2835_gpio_of_to_plat), + .plat_auto = sizeof(struct bcm2835_gpio_plat), .ops = &gpio_bcm2835_ops, .probe = bcm2835_gpio_probe, .flags = DM_FLAG_PRE_RELOC, - .priv_auto_alloc_size = sizeof(struct bcm2835_gpios), + .priv_auto = sizeof(struct bcm2835_gpios), }; diff --git a/drivers/gpio/bcm6345_gpio.c b/drivers/gpio/bcm6345_gpio.c index 5da11d9..e031f71 100644 --- a/drivers/gpio/bcm6345_gpio.c +++ b/drivers/gpio/bcm6345_gpio.c @@ -114,6 +114,6 @@ U_BOOT_DRIVER(bcm6345_gpio) = { .id = UCLASS_GPIO, .of_match = bcm6345_gpio_ids, .ops = &bcm6345_gpio_ops, - .priv_auto_alloc_size = sizeof(struct bcm6345_gpio_priv), + .priv_auto = sizeof(struct bcm6345_gpio_priv), .probe = bcm6345_gpio_probe, }; diff --git a/drivers/gpio/cortina_gpio.c b/drivers/gpio/cortina_gpio.c index 055907c..72ef523 100644 --- a/drivers/gpio/cortina_gpio.c +++ b/drivers/gpio/cortina_gpio.c @@ -107,7 +107,7 @@ U_BOOT_DRIVER(cortina_gpio) = { .id = UCLASS_GPIO, .ops = &gpio_cortina_ops, .probe = ca_gpio_probe, - .priv_auto_alloc_size = sizeof(struct cortina_gpio_bank), + .priv_auto = sizeof(struct cortina_gpio_bank), .of_match = ca_gpio_ids, }; #endif /* CONFIG_DM_GPIO */ diff --git a/drivers/gpio/da8xx_gpio.c b/drivers/gpio/da8xx_gpio.c index f875888..9a52a5e 100644 --- a/drivers/gpio/da8xx_gpio.c +++ b/drivers/gpio/da8xx_gpio.c @@ -522,7 +522,7 @@ static const struct dm_gpio_ops gpio_davinci_ops = { static int davinci_gpio_probe(struct udevice *dev) { struct davinci_gpio_bank *bank = dev_get_priv(dev); - struct davinci_gpio_platdata *plat = dev_get_platdata(dev); + struct davinci_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); const void *fdt = gd->fdt_blob; int node = dev_of_offset(dev); @@ -540,9 +540,9 @@ static const struct udevice_id davinci_gpio_ids[] = { { } }; -static int davinci_gpio_ofdata_to_platdata(struct udevice *dev) +static int davinci_gpio_of_to_plat(struct udevice *dev) { - struct davinci_gpio_platdata *plat = dev_get_platdata(dev); + struct davinci_gpio_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -557,12 +557,12 @@ U_BOOT_DRIVER(ti_dm6441_gpio) = { .name = "ti_dm6441_gpio", .id = UCLASS_GPIO, .ops = &gpio_davinci_ops, - .ofdata_to_platdata = of_match_ptr(davinci_gpio_ofdata_to_platdata), + .of_to_plat = of_match_ptr(davinci_gpio_of_to_plat), .of_match = davinci_gpio_ids, .bind = dm_scan_fdt_dev, - .platdata_auto_alloc_size = sizeof(struct davinci_gpio_platdata), + .plat_auto = sizeof(struct davinci_gpio_plat), .probe = davinci_gpio_probe, - .priv_auto_alloc_size = sizeof(struct davinci_gpio_bank), + .priv_auto = sizeof(struct davinci_gpio_bank), }; #endif diff --git a/drivers/gpio/da8xx_gpio.h b/drivers/gpio/da8xx_gpio.h index 849e8d2..ca59d6a 100644 --- a/drivers/gpio/da8xx_gpio.h +++ b/drivers/gpio/da8xx_gpio.h @@ -31,7 +31,7 @@ struct davinci_gpio_bank { #if CONFIG_IS_ENABLED(DM_GPIO) /* Information about a GPIO bank */ -struct davinci_gpio_platdata { +struct davinci_gpio_plat { int bank_index; ulong base; /* address of registers in physical memory */ const char *port_name; diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c index 37916e7..e6e9194 100644 --- a/drivers/gpio/dwapb_gpio.c +++ b/drivers/gpio/dwapb_gpio.c @@ -36,7 +36,7 @@ struct gpio_dwapb_priv { struct reset_ctl_bulk resets; }; -struct gpio_dwapb_platdata { +struct gpio_dwapb_plat { const char *name; int bank; int pins; @@ -45,7 +45,7 @@ struct gpio_dwapb_platdata { static int dwapb_gpio_direction_input(struct udevice *dev, unsigned pin) { - struct gpio_dwapb_platdata *plat = dev_get_platdata(dev); + struct gpio_dwapb_plat *plat = dev_get_plat(dev); clrbits_le32(plat->base + GPIO_SWPORT_DDR(plat->bank), 1 << pin); return 0; @@ -54,7 +54,7 @@ static int dwapb_gpio_direction_input(struct udevice *dev, unsigned pin) static int dwapb_gpio_direction_output(struct udevice *dev, unsigned pin, int val) { - struct gpio_dwapb_platdata *plat = dev_get_platdata(dev); + struct gpio_dwapb_plat *plat = dev_get_plat(dev); setbits_le32(plat->base + GPIO_SWPORT_DDR(plat->bank), 1 << pin); @@ -68,7 +68,7 @@ static int dwapb_gpio_direction_output(struct udevice *dev, unsigned pin, static int dwapb_gpio_set_value(struct udevice *dev, unsigned pin, int val) { - struct gpio_dwapb_platdata *plat = dev_get_platdata(dev); + struct gpio_dwapb_plat *plat = dev_get_plat(dev); if (val) setbits_le32(plat->base + GPIO_SWPORT_DR(plat->bank), 1 << pin); @@ -80,7 +80,7 @@ static int dwapb_gpio_set_value(struct udevice *dev, unsigned pin, int val) static int dwapb_gpio_get_function(struct udevice *dev, unsigned offset) { - struct gpio_dwapb_platdata *plat = dev_get_platdata(dev); + struct gpio_dwapb_plat *plat = dev_get_plat(dev); u32 gpio; gpio = readl(plat->base + GPIO_SWPORT_DDR(plat->bank)); @@ -93,7 +93,7 @@ static int dwapb_gpio_get_function(struct udevice *dev, unsigned offset) static int dwapb_gpio_get_value(struct udevice *dev, unsigned pin) { - struct gpio_dwapb_platdata *plat = dev_get_platdata(dev); + struct gpio_dwapb_plat *plat = dev_get_plat(dev); u32 value; if (dwapb_gpio_get_function(dev, pin) == GPIOF_OUTPUT) @@ -141,7 +141,7 @@ static int gpio_dwapb_reset(struct udevice *dev) static int gpio_dwapb_probe(struct udevice *dev) { struct gpio_dev_priv *priv = dev_get_uclass_priv(dev); - struct gpio_dwapb_platdata *plat = dev->platdata; + struct gpio_dwapb_plat *plat = dev_get_plat(dev); if (!plat) { /* Reset on parent device only */ @@ -156,7 +156,7 @@ static int gpio_dwapb_probe(struct udevice *dev) static int gpio_dwapb_bind(struct udevice *dev) { - struct gpio_dwapb_platdata *plat = dev_get_platdata(dev); + struct gpio_dwapb_plat *plat = dev_get_plat(dev); struct udevice *subdev; fdt_addr_t base; int ret, bank = 0; @@ -202,8 +202,8 @@ static int gpio_dwapb_bind(struct udevice *dev) } } - ret = device_bind_ofnode(dev, dev->driver, plat->name, - plat, node, &subdev); + ret = device_bind(dev, dev->driver, plat->name, plat, node, + &subdev); if (ret) return ret; @@ -215,7 +215,7 @@ static int gpio_dwapb_bind(struct udevice *dev) static int gpio_dwapb_remove(struct udevice *dev) { - struct gpio_dwapb_platdata *plat = dev_get_platdata(dev); + struct gpio_dwapb_plat *plat = dev_get_plat(dev); struct gpio_dwapb_priv *priv = dev_get_priv(dev); if (!plat && priv) @@ -237,5 +237,5 @@ U_BOOT_DRIVER(gpio_dwapb) = { .bind = gpio_dwapb_bind, .probe = gpio_dwapb_probe, .remove = gpio_dwapb_remove, - .priv_auto_alloc_size = sizeof(struct gpio_dwapb_priv), + .priv_auto = sizeof(struct gpio_dwapb_priv), }; diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index a993fd4..beae34f 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c @@ -189,6 +189,6 @@ U_BOOT_DRIVER(rcar_gpio) = { .id = UCLASS_GPIO, .of_match = rcar_gpio_ids, .ops = &rcar_gpio_ops, - .priv_auto_alloc_size = sizeof(struct rcar_gpio_priv), + .priv_auto = sizeof(struct rcar_gpio_priv), .probe = rcar_gpio_probe, }; diff --git a/drivers/gpio/gpio-rza1.c b/drivers/gpio/gpio-rza1.c index 86804ac..ee7de4c 100644 --- a/drivers/gpio/gpio-rza1.c +++ b/drivers/gpio/gpio-rza1.c @@ -130,6 +130,6 @@ U_BOOT_DRIVER(r7s72100_gpio) = { .name = "r7s72100-gpio", .id = UCLASS_GPIO, .ops = &r7s72100_gpio_ops, - .priv_auto_alloc_size = sizeof(struct r7s72100_gpio_priv), + .priv_auto = sizeof(struct r7s72100_gpio_priv), .probe = r7s72100_gpio_probe, }; diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 0c01413..bad6b71 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -239,9 +239,9 @@ struct gpio_hog_data { u32 val[2]; }; -static int gpio_hog_ofdata_to_platdata(struct udevice *dev) +static int gpio_hog_of_to_plat(struct udevice *dev) { - struct gpio_hog_data *plat = dev_get_platdata(dev); + struct gpio_hog_data *plat = dev_get_plat(dev); const char *nodename; int ret; @@ -272,7 +272,7 @@ static int gpio_hog_ofdata_to_platdata(struct udevice *dev) static int gpio_hog_probe(struct udevice *dev) { - struct gpio_hog_data *plat = dev_get_platdata(dev); + struct gpio_hog_data *plat = dev_get_plat(dev); struct gpio_hog_priv *priv = dev_get_priv(dev); int ret; @@ -306,7 +306,7 @@ int gpio_hog_probe_all(void) for (uclass_first_device(UCLASS_NOP, &dev); dev; uclass_find_next_device(&dev)) { - if (dev->driver == DM_GET_DRIVER(gpio_hog)) { + if (dev->driver == DM_DRIVER_GET(gpio_hog)) { ret = device_probe(dev); if (ret) { printf("Failed to probe device %s err: %d\n", @@ -338,10 +338,10 @@ int gpio_hog_lookup_name(const char *name, struct gpio_desc **desc) U_BOOT_DRIVER(gpio_hog) = { .name = "gpio_hog", .id = UCLASS_NOP, - .ofdata_to_platdata = gpio_hog_ofdata_to_platdata, + .of_to_plat = gpio_hog_of_to_plat, .probe = gpio_hog_probe, - .priv_auto_alloc_size = sizeof(struct gpio_hog_priv), - .platdata_auto_alloc_size = sizeof(struct gpio_hog_data), + .priv_auto = sizeof(struct gpio_hog_priv), + .plat_auto = sizeof(struct gpio_hog_data), }; #else int gpio_hog_lookup_name(const char *name, struct gpio_desc **desc) @@ -1100,9 +1100,8 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name) { int ret; - ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev), - list_name, "#gpio-cells", 0, -1, - NULL); + ret = dev_read_phandle_with_args(dev, list_name, "#gpio-cells", 0, -1, + NULL); if (ret) { debug("%s: Node '%s', property '%s', GPIO count failed: %d\n", __func__, dev->name, list_name, ret); @@ -1166,7 +1165,7 @@ int gpio_get_number(const struct gpio_desc *desc) if (!dev) return -1; - uc_priv = dev->uclass_priv; + uc_priv = dev_get_uclass_priv(dev); return uc_priv->gpio_base + desc->offset; } @@ -1340,5 +1339,5 @@ UCLASS_DRIVER(gpio) = { .post_probe = gpio_post_probe, .post_bind = gpio_post_bind, .pre_remove = gpio_pre_remove, - .per_device_auto_alloc_size = sizeof(struct gpio_dev_priv), + .per_device_auto = sizeof(struct gpio_dev_priv), }; diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c index 54a38da..61c705b 100644 --- a/drivers/gpio/gpio-uniphier.c +++ b/drivers/gpio/gpio-uniphier.c @@ -166,6 +166,6 @@ U_BOOT_DRIVER(uniphier_gpio) = { .id = UCLASS_GPIO, .of_match = uniphier_gpio_match, .probe = uniphier_gpio_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_gpio_priv), + .priv_auto = sizeof(struct uniphier_gpio_priv), .ops = &uniphier_gpio_ops, }; diff --git a/drivers/gpio/hi6220_gpio.c b/drivers/gpio/hi6220_gpio.c index 95de2ae..04f8d90 100644 --- a/drivers/gpio/hi6220_gpio.c +++ b/drivers/gpio/hi6220_gpio.c @@ -66,8 +66,8 @@ static const struct dm_gpio_ops gpio_hi6220_ops = { static int hi6220_gpio_probe(struct udevice *dev) { struct gpio_bank *bank = dev_get_priv(dev); - struct hikey_gpio_platdata *plat = dev_get_platdata(dev); - struct gpio_dev_priv *uc_priv = dev->uclass_priv; + struct hikey_gpio_plat *plat = dev_get_plat(dev); + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); char name[18], *str; sprintf(name, "GPIO%d_", plat->bank_index); @@ -89,7 +89,7 @@ U_BOOT_DRIVER(gpio_hi6220) = { .id = UCLASS_GPIO, .ops = &gpio_hi6220_ops, .probe = hi6220_gpio_probe, - .priv_auto_alloc_size = sizeof(struct gpio_bank), + .priv_auto = sizeof(struct gpio_bank), }; diff --git a/drivers/gpio/hsdk-creg-gpio.c b/drivers/gpio/hsdk-creg-gpio.c index 35b1149..66f8441 100644 --- a/drivers/gpio/hsdk-creg-gpio.c +++ b/drivers/gpio/hsdk-creg-gpio.c @@ -165,5 +165,5 @@ U_BOOT_DRIVER(gpio_hsdk_creg) = { .ops = &hsdk_creg_gpio_ops, .probe = hsdk_creg_gpio_probe, .of_match = hsdk_creg_gpio_ids, - .platdata_auto_alloc_size = sizeof(struct hsdk_creg_gpio), + .plat_auto = sizeof(struct hsdk_creg_gpio), }; diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c index 1e876f6..0e2874c 100644 --- a/drivers/gpio/imx_rgpio2p.c +++ b/drivers/gpio/imx_rgpio2p.c @@ -11,6 +11,7 @@ #include <fdtdec.h> #include <asm/gpio.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <malloc.h> enum imx_rgpio2p_direction { @@ -132,7 +133,7 @@ static const struct dm_gpio_ops imx_rgpio2p_ops = { static int imx_rgpio2p_probe(struct udevice *dev) { struct imx_rgpio2p_data *bank = dev_get_priv(dev); - struct imx_rgpio2p_plat *plat = dev_get_platdata(dev); + struct imx_rgpio2p_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); int banknum; char name[18], *str; @@ -151,13 +152,13 @@ static int imx_rgpio2p_probe(struct udevice *dev) static int imx_rgpio2p_bind(struct udevice *dev) { - struct imx_rgpio2p_plat *plat = dev->platdata; + struct imx_rgpio2p_plat *plat = dev_get_plat(dev); fdt_addr_t addr; /* - * If platdata already exsits, directly return. - * Actually only when DT is not supported, platdata - * is statically initialized in U_BOOT_DEVICES.Here + * If plat already exsits, directly return. + * Actually only when DT is not supported, plat + * is statically initialized in U_BOOT_DRVINFOS.Here * will return. */ if (plat) @@ -171,7 +172,7 @@ static int imx_rgpio2p_bind(struct udevice *dev) * TODO: * When every board is converted to driver model and DT is supported, * this can be done by auto-alloc feature, but not using calloc - * to alloc memory for platdata. + * to alloc memory for plat. * * For example imx_rgpio2p_plat uses platform data rather than device * tree. @@ -183,8 +184,8 @@ static int imx_rgpio2p_bind(struct udevice *dev) return -ENOMEM; plat->regs = (struct gpio_regs *)addr; - plat->bank_index = dev->req_seq; - dev->platdata = plat; + plat->bank_index = dev_seq(dev); + dev_set_plat(dev, plat); return 0; } @@ -200,7 +201,7 @@ U_BOOT_DRIVER(imx_rgpio2p) = { .id = UCLASS_GPIO, .ops = &imx_rgpio2p_ops, .probe = imx_rgpio2p_probe, - .priv_auto_alloc_size = sizeof(struct imx_rgpio2p_plat), + .priv_auto = sizeof(struct imx_rgpio2p_plat), .of_match = imx_rgpio2p_ids, .bind = imx_rgpio2p_bind, }; @@ -215,7 +216,7 @@ static const struct imx_rgpio2p_plat imx_plat[] = { { 5, (struct gpio_regs *)RGPIO2P_GPIO6_BASE_ADDR }, }; -U_BOOT_DEVICES(imx_rgpio2ps) = { +U_BOOT_DRVINFOS(imx_rgpio2ps) = { { "imx_rgpio2p", &imx_plat[0] }, { "imx_rgpio2p", &imx_plat[1] }, { "imx_rgpio2p", &imx_plat[2] }, diff --git a/drivers/gpio/intel_broadwell_gpio.c b/drivers/gpio/intel_broadwell_gpio.c index 95f8b2b..68d72ee 100644 --- a/drivers/gpio/intel_broadwell_gpio.c +++ b/drivers/gpio/intel_broadwell_gpio.c @@ -117,7 +117,7 @@ static int broadwell_gpio_get_function(struct udevice *dev, unsigned offset) static int broadwell_gpio_probe(struct udevice *dev) { - struct broadwell_bank_platdata *plat = dev_get_platdata(dev); + struct broadwell_bank_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct broadwell_bank_priv *priv = dev_get_priv(dev); struct udevice *pinctrl; @@ -139,9 +139,9 @@ static int broadwell_gpio_probe(struct udevice *dev) return 0; } -static int broadwell_gpio_ofdata_to_platdata(struct udevice *dev) +static int broadwell_gpio_of_to_plat(struct udevice *dev) { - struct broadwell_bank_platdata *plat = dev_get_platdata(dev); + struct broadwell_bank_plat *plat = dev_get_plat(dev); u32 gpiobase; int bank; int ret; @@ -182,8 +182,8 @@ U_BOOT_DRIVER(gpio_broadwell) = { .id = UCLASS_GPIO, .of_match = intel_broadwell_gpio_ids, .ops = &gpio_broadwell_ops, - .ofdata_to_platdata = broadwell_gpio_ofdata_to_platdata, + .of_to_plat = broadwell_gpio_of_to_plat, .probe = broadwell_gpio_probe, - .priv_auto_alloc_size = sizeof(struct broadwell_bank_priv), - .platdata_auto_alloc_size = sizeof(struct broadwell_bank_platdata), + .priv_auto = sizeof(struct broadwell_bank_priv), + .plat_auto = sizeof(struct broadwell_bank_plat), }; diff --git a/drivers/gpio/intel_gpio.c b/drivers/gpio/intel_gpio.c index c3b67f2..eda9548 100644 --- a/drivers/gpio/intel_gpio.c +++ b/drivers/gpio/intel_gpio.c @@ -164,7 +164,7 @@ static int intel_gpio_probe(struct udevice *dev) return 0; } -static int intel_gpio_ofdata_to_platdata(struct udevice *dev) +static int intel_gpio_of_to_plat(struct udevice *dev) { struct gpio_dev_priv *upriv = dev_get_uclass_priv(dev); struct intel_pinctrl_priv *pinctrl_priv = dev_get_priv(dev->parent); @@ -188,16 +188,18 @@ static const struct dm_gpio_ops gpio_intel_ops = { #endif }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id intel_intel_gpio_ids[] = { { .compatible = "intel,gpio" }, { } }; +#endif U_BOOT_DRIVER(intel_gpio) = { .name = "intel_gpio", .id = UCLASS_GPIO, - .of_match = intel_intel_gpio_ids, + .of_match = of_match_ptr(intel_intel_gpio_ids), .ops = &gpio_intel_ops, - .ofdata_to_platdata = intel_gpio_ofdata_to_platdata, + .of_to_plat = intel_gpio_of_to_plat, .probe = intel_gpio_probe, }; diff --git a/drivers/gpio/intel_ich6_gpio.c b/drivers/gpio/intel_ich6_gpio.c index 73d98fd..11d4be0 100644 --- a/drivers/gpio/intel_ich6_gpio.c +++ b/drivers/gpio/intel_ich6_gpio.c @@ -93,9 +93,9 @@ static int _ich6_gpio_set_direction(uint16_t base, unsigned offset, int dir) return 0; } -static int gpio_ich6_ofdata_to_platdata(struct udevice *dev) +static int gpio_ich6_of_to_plat(struct udevice *dev) { - struct ich6_bank_platdata *plat = dev_get_platdata(dev); + struct ich6_bank_plat *plat = dev_get_plat(dev); u32 gpiobase; int offset; int ret; @@ -119,7 +119,7 @@ static int gpio_ich6_ofdata_to_platdata(struct udevice *dev) static int ich6_gpio_probe(struct udevice *dev) { - struct ich6_bank_platdata *plat = dev_get_platdata(dev); + struct ich6_bank_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct ich6_bank_priv *bank = dev_get_priv(dev); const void *prop; @@ -234,8 +234,8 @@ U_BOOT_DRIVER(gpio_ich6) = { .id = UCLASS_GPIO, .of_match = intel_ich6_gpio_ids, .ops = &gpio_ich6_ops, - .ofdata_to_platdata = gpio_ich6_ofdata_to_platdata, + .of_to_plat = gpio_ich6_of_to_plat, .probe = ich6_gpio_probe, - .priv_auto_alloc_size = sizeof(struct ich6_bank_priv), - .platdata_auto_alloc_size = sizeof(struct ich6_bank_platdata), + .priv_auto = sizeof(struct ich6_bank_priv), + .plat_auto = sizeof(struct ich6_bank_plat), }; diff --git a/drivers/gpio/iproc_gpio.c b/drivers/gpio/iproc_gpio.c index cc26a13..8c143e9 100644 --- a/drivers/gpio/iproc_gpio.c +++ b/drivers/gpio/iproc_gpio.c @@ -55,7 +55,7 @@ struct iproc_gpio_pctrl_map { * @name: gpio device name, ex GPIO0, GPIO1 * @ngpios: total number of gpios */ -struct iproc_gpio_platdata { +struct iproc_gpio_plat { struct udevice *pinctrl_dev; struct list_head gpiomap; void __iomem *base; @@ -73,7 +73,7 @@ struct iproc_gpio_platdata { * @gpio: GPIO pin * @set: set or clear */ -static inline void iproc_gpio_set_bit(struct iproc_gpio_platdata *plat, +static inline void iproc_gpio_set_bit(struct iproc_gpio_plat *plat, u32 reg, u32 gpio, bool set) { u32 offset = GPIO_REG(gpio, reg); @@ -83,7 +83,7 @@ static inline void iproc_gpio_set_bit(struct iproc_gpio_platdata *plat, (set ? BIT(shift) : 0)); } -static inline bool iproc_gpio_get_bit(struct iproc_gpio_platdata *plat, +static inline bool iproc_gpio_get_bit(struct iproc_gpio_plat *plat, u32 reg, u32 gpio) { u32 offset = GPIO_REG(gpio, reg); @@ -98,7 +98,7 @@ static inline bool iproc_gpio_get_bit(struct iproc_gpio_platdata *plat, * @plat: iproc GPIO device * @gpio: GPIO pin */ -static u32 iproc_get_pctrl_from_gpio(struct iproc_gpio_platdata *plat, u32 gpio) +static u32 iproc_get_pctrl_from_gpio(struct iproc_gpio_plat *plat, u32 gpio) { struct iproc_gpio_pctrl_map *range = NULL; struct list_head *pos, *tmp; @@ -127,7 +127,7 @@ static u32 iproc_get_pctrl_from_gpio(struct iproc_gpio_platdata *plat, u32 gpio) */ static int iproc_get_gpio_pctrl_mapping(struct udevice *dev) { - struct iproc_gpio_platdata *plat = dev_get_platdata(dev); + struct iproc_gpio_plat *plat = dev_get_plat(dev); struct iproc_gpio_pctrl_map *range = NULL; struct ofnode_phandle_args args; int index = 0, ret; @@ -153,7 +153,7 @@ static int iproc_get_gpio_pctrl_mapping(struct udevice *dev) static int iproc_gpio_request(struct udevice *dev, u32 gpio, const char *label) { - struct iproc_gpio_platdata *plat = dev_get_platdata(dev); + struct iproc_gpio_plat *plat = dev_get_plat(dev); u32 pctrl; /* nothing to do if there is no corresponding pinctrl device */ @@ -167,7 +167,7 @@ static int iproc_gpio_request(struct udevice *dev, u32 gpio, const char *label) static int iproc_gpio_direction_input(struct udevice *dev, u32 gpio) { - struct iproc_gpio_platdata *plat = dev_get_platdata(dev); + struct iproc_gpio_plat *plat = dev_get_plat(dev); iproc_gpio_set_bit(plat, OUT_EN_OFFSET, gpio, false); dev_dbg(dev, "gpio:%u set input\n", gpio); @@ -177,7 +177,7 @@ static int iproc_gpio_direction_input(struct udevice *dev, u32 gpio) static int iproc_gpio_direction_output(struct udevice *dev, u32 gpio, int value) { - struct iproc_gpio_platdata *plat = dev_get_platdata(dev); + struct iproc_gpio_plat *plat = dev_get_plat(dev); iproc_gpio_set_bit(plat, OUT_EN_OFFSET, gpio, true); iproc_gpio_set_bit(plat, DATA_OUT_OFFSET, gpio, value); @@ -188,7 +188,7 @@ static int iproc_gpio_direction_output(struct udevice *dev, u32 gpio, int value) static int iproc_gpio_get_value(struct udevice *dev, u32 gpio) { - struct iproc_gpio_platdata *plat = dev_get_platdata(dev); + struct iproc_gpio_plat *plat = dev_get_plat(dev); int value; value = iproc_gpio_get_bit(plat, DATA_IN_OFFSET, gpio); @@ -199,7 +199,7 @@ static int iproc_gpio_get_value(struct udevice *dev, u32 gpio) static int iproc_gpio_set_value(struct udevice *dev, u32 gpio, int value) { - struct iproc_gpio_platdata *plat = dev_get_platdata(dev); + struct iproc_gpio_plat *plat = dev_get_plat(dev); if (iproc_gpio_get_bit(plat, OUT_EN_OFFSET, gpio)) iproc_gpio_set_bit(plat, DATA_OUT_OFFSET, gpio, value); @@ -210,7 +210,7 @@ static int iproc_gpio_set_value(struct udevice *dev, u32 gpio, int value) static int iproc_gpio_get_function(struct udevice *dev, u32 gpio) { - struct iproc_gpio_platdata *plat = dev_get_platdata(dev); + struct iproc_gpio_plat *plat = dev_get_plat(dev); if (iproc_gpio_get_bit(plat, OUT_EN_OFFSET, gpio)) return GPIOF_OUTPUT; @@ -218,9 +218,9 @@ static int iproc_gpio_get_function(struct udevice *dev, u32 gpio) return GPIOF_INPUT; } -static int iproc_gpio_ofdata_to_platdata(struct udevice *dev) +static int iproc_gpio_of_to_plat(struct udevice *dev) { - struct iproc_gpio_platdata *plat = dev_get_platdata(dev); + struct iproc_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); int ret; char name[10]; @@ -252,7 +252,7 @@ static int iproc_gpio_ofdata_to_platdata(struct udevice *dev) return ret; } - snprintf(name, sizeof(name), "GPIO%d", dev->req_seq); + snprintf(name, sizeof(name), "GPIO%d", dev_seq(dev)); plat->name = strdup(name); if (!plat->name) return -ENOMEM; @@ -285,6 +285,6 @@ U_BOOT_DRIVER(iproc_gpio) = { .id = UCLASS_GPIO, .of_match = iproc_gpio_ids, .ops = &iproc_gpio_ops, - .ofdata_to_platdata = iproc_gpio_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct iproc_gpio_platdata), + .of_to_plat = iproc_gpio_of_to_plat, + .plat_auto = sizeof(struct iproc_gpio_plat), }; diff --git a/drivers/gpio/lpc32xx_gpio.c b/drivers/gpio/lpc32xx_gpio.c index 1265ee4..de66c76 100644 --- a/drivers/gpio/lpc32xx_gpio.c +++ b/drivers/gpio/lpc32xx_gpio.c @@ -295,7 +295,7 @@ static const struct dm_gpio_ops gpio_lpc32xx_ops = { static int lpc32xx_gpio_probe(struct udevice *dev) { struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev); - struct gpio_dev_priv *uc_priv = dev->uclass_priv; + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); if (dev_of_offset(dev) == -1) { /* Tell the uclass how many GPIOs we have */ @@ -317,5 +317,5 @@ U_BOOT_DRIVER(gpio_lpc32xx) = { .id = UCLASS_GPIO, .ops = &gpio_lpc32xx_ops, .probe = lpc32xx_gpio_probe, - .priv_auto_alloc_size = sizeof(struct lpc32xx_gpio_priv), + .priv_auto = sizeof(struct lpc32xx_gpio_priv), }; diff --git a/drivers/gpio/mpc83xx_spisel_boot.c b/drivers/gpio/mpc83xx_spisel_boot.c index 54dc437..fd26a36 100644 --- a/drivers/gpio/mpc83xx_spisel_boot.c +++ b/drivers/gpio/mpc83xx_spisel_boot.c @@ -61,9 +61,9 @@ static int mpc83xx_spisel_boot_get_function(struct udevice *dev, uint gpio) } #if CONFIG_IS_ENABLED(OF_CONTROL) -static int mpc83xx_spisel_boot_ofdata_to_platdata(struct udevice *dev) +static int mpc83xx_spisel_boot_of_to_plat(struct udevice *dev) { - struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev); + struct mpc8xxx_gpio_plat *plat = dev_get_plat(dev); fdt_addr_t addr; u32 reg[2]; @@ -78,10 +78,10 @@ static int mpc83xx_spisel_boot_ofdata_to_platdata(struct udevice *dev) } #endif -static int mpc83xx_spisel_boot_platdata_to_priv(struct udevice *dev) +static int mpc83xx_spisel_boot_plat_to_priv(struct udevice *dev) { struct mpc83xx_spisel_boot *priv = dev_get_priv(dev); - struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev); + struct mpc8xxx_gpio_plat *plat = dev_get_plat(dev); unsigned long size = plat->size; ulong driver_data = dev_get_driver_data(dev); @@ -107,7 +107,7 @@ static int mpc83xx_spisel_boot_probe(struct udevice *dev) struct mpc83xx_spisel_boot *data = dev_get_priv(dev); char name[32], *str; - mpc83xx_spisel_boot_platdata_to_priv(dev); + mpc83xx_spisel_boot_plat_to_priv(dev); snprintf(name, sizeof(name), "MPC@%lx_", data->addr); str = strdup(name); @@ -140,10 +140,10 @@ U_BOOT_DRIVER(spisel_boot_mpc83xx) = { .id = UCLASS_GPIO, .ops = &mpc83xx_spisel_boot_ops, #if CONFIG_IS_ENABLED(OF_CONTROL) - .ofdata_to_platdata = mpc83xx_spisel_boot_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct mpc8xxx_gpio_plat), + .of_to_plat = mpc83xx_spisel_boot_of_to_plat, + .plat_auto = sizeof(struct mpc8xxx_gpio_plat), .of_match = mpc83xx_spisel_boot_ids, #endif .probe = mpc83xx_spisel_boot_probe, - .priv_auto_alloc_size = sizeof(struct mpc83xx_spisel_boot), + .priv_auto = sizeof(struct mpc83xx_spisel_boot), }; diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c index 27881a7..a964347 100644 --- a/drivers/gpio/mpc8xxx_gpio.c +++ b/drivers/gpio/mpc8xxx_gpio.c @@ -183,15 +183,15 @@ static int mpc8xxx_gpio_get_function(struct udevice *dev, uint gpio) } #if CONFIG_IS_ENABLED(OF_CONTROL) -static int mpc8xxx_gpio_ofdata_to_platdata(struct udevice *dev) +static int mpc8xxx_gpio_of_to_plat(struct udevice *dev) { - struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev); + struct mpc8xxx_gpio_plat *plat = dev_get_plat(dev); struct mpc8xxx_gpio_data *data = dev_get_priv(dev); fdt_addr_t addr; u32 i; u32 reg[4]; - if (ofnode_read_bool(dev->node, "little-endian")) + if (ofnode_read_bool(dev_ofnode(dev), "little-endian")) data->little_endian = true; if (data->little_endian) @@ -219,10 +219,10 @@ static int mpc8xxx_gpio_ofdata_to_platdata(struct udevice *dev) } #endif -static int mpc8xxx_gpio_platdata_to_priv(struct udevice *dev) +static int mpc8xxx_gpio_plat_to_priv(struct udevice *dev) { struct mpc8xxx_gpio_data *priv = dev_get_priv(dev); - struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev); + struct mpc8xxx_gpio_plat *plat = dev_get_plat(dev); unsigned long size = plat->size; ulong driver_data = dev_get_driver_data(dev); @@ -249,7 +249,7 @@ static int mpc8xxx_gpio_probe(struct udevice *dev) struct mpc8xxx_gpio_data *data = dev_get_priv(dev); char name[32], *str; - mpc8xxx_gpio_platdata_to_priv(dev); + mpc8xxx_gpio_plat_to_priv(dev); snprintf(name, sizeof(name), "MPC@%lx_", data->addr); str = strdup(name); @@ -257,7 +257,7 @@ static int mpc8xxx_gpio_probe(struct udevice *dev) if (!str) return -ENOMEM; - if (ofnode_device_is_compatible(dev->node, "fsl,qoriq-gpio")) { + if (ofnode_device_is_compatible(dev_ofnode(dev), "fsl,qoriq-gpio")) { unsigned long gpibe = data->addr + sizeof(struct ccsr_gpio) - sizeof(u32); @@ -294,10 +294,10 @@ U_BOOT_DRIVER(gpio_mpc8xxx) = { .id = UCLASS_GPIO, .ops = &gpio_mpc8xxx_ops, #if CONFIG_IS_ENABLED(OF_CONTROL) - .ofdata_to_platdata = mpc8xxx_gpio_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct mpc8xxx_gpio_plat), + .of_to_plat = mpc8xxx_gpio_of_to_plat, + .plat_auto = sizeof(struct mpc8xxx_gpio_plat), .of_match = mpc8xxx_gpio_ids, #endif .probe = mpc8xxx_gpio_probe, - .priv_auto_alloc_size = sizeof(struct mpc8xxx_gpio_data), + .priv_auto = sizeof(struct mpc8xxx_gpio_data), }; diff --git a/drivers/gpio/mscc_sgpio.c b/drivers/gpio/mscc_sgpio.c index 780d77b..1cbcc43 100644 --- a/drivers/gpio/mscc_sgpio.c +++ b/drivers/gpio/mscc_sgpio.c @@ -275,5 +275,5 @@ U_BOOT_DRIVER(gpio_mscc_sgpio) = { .of_match = mscc_sgpio_ids, .ops = &mscc_sgpio_ops, .probe = mscc_sgpio_probe, - .priv_auto_alloc_size = sizeof(struct mscc_sgpio_priv), + .priv_auto = sizeof(struct mscc_sgpio_priv), }; diff --git a/drivers/gpio/msm_gpio.c b/drivers/gpio/msm_gpio.c index 416fb56..af6c838 100644 --- a/drivers/gpio/msm_gpio.c +++ b/drivers/gpio/msm_gpio.c @@ -101,7 +101,7 @@ static int msm_gpio_probe(struct udevice *dev) return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0; } -static int msm_gpio_ofdata_to_platdata(struct udevice *dev) +static int msm_gpio_of_to_plat(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); @@ -126,8 +126,8 @@ U_BOOT_DRIVER(gpio_msm) = { .name = "gpio_msm", .id = UCLASS_GPIO, .of_match = msm_gpio_ids, - .ofdata_to_platdata = msm_gpio_ofdata_to_platdata, + .of_to_plat = msm_gpio_of_to_plat, .probe = msm_gpio_probe, .ops = &gpio_msm_ops, - .priv_auto_alloc_size = sizeof(struct msm_gpio_bank), + .priv_auto = sizeof(struct msm_gpio_bank), }; diff --git a/drivers/gpio/mt7621_gpio.c b/drivers/gpio/mt7621_gpio.c index 612413e..43bb4df 100644 --- a/drivers/gpio/mt7621_gpio.c +++ b/drivers/gpio/mt7621_gpio.c @@ -38,20 +38,20 @@ enum mediatek_gpio_reg { static void __iomem *mediatek_gpio_membase; -struct mediatek_gpio_platdata { +struct mediatek_gpio_plat { char bank_name[3]; /* Name of bank, e.g. "PA", "PB" etc */ int gpio_count; int bank; }; -static u32 reg_offs(struct mediatek_gpio_platdata *plat, int reg) +static u32 reg_offs(struct mediatek_gpio_plat *plat, int reg) { return (reg * 0x10) + (plat->bank * 0x4); } static int mediatek_gpio_get_value(struct udevice *dev, unsigned int offset) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); return !!(ioread32(mediatek_gpio_membase + reg_offs(plat, GPIO_REG_DATA)) & BIT(offset)); @@ -60,7 +60,7 @@ static int mediatek_gpio_get_value(struct udevice *dev, unsigned int offset) static int mediatek_gpio_set_value(struct udevice *dev, unsigned int offset, int value) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); iowrite32(BIT(offset), mediatek_gpio_membase + reg_offs(plat, value ? GPIO_REG_DSET : GPIO_REG_DCLR)); @@ -70,7 +70,7 @@ static int mediatek_gpio_set_value(struct udevice *dev, unsigned int offset, static int mediatek_gpio_direction_input(struct udevice *dev, unsigned int offset) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); clrbits_le32(mediatek_gpio_membase + reg_offs(plat, GPIO_REG_CTRL), BIT(offset)); @@ -81,7 +81,7 @@ static int mediatek_gpio_direction_input(struct udevice *dev, unsigned int offse static int mediatek_gpio_direction_output(struct udevice *dev, unsigned int offset, int value) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); setbits_le32(mediatek_gpio_membase + reg_offs(plat, GPIO_REG_CTRL), BIT(offset)); @@ -92,7 +92,7 @@ static int mediatek_gpio_direction_output(struct udevice *dev, unsigned int offs static int mediatek_gpio_get_function(struct udevice *dev, unsigned int offset) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); u32 t; t = ioread32(mediatek_gpio_membase + reg_offs(plat, GPIO_REG_CTRL)); @@ -112,7 +112,7 @@ static const struct dm_gpio_ops gpio_mediatek_ops = { static int gpio_mediatek_probe(struct udevice *dev) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); /* Tell the uclass how many GPIOs we have */ @@ -130,7 +130,7 @@ static int gpio_mediatek_probe(struct udevice *dev) */ static int gpio_mediatek_bind(struct udevice *parent) { - struct mediatek_gpio_platdata *plat = parent->platdata; + struct mediatek_gpio_plat *plat = dev_get_plat(parent); ofnode node; int bank = 0; int ret; @@ -145,7 +145,7 @@ static int gpio_mediatek_bind(struct udevice *parent) for (node = dev_read_first_subnode(parent); ofnode_valid(node); node = dev_read_next_subnode(node)) { - struct mediatek_gpio_platdata *plat; + struct mediatek_gpio_plat *plat; struct udevice *dev; plat = calloc(1, sizeof(*plat)); @@ -157,12 +157,11 @@ static int gpio_mediatek_bind(struct udevice *parent) plat->gpio_count = MTK_BANK_WIDTH; plat->bank = bank; - ret = device_bind(parent, parent->driver, - plat->bank_name, plat, -1, &dev); + ret = device_bind(parent, parent->driver, plat->bank_name, plat, + node, &dev); if (ret) return ret; - dev->node = node; bank++; } diff --git a/drivers/gpio/mvebu_gpio.c b/drivers/gpio/mvebu_gpio.c index 65eaa71..4c1c68e 100644 --- a/drivers/gpio/mvebu_gpio.c +++ b/drivers/gpio/mvebu_gpio.c @@ -92,7 +92,7 @@ static int mvebu_gpio_probe(struct udevice *dev) priv->regs = dev_read_addr_ptr(dev); uc_priv->gpio_count = MVEBU_GPIOS_PER_BANK; - priv->name[0] = 'A' + dev->req_seq; + priv->name[0] = 'A' + dev_seq(dev); uc_priv->bank_name = priv->name; return 0; @@ -117,5 +117,5 @@ U_BOOT_DRIVER(gpio_mvebu) = { .of_match = mvebu_gpio_ids, .ops = &mvebu_gpio_ops, .probe = mvebu_gpio_probe, - .priv_auto_alloc_size = sizeof(struct mvebu_gpio_priv), + .priv_auto = sizeof(struct mvebu_gpio_priv), }; diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c index 88b920a..06e6b22 100644 --- a/drivers/gpio/mxc_gpio.c +++ b/drivers/gpio/mxc_gpio.c @@ -281,7 +281,7 @@ static const struct dm_gpio_ops gpio_mxc_ops = { static int mxc_gpio_probe(struct udevice *dev) { struct mxc_bank_info *bank = dev_get_priv(dev); - struct mxc_gpio_plat *plat = dev_get_platdata(dev); + struct mxc_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); int banknum; char name[18], *str; @@ -307,9 +307,9 @@ static int mxc_gpio_probe(struct udevice *dev) return 0; } -static int mxc_gpio_ofdata_to_platdata(struct udevice *dev) +static int mxc_gpio_of_to_plat(struct udevice *dev) { - struct mxc_gpio_plat *plat = dev_get_platdata(dev); + struct mxc_gpio_plat *plat = dev_get_plat(dev); if (!CONFIG_IS_ENABLED(OF_PLATDATA)) { fdt_addr_t addr; addr = dev_read_addr(dev); @@ -318,7 +318,7 @@ static int mxc_gpio_ofdata_to_platdata(struct udevice *dev) plat->regs = (struct gpio_regs *)addr; } - plat->bank_index = dev->req_seq; + plat->bank_index = dev_seq(dev); return 0; } @@ -338,14 +338,14 @@ U_BOOT_DRIVER(gpio_mxc) = { .id = UCLASS_GPIO, .ops = &gpio_mxc_ops, .probe = mxc_gpio_probe, - .ofdata_to_platdata = mxc_gpio_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct mxc_gpio_plat), - .priv_auto_alloc_size = sizeof(struct mxc_bank_info), + .of_to_plat = mxc_gpio_of_to_plat, + .plat_auto = sizeof(struct mxc_gpio_plat), + .priv_auto = sizeof(struct mxc_bank_info), .of_match = mxc_gpio_ids, .bind = mxc_gpio_bind, }; -U_BOOT_DRIVER_ALIAS(gpio_mxc, fsl_imx6q_gpio) +DM_DRIVER_ALIAS(gpio_mxc, fsl_imx6q_gpio) #if !CONFIG_IS_ENABLED(OF_CONTROL) static const struct mxc_gpio_plat mxc_plat[] = { @@ -372,7 +372,7 @@ static const struct mxc_gpio_plat mxc_plat[] = { #endif }; -U_BOOT_DEVICES(mxc_gpios) = { +U_BOOT_DRVINFOS(mxc_gpios) = { { "gpio_mxc", &mxc_plat[0] }, { "gpio_mxc", &mxc_plat[1] }, { "gpio_mxc", &mxc_plat[2] }, diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c index aaabb02..4b2b18f 100644 --- a/drivers/gpio/mxs_gpio.c +++ b/drivers/gpio/mxs_gpio.c @@ -150,7 +150,7 @@ DECLARE_GLOBAL_DATA_PTR; * Bank 4: 0-20 -> 21 PINS */ -struct mxs_gpio_platdata { +struct mxs_gpio_plat { #if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_fsl_imx23_gpio dtplat; #endif @@ -235,7 +235,7 @@ static const struct dm_gpio_ops gpio_mxs_ops = { static int mxs_gpio_probe(struct udevice *dev) { - struct mxs_gpio_platdata *plat = dev_get_platdata(dev); + struct mxs_gpio_plat *plat = dev_get_plat(dev); struct mxs_gpio_priv *priv = dev_get_priv(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); char name[16], *str; @@ -262,9 +262,9 @@ static int mxs_gpio_probe(struct udevice *dev) } #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -static int mxs_ofdata_to_platdata(struct udevice *dev) +static int mxs_of_to_plat(struct udevice *dev) { - struct mxs_gpio_platdata *plat = dev->platdata; + struct mxs_gpio_plat *plat = dev_get_plat(dev); struct fdtdec_phandle_args args; int node = dev_of_offset(dev); int ret; @@ -298,13 +298,13 @@ U_BOOT_DRIVER(fsl_imx23_gpio) = { .id = UCLASS_GPIO, .ops = &gpio_mxs_ops, .probe = mxs_gpio_probe, - .priv_auto_alloc_size = sizeof(struct mxs_gpio_priv), - .platdata_auto_alloc_size = sizeof(struct mxs_gpio_platdata), + .priv_auto = sizeof(struct mxs_gpio_priv), + .plat_auto = sizeof(struct mxs_gpio_plat), #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = mxs_gpio_ids, - .ofdata_to_platdata = mxs_ofdata_to_platdata, + .of_to_plat = mxs_of_to_plat, #endif }; -U_BOOT_DRIVER_ALIAS(fsl_imx23_gpio, fsl_imx28_gpio) +DM_DRIVER_ALIAS(fsl_imx23_gpio, fsl_imx28_gpio) #endif /* DM_GPIO */ diff --git a/drivers/gpio/nx_gpio.c b/drivers/gpio/nx_gpio.c index 5ec73c4..52851e5 100644 --- a/drivers/gpio/nx_gpio.c +++ b/drivers/gpio/nx_gpio.c @@ -36,7 +36,7 @@ struct nx_alive_gpio_regs { u32 pad; /* Alive GPIO Input Value Register */ }; -struct nx_gpio_platdata { +struct nx_gpio_plat { void *regs; int gpio_count; const char *bank_name; @@ -44,7 +44,7 @@ struct nx_gpio_platdata { static int nx_alive_gpio_is_check(struct udevice *dev) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); const char *bank_name = plat->bank_name; if (!strcmp(bank_name, "gpio_alv")) @@ -55,7 +55,7 @@ static int nx_alive_gpio_is_check(struct udevice *dev) static int nx_alive_gpio_direction_input(struct udevice *dev, unsigned int pin) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_alive_gpio_regs *const regs = plat->regs; setbits_le32(®s->outputenb_reset, 1 << pin); @@ -66,7 +66,7 @@ static int nx_alive_gpio_direction_input(struct udevice *dev, unsigned int pin) static int nx_alive_gpio_direction_output(struct udevice *dev, unsigned int pin, int val) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_alive_gpio_regs *const regs = plat->regs; if (val) @@ -81,7 +81,7 @@ static int nx_alive_gpio_direction_output(struct udevice *dev, unsigned int pin, static int nx_alive_gpio_get_value(struct udevice *dev, unsigned int pin) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_alive_gpio_regs *const regs = plat->regs; unsigned int mask = 1UL << pin; unsigned int value; @@ -94,7 +94,7 @@ static int nx_alive_gpio_get_value(struct udevice *dev, unsigned int pin) static int nx_alive_gpio_set_value(struct udevice *dev, unsigned int pin, int val) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_alive_gpio_regs *const regs = plat->regs; if (val) @@ -107,7 +107,7 @@ static int nx_alive_gpio_set_value(struct udevice *dev, unsigned int pin, static int nx_alive_gpio_get_function(struct udevice *dev, unsigned int pin) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_alive_gpio_regs *const regs = plat->regs; unsigned int mask = (1UL << pin); unsigned int output; @@ -122,7 +122,7 @@ static int nx_alive_gpio_get_function(struct udevice *dev, unsigned int pin) static int nx_gpio_direction_input(struct udevice *dev, unsigned int pin) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_gpio_regs *const regs = plat->regs; if (nx_alive_gpio_is_check(dev)) @@ -136,7 +136,7 @@ static int nx_gpio_direction_input(struct udevice *dev, unsigned int pin) static int nx_gpio_direction_output(struct udevice *dev, unsigned int pin, int val) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_gpio_regs *const regs = plat->regs; if (nx_alive_gpio_is_check(dev)) @@ -154,7 +154,7 @@ static int nx_gpio_direction_output(struct udevice *dev, unsigned int pin, static int nx_gpio_get_value(struct udevice *dev, unsigned int pin) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_gpio_regs *const regs = plat->regs; unsigned int mask = 1UL << pin; unsigned int value; @@ -169,7 +169,7 @@ static int nx_gpio_get_value(struct udevice *dev, unsigned int pin) static int nx_gpio_set_value(struct udevice *dev, unsigned int pin, int val) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_gpio_regs *const regs = plat->regs; if (nx_alive_gpio_is_check(dev)) @@ -185,7 +185,7 @@ static int nx_gpio_set_value(struct udevice *dev, unsigned int pin, int val) static int nx_gpio_get_function(struct udevice *dev, unsigned int pin) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); struct nx_gpio_regs *const regs = plat->regs; unsigned int mask = (1UL << pin); unsigned int output; @@ -204,7 +204,7 @@ static int nx_gpio_get_function(struct udevice *dev, unsigned int pin) static int nx_gpio_probe(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); uc_priv->gpio_count = plat->gpio_count; uc_priv->bank_name = plat->bank_name; @@ -212,9 +212,9 @@ static int nx_gpio_probe(struct udevice *dev) return 0; } -static int nx_gpio_ofdata_to_platdata(struct udevice *dev) +static int nx_gpio_of_to_plat(struct udevice *dev) { - struct nx_gpio_platdata *plat = dev_get_platdata(dev); + struct nx_gpio_plat *plat = dev_get_plat(dev); plat->regs = map_physmem(devfdt_get_addr(dev), sizeof(struct nx_gpio_regs), @@ -244,7 +244,7 @@ U_BOOT_DRIVER(nx_gpio) = { .id = UCLASS_GPIO, .of_match = nx_gpio_ids, .ops = &nx_gpio_ops, - .ofdata_to_platdata = nx_gpio_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct nx_gpio_platdata), + .of_to_plat = nx_gpio_of_to_plat, + .plat_auto = sizeof(struct nx_gpio_plat), .probe = nx_gpio_probe, }; diff --git a/drivers/gpio/octeon_gpio.c b/drivers/gpio/octeon_gpio.c index 45acaad..42eae79 100644 --- a/drivers/gpio/octeon_gpio.c +++ b/drivers/gpio/octeon_gpio.c @@ -190,7 +190,7 @@ static int octeon_gpio_probe(struct udevice *dev) GPIO_CONST_GPIOS_MASK; } else { priv->base = dev_remap_addr(dev); - uc_priv->gpio_count = ofnode_read_u32_default(dev->node, + uc_priv->gpio_count = ofnode_read_u32_default(dev_ofnode(dev), "nr-gpios", 32); } @@ -202,7 +202,7 @@ static int octeon_gpio_probe(struct udevice *dev) uc_priv->bank_name = strdup(dev->name); end = strchr(uc_priv->bank_name, '@'); - end[0] = 'A' + dev->seq; + end[0] = 'A' + dev_seq(dev); end[1] = '\0'; debug("%s(%s): base address: %p, pin count: %d\n", @@ -236,7 +236,7 @@ U_BOOT_DRIVER(octeon_gpio) = { .id = UCLASS_GPIO, .of_match = of_match_ptr(octeon_gpio_ids), .probe = octeon_gpio_probe, - .priv_auto_alloc_size = sizeof(struct octeon_gpio), + .priv_auto = sizeof(struct octeon_gpio), .ops = &octeon_gpio_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index 6eaa0a0..336ece4 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -22,6 +22,7 @@ #include <fdtdec.h> #include <asm/gpio.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <linux/errno.h> #include <malloc.h> @@ -285,7 +286,7 @@ static const struct dm_gpio_ops gpio_omap_ops = { static int omap_gpio_probe(struct udevice *dev) { struct gpio_bank *bank = dev_get_priv(dev); - struct omap_gpio_platdata *plat = dev_get_platdata(dev); + struct omap_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); char name[18], *str; @@ -302,7 +303,7 @@ static int omap_gpio_probe(struct udevice *dev) #if !CONFIG_IS_ENABLED(OF_CONTROL) static int omap_gpio_bind(struct udevice *dev) { - struct omap_gpio_platdata *plat = dev_get_platdata(dev); + struct omap_gpio_plat *plat = dev_get_plat(dev); fdt_addr_t base_addr; if (plat) @@ -316,7 +317,7 @@ static int omap_gpio_bind(struct udevice *dev) * TODO: * When every board is converted to driver model and DT is * supported, this can be done by auto-alloc feature, but - * not using calloc to alloc memory for platdata. + * not using calloc to alloc memory for plat. * * For example am33xx_gpio uses platform data rather than device tree. * @@ -328,7 +329,7 @@ static int omap_gpio_bind(struct udevice *dev) plat->base = base_addr; plat->port_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL); - dev->platdata = plat; + dev_set_plat(dev, plat); return 0; } @@ -342,9 +343,9 @@ static const struct udevice_id omap_gpio_ids[] = { { } }; -static int omap_gpio_ofdata_to_platdata(struct udevice *dev) +static int omap_gpio_of_to_plat(struct udevice *dev) { - struct omap_gpio_platdata *plat = dev_get_platdata(dev); + struct omap_gpio_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -362,15 +363,15 @@ U_BOOT_DRIVER(gpio_omap) = { #if CONFIG_IS_ENABLED(OF_CONTROL) #if !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = omap_gpio_ids, - .ofdata_to_platdata = of_match_ptr(omap_gpio_ofdata_to_platdata), - .platdata_auto_alloc_size = sizeof(struct omap_gpio_platdata), + .of_to_plat = of_match_ptr(omap_gpio_of_to_plat), + .plat_auto = sizeof(struct omap_gpio_plat), #endif #else .bind = omap_gpio_bind, #endif .ops = &gpio_omap_ops, .probe = omap_gpio_probe, - .priv_auto_alloc_size = sizeof(struct gpio_bank), + .priv_auto = sizeof(struct gpio_bank), #if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, #endif diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c index fd17d1a..dc8911a 100644 --- a/drivers/gpio/pca953x_gpio.c +++ b/drivers/gpio/pca953x_gpio.c @@ -76,7 +76,7 @@ struct pca953x_info { static int pca953x_write_single(struct udevice *dev, int reg, u8 val, int offset) { - struct pca953x_info *info = dev_get_platdata(dev); + struct pca953x_info *info = dev_get_plat(dev); int bank_shift = fls((info->gpio_count - 1) / BANK_SZ); int off = offset / BANK_SZ; int ret = 0; @@ -93,7 +93,7 @@ static int pca953x_write_single(struct udevice *dev, int reg, u8 val, static int pca953x_read_single(struct udevice *dev, int reg, u8 *val, int offset) { - struct pca953x_info *info = dev_get_platdata(dev); + struct pca953x_info *info = dev_get_plat(dev); int bank_shift = fls((info->gpio_count - 1) / BANK_SZ); int off = offset / BANK_SZ; int ret; @@ -112,7 +112,7 @@ static int pca953x_read_single(struct udevice *dev, int reg, u8 *val, static int pca953x_read_regs(struct udevice *dev, int reg, u8 *val) { - struct pca953x_info *info = dev_get_platdata(dev); + struct pca953x_info *info = dev_get_plat(dev); int ret = 0; if (info->gpio_count <= 8) { @@ -137,7 +137,7 @@ static int pca953x_read_regs(struct udevice *dev, int reg, u8 *val) static int pca953x_write_regs(struct udevice *dev, int reg, u8 *val) { - struct pca953x_info *info = dev_get_platdata(dev); + struct pca953x_info *info = dev_get_plat(dev); int ret = 0; if (info->gpio_count <= 8) { @@ -160,7 +160,7 @@ static int pca953x_write_regs(struct udevice *dev, int reg, u8 *val) static int pca953x_is_output(struct udevice *dev, int offset) { - struct pca953x_info *info = dev_get_platdata(dev); + struct pca953x_info *info = dev_get_plat(dev); int bank = offset / BANK_SZ; int off = offset % BANK_SZ; @@ -185,7 +185,7 @@ static int pca953x_get_value(struct udevice *dev, uint offset) static int pca953x_set_value(struct udevice *dev, uint offset, int value) { - struct pca953x_info *info = dev_get_platdata(dev); + struct pca953x_info *info = dev_get_plat(dev); int bank = offset / BANK_SZ; int off = offset % BANK_SZ; u8 val; @@ -207,7 +207,7 @@ static int pca953x_set_value(struct udevice *dev, uint offset, int value) static int pca953x_set_direction(struct udevice *dev, uint offset, int dir) { - struct pca953x_info *info = dev_get_platdata(dev); + struct pca953x_info *info = dev_get_plat(dev); int bank = offset / BANK_SZ; int off = offset % BANK_SZ; u8 val; @@ -271,7 +271,7 @@ static const struct dm_gpio_ops pca953x_ops = { static int pca953x_probe(struct udevice *dev) { - struct pca953x_info *info = dev_get_platdata(dev); + struct pca953x_info *info = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); char name[32], label[8], *str; int addr; @@ -385,6 +385,6 @@ U_BOOT_DRIVER(pca953x) = { .id = UCLASS_GPIO, .ops = &pca953x_ops, .probe = pca953x_probe, - .platdata_auto_alloc_size = sizeof(struct pca953x_info), + .plat_auto = sizeof(struct pca953x_info), .of_match = pca953x_ids, }; diff --git a/drivers/gpio/pcf8575_gpio.c b/drivers/gpio/pcf8575_gpio.c index 1b9a18f..6d38646 100644 --- a/drivers/gpio/pcf8575_gpio.c +++ b/drivers/gpio/pcf8575_gpio.c @@ -55,7 +55,7 @@ struct pcf8575_chip { static int pcf8575_i2c_write_le16(struct udevice *dev, unsigned int word) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); u8 buf[2] = { word & 0xff, word >> 8, }; int ret; @@ -69,7 +69,7 @@ static int pcf8575_i2c_write_le16(struct udevice *dev, unsigned int word) static int pcf8575_i2c_read_le16(struct udevice *dev) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); u8 buf[2]; int ret; @@ -85,7 +85,7 @@ static int pcf8575_i2c_read_le16(struct udevice *dev) static int pcf8575_direction_input(struct udevice *dev, unsigned offset) { - struct pcf8575_chip *plat = dev_get_platdata(dev); + struct pcf8575_chip *plat = dev_get_plat(dev); int status; plat->out |= BIT(offset); @@ -97,7 +97,7 @@ static int pcf8575_direction_input(struct udevice *dev, unsigned offset) static int pcf8575_direction_output(struct udevice *dev, unsigned int offset, int value) { - struct pcf8575_chip *plat = dev_get_platdata(dev); + struct pcf8575_chip *plat = dev_get_plat(dev); int ret; if (value) @@ -125,9 +125,9 @@ static int pcf8575_set_value(struct udevice *dev, unsigned int offset, return pcf8575_direction_output(dev, offset, value); } -static int pcf8575_ofdata_platdata(struct udevice *dev) +static int pcf8575_ofdata_plat(struct udevice *dev) { - struct pcf8575_chip *plat = dev_get_platdata(dev); + struct pcf8575_chip *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); int n_latch; @@ -175,7 +175,7 @@ U_BOOT_DRIVER(gpio_pcf8575) = { .id = UCLASS_GPIO, .ops = &pcf8575_gpio_ops, .of_match = pcf8575_gpio_ids, - .ofdata_to_platdata = pcf8575_ofdata_platdata, + .of_to_plat = pcf8575_ofdata_plat, .probe = pcf8575_gpio_probe, - .platdata_auto_alloc_size = sizeof(struct pcf8575_chip), + .plat_auto = sizeof(struct pcf8575_chip), }; diff --git a/drivers/gpio/pic32_gpio.c b/drivers/gpio/pic32_gpio.c index bb1ad25..253a9ba 100644 --- a/drivers/gpio/pic32_gpio.c +++ b/drivers/gpio/pic32_gpio.c @@ -161,5 +161,5 @@ U_BOOT_DRIVER(gpio_pic32) = { .of_match = pic32_gpio_ids, .ops = &gpio_pic32_ops, .probe = pic32_gpio_probe, - .priv_auto_alloc_size = sizeof(struct pic32_gpio_priv), + .priv_auto = sizeof(struct pic32_gpio_priv), }; diff --git a/drivers/gpio/pm8916_gpio.c b/drivers/gpio/pm8916_gpio.c index 58f0446..40b0f25 100644 --- a/drivers/gpio/pm8916_gpio.c +++ b/drivers/gpio/pm8916_gpio.c @@ -187,7 +187,7 @@ static int pm8916_gpio_probe(struct udevice *dev) return 0; } -static int pm8916_gpio_ofdata_to_platdata(struct udevice *dev) +static int pm8916_gpio_of_to_plat(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); @@ -209,10 +209,10 @@ U_BOOT_DRIVER(gpio_pm8916) = { .name = "gpio_pm8916", .id = UCLASS_GPIO, .of_match = pm8916_gpio_ids, - .ofdata_to_platdata = pm8916_gpio_ofdata_to_platdata, + .of_to_plat = pm8916_gpio_of_to_plat, .probe = pm8916_gpio_probe, .ops = &pm8916_gpio_ops, - .priv_auto_alloc_size = sizeof(struct pm8916_gpio_bank), + .priv_auto = sizeof(struct pm8916_gpio_bank), }; @@ -272,7 +272,7 @@ static int pm8941_pwrkey_probe(struct udevice *dev) return 0; } -static int pm8941_pwrkey_ofdata_to_platdata(struct udevice *dev) +static int pm8941_pwrkey_of_to_plat(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); @@ -294,8 +294,8 @@ U_BOOT_DRIVER(pwrkey_pm8941) = { .name = "pwrkey_pm8916", .id = UCLASS_GPIO, .of_match = pm8941_pwrkey_ids, - .ofdata_to_platdata = pm8941_pwrkey_ofdata_to_platdata, + .of_to_plat = pm8941_pwrkey_of_to_plat, .probe = pm8941_pwrkey_probe, .ops = &pm8941_pwrkey_ops, - .priv_auto_alloc_size = sizeof(struct pm8916_gpio_bank), + .priv_auto = sizeof(struct pm8916_gpio_bank), }; diff --git a/drivers/gpio/rk_gpio.c b/drivers/gpio/rk_gpio.c index 8cc2885..68f3015 100644 --- a/drivers/gpio/rk_gpio.c +++ b/drivers/gpio/rk_gpio.c @@ -177,6 +177,6 @@ U_BOOT_DRIVER(rockchip_gpio_bank) = { .id = UCLASS_GPIO, .of_match = rockchip_gpio_ids, .ops = &gpio_rockchip_ops, - .priv_auto_alloc_size = sizeof(struct rockchip_gpio_priv), + .priv_auto = sizeof(struct rockchip_gpio_priv), .probe = rockchip_gpio_probe, }; diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c index c78227f..796fe3e 100644 --- a/drivers/gpio/s5p_gpio.c +++ b/drivers/gpio/s5p_gpio.c @@ -34,7 +34,7 @@ DECLARE_GLOBAL_DATA_PTR; #define RATE_SET(gpio) (0x1 << (gpio + 16)) /* Platform data for each bank */ -struct exynos_gpio_platdata { +struct exynos_gpio_plat { struct s5p_gpio_bank *bank; const char *bank_name; /* Name of port, e.g. 'gpa0" */ }; @@ -286,8 +286,8 @@ static const struct dm_gpio_ops gpio_exynos_ops = { static int gpio_exynos_probe(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); - struct exynos_bank_info *priv = dev->priv; - struct exynos_gpio_platdata *plat = dev->platdata; + struct exynos_bank_info *priv = dev_get_priv(dev); + struct exynos_gpio_plat *plat = dev_get_plat(dev); /* Only child devices have ports */ if (!plat) @@ -307,7 +307,7 @@ static int gpio_exynos_probe(struct udevice *dev) */ static int gpio_exynos_bind(struct udevice *parent) { - struct exynos_gpio_platdata *plat = parent->platdata; + struct exynos_gpio_plat *plat = dev_get_plat(parent); struct s5p_gpio_bank *bank, *base; const void *blob = gd->fdt_blob; int node; @@ -320,7 +320,7 @@ static int gpio_exynos_bind(struct udevice *parent) for (node = fdt_first_subnode(blob, dev_of_offset(parent)), bank = base; node > 0; node = fdt_next_subnode(blob, node), bank++) { - struct exynos_gpio_platdata *plat; + struct exynos_gpio_plat *plat; struct udevice *dev; fdt_addr_t reg; int ret; @@ -332,13 +332,11 @@ static int gpio_exynos_bind(struct udevice *parent) return -ENOMEM; plat->bank_name = fdt_get_name(blob, node, NULL); - ret = device_bind(parent, parent->driver, - plat->bank_name, plat, -1, &dev); + ret = device_bind(parent, parent->driver, plat->bank_name, plat, + offset_to_ofnode(node), &dev); if (ret) return ret; - dev_set_of_offset(dev, node); - reg = dev_read_addr(dev); if (reg != FDT_ADDR_T_NONE) bank = (struct s5p_gpio_bank *)((ulong)base + reg); @@ -367,7 +365,7 @@ U_BOOT_DRIVER(gpio_exynos) = { .of_match = exynos_gpio_ids, .bind = gpio_exynos_bind, .probe = gpio_exynos_probe, - .priv_auto_alloc_size = sizeof(struct exynos_bank_info), + .priv_auto = sizeof(struct exynos_bank_info), .ops = &gpio_exynos_ops, }; #endif diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index eb2600d..dc8d506 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -11,6 +11,7 @@ #include <acpi/acpi_device.h> #include <asm/gpio.h> #include <dm/acpi.h> +#include <dm/device-internal.h> #include <dm/device_compat.h> #include <dm/lists.h> #include <dm/of.h> @@ -278,7 +279,7 @@ static const struct dm_gpio_ops gpio_sandbox_ops = { #endif }; -static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev) +static int sandbox_gpio_of_to_plat(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); @@ -293,18 +294,19 @@ static int gpio_sandbox_probe(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) /* Tell the uclass how many GPIOs we have */ uc_priv->gpio_count = CONFIG_SANDBOX_GPIO_COUNT; - dev->priv = calloc(sizeof(struct gpio_state), uc_priv->gpio_count); + dev_set_priv(dev, + calloc(sizeof(struct gpio_state), uc_priv->gpio_count)); return 0; } static int gpio_sandbox_remove(struct udevice *dev) { - free(dev->priv); + free(dev_get_priv(dev)); return 0; } @@ -318,14 +320,14 @@ U_BOOT_DRIVER(sandbox_gpio) = { .name = "sandbox_gpio", .id = UCLASS_GPIO, .of_match = sandbox_gpio_ids, - .ofdata_to_platdata = sandbox_gpio_ofdata_to_platdata, + .of_to_plat = sandbox_gpio_of_to_plat, .probe = gpio_sandbox_probe, .remove = gpio_sandbox_remove, .ops = &gpio_sandbox_ops, ACPI_OPS_PTR(&gpio_sandbox_acpi_ops) }; -U_BOOT_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias) +DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias) /* pincontrol: used only to check GPIO pin configuration (pinmux command) */ @@ -532,6 +534,6 @@ U_BOOT_DRIVER(sandbox_pinctrl_gpio) = { .ops = &sandbox_pinctrl_gpio_ops, .bind = dm_scan_fdt_dev, .probe = sandbox_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct sb_pinctrl_priv), + .priv_auto = sizeof(struct sb_pinctrl_priv), ACPI_OPS_PTR(&pinctrl_sandbox_acpi_ops) }; diff --git a/drivers/gpio/sifive-gpio.c b/drivers/gpio/sifive-gpio.c index bf3537b..abd1f62 100644 --- a/drivers/gpio/sifive-gpio.c +++ b/drivers/gpio/sifive-gpio.c @@ -15,7 +15,7 @@ static int sifive_gpio_probe(struct udevice *dev) { - struct sifive_gpio_platdata *plat = dev_get_platdata(dev); + struct sifive_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); char name[18], *str; @@ -49,7 +49,7 @@ static void sifive_update_gpio_reg(void *bptr, u32 offset, bool value) static int sifive_gpio_direction_input(struct udevice *dev, u32 offset) { - struct sifive_gpio_platdata *plat = dev_get_platdata(dev); + struct sifive_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); if (offset > uc_priv->gpio_count) @@ -65,7 +65,7 @@ static int sifive_gpio_direction_input(struct udevice *dev, u32 offset) static int sifive_gpio_direction_output(struct udevice *dev, u32 offset, int value) { - struct sifive_gpio_platdata *plat = dev_get_platdata(dev); + struct sifive_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); if (offset > uc_priv->gpio_count) @@ -83,7 +83,7 @@ static int sifive_gpio_direction_output(struct udevice *dev, u32 offset, static int sifive_gpio_get_value(struct udevice *dev, u32 offset) { - struct sifive_gpio_platdata *plat = dev_get_platdata(dev); + struct sifive_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); int val; int dir; @@ -104,7 +104,7 @@ static int sifive_gpio_get_value(struct udevice *dev, u32 offset) static int sifive_gpio_set_value(struct udevice *dev, u32 offset, int value) { - struct sifive_gpio_platdata *plat = dev_get_platdata(dev); + struct sifive_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); if (offset > uc_priv->gpio_count) @@ -117,7 +117,7 @@ static int sifive_gpio_set_value(struct udevice *dev, u32 offset, int value) static int sifive_gpio_get_function(struct udevice *dev, unsigned int offset) { - struct sifive_gpio_platdata *plat = dev_get_platdata(dev); + struct sifive_gpio_plat *plat = dev_get_plat(dev); u32 outdir, indir, val; struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); @@ -154,9 +154,9 @@ static const struct dm_gpio_ops sifive_gpio_ops = { .get_function = sifive_gpio_get_function, }; -static int sifive_gpio_ofdata_to_platdata(struct udevice *dev) +static int sifive_gpio_of_to_plat(struct udevice *dev) { - struct sifive_gpio_platdata *plat = dev_get_platdata(dev); + struct sifive_gpio_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -171,8 +171,8 @@ U_BOOT_DRIVER(gpio_sifive) = { .name = "gpio_sifive", .id = UCLASS_GPIO, .of_match = sifive_gpio_match, - .ofdata_to_platdata = of_match_ptr(sifive_gpio_ofdata_to_platdata), - .platdata_auto_alloc_size = sizeof(struct sifive_gpio_platdata), + .of_to_plat = of_match_ptr(sifive_gpio_of_to_plat), + .plat_auto = sizeof(struct sifive_gpio_plat), .ops = &sifive_gpio_ops, .probe = sifive_gpio_probe, }; diff --git a/drivers/gpio/stm32_gpio.c b/drivers/gpio/stm32_gpio.c index 51e1efd..79d55e8 100644 --- a/drivers/gpio/stm32_gpio.c +++ b/drivers/gpio/stm32_gpio.c @@ -342,5 +342,5 @@ U_BOOT_DRIVER(gpio_stm32) = { .probe = gpio_stm32_probe, .ops = &gpio_stm32_ops, .flags = DM_UC_FLAG_SEQ_ALIAS, - .priv_auto_alloc_size = sizeof(struct stm32_gpio_priv), + .priv_auto = sizeof(struct stm32_gpio_priv), }; diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c index 02c3471..7633422 100644 --- a/drivers/gpio/sunxi_gpio.c +++ b/drivers/gpio/sunxi_gpio.c @@ -22,7 +22,7 @@ #define SUNXI_GPIOS_PER_BANK SUNXI_GPIO_A_NR -struct sunxi_gpio_platdata { +struct sunxi_gpio_plat { struct sunxi_gpio *regs; const char *bank_name; /* Name of bank, e.g. "B" */ int gpio_count; @@ -158,7 +158,7 @@ int sunxi_name_to_gpio(const char *name) static int sunxi_gpio_direction_input(struct udevice *dev, unsigned offset) { - struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + struct sunxi_gpio_plat *plat = dev_get_plat(dev); sunxi_gpio_set_cfgbank(plat->regs, offset, SUNXI_GPIO_INPUT); @@ -168,7 +168,7 @@ static int sunxi_gpio_direction_input(struct udevice *dev, unsigned offset) static int sunxi_gpio_direction_output(struct udevice *dev, unsigned offset, int value) { - struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + struct sunxi_gpio_plat *plat = dev_get_plat(dev); u32 num = GPIO_NUM(offset); sunxi_gpio_set_cfgbank(plat->regs, offset, SUNXI_GPIO_OUTPUT); @@ -179,7 +179,7 @@ static int sunxi_gpio_direction_output(struct udevice *dev, unsigned offset, static int sunxi_gpio_get_value(struct udevice *dev, unsigned offset) { - struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + struct sunxi_gpio_plat *plat = dev_get_plat(dev); u32 num = GPIO_NUM(offset); unsigned dat; @@ -192,7 +192,7 @@ static int sunxi_gpio_get_value(struct udevice *dev, unsigned offset) static int sunxi_gpio_set_value(struct udevice *dev, unsigned offset, int value) { - struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + struct sunxi_gpio_plat *plat = dev_get_plat(dev); u32 num = GPIO_NUM(offset); clrsetbits_le32(&plat->regs->dat, 1 << num, value ? (1 << num) : 0); @@ -201,7 +201,7 @@ static int sunxi_gpio_set_value(struct udevice *dev, unsigned offset, static int sunxi_gpio_get_function(struct udevice *dev, unsigned offset) { - struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + struct sunxi_gpio_plat *plat = dev_get_plat(dev); int func; func = sunxi_gpio_get_cfgbank(plat->regs, offset); @@ -260,7 +260,7 @@ static char *gpio_bank_name(int bank) static int gpio_sunxi_probe(struct udevice *dev) { - struct sunxi_gpio_platdata *plat = dev_get_platdata(dev); + struct sunxi_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); /* Tell the uclass how many GPIOs we have */ @@ -285,7 +285,7 @@ static int gpio_sunxi_bind(struct udevice *parent) { struct sunxi_gpio_soc_data *soc_data = (struct sunxi_gpio_soc_data *)dev_get_driver_data(parent); - struct sunxi_gpio_platdata *plat = parent->platdata; + struct sunxi_gpio_plat *plat = dev_get_plat(parent); struct sunxi_gpio_reg *ctlr; int bank, ret; @@ -295,7 +295,7 @@ static int gpio_sunxi_bind(struct udevice *parent) ctlr = dev_read_addr_ptr(parent); for (bank = 0; bank < soc_data->no_banks; bank++) { - struct sunxi_gpio_platdata *plat; + struct sunxi_gpio_plat *plat; struct udevice *dev; plat = calloc(1, sizeof(*plat)); @@ -305,11 +305,10 @@ static int gpio_sunxi_bind(struct udevice *parent) plat->bank_name = gpio_bank_name(soc_data->start + bank); plat->gpio_count = SUNXI_GPIOS_PER_BANK; - ret = device_bind(parent, parent->driver, - plat->bank_name, plat, -1, &dev); + ret = device_bind(parent, parent->driver, plat->bank_name, plat, + dev_ofnode(parent), &dev); if (ret) return ret; - dev_set_of_offset(dev, dev_of_offset(parent)); } return 0; diff --git a/drivers/gpio/tegra186_gpio.c b/drivers/gpio/tegra186_gpio.c index 6626b54..82dcaf9 100644 --- a/drivers/gpio/tegra186_gpio.c +++ b/drivers/gpio/tegra186_gpio.c @@ -26,7 +26,7 @@ struct tegra186_gpio_ctlr_data { uint32_t port_count; }; -struct tegra186_gpio_platdata { +struct tegra186_gpio_plat { const char *name; uint32_t *regs; }; @@ -34,7 +34,7 @@ struct tegra186_gpio_platdata { static uint32_t *tegra186_gpio_reg(struct udevice *dev, uint32_t reg, uint32_t gpio) { - struct tegra186_gpio_platdata *plat = dev->platdata; + struct tegra186_gpio_plat *plat = dev_get_plat(dev); uint32_t index = (reg + (gpio * TEGRA186_GPIO_PER_GPIO_STRIDE)) / 4; return &(plat->regs[index]); @@ -166,7 +166,7 @@ static const struct dm_gpio_ops tegra186_gpio_ops = { */ static int tegra186_gpio_bind(struct udevice *parent) { - struct tegra186_gpio_platdata *parent_plat = parent->platdata; + struct tegra186_gpio_plat *parent_plat = dev_get_plat(parent); struct tegra186_gpio_ctlr_data *ctlr_data = (struct tegra186_gpio_ctlr_data *)dev_get_driver_data(parent); uint32_t *regs; @@ -181,7 +181,7 @@ static int tegra186_gpio_bind(struct udevice *parent) return -EINVAL; for (port = 0; port < ctlr_data->port_count; port++) { - struct tegra186_gpio_platdata *plat; + struct tegra186_gpio_plat *plat; struct udevice *dev; plat = calloc(1, sizeof(*plat)); @@ -191,10 +191,9 @@ static int tegra186_gpio_bind(struct udevice *parent) plat->regs = &(regs[ctlr_data->ports[port].offset / 4]); ret = device_bind(parent, parent->driver, plat->name, plat, - -1, &dev); + dev_ofnode(parent), &dev); if (ret) return ret; - dev_set_of_offset(dev, dev_of_offset(parent)); } return 0; @@ -202,7 +201,7 @@ static int tegra186_gpio_bind(struct udevice *parent) static int tegra186_gpio_probe(struct udevice *dev) { - struct tegra186_gpio_platdata *plat = dev->platdata; + struct tegra186_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); /* Only child devices have ports */ diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c index 912577a..5d3af8a 100644 --- a/drivers/gpio/tegra_gpio.c +++ b/drivers/gpio/tegra_gpio.c @@ -28,7 +28,7 @@ static const int CONFIG_GPIO = 1; static const int DIRECTION_INPUT = 0; static const int DIRECTION_OUTPUT = 1; -struct tegra_gpio_platdata { +struct tegra_gpio_plat { struct gpio_ctlr_bank *bank; const char *port_name; /* Name of port, e.g. "B" */ int base_gpio; /* Port number for this port (0, 1,.., n-1) */ @@ -291,8 +291,8 @@ static const struct udevice_id tegra_gpio_ids[] = { static int gpio_tegra_probe(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); - struct tegra_port_info *priv = dev->priv; - struct tegra_gpio_platdata *plat = dev->platdata; + struct tegra_port_info *priv = dev_get_priv(dev); + struct tegra_gpio_plat *plat = dev_get_plat(dev); /* Only child devices have ports */ if (!plat) @@ -313,7 +313,7 @@ static int gpio_tegra_probe(struct udevice *dev) */ static int gpio_tegra_bind(struct udevice *parent) { - struct tegra_gpio_platdata *plat = parent->platdata; + struct tegra_gpio_plat *plat = dev_get_plat(parent); struct gpio_ctlr *ctlr; int bank_count; int bank; @@ -348,7 +348,7 @@ static int gpio_tegra_bind(struct udevice *parent) int port; for (port = 0; port < TEGRA_PORTS_PER_BANK; port++) { - struct tegra_gpio_platdata *plat; + struct tegra_gpio_plat *plat; struct udevice *dev; int base_port; @@ -361,10 +361,10 @@ static int gpio_tegra_bind(struct udevice *parent) plat->port_name = gpio_port_name(base_port); ret = device_bind(parent, parent->driver, - plat->port_name, plat, -1, &dev); + plat->port_name, plat, + dev_ofnode(parent), &dev); if (ret) return ret; - dev_set_of_offset(dev, dev_of_offset(parent)); } } @@ -377,6 +377,6 @@ U_BOOT_DRIVER(gpio_tegra) = { .of_match = tegra_gpio_ids, .bind = gpio_tegra_bind, .probe = gpio_tegra_probe, - .priv_auto_alloc_size = sizeof(struct tegra_port_info), + .priv_auto = sizeof(struct tegra_port_info), .ops = &gpio_tegra_ops, }; diff --git a/drivers/gpio/vybrid_gpio.c b/drivers/gpio/vybrid_gpio.c index 4efff5c..fcce90c 100644 --- a/drivers/gpio/vybrid_gpio.c +++ b/drivers/gpio/vybrid_gpio.c @@ -93,7 +93,7 @@ static const struct dm_gpio_ops gpio_vybrid_ops = { static int vybrid_gpio_probe(struct udevice *dev) { struct vybrid_gpios *gpios = dev_get_priv(dev); - struct vybrid_gpio_platdata *plat = dev_get_platdata(dev); + struct vybrid_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); uc_priv->bank_name = plat->port_name; @@ -104,9 +104,9 @@ static int vybrid_gpio_probe(struct udevice *dev) return 0; } -static int vybrid_gpio_odata_to_platdata(struct udevice *dev) +static int vybrid_gpio_odata_to_plat(struct udevice *dev) { - struct vybrid_gpio_platdata *plat = dev_get_platdata(dev); + struct vybrid_gpio_plat *plat = dev_get_plat(dev); fdt_addr_t base_addr; base_addr = dev_read_addr(dev); @@ -114,7 +114,7 @@ static int vybrid_gpio_odata_to_platdata(struct udevice *dev) return -EINVAL; plat->base = base_addr; - plat->chip = dev->req_seq; + plat->chip = dev_seq(dev); plat->port_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL); return 0; @@ -130,8 +130,8 @@ U_BOOT_DRIVER(gpio_vybrid) = { .id = UCLASS_GPIO, .ops = &gpio_vybrid_ops, .of_match = vybrid_gpio_ids, - .ofdata_to_platdata = vybrid_gpio_odata_to_platdata, + .of_to_plat = vybrid_gpio_odata_to_plat, .probe = vybrid_gpio_probe, - .priv_auto_alloc_size = sizeof(struct vybrid_gpios), - .platdata_auto_alloc_size = sizeof(struct vybrid_gpio_platdata), + .priv_auto = sizeof(struct vybrid_gpios), + .plat_auto = sizeof(struct vybrid_gpio_plat), }; diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c index 014f120..510838d 100644 --- a/drivers/gpio/xilinx_gpio.c +++ b/drivers/gpio/xilinx_gpio.c @@ -21,7 +21,7 @@ struct gpio_regs { u32 gpiodir; }; -struct xilinx_gpio_platdata { +struct xilinx_gpio_plat { struct gpio_regs *regs; int bank_max[XILINX_GPIO_MAX_BANK]; int bank_input[XILINX_GPIO_MAX_BANK]; @@ -36,13 +36,13 @@ struct xilinx_gpio_privdata { static int xilinx_gpio_get_bank_pin(unsigned offset, u32 *bank_num, u32 *bank_pin_num, struct udevice *dev) { - struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_plat *plat = dev_get_plat(dev); u32 bank, max_pins; /* the first gpio is 0 not 1 */ u32 pin_num = offset; for (bank = 0; bank < XILINX_GPIO_MAX_BANK; bank++) { - max_pins = platdata->bank_max[bank]; + max_pins = plat->bank_max[bank]; if (pin_num < max_pins) { debug("%s: found at bank 0x%x pin 0x%x\n", __func__, bank, pin_num); @@ -59,7 +59,7 @@ static int xilinx_gpio_get_bank_pin(unsigned offset, u32 *bank_num, static int xilinx_gpio_set_value(struct udevice *dev, unsigned offset, int value) { - struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_plat *plat = dev_get_plat(dev); struct xilinx_gpio_privdata *priv = dev_get_priv(dev); int val, ret; u32 bank, pin; @@ -71,14 +71,14 @@ static int xilinx_gpio_set_value(struct udevice *dev, unsigned offset, val = priv->output_val[bank]; debug("%s: regs: %lx, value: %x, gpio: %x, bank %x, pin %x, out %x\n", - __func__, (ulong)platdata->regs, value, offset, bank, pin, val); + __func__, (ulong)plat->regs, value, offset, bank, pin, val); if (value) val = val | (1 << pin); else val = val & ~(1 << pin); - writel(val, &platdata->regs->gpiodata + bank * 2); + writel(val, &plat->regs->gpiodata + bank * 2); priv->output_val[bank] = val; @@ -87,7 +87,7 @@ static int xilinx_gpio_set_value(struct udevice *dev, unsigned offset, static int xilinx_gpio_get_value(struct udevice *dev, unsigned offset) { - struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_plat *plat = dev_get_plat(dev); struct xilinx_gpio_privdata *priv = dev_get_priv(dev); int val, ret; u32 bank, pin; @@ -97,14 +97,14 @@ static int xilinx_gpio_get_value(struct udevice *dev, unsigned offset) return ret; debug("%s: regs: %lx, gpio: %x, bank %x, pin %x\n", __func__, - (ulong)platdata->regs, offset, bank, pin); + (ulong)plat->regs, offset, bank, pin); - if (platdata->bank_output[bank]) { + if (plat->bank_output[bank]) { debug("%s: Read saved output value\n", __func__); val = priv->output_val[bank]; } else { debug("%s: Read input value from reg\n", __func__); - val = readl(&platdata->regs->gpiodata + bank * 2); + val = readl(&plat->regs->gpiodata + bank * 2); } val = !!(val & (1 << pin)); @@ -114,7 +114,7 @@ static int xilinx_gpio_get_value(struct udevice *dev, unsigned offset) static int xilinx_gpio_get_function(struct udevice *dev, unsigned offset) { - struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_plat *plat = dev_get_plat(dev); int val, ret; u32 bank, pin; @@ -123,15 +123,15 @@ static int xilinx_gpio_get_function(struct udevice *dev, unsigned offset) return ret; /* Check if all pins are inputs */ - if (platdata->bank_input[bank]) + if (plat->bank_input[bank]) return GPIOF_INPUT; /* Check if all pins are outputs */ - if (platdata->bank_output[bank]) + if (plat->bank_output[bank]) return GPIOF_OUTPUT; /* FIXME test on dual */ - val = readl(&platdata->regs->gpiodir + bank * 2); + val = readl(&plat->regs->gpiodir + bank * 2); val = !(val & (1 << pin)); /* input is 1 in reg but GPIOF_INPUT is 0 */ @@ -143,7 +143,7 @@ static int xilinx_gpio_get_function(struct udevice *dev, unsigned offset) static int xilinx_gpio_direction_output(struct udevice *dev, unsigned offset, int value) { - struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_plat *plat = dev_get_plat(dev); int val, ret; u32 bank, pin; @@ -152,15 +152,15 @@ static int xilinx_gpio_direction_output(struct udevice *dev, unsigned offset, return ret; /* can't change it if all is input by default */ - if (platdata->bank_input[bank]) + if (plat->bank_input[bank]) return -EINVAL; xilinx_gpio_set_value(dev, offset, value); - if (!platdata->bank_output[bank]) { - val = readl(&platdata->regs->gpiodir + bank * 2); + if (!plat->bank_output[bank]) { + val = readl(&plat->regs->gpiodir + bank * 2); val = val & ~(1 << pin); - writel(val, &platdata->regs->gpiodir + bank * 2); + writel(val, &plat->regs->gpiodir + bank * 2); } return 0; @@ -168,7 +168,7 @@ static int xilinx_gpio_direction_output(struct udevice *dev, unsigned offset, static int xilinx_gpio_direction_input(struct udevice *dev, unsigned offset) { - struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_plat *plat = dev_get_plat(dev); int val, ret; u32 bank, pin; @@ -177,16 +177,16 @@ static int xilinx_gpio_direction_input(struct udevice *dev, unsigned offset) return ret; /* Already input */ - if (platdata->bank_input[bank]) + if (plat->bank_input[bank]) return 0; /* can't change it if all is output by default */ - if (platdata->bank_output[bank]) + if (plat->bank_output[bank]) return -EINVAL; - val = readl(&platdata->regs->gpiodir + bank * 2); + val = readl(&plat->regs->gpiodir + bank * 2); val = val | (1 << pin); - writel(val, &platdata->regs->gpiodir + bank * 2); + writel(val, &plat->regs->gpiodir + bank * 2); return 0; } @@ -194,7 +194,7 @@ static int xilinx_gpio_direction_input(struct udevice *dev, unsigned offset) static int xilinx_gpio_xlate(struct udevice *dev, struct gpio_desc *desc, struct ofnode_phandle_args *args) { - struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_plat *plat = dev_get_plat(dev); desc->offset = args->args[0]; @@ -209,13 +209,13 @@ static int xilinx_gpio_xlate(struct udevice *dev, struct gpio_desc *desc, * add amount of pins in second channel if present. */ if (args->args[1]) { - if (!platdata->bank_max[1]) { + if (!plat->bank_max[1]) { printf("%s: %s has no second channel\n", __func__, dev->name); return -EINVAL; } - desc->offset += platdata->bank_max[0]; + desc->offset += plat->bank_max[0]; } /* The third cell is optional */ @@ -239,7 +239,7 @@ static const struct dm_gpio_ops xilinx_gpio_ops = { static int xilinx_gpio_probe(struct udevice *dev) { - struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_plat *plat = dev_get_plat(dev); struct xilinx_gpio_privdata *priv = dev_get_priv(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); const void *label_ptr; @@ -253,42 +253,38 @@ static int xilinx_gpio_probe(struct udevice *dev) uc_priv->bank_name = dev->name; } - uc_priv->gpio_count = platdata->bank_max[0] + platdata->bank_max[1]; + uc_priv->gpio_count = plat->bank_max[0] + plat->bank_max[1]; - priv->output_val[0] = platdata->dout_default[0]; + priv->output_val[0] = plat->dout_default[0]; - if (platdata->bank_max[1]) - priv->output_val[1] = platdata->dout_default[1]; + if (plat->bank_max[1]) + priv->output_val[1] = plat->dout_default[1]; return 0; } -static int xilinx_gpio_ofdata_to_platdata(struct udevice *dev) +static int xilinx_gpio_of_to_plat(struct udevice *dev) { - struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev); + struct xilinx_gpio_plat *plat = dev_get_plat(dev); int is_dual; - platdata->regs = (struct gpio_regs *)dev_read_addr(dev); + plat->regs = (struct gpio_regs *)dev_read_addr(dev); - platdata->bank_max[0] = dev_read_u32_default(dev, - "xlnx,gpio-width", 0); - platdata->bank_input[0] = dev_read_u32_default(dev, - "xlnx,all-inputs", 0); - platdata->bank_output[0] = dev_read_u32_default(dev, - "xlnx,all-outputs", 0); - platdata->dout_default[0] = dev_read_u32_default(dev, - "xlnx,dout-default", - 0); + plat->bank_max[0] = dev_read_u32_default(dev, "xlnx,gpio-width", 0); + plat->bank_input[0] = dev_read_u32_default(dev, "xlnx,all-inputs", 0); + plat->bank_output[0] = dev_read_u32_default(dev, "xlnx,all-outputs", 0); + plat->dout_default[0] = dev_read_u32_default(dev, "xlnx,dout-default", + 0); is_dual = dev_read_u32_default(dev, "xlnx,is-dual", 0); if (is_dual) { - platdata->bank_max[1] = dev_read_u32_default(dev, - "xlnx,gpio2-width", 0); - platdata->bank_input[1] = dev_read_u32_default(dev, + plat->bank_max[1] = dev_read_u32_default(dev, + "xlnx,gpio2-width", 0); + plat->bank_input[1] = dev_read_u32_default(dev, "xlnx,all-inputs-2", 0); - platdata->bank_output[1] = dev_read_u32_default(dev, + plat->bank_output[1] = dev_read_u32_default(dev, "xlnx,all-outputs-2", 0); - platdata->dout_default[1] = dev_read_u32_default(dev, + plat->dout_default[1] = dev_read_u32_default(dev, "xlnx,dout-default-2", 0); } @@ -305,8 +301,8 @@ U_BOOT_DRIVER(xilinx_gpio) = { .id = UCLASS_GPIO, .ops = &xilinx_gpio_ops, .of_match = xilinx_gpio_ids, - .ofdata_to_platdata = xilinx_gpio_ofdata_to_platdata, + .of_to_plat = xilinx_gpio_of_to_plat, .probe = xilinx_gpio_probe, - .platdata_auto_alloc_size = sizeof(struct xilinx_gpio_platdata), - .priv_auto_alloc_size = sizeof(struct xilinx_gpio_privdata), + .plat_auto = sizeof(struct xilinx_gpio_plat), + .priv_auto = sizeof(struct xilinx_gpio_privdata), }; diff --git a/drivers/gpio/zynq_gpio.c b/drivers/gpio/zynq_gpio.c index d0e90b8..71a5612 100644 --- a/drivers/gpio/zynq_gpio.c +++ b/drivers/gpio/zynq_gpio.c @@ -97,7 +97,7 @@ #define PMC_GPIO_NR_GPIOS 116 #define PMC_GPIO_MAX_BANK 5 -struct zynq_gpio_platdata { +struct zynq_gpio_plat { phys_addr_t base; const struct zynq_platform_data *p_data; }; @@ -193,20 +193,20 @@ static inline void zynq_gpio_get_bank_pin(unsigned int pin_num, unsigned int *bank_pin_num, struct udevice *dev) { - struct zynq_gpio_platdata *platdata = dev_get_platdata(dev); + struct zynq_gpio_plat *plat = dev_get_plat(dev); u32 bank; - for (bank = 0; bank < platdata->p_data->max_bank; bank++) { - if (pin_num >= platdata->p_data->bank_min[bank] && - pin_num <= platdata->p_data->bank_max[bank]) { + for (bank = 0; bank < plat->p_data->max_bank; bank++) { + if (pin_num >= plat->p_data->bank_min[bank] && + pin_num <= plat->p_data->bank_max[bank]) { *bank_num = bank; *bank_pin_num = pin_num - - platdata->p_data->bank_min[bank]; + plat->p_data->bank_min[bank]; return; } } - if (bank >= platdata->p_data->max_bank) { + if (bank >= plat->p_data->max_bank) { printf("Invalid bank and pin num\n"); *bank_num = 0; *bank_pin_num = 0; @@ -215,9 +215,9 @@ static inline void zynq_gpio_get_bank_pin(unsigned int pin_num, static int gpio_is_valid(unsigned gpio, struct udevice *dev) { - struct zynq_gpio_platdata *platdata = dev_get_platdata(dev); + struct zynq_gpio_plat *plat = dev_get_plat(dev); - return gpio < platdata->p_data->ngpio; + return gpio < plat->p_data->ngpio; } static int check_gpio(unsigned gpio, struct udevice *dev) @@ -233,14 +233,14 @@ static int zynq_gpio_get_value(struct udevice *dev, unsigned gpio) { u32 data; unsigned int bank_num, bank_pin_num; - struct zynq_gpio_platdata *platdata = dev_get_platdata(dev); + struct zynq_gpio_plat *plat = dev_get_plat(dev); if (check_gpio(gpio, dev) < 0) return -1; zynq_gpio_get_bank_pin(gpio, &bank_num, &bank_pin_num, dev); - data = readl(platdata->base + + data = readl(plat->base + ZYNQ_GPIO_DATA_RO_OFFSET(bank_num)); return (data >> bank_pin_num) & 1; @@ -249,7 +249,7 @@ static int zynq_gpio_get_value(struct udevice *dev, unsigned gpio) static int zynq_gpio_set_value(struct udevice *dev, unsigned gpio, int value) { unsigned int reg_offset, bank_num, bank_pin_num; - struct zynq_gpio_platdata *platdata = dev_get_platdata(dev); + struct zynq_gpio_plat *plat = dev_get_plat(dev); if (check_gpio(gpio, dev) < 0) return -1; @@ -272,7 +272,7 @@ static int zynq_gpio_set_value(struct udevice *dev, unsigned gpio, int value) value = ~(1 << (bank_pin_num + ZYNQ_GPIO_MID_PIN_NUM)) & ((value << bank_pin_num) | ZYNQ_GPIO_UPPER_MASK); - writel(value, platdata->base + reg_offset); + writel(value, plat->base + reg_offset); return 0; } @@ -281,7 +281,7 @@ static int zynq_gpio_direction_input(struct udevice *dev, unsigned gpio) { u32 reg; unsigned int bank_num, bank_pin_num; - struct zynq_gpio_platdata *platdata = dev_get_platdata(dev); + struct zynq_gpio_plat *plat = dev_get_plat(dev); if (check_gpio(gpio, dev) < 0) return -1; @@ -293,9 +293,9 @@ static int zynq_gpio_direction_input(struct udevice *dev, unsigned gpio) return -1; /* clear the bit in direction mode reg to set the pin as input */ - reg = readl(platdata->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); + reg = readl(plat->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); reg &= ~BIT(bank_pin_num); - writel(reg, platdata->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); + writel(reg, plat->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); return 0; } @@ -305,7 +305,7 @@ static int zynq_gpio_direction_output(struct udevice *dev, unsigned gpio, { u32 reg; unsigned int bank_num, bank_pin_num; - struct zynq_gpio_platdata *platdata = dev_get_platdata(dev); + struct zynq_gpio_plat *plat = dev_get_plat(dev); if (check_gpio(gpio, dev) < 0) return -1; @@ -313,14 +313,14 @@ static int zynq_gpio_direction_output(struct udevice *dev, unsigned gpio, zynq_gpio_get_bank_pin(gpio, &bank_num, &bank_pin_num, dev); /* set the GPIO pin as output */ - reg = readl(platdata->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); + reg = readl(plat->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); reg |= BIT(bank_pin_num); - writel(reg, platdata->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); + writel(reg, plat->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); /* configure the output enable reg for the pin */ - reg = readl(platdata->base + ZYNQ_GPIO_OUTEN_OFFSET(bank_num)); + reg = readl(plat->base + ZYNQ_GPIO_OUTEN_OFFSET(bank_num)); reg |= BIT(bank_pin_num); - writel(reg, platdata->base + ZYNQ_GPIO_OUTEN_OFFSET(bank_num)); + writel(reg, plat->base + ZYNQ_GPIO_OUTEN_OFFSET(bank_num)); /* set the state of the pin */ zynq_gpio_set_value(dev, gpio, value); @@ -331,7 +331,7 @@ static int zynq_gpio_get_function(struct udevice *dev, unsigned offset) { u32 reg; unsigned int bank_num, bank_pin_num; - struct zynq_gpio_platdata *platdata = dev_get_platdata(dev); + struct zynq_gpio_plat *plat = dev_get_plat(dev); if (check_gpio(offset, dev) < 0) return -1; @@ -339,7 +339,7 @@ static int zynq_gpio_get_function(struct udevice *dev, unsigned offset) zynq_gpio_get_bank_pin(offset, &bank_num, &bank_pin_num, dev); /* set the GPIO pin as output */ - reg = readl(platdata->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); + reg = readl(plat->base + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); reg &= BIT(bank_pin_num); if (reg) return GPIOF_OUTPUT; @@ -369,7 +369,7 @@ static const struct udevice_id zynq_gpio_ids[] = { static int zynq_gpio_probe(struct udevice *dev) { - struct zynq_gpio_platdata *platdata = dev_get_platdata(dev); + struct zynq_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); const void *label_ptr; @@ -382,19 +382,19 @@ static int zynq_gpio_probe(struct udevice *dev) uc_priv->bank_name = dev->name; } - if (platdata->p_data) - uc_priv->gpio_count = platdata->p_data->ngpio; + if (plat->p_data) + uc_priv->gpio_count = plat->p_data->ngpio; return 0; } -static int zynq_gpio_ofdata_to_platdata(struct udevice *dev) +static int zynq_gpio_of_to_plat(struct udevice *dev) { - struct zynq_gpio_platdata *platdata = dev_get_platdata(dev); + struct zynq_gpio_plat *plat = dev_get_plat(dev); - platdata->base = (phys_addr_t)dev_read_addr(dev); + plat->base = (phys_addr_t)dev_read_addr(dev); - platdata->p_data = + plat->p_data = (struct zynq_platform_data *)dev_get_driver_data(dev); return 0; @@ -405,7 +405,7 @@ U_BOOT_DRIVER(gpio_zynq) = { .id = UCLASS_GPIO, .ops = &gpio_zynq_ops, .of_match = zynq_gpio_ids, - .ofdata_to_platdata = zynq_gpio_ofdata_to_platdata, + .of_to_plat = zynq_gpio_of_to_plat, .probe = zynq_gpio_probe, - .platdata_auto_alloc_size = sizeof(struct zynq_gpio_platdata), + .plat_auto = sizeof(struct zynq_gpio_plat), }; diff --git a/drivers/hwspinlock/stm32_hwspinlock.c b/drivers/hwspinlock/stm32_hwspinlock.c index 8be585a..fdc1f6f 100644 --- a/drivers/hwspinlock/stm32_hwspinlock.c +++ b/drivers/hwspinlock/stm32_hwspinlock.c @@ -90,5 +90,5 @@ U_BOOT_DRIVER(hwspinlock_stm32mp1) = { .of_match = stm32mp1_hwspinlock_ids, .ops = &stm32mp1_hwspinlock_ops, .probe = stm32mp1_hwspinlock_probe, - .priv_auto_alloc_size = sizeof(struct stm32mp1_hws_priv), + .priv_auto = sizeof(struct stm32mp1_hws_priv), }; diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 3795808..403602f 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -11,7 +11,7 @@ config DM_I2C Enable driver model for I2C. The I2C uclass interface: probe, read, write and speed, is implemented with the bus drivers operations, which provide methods for bus setting and data transfer. Each chip - device (bus child) info is kept as parent platdata. The interface + device (bus child) info is kept as parent plat. The interface is defined in include/i2c.h. config I2C_CROS_EC_TUNNEL diff --git a/drivers/i2c/acpi_i2c.c b/drivers/i2c/acpi_i2c.c index 57d2968..142f411 100644 --- a/drivers/i2c/acpi_i2c.c +++ b/drivers/i2c/acpi_i2c.c @@ -174,7 +174,7 @@ int acpi_i2c_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx) return 0; } -int acpi_i2c_ofdata_to_platdata(struct udevice *dev) +int acpi_i2c_of_to_plat(struct udevice *dev) { struct acpi_i2c_priv *priv = dev_get_priv(dev); @@ -210,7 +210,7 @@ int acpi_i2c_ofdata_to_platdata(struct udevice *dev) /* Use name specified in priv or build one from I2C address */ static int acpi_i2c_get_name(const struct udevice *dev, char *out_name) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); struct acpi_i2c_priv *priv = dev_get_priv(dev); snprintf(out_name, ACPI_NAME_MAX, diff --git a/drivers/i2c/acpi_i2c.h b/drivers/i2c/acpi_i2c.h index 1f4be29..fc6616a 100644 --- a/drivers/i2c/acpi_i2c.h +++ b/drivers/i2c/acpi_i2c.h @@ -10,6 +10,6 @@ extern struct acpi_ops acpi_i2c_ops; -int acpi_i2c_ofdata_to_platdata(struct udevice *dev); +int acpi_i2c_of_to_plat(struct udevice *dev); #endif diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c index 2cdfb55..2d3feca 100644 --- a/drivers/i2c/ast_i2c.c +++ b/drivers/i2c/ast_i2c.c @@ -87,7 +87,7 @@ static void ast_i2c_init_bus(struct udevice *dev) | I2CD_INTR_ABNORMAL, &priv->regs->icr); } -static int ast_i2c_ofdata_to_platdata(struct udevice *dev) +static int ast_i2c_of_to_plat(struct udevice *dev) { struct ast_i2c_priv *priv = dev_get_priv(dev); int ret; @@ -110,7 +110,7 @@ static int ast_i2c_probe(struct udevice *dev) { struct ast2500_scu *scu; - debug("Enabling I2C%u\n", dev->seq); + debug("Enabling I2C%u\n", dev_seq(dev)); /* * Get all I2C devices out of Reset. @@ -307,7 +307,7 @@ static int ast_i2c_set_speed(struct udevice *dev, unsigned int speed) struct ast_i2c_regs *regs = priv->regs; ulong i2c_rate, divider; - debug("Setting speed for I2C%d to <%u>\n", dev->seq, speed); + debug("Setting speed for I2C%d to <%u>\n", dev_seq(dev), speed); if (!speed) { debug("No valid speed specified\n"); return -EINVAL; @@ -351,7 +351,7 @@ U_BOOT_DRIVER(ast_i2c) = { .id = UCLASS_I2C, .of_match = ast_i2c_ids, .probe = ast_i2c_probe, - .ofdata_to_platdata = ast_i2c_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct ast_i2c_priv), + .of_to_plat = ast_i2c_of_to_plat, + .priv_auto = sizeof(struct ast_i2c_priv), .ops = &ast_i2c_ops, }; diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c index 9d6c6d8..3eb6db4 100644 --- a/drivers/i2c/at91_i2c.c +++ b/drivers/i2c/at91_i2c.c @@ -219,7 +219,7 @@ int at91_i2c_get_bus_speed(struct udevice *dev) return bus->speed; } -static int at91_i2c_ofdata_to_platdata(struct udevice *dev) +static int at91_i2c_of_to_plat(struct udevice *dev) { const void *blob = gd->fdt_blob; struct at91_i2c_bus *bus = dev_get_priv(dev); @@ -317,8 +317,8 @@ U_BOOT_DRIVER(i2c_at91) = { .id = UCLASS_I2C, .of_match = at91_i2c_ids, .probe = at91_i2c_probe, - .ofdata_to_platdata = at91_i2c_ofdata_to_platdata, - .per_child_auto_alloc_size = sizeof(struct dm_i2c_chip), - .priv_auto_alloc_size = sizeof(struct at91_i2c_bus), + .of_to_plat = at91_i2c_of_to_plat, + .per_child_auto = sizeof(struct dm_i2c_chip), + .priv_auto = sizeof(struct at91_i2c_bus), .ops = &at91_i2c_ops, }; diff --git a/drivers/i2c/cros_ec_tunnel.c b/drivers/i2c/cros_ec_tunnel.c index a630817..970b91cf 100644 --- a/drivers/i2c/cros_ec_tunnel.c +++ b/drivers/i2c/cros_ec_tunnel.c @@ -29,7 +29,7 @@ static int cros_ec_i2c_xfer(struct udevice *dev, struct i2c_msg *msg, return cros_ec_i2c_tunnel(dev->parent, i2c_bus->remote_bus, msg, nmsgs); } -static int cros_ec_i2c_ofdata_to_platdata(struct udevice *dev) +static int cros_ec_i2c_of_to_plat(struct udevice *dev) { struct cros_ec_i2c_bus *i2c_bus = dev_get_priv(dev); const void *blob = gd->fdt_blob; @@ -55,7 +55,7 @@ U_BOOT_DRIVER(cros_ec_tunnel) = { .name = "cros_ec_tunnel", .id = UCLASS_I2C, .of_match = cros_ec_i2c_ids, - .ofdata_to_platdata = cros_ec_i2c_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct cros_ec_i2c_bus), + .of_to_plat = cros_ec_i2c_of_to_plat, + .priv_auto = sizeof(struct cros_ec_i2c_bus), .ops = &cros_ec_i2c_ops, }; diff --git a/drivers/i2c/davinci_i2c.c b/drivers/i2c/davinci_i2c.c index a54f215..7811aba 100644 --- a/drivers/i2c/davinci_i2c.c +++ b/drivers/i2c/davinci_i2c.c @@ -470,7 +470,7 @@ static int davinci_i2c_probe(struct udevice *dev) { struct i2c_bus *i2c_bus = dev_get_priv(dev); - i2c_bus->id = dev->seq; + i2c_bus->id = dev_seq(dev); i2c_bus->regs = dev_read_addr_ptr(dev); i2c_bus->speed = 100000; @@ -504,7 +504,7 @@ U_BOOT_DRIVER(i2c_davinci) = { .id = UCLASS_I2C, .of_match = davinci_i2c_ids, .probe = davinci_i2c_probe, - .priv_auto_alloc_size = sizeof(struct i2c_bus), + .priv_auto = sizeof(struct i2c_bus), .ops = &davinci_i2c_ops, }; diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index c549895..60111b8 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -762,7 +762,7 @@ static int designware_i2c_probe_chip(struct udevice *bus, uint chip_addr, return ret; } -int designware_i2c_ofdata_to_platdata(struct udevice *bus) +int designware_i2c_of_to_plat(struct udevice *bus) { struct dw_i2c *priv = dev_get_priv(bus); int ret; @@ -842,9 +842,9 @@ U_BOOT_DRIVER(i2c_designware) = { .name = "i2c_designware", .id = UCLASS_I2C, .of_match = designware_i2c_ids, - .ofdata_to_platdata = designware_i2c_ofdata_to_platdata, + .of_to_plat = designware_i2c_of_to_plat, .probe = designware_i2c_probe, - .priv_auto_alloc_size = sizeof(struct dw_i2c), + .priv_auto = sizeof(struct dw_i2c), .remove = designware_i2c_remove, .flags = DM_FLAG_OS_PREPARE, .ops = &designware_i2c_ops, diff --git a/drivers/i2c/designware_i2c.h b/drivers/i2c/designware_i2c.h index 18acf4e..9b2349a 100644 --- a/drivers/i2c/designware_i2c.h +++ b/drivers/i2c/designware_i2c.h @@ -212,7 +212,7 @@ extern const struct dm_i2c_ops designware_i2c_ops; int designware_i2c_probe(struct udevice *bus); int designware_i2c_remove(struct udevice *dev); -int designware_i2c_ofdata_to_platdata(struct udevice *bus); +int designware_i2c_of_to_plat(struct udevice *bus); /** * dw_i2c_gen_speed_config() - Calculate config info from requested speed diff --git a/drivers/i2c/designware_i2c_pci.c b/drivers/i2c/designware_i2c_pci.c index d0d869c..ec0cdf6 100644 --- a/drivers/i2c/designware_i2c_pci.c +++ b/drivers/i2c/designware_i2c_pci.c @@ -34,7 +34,7 @@ static struct dw_scl_sda_cfg byt_config = { /* Have a weak function for now - possibly should be a new uclass */ __weak void lpss_reset_release(void *regs); -static int designware_i2c_pci_ofdata_to_platdata(struct udevice *dev) +static int designware_i2c_pci_of_to_plat(struct udevice *dev) { struct dw_i2c *priv = dev_get_priv(dev); @@ -71,7 +71,7 @@ static int designware_i2c_pci_ofdata_to_platdata(struct udevice *dev) if (dev_get_driver_data(dev) == INTEL_APL) priv->has_spk_cnt = true; - return designware_i2c_ofdata_to_platdata(dev); + return designware_i2c_of_to_plat(dev); } static int designware_i2c_pci_probe(struct udevice *dev) @@ -92,24 +92,10 @@ static int designware_i2c_pci_bind(struct udevice *dev) { char name[20]; - if (dev_of_valid(dev)) + if (dev_has_ofnode(dev)) return 0; - /* - * Create a unique device name for PCI type devices - * ToDo: - * Setting req_seq in the driver is probably not recommended. - * But without a DT alias the number is not configured. And - * using this driver is impossible for PCIe I2C devices. - * This can be removed, once a better (correct) way for this - * is found and implemented. - * - * TODO(sjg@chromium.org): Perhaps if uclasses had platdata this would - * be possible. We cannot use static data in drivers since they may be - * used in SPL or before relocation. - */ - dev->req_seq = uclass_find_next_free_req_seq(UCLASS_I2C); - sprintf(name, "i2c_designware#%u", dev->req_seq); + sprintf(name, "i2c_designware#%u", dev_seq(dev)); device_set_name(dev, name); return 0; @@ -166,7 +152,7 @@ static int dw_i2c_acpi_fill_ssdt(const struct udevice *dev, int ret; /* If no device-tree node, ignore this since we assume it isn't used */ - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) return 0; ret = acpi_device_path(dev, path, sizeof(path)); @@ -211,9 +197,9 @@ U_BOOT_DRIVER(i2c_designware_pci) = { .id = UCLASS_I2C, .of_match = designware_i2c_pci_ids, .bind = designware_i2c_pci_bind, - .ofdata_to_platdata = designware_i2c_pci_ofdata_to_platdata, + .of_to_plat = designware_i2c_pci_of_to_plat, .probe = designware_i2c_pci_probe, - .priv_auto_alloc_size = sizeof(struct dw_i2c), + .priv_auto = sizeof(struct dw_i2c), .remove = designware_i2c_remove, .flags = DM_FLAG_OS_PREPARE, .ops = &designware_i2c_ops, diff --git a/drivers/i2c/exynos_hs_i2c.c b/drivers/i2c/exynos_hs_i2c.c index 5785ade..879ddc6 100644 --- a/drivers/i2c/exynos_hs_i2c.c +++ b/drivers/i2c/exynos_hs_i2c.c @@ -517,7 +517,7 @@ static int s3c24x0_i2c_probe(struct udevice *dev, uint chip, uint chip_flags) return ret != I2C_OK; } -static int s3c_i2c_ofdata_to_platdata(struct udevice *dev) +static int s3c_i2c_of_to_plat(struct udevice *dev) { const void *blob = gd->fdt_blob; struct s3c24x0_i2c_bus *i2c_bus = dev_get_priv(dev); @@ -533,7 +533,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev) dev_read_u32_default(dev, "clock-frequency", I2C_SPEED_STANDARD_RATE); i2c_bus->node = node; - i2c_bus->bus_num = dev->seq; + i2c_bus->bus_num = dev_seq(dev); exynos_pinmux_config(i2c_bus->id, PINMUX_FLAG_HS_MODE); @@ -557,7 +557,7 @@ U_BOOT_DRIVER(hs_i2c) = { .name = "i2c_s3c_hs", .id = UCLASS_I2C, .of_match = exynos_hs_i2c_ids, - .ofdata_to_platdata = s3c_i2c_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct s3c24x0_i2c_bus), + .of_to_plat = s3c_i2c_of_to_plat, + .priv_auto = sizeof(struct s3c24x0_i2c_bus), .ops = &exynos_hs_i2c_ops, }; diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index da93345..875d307 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -573,7 +573,7 @@ static int fsl_i2c_set_bus_speed(struct udevice *bus, uint speed) return __i2c_set_bus_speed(dev->base, speed, dev->i2c_clk); } -static int fsl_i2c_ofdata_to_platdata(struct udevice *bus) +static int fsl_i2c_of_to_plat(struct udevice *bus) { struct fsl_i2c_dev *dev = dev_get_priv(bus); struct clk clock; @@ -649,8 +649,8 @@ U_BOOT_DRIVER(i2c_fsl) = { .id = UCLASS_I2C, .of_match = fsl_i2c_ids, .probe = fsl_i2c_probe, - .ofdata_to_platdata = fsl_i2c_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct fsl_i2c_dev), + .of_to_plat = fsl_i2c_of_to_plat, + .priv_auto = sizeof(struct fsl_i2c_dev), .ops = &fsl_i2c_ops, }; diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c index 7144d39..db3c04f 100644 --- a/drivers/i2c/i2c-cdns.c +++ b/drivers/i2c/i2c-cdns.c @@ -460,7 +460,7 @@ static int cdns_i2c_xfer(struct udevice *dev, struct i2c_msg *msg, return ret; } -static int cdns_i2c_ofdata_to_platdata(struct udevice *dev) +static int cdns_i2c_of_to_plat(struct udevice *dev) { struct i2c_cdns_bus *i2c_bus = dev_get_priv(dev); struct cdns_i2c_platform_data *pdata = @@ -503,7 +503,7 @@ U_BOOT_DRIVER(cdns_i2c) = { .name = "i2c_cdns", .id = UCLASS_I2C, .of_match = cdns_i2c_of_match, - .ofdata_to_platdata = cdns_i2c_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct i2c_cdns_bus), + .of_to_plat = cdns_i2c_of_to_plat, + .priv_auto = sizeof(struct i2c_cdns_bus), .ops = &cdns_i2c_ops, }; diff --git a/drivers/i2c/i2c-cortina.c b/drivers/i2c/i2c-cortina.c index 036fc42..960ae8c 100644 --- a/drivers/i2c/i2c-cortina.c +++ b/drivers/i2c/i2c-cortina.c @@ -322,7 +322,7 @@ static int ca_i2c_probe(struct udevice *bus) return 0; } -static int ca_i2c_ofdata_to_platdata(struct udevice *bus) +static int ca_i2c_of_to_plat(struct udevice *bus) { struct ca_i2c *priv = dev_get_priv(bus); @@ -339,9 +339,9 @@ U_BOOT_DRIVER(i2c_cortina) = { .name = "i2c_cortina", .id = UCLASS_I2C, .of_match = ca_i2c_ids, - .ofdata_to_platdata = ca_i2c_ofdata_to_platdata, + .of_to_plat = ca_i2c_of_to_plat, .probe = ca_i2c_probe, - .priv_auto_alloc_size = sizeof(struct ca_i2c), + .priv_auto = sizeof(struct ca_i2c), .ops = &ca_i2c_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/i2c/i2c-emul-uclass.c b/drivers/i2c/i2c-emul-uclass.c index 84b6a21..085b824 100644 --- a/drivers/i2c/i2c-emul-uclass.c +++ b/drivers/i2c/i2c-emul-uclass.c @@ -14,7 +14,7 @@ * i2c emulation works using an 'emul' node at the bus level. Each device in * that node is in the UCLASS_I2C_EMUL uclass, and emulates one i2c device. A * pointer to the device it emulates is in the 'dev' property of the emul device - * uclass platdata (struct i2c_emul_platdata), put there by i2c_emul_find(). + * uclass plat (struct i2c_emul_plat), put there by i2c_emul_find(). * When sandbox wants an emulator for a device, it calls i2c_emul_find() which * searches for the emulator with the correct address. To find the device for an * emulator, call i2c_emul_get_device(). @@ -24,27 +24,27 @@ */ /** - * struct i2c_emul_uc_platdata - information about the emulator for this device + * struct i2c_emul_uc_plat - information about the emulator for this device * * This is used by devices in UCLASS_I2C_EMUL to record information about the - * device being emulated. It is accessible with dev_get_uclass_platdata() + * device being emulated. It is accessible with dev_get_uclass_plat() * * @dev: Device being emulated */ -struct i2c_emul_uc_platdata { +struct i2c_emul_uc_plat { struct udevice *dev; }; struct udevice *i2c_emul_get_device(struct udevice *emul) { - struct i2c_emul_uc_platdata *uc_plat = dev_get_uclass_platdata(emul); + struct i2c_emul_uc_plat *uc_plat = dev_get_uclass_plat(emul); return uc_plat->dev; } int i2c_emul_find(struct udevice *dev, struct udevice **emulp) { - struct i2c_emul_uc_platdata *uc_plat; + struct i2c_emul_uc_plat *uc_plat; struct udevice *emul; int ret; @@ -54,7 +54,7 @@ int i2c_emul_find(struct udevice *dev, struct udevice **emulp) log_err("No emulators for device '%s'\n", dev->name); return ret; } - uc_plat = dev_get_uclass_platdata(emul); + uc_plat = dev_get_uclass_plat(emul); uc_plat->dev = dev; *emulp = emul; @@ -64,14 +64,13 @@ int i2c_emul_find(struct udevice *dev, struct udevice **emulp) UCLASS_DRIVER(i2c_emul) = { .id = UCLASS_I2C_EMUL, .name = "i2c_emul", - .per_device_platdata_auto_alloc_size = - sizeof(struct i2c_emul_uc_platdata), + .per_device_plat_auto = sizeof(struct i2c_emul_uc_plat), }; /* - * This uclass is a child of the i2c bus. Its platdata is not defined here so + * This uclass is a child of the i2c bus. Its plat is not defined here so * is defined by its parent, UCLASS_I2C, which uses struct dm_i2c_chip. See - * per_child_platdata_auto_alloc_size in UCLASS_DRIVER(i2c). + * per_child_plat_auto in UCLASS_DRIVER(i2c). */ UCLASS_DRIVER(i2c_emul_parent) = { .id = UCLASS_I2C_EMUL_PARENT, diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c index 381938c..387f00b 100644 --- a/drivers/i2c/i2c-gpio.c +++ b/drivers/i2c/i2c-gpio.c @@ -298,7 +298,7 @@ static int i2c_gpio_probe(struct udevice *dev, uint chip, uint chip_flags) i2c_gpio_send_stop(bus, delay); debug("%s: bus: %d (%s) chip: %x flags: %x ret: %d\n", - __func__, dev->seq, dev->name, chip, chip_flags, ret); + __func__, dev_seq(dev), dev->name, chip, chip_flags, ret); return ret; } @@ -329,7 +329,7 @@ static int i2c_gpio_drv_probe(struct udevice *dev) return 0; } -static int i2c_gpio_ofdata_to_platdata(struct udevice *dev) +static int i2c_gpio_of_to_plat(struct udevice *dev) { struct i2c_gpio_bus *bus = dev_get_priv(dev); int ret; @@ -371,7 +371,7 @@ U_BOOT_DRIVER(i2c_gpio) = { .id = UCLASS_I2C, .of_match = i2c_gpio_ids, .probe = i2c_gpio_drv_probe, - .ofdata_to_platdata = i2c_gpio_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct i2c_gpio_bus), + .of_to_plat = i2c_gpio_of_to_plat, + .priv_auto = sizeof(struct i2c_gpio_bus), .ops = &i2c_gpio_ops, }; diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c index 5c4626b..be56785 100644 --- a/drivers/i2c/i2c-uclass.c +++ b/drivers/i2c/i2c-uclass.c @@ -79,7 +79,7 @@ static int i2c_setup_offset(struct dm_i2c_chip *chip, uint offset, static int i2c_read_bytewise(struct udevice *dev, uint offset, uint8_t *buffer, int len) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); struct udevice *bus = dev_get_parent(dev); struct dm_i2c_ops *ops = i2c_get_ops(bus); struct i2c_msg msg[2], *ptr; @@ -108,7 +108,7 @@ static int i2c_read_bytewise(struct udevice *dev, uint offset, static int i2c_write_bytewise(struct udevice *dev, uint offset, const uint8_t *buffer, int len) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); struct udevice *bus = dev_get_parent(dev); struct dm_i2c_ops *ops = i2c_get_ops(bus); struct i2c_msg msg[1]; @@ -131,7 +131,7 @@ static int i2c_write_bytewise(struct udevice *dev, uint offset, int dm_i2c_read(struct udevice *dev, uint offset, uint8_t *buffer, int len) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); struct udevice *bus = dev_get_parent(dev); struct dm_i2c_ops *ops = i2c_get_ops(bus); struct i2c_msg msg[2], *ptr; @@ -162,7 +162,7 @@ int dm_i2c_read(struct udevice *dev, uint offset, uint8_t *buffer, int len) int dm_i2c_write(struct udevice *dev, uint offset, const uint8_t *buffer, int len) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); struct udevice *bus = dev_get_parent(dev); struct dm_i2c_ops *ops = i2c_get_ops(bus); struct i2c_msg msg[1]; @@ -297,7 +297,7 @@ static int i2c_bind_driver(struct udevice *bus, uint chip_addr, uint offset_len, goto err_bind; /* Tell the device what we know about it */ - chip = dev_get_parent_platdata(dev); + chip = dev_get_parent_plat(dev); chip->chip_addr = chip_addr; chip->offset_len = offset_len; ret = device_probe(dev); @@ -328,7 +328,7 @@ int i2c_get_chip(struct udevice *bus, uint chip_addr, uint offset_len, bus->name, chip_addr); for (device_find_first_child(bus, &dev); dev; device_find_next_child(&dev)) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); int ret; if (chip->chip_addr == (chip_addr & @@ -433,7 +433,7 @@ int dm_i2c_get_bus_speed(struct udevice *bus) int i2c_set_chip_flags(struct udevice *dev, uint flags) { struct udevice *bus = dev->parent; - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); struct dm_i2c_ops *ops = i2c_get_ops(bus); int ret; @@ -449,7 +449,7 @@ int i2c_set_chip_flags(struct udevice *dev, uint flags) int i2c_get_chip_flags(struct udevice *dev, uint *flagsp) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); *flagsp = chip->flags; @@ -458,7 +458,7 @@ int i2c_get_chip_flags(struct udevice *dev, uint *flagsp) int i2c_set_chip_offset_len(struct udevice *dev, uint offset_len) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); if (offset_len > I2C_MAX_OFFSET_LEN) return log_ret(-EINVAL); @@ -469,14 +469,14 @@ int i2c_set_chip_offset_len(struct udevice *dev, uint offset_len) int i2c_get_chip_offset_len(struct udevice *dev) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); return chip->offset_len; } int i2c_set_chip_addr_offset_mask(struct udevice *dev, uint mask) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); chip->chip_addr_offset_mask = mask; @@ -485,7 +485,7 @@ int i2c_set_chip_addr_offset_mask(struct udevice *dev, uint mask) uint i2c_get_chip_addr_offset_mask(struct udevice *dev) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); return chip->chip_addr_offset_mask; } @@ -617,7 +617,7 @@ int i2c_deblock(struct udevice *bus) } #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -int i2c_chip_ofdata_to_platdata(struct udevice *dev, struct dm_i2c_chip *chip) +int i2c_chip_of_to_plat(struct udevice *dev, struct dm_i2c_chip *chip) { int addr; @@ -676,37 +676,21 @@ static int i2c_post_probe(struct udevice *dev) static int i2c_child_post_bind(struct udevice *dev) { #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) - struct dm_i2c_chip *plat = dev_get_parent_platdata(dev); + struct dm_i2c_chip *plat = dev_get_parent_plat(dev); - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) return 0; - return i2c_chip_ofdata_to_platdata(dev, plat); + return i2c_chip_of_to_plat(dev, plat); #else return 0; #endif } -struct i2c_priv { - int max_id; -}; - static int i2c_post_bind(struct udevice *dev) { - struct uclass *class = dev->uclass; - struct i2c_priv *priv = class->priv; int ret = 0; - /* Just for sure */ - if (!priv) - return -ENOMEM; - - debug("%s: %s, req_seq=%d\n", __func__, dev->name, dev->req_seq); - - /* if there is no alias ID, use the first free */ - if (dev->req_seq == -1) - dev->req_seq = ++priv->max_id; - - debug("%s: %s, new req_seq=%d\n", __func__, dev->name, dev->req_seq); + debug("%s: %s, seq=%d\n", __func__, dev->name, dev_seq(dev)); #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) ret = dm_scan_fdt_dev(dev); @@ -714,36 +698,15 @@ static int i2c_post_bind(struct udevice *dev) return ret; } -int i2c_uclass_init(struct uclass *class) -{ - struct i2c_priv *priv = class->priv; - - /* Just for sure */ - if (!priv) - return -ENOMEM; - - /* Get the last allocated alias. */ - if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) - priv->max_id = dev_read_alias_highest_id("i2c"); - else - priv->max_id = -1; - - debug("%s: highest alias id is %d\n", __func__, priv->max_id); - - return 0; -} - UCLASS_DRIVER(i2c) = { .id = UCLASS_I2C, .name = "i2c", .flags = DM_UC_FLAG_SEQ_ALIAS, .post_bind = i2c_post_bind, - .init = i2c_uclass_init, - .priv_auto_alloc_size = sizeof(struct i2c_priv), .pre_probe = i2c_pre_probe, .post_probe = i2c_post_probe, - .per_device_auto_alloc_size = sizeof(struct dm_i2c_bus), - .per_child_platdata_auto_alloc_size = sizeof(struct dm_i2c_chip), + .per_device_auto = sizeof(struct dm_i2c_bus), + .per_child_plat_auto = sizeof(struct dm_i2c_chip), .child_post_bind = i2c_child_post_bind, }; @@ -765,8 +728,8 @@ U_BOOT_DRIVER(i2c_generic_chip_drv) = { .id = UCLASS_I2C_GENERIC, .of_match = generic_chip_i2c_ids, #if CONFIG_IS_ENABLED(ACPIGEN) - .ofdata_to_platdata = acpi_i2c_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct acpi_i2c_priv), + .of_to_plat = acpi_i2c_of_to_plat, + .priv_auto = sizeof(struct acpi_i2c_priv), #endif ACPI_OPS_PTR(&acpi_i2c_ops) }; diff --git a/drivers/i2c/i2c-uniphier-f.c b/drivers/i2c/i2c-uniphier-f.c index a110fe9..9d6f168 100644 --- a/drivers/i2c/i2c-uniphier-f.c +++ b/drivers/i2c/i2c-uniphier-f.c @@ -326,6 +326,6 @@ U_BOOT_DRIVER(uniphier_fi2c) = { .id = UCLASS_I2C, .of_match = uniphier_fi2c_of_match, .probe = uniphier_fi2c_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_fi2c_priv), + .priv_auto = sizeof(struct uniphier_fi2c_priv), .ops = &uniphier_fi2c_ops, }; diff --git a/drivers/i2c/i2c-uniphier.c b/drivers/i2c/i2c-uniphier.c index e7f44e1..6eafbee 100644 --- a/drivers/i2c/i2c-uniphier.c +++ b/drivers/i2c/i2c-uniphier.c @@ -214,6 +214,6 @@ U_BOOT_DRIVER(uniphier_i2c) = { .id = UCLASS_I2C, .of_match = uniphier_i2c_of_match, .probe = uniphier_i2c_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_i2c_priv), + .priv_auto = sizeof(struct uniphier_i2c_priv), .ops = &uniphier_i2c_ops, }; diff --git a/drivers/i2c/i2c-versatile.c b/drivers/i2c/i2c-versatile.c index 6283152..0a1a85d 100644 --- a/drivers/i2c/i2c-versatile.c +++ b/drivers/i2c/i2c-versatile.c @@ -252,11 +252,6 @@ static int versatile_i2c_probe(struct udevice *dev) priv->base = (phys_addr_t)dev_read_addr(dev); priv->delay = 25; /* 25us * 4 = 100kHz */ - /* - * U-Boot still doesn't assign automatically - * sequence numbers to devices - */ - dev->req_seq = 1; return 0; } @@ -277,6 +272,6 @@ U_BOOT_DRIVER(versatile_i2c) = { .id = UCLASS_I2C, .of_match = versatile_i2c_of_match, .probe = versatile_i2c_probe, - .priv_auto_alloc_size = sizeof(struct versatile_i2c_priv), + .priv_auto = sizeof(struct versatile_i2c_priv), .ops = &versatile_i2c_ops, }; diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c index cec3853..f91a96a 100644 --- a/drivers/i2c/ihs_i2c.c +++ b/drivers/i2c/ihs_i2c.c @@ -354,7 +354,7 @@ U_BOOT_DRIVER(i2c_ihs) = { .id = UCLASS_I2C, .of_match = ihs_i2c_ids, .probe = ihs_i2c_probe, - .priv_auto_alloc_size = sizeof(struct ihs_i2c_priv), + .priv_auto = sizeof(struct ihs_i2c_priv), .ops = &ihs_i2c_ops, }; diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c index feeed1e..92c5003 100644 --- a/drivers/i2c/imx_lpi2c.c +++ b/drivers/i2c/imx_lpi2c.c @@ -289,7 +289,7 @@ static int bus_i2c_set_bus_speed(struct udevice *bus, int speed) return clock_rate; } } else { - clock_rate = imx_get_i2cclk(bus->seq); + clock_rate = imx_get_i2cclk(dev_seq(bus)); if (!clock_rate) return -EPERM; } @@ -377,7 +377,7 @@ static int bus_i2c_init(struct udevice *bus, int speed) val = readl(®s->mcr) & ~LPI2C_MCR_MEN_MASK; writel(val | LPI2C_MCR_MEN(1), ®s->mcr); - debug("i2c : controller bus %d, speed %d:\n", bus->seq, speed); + debug("i2c : controller bus %d, speed %d:\n", dev_seq(bus), speed); return ret; } @@ -452,11 +452,11 @@ static int imx_lpi2c_probe(struct udevice *bus) return -EINVAL; i2c_bus->base = addr; - i2c_bus->index = bus->seq; + i2c_bus->index = dev_seq(bus); i2c_bus->bus = bus; /* power up i2c resource */ - ret = init_i2c_power(bus->seq); + ret = init_i2c_power(dev_seq(bus)); if (ret) { debug("init_i2c_power err = %d\n", ret); return ret; @@ -486,7 +486,7 @@ static int imx_lpi2c_probe(struct udevice *bus) } } else { /* To i.MX7ULP, only i2c4-7 can be handled by A7 core */ - ret = enable_i2c_clk(1, bus->seq); + ret = enable_i2c_clk(1, dev_seq(bus)); if (ret < 0) return ret; } @@ -496,7 +496,7 @@ static int imx_lpi2c_probe(struct udevice *bus) return ret; debug("i2c : controller bus %d at 0x%lx , speed %d: ", - bus->seq, i2c_bus->base, + dev_seq(bus), i2c_bus->base, i2c_bus->speed); return 0; @@ -519,6 +519,6 @@ U_BOOT_DRIVER(imx_lpi2c) = { .id = UCLASS_I2C, .of_match = imx_lpi2c_ids, .probe = imx_lpi2c_probe, - .priv_auto_alloc_size = sizeof(struct imx_lpi2c_bus), + .priv_auto = sizeof(struct imx_lpi2c_bus), .ops = &imx_lpi2c_ops, }; diff --git a/drivers/i2c/intel_i2c.c b/drivers/i2c/intel_i2c.c index 3b79cb4..52f7a52 100644 --- a/drivers/i2c/intel_i2c.c +++ b/drivers/i2c/intel_i2c.c @@ -269,21 +269,11 @@ static int intel_i2c_probe(struct udevice *dev) static int intel_i2c_bind(struct udevice *dev) { - static int num_cards __attribute__ ((section(".data"))); char name[20]; /* Create a unique device name for PCI type devices */ if (device_is_on_pci_bus(dev)) { - /* - * ToDo: - * Setting req_seq in the driver is probably not recommended. - * But without a DT alias the number is not configured. And - * using this driver is impossible for PCIe I2C devices. - * This can be removed, once a better (correct) way for this - * is found and implemented. - */ - dev->req_seq = num_cards; - sprintf(name, "intel_i2c#%u", num_cards++); + sprintf(name, "intel_i2c#%u", dev_seq(dev)); device_set_name(dev, name); } @@ -306,7 +296,7 @@ U_BOOT_DRIVER(intel_i2c) = { .id = UCLASS_I2C, .of_match = intel_i2c_ids, .ops = &intel_i2c_ops, - .priv_auto_alloc_size = sizeof(struct intel_i2c), + .priv_auto = sizeof(struct intel_i2c), .bind = intel_i2c_bind, .probe = intel_i2c_probe, }; diff --git a/drivers/i2c/iproc_i2c.c b/drivers/i2c/iproc_i2c.c index b7e9ced..83301bb 100644 --- a/drivers/i2c/iproc_i2c.c +++ b/drivers/i2c/iproc_i2c.c @@ -672,7 +672,7 @@ static int iproc_i2c_probe(struct udevice *bus) return iproc_i2c_init(bus); } -static int iproc_i2c_ofdata_to_platdata(struct udevice *bus) +static int iproc_i2c_of_to_plat(struct udevice *bus) { struct iproc_i2c *bus_prvdata = dev_get_priv(bus); int node = dev_of_offset(bus); @@ -705,9 +705,9 @@ U_BOOT_DRIVER(iproc_i2c) = { .name = "iproc_i2c", .id = UCLASS_I2C, .of_match = iproc_i2c_ids, - .ofdata_to_platdata = iproc_i2c_ofdata_to_platdata, + .of_to_plat = iproc_i2c_of_to_plat, .probe = iproc_i2c_probe, - .priv_auto_alloc_size = sizeof(struct iproc_i2c), + .priv_auto = sizeof(struct iproc_i2c), .ops = &iproc_i2c_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/i2c/lpc32xx_i2c.c b/drivers/i2c/lpc32xx_i2c.c index 6af2e97..ad11e97 100644 --- a/drivers/i2c/lpc32xx_i2c.c +++ b/drivers/i2c/lpc32xx_i2c.c @@ -281,8 +281,12 @@ U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_2, lpc32xx_i2c_init, NULL, #else /* CONFIG_DM_I2C */ static int lpc32xx_i2c_probe(struct udevice *bus) { - struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus); - bus->seq = dev->index; + struct lpc32xx_i2c_dev *dev = dev_get_plat(bus); + + /* + * FIXME: This is not permitted + * dev_seq(bus) = dev->index; + */ __i2c_init(dev->base, dev->speed, 0, dev->index); return 0; @@ -291,14 +295,14 @@ static int lpc32xx_i2c_probe(struct udevice *bus) static int lpc32xx_i2c_probe_chip(struct udevice *bus, u32 chip_addr, u32 chip_flags) { - struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus); + struct lpc32xx_i2c_dev *dev = dev_get_plat(bus); return __i2c_probe_chip(dev->base, chip_addr); } static int lpc32xx_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, int nmsgs) { - struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus); + struct lpc32xx_i2c_dev *dev = dev_get_plat(bus); struct i2c_msg *dmsg, *omsg, dummy; uint i = 0, address = 0; @@ -330,13 +334,13 @@ static int lpc32xx_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, static int lpc32xx_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) { - struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus); + struct lpc32xx_i2c_dev *dev = dev_get_plat(bus); return __i2c_set_bus_speed(dev->base, speed, dev->index); } static int lpc32xx_i2c_reset(struct udevice *bus) { - struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus); + struct lpc32xx_i2c_dev *dev = dev_get_plat(bus); __i2c_init(dev->base, dev->speed, 0, dev->index); return 0; diff --git a/drivers/i2c/meson_i2c.c b/drivers/i2c/meson_i2c.c index e070caf..434e346 100644 --- a/drivers/i2c/meson_i2c.c +++ b/drivers/i2c/meson_i2c.c @@ -308,6 +308,6 @@ U_BOOT_DRIVER(i2c_meson) = { .id = UCLASS_I2C, .of_match = meson_i2c_ids, .probe = meson_i2c_probe, - .priv_auto_alloc_size = sizeof(struct meson_i2c), + .priv_auto = sizeof(struct meson_i2c), .ops = &meson_i2c_ops, }; diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c index 584d0a4..928e02b 100644 --- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c +++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c @@ -145,5 +145,5 @@ U_BOOT_DRIVER(i2c_arbitrator) = { .probe = i2c_arbitrator_probe, .remove = i2c_arbitrator_remove, .ops = &i2c_arbitrator_ops, - .priv_auto_alloc_size = sizeof(struct i2c_arbitrator_priv), + .priv_auto = sizeof(struct i2c_arbitrator_priv), }; diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c index 83dcb40..8d6e208 100644 --- a/drivers/i2c/muxes/i2c-mux-gpio.c +++ b/drivers/i2c/muxes/i2c-mux-gpio.c @@ -136,5 +136,5 @@ U_BOOT_DRIVER(i2c_mux_gpio) = { .of_match = i2c_mux_gpio_ids, .ops = &i2c_mux_gpio_ops, .probe = i2c_mux_gpio_probe, - .priv_auto_alloc_size = sizeof(struct i2c_mux_gpio_priv), + .priv_auto = sizeof(struct i2c_mux_gpio_priv), }; diff --git a/drivers/i2c/muxes/i2c-mux-uclass.c b/drivers/i2c/muxes/i2c-mux-uclass.c index 2689755..dbca409 100644 --- a/drivers/i2c/muxes/i2c-mux-uclass.c +++ b/drivers/i2c/muxes/i2c-mux-uclass.c @@ -36,7 +36,7 @@ struct i2c_mux_bus { /* Find out the mux channel number */ static int i2c_mux_child_post_bind(struct udevice *dev) { - struct i2c_mux_bus *plat = dev_get_parent_platdata(dev); + struct i2c_mux_bus *plat = dev_get_parent_plat(dev); int channel; channel = dev_read_u32_default(dev, "reg", -1); @@ -87,8 +87,8 @@ static int i2c_mux_post_bind(struct udevice *mux) ret = device_bind_driver_to_node(mux, "i2c_mux_bus_drv", full_name, node, &dev); - debug(" - bind ret=%d, %s, req_seq %d\n", ret, - dev ? dev->name : NULL, dev->req_seq); + debug(" - bind ret=%d, %s, seq %d\n", ret, + dev ? dev->name : NULL, dev_seq(dev)); if (ret) return ret; } @@ -126,7 +126,7 @@ static int i2c_mux_post_probe(struct udevice *mux) int i2c_mux_select(struct udevice *dev) { - struct i2c_mux_bus *plat = dev_get_parent_platdata(dev); + struct i2c_mux_bus *plat = dev_get_parent_plat(dev); struct udevice *mux = dev->parent; struct i2c_mux_ops *ops = i2c_mux_get_ops(mux); @@ -138,7 +138,7 @@ int i2c_mux_select(struct udevice *dev) int i2c_mux_deselect(struct udevice *dev) { - struct i2c_mux_bus *plat = dev_get_parent_platdata(dev); + struct i2c_mux_bus *plat = dev_get_parent_plat(dev); struct udevice *mux = dev->parent; struct i2c_mux_ops *ops = i2c_mux_get_ops(mux); @@ -220,7 +220,7 @@ UCLASS_DRIVER(i2c_mux) = { .name = "i2c_mux", .post_bind = i2c_mux_post_bind, .post_probe = i2c_mux_post_probe, - .per_device_auto_alloc_size = sizeof(struct i2c_mux), - .per_child_platdata_auto_alloc_size = sizeof(struct i2c_mux_bus), + .per_device_auto = sizeof(struct i2c_mux), + .per_child_plat_auto = sizeof(struct i2c_mux_bus), .child_post_bind = i2c_mux_child_post_bind, }; diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c index 7360e16..d21a84c 100644 --- a/drivers/i2c/muxes/pca954x.c +++ b/drivers/i2c/muxes/pca954x.c @@ -108,7 +108,7 @@ static const struct udevice_id pca954x_ids[] = { { } }; -static int pca954x_ofdata_to_platdata(struct udevice *dev) +static int pca954x_of_to_plat(struct udevice *dev) { struct pca954x_priv *priv = dev_get_priv(dev); const struct chip_desc *chip = &chips[dev_get_driver_data(dev)]; @@ -171,6 +171,6 @@ U_BOOT_DRIVER(pca954x) = { .probe = pca954x_probe, .remove = pca954x_remove, .ops = &pca954x_ops, - .ofdata_to_platdata = pca954x_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct pca954x_priv), + .of_to_plat = pca954x_of_to_plat, + .priv_auto = sizeof(struct pca954x_priv), }; diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c index 82e8fda..ef1007d 100644 --- a/drivers/i2c/mv_i2c.c +++ b/drivers/i2c/mv_i2c.c @@ -600,7 +600,7 @@ U_BOOT_DRIVER(i2c_mv) = { .id = UCLASS_I2C, .of_match = mv_i2c_ids, .probe = mv_i2c_probe, - .priv_auto_alloc_size = sizeof(struct mv_i2c_priv), + .priv_auto = sizeof(struct mv_i2c_priv), .ops = &mv_i2c_ops, }; #endif /* CONFIG_DM_I2C */ diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c index 14c594d..a4d59b6 100644 --- a/drivers/i2c/mvtwsi.c +++ b/drivers/i2c/mvtwsi.c @@ -794,7 +794,7 @@ static int mvtwsi_i2c_set_bus_speed(struct udevice *bus, uint speed) return 0; } -static int mvtwsi_i2c_ofdata_to_platdata(struct udevice *bus) +static int mvtwsi_i2c_of_to_plat(struct udevice *bus) { struct mvtwsi_i2c_dev *dev = dev_get_priv(bus); @@ -823,9 +823,9 @@ static int mvtwsi_i2c_bind(struct udevice *bus) struct mvtwsi_registers *twsi = dev_read_addr_ptr(bus); /* Disable the hidden slave in i2c0 of these platforms */ - if ((IS_ENABLED(CONFIG_ARMADA_38X) || IS_ENABLED(CONFIG_ARCH_KIRKWOOD) - || IS_ENABLED(CONFIG_ARMADA_8K)) - && bus->req_seq == 0) + if ((IS_ENABLED(CONFIG_ARMADA_38X) || + IS_ENABLED(CONFIG_ARCH_KIRKWOOD) || + IS_ENABLED(CONFIG_ARMADA_8K)) && !dev_seq(bus)) twsi_disable_i2c_slave(twsi); return 0; @@ -888,8 +888,8 @@ U_BOOT_DRIVER(i2c_mvtwsi) = { .of_match = mvtwsi_i2c_ids, .bind = mvtwsi_i2c_bind, .probe = mvtwsi_i2c_probe, - .ofdata_to_platdata = mvtwsi_i2c_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct mvtwsi_i2c_dev), + .of_to_plat = mvtwsi_i2c_of_to_plat, + .priv_auto = sizeof(struct mvtwsi_i2c_dev), .ops = &mvtwsi_i2c_ops, }; #endif /* CONFIG_DM_I2C */ diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index d486dab..0362ec6 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -914,7 +914,7 @@ static int mxc_i2c_probe(struct udevice *bus) } i2c_bus->base = addr; - i2c_bus->index = bus->seq; + i2c_bus->index = dev_seq(bus); i2c_bus->bus = bus; /* Enable clk */ @@ -930,7 +930,7 @@ static int mxc_i2c_probe(struct udevice *bus) return ret; } #else - ret = enable_i2c_clk(1, bus->seq); + ret = enable_i2c_clk(1, dev_seq(bus)); if (ret < 0) return ret; #endif @@ -942,7 +942,7 @@ static int mxc_i2c_probe(struct udevice *bus) ret = fdt_stringlist_search(fdt, node, "pinctrl-names", "gpio"); if (ret < 0) { debug("i2c bus %d at 0x%2lx, no gpio pinctrl state.\n", - bus->seq, i2c_bus->base); + dev_seq(bus), i2c_bus->base); } else { ret = gpio_request_by_name_nodev(offset_to_ofnode(node), "scl-gpios", 0, &i2c_bus->scl_gpio, @@ -955,7 +955,7 @@ static int mxc_i2c_probe(struct udevice *bus) ret || ret2) { dev_err(bus, "i2c bus %d at 0x%2lx, fail to request scl/sda gpio\n", - bus->seq, i2c_bus->base); + dev_seq(bus), i2c_bus->base); return -EINVAL; } } @@ -966,7 +966,7 @@ static int mxc_i2c_probe(struct udevice *bus) */ debug("i2c : controller bus %d at %lu , speed %d: ", - bus->seq, i2c_bus->base, + dev_seq(bus), i2c_bus->base, i2c_bus->speed); return 0; @@ -1072,7 +1072,7 @@ U_BOOT_DRIVER(i2c_mxc) = { .id = UCLASS_I2C, .of_match = mxc_i2c_ids, .probe = mxc_i2c_probe, - .priv_auto_alloc_size = sizeof(struct mxc_i2c_bus), + .priv_auto = sizeof(struct mxc_i2c_bus), .ops = &mxc_i2c_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/i2c/nx_i2c.c b/drivers/i2c/nx_i2c.c index ca14a0e..c63a732 100644 --- a/drivers/i2c/nx_i2c.c +++ b/drivers/i2c/nx_i2c.c @@ -240,7 +240,7 @@ static int nx_i2c_probe(struct udevice *dev) return -EINVAL; bus->regs = (struct nx_i2c_regs *)addr; - bus->bus_num = dev->seq; + bus->bus_num = dev_seq(dev); /* i2c node parsing */ i2c_process_node(dev); @@ -621,6 +621,6 @@ U_BOOT_DRIVER(i2c_nexell) = { .id = UCLASS_I2C, .of_match = nx_i2c_ids, .probe = nx_i2c_probe, - .priv_auto_alloc_size = sizeof(struct nx_i2c_bus), + .priv_auto = sizeof(struct nx_i2c_bus), .ops = &nx_i2c_ops, }; diff --git a/drivers/i2c/ocores_i2c.c b/drivers/i2c/ocores_i2c.c index c4f2cc4..48ed1d5 100644 --- a/drivers/i2c/ocores_i2c.c +++ b/drivers/i2c/ocores_i2c.c @@ -632,6 +632,6 @@ U_BOOT_DRIVER(i2c_ocores) = { .id = UCLASS_I2C, .of_match = ocores_i2c_ids, .probe = ocores_i2c_probe, - .priv_auto_alloc_size = sizeof(struct ocores_i2c_bus), + .priv_auto = sizeof(struct ocores_i2c_bus), .ops = &ocores_i2c_ops, }; diff --git a/drivers/i2c/octeon_i2c.c b/drivers/i2c/octeon_i2c.c index 23dcb15..ea2cc33 100644 --- a/drivers/i2c/octeon_i2c.c +++ b/drivers/i2c/octeon_i2c.c @@ -791,7 +791,6 @@ static int octeon_i2c_probe(struct udevice *dev) pci_dev_t bdf = dm_pci_get_bdf(dev); debug("TWSI PCI device: %x\n", bdf); - dev->req_seq = PCI_FUNC(bdf); twsi->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM); @@ -811,7 +810,7 @@ static int octeon_i2c_probe(struct udevice *dev) if (ret) return ret; - debug("TWSI bus %d at %p\n", dev->seq, twsi->base); + debug("TWSI bus %d at %p\n", dev_seq(dev), twsi->base); /* Start with standard speed, real speed set via DT or cmd */ return twsi_init(twsi->base, i2c_slave_addr); @@ -835,6 +834,6 @@ U_BOOT_DRIVER(octeon_pci_twsi) = { .id = UCLASS_I2C, .of_match = octeon_i2c_ids, .probe = octeon_i2c_probe, - .priv_auto_alloc_size = sizeof(struct octeon_twsi), + .priv_auto = sizeof(struct octeon_twsi), .ops = &octeon_i2c_ops, }; diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index 0af4e33..1355dc2 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -1049,7 +1049,7 @@ static int omap_i2c_probe_chip(struct udevice *bus, uint chip_addr, static int omap_i2c_probe(struct udevice *bus) { struct omap_i2c *priv = dev_get_priv(bus); - struct omap_i2c_platdata *plat = dev_get_platdata(bus); + struct omap_i2c_plat *plat = dev_get_plat(bus); priv->speed = plat->speed; priv->regs = map_physmem(plat->base, sizeof(void *), @@ -1063,9 +1063,9 @@ static int omap_i2c_probe(struct udevice *bus) } #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -static int omap_i2c_ofdata_to_platdata(struct udevice *bus) +static int omap_i2c_of_to_plat(struct udevice *bus) { - struct omap_i2c_platdata *plat = dev_get_platdata(bus); + struct omap_i2c_plat *plat = dev_get_plat(bus); plat->base = dev_read_addr(bus); plat->speed = dev_read_u32_default(bus, "clock-frequency", @@ -1093,11 +1093,11 @@ U_BOOT_DRIVER(i2c_omap) = { .id = UCLASS_I2C, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = omap_i2c_ids, - .ofdata_to_platdata = omap_i2c_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct omap_i2c_platdata), + .of_to_plat = omap_i2c_of_to_plat, + .plat_auto = sizeof(struct omap_i2c_plat), #endif .probe = omap_i2c_probe, - .priv_auto_alloc_size = sizeof(struct omap_i2c), + .priv_auto = sizeof(struct omap_i2c), .ops = &omap_i2c_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/i2c/rcar_i2c.c b/drivers/i2c/rcar_i2c.c index 663c342..14bb660 100644 --- a/drivers/i2c/rcar_i2c.c +++ b/drivers/i2c/rcar_i2c.c @@ -371,6 +371,6 @@ U_BOOT_DRIVER(i2c_rcar) = { .id = UCLASS_I2C, .of_match = rcar_i2c_ids, .probe = rcar_i2c_probe, - .priv_auto_alloc_size = sizeof(struct rcar_i2c_priv), + .priv_auto = sizeof(struct rcar_i2c_priv), .ops = &rcar_i2c_ops, }; diff --git a/drivers/i2c/rcar_iic.c b/drivers/i2c/rcar_iic.c index cad0a62..f0e5091 100644 --- a/drivers/i2c/rcar_iic.c +++ b/drivers/i2c/rcar_iic.c @@ -269,6 +269,6 @@ U_BOOT_DRIVER(iic_rcar) = { .id = UCLASS_I2C, .of_match = rcar_iic_ids, .probe = rcar_iic_probe, - .priv_auto_alloc_size = sizeof(struct rcar_iic_priv), + .priv_auto = sizeof(struct rcar_iic_priv), .ops = &rcar_iic_ops, }; diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c index 6594610..f8fac45 100644 --- a/drivers/i2c/rk_i2c.c +++ b/drivers/i2c/rk_i2c.c @@ -375,7 +375,7 @@ int rockchip_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) return 0; } -static int rockchip_i2c_ofdata_to_platdata(struct udevice *bus) +static int rockchip_i2c_of_to_plat(struct udevice *bus) { struct rk_i2c *priv = dev_get_priv(bus); int ret; @@ -489,10 +489,10 @@ U_BOOT_DRIVER(rockchip_rk3066_i2c) = { .name = "rockchip_rk3066_i2c", .id = UCLASS_I2C, .of_match = rockchip_i2c_ids, - .ofdata_to_platdata = rockchip_i2c_ofdata_to_platdata, + .of_to_plat = rockchip_i2c_of_to_plat, .probe = rockchip_i2c_probe, - .priv_auto_alloc_size = sizeof(struct rk_i2c), + .priv_auto = sizeof(struct rk_i2c), .ops = &rockchip_i2c_ops, }; -U_BOOT_DRIVER_ALIAS(rockchip_rk3066_i2c, rockchip_rk3288_i2c) +DM_DRIVER_ALIAS(rockchip_rk3066_i2c, rockchip_rk3288_i2c) diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c index cb45d3c..0c89156 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -302,7 +302,7 @@ static int s3c24x0_i2c_xfer(struct udevice *dev, struct i2c_msg *msg, return ret ? -EREMOTEIO : 0; } -static int s3c_i2c_ofdata_to_platdata(struct udevice *dev) +static int s3c_i2c_of_to_plat(struct udevice *dev) { const void *blob = gd->fdt_blob; struct s3c24x0_i2c_bus *i2c_bus = dev_get_priv(dev); @@ -318,7 +318,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev) dev_read_u32_default(dev, "clock-frequency", I2C_SPEED_STANDARD_RATE); i2c_bus->node = node; - i2c_bus->bus_num = dev->seq; + i2c_bus->bus_num = dev_seq(dev); exynos_pinmux_config(i2c_bus->id, 0); @@ -342,7 +342,7 @@ U_BOOT_DRIVER(i2c_s3c) = { .name = "i2c_s3c", .id = UCLASS_I2C, .of_match = s3c_i2c_ids, - .ofdata_to_platdata = s3c_i2c_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct s3c24x0_i2c_bus), + .of_to_plat = s3c_i2c_of_to_plat, + .priv_auto = sizeof(struct s3c24x0_i2c_bus), .ops = &s3c_i2c_ops, }; diff --git a/drivers/i2c/sandbox_i2c.c b/drivers/i2c/sandbox_i2c.c index 2cbdaf9..c99e6de 100644 --- a/drivers/i2c/sandbox_i2c.c +++ b/drivers/i2c/sandbox_i2c.c @@ -10,15 +10,12 @@ #include <errno.h> #include <i2c.h> #include <log.h> +#include <asm/i2c.h> #include <asm/test.h> #include <dm/acpi.h> #include <dm/lists.h> #include <dm/device-internal.h> -struct sandbox_i2c_priv { - bool test_mode; -}; - static int get_emul(struct udevice *dev, struct udevice **devp, struct dm_i2c_ops **opsp) { @@ -27,7 +24,7 @@ static int get_emul(struct udevice *dev, struct udevice **devp, *devp = NULL; *opsp = NULL; - plat = dev_get_parent_platdata(dev); + plat = dev_get_parent_plat(dev); if (!plat->emul) { ret = i2c_emul_find(dev, &plat->emul); if (ret) @@ -98,5 +95,5 @@ U_BOOT_DRIVER(sandbox_i2c) = { .id = UCLASS_I2C, .of_match = sandbox_i2c_ids, .ops = &sandbox_i2c_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_i2c_priv), + .priv_auto = sizeof(struct sandbox_i2c_priv), }; diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 2f60911..6553bdc 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -901,7 +901,7 @@ clk_free: return ret; } -static int stm32_ofdata_to_platdata(struct udevice *dev) +static int stm32_of_to_plat(struct udevice *dev) { struct stm32_i2c_priv *i2c_priv = dev_get_priv(dev); u32 rise_time, fall_time; @@ -953,8 +953,8 @@ U_BOOT_DRIVER(stm32f7_i2c) = { .name = "stm32f7-i2c", .id = UCLASS_I2C, .of_match = stm32_i2c_of_match, - .ofdata_to_platdata = stm32_ofdata_to_platdata, + .of_to_plat = stm32_of_to_plat, .probe = stm32_i2c_probe, - .priv_auto_alloc_size = sizeof(struct stm32_i2c_priv), + .priv_auto = sizeof(struct stm32_i2c_priv), .ops = &stm32_i2c_ops, }; diff --git a/drivers/i2c/tegra186_bpmp_i2c.c b/drivers/i2c/tegra186_bpmp_i2c.c index 3720471..88e4e9a 100644 --- a/drivers/i2c/tegra186_bpmp_i2c.c +++ b/drivers/i2c/tegra186_bpmp_i2c.c @@ -122,6 +122,6 @@ U_BOOT_DRIVER(i2c_gpio) = { .id = UCLASS_I2C, .of_match = tegra186_bpmp_i2c_ids, .probe = tegra186_bpmp_i2c_probe, - .priv_auto_alloc_size = sizeof(struct tegra186_bpmp_i2c), + .priv_auto = sizeof(struct tegra186_bpmp_i2c), .ops = &tegra186_bpmp_i2c_ops, }; diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c index 65b3734..1e74484 100644 --- a/drivers/i2c/tegra_i2c.c +++ b/drivers/i2c/tegra_i2c.c @@ -362,7 +362,7 @@ static int tegra_i2c_probe(struct udevice *dev) int ret; bool is_dvc; - i2c_bus->id = dev->seq; + i2c_bus->id = dev_seq(dev); i2c_bus->type = dev_get_driver_data(dev); i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr(dev); if ((ulong)i2c_bus->regs == FDT_ADDR_T_NONE) { @@ -408,7 +408,8 @@ static int tegra_i2c_probe(struct udevice *dev) } i2c_init_controller(i2c_bus); debug("%s: controller bus %d at %p, speed %d: ", - is_dvc ? "dvc" : "i2c", dev->seq, i2c_bus->regs, i2c_bus->speed); + is_dvc ? "dvc" : "i2c", dev_seq(dev), i2c_bus->regs, + i2c_bus->speed); return 0; } @@ -523,6 +524,6 @@ U_BOOT_DRIVER(i2c_tegra) = { .id = UCLASS_I2C, .of_match = tegra_i2c_ids, .probe = tegra_i2c_probe, - .priv_auto_alloc_size = sizeof(struct i2c_bus), + .priv_auto = sizeof(struct i2c_bus), .ops = &tegra_i2c_ops, }; diff --git a/drivers/i2c/xilinx_xiic.c b/drivers/i2c/xilinx_xiic.c index 149bd32..72199a6 100644 --- a/drivers/i2c/xilinx_xiic.c +++ b/drivers/i2c/xilinx_xiic.c @@ -348,6 +348,6 @@ U_BOOT_DRIVER(xilinx_xiic) = { .id = UCLASS_I2C, .of_match = xilinx_xiic_ids, .probe = xilinx_xiic_probe, - .priv_auto_alloc_size = sizeof(struct xilinx_xiic_priv), + .priv_auto = sizeof(struct xilinx_xiic_priv), .ops = &xilinx_xiic_ops, }; diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c index 0c0f522..dc3b08c 100644 --- a/drivers/input/cros_ec_keyb.c +++ b/drivers/input/cros_ec_keyb.c @@ -251,5 +251,5 @@ U_BOOT_DRIVER(google_cros_ec_keyb) = { .of_match = cros_ec_kbd_ids, .probe = cros_ec_kbd_probe, .ops = &cros_ec_kbd_ops, - .priv_auto_alloc_size = sizeof(struct cros_ec_keyb_priv), + .priv_auto = sizeof(struct cros_ec_keyb_priv), }; diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c index 7beaccc..1ea11fd 100644 --- a/drivers/input/i8042.c +++ b/drivers/input/i8042.c @@ -357,5 +357,5 @@ U_BOOT_DRIVER(i8042_kbd) = { .probe = i8042_kbd_probe, .remove = i8042_kbd_remove, .ops = &i8042_kbd_ops, - .priv_auto_alloc_size = sizeof(struct i8042_kbd_priv), + .priv_auto = sizeof(struct i8042_kbd_priv), }; diff --git a/drivers/input/keyboard-uclass.c b/drivers/input/keyboard-uclass.c index f19934e..2c66803 100644 --- a/drivers/input/keyboard-uclass.c +++ b/drivers/input/keyboard-uclass.c @@ -87,5 +87,5 @@ UCLASS_DRIVER(keyboard) = { .id = UCLASS_KEYBOARD, .name = "keyboard", .pre_probe = keyboard_pre_probe, - .per_device_auto_alloc_size = sizeof(struct keyboard_priv), + .per_device_auto = sizeof(struct keyboard_priv), }; diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c index f07a51d..5113041 100644 --- a/drivers/input/tegra-kbc.c +++ b/drivers/input/tegra-kbc.c @@ -350,5 +350,5 @@ U_BOOT_DRIVER(tegra_kbd) = { .of_match = tegra_kbd_ids, .probe = tegra_kbd_probe, .ops = &tegra_kbd_ops, - .priv_auto_alloc_size = sizeof(struct tegra_kbd_priv), + .priv_auto = sizeof(struct tegra_kbd_priv), }; diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index 2859475..e15a296 100644 --- a/drivers/led/led-uclass.c +++ b/drivers/led/led-uclass.c @@ -22,7 +22,7 @@ int led_get_by_label(const char *label, struct udevice **devp) if (ret) return ret; uclass_foreach_dev(dev, uc) { - struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev); + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Ignore the top-level LED node */ if (uc_plat->label && !strcmp(label, uc_plat->label)) @@ -96,5 +96,5 @@ int led_default_state(void) UCLASS_DRIVER(led) = { .id = UCLASS_LED, .name = "led", - .per_device_platdata_auto_alloc_size = sizeof(struct led_uc_plat), + .per_device_plat_auto = sizeof(struct led_uc_plat), }; diff --git a/drivers/led/led_bcm6328.c b/drivers/led/led_bcm6328.c index 5294683..bf8207d 100644 --- a/drivers/led/led_bcm6328.c +++ b/drivers/led/led_bcm6328.c @@ -147,7 +147,7 @@ static const struct led_ops bcm6328_led_ops = { static int bcm6328_led_probe(struct udevice *dev) { - struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev); + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Top-level LED node */ if (!uc_plat->label) { @@ -222,7 +222,7 @@ static int bcm6328_led_bind(struct udevice *parent) if (ret) return ret; - uc_plat = dev_get_uclass_platdata(dev); + uc_plat = dev_get_uclass_plat(dev); uc_plat->label = label; } @@ -241,5 +241,5 @@ U_BOOT_DRIVER(bcm6328_led) = { .ops = &bcm6328_led_ops, .bind = bcm6328_led_bind, .probe = bcm6328_led_probe, - .priv_auto_alloc_size = sizeof(struct bcm6328_led_priv), + .priv_auto = sizeof(struct bcm6328_led_priv), }; diff --git a/drivers/led/led_bcm6358.c b/drivers/led/led_bcm6358.c index 307d418..3e57cdf 100644 --- a/drivers/led/led_bcm6358.c +++ b/drivers/led/led_bcm6358.c @@ -113,7 +113,7 @@ static const struct led_ops bcm6358_led_ops = { static int bcm6358_led_probe(struct udevice *dev) { - struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev); + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Top-level LED node */ if (!uc_plat->label) { @@ -192,7 +192,7 @@ static int bcm6358_led_bind(struct udevice *parent) if (ret) return ret; - uc_plat = dev_get_uclass_platdata(dev); + uc_plat = dev_get_uclass_plat(dev); uc_plat->label = label; } @@ -210,6 +210,6 @@ U_BOOT_DRIVER(bcm6358_led) = { .of_match = bcm6358_led_ids, .bind = bcm6358_led_bind, .probe = bcm6358_led_probe, - .priv_auto_alloc_size = sizeof(struct bcm6358_led_priv), + .priv_auto = sizeof(struct bcm6358_led_priv), .ops = &bcm6358_led_ops, }; diff --git a/drivers/led/led_bcm6858.c b/drivers/led/led_bcm6858.c index 511185f..fbf46a1 100644 --- a/drivers/led/led_bcm6858.c +++ b/drivers/led/led_bcm6858.c @@ -154,7 +154,7 @@ static const struct led_ops bcm6858_led_ops = { static int bcm6858_led_probe(struct udevice *dev) { - struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev); + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Top-level LED node */ if (!uc_plat->label) { @@ -229,7 +229,7 @@ static int bcm6858_led_bind(struct udevice *parent) if (ret) return ret; - uc_plat = dev_get_uclass_platdata(dev); + uc_plat = dev_get_uclass_plat(dev); uc_plat->label = label; } @@ -247,6 +247,6 @@ U_BOOT_DRIVER(bcm6858_led) = { .of_match = bcm6858_led_ids, .bind = bcm6858_led_bind, .probe = bcm6858_led_probe, - .priv_auto_alloc_size = sizeof(struct bcm6858_led_priv), + .priv_auto = sizeof(struct bcm6858_led_priv), .ops = &bcm6858_led_ops, }; diff --git a/drivers/led/led_cortina.c b/drivers/led/led_cortina.c index 8fd6fd1..598c0a0 100644 --- a/drivers/led/led_cortina.c +++ b/drivers/led/led_cortina.c @@ -57,7 +57,7 @@ struct cortina_led_cfg { }; /* LED_control structures */ -struct cortina_led_platdata { +struct cortina_led_plat { void __iomem *ctrl_regs; u16 rate1; /* blink rate setting 0 */ u16 rate2; /* blink rate setting 1 */ @@ -130,13 +130,13 @@ static const struct led_ops cortina_led_ops = { .set_state = cortina_led_set_state, }; -static int ca_led_ofdata_to_platdata(struct udevice *dev) +static int ca_led_of_to_plat(struct udevice *dev) { - struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev); + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Top-level LED node */ if (!uc_plat->label) { - struct cortina_led_platdata *plt = dev_get_platdata(dev); + struct cortina_led_plat *plt = dev_get_plat(dev); plt->rate1 = dev_read_u32_default(dev, "Cortina,blink-rate1", 256); @@ -165,22 +165,22 @@ static int ca_led_ofdata_to_platdata(struct udevice *dev) static int cortina_led_probe(struct udevice *dev) { - struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev); + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Top-level LED node */ if (!uc_plat->label) { - struct cortina_led_platdata *platdata = dev_get_platdata(dev); + struct cortina_led_plat *plat = dev_get_plat(dev); u32 reg_value, val; u16 rate1, rate2; - if (!platdata->ctrl_regs) + if (!plat->ctrl_regs) return -EINVAL; reg_value = 0; reg_value |= LED_CLK_POLARITY; - rate1 = platdata->rate1; - rate2 = platdata->rate2; + rate1 = plat->rate1; + rate2 = plat->rate2; val = rate1 / 16 - 1; rate1 = val > LED_MAX_HW_BLINK ? @@ -194,7 +194,7 @@ static int cortina_led_probe(struct udevice *dev) reg_value |= (rate2 & LED_BLINK_RATE2_MASK) << LED_BLINK_RATE2_SHIFT; - cortina_led_write(platdata->ctrl_regs, reg_value); + cortina_led_write(plat->ctrl_regs, reg_value); } else { struct cortina_led_cfg *priv = dev_get_priv(dev); @@ -273,7 +273,7 @@ static int cortina_led_bind(struct udevice *parent) node, &dev); if (ret) return ret; - uc_plat = dev_get_uclass_platdata(dev); + uc_plat = dev_get_uclass_plat(dev); uc_plat->label = label; } @@ -289,10 +289,10 @@ U_BOOT_DRIVER(cortina_led) = { .name = "ca-leds", .id = UCLASS_LED, .of_match = ca_led_ids, - .ofdata_to_platdata = ca_led_ofdata_to_platdata, + .of_to_plat = ca_led_of_to_plat, .bind = cortina_led_bind, .probe = cortina_led_probe, - .platdata_auto_alloc_size = sizeof(struct cortina_led_platdata), - .priv_auto_alloc_size = sizeof(struct cortina_led_cfg), + .plat_auto = sizeof(struct cortina_led_plat), + .priv_auto = sizeof(struct cortina_led_cfg), .ops = &cortina_led_ops, }; diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c index 2cdb026..67ece3c 100644 --- a/drivers/led/led_gpio.c +++ b/drivers/led/led_gpio.c @@ -57,7 +57,7 @@ static enum led_state_t gpio_led_get_state(struct udevice *dev) static int led_gpio_probe(struct udevice *dev) { - struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev); + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct led_gpio_priv *priv = dev_get_priv(dev); int ret; @@ -106,7 +106,7 @@ static int led_gpio_bind(struct udevice *parent) node, &dev); if (ret) return ret; - uc_plat = dev_get_uclass_platdata(dev); + uc_plat = dev_get_uclass_plat(dev); uc_plat->label = label; } @@ -128,7 +128,7 @@ U_BOOT_DRIVER(led_gpio) = { .id = UCLASS_LED, .of_match = led_gpio_ids, .ops = &gpio_led_ops, - .priv_auto_alloc_size = sizeof(struct led_gpio_priv), + .priv_auto = sizeof(struct led_gpio_priv), .bind = led_gpio_bind, .probe = led_gpio_probe, .remove = led_gpio_remove, diff --git a/drivers/mailbox/k3-sec-proxy.c b/drivers/mailbox/k3-sec-proxy.c index 27ccc6e..8dd93a3 100644 --- a/drivers/mailbox/k3-sec-proxy.c +++ b/drivers/mailbox/k3-sec-proxy.c @@ -438,6 +438,6 @@ U_BOOT_DRIVER(k3_sec_proxy) = { .of_match = k3_sec_proxy_ids, .probe = k3_sec_proxy_probe, .remove = k3_sec_proxy_remove, - .priv_auto_alloc_size = sizeof(struct k3_sec_proxy_mbox), + .priv_auto = sizeof(struct k3_sec_proxy_mbox), .ops = &k3_sec_proxy_mbox_ops, }; diff --git a/drivers/mailbox/sandbox-mbox-test.c b/drivers/mailbox/sandbox-mbox-test.c index faca8fc..ffd4674 100644 --- a/drivers/mailbox/sandbox-mbox-test.c +++ b/drivers/mailbox/sandbox-mbox-test.c @@ -50,5 +50,5 @@ U_BOOT_DRIVER(sandbox_mbox_test) = { .name = "sandbox_mbox_test", .id = UCLASS_MISC, .of_match = sandbox_mbox_test_ids, - .priv_auto_alloc_size = sizeof(struct sandbox_mbox_test), + .priv_auto = sizeof(struct sandbox_mbox_test), }; diff --git a/drivers/mailbox/sandbox-mbox.c b/drivers/mailbox/sandbox-mbox.c index 19704dd..87d38de 100644 --- a/drivers/mailbox/sandbox-mbox.c +++ b/drivers/mailbox/sandbox-mbox.c @@ -100,6 +100,6 @@ U_BOOT_DRIVER(sandbox_mbox) = { .of_match = sandbox_mbox_ids, .bind = sandbox_mbox_bind, .probe = sandbox_mbox_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_mbox), + .priv_auto = sizeof(struct sandbox_mbox), .ops = &sandbox_mbox_mbox_ops, }; diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c index 81a4115..093b570 100644 --- a/drivers/mailbox/stm32-ipcc.c +++ b/drivers/mailbox/stm32-ipcc.c @@ -163,6 +163,6 @@ U_BOOT_DRIVER(stm32_ipcc) = { .id = UCLASS_MAILBOX, .of_match = stm32_ipcc_ids, .probe = stm32_ipcc_probe, - .priv_auto_alloc_size = sizeof(struct stm32_ipcc), + .priv_auto = sizeof(struct stm32_ipcc), .ops = &stm32_ipcc_mbox_ops, }; diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c index e91dac2..1d66d95 100644 --- a/drivers/mailbox/tegra-hsp.c +++ b/drivers/mailbox/tegra-hsp.c @@ -189,6 +189,6 @@ U_BOOT_DRIVER(tegra_hsp) = { .of_match = tegra_hsp_ids, .bind = tegra_hsp_bind, .probe = tegra_hsp_probe, - .priv_auto_alloc_size = sizeof(struct tegra_hsp), + .priv_auto = sizeof(struct tegra_hsp), .ops = &tegra_hsp_mbox_ops, }; diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c index 847a036..959cce9 100644 --- a/drivers/mailbox/zynqmp-ipi.c +++ b/drivers/mailbox/zynqmp-ipi.c @@ -137,6 +137,6 @@ U_BOOT_DRIVER(zynqmp_ipi) = { .id = UCLASS_MAILBOX, .of_match = zynqmp_ipi_ids, .probe = zynqmp_ipi_probe, - .priv_auto_alloc_size = sizeof(struct zynqmp_ipi), + .priv_auto = sizeof(struct zynqmp_ipi), .ops = &zynqmp_ipi_mbox_ops, }; diff --git a/drivers/memory/stm32-fmc2-ebi.c b/drivers/memory/stm32-fmc2-ebi.c index d887a1e..f3f48f8 100644 --- a/drivers/memory/stm32-fmc2-ebi.c +++ b/drivers/memory/stm32-fmc2-ebi.c @@ -1051,6 +1051,6 @@ U_BOOT_DRIVER(stm32_fmc2_ebi) = { .id = UCLASS_NOP, .of_match = stm32_fmc2_ebi_match, .probe = stm32_fmc2_ebi_probe, - .priv_auto_alloc_size = sizeof(struct stm32_fmc2_ebi), + .priv_auto = sizeof(struct stm32_fmc2_ebi), .bind = dm_scan_fdt_dev, }; diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 29432ae..7d2a299 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -343,6 +343,15 @@ config TEGRA186_BPMP can make requests to the BPMP. This driver is similar to an MFD driver in the Linux kernel. +config TEST_DRV + bool "Enable support for test drivers" + default y if SANDBOX + help + This enables drivers and uclasses that provides a way of testing the + operations of memory allocation and driver/uclass methods in driver + model. This should only be enabled for testing as it is not useful for + anything else. + config TWL4030_LED bool "Enable TWL4030 LED controller" help diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 947bd3a..d737203 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -67,6 +67,7 @@ obj-$(CONFIG_STM32_RCC) += stm32_rcc.o obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o obj-$(CONFIG_TEGRA186_BPMP) += tegra186_bpmp.o obj-$(CONFIG_TEGRA_CAR) += tegra_car.o +obj-$(CONFIG_TEST_DRV) += test_drv.o obj-$(CONFIG_TWL4030_LED) += twl4030_led.o obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress_config.o obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o diff --git a/drivers/misc/altera_sysid.c b/drivers/misc/altera_sysid.c index c650265..878df12 100644 --- a/drivers/misc/altera_sysid.c +++ b/drivers/misc/altera_sysid.c @@ -17,7 +17,7 @@ struct altera_sysid_regs { u32 timestamp; /* Timestamp */ }; -struct altera_sysid_platdata { +struct altera_sysid_plat { struct altera_sysid_regs *regs; }; @@ -59,7 +59,7 @@ U_BOOT_CMD( static int altera_sysid_read(struct udevice *dev, int offset, void *buf, int size) { - struct altera_sysid_platdata *plat = dev->platdata; + struct altera_sysid_plat *plat = dev_get_plat(dev); struct altera_sysid_regs *const regs = plat->regs; u32 *sysid = buf; @@ -69,9 +69,9 @@ static int altera_sysid_read(struct udevice *dev, return 0; } -static int altera_sysid_ofdata_to_platdata(struct udevice *dev) +static int altera_sysid_of_to_plat(struct udevice *dev) { - struct altera_sysid_platdata *plat = dev_get_platdata(dev); + struct altera_sysid_plat *plat = dev_get_plat(dev); plat->regs = map_physmem(dev_read_addr(dev), sizeof(struct altera_sysid_regs), @@ -93,7 +93,7 @@ U_BOOT_DRIVER(altera_sysid) = { .name = "altera_sysid", .id = UCLASS_MISC, .of_match = altera_sysid_ids, - .ofdata_to_platdata = altera_sysid_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct altera_sysid_platdata), + .of_to_plat = altera_sysid_of_to_plat, + .plat_auto = sizeof(struct altera_sysid_plat), .ops = &altera_sysid_ops, }; diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c index 422ea6f..90f9cd2 100644 --- a/drivers/misc/atsha204a-i2c.c +++ b/drivers/misc/atsha204a-i2c.c @@ -382,7 +382,7 @@ int atsha204a_get_random(struct udevice *dev, u8 *buffer, size_t max) return 0; } -static int atsha204a_ofdata_to_platdata(struct udevice *dev) +static int atsha204a_of_to_plat(struct udevice *dev) { fdt_addr_t *priv = dev_get_priv(dev); fdt_addr_t addr; @@ -406,6 +406,6 @@ U_BOOT_DRIVER(atsha204) = { .name = "atsha204", .id = UCLASS_MISC, .of_match = atsha204a_ids, - .ofdata_to_platdata = atsha204a_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(fdt_addr_t), + .of_to_plat = atsha204a_of_to_plat, + .priv_auto = sizeof(fdt_addr_t), }; diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index 1b22f18..f03b7d5 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -1505,7 +1505,7 @@ int cros_ec_set_lid_shutdown_mask(struct udevice *dev, int enable) UCLASS_DRIVER(cros_ec) = { .id = UCLASS_CROS_EC, .name = "cros-ec", - .per_device_auto_alloc_size = sizeof(struct cros_ec_dev), + .per_device_auto = sizeof(struct cros_ec_dev), .post_bind = dm_scan_fdt_dev, .flags = DM_UC_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/misc/cros_ec_i2c.c b/drivers/misc/cros_ec_i2c.c index 664bd2b..a1b78a3 100644 --- a/drivers/misc/cros_ec_i2c.c +++ b/drivers/misc/cros_ec_i2c.c @@ -52,7 +52,7 @@ struct ec_host_response_i2c { static int cros_ec_i2c_packet(struct udevice *udev, int out_bytes, int in_bytes) { struct cros_ec_dev *dev = dev_get_uclass_priv(udev); - struct dm_i2c_chip *chip = dev_get_parent_platdata(udev); + struct dm_i2c_chip *chip = dev_get_parent_plat(udev); struct ec_host_request_i2c *ec_request_i2c = (struct ec_host_request_i2c *)dev->dout; struct ec_host_response_i2c *ec_response_i2c = @@ -112,7 +112,7 @@ static int cros_ec_i2c_command(struct udevice *udev, uint8_t cmd, int dout_len, uint8_t **dinp, int din_len) { struct cros_ec_dev *dev = dev_get_uclass_priv(udev); - struct dm_i2c_chip *chip = dev_get_parent_platdata(udev); + struct dm_i2c_chip *chip = dev_get_parent_plat(udev); struct i2c_msg i2c_msg[2]; /* version8, cmd8, arglen8, out8[dout_len], csum8 */ int out_bytes = dout_len + 4; diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index d72db3e..9fd6cc2 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -520,8 +520,8 @@ void cros_ec_check_keyboard(struct udevice *dev) int cros_ec_probe(struct udevice *dev) { - struct ec_state *ec = dev->priv; - struct cros_ec_dev *cdev = dev->uclass_priv; + struct ec_state *ec = dev_get_priv(dev); + struct cros_ec_dev *cdev = dev_get_uclass_priv(dev); struct udevice *keyb_dev; ofnode node; int err; @@ -585,6 +585,6 @@ U_BOOT_DRIVER(google_cros_ec_sandbox) = { .id = UCLASS_CROS_EC, .of_match = cros_ec_ids, .probe = cros_ec_probe, - .priv_auto_alloc_size = sizeof(struct ec_state), + .priv_auto = sizeof(struct ec_state), .ops = &cros_ec_ops, }; diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c index 56406aa..f460b1a 100644 --- a/drivers/misc/fs_loader.c +++ b/drivers/misc/fs_loader.c @@ -61,7 +61,7 @@ static int mount_ubifs(char *mtdpart, char *ubivol) } #endif -static int select_fs_dev(struct device_platdata *plat) +static int select_fs_dev(struct device_plat *plat) { int ret; @@ -161,7 +161,7 @@ static int fw_get_filesystem_firmware(struct udevice *dev) else ret = -ENODEV; } else { - ret = select_fs_dev(dev->platdata); + ret = select_fs_dev(dev_get_plat(dev)); } if (ret) @@ -219,16 +219,16 @@ int request_firmware_into_buf(struct udevice *dev, return ret; } -static int fs_loader_ofdata_to_platdata(struct udevice *dev) +static int fs_loader_of_to_plat(struct udevice *dev) { u32 phandlepart[2]; ofnode fs_loader_node = dev_ofnode(dev); if (ofnode_valid(fs_loader_node)) { - struct device_platdata *plat; + struct device_plat *plat; - plat = dev->platdata; + plat = dev_get_plat(dev); if (!ofnode_read_u32_array(fs_loader_node, "phandlepart", phandlepart, 2)) { @@ -250,7 +250,7 @@ static int fs_loader_probe(struct udevice *dev) { #if CONFIG_IS_ENABLED(DM) && CONFIG_IS_ENABLED(BLK) int ret; - struct device_platdata *plat = dev->platdata; + struct device_plat *plat = dev_get_plat(dev); if (plat->phandlepart.phandle) { ofnode node = ofnode_get_by_phandle(plat->phandlepart.phandle); @@ -284,9 +284,9 @@ U_BOOT_DRIVER(fs_loader) = { .id = UCLASS_FS_FIRMWARE_LOADER, .of_match = fs_loader_ids, .probe = fs_loader_probe, - .ofdata_to_platdata = fs_loader_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct device_platdata), - .priv_auto_alloc_size = sizeof(struct firmware), + .of_to_plat = fs_loader_of_to_plat, + .plat_auto = sizeof(struct device_plat), + .priv_auto = sizeof(struct firmware), }; UCLASS_DRIVER(fs_loader) = { diff --git a/drivers/misc/gdsys_ioep.c b/drivers/misc/gdsys_ioep.c index 69e16a0..145cfa2 100644 --- a/drivers/misc/gdsys_ioep.c +++ b/drivers/misc/gdsys_ioep.c @@ -206,5 +206,5 @@ U_BOOT_DRIVER(gdsys_ioep) = { .flags = DM_UC_FLAG_SEQ_ALIAS, .of_match = gdsys_ioep_ids, .probe = gdsys_ioep_probe, - .priv_auto_alloc_size = sizeof(struct gdsys_ioep_priv), + .priv_auto = sizeof(struct gdsys_ioep_priv), }; diff --git a/drivers/misc/gdsys_rxaui_ctrl.c b/drivers/misc/gdsys_rxaui_ctrl.c index c56abce..8f5cbe4 100644 --- a/drivers/misc/gdsys_rxaui_ctrl.c +++ b/drivers/misc/gdsys_rxaui_ctrl.c @@ -77,5 +77,5 @@ U_BOOT_DRIVER(gdsys_rxaui_ctrl) = { .ops = &gdsys_rxaui_ctrl_ops, .of_match = gdsys_rxaui_ctrl_ids, .probe = gdsys_rxaui_ctrl_probe, - .priv_auto_alloc_size = sizeof(struct gdsys_rxaui_ctrl_priv), + .priv_auto = sizeof(struct gdsys_rxaui_ctrl_priv), }; diff --git a/drivers/misc/gdsys_soc.c b/drivers/misc/gdsys_soc.c index b4c721c..27e7dc4 100644 --- a/drivers/misc/gdsys_soc.c +++ b/drivers/misc/gdsys_soc.c @@ -71,5 +71,5 @@ U_BOOT_DRIVER(gdsys_soc_bus) = { .id = UCLASS_SIMPLE_BUS, .of_match = gdsys_soc_ids, .probe = gdsys_soc_probe, - .priv_auto_alloc_size = sizeof(struct gdsys_soc_priv), + .priv_auto = sizeof(struct gdsys_soc_priv), }; diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c index 3651ba4..5926c91 100644 --- a/drivers/misc/i2c_eeprom.c +++ b/drivers/misc/i2c_eeprom.c @@ -93,7 +93,7 @@ static const struct i2c_eeprom_ops i2c_eeprom_std_ops = { .size = i2c_eeprom_std_size, }; -static int i2c_eeprom_std_ofdata_to_platdata(struct udevice *dev) +static int i2c_eeprom_std_of_to_plat(struct udevice *dev) { struct i2c_eeprom *priv = dev_get_priv(dev); struct i2c_eeprom_drv_data *data = @@ -131,8 +131,8 @@ static int i2c_eeprom_std_bind(struct udevice *dev) if (!name) continue; - device_bind_ofnode(dev, DM_GET_DRIVER(i2c_eeprom_partition), - name, NULL, partition, NULL); + device_bind(dev, DM_DRIVER_GET(i2c_eeprom_partition), name, + NULL, partition, NULL); } return 0; @@ -283,8 +283,8 @@ U_BOOT_DRIVER(i2c_eeprom_std) = { .of_match = i2c_eeprom_std_ids, .bind = i2c_eeprom_std_bind, .probe = i2c_eeprom_std_probe, - .ofdata_to_platdata = i2c_eeprom_std_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct i2c_eeprom), + .of_to_plat = i2c_eeprom_std_of_to_plat, + .priv_auto = sizeof(struct i2c_eeprom), .ops = &i2c_eeprom_std_ops, }; @@ -298,7 +298,7 @@ static int i2c_eeprom_partition_probe(struct udevice *dev) return 0; } -static int i2c_eeprom_partition_ofdata_to_platdata(struct udevice *dev) +static int i2c_eeprom_partition_of_to_plat(struct udevice *dev) { struct i2c_eeprom_partition *priv = dev_get_priv(dev); u32 reg[2]; @@ -365,8 +365,8 @@ U_BOOT_DRIVER(i2c_eeprom_partition) = { .name = "i2c_eeprom_partition", .id = UCLASS_I2C_EEPROM, .probe = i2c_eeprom_partition_probe, - .ofdata_to_platdata = i2c_eeprom_partition_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct i2c_eeprom_partition), + .of_to_plat = i2c_eeprom_partition_of_to_plat, + .priv_auto = sizeof(struct i2c_eeprom_partition), .ops = &i2c_eeprom_partition_ops, }; diff --git a/drivers/misc/i2c_eeprom_emul.c b/drivers/misc/i2c_eeprom_emul.c index 6be76ad..85b127c 100644 --- a/drivers/misc/i2c_eeprom_emul.c +++ b/drivers/misc/i2c_eeprom_emul.c @@ -36,14 +36,14 @@ struct sandbox_i2c_flash { void sandbox_i2c_eeprom_set_test_mode(struct udevice *dev, enum sandbox_i2c_eeprom_test_mode mode) { - struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_flash_plat_data *plat = dev_get_plat(dev); plat->test_mode = mode; } void sandbox_i2c_eeprom_set_offset_len(struct udevice *dev, int offset_len) { - struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_flash_plat_data *plat = dev_get_plat(dev); plat->offset_len = offset_len; } @@ -51,7 +51,7 @@ void sandbox_i2c_eeprom_set_offset_len(struct udevice *dev, int offset_len) void sandbox_i2c_eeprom_set_chip_addr_offset_mask(struct udevice *dev, uint mask) { - struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_flash_plat_data *plat = dev_get_plat(dev); plat->chip_addr_offset_mask = mask; } @@ -74,7 +74,7 @@ static int sandbox_i2c_eeprom_xfer(struct udevice *emul, struct i2c_msg *msg, int nmsgs) { struct sandbox_i2c_flash *priv = dev_get_priv(emul); - struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(emul); + struct sandbox_i2c_flash_plat_data *plat = dev_get_plat(emul); uint offset = msg->addr & plat->chip_addr_offset_mask; debug("\n%s\n", __func__); @@ -149,9 +149,9 @@ struct dm_i2c_ops sandbox_i2c_emul_ops = { .xfer = sandbox_i2c_eeprom_xfer, }; -static int sandbox_i2c_eeprom_ofdata_to_platdata(struct udevice *dev) +static int sandbox_i2c_eeprom_of_to_plat(struct udevice *dev) { - struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_flash_plat_data *plat = dev_get_plat(dev); plat->size = dev_read_u32_default(dev, "sandbox,size", 32); plat->filename = dev_read_string(dev, "sandbox,filename"); @@ -169,7 +169,7 @@ static int sandbox_i2c_eeprom_ofdata_to_platdata(struct udevice *dev) static int sandbox_i2c_eeprom_probe(struct udevice *dev) { - struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_flash_plat_data *plat = dev_get_plat(dev); struct sandbox_i2c_flash *priv = dev_get_priv(dev); priv->data = calloc(1, plat->size); @@ -197,10 +197,10 @@ U_BOOT_DRIVER(sandbox_i2c_emul) = { .name = "sandbox_i2c_eeprom_emul", .id = UCLASS_I2C_EMUL, .of_match = sandbox_i2c_ids, - .ofdata_to_platdata = sandbox_i2c_eeprom_ofdata_to_platdata, + .of_to_plat = sandbox_i2c_eeprom_of_to_plat, .probe = sandbox_i2c_eeprom_probe, .remove = sandbox_i2c_eeprom_remove, - .priv_auto_alloc_size = sizeof(struct sandbox_i2c_flash), - .platdata_auto_alloc_size = sizeof(struct sandbox_i2c_flash_plat_data), + .priv_auto = sizeof(struct sandbox_i2c_flash), + .plat_auto = sizeof(struct sandbox_i2c_flash_plat_data), .ops = &sandbox_i2c_emul_ops, }; diff --git a/drivers/misc/ihs_fpga.c b/drivers/misc/ihs_fpga.c index 00d34a3..a0fece9 100644 --- a/drivers/misc/ihs_fpga.c +++ b/drivers/misc/ihs_fpga.c @@ -866,5 +866,5 @@ U_BOOT_DRIVER(ihs_fpga_bus) = { .id = UCLASS_MISC, .of_match = ihs_fpga_ids, .probe = ihs_fpga_probe, - .priv_auto_alloc_size = sizeof(struct ihs_fpga_priv), + .priv_auto = sizeof(struct ihs_fpga_priv), }; diff --git a/drivers/misc/imx8/scu.c b/drivers/misc/imx8/scu.c index 223aac8..72a3473 100644 --- a/drivers/misc/imx8/scu.c +++ b/drivers/misc/imx8/scu.c @@ -158,7 +158,7 @@ static int sc_ipc_write(struct mu_type *base, void *data) static int imx8_scu_call(struct udevice *dev, int no_resp, void *tx_msg, int tx_size, void *rx_msg, int rx_size) { - struct imx8_scu *plat = dev_get_platdata(dev); + struct imx8_scu *plat = dev_get_plat(dev); sc_err_t result; int ret; @@ -182,7 +182,7 @@ static int imx8_scu_call(struct udevice *dev, int no_resp, void *tx_msg, static int imx8_scu_probe(struct udevice *dev) { - struct imx8_scu *plat = dev_get_platdata(dev); + struct imx8_scu *plat = dev_get_plat(dev); fdt_addr_t addr; debug("%s(dev=%p) (plat=%p)\n", __func__, dev, plat); @@ -245,6 +245,6 @@ U_BOOT_DRIVER(imx8_scu) = { .bind = imx8_scu_bind, .remove = imx8_scu_remove, .ops = &imx8_scu_ops, - .platdata_auto_alloc_size = sizeof(struct imx8_scu), + .plat_auto = sizeof(struct imx8_scu), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/misc/irq_sandbox.c b/drivers/misc/irq_sandbox.c index a2511b3..1f7e62e 100644 --- a/drivers/misc/irq_sandbox.c +++ b/drivers/misc/irq_sandbox.c @@ -108,5 +108,5 @@ U_BOOT_DRIVER(sandbox_irq_drv) = { .id = UCLASS_IRQ, .of_match = sandbox_irq_ids, .ops = &sandbox_irq_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_irq_priv), + .priv_auto = sizeof(struct sandbox_irq_priv), }; diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c index 408c893..840148d 100644 --- a/drivers/misc/k3_avs.c +++ b/drivers/misc/k3_avs.c @@ -390,5 +390,5 @@ U_BOOT_DRIVER(k3_avs) = { .of_match = k3_avs_ids, .id = UCLASS_MISC, .probe = k3_avs_probe, - .priv_auto_alloc_size = sizeof(struct k3_avs_privdata), + .priv_auto = sizeof(struct k3_avs_privdata), }; diff --git a/drivers/misc/microchip_flexcom.c b/drivers/misc/microchip_flexcom.c index 64cc4ae..e0a6f2d 100644 --- a/drivers/misc/microchip_flexcom.c +++ b/drivers/misc/microchip_flexcom.c @@ -16,14 +16,14 @@ struct microchip_flexcom_regs { u32 cr; }; -struct microchip_flexcom_platdata { +struct microchip_flexcom_plat { struct microchip_flexcom_regs *regs; u32 flexcom_mode; }; -static int microchip_flexcom_ofdata_to_platdata(struct udevice *dev) +static int microchip_flexcom_of_to_plat(struct udevice *dev) { - struct microchip_flexcom_platdata *plat = dev_get_platdata(dev); + struct microchip_flexcom_plat *plat = dev_get_plat(dev); int ret; plat->regs = map_physmem(dev_read_addr(dev), @@ -61,6 +61,6 @@ U_BOOT_DRIVER(microchip_flexcom) = { .name = "microchip_flexcom", .id = UCLASS_MISC, .of_match = microchip_flexcom_ids, - .ofdata_to_platdata = microchip_flexcom_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct microchip_flexcom_platdata), + .of_to_plat = microchip_flexcom_of_to_plat, + .plat_auto = sizeof(struct microchip_flexcom_plat), }; diff --git a/drivers/misc/misc_sandbox.c b/drivers/misc/misc_sandbox.c index f7c5b2e..0e4292f 100644 --- a/drivers/misc/misc_sandbox.c +++ b/drivers/misc/misc_sandbox.c @@ -129,5 +129,5 @@ U_BOOT_DRIVER(misc_sandbox) = { .ops = &misc_sandbox_ops, .of_match = misc_sandbox_ids, .probe = misc_sandbox_probe, - .priv_auto_alloc_size = sizeof(struct misc_sandbox_priv), + .priv_auto = sizeof(struct misc_sandbox_priv), }; diff --git a/drivers/misc/mpc83xx_serdes.c b/drivers/misc/mpc83xx_serdes.c index ab1e34e..93c87e9 100644 --- a/drivers/misc/mpc83xx_serdes.c +++ b/drivers/misc/mpc83xx_serdes.c @@ -183,5 +183,5 @@ U_BOOT_DRIVER(mpc83xx_serdes) = { .id = UCLASS_MISC, .of_match = mpc83xx_serdes_ids, .probe = mpc83xx_serdes_probe, - .priv_auto_alloc_size = sizeof(struct mpc83xx_serdes_priv), + .priv_auto = sizeof(struct mpc83xx_serdes_priv), }; diff --git a/drivers/misc/p2sb-uclass.c b/drivers/misc/p2sb-uclass.c index 12abcff..ac28525 100644 --- a/drivers/misc/p2sb-uclass.c +++ b/drivers/misc/p2sb-uclass.c @@ -30,7 +30,7 @@ int p2sb_set_hide(struct udevice *dev, bool hide) void *pcr_reg_address(struct udevice *dev, uint offset) { - struct p2sb_child_platdata *pplat = dev_get_parent_platdata(dev); + struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); struct udevice *p2sb = dev_get_parent(dev); struct p2sb_uc_priv *upriv = dev_get_uclass_priv(p2sb); uintptr_t reg_addr; @@ -161,34 +161,19 @@ void pcr_clrsetbits8(struct udevice *dev, uint offset, uint clr, uint set) int p2sb_get_port_id(struct udevice *dev) { - struct p2sb_child_platdata *pplat = dev_get_parent_platdata(dev); + struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); return pplat->pid; } int p2sb_set_port_id(struct udevice *dev, int portid) { - struct udevice *ps2b; - struct p2sb_child_platdata *pplat; + struct p2sb_child_plat *pplat; if (!CONFIG_IS_ENABLED(OF_PLATDATA)) return -ENOSYS; - if (!CONFIG_IS_ENABLED(OF_PLATDATA_PARENT)) { - uclass_find_first_device(UCLASS_P2SB, &ps2b); - if (!ps2b) - return -EDEADLK; - dev->parent = ps2b; - - /* - * We must allocate this, since when the device was bound it did - * not have a parent. - */ - dev->parent_platdata = malloc(sizeof(*pplat)); - if (!dev->parent_platdata) - return -ENOMEM; - } - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); pplat->pid = portid; return 0; @@ -197,7 +182,7 @@ int p2sb_set_port_id(struct udevice *dev, int portid) static int p2sb_child_post_bind(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) - struct p2sb_child_platdata *pplat = dev_get_parent_platdata(dev); + struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); int ret; u32 pid; @@ -221,9 +206,8 @@ static int p2sb_post_bind(struct udevice *dev) UCLASS_DRIVER(p2sb) = { .id = UCLASS_P2SB, .name = "p2sb", - .per_device_auto_alloc_size = sizeof(struct p2sb_uc_priv), + .per_device_auto = sizeof(struct p2sb_uc_priv), .post_bind = p2sb_post_bind, .child_post_bind = p2sb_child_post_bind, - .per_child_platdata_auto_alloc_size = - sizeof(struct p2sb_child_platdata), + .per_child_plat_auto = sizeof(struct p2sb_child_plat), }; diff --git a/drivers/misc/p2sb_emul.c b/drivers/misc/p2sb_emul.c index a4b6dba..973d02d 100644 --- a/drivers/misc/p2sb_emul.c +++ b/drivers/misc/p2sb_emul.c @@ -18,12 +18,12 @@ #include <p2sb.h> /** - * struct p2sb_emul_platdata - platform data for this device + * struct p2sb_emul_plat - platform data for this device * * @command: Current PCI command value * @bar: Current base address values */ -struct p2sb_emul_platdata { +struct p2sb_emul_plat { u16 command; u32 bar[6]; }; @@ -53,7 +53,7 @@ static int sandbox_p2sb_emul_read_config(const struct udevice *emul, uint offset, ulong *valuep, enum pci_size_t size) { - struct p2sb_emul_platdata *plat = dev_get_platdata(emul); + struct p2sb_emul_plat *plat = dev_get_plat(emul); switch (offset) { case PCI_COMMAND: @@ -106,7 +106,7 @@ static int sandbox_p2sb_emul_read_config(const struct udevice *emul, static int sandbox_p2sb_emul_write_config(struct udevice *emul, uint offset, ulong value, enum pci_size_t size) { - struct p2sb_emul_platdata *plat = dev_get_platdata(emul); + struct p2sb_emul_plat *plat = dev_get_plat(emul); switch (offset) { case PCI_COMMAND: @@ -134,7 +134,7 @@ static int sandbox_p2sb_emul_write_config(struct udevice *emul, uint offset, static int sandbox_p2sb_emul_find_bar(struct udevice *emul, unsigned int addr, int *barnump, unsigned int *offsetp) { - struct p2sb_emul_platdata *plat = dev_get_platdata(emul); + struct p2sb_emul_plat *plat = dev_get_plat(emul); int barnum; for (barnum = 0; barnum < ARRAY_SIZE(barinfo); barnum++) { @@ -197,8 +197,8 @@ static int find_p2sb_channel(struct udevice *emul, uint offset, return log_msg_ret("No client", ret); device_foreach_child(dev, p2sb) { - struct p2sb_child_platdata *pplat = - dev_get_parent_platdata(dev); + struct p2sb_child_plat *pplat = + dev_get_parent_plat(dev); log_debug(" - child %s, pid %d, want %d\n", dev->name, pplat->pid, pid); @@ -262,8 +262,8 @@ U_BOOT_DRIVER(sandbox_p2sb_emul_emul) = { .id = UCLASS_PCI_EMUL, .of_match = sandbox_p2sb_emul_ids, .ops = &sandbox_p2sb_emul_emul_ops, - .priv_auto_alloc_size = sizeof(struct p2sb_emul_priv), - .platdata_auto_alloc_size = sizeof(struct p2sb_emul_platdata), + .priv_auto = sizeof(struct p2sb_emul_priv), + .plat_auto = sizeof(struct p2sb_emul_plat), }; static struct pci_device_id sandbox_p2sb_emul_supported[] = { diff --git a/drivers/misc/p2sb_sandbox.c b/drivers/misc/p2sb_sandbox.c index ce50a97..d80bca2 100644 --- a/drivers/misc/p2sb_sandbox.c +++ b/drivers/misc/p2sb_sandbox.c @@ -35,5 +35,5 @@ U_BOOT_DRIVER(p2sb_sandbox) = { .id = UCLASS_P2SB, .of_match = sandbox_p2sb_ids, .probe = sandbox_p2sb_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_p2sb_priv), + .priv_auto = sizeof(struct sandbox_p2sb_priv), }; diff --git a/drivers/misc/rockchip-efuse.c b/drivers/misc/rockchip-efuse.c index 46ce630..083ee65 100644 --- a/drivers/misc/rockchip-efuse.c +++ b/drivers/misc/rockchip-efuse.c @@ -37,7 +37,7 @@ struct rockchip_efuse_regs { /* 0x14 efuse strobe finish control register */ }; -struct rockchip_efuse_platdata { +struct rockchip_efuse_plat { void __iomem *base; struct clk *clk; }; @@ -58,7 +58,7 @@ static int dump_efuses(struct cmd_tbl *cmdtp, int flag, /* retrieve the device */ ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(rockchip_efuse), &dev); + DM_DRIVER_GET(rockchip_efuse), &dev); if (ret) { printf("%s: no misc-device found\n", __func__); return 0; @@ -86,7 +86,7 @@ U_BOOT_CMD( static int rockchip_rk3399_efuse_read(struct udevice *dev, int offset, void *buf, int size) { - struct rockchip_efuse_platdata *plat = dev_get_platdata(dev); + struct rockchip_efuse_plat *plat = dev_get_plat(dev); struct rockchip_efuse_regs *efuse = (struct rockchip_efuse_regs *)plat->base; @@ -137,9 +137,9 @@ static const struct misc_ops rockchip_efuse_ops = { .read = rockchip_efuse_read, }; -static int rockchip_efuse_ofdata_to_platdata(struct udevice *dev) +static int rockchip_efuse_of_to_plat(struct udevice *dev) { - struct rockchip_efuse_platdata *plat = dev_get_platdata(dev); + struct rockchip_efuse_plat *plat = dev_get_plat(dev); plat->base = dev_read_addr_ptr(dev); return 0; @@ -154,7 +154,7 @@ U_BOOT_DRIVER(rockchip_efuse) = { .name = "rockchip_efuse", .id = UCLASS_MISC, .of_match = rockchip_efuse_ids, - .ofdata_to_platdata = rockchip_efuse_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct rockchip_efuse_platdata), + .of_to_plat = rockchip_efuse_of_to_plat, + .plat_auto = sizeof(struct rockchip_efuse_plat), .ops = &rockchip_efuse_ops, }; diff --git a/drivers/misc/rockchip-otp.c b/drivers/misc/rockchip-otp.c index bdd443b..cc9a545 100644 --- a/drivers/misc/rockchip-otp.c +++ b/drivers/misc/rockchip-otp.c @@ -47,13 +47,13 @@ #define OTPC_TIMEOUT 10000 -struct rockchip_otp_platdata { +struct rockchip_otp_plat { void __iomem *base; unsigned long secure_conf_base; unsigned long otp_mask_base; }; -static int rockchip_otp_wait_status(struct rockchip_otp_platdata *otp, +static int rockchip_otp_wait_status(struct rockchip_otp_plat *otp, u32 flag) { int delay = OTPC_TIMEOUT; @@ -73,7 +73,7 @@ static int rockchip_otp_wait_status(struct rockchip_otp_platdata *otp, return 0; } -static int rockchip_otp_ecc_enable(struct rockchip_otp_platdata *otp, +static int rockchip_otp_ecc_enable(struct rockchip_otp_plat *otp, bool enable) { int ret = 0; @@ -102,7 +102,7 @@ static int rockchip_otp_ecc_enable(struct rockchip_otp_platdata *otp, static int rockchip_px30_otp_read(struct udevice *dev, int offset, void *buf, int size) { - struct rockchip_otp_platdata *otp = dev_get_platdata(dev); + struct rockchip_otp_plat *otp = dev_get_plat(dev); u8 *buffer = buf; int ret = 0; @@ -145,9 +145,9 @@ static const struct misc_ops rockchip_otp_ops = { .read = rockchip_otp_read, }; -static int rockchip_otp_ofdata_to_platdata(struct udevice *dev) +static int rockchip_otp_of_to_plat(struct udevice *dev) { - struct rockchip_otp_platdata *otp = dev_get_platdata(dev); + struct rockchip_otp_plat *otp = dev_get_plat(dev); otp->base = dev_read_addr_ptr(dev); @@ -171,6 +171,6 @@ U_BOOT_DRIVER(rockchip_otp) = { .id = UCLASS_MISC, .of_match = rockchip_otp_ids, .ops = &rockchip_otp_ops, - .ofdata_to_platdata = rockchip_otp_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct rockchip_otp_platdata), + .of_to_plat = rockchip_otp_of_to_plat, + .plat_auto = sizeof(struct rockchip_otp_plat), }; diff --git a/drivers/misc/sandbox_adder.c b/drivers/misc/sandbox_adder.c index df262e6..3ea33e4 100644 --- a/drivers/misc/sandbox_adder.c +++ b/drivers/misc/sandbox_adder.c @@ -21,7 +21,7 @@ struct sandbox_adder_priv { int sandbox_adder_read(struct udevice *dev, ulong address, void *data, enum axi_size_t size) { - struct p2sb_child_platdata *pplat = dev_get_parent_platdata(dev); + struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); u32 *val = data; *val = pplat->pid << 24 | address; @@ -56,5 +56,5 @@ U_BOOT_DRIVER(adder_sandbox) = { .of_match = sandbox_adder_ids, .probe = sandbox_adder_probe, .ops = &sandbox_adder_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_adder_priv), + .priv_auto = sizeof(struct sandbox_adder_priv), }; diff --git a/drivers/misc/sifive-otp.c b/drivers/misc/sifive-otp.c index 92f08dd..3e658b3 100644 --- a/drivers/misc/sifive-otp.c +++ b/drivers/misc/sifive-otp.c @@ -89,7 +89,7 @@ struct sifive_otp_regs { u32 pwe; /* Write enable input (defines program cycle) */ }; -struct sifive_otp_platdata { +struct sifive_otp_plat { struct sifive_otp_regs __iomem *regs; u32 total_fuses; }; @@ -100,7 +100,7 @@ struct sifive_otp_platdata { static int sifive_otp_read(struct udevice *dev, int offset, void *buf, int size) { - struct sifive_otp_platdata *plat = dev_get_platdata(dev); + struct sifive_otp_plat *plat = dev_get_plat(dev); struct sifive_otp_regs *regs = (struct sifive_otp_regs *)plat->regs; /* Check if offset and size are multiple of BYTES_PER_FUSE */ @@ -162,7 +162,7 @@ static int sifive_otp_read(struct udevice *dev, int offset, static int sifive_otp_write(struct udevice *dev, int offset, const void *buf, int size) { - struct sifive_otp_platdata *plat = dev_get_platdata(dev); + struct sifive_otp_plat *plat = dev_get_plat(dev); struct sifive_otp_regs *regs = (struct sifive_otp_regs *)plat->regs; /* Check if offset and size are multiple of BYTES_PER_FUSE */ @@ -239,9 +239,9 @@ static int sifive_otp_write(struct udevice *dev, int offset, return size; } -static int sifive_otp_ofdata_to_platdata(struct udevice *dev) +static int sifive_otp_of_to_plat(struct udevice *dev) { - struct sifive_otp_platdata *plat = dev_get_platdata(dev); + struct sifive_otp_plat *plat = dev_get_plat(dev); int ret; plat->regs = dev_read_addr_ptr(dev); @@ -269,7 +269,7 @@ U_BOOT_DRIVER(sifive_otp) = { .name = "sifive_otp", .id = UCLASS_MISC, .of_match = sifive_otp_ids, - .ofdata_to_platdata = sifive_otp_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct sifive_otp_platdata), + .of_to_plat = sifive_otp_of_to_plat, + .plat_auto = sizeof(struct sifive_otp_plat), .ops = &sifive_otp_ops, }; diff --git a/drivers/misc/spltest_sandbox.c b/drivers/misc/spltest_sandbox.c index 3ae6707..6b9701a 100644 --- a/drivers/misc/spltest_sandbox.c +++ b/drivers/misc/spltest_sandbox.c @@ -8,8 +8,14 @@ #include <dm.h> #include <dt-structs.h> +static const struct udevice_id sandbox_spl_ids[] = { + { .compatible = "sandbox,spl-test", }, + {} /* sentinel */ +}; + U_BOOT_DRIVER(sandbox_spl_test) = { .name = "sandbox_spl_test", .id = UCLASS_MISC, + .of_match = sandbox_spl_ids, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/misc/stm32mp_fuse.c b/drivers/misc/stm32mp_fuse.c index 0eed345..9fd6c36 100644 --- a/drivers/misc/stm32mp_fuse.c +++ b/drivers/misc/stm32mp_fuse.c @@ -26,7 +26,7 @@ int fuse_read(u32 bank, u32 word, u32 *val) switch (bank) { case STM32MP_OTP_BANK: ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(stm32mp_bsec), + DM_DRIVER_GET(stm32mp_bsec), &dev); if (ret) return ret; @@ -41,7 +41,7 @@ int fuse_read(u32 bank, u32 word, u32 *val) #ifdef CONFIG_PMIC_STPMIC1 case STM32MP_NVM_BANK: ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(stpmic1_nvm), + DM_DRIVER_GET(stpmic1_nvm), &dev); if (ret) return ret; @@ -71,7 +71,7 @@ int fuse_prog(u32 bank, u32 word, u32 val) switch (bank) { case STM32MP_OTP_BANK: ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(stm32mp_bsec), + DM_DRIVER_GET(stm32mp_bsec), &dev); if (ret) return ret; @@ -86,7 +86,7 @@ int fuse_prog(u32 bank, u32 word, u32 val) #ifdef CONFIG_PMIC_STPMIC1 case STM32MP_NVM_BANK: ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(stpmic1_nvm), + DM_DRIVER_GET(stpmic1_nvm), &dev); if (ret) return ret; @@ -115,7 +115,7 @@ int fuse_sense(u32 bank, u32 word, u32 *val) switch (bank) { case STM32MP_OTP_BANK: ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(stm32mp_bsec), + DM_DRIVER_GET(stm32mp_bsec), &dev); if (ret) return ret; @@ -129,7 +129,7 @@ int fuse_sense(u32 bank, u32 word, u32 *val) #ifdef CONFIG_PMIC_STPMIC1 case STM32MP_NVM_BANK: ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(stpmic1_nvm), + DM_DRIVER_GET(stpmic1_nvm), &dev); if (ret) return ret; @@ -159,7 +159,7 @@ int fuse_override(u32 bank, u32 word, u32 val) switch (bank) { case STM32MP_OTP_BANK: ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(stm32mp_bsec), + DM_DRIVER_GET(stm32mp_bsec), &dev); if (ret) return ret; @@ -174,7 +174,7 @@ int fuse_override(u32 bank, u32 word, u32 val) #ifdef CONFIG_PMIC_STPMIC1 case STM32MP_NVM_BANK: ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(stpmic1_nvm), + DM_DRIVER_GET(stpmic1_nvm), &dev); if (ret) return ret; diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c index 07c6757..3cbc8f3 100644 --- a/drivers/misc/swap_case.c +++ b/drivers/misc/swap_case.c @@ -15,12 +15,12 @@ #include <linux/ctype.h> /** - * struct swap_case_platdata - platform data for this device + * struct swap_case_plat - platform data for this device * * @command: Current PCI command value * @bar: Current base address values */ -struct swap_case_platdata { +struct swap_case_plat { u16 command; u32 bar[6]; }; @@ -54,7 +54,7 @@ struct swap_case_priv { static int sandbox_swap_case_use_ea(const struct udevice *dev) { - return !!ofnode_get_property(dev->node, "use-ea", NULL); + return !!ofnode_get_property(dev_ofnode(dev), "use-ea", NULL); } /* Please keep these macros in sync with ea_regs below */ @@ -100,7 +100,7 @@ static int sandbox_swap_case_read_config(const struct udevice *emul, uint offset, ulong *valuep, enum pci_size_t size) { - struct swap_case_platdata *plat = dev_get_platdata(emul); + struct swap_case_plat *plat = dev_get_plat(emul); /* * The content of the EA capability structure is handled elsewhere to @@ -200,7 +200,7 @@ static int sandbox_swap_case_read_config(const struct udevice *emul, static int sandbox_swap_case_write_config(struct udevice *emul, uint offset, ulong value, enum pci_size_t size) { - struct swap_case_platdata *plat = dev_get_platdata(emul); + struct swap_case_plat *plat = dev_get_plat(emul); switch (offset) { case PCI_COMMAND: @@ -228,7 +228,7 @@ static int sandbox_swap_case_write_config(struct udevice *emul, uint offset, static int sandbox_swap_case_find_bar(struct udevice *emul, unsigned int addr, int *barnump, unsigned int *offsetp) { - struct swap_case_platdata *plat = dev_get_platdata(emul); + struct swap_case_plat *plat = dev_get_plat(emul); int barnum; for (barnum = 0; barnum < ARRAY_SIZE(barinfo); barnum++) { @@ -391,8 +391,8 @@ U_BOOT_DRIVER(sandbox_swap_case_emul) = { .id = UCLASS_PCI_EMUL, .of_match = sandbox_swap_case_ids, .ops = &sandbox_swap_case_emul_ops, - .priv_auto_alloc_size = sizeof(struct swap_case_priv), - .platdata_auto_alloc_size = sizeof(struct swap_case_platdata), + .priv_auto = sizeof(struct swap_case_priv), + .plat_auto = sizeof(struct swap_case_plat), }; static struct pci_device_id sandbox_swap_case_supported[] = { diff --git a/drivers/misc/tegra186_bpmp.c b/drivers/misc/tegra186_bpmp.c index 18da138..f2366d6 100644 --- a/drivers/misc/tegra186_bpmp.c +++ b/drivers/misc/tegra186_bpmp.c @@ -257,5 +257,5 @@ U_BOOT_DRIVER(tegra186_bpmp) = { .probe = tegra186_bpmp_probe, .remove = tegra186_bpmp_remove, .ops = &tegra186_bpmp_ops, - .priv_auto_alloc_size = sizeof(struct tegra186_bpmp), + .priv_auto = sizeof(struct tegra186_bpmp), }; diff --git a/drivers/misc/test_drv.c b/drivers/misc/test_drv.c new file mode 100644 index 0000000..7dd3de3 --- /dev/null +++ b/drivers/misc/test_drv.c @@ -0,0 +1,222 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2014 Google, Inc + */ + +#include <common.h> +#include <dm.h> +#include <dm/test.h> + +/* Records the last testbus device that was removed */ +static struct udevice *testbus_removed; + +struct udevice *testbus_get_clear_removed(void) +{ + struct udevice *removed = testbus_removed; + + testbus_removed = NULL; + + return removed; +} + +static int testbus_drv_probe(struct udevice *dev) +{ + if (!CONFIG_IS_ENABLED(OF_PLATDATA)) { + int ret; + + ret = dm_scan_fdt_dev(dev); + if (ret) + return ret; + } + + return 0; +} + +static int testbus_child_post_bind(struct udevice *dev) +{ + struct dm_test_parent_plat *plat; + + plat = dev_get_parent_plat(dev); + plat->bind_flag = 1; + plat->uclass_bind_flag = 2; + + return 0; +} + +static int testbus_child_pre_probe(struct udevice *dev) +{ + struct dm_test_parent_data *parent_data = dev_get_parent_priv(dev); + + parent_data->flag += TEST_FLAG_CHILD_PROBED; + + return 0; +} + +static int testbus_child_pre_probe_uclass(struct udevice *dev) +{ + struct dm_test_priv *priv = dev_get_priv(dev); + + priv->uclass_flag++; + + return 0; +} + +static int testbus_child_post_probe_uclass(struct udevice *dev) +{ + struct dm_test_priv *priv = dev_get_priv(dev); + + priv->uclass_postp++; + + return 0; +} + +static int testbus_child_post_remove(struct udevice *dev) +{ + struct dm_test_parent_data *parent_data = dev_get_parent_priv(dev); + + parent_data->flag += TEST_FLAG_CHILD_REMOVED; + testbus_removed = dev; + + return 0; +} + +static const struct udevice_id testbus_ids[] = { + { .compatible = "denx,u-boot-test-bus", .data = DM_TEST_TYPE_FIRST }, + { } +}; + +U_BOOT_DRIVER(testbus_drv) = { + .name = "testbus_drv", + .of_match = testbus_ids, + .id = UCLASS_TEST_BUS, + .probe = testbus_drv_probe, + .child_post_bind = testbus_child_post_bind, + .priv_auto = sizeof(struct dm_test_priv), + .plat_auto = sizeof(struct dm_test_pdata), + .per_child_auto = sizeof(struct dm_test_parent_data), + .per_child_plat_auto = sizeof(struct dm_test_parent_plat), + .child_pre_probe = testbus_child_pre_probe, + .child_post_remove = testbus_child_post_remove, +}; + +UCLASS_DRIVER(testbus) = { + .name = "testbus", + .id = UCLASS_TEST_BUS, + .flags = DM_UC_FLAG_SEQ_ALIAS, + .child_pre_probe = testbus_child_pre_probe_uclass, + .child_post_probe = testbus_child_post_probe_uclass, +}; + +static int testfdt_drv_ping(struct udevice *dev, int pingval, int *pingret) +{ + const struct dm_test_pdata *pdata = dev_get_plat(dev); + struct dm_test_priv *priv = dev_get_priv(dev); + + *pingret = pingval + pdata->ping_add; + priv->ping_total += *pingret; + + return 0; +} + +static const struct test_ops test_ops = { + .ping = testfdt_drv_ping, +}; + +static int testfdt_of_to_plat(struct udevice *dev) +{ + struct dm_test_pdata *pdata = dev_get_plat(dev); + + pdata->ping_add = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), + "ping-add", -1); + pdata->base = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), + "ping-expect"); + + return 0; +} + +static int testfdt_drv_probe(struct udevice *dev) +{ + struct dm_test_priv *priv = dev_get_priv(dev); + + priv->ping_total += DM_TEST_START_TOTAL; + + /* + * If this device is on a bus, the uclass_flag will be set before + * calling this function. In the meantime the uclass_postp is + * initlized to a value -1. These are used respectively by + * dm_test_bus_child_pre_probe_uclass() and + * dm_test_bus_child_post_probe_uclass(). + */ + priv->uclass_total += priv->uclass_flag; + priv->uclass_postp = -1; + + return 0; +} + +static const struct udevice_id testfdt_ids[] = { + { .compatible = "denx,u-boot-fdt-test", .data = DM_TEST_TYPE_FIRST }, + { .compatible = "google,another-fdt-test", .data = DM_TEST_TYPE_SECOND }, + { } +}; + +U_BOOT_DRIVER(testfdt_drv) = { + .name = "testfdt_drv", + .of_match = testfdt_ids, + .id = UCLASS_TEST_FDT, + .of_to_plat = testfdt_of_to_plat, + .probe = testfdt_drv_probe, + .ops = &test_ops, + .priv_auto = sizeof(struct dm_test_priv), + .plat_auto = sizeof(struct dm_test_pdata), +}; + +static const struct udevice_id testfdt1_ids[] = { + { .compatible = "denx,u-boot-fdt-test1", .data = DM_TEST_TYPE_FIRST }, + { } +}; + +U_BOOT_DRIVER(testfdt1_drv) = { + .name = "testfdt1_drv", + .of_match = testfdt1_ids, + .id = UCLASS_TEST_FDT, + .of_to_plat = testfdt_of_to_plat, + .probe = testfdt_drv_probe, + .ops = &test_ops, + .priv_auto = sizeof(struct dm_test_priv), + .plat_auto = sizeof(struct dm_test_pdata), + .flags = DM_FLAG_PRE_RELOC, +}; + +/* From here is the testfdt uclass code */ +int testfdt_ping(struct udevice *dev, int pingval, int *pingret) +{ + const struct test_ops *ops = device_get_ops(dev); + + if (!ops->ping) + return -ENOSYS; + + return ops->ping(dev, pingval, pingret); +} + +UCLASS_DRIVER(testfdt) = { + .name = "testfdt", + .id = UCLASS_TEST_FDT, + .flags = DM_UC_FLAG_SEQ_ALIAS, +}; + +static const struct udevice_id testfdtm_ids[] = { + { .compatible = "denx,u-boot-fdtm-test" }, + { } +}; + +U_BOOT_DRIVER(testfdtm_drv) = { + .name = "testfdtm_drv", + .of_match = testfdtm_ids, + .id = UCLASS_TEST_FDT_MANUAL, +}; + +UCLASS_DRIVER(testfdtm) = { + .name = "testfdtm", + .id = UCLASS_TEST_FDT_MANUAL, + .flags = DM_UC_FLAG_SEQ_ALIAS | DM_UC_FLAG_NO_AUTO_SEQ, +}; diff --git a/drivers/misc/vexpress_config.c b/drivers/misc/vexpress_config.c index 02e5b58..2baca48 100644 --- a/drivers/misc/vexpress_config.c +++ b/drivers/misc/vexpress_config.c @@ -109,7 +109,7 @@ static int vexpress_config_probe(struct udevice *dev) if (!priv) return -ENOMEM; - dev->uclass_priv = priv; + dev_get_uclass_priv(dev) = priv; priv->addr = ofnode_get_addr(args.node); return dev_read_u32(dev, "arm,vexpress,site", &priv->site); diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c index 82abf48..baa935e 100644 --- a/drivers/mmc/am654_sdhci.c +++ b/drivers/mmc/am654_sdhci.c @@ -129,7 +129,7 @@ static void am654_sdhci_set_control_reg(struct sdhci_host *host) static int am654_sdhci_set_ios_post(struct sdhci_host *host) { struct udevice *dev = host->mmc->dev; - struct am654_sdhci_plat *plat = dev_get_platdata(dev); + struct am654_sdhci_plat *plat = dev_get_plat(dev); unsigned int speed = host->mmc->clock; int sel50, sel100, freqsel; u32 otap_del_sel; @@ -269,7 +269,7 @@ int am654_sdhci_init(struct am654_sdhci_plat *plat) static int am654_sdhci_deferred_probe(struct sdhci_host *host) { struct udevice *dev = host->mmc->dev; - struct am654_sdhci_plat *plat = dev_get_platdata(dev); + struct am654_sdhci_plat *plat = dev_get_plat(dev); unsigned long start; int val; @@ -311,7 +311,7 @@ const struct am654_driver_data j721e_8bit_drv_data = { static int j721e_4bit_sdhci_set_ios_post(struct sdhci_host *host) { struct udevice *dev = host->mmc->dev; - struct am654_sdhci_plat *plat = dev_get_platdata(dev); + struct am654_sdhci_plat *plat = dev_get_plat(dev); u32 otap_del_sel, mask, val; otap_del_sel = plat->otap_del_sel[host->mmc->selected_mode]; @@ -335,7 +335,7 @@ const struct am654_driver_data j721e_4bit_drv_data = { static int sdhci_am654_get_otap_delay(struct udevice *dev, struct mmc_config *cfg) { - struct am654_sdhci_plat *plat = dev_get_platdata(dev); + struct am654_sdhci_plat *plat = dev_get_plat(dev); int ret; int i; @@ -367,7 +367,7 @@ static int am654_sdhci_probe(struct udevice *dev) { struct am654_driver_data *drv_data = (struct am654_driver_data *)dev_get_driver_data(dev); - struct am654_sdhci_plat *plat = dev_get_platdata(dev); + struct am654_sdhci_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct sdhci_host *host = dev_get_priv(dev); struct mmc_config *cfg = &plat->cfg; @@ -408,9 +408,9 @@ static int am654_sdhci_probe(struct udevice *dev) return 0; } -static int am654_sdhci_ofdata_to_platdata(struct udevice *dev) +static int am654_sdhci_of_to_plat(struct udevice *dev) { - struct am654_sdhci_plat *plat = dev_get_platdata(dev); + struct am654_sdhci_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); struct mmc_config *cfg = &plat->cfg; u32 drv_strength; @@ -463,7 +463,7 @@ static int am654_sdhci_bind(struct udevice *dev) { struct am654_driver_data *drv_data = (struct am654_driver_data *)dev_get_driver_data(dev); - struct am654_sdhci_plat *plat = dev_get_platdata(dev); + struct am654_sdhci_plat *plat = dev_get_plat(dev); plat->flags = drv_data->flags; @@ -490,10 +490,10 @@ U_BOOT_DRIVER(am654_sdhci_drv) = { .name = "am654_sdhci", .id = UCLASS_MMC, .of_match = am654_sdhci_ids, - .ofdata_to_platdata = am654_sdhci_ofdata_to_platdata, + .of_to_plat = am654_sdhci_of_to_plat, .ops = &sdhci_ops, .bind = am654_sdhci_bind, .probe = am654_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct am654_sdhci_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct am654_sdhci_plat), }; diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c index 8466228..b2d1b4f 100644 --- a/drivers/mmc/arm_pl180_mmci.c +++ b/drivers/mmc/arm_pl180_mmci.c @@ -418,10 +418,10 @@ static void arm_pl180_mmc_init(struct pl180_mmc_host *host) static int arm_pl180_mmc_probe(struct udevice *dev) { - struct arm_pl180_mmc_plat *pdata = dev_get_platdata(dev); + struct arm_pl180_mmc_plat *pdata = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct mmc *mmc = &pdata->mmc; - struct pl180_mmc_host *host = dev->priv; + struct pl180_mmc_host *host = dev_get_priv(dev); struct mmc_config *cfg = &pdata->cfg; struct clk clk; u32 bus_width; @@ -486,7 +486,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev) int arm_pl180_mmc_bind(struct udevice *dev) { - struct arm_pl180_mmc_plat *plat = dev_get_platdata(dev); + struct arm_pl180_mmc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -508,7 +508,7 @@ static int dm_host_set_ios(struct udevice *dev) static int dm_mmc_getcd(struct udevice *dev) { - struct pl180_mmc_host *host = dev->priv; + struct pl180_mmc_host *host = dev_get_priv(dev); int value = 1; if (dm_gpio_is_valid(&host->cd_gpio)) @@ -523,9 +523,9 @@ static const struct dm_mmc_ops arm_pl180_dm_mmc_ops = { .get_cd = dm_mmc_getcd, }; -static int arm_pl180_mmc_ofdata_to_platdata(struct udevice *dev) +static int arm_pl180_mmc_of_to_plat(struct udevice *dev) { - struct pl180_mmc_host *host = dev->priv; + struct pl180_mmc_host *host = dev_get_priv(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -549,9 +549,9 @@ U_BOOT_DRIVER(arm_pl180_mmc) = { .of_match = arm_pl180_mmc_match, .ops = &arm_pl180_dm_mmc_ops, .probe = arm_pl180_mmc_probe, - .ofdata_to_platdata = arm_pl180_mmc_ofdata_to_platdata, + .of_to_plat = arm_pl180_mmc_of_to_plat, .bind = arm_pl180_mmc_bind, - .priv_auto_alloc_size = sizeof(struct pl180_mmc_host), - .platdata_auto_alloc_size = sizeof(struct arm_pl180_mmc_plat), + .priv_auto = sizeof(struct pl180_mmc_host), + .plat_auto = sizeof(struct arm_pl180_mmc_plat), }; #endif diff --git a/drivers/mmc/aspeed_sdhci.c b/drivers/mmc/aspeed_sdhci.c index 543c65a..4537315 100644 --- a/drivers/mmc/aspeed_sdhci.c +++ b/drivers/mmc/aspeed_sdhci.c @@ -19,7 +19,7 @@ struct aspeed_sdhci_plat { static int aspeed_sdhci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct aspeed_sdhci_plat *plat = dev_get_platdata(dev); + struct aspeed_sdhci_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); u32 max_clk; struct clk clk; @@ -67,7 +67,7 @@ free: static int aspeed_sdhci_bind(struct udevice *dev) { - struct aspeed_sdhci_plat *plat = dev_get_platdata(dev); + struct aspeed_sdhci_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -86,6 +86,6 @@ U_BOOT_DRIVER(aspeed_sdhci_drv) = { .ops = &sdhci_ops, .bind = aspeed_sdhci_bind, .probe = aspeed_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct aspeed_sdhci_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct aspeed_sdhci_plat), }; diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c index ca7a98b..d7dbc23 100644 --- a/drivers/mmc/atmel_sdhci.c +++ b/drivers/mmc/atmel_sdhci.c @@ -54,7 +54,7 @@ struct atmel_sdhci_plat { static int atmel_sdhci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct atmel_sdhci_plat *plat = dev_get_platdata(dev); + struct atmel_sdhci_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); u32 max_clk; struct clk clk; @@ -112,7 +112,7 @@ static int atmel_sdhci_probe(struct udevice *dev) static int atmel_sdhci_bind(struct udevice *dev) { - struct atmel_sdhci_plat *plat = dev_get_platdata(dev); + struct atmel_sdhci_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -131,7 +131,7 @@ U_BOOT_DRIVER(atmel_sdhci_drv) = { .ops = &sdhci_ops, .bind = atmel_sdhci_bind, .probe = atmel_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct atmel_sdhci_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct atmel_sdhci_plat), }; #endif diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c index 7a410d1..5e48394 100644 --- a/drivers/mmc/bcm2835_sdhci.c +++ b/drivers/mmc/bcm2835_sdhci.c @@ -166,7 +166,7 @@ static const struct sdhci_ops bcm2835_ops = { static int bcm2835_sdhci_bind(struct udevice *dev) { - struct bcm2835_sdhci_plat *plat = dev_get_platdata(dev); + struct bcm2835_sdhci_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -174,7 +174,7 @@ static int bcm2835_sdhci_bind(struct udevice *dev) static int bcm2835_sdhci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct bcm2835_sdhci_plat *plat = dev_get_platdata(dev); + struct bcm2835_sdhci_plat *plat = dev_get_plat(dev); struct bcm2835_sdhci_host *priv = dev_get_priv(dev); struct sdhci_host *host = &priv->host; fdt_addr_t base; @@ -250,7 +250,7 @@ U_BOOT_DRIVER(sdhci_cdns) = { .of_match = bcm2835_sdhci_match, .bind = bcm2835_sdhci_bind, .probe = bcm2835_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct bcm2835_sdhci_host), - .platdata_auto_alloc_size = sizeof(struct bcm2835_sdhci_plat), + .priv_auto = sizeof(struct bcm2835_sdhci_host), + .plat_auto = sizeof(struct bcm2835_sdhci_plat), .ops = &sdhci_ops, }; diff --git a/drivers/mmc/bcm2835_sdhost.c b/drivers/mmc/bcm2835_sdhost.c index ea8b385..894dbdd 100644 --- a/drivers/mmc/bcm2835_sdhost.c +++ b/drivers/mmc/bcm2835_sdhost.c @@ -755,7 +755,7 @@ static void bcm2835_add_host(struct bcm2835_host *host) static int bcm2835_probe(struct udevice *dev) { - struct bcm2835_plat *plat = dev_get_platdata(dev); + struct bcm2835_plat *plat = dev_get_plat(dev); struct bcm2835_host *host = dev_get_priv(dev); struct mmc *mmc = mmc_get_mmc_dev(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); @@ -795,7 +795,7 @@ static const struct dm_mmc_ops bcm2835_ops = { static int bcm2835_bind(struct udevice *dev) { - struct bcm2835_plat *plat = dev_get_platdata(dev); + struct bcm2835_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -806,7 +806,7 @@ U_BOOT_DRIVER(bcm2835_sdhost) = { .of_match = bcm2835_match, .bind = bcm2835_bind, .probe = bcm2835_probe, - .priv_auto_alloc_size = sizeof(struct bcm2835_host), - .platdata_auto_alloc_size = sizeof(struct bcm2835_plat), + .priv_auto = sizeof(struct bcm2835_host), + .plat_auto = sizeof(struct bcm2835_plat), .ops = &bcm2835_ops, }; diff --git a/drivers/mmc/bcmstb_sdhci.c b/drivers/mmc/bcmstb_sdhci.c index 5269aa7..dc96818 100644 --- a/drivers/mmc/bcmstb_sdhci.c +++ b/drivers/mmc/bcmstb_sdhci.c @@ -49,7 +49,7 @@ struct sdhci_bcmstb_plat { static int sdhci_bcmstb_bind(struct udevice *dev) { - struct sdhci_bcmstb_plat *plat = dev_get_platdata(dev); + struct sdhci_bcmstb_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -57,7 +57,7 @@ static int sdhci_bcmstb_bind(struct udevice *dev) static int sdhci_bcmstb_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct sdhci_bcmstb_plat *plat = dev_get_platdata(dev); + struct sdhci_bcmstb_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); fdt_addr_t base; int ret; @@ -100,6 +100,6 @@ U_BOOT_DRIVER(sdhci_bcmstb) = { .ops = &sdhci_ops, .bind = sdhci_bcmstb_bind, .probe = sdhci_bcmstb_probe, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct sdhci_bcmstb_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct sdhci_bcmstb_plat), }; diff --git a/drivers/mmc/ca_dw_mmc.c b/drivers/mmc/ca_dw_mmc.c index 198c41f..fad2ff5 100644 --- a/drivers/mmc/ca_dw_mmc.c +++ b/drivers/mmc/ca_dw_mmc.c @@ -87,7 +87,7 @@ unsigned int ca_dwmci_get_mmc_clock(struct dwmci_host *host, uint freq) return SD_SCLK_MAX / clk_div / (host->div + 1); } -static int ca_dwmmc_ofdata_to_platdata(struct udevice *dev) +static int ca_dwmmc_of_to_plat(struct udevice *dev) { struct ca_dwmmc_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -124,7 +124,7 @@ struct dm_mmc_ops ca_dwmci_dm_ops; static int ca_dwmmc_probe(struct udevice *dev) { - struct ca_mmc_plat *plat = dev_get_platdata(dev); + struct ca_mmc_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct ca_dwmmc_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -148,7 +148,7 @@ static int ca_dwmmc_probe(struct udevice *dev) static int ca_dwmmc_bind(struct udevice *dev) { - struct ca_mmc_plat *plat = dev_get_platdata(dev); + struct ca_mmc_plat *plat = dev_get_plat(dev); return dwmci_bind(dev, &plat->mmc, &plat->cfg); } @@ -162,10 +162,10 @@ U_BOOT_DRIVER(ca_dwmmc_drv) = { .name = "cortina_dwmmc", .id = UCLASS_MMC, .of_match = ca_dwmmc_ids, - .ofdata_to_platdata = ca_dwmmc_ofdata_to_platdata, + .of_to_plat = ca_dwmmc_of_to_plat, .bind = ca_dwmmc_bind, .ops = &ca_dwmci_dm_ops, .probe = ca_dwmmc_probe, - .priv_auto_alloc_size = sizeof(struct ca_dwmmc_priv_data), - .platdata_auto_alloc_size = sizeof(struct ca_mmc_plat), + .priv_auto = sizeof(struct ca_dwmmc_priv_data), + .plat_auto = sizeof(struct ca_mmc_plat), }; diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c index 0a05fb1..05ca361 100644 --- a/drivers/mmc/davinci_mmc.c +++ b/drivers/mmc/davinci_mmc.c @@ -478,7 +478,7 @@ int davinci_mmc_init(struct bd_info *bis, struct davinci_mmc *host) static int davinci_mmc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct davinci_mmc_plat *plat = dev_get_platdata(dev); + struct davinci_mmc_plat *plat = dev_get_plat(dev); struct davinci_mmc_priv *priv = dev_get_priv(dev); priv->reg_base = plat->reg_base; @@ -495,15 +495,15 @@ static int davinci_mmc_probe(struct udevice *dev) static int davinci_mmc_bind(struct udevice *dev) { - struct davinci_mmc_plat *plat = dev_get_platdata(dev); + struct davinci_mmc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } #if CONFIG_IS_ENABLED(OF_CONTROL) -static int davinci_mmc_ofdata_to_platdata(struct udevice *dev) +static int davinci_mmc_of_to_plat(struct udevice *dev) { - struct davinci_mmc_plat *plat = dev_get_platdata(dev); + struct davinci_mmc_plat *plat = dev_get_plat(dev); struct mmc_config *cfg = &plat->cfg; plat->reg_base = (struct davinci_mmc_regs *)dev_read_addr(dev); @@ -527,15 +527,15 @@ U_BOOT_DRIVER(ti_da830_mmc) = { .id = UCLASS_MMC, #if CONFIG_IS_ENABLED(OF_CONTROL) .of_match = davinci_mmc_ids, - .platdata_auto_alloc_size = sizeof(struct davinci_mmc_plat), - .ofdata_to_platdata = davinci_mmc_ofdata_to_platdata, + .plat_auto = sizeof(struct davinci_mmc_plat), + .of_to_plat = davinci_mmc_of_to_plat, #endif #if CONFIG_BLK .bind = davinci_mmc_bind, #endif .probe = davinci_mmc_probe, .ops = &davinci_mmc_ops, - .priv_auto_alloc_size = sizeof(struct davinci_mmc_priv), + .priv_auto = sizeof(struct davinci_mmc_priv), #if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, #endif diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 435ccac..3aa9fb3 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -263,7 +263,7 @@ int exynos_dwmmc_init(const void *blob) #ifdef CONFIG_DM_MMC static int exynos_dwmmc_probe(struct udevice *dev) { - struct exynos_mmc_plat *plat = dev_get_platdata(dev); + struct exynos_mmc_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct dwmci_exynos_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -288,7 +288,7 @@ static int exynos_dwmmc_probe(struct udevice *dev) static int exynos_dwmmc_bind(struct udevice *dev) { - struct exynos_mmc_plat *plat = dev_get_platdata(dev); + struct exynos_mmc_plat *plat = dev_get_plat(dev); return dwmci_bind(dev, &plat->mmc, &plat->cfg); } @@ -306,7 +306,7 @@ U_BOOT_DRIVER(exynos_dwmmc_drv) = { .bind = exynos_dwmmc_bind, .ops = &dm_dwmci_ops, .probe = exynos_dwmmc_probe, - .priv_auto_alloc_size = sizeof(struct dwmci_exynos_priv_data), - .platdata_auto_alloc_size = sizeof(struct exynos_mmc_plat), + .priv_auto = sizeof(struct dwmci_exynos_priv_data), + .plat_auto = sizeof(struct exynos_mmc_plat), }; #endif diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index a18316e..b5f3fd1 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -955,7 +955,7 @@ int fsl_esdhc_mmc_init(struct bd_info *bis) static int fsl_esdhc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); u32 caps, hostver; fdt_addr_t addr; @@ -1022,7 +1022,7 @@ static int fsl_esdhc_probe(struct udevice *dev) static int fsl_esdhc_get_cd(struct udevice *dev) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); if (plat->cfg.host_caps & MMC_CAP_NONREMOVABLE) @@ -1034,7 +1034,7 @@ static int fsl_esdhc_get_cd(struct udevice *dev) static int fsl_esdhc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); return esdhc_send_cmd_common(priv, &plat->mmc, cmd, data); @@ -1042,7 +1042,7 @@ static int fsl_esdhc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, static int fsl_esdhc_set_ios(struct udevice *dev) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); return esdhc_set_ios_common(priv, &plat->mmc); @@ -1050,7 +1050,7 @@ static int fsl_esdhc_set_ios(struct udevice *dev) static int fsl_esdhc_reinit(struct udevice *dev) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); return esdhc_init_common(priv, &plat->mmc); @@ -1059,7 +1059,7 @@ static int fsl_esdhc_reinit(struct udevice *dev) #ifdef MMC_SUPPORTS_TUNING static int fsl_esdhc_execute_tuning(struct udevice *dev, uint32_t opcode) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); struct fsl_esdhc *regs = priv->esdhc_regs; u32 val, irqstaten; @@ -1124,7 +1124,7 @@ static const struct udevice_id fsl_esdhc_ids[] = { static int fsl_esdhc_bind(struct udevice *dev) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -1136,7 +1136,7 @@ U_BOOT_DRIVER(fsl_esdhc) = { .ops = &fsl_esdhc_ops, .bind = fsl_esdhc_bind, .probe = fsl_esdhc_probe, - .platdata_auto_alloc_size = sizeof(struct fsl_esdhc_plat), - .priv_auto_alloc_size = sizeof(struct fsl_esdhc_priv), + .plat_auto = sizeof(struct fsl_esdhc_plat), + .priv_auto = sizeof(struct fsl_esdhc_priv), }; #endif diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index e5409ad..f47a095 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -850,7 +850,7 @@ static void esdhc_stop_tuning(struct mmc *mmc) static int fsl_esdhc_execute_tuning(struct udevice *dev, uint32_t opcode) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); struct fsl_esdhc *regs = priv->esdhc_regs; struct mmc *mmc = &plat->mmc; @@ -1400,7 +1400,7 @@ __weak void init_clk_usdhc(u32 index) { } -static int fsl_esdhc_ofdata_to_platdata(struct udevice *dev) +static int fsl_esdhc_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct fsl_esdhc_priv *priv = dev_get_priv(dev); @@ -1490,7 +1490,7 @@ static int fsl_esdhc_ofdata_to_platdata(struct udevice *dev) static int fsl_esdhc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); struct esdhc_soc_data *data = (struct esdhc_soc_data *)dev_get_driver_data(dev); @@ -1558,7 +1558,7 @@ static int fsl_esdhc_probe(struct udevice *dev) * work as expected. */ - init_clk_usdhc(dev->seq); + init_clk_usdhc(dev_seq(dev)); #if CONFIG_IS_ENABLED(CLK) /* Assigned clock already set clock */ @@ -1575,7 +1575,7 @@ static int fsl_esdhc_probe(struct udevice *dev) priv->sdhc_clk = clk_get_rate(&priv->per_clk); #else - priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev->seq); + priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev_seq(dev)); if (priv->sdhc_clk <= 0) { dev_err(dev, "Unable to get clk for %s\n", dev->name); return -EINVAL; @@ -1633,7 +1633,7 @@ static int fsl_esdhc_get_cd(struct udevice *dev) static int fsl_esdhc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); return esdhc_send_cmd_common(priv, &plat->mmc, cmd, data); @@ -1641,7 +1641,7 @@ static int fsl_esdhc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, static int fsl_esdhc_set_ios(struct udevice *dev) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); struct fsl_esdhc_priv *priv = dev_get_priv(dev); return esdhc_set_ios_common(priv, &plat->mmc); @@ -1722,7 +1722,7 @@ static const struct udevice_id fsl_esdhc_ids[] = { #if CONFIG_IS_ENABLED(BLK) static int fsl_esdhc_bind(struct udevice *dev) { - struct fsl_esdhc_plat *plat = dev_get_platdata(dev); + struct fsl_esdhc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -1732,15 +1732,15 @@ U_BOOT_DRIVER(fsl_esdhc) = { .name = "fsl_esdhc", .id = UCLASS_MMC, .of_match = fsl_esdhc_ids, - .ofdata_to_platdata = fsl_esdhc_ofdata_to_platdata, + .of_to_plat = fsl_esdhc_of_to_plat, .ops = &fsl_esdhc_ops, #if CONFIG_IS_ENABLED(BLK) .bind = fsl_esdhc_bind, #endif .probe = fsl_esdhc_probe, - .platdata_auto_alloc_size = sizeof(struct fsl_esdhc_plat), - .priv_auto_alloc_size = sizeof(struct fsl_esdhc_priv), + .plat_auto = sizeof(struct fsl_esdhc_plat), + .priv_auto = sizeof(struct fsl_esdhc_priv), }; -U_BOOT_DRIVER_ALIAS(fsl_esdhc, fsl_imx6q_usdhc) +DM_DRIVER_ALIAS(fsl_esdhc, fsl_imx6q_usdhc) #endif diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c index bc0d5ff..fa6181d 100644 --- a/drivers/mmc/ftsdc010_mci.c +++ b/drivers/mmc/ftsdc010_mci.c @@ -389,7 +389,7 @@ static void ftsdc_setup_cfg(struct mmc_config *cfg, const char *name, int buswid cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT; } -static int ftsdc010_mmc_ofdata_to_platdata(struct udevice *dev) +static int ftsdc010_mmc_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct ftsdc_priv *priv = dev_get_priv(dev); @@ -424,7 +424,7 @@ static int ftsdc010_mmc_ofdata_to_platdata(struct udevice *dev) static int ftsdc010_mmc_probe(struct udevice *dev) { - struct ftsdc010_plat *plat = dev_get_platdata(dev); + struct ftsdc010_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct ftsdc_priv *priv = dev_get_priv(dev); struct ftsdc010_chip *chip = &priv->chip; @@ -459,7 +459,7 @@ static int ftsdc010_mmc_probe(struct udevice *dev) int ftsdc010_mmc_bind(struct udevice *dev) { - struct ftsdc010_plat *plat = dev_get_platdata(dev); + struct ftsdc010_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -473,10 +473,10 @@ U_BOOT_DRIVER(ftsdc010_mmc) = { .name = "ftsdc010_mmc", .id = UCLASS_MMC, .of_match = ftsdc010_mmc_ids, - .ofdata_to_platdata = ftsdc010_mmc_ofdata_to_platdata, + .of_to_plat = ftsdc010_mmc_of_to_plat, .ops = &dm_ftsdc010_mmc_ops, .bind = ftsdc010_mmc_bind, .probe = ftsdc010_mmc_probe, - .priv_auto_alloc_size = sizeof(struct ftsdc_priv), - .platdata_auto_alloc_size = sizeof(struct ftsdc010_plat), + .priv_auto = sizeof(struct ftsdc_priv), + .plat_auto = sizeof(struct ftsdc010_plat), }; diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c index 0a347b2..da81425 100644 --- a/drivers/mmc/gen_atmel_mci.c +++ b/drivers/mmc/gen_atmel_mci.c @@ -91,7 +91,7 @@ static inline void mci_set_blklen(atmel_mci_t *mci, int blklen) #ifdef CONFIG_DM_MMC static void mci_set_mode(struct udevice *dev, u32 hz, u32 blklen) { - struct atmel_mci_plat *plat = dev_get_platdata(dev); + struct atmel_mci_plat *plat = dev_get_plat(dev); struct atmel_mci_priv *priv = dev_get_priv(dev); struct mmc *mmc = &plat->mmc; u32 bus_hz = priv->bus_clk_rate; @@ -242,7 +242,7 @@ io_fail: static int atmel_mci_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) { - struct atmel_mci_plat *plat = dev_get_platdata(dev); + struct atmel_mci_plat *plat = dev_get_plat(dev); struct atmel_mci_priv *priv = dev_get_priv(dev); atmel_mci_t *mci = plat->mci; #else @@ -373,7 +373,7 @@ mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) #ifdef CONFIG_DM_MMC static int atmel_mci_set_ios(struct udevice *dev) { - struct atmel_mci_plat *plat = dev_get_platdata(dev); + struct atmel_mci_plat *plat = dev_get_plat(dev); struct mmc *mmc = mmc_get_mmc_dev(dev); atmel_mci_t *mci = plat->mci; #else @@ -424,7 +424,7 @@ static int mci_set_ios(struct mmc *mmc) #ifdef CONFIG_DM_MMC static int atmel_mci_hw_init(struct udevice *dev) { - struct atmel_mci_plat *plat = dev_get_platdata(dev); + struct atmel_mci_plat *plat = dev_get_plat(dev); atmel_mci_t *mci = plat->mci; #else /* Entered into mmc structure during driver init */ @@ -525,7 +525,7 @@ static const struct dm_mmc_ops atmel_mci_mmc_ops = { static void atmel_mci_setup_cfg(struct udevice *dev) { - struct atmel_mci_plat *plat = dev_get_platdata(dev); + struct atmel_mci_plat *plat = dev_get_plat(dev); struct atmel_mci_priv *priv = dev_get_priv(dev); struct mmc_config *cfg; u32 version; @@ -584,7 +584,7 @@ failed: static int atmel_mci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct atmel_mci_plat *plat = dev_get_platdata(dev); + struct atmel_mci_plat *plat = dev_get_plat(dev); struct mmc *mmc; int ret; @@ -608,7 +608,7 @@ static int atmel_mci_probe(struct udevice *dev) static int atmel_mci_bind(struct udevice *dev) { - struct atmel_mci_plat *plat = dev_get_platdata(dev); + struct atmel_mci_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -624,8 +624,8 @@ U_BOOT_DRIVER(atmel_mci) = { .of_match = atmel_mci_ids, .bind = atmel_mci_bind, .probe = atmel_mci_probe, - .platdata_auto_alloc_size = sizeof(struct atmel_mci_plat), - .priv_auto_alloc_size = sizeof(struct atmel_mci_priv), + .plat_auto = sizeof(struct atmel_mci_plat), + .priv_auto = sizeof(struct atmel_mci_priv), .ops = &atmel_mci_mmc_ops, }; #endif diff --git a/drivers/mmc/hi6220_dw_mmc.c b/drivers/mmc/hi6220_dw_mmc.c index 67d6a05..bb5d092 100644 --- a/drivers/mmc/hi6220_dw_mmc.c +++ b/drivers/mmc/hi6220_dw_mmc.c @@ -27,7 +27,7 @@ struct hisi_mmc_data { bool use_fifo; }; -static int hi6220_dwmmc_ofdata_to_platdata(struct udevice *dev) +static int hi6220_dwmmc_of_to_plat(struct udevice *dev) { struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -50,7 +50,7 @@ static int hi6220_dwmmc_ofdata_to_platdata(struct udevice *dev) static int hi6220_dwmmc_probe(struct udevice *dev) { - struct hi6220_dwmmc_plat *plat = dev_get_platdata(dev); + struct hi6220_dwmmc_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -74,7 +74,7 @@ static int hi6220_dwmmc_probe(struct udevice *dev) static int hi6220_dwmmc_bind(struct udevice *dev) { - struct hi6220_dwmmc_plat *plat = dev_get_platdata(dev); + struct hi6220_dwmmc_plat *plat = dev_get_plat(dev); int ret; ret = dwmci_bind(dev, &plat->mmc, &plat->cfg); @@ -108,10 +108,10 @@ U_BOOT_DRIVER(hi6220_dwmmc_drv) = { .name = "hi6220_dwmmc", .id = UCLASS_MMC, .of_match = hi6220_dwmmc_ids, - .ofdata_to_platdata = hi6220_dwmmc_ofdata_to_platdata, + .of_to_plat = hi6220_dwmmc_of_to_plat, .ops = &dm_dwmci_ops, .bind = hi6220_dwmmc_bind, .probe = hi6220_dwmmc_probe, - .priv_auto_alloc_size = sizeof(struct hi6220_dwmmc_priv_data), - .platdata_auto_alloc_size = sizeof(struct hi6220_dwmmc_plat), + .priv_auto = sizeof(struct hi6220_dwmmc_priv_data), + .plat_auto = sizeof(struct hi6220_dwmmc_plat), }; diff --git a/drivers/mmc/iproc_sdhci.c b/drivers/mmc/iproc_sdhci.c index 9f53063..f931e4b 100644 --- a/drivers/mmc/iproc_sdhci.c +++ b/drivers/mmc/iproc_sdhci.c @@ -172,7 +172,7 @@ struct iproc_sdhci_plat { static int iproc_sdhci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct iproc_sdhci_plat *plat = dev_get_platdata(dev); + struct iproc_sdhci_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); struct sdhci_iproc_host *iproc_host; int node = dev_of_offset(dev); @@ -230,7 +230,7 @@ static int iproc_sdhci_probe(struct udevice *dev) static int iproc_sdhci_bind(struct udevice *dev) { - struct iproc_sdhci_plat *plat = dev_get_platdata(dev); + struct iproc_sdhci_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -247,6 +247,6 @@ U_BOOT_DRIVER(iproc_sdhci_drv) = { .ops = &sdhci_ops, .bind = iproc_sdhci_bind, .probe = iproc_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct iproc_sdhci_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct iproc_sdhci_plat), }; diff --git a/drivers/mmc/jz_mmc.c b/drivers/mmc/jz_mmc.c index b33f085..ae3af39 100644 --- a/drivers/mmc/jz_mmc.c +++ b/drivers/mmc/jz_mmc.c @@ -443,10 +443,10 @@ static const struct dm_mmc_ops jz_msc_ops = { .set_ios = jz_mmc_dm_set_ios, }; -static int jz_mmc_ofdata_to_platdata(struct udevice *dev) +static int jz_mmc_of_to_plat(struct udevice *dev) { struct jz_mmc_priv *priv = dev_get_priv(dev); - struct jz_mmc_plat *plat = dev_get_platdata(dev); + struct jz_mmc_plat *plat = dev_get_plat(dev); struct mmc_config *cfg; int ret; @@ -473,7 +473,7 @@ static int jz_mmc_ofdata_to_platdata(struct udevice *dev) static int jz_mmc_bind(struct udevice *dev) { - struct jz_mmc_plat *plat = dev_get_platdata(dev); + struct jz_mmc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -482,7 +482,7 @@ static int jz_mmc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct jz_mmc_priv *priv = dev_get_priv(dev); - struct jz_mmc_plat *plat = dev_get_platdata(dev); + struct jz_mmc_plat *plat = dev_get_plat(dev); plat->mmc.priv = priv; upriv->mmc = &plat->mmc; @@ -498,11 +498,11 @@ U_BOOT_DRIVER(jz_mmc_drv) = { .name = "jz_mmc", .id = UCLASS_MMC, .of_match = jz_mmc_ids, - .ofdata_to_platdata = jz_mmc_ofdata_to_platdata, + .of_to_plat = jz_mmc_of_to_plat, .bind = jz_mmc_bind, .probe = jz_mmc_probe, - .priv_auto_alloc_size = sizeof(struct jz_mmc_priv), - .platdata_auto_alloc_size = sizeof(struct jz_mmc_plat), + .priv_auto = sizeof(struct jz_mmc_priv), + .plat_auto = sizeof(struct jz_mmc_plat), .ops = &jz_msc_ops, }; #endif /* CONFIG_DM_MMC */ diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c index a5e9ac5..8b6dfa3 100644 --- a/drivers/mmc/meson_gx_mmc.c +++ b/drivers/mmc/meson_gx_mmc.c @@ -27,7 +27,7 @@ bool meson_gx_mmc_is_compatible(struct udevice *dev, static inline void *get_regbase(const struct mmc *mmc) { - struct meson_mmc_platdata *pdata = mmc->priv; + struct meson_mmc_plat *pdata = mmc->priv; return pdata->regbase; } @@ -160,7 +160,7 @@ static void meson_mmc_setup_cmd(struct mmc *mmc, struct mmc_data *data, static void meson_mmc_setup_addr(struct mmc *mmc, struct mmc_data *data) { - struct meson_mmc_platdata *pdata = mmc->priv; + struct meson_mmc_plat *pdata = mmc->priv; unsigned int data_size; uint32_t data_addr = 0; @@ -198,7 +198,7 @@ static int meson_dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) { struct mmc *mmc = mmc_get_mmc_dev(dev); - struct meson_mmc_platdata *pdata = mmc->priv; + struct meson_mmc_plat *pdata = mmc->priv; uint32_t status; ulong start; int ret = 0; @@ -241,9 +241,9 @@ static const struct dm_mmc_ops meson_dm_mmc_ops = { .set_ios = meson_dm_mmc_set_ios, }; -static int meson_mmc_ofdata_to_platdata(struct udevice *dev) +static int meson_mmc_of_to_plat(struct udevice *dev) { - struct meson_mmc_platdata *pdata = dev_get_platdata(dev); + struct meson_mmc_plat *pdata = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -257,7 +257,7 @@ static int meson_mmc_ofdata_to_platdata(struct udevice *dev) static int meson_mmc_probe(struct udevice *dev) { - struct meson_mmc_platdata *pdata = dev_get_platdata(dev); + struct meson_mmc_plat *pdata = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct mmc *mmc = &pdata->mmc; struct mmc_config *cfg = &pdata->cfg; @@ -320,7 +320,7 @@ static int meson_mmc_probe(struct udevice *dev) int meson_mmc_bind(struct udevice *dev) { - struct meson_mmc_platdata *pdata = dev_get_platdata(dev); + struct meson_mmc_plat *pdata = dev_get_plat(dev); return mmc_bind(dev, &pdata->mmc, &pdata->cfg); } @@ -339,8 +339,8 @@ U_BOOT_DRIVER(meson_mmc) = { .ops = &meson_dm_mmc_ops, .probe = meson_mmc_probe, .bind = meson_mmc_bind, - .ofdata_to_platdata = meson_mmc_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct meson_mmc_platdata), + .of_to_plat = meson_mmc_of_to_plat, + .plat_auto = sizeof(struct meson_mmc_plat), }; #ifdef CONFIG_PWRSEQ diff --git a/drivers/mmc/meson_gx_mmc.h b/drivers/mmc/meson_gx_mmc.h index 92aec53..8974b78 100644 --- a/drivers/mmc/meson_gx_mmc.h +++ b/drivers/mmc/meson_gx_mmc.h @@ -84,7 +84,7 @@ enum meson_gx_mmc_compatible { #define MESON_SD_EMMC_CMD_RSP2 0x64 #define MESON_SD_EMMC_CMD_RSP3 0x68 -struct meson_mmc_platdata { +struct meson_mmc_plat { struct mmc_config cfg; struct mmc mmc; void *regbase; diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index 285ac48..53eabc9 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -321,7 +321,7 @@ struct blk_desc *mmc_get_blk_desc(struct mmc *mmc) device_find_first_child(mmc->dev, &dev); if (!dev) return NULL; - desc = dev_get_uclass_platdata(dev); + desc = dev_get_uclass_plat(dev); return desc; } @@ -399,7 +399,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg) debug("Cannot create block device\n"); return ret; } - bdesc = dev_get_uclass_platdata(bdev); + bdesc = dev_get_uclass_plat(bdev); mmc->cfg = cfg; mmc->priv = dev; @@ -435,7 +435,7 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart) { struct udevice *mmc_dev = dev_get_parent(bdev); struct mmc *mmc = mmc_get_mmc_dev(mmc_dev); - struct blk_desc *desc = dev_get_uclass_platdata(bdev); + struct blk_desc *desc = dev_get_uclass_plat(bdev); int ret; if (desc->hwpart == hwpart) @@ -508,5 +508,5 @@ UCLASS_DRIVER(mmc) = { .id = UCLASS_MMC, .name = "mmc", .flags = DM_UC_FLAG_SEQ_ALIAS, - .per_device_auto_alloc_size = sizeof(struct mmc_uclass_priv), + .per_device_auto = sizeof(struct mmc_uclass_priv), }; diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index a6394bc..36aab50 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -454,7 +454,7 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, #endif { #if CONFIG_IS_ENABLED(BLK) - struct blk_desc *block_dev = dev_get_uclass_platdata(dev); + struct blk_desc *block_dev = dev_get_uclass_plat(dev); #endif int dev_num = block_dev->devnum; int err; diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c index 50fcd32..46800bb 100644 --- a/drivers/mmc/mmc_spi.c +++ b/drivers/mmc/mmc_spi.c @@ -411,14 +411,13 @@ done: static int mmc_spi_probe(struct udevice *dev) { struct mmc_spi_priv *priv = dev_get_priv(dev); - struct mmc_spi_plat *plat = dev_get_platdata(dev); + struct mmc_spi_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); char *name; priv->spi = dev_get_parent_priv(dev); if (!priv->spi->max_hz) priv->spi->max_hz = MMC_SPI_MAX_CLOCK; - priv->spi->speed = 0; priv->spi->mode = SPI_MODE_0; priv->spi->wordlen = 8; @@ -446,7 +445,7 @@ static int mmc_spi_probe(struct udevice *dev) static int mmc_spi_bind(struct udevice *dev) { - struct mmc_spi_plat *plat = dev_get_platdata(dev); + struct mmc_spi_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -468,6 +467,6 @@ U_BOOT_DRIVER(mmc_spi) = { .ops = &mmc_spi_ops, .probe = mmc_spi_probe, .bind = mmc_spi_bind, - .platdata_auto_alloc_size = sizeof(struct mmc_spi_plat), - .priv_auto_alloc_size = sizeof(struct mmc_spi_priv), + .plat_auto = sizeof(struct mmc_spi_plat), + .priv_auto = sizeof(struct mmc_spi_priv), }; diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c index 6a4453c..d23b7d9 100644 --- a/drivers/mmc/mmc_write.c +++ b/drivers/mmc/mmc_write.c @@ -73,7 +73,7 @@ ulong mmc_berase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt) #endif { #if CONFIG_IS_ENABLED(BLK) - struct blk_desc *block_dev = dev_get_uclass_platdata(dev); + struct blk_desc *block_dev = dev_get_uclass_plat(dev); #endif int dev_num = block_dev->devnum; int err = 0; @@ -193,7 +193,7 @@ ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, #endif { #if CONFIG_IS_ENABLED(BLK) - struct blk_desc *block_dev = dev_get_uclass_platdata(dev); + struct blk_desc *block_dev = dev_get_uclass_plat(dev); #endif int dev_num = block_dev->devnum; lbaint_t cur, blocks_todo = blkcnt; diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c index 2a1f412..bfbba46 100644 --- a/drivers/mmc/msm_sdhci.c +++ b/drivers/mmc/msm_sdhci.c @@ -87,7 +87,7 @@ static int msm_sdc_clk_init(struct udevice *dev) static int msm_sdc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct msm_sdhc_plat *plat = dev_get_platdata(dev); + struct msm_sdhc_plat *plat = dev_get_plat(dev); struct msm_sdhc *prv = dev_get_priv(dev); struct sdhci_host *host = &prv->host; u32 core_version, core_minor, core_major; @@ -167,7 +167,7 @@ static int msm_sdc_remove(struct udevice *dev) return 0; } -static int msm_ofdata_to_platdata(struct udevice *dev) +static int msm_of_to_plat(struct udevice *dev) { struct udevice *parent = dev->parent; struct msm_sdhc *priv = dev_get_priv(dev); @@ -189,7 +189,7 @@ static int msm_ofdata_to_platdata(struct udevice *dev) static int msm_sdc_bind(struct udevice *dev) { - struct msm_sdhc_plat *plat = dev_get_platdata(dev); + struct msm_sdhc_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -203,11 +203,11 @@ U_BOOT_DRIVER(msm_sdc_drv) = { .name = "msm_sdc", .id = UCLASS_MMC, .of_match = msm_mmc_ids, - .ofdata_to_platdata = msm_ofdata_to_platdata, + .of_to_plat = msm_of_to_plat, .ops = &sdhci_ops, .bind = msm_sdc_bind, .probe = msm_sdc_probe, .remove = msm_sdc_remove, - .priv_auto_alloc_size = sizeof(struct msm_sdhc), - .platdata_auto_alloc_size = sizeof(struct msm_sdhc_plat), + .priv_auto = sizeof(struct msm_sdhc), + .plat_auto = sizeof(struct msm_sdhc_plat), }; diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c index 4f9fa7d..95dc9da 100644 --- a/drivers/mmc/mtk-sd.c +++ b/drivers/mmc/mtk-sd.c @@ -885,7 +885,7 @@ static void msdc_set_mclk(struct udevice *dev, static int msdc_ops_set_ios(struct udevice *dev) { - struct msdc_plat *plat = dev_get_platdata(dev); + struct msdc_plat *plat = dev_get_plat(dev); struct msdc_host *host = dev_get_priv(dev); struct mmc *mmc = &plat->mmc; uint clock = mmc->clock; @@ -1031,7 +1031,7 @@ static inline void msdc_set_data_delay(struct msdc_host *host, u32 value) static int hs400_tune_response(struct udevice *dev, u32 opcode) { - struct msdc_plat *plat = dev_get_platdata(dev); + struct msdc_plat *plat = dev_get_plat(dev); struct msdc_host *host = dev_get_priv(dev); struct mmc *mmc = &plat->mmc; u32 cmd_delay = 0; @@ -1081,7 +1081,7 @@ static int hs400_tune_response(struct udevice *dev, u32 opcode) static int msdc_tune_response(struct udevice *dev, u32 opcode) { - struct msdc_plat *plat = dev_get_platdata(dev); + struct msdc_plat *plat = dev_get_plat(dev); struct msdc_host *host = dev_get_priv(dev); struct mmc *mmc = &plat->mmc; u32 rise_delay = 0, fall_delay = 0; @@ -1185,7 +1185,7 @@ skip_internal: static int msdc_tune_data(struct udevice *dev, u32 opcode) { - struct msdc_plat *plat = dev_get_platdata(dev); + struct msdc_plat *plat = dev_get_plat(dev); struct msdc_host *host = dev_get_priv(dev); struct mmc *mmc = &plat->mmc; u32 rise_delay = 0, fall_delay = 0; @@ -1276,7 +1276,7 @@ skip_fall: */ static int msdc_tune_together(struct udevice *dev, u32 opcode) { - struct msdc_plat *plat = dev_get_platdata(dev); + struct msdc_plat *plat = dev_get_plat(dev); struct msdc_host *host = dev_get_priv(dev); struct mmc *mmc = &plat->mmc; u32 rise_delay = 0, fall_delay = 0; @@ -1334,7 +1334,7 @@ skip_fall: static int msdc_execute_tuning(struct udevice *dev, uint opcode) { - struct msdc_plat *plat = dev_get_platdata(dev); + struct msdc_plat *plat = dev_get_plat(dev); struct msdc_host *host = dev_get_priv(dev); struct mmc *mmc = &plat->mmc; int ret = 0; @@ -1511,7 +1511,7 @@ static void msdc_ungate_clock(struct msdc_host *host) static int msdc_drv_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct msdc_plat *plat = dev_get_platdata(dev); + struct msdc_plat *plat = dev_get_plat(dev); struct msdc_host *host = dev_get_priv(dev); struct mmc_config *cfg = &plat->cfg; @@ -1545,9 +1545,9 @@ static int msdc_drv_probe(struct udevice *dev) return 0; } -static int msdc_ofdata_to_platdata(struct udevice *dev) +static int msdc_of_to_plat(struct udevice *dev) { - struct msdc_plat *plat = dev_get_platdata(dev); + struct msdc_plat *plat = dev_get_plat(dev); struct msdc_host *host = dev_get_priv(dev); struct mmc_config *cfg = &plat->cfg; fdt_addr_t base, top_base; @@ -1598,7 +1598,7 @@ static int msdc_ofdata_to_platdata(struct udevice *dev) static int msdc_drv_bind(struct udevice *dev) { - struct msdc_plat *plat = dev_get_platdata(dev); + struct msdc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -1688,10 +1688,10 @@ U_BOOT_DRIVER(mtk_sd_drv) = { .name = "mtk_sd", .id = UCLASS_MMC, .of_match = msdc_ids, - .ofdata_to_platdata = msdc_ofdata_to_platdata, + .of_to_plat = msdc_of_to_plat, .bind = msdc_drv_bind, .probe = msdc_drv_probe, .ops = &msdc_ops, - .platdata_auto_alloc_size = sizeof(struct msdc_plat), - .priv_auto_alloc_size = sizeof(struct msdc_host), + .plat_auto = sizeof(struct msdc_plat), + .priv_auto = sizeof(struct msdc_host), }; diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c index 9b3dfa1..556dd38 100644 --- a/drivers/mmc/mv_sdhci.c +++ b/drivers/mmc/mv_sdhci.c @@ -107,7 +107,7 @@ struct mv_sdhci_plat { static int mv_sdhci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct mv_sdhci_plat *plat = dev_get_platdata(dev); + struct mv_sdhci_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); int ret; @@ -134,7 +134,7 @@ static int mv_sdhci_probe(struct udevice *dev) static int mv_sdhci_bind(struct udevice *dev) { - struct mv_sdhci_plat *plat = dev_get_platdata(dev); + struct mv_sdhci_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -151,7 +151,7 @@ U_BOOT_DRIVER(mv_sdhci_drv) = { .bind = mv_sdhci_bind, .probe = mv_sdhci_probe, .ops = &sdhci_ops, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct mv_sdhci_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct mv_sdhci_plat), }; #endif /* CONFIG_DM_MMC */ diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c index 2b3a3a9..8fd4176 100644 --- a/drivers/mmc/mxsmmc.c +++ b/drivers/mmc/mxsmmc.c @@ -52,7 +52,7 @@ struct mxsmmc_priv { #include <dm/read.h> #include <dt-structs.h> -struct mxsmmc_platdata { +struct mxsmmc_plat { #if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_fsl_imx23_mmc dtplat; #endif @@ -310,7 +310,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) static int mxsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) { - struct mxsmmc_platdata *plat = dev_get_platdata(dev); + struct mxsmmc_plat *plat = dev_get_plat(dev); struct mxsmmc_priv *priv = dev_get_priv(dev); struct mxs_ssp_regs *ssp_regs = priv->regs; struct mmc *mmc = &plat->mmc; @@ -490,7 +490,7 @@ mxsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) static int mxsmmc_get_cd(struct udevice *dev) { - struct mxsmmc_platdata *plat = dev_get_platdata(dev); + struct mxsmmc_plat *plat = dev_get_plat(dev); struct mxsmmc_priv *priv = dev_get_priv(dev); struct mxs_ssp_regs *ssp_regs = priv->regs; @@ -502,7 +502,7 @@ static int mxsmmc_get_cd(struct udevice *dev) static int mxsmmc_set_ios(struct udevice *dev) { - struct mxsmmc_platdata *plat = dev_get_platdata(dev); + struct mxsmmc_plat *plat = dev_get_plat(dev); struct mxsmmc_priv *priv = dev_get_priv(dev); struct mxs_ssp_regs *ssp_regs = priv->regs; struct mmc *mmc = &plat->mmc; @@ -567,7 +567,7 @@ static int mxsmmc_init(struct udevice *dev) static int mxsmmc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct mxsmmc_platdata *plat = dev_get_platdata(dev); + struct mxsmmc_plat *plat = dev_get_plat(dev); struct mxsmmc_priv *priv = dev_get_priv(dev); struct blk_desc *bdesc; struct mmc *mmc; @@ -653,7 +653,7 @@ static int mxsmmc_probe(struct udevice *dev) #if CONFIG_IS_ENABLED(BLK) static int mxsmmc_bind(struct udevice *dev) { - struct mxsmmc_platdata *plat = dev_get_platdata(dev); + struct mxsmmc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -666,9 +666,9 @@ static const struct dm_mmc_ops mxsmmc_ops = { }; #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -static int mxsmmc_ofdata_to_platdata(struct udevice *bus) +static int mxsmmc_of_to_plat(struct udevice *bus) { - struct mxsmmc_platdata *plat = bus->platdata; + struct mxsmmc_plat *plat = dev_get_plat(bus); u32 prop[2]; int ret; @@ -711,16 +711,16 @@ U_BOOT_DRIVER(fsl_imx23_mmc) = { .id = UCLASS_MMC, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = mxsmmc_ids, - .ofdata_to_platdata = mxsmmc_ofdata_to_platdata, + .of_to_plat = mxsmmc_of_to_plat, #endif .ops = &mxsmmc_ops, #if CONFIG_IS_ENABLED(BLK) .bind = mxsmmc_bind, #endif .probe = mxsmmc_probe, - .priv_auto_alloc_size = sizeof(struct mxsmmc_priv), - .platdata_auto_alloc_size = sizeof(struct mxsmmc_platdata), + .priv_auto = sizeof(struct mxsmmc_priv), + .plat_auto = sizeof(struct mxsmmc_plat), }; -U_BOOT_DRIVER_ALIAS(fsl_imx23_mmc, fsl_imx28_mmc) +DM_DRIVER_ALIAS(fsl_imx23_mmc, fsl_imx28_mmc) #endif /* CONFIG_DM_MMC */ diff --git a/drivers/mmc/nexell_dw_mmc.c b/drivers/mmc/nexell_dw_mmc.c index 0462759..753c89d 100644 --- a/drivers/mmc/nexell_dw_mmc.c +++ b/drivers/mmc/nexell_dw_mmc.c @@ -139,7 +139,7 @@ static unsigned long nx_dw_mmc_set_clk(struct dwmci_host *host, return rate; } -static int nexell_dwmmc_ofdata_to_platdata(struct udevice *dev) +static int nexell_dwmmc_of_to_plat(struct udevice *dev) { struct nexell_dwmmc_priv *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -179,7 +179,7 @@ static int nexell_dwmmc_ofdata_to_platdata(struct udevice *dev) static int nexell_dwmmc_probe(struct udevice *dev) { - struct nexell_mmc_plat *plat = dev_get_platdata(dev); + struct nexell_mmc_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct nexell_dwmmc_priv *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -214,7 +214,7 @@ static int nexell_dwmmc_probe(struct udevice *dev) static int nexell_dwmmc_bind(struct udevice *dev) { - struct nexell_mmc_plat *plat = dev_get_platdata(dev); + struct nexell_mmc_plat *plat = dev_get_plat(dev); return dwmci_bind(dev, &plat->mmc, &plat->cfg); } @@ -228,10 +228,10 @@ U_BOOT_DRIVER(nexell_dwmmc_drv) = { .name = "nexell_dwmmc", .id = UCLASS_MMC, .of_match = nexell_dwmmc_ids, - .ofdata_to_platdata = nexell_dwmmc_ofdata_to_platdata, + .of_to_plat = nexell_dwmmc_of_to_plat, .ops = &dm_dwmci_ops, .bind = nexell_dwmmc_bind, .probe = nexell_dwmmc_probe, - .priv_auto_alloc_size = sizeof(struct nexell_dwmmc_priv), - .platdata_auto_alloc_size = sizeof(struct nexell_mmc_plat), + .priv_auto = sizeof(struct nexell_dwmmc_priv), + .plat_auto = sizeof(struct nexell_mmc_plat), }; diff --git a/drivers/mmc/octeontx_hsmmc.c b/drivers/mmc/octeontx_hsmmc.c index 38ca373..442ca49 100644 --- a/drivers/mmc/octeontx_hsmmc.c +++ b/drivers/mmc/octeontx_hsmmc.c @@ -30,6 +30,7 @@ #include <asm/arch/clock.h> #include <asm/arch/csrs/csrs-mio_emm.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <power/regulator.h> @@ -3438,7 +3439,7 @@ static u32 xlate_voltage(u32 voltage) */ static bool octeontx_mmc_get_valid(struct udevice *dev) { - const char *stat = ofnode_read_string(dev->node, "status"); + const char *stat = ofnode_read_string(dev_ofnode(dev), "status"); if (!stat || !strncmp(stat, "ok", 2)) return true; @@ -3460,14 +3461,15 @@ static int octeontx_mmc_get_config(struct udevice *dev) uint low, high; char env_name[32]; int err; - ofnode node = dev->node; + ofnode node = dev_ofnode(dev); int bus_width = 1; ulong new_max_freq; debug("%s(%s)", __func__, dev->name); slot->cfg.name = dev->name; - slot->cfg.f_max = ofnode_read_s32_default(dev->node, "max-frequency", + slot->cfg.f_max = ofnode_read_s32_default(dev_ofnode(dev), + "max-frequency", 26000000); snprintf(env_name, sizeof(env_name), "mmc_max_frequency%d", slot->bus_id); @@ -3485,25 +3487,26 @@ static int octeontx_mmc_get_config(struct udevice *dev) if (IS_ENABLED(CONFIG_ARCH_OCTEONTX2)) { slot->hs400_tuning_block = - ofnode_read_s32_default(dev->node, + ofnode_read_s32_default(dev_ofnode(dev), "marvell,hs400-tuning-block", -1); debug("%s(%s): mmc HS400 tuning block: %d\n", __func__, dev->name, slot->hs400_tuning_block); slot->hs200_tap_adj = - ofnode_read_s32_default(dev->node, + ofnode_read_s32_default(dev_ofnode(dev), "marvell,hs200-tap-adjust", 0); debug("%s(%s): hs200-tap-adjust: %d\n", __func__, dev->name, slot->hs200_tap_adj); slot->hs400_tap_adj = - ofnode_read_s32_default(dev->node, + ofnode_read_s32_default(dev_ofnode(dev), "marvell,hs400-tap-adjust", 0); debug("%s(%s): hs400-tap-adjust: %d\n", __func__, dev->name, slot->hs400_tap_adj); } - err = ofnode_read_u32_array(dev->node, "voltage-ranges", voltages, 2); + err = ofnode_read_u32_array(dev_ofnode(dev), "voltage-ranges", + voltages, 2); if (err) { slot->cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34; } else { @@ -3731,7 +3734,6 @@ U_BOOT_DRIVER(octeontx_hsmmc_slot) = { */ static int octeontx_mmc_host_probe(struct udevice *dev) { - pci_dev_t bdf = dm_pci_get_bdf(dev); struct octeontx_mmc_host *host = dev_get_priv(dev); union mio_emm_int emm_int; u8 rev; @@ -3752,19 +3754,19 @@ static int octeontx_mmc_host_probe(struct udevice *dev) host->dev = dev; debug("%s(%s): Base address: %p\n", __func__, dev->name, host->base_addr); - if (!dev_has_of_node(dev)) { + if (!dev_has_ofnode(dev)) { pr_err("%s: No device tree information found\n", __func__); return -1; } - host->node = dev->node; - dev->req_seq = PCI_FUNC(bdf); + host->node = dev_ofnode(dev); host->last_slotid = -1; if (otx_is_platform(PLATFORM_ASIM)) host->is_asim = true; if (otx_is_platform(PLATFORM_EMULATOR)) host->is_emul = true; host->dma_wait_delay = - ofnode_read_u32_default(dev->node, "marvell,dma-wait-delay", 1); + ofnode_read_u32_default(dev_ofnode(dev), + "marvell,dma-wait-delay", 1); /* Force reset of eMMC */ writeq(0, host->base_addr + MIO_EMM_CFG()); debug("%s: Clearing MIO_EMM_CFG\n", __func__); @@ -3825,7 +3827,7 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev) struct octeontx_mmc_host *host = dev_get_priv(dev_get_parent(dev)); struct octeontx_mmc_slot *slot; struct mmc_uclass_priv *upriv; - ofnode node = dev->node; + ofnode node = dev_ofnode(dev); u32 bus_id; char name[16]; int err; @@ -3843,7 +3845,7 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev) } slot = &host->slots[bus_id]; - dev->priv = slot; + dev_set_priv(dev, slot); slot->host = host; slot->bus_id = bus_id; slot->dev = dev; @@ -3854,16 +3856,21 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev) snprintf(name, sizeof(name), "octeontx-mmc%d", bus_id); err = device_set_name(dev, name); - if (!dev->uclass_priv) { + /* FIXME: This code should not be needed */ + if (!dev_get_uclass_priv(dev)) { debug("%s(%s): Allocating uclass priv\n", __func__, dev->name); upriv = calloc(1, sizeof(struct mmc_uclass_priv)); if (!upriv) return -ENOMEM; - dev->uclass_priv = upriv; - dev->uclass->priv = upriv; + + /* + * FIXME: This is not allowed + * dev_set_uclass_priv(dev, upriv); + * uclass_set_priv(dev->uclass, upriv); + */ } else { - upriv = dev->uclass_priv; + upriv = dev_get_uclass_priv(dev); } upriv->mmc = &slot->mmc; @@ -3880,10 +3887,11 @@ static const struct udevice_id octeontx_hsmmc_host_ids[] = { U_BOOT_DRIVER(octeontx_hsmmc_host) = { .name = "octeontx_hsmmc_host", + /* FIXME: Why is this not UCLASS_MMC? */ .id = UCLASS_MISC, .of_match = of_match_ptr(octeontx_hsmmc_host_ids), .probe = octeontx_mmc_host_probe, - .priv_auto_alloc_size = sizeof(struct octeontx_mmc_host), + .priv_auto = sizeof(struct octeontx_mmc_host), .child_pre_probe = octeontx_mmc_host_child_pre_probe, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index 715eee0..52f044e 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -180,7 +180,7 @@ static inline struct omap_hsmmc_data *omap_hsmmc_get_data(struct mmc *mmc) static inline struct mmc_config *omap_hsmmc_get_cfg(struct mmc *mmc) { #if CONFIG_IS_ENABLED(DM_MMC) - struct omap_hsmmc_plat *plat = dev_get_platdata(mmc->dev); + struct omap_hsmmc_plat *plat = dev_get_plat(mmc->dev); return &plat->cfg; #else return &((struct omap_hsmmc_data *)mmc->priv)->cfg; @@ -1898,9 +1898,9 @@ __weak const struct mmc_platform_fixups *platform_fixups_mmc(uint32_t addr) } #endif -static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev) +static int omap_hsmmc_of_to_plat(struct udevice *dev) { - struct omap_hsmmc_plat *plat = dev_get_platdata(dev); + struct omap_hsmmc_plat *plat = dev_get_plat(dev); struct omap_mmc_of_data *of_data = (void *)dev_get_driver_data(dev); struct mmc_config *cfg = &plat->cfg; @@ -1949,14 +1949,14 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev) static int omap_hsmmc_bind(struct udevice *dev) { - struct omap_hsmmc_plat *plat = dev_get_platdata(dev); + struct omap_hsmmc_plat *plat = dev_get_plat(dev); plat->mmc = calloc(1, sizeof(struct mmc)); return mmc_bind(dev, plat->mmc, &plat->cfg); } #endif static int omap_hsmmc_probe(struct udevice *dev) { - struct omap_hsmmc_plat *plat = dev_get_platdata(dev); + struct omap_hsmmc_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct omap_hsmmc_data *priv = dev_get_priv(dev); struct mmc_config *cfg = &plat->cfg; @@ -2028,15 +2028,15 @@ U_BOOT_DRIVER(omap_hsmmc) = { .id = UCLASS_MMC, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = omap_hsmmc_ids, - .ofdata_to_platdata = omap_hsmmc_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct omap_hsmmc_plat), + .of_to_plat = omap_hsmmc_of_to_plat, + .plat_auto = sizeof(struct omap_hsmmc_plat), #endif #ifdef CONFIG_BLK .bind = omap_hsmmc_bind, #endif .ops = &omap_hsmmc_ops, .probe = omap_hsmmc_probe, - .priv_auto_alloc_size = sizeof(struct omap_hsmmc_data), + .priv_auto = sizeof(struct omap_hsmmc_data), #if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, #endif diff --git a/drivers/mmc/pci_mmc.c b/drivers/mmc/pci_mmc.c index 0c45e1b..c71c495 100644 --- a/drivers/mmc/pci_mmc.c +++ b/drivers/mmc/pci_mmc.c @@ -31,7 +31,7 @@ struct pci_mmc_priv { static int pci_mmc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct pci_mmc_plat *plat = dev_get_platdata(dev); + struct pci_mmc_plat *plat = dev_get_plat(dev); struct pci_mmc_priv *priv = dev_get_priv(dev); struct sdhci_host *host = &priv->host; int ret; @@ -50,7 +50,7 @@ static int pci_mmc_probe(struct udevice *dev) return sdhci_probe(dev); } -static int pci_mmc_ofdata_to_platdata(struct udevice *dev) +static int pci_mmc_of_to_plat(struct udevice *dev) { struct pci_mmc_priv *priv = dev_get_priv(dev); @@ -61,7 +61,7 @@ static int pci_mmc_ofdata_to_platdata(struct udevice *dev) static int pci_mmc_bind(struct udevice *dev) { - struct pci_mmc_plat *plat = dev_get_platdata(dev); + struct pci_mmc_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -75,7 +75,7 @@ static int pci_mmc_acpi_fill_ssdt(const struct udevice *dev, struct acpi_dp *dp; int ret; - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) return 0; ret = gpio_get_acpi(&priv->cd_gpio, &gpio); @@ -129,11 +129,11 @@ U_BOOT_DRIVER(pci_mmc) = { .id = UCLASS_MMC, .of_match = pci_mmc_match, .bind = pci_mmc_bind, - .ofdata_to_platdata = pci_mmc_ofdata_to_platdata, + .of_to_plat = pci_mmc_of_to_plat, .probe = pci_mmc_probe, .ops = &sdhci_ops, - .priv_auto_alloc_size = sizeof(struct pci_mmc_priv), - .platdata_auto_alloc_size = sizeof(struct pci_mmc_plat), + .priv_auto = sizeof(struct pci_mmc_priv), + .plat_auto = sizeof(struct pci_mmc_plat), ACPI_OPS_PTR(&pci_mmc_acpi_ops) }; diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c index e201bdb..fb37c67 100644 --- a/drivers/mmc/pic32_sdhci.c +++ b/drivers/mmc/pic32_sdhci.c @@ -18,7 +18,7 @@ struct pic32_sdhci_plat { static int pic32_sdhci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct pic32_sdhci_plat *plat = dev_get_platdata(dev); + struct pic32_sdhci_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); struct clk clk; @@ -71,7 +71,7 @@ static int pic32_sdhci_probe(struct udevice *dev) static int pic32_sdhci_bind(struct udevice *dev) { - struct pic32_sdhci_plat *plat = dev_get_platdata(dev); + struct pic32_sdhci_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -88,6 +88,6 @@ U_BOOT_DRIVER(pic32_sdhci_drv) = { .ops = &sdhci_ops, .bind = pic32_sdhci_bind, .probe = pic32_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct pic32_sdhci_plat) + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct pic32_sdhci_plat) }; diff --git a/drivers/mmc/pxa_mmc_gen.c b/drivers/mmc/pxa_mmc_gen.c index 2c081fd..2b45549 100644 --- a/drivers/mmc/pxa_mmc_gen.c +++ b/drivers/mmc/pxa_mmc_gen.c @@ -459,7 +459,7 @@ err0: static int pxa_mmc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct pxa_mmc_plat *plat = dev_get_platdata(dev); + struct pxa_mmc_plat *plat = dev_get_plat(dev); struct mmc_config *cfg = &plat->cfg; struct mmc *mmc = &plat->mmc; struct pxa_mmc_priv *priv = dev_get_priv(dev); @@ -494,7 +494,7 @@ static int pxa_mmc_probe(struct udevice *dev) static int pxa_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) { - struct pxa_mmc_plat *plat = dev_get_platdata(dev); + struct pxa_mmc_plat *plat = dev_get_plat(dev); struct pxa_mmc_priv *priv = dev_get_priv(dev); return pxa_mmc_send_cmd_common(priv, &plat->mmc, cmd, data); @@ -502,7 +502,7 @@ static int pxa_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, static int pxa_mmc_set_ios(struct udevice *dev) { - struct pxa_mmc_plat *plat = dev_get_platdata(dev); + struct pxa_mmc_plat *plat = dev_get_plat(dev); struct pxa_mmc_priv *priv = dev_get_priv(dev); return pxa_mmc_set_ios_common(priv, &plat->mmc); @@ -517,7 +517,7 @@ static const struct dm_mmc_ops pxa_mmc_ops = { #if CONFIG_IS_ENABLED(BLK) static int pxa_mmc_bind(struct udevice *dev) { - struct pxa_mmc_plat *plat = dev_get_platdata(dev); + struct pxa_mmc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -530,7 +530,7 @@ U_BOOT_DRIVER(pxa_mmc) = { .id = UCLASS_MMC, .name = "pxa_mmc", .ops = &pxa_mmc_ops, - .priv_auto_alloc_size = sizeof(struct pxa_mmc_priv), + .priv_auto = sizeof(struct pxa_mmc_priv), .probe = pxa_mmc_probe, }; #endif /* !CONFIG_IS_ENABLED(DM_MMC) */ diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c index d80b3fc..24130e6 100644 --- a/drivers/mmc/renesas-sdhi.c +++ b/drivers/mmc/renesas-sdhi.c @@ -865,7 +865,7 @@ static void renesas_sdhi_filter_caps(struct udevice *dev) #if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \ CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \ CONFIG_IS_ENABLED(MMC_HS400_SUPPORT) - struct tmio_sd_plat *plat = dev_get_platdata(dev); + struct tmio_sd_plat *plat = dev_get_plat(dev); /* HS400 is not supported on H3 ES1.x and M3W ES1.0, ES1.1 */ if (((rmobile_get_cpu_type() == RMOBILE_CPU_TYPE_R8A7795) && @@ -1014,7 +1014,7 @@ U_BOOT_DRIVER(renesas_sdhi) = { .of_match = renesas_sdhi_match, .bind = tmio_sd_bind, .probe = renesas_sdhi_probe, - .priv_auto_alloc_size = sizeof(struct tmio_sd_priv), - .platdata_auto_alloc_size = sizeof(struct tmio_sd_plat), + .priv_auto = sizeof(struct tmio_sd_priv), + .plat_auto = sizeof(struct tmio_sd_plat), .ops = &renesas_sdhi_ops, }; diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index f1dafa6..1be3c17 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -50,7 +50,7 @@ static uint rockchip_dwmmc_get_mmc_clk(struct dwmci_host *host, uint freq) return freq; } -static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev) +static int rockchip_dwmmc_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct rockchip_dwmmc_priv *priv = dev_get_priv(dev); @@ -101,7 +101,7 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev) static int rockchip_dwmmc_probe(struct udevice *dev) { - struct rockchip_mmc_plat *plat = dev_get_platdata(dev); + struct rockchip_mmc_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct rockchip_dwmmc_priv *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -157,7 +157,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev) static int rockchip_dwmmc_bind(struct udevice *dev) { - struct rockchip_mmc_plat *plat = dev_get_platdata(dev); + struct rockchip_mmc_plat *plat = dev_get_plat(dev); return dwmci_bind(dev, &plat->mmc, &plat->cfg); } @@ -172,16 +172,16 @@ U_BOOT_DRIVER(rockchip_rk3288_dw_mshc) = { .name = "rockchip_rk3288_dw_mshc", .id = UCLASS_MMC, .of_match = rockchip_dwmmc_ids, - .ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata, + .of_to_plat = rockchip_dwmmc_of_to_plat, .ops = &dm_dwmci_ops, .bind = rockchip_dwmmc_bind, .probe = rockchip_dwmmc_probe, - .priv_auto_alloc_size = sizeof(struct rockchip_dwmmc_priv), - .platdata_auto_alloc_size = sizeof(struct rockchip_mmc_plat), + .priv_auto = sizeof(struct rockchip_dwmmc_priv), + .plat_auto = sizeof(struct rockchip_mmc_plat), }; -U_BOOT_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc) -U_BOOT_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc) +DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc) +DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc) #ifdef CONFIG_PWRSEQ static int rockchip_dwmmc_pwrseq_set_power(struct udevice *dev, bool enable) diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index b073f1a..d95f8b2 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -34,7 +34,7 @@ struct rockchip_sdhc { static int arasan_sdhci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct rockchip_sdhc_plat *plat = dev_get_platdata(dev); + struct rockchip_sdhc_plat *plat = dev_get_plat(dev); struct rockchip_sdhc *prv = dev_get_priv(dev); struct sdhci_host *host = &prv->host; int max_frequency, ret; @@ -81,7 +81,7 @@ static int arasan_sdhci_probe(struct udevice *dev) return sdhci_probe(dev); } -static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) +static int arasan_sdhci_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct sdhci_host *host = dev_get_priv(dev); @@ -96,7 +96,7 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) static int rockchip_sdhci_bind(struct udevice *dev) { - struct rockchip_sdhc_plat *plat = dev_get_platdata(dev); + struct rockchip_sdhc_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -110,10 +110,10 @@ U_BOOT_DRIVER(arasan_sdhci_drv) = { .name = "rockchip_rk3399_sdhci_5_1", .id = UCLASS_MMC, .of_match = arasan_sdhci_ids, - .ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata, + .of_to_plat = arasan_sdhci_of_to_plat, .ops = &sdhci_ops, .bind = rockchip_sdhci_bind, .probe = arasan_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct rockchip_sdhc), - .platdata_auto_alloc_size = sizeof(struct rockchip_sdhc_plat), + .priv_auto = sizeof(struct rockchip_sdhc), + .plat_auto = sizeof(struct rockchip_sdhc_plat), }; diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c index 24f599e..3cf56e0 100644 --- a/drivers/mmc/s5p_sdhci.c +++ b/drivers/mmc/s5p_sdhci.c @@ -192,7 +192,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host) #ifdef CONFIG_DM_MMC static int s5p_sdhci_probe(struct udevice *dev) { - struct s5p_sdhci_plat *plat = dev_get_platdata(dev); + struct s5p_sdhci_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct sdhci_host *host = dev_get_priv(dev); int ret; @@ -224,7 +224,7 @@ static int s5p_sdhci_probe(struct udevice *dev) static int s5p_sdhci_bind(struct udevice *dev) { - struct s5p_sdhci_plat *plat = dev_get_platdata(dev); + struct s5p_sdhci_plat *plat = dev_get_plat(dev); int ret; ret = sdhci_bind(dev, &plat->mmc, &plat->cfg); @@ -246,7 +246,7 @@ U_BOOT_DRIVER(s5p_sdhci_drv) = { .bind = s5p_sdhci_bind, .ops = &sdhci_ops, .probe = s5p_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct s5p_sdhci_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct s5p_sdhci_plat), }; #endif /* CONFIG_DM_MMC */ diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c index e86ea8f..8a2391d 100644 --- a/drivers/mmc/sandbox_mmc.c +++ b/drivers/mmc/sandbox_mmc.c @@ -108,14 +108,14 @@ static const struct dm_mmc_ops sandbox_mmc_ops = { int sandbox_mmc_probe(struct udevice *dev) { - struct sandbox_mmc_plat *plat = dev_get_platdata(dev); + struct sandbox_mmc_plat *plat = dev_get_plat(dev); return mmc_init(&plat->mmc); } int sandbox_mmc_bind(struct udevice *dev) { - struct sandbox_mmc_plat *plat = dev_get_platdata(dev); + struct sandbox_mmc_plat *plat = dev_get_plat(dev); struct mmc_config *cfg = &plat->cfg; cfg->name = dev->name; @@ -148,5 +148,5 @@ U_BOOT_DRIVER(mmc_sandbox) = { .bind = sandbox_mmc_bind, .unbind = sandbox_mmc_unbind, .probe = sandbox_mmc_probe, - .platdata_auto_alloc_size = sizeof(struct sandbox_mmc_plat), + .plat_auto = sizeof(struct sandbox_mmc_plat), }; diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c index cc99beb..2b726c2 100644 --- a/drivers/mmc/sdhci-cadence.c +++ b/drivers/mmc/sdhci-cadence.c @@ -135,7 +135,7 @@ static int sdhci_cdns_phy_init(struct sdhci_cdns_plat *plat, static void sdhci_cdns_set_control_reg(struct sdhci_host *host) { struct mmc *mmc = host->mmc; - struct sdhci_cdns_plat *plat = dev_get_platdata(mmc->dev); + struct sdhci_cdns_plat *plat = dev_get_plat(mmc->dev); unsigned int clock = mmc->clock; u32 mode, tmp; @@ -203,7 +203,7 @@ static int sdhci_cdns_set_tune_val(struct sdhci_cdns_plat *plat, static int __maybe_unused sdhci_cdns_execute_tuning(struct udevice *dev, unsigned int opcode) { - struct sdhci_cdns_plat *plat = dev_get_platdata(dev); + struct sdhci_cdns_plat *plat = dev_get_plat(dev); struct mmc *mmc = &plat->mmc; int cur_streak = 0; int max_streak = 0; @@ -246,7 +246,7 @@ static struct dm_mmc_ops sdhci_cdns_mmc_ops; static int sdhci_cdns_bind(struct udevice *dev) { - struct sdhci_cdns_plat *plat = dev_get_platdata(dev); + struct sdhci_cdns_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -255,7 +255,7 @@ static int sdhci_cdns_probe(struct udevice *dev) { DECLARE_GLOBAL_DATA_PTR; struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct sdhci_cdns_plat *plat = dev_get_platdata(dev); + struct sdhci_cdns_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); fdt_addr_t base; int ret; @@ -309,7 +309,7 @@ U_BOOT_DRIVER(sdhci_cdns) = { .of_match = sdhci_cdns_match, .bind = sdhci_cdns_bind, .probe = sdhci_cdns_probe, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct sdhci_cdns_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct sdhci_cdns_plat), .ops = &sdhci_cdns_mmc_ops, }; diff --git a/drivers/mmc/sh_mmcif.c b/drivers/mmc/sh_mmcif.c index ad38690..af342f2 100644 --- a/drivers/mmc/sh_mmcif.c +++ b/drivers/mmc/sh_mmcif.c @@ -666,14 +666,14 @@ static const struct dm_mmc_ops sh_mmcif_dm_ops = { static int sh_mmcif_dm_bind(struct udevice *dev) { - struct sh_mmcif_plat *plat = dev_get_platdata(dev); + struct sh_mmcif_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } static int sh_mmcif_dm_probe(struct udevice *dev) { - struct sh_mmcif_plat *plat = dev_get_platdata(dev); + struct sh_mmcif_plat *plat = dev_get_plat(dev); struct sh_mmcif_host *host = dev_get_priv(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct clk sh_mmcif_clk; @@ -743,8 +743,8 @@ U_BOOT_DRIVER(sh_mmcif_mmc) = { .of_match = sh_mmcif_sd_match, .bind = sh_mmcif_dm_bind, .probe = sh_mmcif_dm_probe, - .priv_auto_alloc_size = sizeof(struct sh_mmcif_host), - .platdata_auto_alloc_size = sizeof(struct sh_mmcif_plat), + .priv_auto = sizeof(struct sh_mmcif_host), + .plat_auto = sizeof(struct sh_mmcif_plat), .ops = &sh_mmcif_dm_ops, }; #endif diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c index 29f83b6..b8865b1 100644 --- a/drivers/mmc/sh_sdhi.c +++ b/drivers/mmc/sh_sdhi.c @@ -818,14 +818,14 @@ static const struct dm_mmc_ops sh_sdhi_dm_ops = { static int sh_sdhi_dm_bind(struct udevice *dev) { - struct sh_sdhi_plat *plat = dev_get_platdata(dev); + struct sh_sdhi_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } static int sh_sdhi_dm_probe(struct udevice *dev) { - struct sh_sdhi_plat *plat = dev_get_platdata(dev); + struct sh_sdhi_plat *plat = dev_get_plat(dev); struct sh_sdhi_host *host = dev_get_priv(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct clk sh_sdhi_clk; @@ -902,8 +902,8 @@ U_BOOT_DRIVER(sh_sdhi_mmc) = { .of_match = sh_sdhi_sd_match, .bind = sh_sdhi_dm_bind, .probe = sh_sdhi_dm_probe, - .priv_auto_alloc_size = sizeof(struct sh_sdhi_host), - .platdata_auto_alloc_size = sizeof(struct sh_sdhi_plat), + .priv_auto = sizeof(struct sh_sdhi_host), + .plat_auto = sizeof(struct sh_sdhi_plat), .ops = &sh_sdhi_dm_ops, }; #endif diff --git a/drivers/mmc/snps_dw_mmc.c b/drivers/mmc/snps_dw_mmc.c index 4b468a1..50a8805 100644 --- a/drivers/mmc/snps_dw_mmc.c +++ b/drivers/mmc/snps_dw_mmc.c @@ -76,7 +76,7 @@ clk_err: return ret; } -static int snps_dwmmc_ofdata_to_platdata(struct udevice *dev) +static int snps_dwmmc_of_to_plat(struct udevice *dev) { struct snps_dwmci_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -132,7 +132,7 @@ struct dm_mmc_ops snps_dwmci_dm_ops; static int snps_dwmmc_probe(struct udevice *dev) { #ifdef CONFIG_BLK - struct snps_dwmci_plat *plat = dev_get_platdata(dev); + struct snps_dwmci_plat *plat = dev_get_plat(dev); #endif struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct snps_dwmci_priv_data *priv = dev_get_priv(dev); @@ -171,7 +171,7 @@ static int snps_dwmmc_probe(struct udevice *dev) static int snps_dwmmc_bind(struct udevice *dev) { #ifdef CONFIG_BLK - struct snps_dwmci_plat *plat = dev_get_platdata(dev); + struct snps_dwmci_plat *plat = dev_get_plat(dev); int ret; ret = dwmci_bind(dev, &plat->mmc, &plat->cfg); @@ -191,10 +191,10 @@ U_BOOT_DRIVER(snps_dwmmc_drv) = { .name = "snps_dw_mmc", .id = UCLASS_MMC, .of_match = snps_dwmmc_ids, - .ofdata_to_platdata = snps_dwmmc_ofdata_to_platdata, + .of_to_plat = snps_dwmmc_of_to_plat, .ops = &snps_dwmci_dm_ops, .bind = snps_dwmmc_bind, .probe = snps_dwmmc_probe, - .priv_auto_alloc_size = sizeof(struct snps_dwmci_priv_data), - .platdata_auto_alloc_size = sizeof(struct snps_dwmci_plat), + .priv_auto = sizeof(struct snps_dwmci_priv_data), + .plat_auto = sizeof(struct snps_dwmci_plat), }; diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c index 0022f94..dc008c5 100644 --- a/drivers/mmc/socfpga_dw_mmc.c +++ b/drivers/mmc/socfpga_dw_mmc.c @@ -95,7 +95,7 @@ static int socfpga_dwmmc_get_clk_rate(struct udevice *dev) return 0; } -static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev) +static int socfpga_dwmmc_of_to_plat(struct udevice *dev) { struct dwmci_socfpga_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; @@ -133,7 +133,7 @@ static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev) static int socfpga_dwmmc_probe(struct udevice *dev) { #ifdef CONFIG_BLK - struct socfpga_dwmci_plat *plat = dev_get_platdata(dev); + struct socfpga_dwmci_plat *plat = dev_get_plat(dev); #endif struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct dwmci_socfpga_priv_data *priv = dev_get_priv(dev); @@ -165,7 +165,7 @@ static int socfpga_dwmmc_probe(struct udevice *dev) static int socfpga_dwmmc_bind(struct udevice *dev) { #ifdef CONFIG_BLK - struct socfpga_dwmci_plat *plat = dev_get_platdata(dev); + struct socfpga_dwmci_plat *plat = dev_get_plat(dev); int ret; ret = dwmci_bind(dev, &plat->mmc, &plat->cfg); @@ -185,10 +185,10 @@ U_BOOT_DRIVER(socfpga_dwmmc_drv) = { .name = "socfpga_dwmmc", .id = UCLASS_MMC, .of_match = socfpga_dwmmc_ids, - .ofdata_to_platdata = socfpga_dwmmc_ofdata_to_platdata, + .of_to_plat = socfpga_dwmmc_of_to_plat, .ops = &dm_dwmci_ops, .bind = socfpga_dwmmc_bind, .probe = socfpga_dwmmc_probe, - .priv_auto_alloc_size = sizeof(struct dwmci_socfpga_priv_data), - .platdata_auto_alloc_size = sizeof(struct socfpga_dwmci_plat), + .priv_auto = sizeof(struct dwmci_socfpga_priv_data), + .plat_auto = sizeof(struct socfpga_dwmci_plat), }; diff --git a/drivers/mmc/sti_sdhci.c b/drivers/mmc/sti_sdhci.c index c3a1b34..8ecd575 100644 --- a/drivers/mmc/sti_sdhci.c +++ b/drivers/mmc/sti_sdhci.c @@ -35,7 +35,7 @@ struct sti_sdhci_plat { */ static int sti_mmc_core_config(struct udevice *dev) { - struct sti_sdhci_plat *plat = dev_get_platdata(dev); + struct sti_sdhci_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); int ret; @@ -71,7 +71,7 @@ static int sti_mmc_core_config(struct udevice *dev) static int sti_sdhci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct sti_sdhci_plat *plat = dev_get_platdata(dev); + struct sti_sdhci_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); int ret; @@ -111,7 +111,7 @@ static int sti_sdhci_probe(struct udevice *dev) return sdhci_probe(dev); } -static int sti_sdhci_ofdata_to_platdata(struct udevice *dev) +static int sti_sdhci_of_to_plat(struct udevice *dev) { struct sdhci_host *host = dev_get_priv(dev); @@ -126,7 +126,7 @@ static int sti_sdhci_ofdata_to_platdata(struct udevice *dev) static int sti_sdhci_bind(struct udevice *dev) { - struct sti_sdhci_plat *plat = dev_get_platdata(dev); + struct sti_sdhci_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -142,8 +142,8 @@ U_BOOT_DRIVER(sti_mmc) = { .of_match = sti_sdhci_ids, .bind = sti_sdhci_bind, .ops = &sdhci_ops, - .ofdata_to_platdata = sti_sdhci_ofdata_to_platdata, + .of_to_plat = sti_sdhci_of_to_plat, .probe = sti_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct sti_sdhci_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct sti_sdhci_plat), }; diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index 1f1b6cf..3246f6b 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -644,7 +644,7 @@ static const struct dm_mmc_ops stm32_sdmmc2_ops = { static int stm32_sdmmc2_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct stm32_sdmmc2_plat *plat = dev_get_platdata(dev); + struct stm32_sdmmc2_plat *plat = dev_get_plat(dev); struct stm32_sdmmc2_priv *priv = dev_get_priv(dev); struct mmc_config *cfg = &plat->cfg; int ret; @@ -700,7 +700,7 @@ clk_free: static int stm32_sdmmc_bind(struct udevice *dev) { - struct stm32_sdmmc2_plat *plat = dev_get_platdata(dev); + struct stm32_sdmmc2_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -717,6 +717,6 @@ U_BOOT_DRIVER(stm32_sdmmc2) = { .ops = &stm32_sdmmc2_ops, .probe = stm32_sdmmc2_probe, .bind = stm32_sdmmc_bind, - .priv_auto_alloc_size = sizeof(struct stm32_sdmmc2_priv), - .platdata_auto_alloc_size = sizeof(struct stm32_sdmmc2_plat), + .priv_auto = sizeof(struct stm32_sdmmc2_priv), + .plat_auto = sizeof(struct stm32_sdmmc2_plat), }; diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index 0e03b07..b33f80b 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -572,7 +572,7 @@ struct mmc *sunxi_mmc_init(int sdc_no) static int sunxi_mmc_set_ios(struct udevice *dev) { - struct sunxi_mmc_plat *plat = dev_get_platdata(dev); + struct sunxi_mmc_plat *plat = dev_get_plat(dev); struct sunxi_mmc_priv *priv = dev_get_priv(dev); return sunxi_mmc_set_ios_common(priv, &plat->mmc); @@ -581,7 +581,7 @@ static int sunxi_mmc_set_ios(struct udevice *dev) static int sunxi_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) { - struct sunxi_mmc_plat *plat = dev_get_platdata(dev); + struct sunxi_mmc_plat *plat = dev_get_plat(dev); struct sunxi_mmc_priv *priv = dev_get_priv(dev); return sunxi_mmc_send_cmd_common(priv, &plat->mmc, cmd, data); @@ -608,7 +608,7 @@ static const struct dm_mmc_ops sunxi_mmc_ops = { static int sunxi_mmc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct sunxi_mmc_plat *plat = dev_get_platdata(dev); + struct sunxi_mmc_plat *plat = dev_get_plat(dev); struct sunxi_mmc_priv *priv = dev_get_priv(dev); struct reset_ctl_bulk reset_bulk; struct clk gate_clk; @@ -682,7 +682,7 @@ static int sunxi_mmc_probe(struct udevice *dev) static int sunxi_mmc_bind(struct udevice *dev) { - struct sunxi_mmc_plat *plat = dev_get_platdata(dev); + struct sunxi_mmc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -746,7 +746,7 @@ U_BOOT_DRIVER(sunxi_mmc_drv) = { .bind = sunxi_mmc_bind, .probe = sunxi_mmc_probe, .ops = &sunxi_mmc_ops, - .platdata_auto_alloc_size = sizeof(struct sunxi_mmc_plat), - .priv_auto_alloc_size = sizeof(struct sunxi_mmc_priv), + .plat_auto = sizeof(struct sunxi_mmc_plat), + .priv_auto = sizeof(struct sunxi_mmc_priv), }; #endif diff --git a/drivers/mmc/tangier_sdhci.c b/drivers/mmc/tangier_sdhci.c index 879e2c9..1156427 100644 --- a/drivers/mmc/tangier_sdhci.c +++ b/drivers/mmc/tangier_sdhci.c @@ -22,7 +22,7 @@ struct sdhci_tangier_plat { static int sdhci_tangier_bind(struct udevice *dev) { - struct sdhci_tangier_plat *plat = dev_get_platdata(dev); + struct sdhci_tangier_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -30,7 +30,7 @@ static int sdhci_tangier_bind(struct udevice *dev) static int sdhci_tangier_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct sdhci_tangier_plat *plat = dev_get_platdata(dev); + struct sdhci_tangier_plat *plat = dev_get_plat(dev); struct sdhci_host *host = dev_get_priv(dev); fdt_addr_t base; int ret; @@ -76,6 +76,6 @@ U_BOOT_DRIVER(sdhci_tangier) = { .bind = sdhci_tangier_bind, .probe = sdhci_tangier_probe, .ops = &sdhci_ops, - .priv_auto_alloc_size = sizeof(struct sdhci_host), - .platdata_auto_alloc_size = sizeof(struct sdhci_tangier_plat), + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct sdhci_tangier_plat), }; diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index cc78a2f..760eca4 100644 --- a/drivers/mmc/tegra_mmc.c +++ b/drivers/mmc/tegra_mmc.c @@ -680,7 +680,7 @@ static const struct dm_mmc_ops tegra_mmc_ops = { static int tegra_mmc_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct tegra_mmc_plat *plat = dev_get_platdata(dev); + struct tegra_mmc_plat *plat = dev_get_plat(dev); struct tegra_mmc_priv *priv = dev_get_priv(dev); struct mmc_config *cfg = &plat->cfg; int bus_width, ret; @@ -749,7 +749,7 @@ static int tegra_mmc_probe(struct udevice *dev) static int tegra_mmc_bind(struct udevice *dev) { - struct tegra_mmc_plat *plat = dev_get_platdata(dev); + struct tegra_mmc_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } @@ -771,6 +771,6 @@ U_BOOT_DRIVER(tegra_mmc_drv) = { .bind = tegra_mmc_bind, .probe = tegra_mmc_probe, .ops = &tegra_mmc_ops, - .platdata_auto_alloc_size = sizeof(struct tegra_mmc_plat), - .priv_auto_alloc_size = sizeof(struct tegra_mmc_priv), + .plat_auto = sizeof(struct tegra_mmc_plat), + .priv_auto = sizeof(struct tegra_mmc_priv), }; diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c index c653973..2c52868 100644 --- a/drivers/mmc/tmio-common.c +++ b/drivers/mmc/tmio-common.c @@ -708,14 +708,14 @@ static void tmio_sd_host_init(struct tmio_sd_priv *priv) int tmio_sd_bind(struct udevice *dev) { - struct tmio_sd_plat *plat = dev_get_platdata(dev); + struct tmio_sd_plat *plat = dev_get_plat(dev); return mmc_bind(dev, &plat->mmc, &plat->cfg); } int tmio_sd_probe(struct udevice *dev, u32 quirks) { - struct tmio_sd_plat *plat = dev_get_platdata(dev); + struct tmio_sd_plat *plat = dev_get_plat(dev); struct tmio_sd_priv *priv = dev_get_priv(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); fdt_addr_t base; diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c index 4dbe71f..75003a0 100644 --- a/drivers/mmc/uniphier-sd.c +++ b/drivers/mmc/uniphier-sd.c @@ -84,7 +84,7 @@ U_BOOT_DRIVER(uniphier_mmc) = { .of_match = uniphier_sd_match, .bind = tmio_sd_bind, .probe = uniphier_sd_probe, - .priv_auto_alloc_size = sizeof(struct tmio_sd_priv), - .platdata_auto_alloc_size = sizeof(struct tmio_sd_plat), + .priv_auto = sizeof(struct tmio_sd_priv), + .plat_auto = sizeof(struct tmio_sd_plat), .ops = &uniphier_sd_ops, }; diff --git a/drivers/mmc/xenon_sdhci.c b/drivers/mmc/xenon_sdhci.c index 6ce9d00..b8e833e 100644 --- a/drivers/mmc/xenon_sdhci.c +++ b/drivers/mmc/xenon_sdhci.c @@ -442,7 +442,7 @@ static const struct sdhci_ops xenon_sdhci_ops = { static int xenon_sdhci_probe(struct udevice *dev) { - struct xenon_sdhci_plat *plat = dev_get_platdata(dev); + struct xenon_sdhci_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct xenon_sdhci_priv *priv = dev_get_priv(dev); struct sdhci_host *host = dev_get_priv(dev); @@ -515,7 +515,7 @@ static int xenon_sdhci_probe(struct udevice *dev) return ret; } -static int xenon_sdhci_ofdata_to_platdata(struct udevice *dev) +static int xenon_sdhci_of_to_plat(struct udevice *dev) { struct sdhci_host *host = dev_get_priv(dev); struct xenon_sdhci_priv *priv = dev_get_priv(dev); @@ -545,7 +545,7 @@ static int xenon_sdhci_ofdata_to_platdata(struct udevice *dev) static int xenon_sdhci_bind(struct udevice *dev) { - struct xenon_sdhci_plat *plat = dev_get_platdata(dev); + struct xenon_sdhci_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -560,10 +560,10 @@ U_BOOT_DRIVER(xenon_sdhci_drv) = { .name = "xenon_sdhci", .id = UCLASS_MMC, .of_match = xenon_sdhci_ids, - .ofdata_to_platdata = xenon_sdhci_ofdata_to_platdata, + .of_to_plat = xenon_sdhci_of_to_plat, .ops = &sdhci_ops, .bind = xenon_sdhci_bind, .probe = xenon_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct xenon_sdhci_priv), - .platdata_auto_alloc_size = sizeof(struct xenon_sdhci_plat), + .priv_auto = sizeof(struct xenon_sdhci_priv), + .plat_auto = sizeof(struct xenon_sdhci_plat), }; diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 147ecc0..d9ad0ff 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -552,7 +552,7 @@ const struct sdhci_ops arasan_ops = { static int arasan_sdhci_probe(struct udevice *dev) { - struct arasan_sdhci_plat *plat = dev_get_platdata(dev); + struct arasan_sdhci_plat *plat = dev_get_plat(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct arasan_sdhci_priv *priv = dev_get_priv(dev); struct sdhci_host *host; @@ -613,7 +613,7 @@ static int arasan_sdhci_probe(struct udevice *dev) return sdhci_probe(dev); } -static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) +static int arasan_sdhci_of_to_plat(struct udevice *dev) { struct arasan_sdhci_priv *priv = dev_get_priv(dev); @@ -641,7 +641,7 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) static int arasan_sdhci_bind(struct udevice *dev) { - struct arasan_sdhci_plat *plat = dev_get_platdata(dev); + struct arasan_sdhci_plat *plat = dev_get_plat(dev); return sdhci_bind(dev, &plat->mmc, &plat->cfg); } @@ -655,10 +655,10 @@ U_BOOT_DRIVER(arasan_sdhci_drv) = { .name = "arasan_sdhci", .id = UCLASS_MMC, .of_match = arasan_sdhci_ids, - .ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata, + .of_to_plat = arasan_sdhci_of_to_plat, .ops = &sdhci_ops, .bind = arasan_sdhci_bind, .probe = arasan_sdhci_probe, - .priv_auto_alloc_size = sizeof(struct arasan_sdhci_priv), - .platdata_auto_alloc_size = sizeof(struct arasan_sdhci_plat), + .priv_auto = sizeof(struct arasan_sdhci_priv), + .plat_auto = sizeof(struct arasan_sdhci_plat), }; diff --git a/drivers/mtd/altera_qspi.c b/drivers/mtd/altera_qspi.c index cd4d329..0011811 100644 --- a/drivers/mtd/altera_qspi.c +++ b/drivers/mtd/altera_qspi.c @@ -48,7 +48,7 @@ struct altera_qspi_regs { u32 chip_select; }; -struct altera_qspi_platdata { +struct altera_qspi_plat { struct altera_qspi_regs *regs; void *base; unsigned long size; @@ -106,7 +106,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) { struct mtd_info *mtd = info->mtd; struct udevice *dev = mtd->dev; - struct altera_qspi_platdata *pdata = dev_get_platdata(dev); + struct altera_qspi_plat *pdata = dev_get_plat(dev); ulong base = (ulong)pdata->base; loff_t to = addr - base; size_t retlen; @@ -135,7 +135,7 @@ unsigned long flash_init(void) static int altera_qspi_erase(struct mtd_info *mtd, struct erase_info *instr) { struct udevice *dev = mtd->dev; - struct altera_qspi_platdata *pdata = dev_get_platdata(dev); + struct altera_qspi_plat *pdata = dev_get_plat(dev); struct altera_qspi_regs *regs = pdata->regs; size_t addr = instr->addr; size_t len = instr->len; @@ -197,7 +197,7 @@ static int altera_qspi_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) { struct udevice *dev = mtd->dev; - struct altera_qspi_platdata *pdata = dev_get_platdata(dev); + struct altera_qspi_plat *pdata = dev_get_plat(dev); memcpy_fromio(buf, pdata->base + from, len); *retlen = len; @@ -209,7 +209,7 @@ static int altera_qspi_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { struct udevice *dev = mtd->dev; - struct altera_qspi_platdata *pdata = dev_get_platdata(dev); + struct altera_qspi_plat *pdata = dev_get_plat(dev); struct altera_qspi_regs *regs = pdata->regs; u32 stat; @@ -235,7 +235,7 @@ static void altera_qspi_get_locked_range(struct mtd_info *mtd, loff_t *ofs, uint64_t *len) { struct udevice *dev = mtd->dev; - struct altera_qspi_platdata *pdata = dev_get_platdata(dev); + struct altera_qspi_plat *pdata = dev_get_plat(dev); struct altera_qspi_regs *regs = pdata->regs; int shift0 = ffs(QUADSPI_SR_BP2_0) - 1; int shift3 = ffs(QUADSPI_SR_BP3) - 1 - 3; @@ -257,7 +257,7 @@ static void altera_qspi_get_locked_range(struct mtd_info *mtd, loff_t *ofs, static int altera_qspi_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) { struct udevice *dev = mtd->dev; - struct altera_qspi_platdata *pdata = dev_get_platdata(dev); + struct altera_qspi_plat *pdata = dev_get_plat(dev); struct altera_qspi_regs *regs = pdata->regs; u32 sector_start, sector_end; u32 num_sectors; @@ -291,7 +291,7 @@ static int altera_qspi_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) static int altera_qspi_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) { struct udevice *dev = mtd->dev; - struct altera_qspi_platdata *pdata = dev_get_platdata(dev); + struct altera_qspi_plat *pdata = dev_get_plat(dev); struct altera_qspi_regs *regs = pdata->regs; u32 mem_op; @@ -304,7 +304,7 @@ static int altera_qspi_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) static int altera_qspi_probe(struct udevice *dev) { - struct altera_qspi_platdata *pdata = dev_get_platdata(dev); + struct altera_qspi_plat *pdata = dev_get_plat(dev); struct altera_qspi_regs *regs = pdata->regs; unsigned long base = (unsigned long)pdata->base; struct mtd_info *mtd; @@ -346,9 +346,9 @@ static int altera_qspi_probe(struct udevice *dev) return 0; } -static int altera_qspi_ofdata_to_platdata(struct udevice *dev) +static int altera_qspi_of_to_plat(struct udevice *dev) { - struct altera_qspi_platdata *pdata = dev_get_platdata(dev); + struct altera_qspi_plat *pdata = dev_get_plat(dev); void *blob = (void *)gd->fdt_blob; int node = dev_of_offset(dev); const char *list, *end; @@ -400,7 +400,7 @@ U_BOOT_DRIVER(altera_qspi) = { .name = "altera_qspi", .id = UCLASS_MTD, .of_match = altera_qspi_ids, - .ofdata_to_platdata = altera_qspi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct altera_qspi_platdata), + .of_to_plat = altera_qspi_of_to_plat, + .plat_auto = sizeof(struct altera_qspi_plat), .probe = altera_qspi_probe, }; diff --git a/drivers/mtd/hbmc-am654.c b/drivers/mtd/hbmc-am654.c index 846b0e8..c86e504 100644 --- a/drivers/mtd/hbmc-am654.c +++ b/drivers/mtd/hbmc-am654.c @@ -102,5 +102,5 @@ U_BOOT_DRIVER(hbmc_am654) = { .of_match = am654_hbmc_dt_ids, .probe = am654_hbmc_probe, .bind = am654_hbmc_bind, - .priv_auto_alloc_size = sizeof(struct am654_hbmc_priv), + .priv_auto = sizeof(struct am654_hbmc_priv), }; diff --git a/drivers/mtd/mtd-uclass.c b/drivers/mtd/mtd-uclass.c index 5418217..9f5f672 100644 --- a/drivers/mtd/mtd-uclass.c +++ b/drivers/mtd/mtd-uclass.c @@ -32,5 +32,5 @@ int mtd_probe(struct udevice *dev) UCLASS_DRIVER(mtd) = { .id = UCLASS_MTD, .name = "mtd", - .per_device_auto_alloc_size = sizeof(struct mtd_info), + .per_device_auto = sizeof(struct mtd_info), }; diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c index 0615e50..4621bfb 100644 --- a/drivers/mtd/nand/raw/arasan_nfc.c +++ b/drivers/mtd/nand/raw/arasan_nfc.c @@ -1310,7 +1310,7 @@ U_BOOT_DRIVER(arasan_nand) = { .id = UCLASS_MTD, .of_match = arasan_nand_dt_ids, .probe = arasan_probe, - .priv_auto_alloc_size = sizeof(struct arasan_nand_info), + .priv_auto = sizeof(struct arasan_nand_info), }; void board_nand_init(void) @@ -1319,7 +1319,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(arasan_nand), &dev); + DM_DRIVER_GET(arasan_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize %s. (error %d)\n", dev->name, ret); } diff --git a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c index 6313403..aa095c4 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c @@ -109,7 +109,7 @@ U_BOOT_DRIVER(bcm63158_nand) = { .id = UCLASS_MTD, .of_match = bcm63158_nand_dt_ids, .probe = bcm63158_nand_probe, - .priv_auto_alloc_size = sizeof(struct bcm63158_nand_soc), + .priv_auto = sizeof(struct bcm63158_nand_soc), }; void board_nand_init(void) @@ -118,7 +118,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(bcm63158_nand), &dev); + DM_DRIVER_GET(bcm63158_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize %s. (error %d)\n", dev->name, ret); diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c index cd4b24a..e4bf193 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c @@ -102,7 +102,7 @@ U_BOOT_DRIVER(bcm6368_nand) = { .id = UCLASS_MTD, .of_match = bcm6368_nand_dt_ids, .probe = bcm6368_nand_probe, - .priv_auto_alloc_size = sizeof(struct bcm6368_nand_soc), + .priv_auto = sizeof(struct bcm6368_nand_soc), }; void board_nand_init(void) @@ -111,7 +111,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(bcm6368_nand), &dev); + DM_DRIVER_GET(bcm6368_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize %s. (error %d)\n", dev->name, ret); diff --git a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c index aa042be..586ea3d 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c @@ -108,7 +108,7 @@ U_BOOT_DRIVER(bcm68360_nand) = { .id = UCLASS_MTD, .of_match = bcm68360_nand_dt_ids, .probe = bcm68360_nand_probe, - .priv_auto_alloc_size = sizeof(struct bcm68360_nand_soc), + .priv_auto = sizeof(struct bcm68360_nand_soc), }; void board_nand_init(void) @@ -117,7 +117,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(bcm68360_nand), &dev); + DM_DRIVER_GET(bcm68360_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize %s. (error %d)\n", dev->name, ret); diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c index 0788455..85f318b 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c @@ -108,7 +108,7 @@ U_BOOT_DRIVER(bcm6838_nand) = { .id = UCLASS_MTD, .of_match = bcm6838_nand_dt_ids, .probe = bcm6838_nand_probe, - .priv_auto_alloc_size = sizeof(struct bcm6838_nand_soc), + .priv_auto = sizeof(struct bcm6838_nand_soc), }; void board_nand_init(void) @@ -117,7 +117,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(bcm6838_nand), &dev); + DM_DRIVER_GET(bcm6838_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize %s. (error %d)\n", dev->name, ret); diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c index 818eae8..a5e159a 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c @@ -109,7 +109,7 @@ U_BOOT_DRIVER(bcm6858_nand) = { .id = UCLASS_MTD, .of_match = bcm6858_nand_dt_ids, .probe = bcm6858_nand_probe, - .priv_auto_alloc_size = sizeof(struct bcm6858_nand_soc), + .priv_auto = sizeof(struct bcm6858_nand_soc), }; void board_nand_init(void) @@ -118,7 +118,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(bcm6858_nand), &dev); + DM_DRIVER_GET(bcm6858_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize %s. (error %d)\n", dev->name, ret); diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c index 4416b8f..9ad3a57 100644 --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -816,7 +816,7 @@ U_BOOT_DRIVER(davinci_nand) = { .id = UCLASS_MTD, .of_match = davinci_nand_ids, .probe = davinci_nand_probe, - .priv_auto_alloc_size = sizeof(struct nand_chip), + .priv_auto = sizeof(struct nand_chip), }; void board_nand_init(void) @@ -825,7 +825,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(davinci_nand), &dev); + DM_DRIVER_GET(davinci_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize %s: %d\n", dev->name, ret); } diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c index 8318ff5..cf4df01 100644 --- a/drivers/mtd/nand/raw/denali_dt.c +++ b/drivers/mtd/nand/raw/denali_dt.c @@ -172,7 +172,7 @@ U_BOOT_DRIVER(denali_nand_dt) = { .id = UCLASS_MTD, .of_match = denali_nand_dt_ids, .probe = denali_dt_probe, - .priv_auto_alloc_size = sizeof(struct denali_nand_info), + .priv_auto = sizeof(struct denali_nand_info), }; void board_nand_init(void) @@ -181,7 +181,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(denali_nand_dt), + DM_DRIVER_GET(denali_nand_dt), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize Denali NAND controller. (error %d)\n", diff --git a/drivers/mtd/nand/raw/mxs_nand_dt.c b/drivers/mtd/nand/raw/mxs_nand_dt.c index 43dbe9e..878796d 100644 --- a/drivers/mtd/nand/raw/mxs_nand_dt.c +++ b/drivers/mtd/nand/raw/mxs_nand_dt.c @@ -168,7 +168,7 @@ U_BOOT_DRIVER(mxs_nand_dt) = { .id = UCLASS_MTD, .of_match = mxs_nand_dt_ids, .probe = mxs_nand_dt_probe, - .priv_auto_alloc_size = sizeof(struct mxs_nand_info), + .priv_auto = sizeof(struct mxs_nand_info), }; void board_nand_init(void) @@ -177,7 +177,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(mxs_nand_dt), + DM_DRIVER_GET(mxs_nand_dt), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize MXS NAND controller. (error %d)\n", diff --git a/drivers/mtd/nand/raw/octeontx_bch.c b/drivers/mtd/nand/raw/octeontx_bch.c index 6937062..a417728 100644 --- a/drivers/mtd/nand/raw/octeontx_bch.c +++ b/drivers/mtd/nand/raw/octeontx_bch.c @@ -410,7 +410,7 @@ U_BOOT_DRIVER(octeontx_pci_bchpf) = { .id = UCLASS_MISC, .probe = octeontx_pci_bchpf_probe, .remove = octeontx_pci_bchpf_remove, - .priv_auto_alloc_size = sizeof(struct bch_device), + .priv_auto = sizeof(struct bch_device), .flags = DM_FLAG_OS_PREPARE, }; @@ -418,7 +418,7 @@ U_BOOT_DRIVER(octeontx_pci_bchvf) = { .name = BCHVF_DRIVER_NAME, .id = UCLASS_MISC, .probe = octeontx_pci_bchvf_probe, - .priv_auto_alloc_size = sizeof(struct bch_vf), + .priv_auto = sizeof(struct bch_vf), }; U_BOOT_PCI_DEVICE(octeontx_pci_bchpf, octeontx_bchpf_pci_id_table); diff --git a/drivers/mtd/nand/raw/octeontx_nand.c b/drivers/mtd/nand/raw/octeontx_nand.c index ad21917..9997135 100644 --- a/drivers/mtd/nand/raw/octeontx_nand.c +++ b/drivers/mtd/nand/raw/octeontx_nand.c @@ -1999,7 +1999,7 @@ static int octeontx_nfc_chip_init(struct octeontx_nfc *tn, struct udevice *dev, static int octeontx_nfc_chips_init(struct octeontx_nfc *tn) { struct udevice *dev = tn->dev; - ofnode node = dev->node; + ofnode node = dev_ofnode(dev); ofnode nand_node; int nr_chips = of_get_child_count(node); int ret; @@ -2187,7 +2187,7 @@ int octeontx_pci_nand_deferred_probe(void) debug("%s: Performing deferred probing\n", __func__); list_for_each_entry(pdev, &octeontx_pci_nand_deferred_devices, list) { debug("%s: Probing %s\n", __func__, pdev->dev->name); - pdev->dev->flags &= ~DM_FLAG_ACTIVATED; + dev_get_flags(pdev->dev) &= ~DM_FLAG_ACTIVATED; rc = device_probe(pdev->dev); if (rc && rc != -ENODEV) { printf("%s: Error %d with deferred probe of %s\n", @@ -2203,7 +2203,7 @@ static const struct pci_device_id octeontx_nfc_pci_id_table[] = { {} }; -static int octeontx_nand_ofdata_to_platdata(struct udevice *dev) +static int octeontx_nand_of_to_plat(struct udevice *dev) { return 0; } @@ -2217,9 +2217,9 @@ U_BOOT_DRIVER(octeontx_pci_nand) = { .name = OCTEONTX_NAND_DRIVER_NAME, .id = UCLASS_MTD, .of_match = of_match_ptr(octeontx_nand_ids), - .ofdata_to_platdata = octeontx_nand_ofdata_to_platdata, + .of_to_plat = octeontx_nand_of_to_plat, .probe = octeontx_pci_nand_probe, - .priv_auto_alloc_size = sizeof(struct octeontx_nfc), + .priv_auto = sizeof(struct octeontx_nfc), .remove = octeontx_pci_nand_disable, .flags = DM_FLAG_OS_PREPARE, }; @@ -2233,14 +2233,14 @@ void board_nand_init(void) if (IS_ENABLED(CONFIG_NAND_OCTEONTX_HW_ECC)) { ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(octeontx_pci_bchpf), + DM_DRIVER_GET(octeontx_pci_bchpf), &dev); if (ret && ret != -ENODEV) { pr_err("Failed to initialize OcteonTX BCH PF controller. (error %d)\n", ret); } ret = uclass_get_device_by_driver(UCLASS_MISC, - DM_GET_DRIVER(octeontx_pci_bchvf), + DM_DRIVER_GET(octeontx_pci_bchvf), &dev); if (ret && ret != -ENODEV) { pr_err("Failed to initialize OcteonTX BCH VF controller. (error %d)\n", @@ -2249,7 +2249,7 @@ void board_nand_init(void) } ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(octeontx_pci_nand), + DM_DRIVER_GET(octeontx_pci_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize OcteonTX NAND controller. (error %d)\n", diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c b/drivers/mtd/nand/raw/pxa3xx_nand.c index 361a9e3..f623375 100644 --- a/drivers/mtd/nand/raw/pxa3xx_nand.c +++ b/drivers/mtd/nand/raw/pxa3xx_nand.c @@ -1937,7 +1937,7 @@ U_BOOT_DRIVER(pxa3xx_nand) = { .id = UCLASS_MTD, .of_match = pxa3xx_nand_dt_ids, .probe = pxa3xx_nand_probe, - .priv_auto_alloc_size = sizeof(struct pxa3xx_nand_info) + + .priv_auto = sizeof(struct pxa3xx_nand_info) + sizeof(struct pxa3xx_nand_host) * CONFIG_SYS_MAX_NAND_DEVICE, }; @@ -1947,7 +1947,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(pxa3xx_nand), &dev); + DM_DRIVER_GET(pxa3xx_nand), &dev); if (ret && ret != -ENODEV) { pr_err("Failed to initialize %s. (error %d)\n", dev->name, ret); diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index 47fe610..b8561b2 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -1033,7 +1033,7 @@ U_BOOT_DRIVER(stm32_fmc2_nfc) = { .id = UCLASS_MTD, .of_match = stm32_fmc2_nfc_match, .probe = stm32_fmc2_nfc_probe, - .priv_auto_alloc_size = sizeof(struct stm32_fmc2_nfc), + .priv_auto = sizeof(struct stm32_fmc2_nfc), }; void board_nand_init(void) @@ -1042,7 +1042,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(stm32_fmc2_nfc), + DM_DRIVER_GET(stm32_fmc2_nfc), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize STM32 FMC2 NFC controller. (error %d)\n", diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c index b9f5bdd..a530127 100644 --- a/drivers/mtd/nand/raw/tegra_nand.c +++ b/drivers/mtd/nand/raw/tegra_nand.c @@ -990,7 +990,7 @@ U_BOOT_DRIVER(tegra_nand) = { .id = UCLASS_MTD, .of_match = tegra_nand_dt_ids, .probe = tegra_probe, - .priv_auto_alloc_size = sizeof(struct tegra_nand_info), + .priv_auto = sizeof(struct tegra_nand_info), }; void board_nand_init(void) @@ -999,7 +999,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(tegra_nand), &dev); + DM_DRIVER_GET(tegra_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize %s. (error %d)\n", dev->name, ret); diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c index 4e6fdc6..e33953e 100644 --- a/drivers/mtd/nand/raw/vf610_nfc.c +++ b/drivers/mtd/nand/raw/vf610_nfc.c @@ -784,7 +784,7 @@ U_BOOT_DRIVER(vf610_nfc_dt) = { .name = "vf610-nfc-dt", .id = UCLASS_MTD, .of_match = vf610_nfc_dt_ids, - .priv_auto_alloc_size = sizeof(struct vf610_nfc), + .priv_auto = sizeof(struct vf610_nfc), .probe = vf610_nfc_dt_probe, }; @@ -794,7 +794,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(vf610_nfc_dt), + DM_DRIVER_GET(vf610_nfc_dt), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize NAND controller. (error %d)\n", diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c index 92db2aa..d792528 100644 --- a/drivers/mtd/nand/raw/zynq_nand.c +++ b/drivers/mtd/nand/raw/zynq_nand.c @@ -1206,12 +1206,10 @@ static int zynq_nand_probe(struct udevice *dev) nand_chip->options |= NAND_SUBPAGE_READ; /* On-Die ECC spare bytes offset 8 is used for ECC codes */ - if (ondie_ecc_enabled) { - nand_chip->ecc.layout = &ondie_nand_oob_64; - /* Use the BBT pattern descriptors */ - nand_chip->bbt_td = &bbt_main_descr; - nand_chip->bbt_md = &bbt_mirror_descr; - } + nand_chip->ecc.layout = &ondie_nand_oob_64; + /* Use the BBT pattern descriptors */ + nand_chip->bbt_td = &bbt_main_descr; + nand_chip->bbt_md = &bbt_mirror_descr; } else { /* Hardware ECC generates 3 bytes ECC code for each 512 bytes */ nand_chip->ecc.mode = NAND_ECC_HW; @@ -1286,7 +1284,7 @@ U_BOOT_DRIVER(zynq_nand) = { .id = UCLASS_MTD, .of_match = zynq_nand_dt_ids, .probe = zynq_nand_probe, - .priv_auto_alloc_size = sizeof(struct zynq_nand_info), + .priv_auto = sizeof(struct zynq_nand_info), }; void board_nand_init(void) @@ -1295,7 +1293,7 @@ void board_nand_init(void) int ret; ret = uclass_get_device_by_driver(UCLASS_MTD, - DM_GET_DRIVER(zynq_nand), &dev); + DM_DRIVER_GET(zynq_nand), &dev); if (ret && ret != -ENODEV) pr_err("Failed to initialize %s. (error %d)\n", dev->name, ret); } diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 36d0400..68ef5d1 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -1165,7 +1165,7 @@ static int spinand_probe(struct udevice *dev) return -ENOMEM; sprintf(mtd->name, "spi-nand%d", spi_nand_idx++); spinand->slave = slave; - spinand_set_of_node(spinand, dev->node.np); + spinand_set_ofnode(spinand, dev_ofnode(dev)); #endif ret = spinand_init(spinand); @@ -1247,6 +1247,6 @@ U_BOOT_DRIVER(spinand) = { .name = "spi_nand", .id = UCLASS_MTD, .of_match = spinand_ids, - .priv_auto_alloc_size = sizeof(struct spinand_device), + .priv_auto = sizeof(struct spinand_device), .probe = spinand_probe, }; diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig index 018e8c5..ea44443 100644 --- a/drivers/mtd/spi/Kconfig +++ b/drivers/mtd/spi/Kconfig @@ -63,7 +63,7 @@ config SF_DEFAULT_MODE to handle the common case when only a single serial flash is present on the system. Not used for boot with device tree; the SPI driver reads - speed and mode from platdata values computed from + speed and mode from plat values computed from available node. config SF_DEFAULT_SPEED @@ -75,7 +75,7 @@ config SF_DEFAULT_SPEED to handle the common case when only a single serial flash is present on the system. Not used for boot with device tree; the SPI driver reads - speed and mode from platdata values computed from + speed and mode from plat values computed from available node. if SPI_FLASH diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c index 0b602dc..3c01e3b 100644 --- a/drivers/mtd/spi/sandbox.c +++ b/drivers/mtd/spi/sandbox.c @@ -122,23 +122,23 @@ static int sandbox_sf_probe(struct udevice *dev) struct sandbox_spi_flash *sbsf = dev_get_priv(dev); size_t len, idname_len; const struct flash_info *data; - struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev); + struct sandbox_spi_flash_plat_data *pdata = dev_get_plat(dev); struct sandbox_state *state = state_get_current(); - struct dm_spi_slave_platdata *slave_plat; + struct dm_spi_slave_plat *slave_plat; struct udevice *bus = dev->parent; const char *spec = NULL; struct udevice *emul; int ret = 0; int cs = -1; - debug("%s: bus %d, looking for emul=%p: ", __func__, bus->seq, dev); + debug("%s: bus %d, looking for emul=%p: ", __func__, dev_seq(bus), dev); ret = sandbox_spi_get_emul(state, bus, dev, &emul); if (ret) { printf("Error: Unknown chip select for device '%s'\n", dev->name); return ret; } - slave_plat = dev_get_parent_platdata(dev); + slave_plat = dev_get_parent_plat(dev); cs = slave_plat->cs; debug("found at cs %d\n", cs); @@ -498,9 +498,9 @@ static int sandbox_sf_xfer(struct udevice *dev, unsigned int bitlen, return pos == bytes ? 0 : -EIO; } -int sandbox_sf_ofdata_to_platdata(struct udevice *dev) +int sandbox_sf_of_to_plat(struct udevice *dev) { - struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev); + struct sandbox_spi_flash_plat_data *pdata = dev_get_plat(dev); pdata->filename = dev_read_string(dev, "sandbox,filename"); pdata->device_name = dev_read_string(dev, "compatible"); @@ -538,7 +538,7 @@ int sandbox_sf_bind_emul(struct sandbox_state *state, int busnum, int cs, str = strdup(name); if (!str) return -ENOMEM; - ret = device_bind_ofnode(bus, drv, str, NULL, node, &emul); + ret = device_bind(bus, drv, str, NULL, node, &emul); if (ret) { free(str); printf("Cannot create emul device for spec '%s' (err=%d)\n", @@ -565,7 +565,7 @@ int sandbox_spi_get_emul(struct sandbox_state *state, struct udevice **emulp) { struct sandbox_spi_info *info; - int busnum = bus->seq; + int busnum = dev_seq(bus); int cs = spi_chip_select(slave); int ret; @@ -597,10 +597,10 @@ U_BOOT_DRIVER(sandbox_sf_emul) = { .name = "sandbox_sf_emul", .id = UCLASS_SPI_EMUL, .of_match = sandbox_sf_ids, - .ofdata_to_platdata = sandbox_sf_ofdata_to_platdata, + .of_to_plat = sandbox_sf_of_to_plat, .probe = sandbox_sf_probe, .remove = sandbox_sf_remove, - .priv_auto_alloc_size = sizeof(struct sandbox_spi_flash), - .platdata_auto_alloc_size = sizeof(struct sandbox_spi_flash_plat_data), + .priv_auto = sizeof(struct sandbox_spi_flash), + .plat_auto = sizeof(struct sandbox_spi_flash_plat_data), .ops = &sandbox_sf_emul_ops, }; diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c index 09c1143..3017022 100644 --- a/drivers/mtd/spi/sf-uclass.c +++ b/drivers/mtd/spi/sf-uclass.c @@ -100,5 +100,5 @@ UCLASS_DRIVER(spi_flash) = { .id = UCLASS_SPI_FLASH, .name = "spi_flash", .post_bind = spi_flash_post_bind, - .per_device_auto_alloc_size = sizeof(struct spi_flash), + .per_device_auto = sizeof(struct spi_nor), }; diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c index 27d847d..b59edd1 100644 --- a/drivers/mtd/spi/sf_dataflash.c +++ b/drivers/mtd/spi/sf_dataflash.c @@ -693,6 +693,6 @@ U_BOOT_DRIVER(spi_dataflash) = { .id = UCLASS_SPI_FLASH, .of_match = spi_dataflash_ids, .probe = spi_dataflash_probe, - .priv_auto_alloc_size = sizeof(struct dataflash), + .priv_auto = sizeof(struct dataflash), .ops = &spi_dataflash_ops, }; diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index b959e34..6c87434 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -166,10 +166,10 @@ U_BOOT_DRIVER(jedec_spi_nor) = { .of_match = spi_flash_std_ids, .probe = spi_flash_std_probe, .remove = spi_flash_std_remove, - .priv_auto_alloc_size = sizeof(struct spi_flash), + .priv_auto = sizeof(struct spi_nor), .ops = &spi_flash_std_ops, }; -U_BOOT_DRIVER_ALIAS(jedec_spi_nor, spansion_m25p16) +DM_DRIVER_ALIAS(jedec_spi_nor, spansion_m25p16) #endif /* CONFIG_DM_SPI_FLASH */ diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index b986850..00e0282 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -12,6 +12,7 @@ #include <regmap.h> #include <syscon.h> #include <dm/device.h> +#include <dm/device-internal.h> #include <dm/device_compat.h> #include <dm/read.h> #include <dm/devres.h> @@ -68,7 +69,7 @@ static int mmio_mux_probe(struct udevice *dev) fields = devm_kmalloc(dev, num_fields * sizeof(*fields), __GFP_ZERO); if (!fields) return -ENOMEM; - dev->priv = fields; + dev_set_priv(dev, fields); mux_reg_masks = devm_kmalloc(dev, num_fields * 2 * sizeof(u32), __GFP_ZERO); diff --git a/drivers/mux/mux-uclass.c b/drivers/mux/mux-uclass.c index a35c3d9..6d28dbe 100644 --- a/drivers/mux/mux-uclass.c +++ b/drivers/mux/mux-uclass.c @@ -331,5 +331,5 @@ UCLASS_DRIVER(mux) = { .id = UCLASS_MUX, .name = "mux", .post_probe = mux_uclass_post_probe, - .per_device_auto_alloc_size = sizeof(struct mux_chip), + .per_device_auto = sizeof(struct mux_chip), }; diff --git a/drivers/net/ag7xxx.c b/drivers/net/ag7xxx.c index ccba394..c16dff9 100644 --- a/drivers/net/ag7xxx.c +++ b/drivers/net/ag7xxx.c @@ -588,7 +588,7 @@ static void ag7xxx_eth_stop(struct udevice *dev) */ static int ag7xxx_eth_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct ar7xxx_eth_priv *priv = dev_get_priv(dev); unsigned char *mac = pdata->enetaddr; u32 macid_lo, macid_hi; @@ -1197,7 +1197,7 @@ static int ag7xxx_get_phy_iface_offset(struct udevice *dev) static int ag7xxx_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct ar7xxx_eth_priv *priv = dev_get_priv(dev); void __iomem *iobase, *phyiobase; int ret, phyreg; @@ -1250,9 +1250,9 @@ static const struct eth_ops ag7xxx_eth_ops = { .write_hwaddr = ag7xxx_eth_write_hwaddr, }; -static int ag7xxx_eth_ofdata_to_platdata(struct udevice *dev) +static int ag7xxx_eth_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const char *phy_mode; int ret; @@ -1287,11 +1287,11 @@ U_BOOT_DRIVER(eth_ag7xxx) = { .name = "eth_ag7xxx", .id = UCLASS_ETH, .of_match = ag7xxx_eth_ids, - .ofdata_to_platdata = ag7xxx_eth_ofdata_to_platdata, + .of_to_plat = ag7xxx_eth_of_to_plat, .probe = ag7xxx_eth_probe, .remove = ag7xxx_eth_remove, .ops = &ag7xxx_eth_ops, - .priv_auto_alloc_size = sizeof(struct ar7xxx_eth_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ar7xxx_eth_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 93b26da..456b7b9 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -453,7 +453,7 @@ static int altera_tse_write_hwaddr(struct udevice *dev) { struct altera_tse_priv *priv = dev_get_priv(dev); struct alt_tse_mac *mac_dev = priv->mac_dev; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); u8 *hwaddr = pdata->enetaddr; u32 mac_lo, mac_hi; @@ -575,7 +575,7 @@ static const struct tse_ops tse_msgdma_ops = { static int altera_tse_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct altera_tse_priv *priv = dev_get_priv(dev); void *blob = (void *)gd->fdt_blob; int node = dev_of_offset(dev); @@ -672,9 +672,9 @@ static int altera_tse_probe(struct udevice *dev) return ret; } -static int altera_tse_ofdata_to_platdata(struct udevice *dev) +static int altera_tse_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const char *phy_mode; pdata->phy_interface = -1; @@ -710,8 +710,8 @@ U_BOOT_DRIVER(altera_tse) = { .id = UCLASS_ETH, .of_match = altera_tse_ids, .ops = &altera_tse_ops, - .ofdata_to_platdata = altera_tse_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct eth_pdata), - .priv_auto_alloc_size = sizeof(struct altera_tse_priv), + .of_to_plat = altera_tse_of_to_plat, + .plat_auto = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct altera_tse_priv), .probe = altera_tse_probe, }; diff --git a/drivers/net/bcm6348-eth.c b/drivers/net/bcm6348-eth.c index 9ddc0f9..aad7b61 100644 --- a/drivers/net/bcm6348-eth.c +++ b/drivers/net/bcm6348-eth.c @@ -264,7 +264,7 @@ static void bcm6348_eth_stop(struct udevice *dev) static int bcm6348_eth_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct bcm6348_eth_priv *priv = dev_get_priv(dev); bool running = false; @@ -380,7 +380,7 @@ static int bcm6348_mdio_init(const char *name, void __iomem *base) static int bcm6348_phy_init(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct bcm6348_eth_priv *priv = dev_get_priv(dev); struct mii_dev *bus; @@ -412,7 +412,7 @@ static int bcm6348_phy_init(struct udevice *dev) static int bcm6348_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct bcm6348_eth_priv *priv = dev_get_priv(dev); struct ofnode_phandle_args phy; const char *phy_mode; @@ -533,7 +533,7 @@ U_BOOT_DRIVER(bcm6348_eth) = { .id = UCLASS_ETH, .of_match = bcm6348_eth_ids, .ops = &bcm6348_eth_ops, - .platdata_auto_alloc_size = sizeof(struct eth_pdata), - .priv_auto_alloc_size = sizeof(struct bcm6348_eth_priv), + .plat_auto = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct bcm6348_eth_priv), .probe = bcm6348_eth_probe, }; diff --git a/drivers/net/bcm6368-eth.c b/drivers/net/bcm6368-eth.c index 38a2a30..29abe7f 100644 --- a/drivers/net/bcm6368-eth.c +++ b/drivers/net/bcm6368-eth.c @@ -506,7 +506,7 @@ static int bcm6368_mdio_init(const char *name, struct bcm6368_eth_priv *priv) static int bcm6368_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct bcm6368_eth_priv *priv = dev_get_priv(dev); int num_ports, ret, i; ofnode node; @@ -637,7 +637,7 @@ U_BOOT_DRIVER(bcm6368_eth) = { .id = UCLASS_ETH, .of_match = bcm6368_eth_ids, .ops = &bcm6368_eth_ops, - .platdata_auto_alloc_size = sizeof(struct eth_pdata), - .priv_auto_alloc_size = sizeof(struct bcm6368_eth_priv), + .plat_auto = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct bcm6368_eth_priv), .probe = bcm6368_eth_probe, }; diff --git a/drivers/net/bcmgenet.c b/drivers/net/bcmgenet.c index ace1331..6783956 100644 --- a/drivers/net/bcmgenet.c +++ b/drivers/net/bcmgenet.c @@ -236,7 +236,7 @@ static void bcmgenet_umac_reset(struct bcmgenet_eth_priv *priv) static int bcmgenet_gmac_write_hwaddr(struct udevice *dev) { struct bcmgenet_eth_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); uchar *addr = pdata->enetaddr; u32 reg; @@ -619,7 +619,7 @@ static int bcmgenet_interface_set(struct bcmgenet_eth_priv *priv) static int bcmgenet_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct bcmgenet_eth_priv *priv = dev_get_priv(dev); ofnode mdio_node; const char *name; @@ -685,9 +685,9 @@ static const struct eth_ops bcmgenet_gmac_eth_ops = { .stop = bcmgenet_gmac_eth_stop, }; -static int bcmgenet_eth_ofdata_to_platdata(struct udevice *dev) +static int bcmgenet_eth_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct bcmgenet_eth_priv *priv = dev_get_priv(dev); struct ofnode_phandle_args phy_node; const char *phy_mode; @@ -729,10 +729,10 @@ U_BOOT_DRIVER(eth_bcmgenet) = { .name = "eth_bcmgenet", .id = UCLASS_ETH, .of_match = bcmgenet_eth_ids, - .ofdata_to_platdata = bcmgenet_eth_ofdata_to_platdata, + .of_to_plat = bcmgenet_eth_of_to_plat, .probe = bcmgenet_eth_probe, .ops = &bcmgenet_gmac_eth_ops, - .priv_auto_alloc_size = sizeof(struct bcmgenet_eth_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct bcmgenet_eth_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c index 9f8c6c5..deedfe7 100644 --- a/drivers/net/dc2114x.c +++ b/drivers/net/dc2114x.c @@ -625,7 +625,7 @@ int dc21x4x_initialize(struct bd_info *bis) #else /* DM_ETH */ static int dc2114x_start(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct dc2114x_priv *priv = dev_get_priv(dev); memcpy(priv->enetaddr, plat->enetaddr, sizeof(plat->enetaddr)); @@ -709,7 +709,7 @@ static int dc2114x_bind(struct udevice *dev) static int dc2114x_probe(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct dc2114x_priv *priv = dev_get_priv(dev); u16 command, status; u32 iobase; @@ -751,8 +751,8 @@ U_BOOT_DRIVER(eth_dc2114x) = { .bind = dc2114x_bind, .probe = dc2114x_probe, .ops = &dc2114x_ops, - .priv_auto_alloc_size = sizeof(struct dc2114x_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct dc2114x_priv), + .plat_auto = sizeof(struct eth_pdata), }; U_BOOT_PCI_DEVICE(eth_dc2114x, supported); diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 4c19abb..9dba55a 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -93,7 +93,7 @@ static int dw_mdio_reset(struct mii_dev *bus) { struct udevice *dev = bus->priv; struct dw_eth_dev *priv = dev_get_priv(dev); - struct dw_eth_pdata *pdata = dev_get_platdata(dev); + struct dw_eth_pdata *pdata = dev_get_plat(dev); int ret; if (!dm_gpio_is_valid(&priv->reset_gpio)) @@ -610,7 +610,7 @@ int designware_initialize(ulong base_addr, u32 interface) #ifdef CONFIG_DM_ETH static int designware_eth_start(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct dw_eth_dev *priv = dev_get_priv(dev); int ret; @@ -654,7 +654,7 @@ void designware_eth_stop(struct udevice *dev) int designware_eth_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct dw_eth_dev *priv = dev_get_priv(dev); return _dw_write_hwaddr(priv, pdata->enetaddr); @@ -678,7 +678,7 @@ static int designware_eth_bind(struct udevice *dev) int designware_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct dw_eth_dev *priv = dev_get_priv(dev); u32 iobase = pdata->iobase; ulong ioaddr; @@ -740,7 +740,7 @@ int designware_eth_probe(struct udevice *dev) #ifdef CONFIG_DM_PCI /* * If we are on PCI bus, either directly attached to a PCI root port, - * or via a PCI bridge, fill in platdata before we probe the hardware. + * or via a PCI bridge, fill in plat before we probe the hardware. */ if (device_is_on_pci_bus(dev)) { dm_pci_read_config32(dev, PCI_BASE_ADDRESS_0, &iobase); @@ -811,9 +811,9 @@ const struct eth_ops designware_eth_ops = { .write_hwaddr = designware_eth_write_hwaddr, }; -int designware_eth_ofdata_to_platdata(struct udevice *dev) +int designware_eth_of_to_plat(struct udevice *dev) { - struct dw_eth_pdata *dw_pdata = dev_get_platdata(dev); + struct dw_eth_pdata *dw_pdata = dev_get_plat(dev); #if CONFIG_IS_ENABLED(DM_GPIO) struct dw_eth_dev *priv = dev_get_priv(dev); #endif @@ -868,13 +868,13 @@ U_BOOT_DRIVER(eth_designware) = { .name = "eth_designware", .id = UCLASS_ETH, .of_match = designware_eth_ids, - .ofdata_to_platdata = designware_eth_ofdata_to_platdata, + .of_to_plat = designware_eth_of_to_plat, .bind = designware_eth_bind, .probe = designware_eth_probe, .remove = designware_eth_remove, .ops = &designware_eth_ops, - .priv_auto_alloc_size = sizeof(struct dw_eth_dev), - .platdata_auto_alloc_size = sizeof(struct dw_eth_pdata), + .priv_auto = sizeof(struct dw_eth_dev), + .plat_auto = sizeof(struct dw_eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/designware.h b/drivers/net/designware.h index ffaf5a1..a82afb9 100644 --- a/drivers/net/designware.h +++ b/drivers/net/designware.h @@ -251,7 +251,7 @@ struct dw_eth_dev { }; #ifdef CONFIG_DM_ETH -int designware_eth_ofdata_to_platdata(struct udevice *dev); +int designware_eth_of_to_plat(struct udevice *dev); int designware_eth_probe(struct udevice *dev); extern const struct eth_ops designware_eth_ops; diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index db11025..45a1648 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -1108,7 +1108,7 @@ static int eqos_adjust_link(struct udevice *dev) static int eqos_write_hwaddr(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct eqos_priv *eqos = dev_get_priv(dev); uint32_t val; @@ -1152,10 +1152,10 @@ static int eqos_write_hwaddr(struct udevice *dev) static int eqos_read_rom_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); #ifdef CONFIG_ARCH_IMX8M - imx_get_mac_from_fuse(dev->req_seq, pdata->enetaddr); + imx_get_mac_from_fuse(dev_seq(dev), pdata->enetaddr); #endif return !is_valid_ethaddr(pdata->enetaddr); } @@ -2193,6 +2193,6 @@ U_BOOT_DRIVER(eth_eqos) = { .probe = eqos_probe, .remove = eqos_remove, .ops = &eqos_ops, - .priv_auto_alloc_size = sizeof(struct eqos_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct eqos_priv), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/dwmac_s700.c b/drivers/net/dwmac_s700.c index 9d3f3ac..efe3d1d 100644 --- a/drivers/net/dwmac_s700.c +++ b/drivers/net/dwmac_s700.c @@ -44,9 +44,9 @@ static int dwmac_s700_probe(struct udevice *dev) return designware_eth_probe(dev); } -static int dwmac_s700_ofdata_to_platdata(struct udevice *dev) +static int dwmac_s700_of_to_plat(struct udevice *dev) { - return designware_eth_ofdata_to_platdata(dev); + return designware_eth_of_to_plat(dev); } static const struct udevice_id dwmac_s700_ids[] = { @@ -58,10 +58,10 @@ U_BOOT_DRIVER(dwmac_s700) = { .name = "dwmac_s700", .id = UCLASS_ETH, .of_match = dwmac_s700_ids, - .ofdata_to_platdata = dwmac_s700_ofdata_to_platdata, + .of_to_plat = dwmac_s700_of_to_plat, .probe = dwmac_s700_probe, .ops = &designware_eth_ops, - .priv_auto_alloc_size = sizeof(struct dw_eth_dev), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct dw_eth_dev), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/dwmac_socfpga.c b/drivers/net/dwmac_socfpga.c index e93561d..939f199 100644 --- a/drivers/net/dwmac_socfpga.c +++ b/drivers/net/dwmac_socfpga.c @@ -19,15 +19,15 @@ #include <asm/arch/system_manager.h> -struct dwmac_socfpga_platdata { +struct dwmac_socfpga_plat { struct dw_eth_pdata dw_eth_pdata; void *phy_intf; u32 reg_shift; }; -static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev) +static int dwmac_socfpga_of_to_plat(struct udevice *dev) { - struct dwmac_socfpga_platdata *pdata = dev_get_platdata(dev); + struct dwmac_socfpga_plat *pdata = dev_get_plat(dev); struct regmap *regmap; struct ofnode_phandle_args args; void *range; @@ -61,12 +61,12 @@ static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev) pdata->phy_intf = range + args.args[0]; pdata->reg_shift = args.args[1]; - return designware_eth_ofdata_to_platdata(dev); + return designware_eth_of_to_plat(dev); } static int dwmac_socfpga_probe(struct udevice *dev) { - struct dwmac_socfpga_platdata *pdata = dev_get_platdata(dev); + struct dwmac_socfpga_plat *pdata = dev_get_plat(dev); struct eth_pdata *edata = &pdata->dw_eth_pdata.eth_pdata; struct reset_ctl_bulk reset_bulk; int ret; @@ -115,10 +115,10 @@ U_BOOT_DRIVER(dwmac_socfpga) = { .name = "dwmac_socfpga", .id = UCLASS_ETH, .of_match = dwmac_socfpga_ids, - .ofdata_to_platdata = dwmac_socfpga_ofdata_to_platdata, + .of_to_plat = dwmac_socfpga_of_to_plat, .probe = dwmac_socfpga_probe, .ops = &designware_eth_ops, - .priv_auto_alloc_size = sizeof(struct dw_eth_dev), - .platdata_auto_alloc_size = sizeof(struct dwmac_socfpga_platdata), + .priv_auto = sizeof(struct dw_eth_dev), + .plat_auto = sizeof(struct dwmac_socfpga_plat), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 8e6c755..3b3dd10 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -5795,7 +5795,7 @@ static int do_e1000(struct cmd_tbl *cmdtp, int flag, int argc, e1000_name(name, cardnum); ret = uclass_get_device_by_name(UCLASS_ETH, name, &dev); if (!ret) { - plat = dev_get_platdata(dev); + plat = dev_get_plat(dev); mac = plat->enetaddr; } #else @@ -5844,7 +5844,7 @@ U_BOOT_CMD( #ifdef CONFIG_DM_ETH static int e1000_eth_start(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct e1000_hw *hw = dev_get_priv(dev); return _e1000_init(hw, plat->enetaddr); @@ -5890,7 +5890,7 @@ static int e1000_free_pkt(struct udevice *dev, uchar *packet, int length) static int e1000_eth_probe(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct e1000_hw *hw = dev_get_priv(dev); int ret; @@ -5940,8 +5940,8 @@ U_BOOT_DRIVER(eth_e1000) = { .bind = e1000_eth_bind, .probe = e1000_eth_probe, .ops = &e1000_eth_ops, - .priv_auto_alloc_size = sizeof(struct e1000_hw), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct e1000_hw), + .plat_auto = sizeof(struct eth_pdata), }; U_BOOT_PCI_DEVICE(eth_e1000, e1000_supported); diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index feba532..934b881 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -900,7 +900,7 @@ int eepro100_initialize(struct bd_info *bis) #else /* DM_ETH */ static int eepro100_start(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct eepro100_priv *priv = dev_get_priv(dev); memcpy(priv->enetaddr, plat->enetaddr, sizeof(plat->enetaddr)); @@ -962,7 +962,7 @@ static int eepro100_bind(struct udevice *dev) static int eepro100_probe(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct eepro100_priv *priv = dev_get_priv(dev); u16 command, status; u32 iobase; @@ -1009,8 +1009,8 @@ U_BOOT_DRIVER(eth_eepro100) = { .bind = eepro100_bind, .probe = eepro100_probe, .ops = &eepro100_ops, - .priv_auto_alloc_size = sizeof(struct eepro100_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct eepro100_priv), + .plat_auto = sizeof(struct eth_pdata), }; U_BOOT_PCI_DEVICE(eth_eepro100, supported); diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c index b383f45..07aebd9 100644 --- a/drivers/net/eth-phy-uclass.c +++ b/drivers/net/eth-phy-uclass.c @@ -54,7 +54,7 @@ int eth_phy_set_mdio_bus(struct udevice *eth_dev, struct mii_dev *mdio_bus) for (uclass_first_device(UCLASS_ETH_PHY, &dev); dev; uclass_next_device(&dev)) { if (dev->parent == eth_dev) { - uc_priv = (struct eth_phy_device_priv *)(dev->uclass_priv); + uc_priv = (struct eth_phy_device_priv *)(dev_get_uclass_priv(dev)); if (!uc_priv->mdio_bus) uc_priv->mdio_bus = mdio_bus; @@ -79,7 +79,7 @@ struct mii_dev *eth_phy_get_mdio_bus(struct udevice *eth_dev) * phy_dev is shared and controlled by * other eth controller */ - uc_priv = (struct eth_phy_device_priv *)(phy_dev->uclass_priv); + uc_priv = (struct eth_phy_device_priv *)(dev_get_uclass_priv(phy_dev)); if (uc_priv->mdio_bus) printf("Get shared mii bus on %s\n", eth_dev->name); else @@ -113,7 +113,7 @@ int eth_phy_get_addr(struct udevice *dev) UCLASS_DRIVER(eth_phy_generic) = { .id = UCLASS_ETH_PHY, .name = "eth_phy_generic", - .per_device_auto_alloc_size = sizeof(struct eth_phy_device_priv), + .per_device_auto = sizeof(struct eth_phy_device_priv), }; U_BOOT_DRIVER(eth_phy_generic_drv) = { diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index b9d80a5..7f146d4 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c @@ -647,7 +647,7 @@ static inline int ethoc_phy_init(struct ethoc *priv, void *dev) static int ethoc_write_hwaddr(struct udevice *dev) { - struct ethoc_eth_pdata *pdata = dev_get_platdata(dev); + struct ethoc_eth_pdata *pdata = dev_get_plat(dev); struct ethoc *priv = dev_get_priv(dev); u8 *mac = pdata->eth_pdata.enetaddr; @@ -685,9 +685,9 @@ static void ethoc_stop(struct udevice *dev) ethoc_stop_common(dev_get_priv(dev)); } -static int ethoc_ofdata_to_platdata(struct udevice *dev) +static int ethoc_of_to_plat(struct udevice *dev) { - struct ethoc_eth_pdata *pdata = dev_get_platdata(dev); + struct ethoc_eth_pdata *pdata = dev_get_plat(dev); fdt_addr_t addr; pdata->eth_pdata.iobase = dev_read_addr(dev); @@ -699,7 +699,7 @@ static int ethoc_ofdata_to_platdata(struct udevice *dev) static int ethoc_probe(struct udevice *dev) { - struct ethoc_eth_pdata *pdata = dev_get_platdata(dev); + struct ethoc_eth_pdata *pdata = dev_get_plat(dev); struct ethoc *priv = dev_get_priv(dev); priv->iobase = ioremap(pdata->eth_pdata.iobase, ETHOC_IOSIZE); @@ -746,12 +746,12 @@ U_BOOT_DRIVER(ethoc) = { .name = "ethoc", .id = UCLASS_ETH, .of_match = ethoc_ids, - .ofdata_to_platdata = ethoc_ofdata_to_platdata, + .of_to_plat = ethoc_of_to_plat, .probe = ethoc_probe, .remove = ethoc_remove, .ops = ðoc_ops, - .priv_auto_alloc_size = sizeof(struct ethoc), - .platdata_auto_alloc_size = sizeof(struct ethoc_eth_pdata), + .priv_auto = sizeof(struct ethoc), + .plat_auto = sizeof(struct ethoc_eth_pdata), }; #else diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index bb55be9..e3b29a9 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -415,7 +415,7 @@ static int fec_set_hwaddr(struct eth_device *dev) { #ifdef CONFIG_DM_ETH struct fec_priv *fec = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); uchar *mac = pdata->enetaddr; #else uchar *mac = dev->enetaddr; @@ -1272,7 +1272,7 @@ int fecmxc_register_mii_postcall(struct eth_device *dev, int (*cb)(int)) static int fecmxc_read_rom_hwaddr(struct udevice *dev) { struct fec_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); return fec_get_hwaddr(priv->dev_id, pdata->enetaddr); } @@ -1351,7 +1351,7 @@ static void fec_gpio_reset(struct fec_priv *priv) static int fecmxc_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct fec_priv *priv = dev_get_priv(dev); struct mii_dev *bus = NULL; uint32_t start; @@ -1451,7 +1451,7 @@ static int fecmxc_probe(struct udevice *dev) fec_reg_setup(priv); - priv->dev_id = dev->seq; + priv->dev_id = dev_seq(dev); #ifdef CONFIG_DM_ETH_PHY bus = eth_phy_get_mdio_bus(dev); @@ -1459,9 +1459,10 @@ static int fecmxc_probe(struct udevice *dev) if (!bus) { #ifdef CONFIG_FEC_MXC_MDIO_BASE - bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq); + bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, + dev_seq(dev)); #else - bus = fec_get_miibus((ulong)priv->eth, dev->seq); + bus = fec_get_miibus((ulong)priv->eth, dev_seq(dev)); #endif } if (!bus) { @@ -1527,10 +1528,10 @@ static int fecmxc_remove(struct udevice *dev) return 0; } -static int fecmxc_ofdata_to_platdata(struct udevice *dev) +static int fecmxc_of_to_plat(struct udevice *dev) { int ret = 0; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct fec_priv *priv = dev_get_priv(dev); const char *phy_mode; @@ -1593,11 +1594,11 @@ U_BOOT_DRIVER(fecmxc_gem) = { .name = "fecmxc", .id = UCLASS_ETH, .of_match = fecmxc_ids, - .ofdata_to_platdata = fecmxc_ofdata_to_platdata, + .of_to_plat = fecmxc_of_to_plat, .probe = fecmxc_probe, .remove = fecmxc_remove, .ops = &fecmxc_ops, - .priv_auto_alloc_size = sizeof(struct fec_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct fec_priv), + .plat_auto = sizeof(struct eth_pdata), }; #endif diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c index 2f433ce..0e89e66 100644 --- a/drivers/net/fm/eth.c +++ b/drivers/net/fm/eth.c @@ -472,7 +472,7 @@ static int fm_eth_open(struct udevice *dev) #ifndef CONFIG_DM_ETH struct fm_eth *fm_eth = dev->priv; #else - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct fm_eth *fm_eth = dev_get_priv(dev); #endif unsigned char *enetaddr; @@ -547,7 +547,11 @@ static void fm_eth_halt(struct udevice *dev) struct fm_eth *fm_eth; struct fsl_enet_mac *mac; +#ifndef CONFIG_DM_ETH fm_eth = (struct fm_eth *)dev->priv; +#else + fm_eth = dev_get_priv(dev); +#endif mac = fm_eth->mac; /* graceful stop the transmission of frames */ @@ -577,7 +581,11 @@ static int fm_eth_send(struct udevice *dev, void *buf, int len) u16 offset_in; int i; +#ifndef CONFIG_DM_ETH fm_eth = (struct fm_eth *)dev->priv; +#else + fm_eth = dev_get_priv(dev); +#endif pram = fm_eth->tx_pram; txbd = fm_eth->cur_txbd; @@ -664,13 +672,19 @@ static int fm_eth_recv(struct eth_device *dev) static int fm_eth_recv(struct udevice *dev, int flags, uchar **packetp) #endif { - struct fm_eth *fm_eth = (struct fm_eth *)dev->priv; - struct fm_port_bd *rxbd = fm_eth->cur_rxbd; + struct fm_eth *fm_eth; + struct fm_port_bd *rxbd; u32 buf_lo, buf_hi; u16 status, len; int ret = -1; u8 *data; +#ifndef CONFIG_DM_ETH + fm_eth = (struct fm_eth *)dev->priv; +#else + fm_eth = dev_get_priv(dev); +#endif + rxbd = fm_eth->cur_rxbd; status = muram_readw(&rxbd->status); while (!(status & RxBD_EMPTY)) { @@ -704,7 +718,7 @@ static int fm_eth_recv(struct udevice *dev, int flags, uchar **packetp) #ifdef CONFIG_DM_ETH static int fm_eth_free_pkt(struct udevice *dev, uchar *packet, int length) { - struct fm_eth *fm_eth = (struct fm_eth *)dev->priv; + struct fm_eth *fm_eth = (struct fm_eth *)dev_get_priv(dev); fm_eth->cur_rxbd = fm_eth_free_one(fm_eth, fm_eth->cur_rxbd); @@ -943,7 +957,7 @@ phy_interface_t fman_read_sys_if(struct udevice *dev) { const char *if_str; - if_str = ofnode_read_string(dev->node, "phy-connection-type"); + if_str = ofnode_read_string(dev_ofnode(dev), "phy-connection-type"); debug("MAC system interface mode %s\n", if_str); return phy_get_interface_by_name(if_str); @@ -955,7 +969,7 @@ static int fm_eth_bind(struct udevice *dev) char mac_name[11]; u32 fm, num; - if (ofnode_read_u32(ofnode_get_parent(dev->node), "cell-index", &fm)) { + if (ofnode_read_u32(ofnode_get_parent(dev_ofnode(dev)), "cell-index", &fm)) { printf("FMan node property cell-index missing\n"); return -EINVAL; } @@ -1004,7 +1018,7 @@ static struct udevice *fm_get_internal_mdio(struct udevice *dev) static int fm_eth_probe(struct udevice *dev) { - struct fm_eth *fm_eth = (struct fm_eth *)dev->priv; + struct fm_eth *fm_eth = (struct fm_eth *)dev_get_priv(dev); struct ofnode_phandle_args args; void *reg; int ret, index; @@ -1130,8 +1144,8 @@ U_BOOT_DRIVER(eth_fman) = { .probe = fm_eth_probe, .remove = fm_eth_remove, .ops = &fm_eth_ops, - .priv_auto_alloc_size = sizeof(struct fm_eth), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct fm_eth), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif /* CONFIG_DM_ETH */ diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c index bbb1738..7d51be1 100644 --- a/drivers/net/fm/fm.c +++ b/drivers/net/fm/fm.c @@ -605,7 +605,7 @@ U_BOOT_DRIVER(fman) = { .of_match = fman_ids, .probe = fman_probe, .remove = fman_remove, - .priv_auto_alloc_size = sizeof(struct fman_priv), + .priv_auto = sizeof(struct fman_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif /* CONFIG_DM_ETH */ diff --git a/drivers/net/fm/memac_phy.c b/drivers/net/fm/memac_phy.c index e15c28d..8bd32b0 100644 --- a/drivers/net/fm/memac_phy.c +++ b/drivers/net/fm/memac_phy.c @@ -297,8 +297,8 @@ U_BOOT_DRIVER(fman_mdio) = { .probe = fm_mdio_probe, .remove = fm_mdio_remove, .ops = &fm_mdio_ops, - .priv_auto_alloc_size = sizeof(struct fm_mdio_priv), - .platdata_auto_alloc_size = sizeof(struct mdio_perdev_priv), + .priv_auto = sizeof(struct fm_mdio_priv), + .plat_auto = sizeof(struct mdio_perdev_priv), }; #endif /* CONFIG_PHYLIB && CONFIG_DM_MDIO */ #endif /* CONFIG_DM_ETH */ diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index 84db6be..5bfe378 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -185,9 +185,9 @@ static int mc_fixup_mac_addr(void *blob, int nodeoffset, enum mc_fixup_type type) { #ifdef CONFIG_DM_ETH - struct eth_pdata *plat = dev_get_platdata(eth_dev); + struct eth_pdata *plat = dev_get_plat(eth_dev); unsigned char *enetaddr = plat->enetaddr; - int eth_index = eth_dev->seq; + int eth_index = dev_seq(eth_dev); #else unsigned char *enetaddr = eth_dev->enetaddr; int eth_index = eth_dev->index; diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c index 2929ae7..f6fc780 100644 --- a/drivers/net/fsl_enetc.c +++ b/drivers/net/fsl_enetc.c @@ -54,7 +54,7 @@ static int ierb_fn_to_pf[] = {0, 1, 2, -1, -1, -1, 3}; /* sets up primary MAC addresses in DT/IERB */ void fdt_fixup_enetc_mac(void *blob) { - struct pci_child_platdata *ppdata; + struct pci_child_plat *ppdata; struct eth_pdata *pdata; struct udevice *dev; struct uclass *uc; @@ -68,8 +68,8 @@ void fdt_fixup_enetc_mac(void *blob) strcmp(dev->driver->name, ENETC_DRIVER_NAME)) continue; - pdata = dev_get_platdata(dev); - ppdata = dev_get_parent_platdata(dev); + pdata = dev_get_plat(dev); + ppdata = dev_get_parent_plat(dev); devfn = PCI_FUNC(ppdata->devfn); enetc_set_ierb_primary_mac(dev, devfn, pdata->enetaddr); @@ -99,7 +99,7 @@ static int enetc_bind(struct udevice *dev) * and some are not, use different naming scheme - enetc-N based on * PCI function # and enetc#N based on interface count */ - if (ofnode_valid(dev->node)) + if (ofnode_valid(dev_ofnode(dev))) sprintf(name, "enetc-%u", PCI_FUNC(pci_get_devfn(dev))); else sprintf(name, "enetc#%u", eth_num_devices++); @@ -253,12 +253,12 @@ static void enetc_start_pcs(struct udevice *dev) mdio_register(&priv->imdio); } - if (!ofnode_valid(dev->node)) { + if (!ofnode_valid(dev_ofnode(dev))) { enetc_dbg(dev, "no enetc ofnode found, skipping PCS set-up\n"); return; } - if_str = ofnode_read_string(dev->node, "phy-mode"); + if_str = ofnode_read_string(dev_ofnode(dev), "phy-mode"); if (if_str) priv->if_type = phy_get_interface_by_name(if_str); else @@ -306,7 +306,7 @@ static int enetc_probe(struct udevice *dev) { struct enetc_priv *priv = dev_get_priv(dev); - if (ofnode_valid(dev->node) && !ofnode_is_available(dev->node)) { + if (ofnode_valid(dev_ofnode(dev)) && !ofnode_is_available(dev_ofnode(dev))) { enetc_dbg(dev, "interface disabled\n"); return -ENODEV; } @@ -365,9 +365,9 @@ static int enetc_remove(struct udevice *dev) static int enetc_ls1028a_write_hwaddr(struct udevice *dev) { - struct pci_child_platdata *ppdata = dev_get_parent_platdata(dev); + struct pci_child_plat *ppdata = dev_get_parent_plat(dev); const int devfn_to_pf[] = {0, 1, 2, -1, -1, -1, 3}; - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); int devfn = PCI_FUNC(ppdata->devfn); u8 *addr = plat->enetaddr; u32 lower, upper; @@ -391,7 +391,7 @@ static int enetc_ls1028a_write_hwaddr(struct udevice *dev) static int enetc_write_hwaddr(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct enetc_priv *priv = dev_get_priv(dev); u8 *addr = plat->enetaddr; @@ -677,8 +677,8 @@ U_BOOT_DRIVER(eth_enetc) = { .probe = enetc_probe, .remove = enetc_remove, .ops = &enetc_ops, - .priv_auto_alloc_size = sizeof(struct enetc_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct enetc_priv), + .plat_auto = sizeof(struct eth_pdata), }; static struct pci_device_id enetc_ids[] = { diff --git a/drivers/net/fsl_enetc_mdio.c b/drivers/net/fsl_enetc_mdio.c index 47257a6..3eb6ac9 100644 --- a/drivers/net/fsl_enetc_mdio.c +++ b/drivers/net/fsl_enetc_mdio.c @@ -112,7 +112,7 @@ static int enetc_mdio_bind(struct udevice *dev) * and some are not, use different naming scheme - enetc-N based on * PCI function # and enetc#N based on interface count */ - if (ofnode_valid(dev->node)) + if (ofnode_valid(dev_ofnode(dev))) sprintf(name, "emdio-%u", PCI_FUNC(pci_get_devfn(dev))); else sprintf(name, "emdio#%u", eth_num_devices++); @@ -144,7 +144,7 @@ U_BOOT_DRIVER(enetc_mdio) = { .bind = enetc_mdio_bind, .probe = enetc_mdio_probe, .ops = &enetc_mdio_ops, - .priv_auto_alloc_size = sizeof(struct enetc_mdio_priv), + .priv_auto = sizeof(struct enetc_mdio_priv), }; static struct pci_device_id enetc_mdio_ids[] = { diff --git a/drivers/net/fsl_ls_mdio.c b/drivers/net/fsl_ls_mdio.c index 6d8332d..6d4e682 100644 --- a/drivers/net/fsl_ls_mdio.c +++ b/drivers/net/fsl_ls_mdio.c @@ -142,5 +142,5 @@ U_BOOT_DRIVER(fsl_ls_mdio) = { .of_match = fsl_ls_mdio_of_ids, .probe = fsl_ls_mdio_probe, .ops = &fsl_ls_mdio_ops, - .priv_auto_alloc_size = sizeof(struct fsl_ls_mdio_priv), + .priv_auto = sizeof(struct fsl_ls_mdio_priv), }; diff --git a/drivers/net/fsl_mcdmafec.c b/drivers/net/fsl_mcdmafec.c index e27f7e5..c36d40c 100644 --- a/drivers/net/fsl_mcdmafec.c +++ b/drivers/net/fsl_mcdmafec.c @@ -79,7 +79,7 @@ static void init_eth_info(struct fec_info_dma *info) static void fec_halt(struct udevice *dev) { - struct fec_info_dma *info = dev->priv; + struct fec_info_dma *info = dev_get_priv(dev); volatile fecdma_t *fecp = (fecdma_t *)info->iobase; int counter = 0xffff; @@ -230,7 +230,7 @@ static void fec_set_hwaddr(volatile fecdma_t *fecp, u8 *mac) static int fec_init(struct udevice *dev) { - struct fec_info_dma *info = dev->priv; + struct fec_info_dma *info = dev_get_priv(dev); volatile fecdma_t *fecp = (fecdma_t *)info->iobase; int rval, i; uchar enetaddr[6]; @@ -352,7 +352,7 @@ static int mcdmafec_init(struct udevice *dev) static int mcdmafec_send(struct udevice *dev, void *packet, int length) { - struct fec_info_dma *info = dev->priv; + struct fec_info_dma *info = dev_get_priv(dev); cbd_t *p_tbd, *p_used_tbd; u16 phy_status; @@ -412,7 +412,7 @@ static int mcdmafec_send(struct udevice *dev, void *packet, int length) static int mcdmafec_recv(struct udevice *dev, int flags, uchar **packetp) { - struct fec_info_dma *info = dev->priv; + struct fec_info_dma *info = dev_get_priv(dev); volatile fecdma_t *fecp = (fecdma_t *)info->iobase; cbd_t *prbd = &info->rxbd[info->rx_idx]; @@ -491,18 +491,18 @@ static const struct eth_ops mcdmafec_ops = { }; /* - * Boot sequence, called just after mcffec_ofdata_to_platdata, + * Boot sequence, called just after mcffec_of_to_plat, * as DM way, it replaces old mcffec_initialize. */ static int mcdmafec_probe(struct udevice *dev) { - struct fec_info_dma *info = dev->priv; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct fec_info_dma *info = dev_get_priv(dev); + struct eth_pdata *pdata = dev_get_plat(dev); int node = dev_of_offset(dev); int retval; const u32 *val; - info->index = dev->seq; + info->index = dev_seq(dev); info->iobase = pdata->iobase; info->miibase = pdata->iobase; info->phy_addr = -1; @@ -565,9 +565,9 @@ static int mcdmafec_remove(struct udevice *dev) /* * Boot sequence, called 1st */ -static int mcdmafec_ofdata_to_platdata(struct udevice *dev) +static int mcdmafec_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const u32 *val; pdata->iobase = dev_read_addr(dev); @@ -590,10 +590,10 @@ U_BOOT_DRIVER(mcffec) = { .name = "mcdmafec", .id = UCLASS_ETH, .of_match = mcdmafec_ids, - .ofdata_to_platdata = mcdmafec_ofdata_to_platdata, + .of_to_plat = mcdmafec_of_to_plat, .probe = mcdmafec_probe, .remove = mcdmafec_remove, .ops = &mcdmafec_ops, - .priv_auto_alloc_size = sizeof(struct fec_info_dma), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct fec_info_dma), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c index 77f1a96..5fd11db 100644 --- a/drivers/net/fsl_mdio.c +++ b/drivers/net/fsl_mdio.c @@ -248,8 +248,8 @@ U_BOOT_DRIVER(tsec_mdio) = { .probe = tsec_mdio_probe, .remove = tsec_mdio_remove, .ops = &tsec_mdio_ops, - .priv_auto_alloc_size = sizeof(struct tsec_mdio_priv), - .platdata_auto_alloc_size = sizeof(struct mdio_perdev_priv), + .priv_auto = sizeof(struct tsec_mdio_priv), + .plat_auto = sizeof(struct mdio_perdev_priv), }; #endif /* CONFIG_PHYLIB */ #endif /* CONFIG_DM_MDIO */ diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c index 00bda24..69e299d 100644 --- a/drivers/net/ftgmac100.c +++ b/drivers/net/ftgmac100.c @@ -171,7 +171,7 @@ static int ftgmac100_mdio_init(struct udevice *dev) bus->write = ftgmac100_mdio_write; bus->priv = priv; - ret = mdio_register_seq(bus, dev->seq); + ret = mdio_register_seq(bus, dev_seq(dev)); if (ret) { free(bus); return ret; @@ -287,7 +287,7 @@ static void ftgmac100_stop(struct udevice *dev) static int ftgmac100_start(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct ftgmac100_data *priv = dev_get_priv(dev); struct ftgmac100 *ftgmac100 = priv->iobase; struct phy_device *phydev = priv->phydev; @@ -505,15 +505,15 @@ static int ftgmac100_send(struct udevice *dev, void *packet, int length) static int ftgmac100_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct ftgmac100_data *priv = dev_get_priv(dev); return ftgmac100_set_mac(priv, pdata->enetaddr); } -static int ftgmac100_ofdata_to_platdata(struct udevice *dev) +static int ftgmac100_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct ftgmac100_data *priv = dev_get_priv(dev); const char *phy_mode; @@ -542,7 +542,7 @@ static int ftgmac100_ofdata_to_platdata(struct udevice *dev) static int ftgmac100_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct ftgmac100_data *priv = dev_get_priv(dev); int ret; @@ -609,11 +609,11 @@ U_BOOT_DRIVER(ftgmac100) = { .name = "ftgmac100", .id = UCLASS_ETH, .of_match = ftgmac100_ids, - .ofdata_to_platdata = ftgmac100_ofdata_to_platdata, + .of_to_plat = ftgmac100_of_to_plat, .probe = ftgmac100_probe, .remove = ftgmac100_remove, .ops = &ftgmac100_ops, - .priv_auto_alloc_size = sizeof(struct ftgmac100_data), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ftgmac100_data), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index 292690d..0d67237 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -318,7 +318,7 @@ out: #ifdef CONFIG_DM_ETH static int ftmac100_start(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct ftmac100_data *priv = dev_get_priv(dev); return _ftmac100_init(priv, plat->enetaddr); @@ -360,7 +360,7 @@ static int ftmac100_free_pkt(struct udevice *dev, uchar *packet, int length) int ftmac100_read_rom_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); eth_env_get_enetaddr("ethaddr", pdata->enetaddr); return 0; } @@ -393,10 +393,10 @@ static const char *dtbmacaddr(u32 ifno) return NULL; } -static int ftmac100_ofdata_to_platdata(struct udevice *dev) +static int ftmac100_of_to_plat(struct udevice *dev) { struct ftmac100_data *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const char *mac; pdata->iobase = dev_read_addr(dev); priv->iobase = pdata->iobase; @@ -437,11 +437,11 @@ U_BOOT_DRIVER(ftmac100) = { .id = UCLASS_ETH, .of_match = ftmac100_ids, .bind = ftmac100_bind, - .ofdata_to_platdata = ftmac100_ofdata_to_platdata, + .of_to_plat = ftmac100_of_to_plat, .probe = ftmac100_probe, .ops = &ftmac100_ops, - .priv_auto_alloc_size = sizeof(struct ftmac100_data), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ftmac100_data), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c index 8d95ee1..a50a5b3 100644 --- a/drivers/net/gmac_rockchip.c +++ b/drivers/net/gmac_rockchip.c @@ -39,7 +39,7 @@ DECLARE_GLOBAL_DATA_PTR; * * dw_eth_pdata: Required platform data for designware driver (must be first) */ -struct gmac_rockchip_platdata { +struct gmac_rockchip_plat { struct dw_eth_pdata dw_eth_pdata; bool clock_input; int tx_delay; @@ -48,14 +48,14 @@ struct gmac_rockchip_platdata { struct rk_gmac_ops { int (*fix_mac_speed)(struct dw_eth_dev *priv); - void (*set_to_rmii)(struct gmac_rockchip_platdata *pdata); - void (*set_to_rgmii)(struct gmac_rockchip_platdata *pdata); + void (*set_to_rmii)(struct gmac_rockchip_plat *pdata); + void (*set_to_rgmii)(struct gmac_rockchip_plat *pdata); }; -static int gmac_rockchip_ofdata_to_platdata(struct udevice *dev) +static int gmac_rockchip_of_to_plat(struct udevice *dev) { - struct gmac_rockchip_platdata *pdata = dev_get_platdata(dev); + struct gmac_rockchip_plat *pdata = dev_get_plat(dev); const char *string; string = dev_read_string(dev, "clock_in_out"); @@ -74,7 +74,7 @@ static int gmac_rockchip_ofdata_to_platdata(struct udevice *dev) if (pdata->rx_delay == -ENOENT) pdata->rx_delay = dev_read_u32_default(dev, "rx-delay", 0x10); - return designware_eth_ofdata_to_platdata(dev); + return designware_eth_of_to_plat(dev); } static int px30_gmac_fix_mac_speed(struct dw_eth_dev *priv) @@ -344,7 +344,7 @@ static int rv1108_set_rmii_speed(struct dw_eth_dev *priv) return 0; } -static void px30_gmac_set_to_rmii(struct gmac_rockchip_platdata *pdata) +static void px30_gmac_set_to_rmii(struct gmac_rockchip_plat *pdata) { struct px30_grf *grf; enum { @@ -360,7 +360,7 @@ static void px30_gmac_set_to_rmii(struct gmac_rockchip_platdata *pdata) PX30_GMAC_PHY_INTF_SEL_RMII); } -static void rk3228_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) +static void rk3228_gmac_set_to_rgmii(struct gmac_rockchip_plat *pdata) { struct rk322x_grf *grf; enum { @@ -403,7 +403,7 @@ static void rk3228_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) pdata->tx_delay << RK3228_CLK_TX_DL_CFG_GMAC_SHIFT); } -static void rk3288_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) +static void rk3288_gmac_set_to_rgmii(struct gmac_rockchip_plat *pdata) { struct rk3288_grf *grf; @@ -422,7 +422,7 @@ static void rk3288_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) pdata->tx_delay << RK3288_CLK_TX_DL_CFG_GMAC_SHIFT); } -static void rk3308_gmac_set_to_rmii(struct gmac_rockchip_platdata *pdata) +static void rk3308_gmac_set_to_rmii(struct gmac_rockchip_plat *pdata) { struct rk3308_grf *grf; enum { @@ -438,7 +438,7 @@ static void rk3308_gmac_set_to_rmii(struct gmac_rockchip_platdata *pdata) RK3308_GMAC_PHY_INTF_SEL_RMII); } -static void rk3328_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) +static void rk3328_gmac_set_to_rgmii(struct gmac_rockchip_plat *pdata) { struct rk3328_grf_regs *grf; enum { @@ -481,7 +481,7 @@ static void rk3328_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) pdata->tx_delay << RK3328_CLK_TX_DL_CFG_GMAC_SHIFT); } -static void rk3368_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) +static void rk3368_gmac_set_to_rgmii(struct gmac_rockchip_plat *pdata) { struct rk3368_grf *grf; enum { @@ -518,7 +518,7 @@ static void rk3368_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) pdata->tx_delay << RK3368_CLK_TX_DL_CFG_GMAC_SHIFT); } -static void rk3399_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) +static void rk3399_gmac_set_to_rgmii(struct gmac_rockchip_plat *pdata) { struct rk3399_grf_regs *grf; @@ -538,7 +538,7 @@ static void rk3399_gmac_set_to_rgmii(struct gmac_rockchip_platdata *pdata) pdata->tx_delay << RK3399_CLK_TX_DL_CFG_GMAC_SHIFT); } -static void rv1108_gmac_set_to_rmii(struct gmac_rockchip_platdata *pdata) +static void rv1108_gmac_set_to_rmii(struct gmac_rockchip_plat *pdata) { struct rv1108_grf *grf; @@ -555,10 +555,10 @@ static void rv1108_gmac_set_to_rmii(struct gmac_rockchip_platdata *pdata) static int gmac_rockchip_probe(struct udevice *dev) { - struct gmac_rockchip_platdata *pdata = dev_get_platdata(dev); + struct gmac_rockchip_plat *pdata = dev_get_plat(dev); struct rk_gmac_ops *ops = (struct rk_gmac_ops *)dev_get_driver_data(dev); - struct dw_eth_pdata *dw_pdata = dev_get_platdata(dev); + struct dw_eth_pdata *dw_pdata = dev_get_plat(dev); struct eth_pdata *eth_pdata = &dw_pdata->eth_pdata; struct clk clk; ulong rate; @@ -664,7 +664,7 @@ static int gmac_rockchip_probe(struct udevice *dev) static int gmac_rockchip_eth_start(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct dw_eth_dev *priv = dev_get_priv(dev); struct rk_gmac_ops *ops = (struct rk_gmac_ops *)dev_get_driver_data(dev); @@ -756,10 +756,10 @@ U_BOOT_DRIVER(eth_gmac_rockchip) = { .name = "gmac_rockchip", .id = UCLASS_ETH, .of_match = rockchip_gmac_ids, - .ofdata_to_platdata = gmac_rockchip_ofdata_to_platdata, + .of_to_plat = gmac_rockchip_of_to_plat, .probe = gmac_rockchip_probe, .ops = &gmac_rockchip_eth_ops, - .priv_auto_alloc_size = sizeof(struct dw_eth_dev), - .platdata_auto_alloc_size = sizeof(struct gmac_rockchip_platdata), + .priv_auto = sizeof(struct dw_eth_dev), + .plat_auto = sizeof(struct gmac_rockchip_plat), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/higmacv300.c b/drivers/net/higmacv300.c index 2aae7f4..aa79d6e 100644 --- a/drivers/net/higmacv300.c +++ b/drivers/net/higmacv300.c @@ -128,7 +128,7 @@ struct higmac_priv { static int higmac_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct higmac_priv *priv = dev_get_priv(dev); unsigned char *mac = pdata->enetaddr; u32 val; @@ -528,7 +528,7 @@ static int higmac_probe(struct udevice *dev) bus->priv = priv; priv->bus = bus; - ret = mdio_register_seq(bus, dev->seq); + ret = mdio_register_seq(bus, dev_seq(dev)); if (ret) return ret; @@ -558,7 +558,7 @@ static int higmac_remove(struct udevice *dev) return 0; } -static int higmac_ofdata_to_platdata(struct udevice *dev) +static int higmac_of_to_plat(struct udevice *dev) { struct higmac_priv *priv = dev_get_priv(dev); int phyintf = PHY_INTERFACE_MODE_NONE; @@ -594,10 +594,10 @@ U_BOOT_DRIVER(eth_higmac) = { .name = "eth_higmac", .id = UCLASS_ETH, .of_match = higmac_ids, - .ofdata_to_platdata = higmac_ofdata_to_platdata, + .of_to_plat = higmac_of_to_plat, .probe = higmac_probe, .remove = higmac_remove, .ops = &higmac_ops, - .priv_auto_alloc_size = sizeof(struct higmac_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct higmac_priv), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c index 58e065c..91c2d10 100644 --- a/drivers/net/ks8851_mll.c +++ b/drivers/net/ks8851_mll.c @@ -615,7 +615,7 @@ static int ks8851_recv(struct udevice *dev, int flags, uchar **packetp) static int ks8851_write_hwaddr(struct udevice *dev) { struct ks_net *ks = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); ks8851_mll_write_hwaddr_common(ks, pdata->enetaddr); @@ -625,7 +625,7 @@ static int ks8851_write_hwaddr(struct udevice *dev) static int ks8851_read_rom_hwaddr(struct udevice *dev) { struct ks_net *ks = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); u16 addrl, addrm, addrh; /* No EEPROM means no valid MAC address. */ @@ -665,10 +665,10 @@ static int ks8851_probe(struct udevice *dev) return 0; } -static int ks8851_ofdata_to_platdata(struct udevice *dev) +static int ks8851_of_to_plat(struct udevice *dev) { struct ks_net *ks = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); pdata->iobase = dev_read_addr(dev); ks->iobase = pdata->iobase; @@ -695,11 +695,11 @@ U_BOOT_DRIVER(ks8851) = { .id = UCLASS_ETH, .of_match = ks8851_ids, .bind = ks8851_bind, - .ofdata_to_platdata = ks8851_ofdata_to_platdata, + .of_to_plat = ks8851_of_to_plat, .probe = ks8851_probe, .ops = &ks8851_ops, - .priv_auto_alloc_size = sizeof(struct ks_net), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ks_net), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c index 42eaf49..ef013c9 100644 --- a/drivers/net/ldpaa_eth/ldpaa_eth.c +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c @@ -511,7 +511,7 @@ static int ldpaa_get_dpmac_state(struct ldpaa_eth_priv *priv, #ifdef CONFIG_DM_ETH static int ldpaa_eth_open(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct ldpaa_eth_priv *priv = dev_get_priv(dev); #else static int ldpaa_eth_open(struct eth_device *net_dev, struct bd_info *bd) @@ -1160,7 +1160,7 @@ static int ldpaa_eth_bind(struct udevice *dev) return 0; } -static int ldpaa_eth_ofdata_to_platdata(struct udevice *dev) +static int ldpaa_eth_of_to_plat(struct udevice *dev) { struct ldpaa_eth_priv *priv = dev_get_priv(dev); const char *phy_mode_str; @@ -1187,12 +1187,12 @@ U_BOOT_DRIVER(ldpaa_eth) = { .name = "ldpaa_eth", .id = UCLASS_ETH, .of_match = ldpaa_eth_of_ids, - .ofdata_to_platdata = ldpaa_eth_ofdata_to_platdata, + .of_to_plat = ldpaa_eth_of_to_plat, .bind = ldpaa_eth_bind, .probe = ldpaa_eth_probe, .ops = &ldpaa_eth_ops, - .priv_auto_alloc_size = sizeof(struct ldpaa_eth_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ldpaa_eth_priv), + .plat_auto = sizeof(struct eth_pdata), }; #else diff --git a/drivers/net/macb.c b/drivers/net/macb.c index b80a259..e287c29 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -1169,7 +1169,7 @@ static void macb_stop(struct udevice *dev) static int macb_write_hwaddr(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct macb_device *macb = dev_get_priv(dev); return _macb_write_hwaddr(macb, plat->enetaddr); @@ -1222,7 +1222,7 @@ static const struct macb_config default_gem_config = { static int macb_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct macb_device *macb = dev_get_priv(dev); const char *phy_mode; int ret; @@ -1283,25 +1283,25 @@ static int macb_eth_remove(struct udevice *dev) } /** - * macb_late_eth_ofdata_to_platdata + * macb_late_eth_of_to_plat * @dev: udevice struct * Returns 0 when operation success and negative errno number * when operation failed. */ -int __weak macb_late_eth_ofdata_to_platdata(struct udevice *dev) +int __weak macb_late_eth_of_to_plat(struct udevice *dev) { return 0; } -static int macb_eth_ofdata_to_platdata(struct udevice *dev) +static int macb_eth_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); pdata->iobase = (phys_addr_t)dev_remap_addr(dev); if (!pdata->iobase) return -EINVAL; - return macb_late_eth_ofdata_to_platdata(dev); + return macb_late_eth_of_to_plat(dev); } static const struct macb_config sama5d4_config = { @@ -1331,12 +1331,12 @@ U_BOOT_DRIVER(eth_macb) = { .name = "eth_macb", .id = UCLASS_ETH, .of_match = macb_eth_ids, - .ofdata_to_platdata = macb_eth_ofdata_to_platdata, + .of_to_plat = macb_eth_of_to_plat, .probe = macb_eth_probe, .remove = macb_eth_remove, .ops = &macb_eth_ops, - .priv_auto_alloc_size = sizeof(struct macb_device), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct macb_device), + .plat_auto = sizeof(struct eth_pdata), }; #endif diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c index f94a2d8..cb343b4 100644 --- a/drivers/net/mcffec.c +++ b/drivers/net/mcffec.c @@ -125,7 +125,7 @@ static void set_fec_duplex_speed(volatile fec_t *fecp, int dup_spd) #ifdef ET_DEBUG static void dbg_fec_regs(struct udevice *dev) { - struct fec_info_s *info = dev->priv; + struct fec_info_s *info = dev_get_priv(dev); volatile fec_t *fecp = (fec_t *)(info->iobase); printf("=====\n"); @@ -275,7 +275,7 @@ static void dbg_fec_regs(struct udevice *dev) int mcffec_init(struct udevice *dev) { - struct fec_info_s *info = dev->priv; + struct fec_info_s *info = dev_get_priv(dev); volatile fec_t *fecp = (fec_t *) (info->iobase); int rval, i; uchar ea[6]; @@ -374,7 +374,7 @@ int mcffec_init(struct udevice *dev) static int mcffec_send(struct udevice *dev, void *packet, int length) { - struct fec_info_s *info = dev->priv; + struct fec_info_s *info = dev_get_priv(dev); volatile fec_t *fecp = (fec_t *)info->iobase; int j, rc; u16 phy_status; @@ -440,7 +440,7 @@ static int mcffec_send(struct udevice *dev, void *packet, int length) static int mcffec_recv(struct udevice *dev, int flags, uchar **packetp) { - struct fec_info_s *info = dev->priv; + struct fec_info_s *info = dev_get_priv(dev); volatile fec_t *fecp = (fec_t *)info->iobase; int length = -1; @@ -492,7 +492,7 @@ static int mcffec_recv(struct udevice *dev, int flags, uchar **packetp) static void mcffec_halt(struct udevice *dev) { - struct fec_info_s *info = dev->priv; + struct fec_info_s *info = dev_get_priv(dev); fec_reset(info); fecpin_setclear(info, 0); @@ -513,18 +513,18 @@ static const struct eth_ops mcffec_ops = { }; /* - * Boot sequence, called just after mcffec_ofdata_to_platdata, + * Boot sequence, called just after mcffec_of_to_plat, * as DM way, it replaces old mcffec_initialize. */ static int mcffec_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); - struct fec_info_s *info = dev->priv; + struct eth_pdata *pdata = dev_get_plat(dev); + struct fec_info_s *info = dev_get_priv(dev); int node = dev_of_offset(dev); int retval, fec_idx; const u32 *val; - info->index = dev->seq; + info->index = dev_seq(dev); info->iobase = pdata->iobase; info->phy_addr = -1; @@ -584,9 +584,9 @@ static int mcffec_remove(struct udevice *dev) /* * Boot sequence, called 1st */ -static int mcffec_ofdata_to_platdata(struct udevice *dev) +static int mcffec_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const u32 *val; pdata->iobase = dev_read_addr(dev); @@ -610,10 +610,10 @@ U_BOOT_DRIVER(mcffec) = { .name = "mcffec", .id = UCLASS_ETH, .of_match = mcffec_ids, - .ofdata_to_platdata = mcffec_ofdata_to_platdata, + .of_to_plat = mcffec_of_to_plat, .probe = mcffec_probe, .remove = mcffec_remove, .ops = &mcffec_ops, - .priv_auto_alloc_size = sizeof(struct fec_info_s), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct fec_info_s), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c index 3936055..ec81320 100644 --- a/drivers/net/mcfmii.c +++ b/drivers/net/mcfmii.c @@ -100,7 +100,11 @@ uint mii_send(uint mii_cmd) /* retrieve from register structure */ dev = eth_get_dev(); +#ifdef CONFIG_DM_ETH + info = dev_get_priv(dev); +#else info = dev->priv; +#endif ep = (FEC_T *) info->miibase; @@ -216,7 +220,11 @@ void __mii_init(void) /* retrieve from register structure */ dev = eth_get_dev(); +#ifdef CONFIG_DM_ETH + info = dev_get_priv(dev); +#else info = dev->priv; +#endif fecp = (FEC_T *) info->miibase; diff --git a/drivers/net/mdio-ipq4019.c b/drivers/net/mdio-ipq4019.c index bc68e1d..50134b4 100644 --- a/drivers/net/mdio-ipq4019.c +++ b/drivers/net/mdio-ipq4019.c @@ -107,8 +107,8 @@ static const struct mdio_ops ipq4019_mdio_ops = { static int ipq4019_mdio_bind(struct udevice *dev) { - if (ofnode_valid(dev->node)) - device_set_name(dev, ofnode_get_name(dev->node)); + if (ofnode_valid(dev_ofnode(dev))) + device_set_name(dev, ofnode_get_name(dev_ofnode(dev))); return 0; } @@ -142,5 +142,5 @@ U_BOOT_DRIVER(ipq4019_mdio) = { .bind = ipq4019_mdio_bind, .probe = ipq4019_mdio_probe, .ops = &ipq4019_mdio_ops, - .priv_auto_alloc_size = sizeof(struct ipq4019_mdio_priv), + .priv_auto = sizeof(struct ipq4019_mdio_priv), }; diff --git a/drivers/net/mdio_mux_i2creg.c b/drivers/net/mdio_mux_i2creg.c index cc02b5f..3654230 100644 --- a/drivers/net/mdio_mux_i2creg.c +++ b/drivers/net/mdio_mux_i2creg.c @@ -61,7 +61,7 @@ static int mdio_mux_i2creg_probe(struct udevice *dev) } /* parent should be an I2C chip, grandparent should be an I2C bus */ - chip_node = ofnode_get_parent(dev->node); + chip_node = ofnode_get_parent(dev_ofnode(dev)); bus_node = ofnode_get_parent(chip_node); err = uclass_get_device_by_ofnode(UCLASS_I2C, bus_node, &i2c_bus); @@ -105,5 +105,5 @@ U_BOOT_DRIVER(mdio_mux_i2creg) = { .of_match = mdio_mux_i2creg_ids, .probe = mdio_mux_i2creg_probe, .ops = &mdio_mux_i2creg_ops, - .priv_auto_alloc_size = sizeof(struct mdio_mux_i2creg_priv), + .priv_auto = sizeof(struct mdio_mux_i2creg_priv), }; diff --git a/drivers/net/mdio_mux_sandbox.c b/drivers/net/mdio_mux_sandbox.c index 3dba4d1..fff6ddb 100644 --- a/drivers/net/mdio_mux_sandbox.c +++ b/drivers/net/mdio_mux_sandbox.c @@ -93,5 +93,5 @@ U_BOOT_DRIVER(mdio_mux_sandbox) = { .of_match = mdio_mux_sandbox_ids, .probe = mdio_mux_sandbox_probe, .ops = &mdio_mux_sandbox_ops, - .priv_auto_alloc_size = sizeof(struct mdio_mux_sandbox_priv), + .priv_auto = sizeof(struct mdio_mux_sandbox_priv), }; diff --git a/drivers/net/mdio_sandbox.c b/drivers/net/mdio_sandbox.c index b731f60..2b50ffc 100644 --- a/drivers/net/mdio_sandbox.c +++ b/drivers/net/mdio_sandbox.c @@ -90,5 +90,5 @@ U_BOOT_DRIVER(mdio_sandbox) = { .of_match = mdio_sandbox_ids, .probe = mdio_sandbox_probe, .ops = &mdio_sandbox_ops, - .priv_auto_alloc_size = sizeof(struct mdio_sandbox_priv), + .priv_auto = sizeof(struct mdio_sandbox_priv), }; diff --git a/drivers/net/mscc_eswitch/jr2_switch.c b/drivers/net/mscc_eswitch/jr2_switch.c index 1c9a401..128d7f2 100644 --- a/drivers/net/mscc_eswitch/jr2_switch.c +++ b/drivers/net/mscc_eswitch/jr2_switch.c @@ -726,7 +726,7 @@ static int jr2_mac_table_add(struct jr2_private *priv, static int jr2_write_hwaddr(struct udevice *dev) { struct jr2_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); return jr2_mac_table_add(priv, pdata->enetaddr, PGID_UNICAST); } @@ -755,7 +755,7 @@ static void serdes_setup(struct jr2_private *priv) static int jr2_start(struct udevice *dev) { struct jr2_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const unsigned char mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int ret; @@ -964,6 +964,6 @@ U_BOOT_DRIVER(jr2) = { .probe = jr2_probe, .remove = jr2_remove, .ops = &jr2_ops, - .priv_auto_alloc_size = sizeof(struct jr2_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct jr2_private), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/mscc_eswitch/luton_switch.c b/drivers/net/mscc_eswitch/luton_switch.c index 1d46d0e..54afa14 100644 --- a/drivers/net/mscc_eswitch/luton_switch.c +++ b/drivers/net/mscc_eswitch/luton_switch.c @@ -497,7 +497,7 @@ static int luton_initialize(struct luton_private *priv) static int luton_write_hwaddr(struct udevice *dev) { struct luton_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); mscc_mac_table_add(priv->regs[ANA], luton_regs_ana_table, pdata->enetaddr, PGID_UNICAST); @@ -510,7 +510,7 @@ static int luton_write_hwaddr(struct udevice *dev) static int luton_start(struct udevice *dev) { struct luton_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const unsigned char mac[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int ret; @@ -737,6 +737,6 @@ U_BOOT_DRIVER(luton) = { .probe = luton_probe, .remove = luton_remove, .ops = &luton_ops, - .priv_auto_alloc_size = sizeof(struct luton_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct luton_private), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/mscc_eswitch/ocelot_switch.c b/drivers/net/mscc_eswitch/ocelot_switch.c index 2a48dc6..19e725c 100644 --- a/drivers/net/mscc_eswitch/ocelot_switch.c +++ b/drivers/net/mscc_eswitch/ocelot_switch.c @@ -420,7 +420,7 @@ static int ocelot_initialize(struct ocelot_private *priv) static int ocelot_write_hwaddr(struct udevice *dev) { struct ocelot_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); mscc_mac_table_add(priv->regs[ANA], ocelot_regs_ana_table, pdata->enetaddr, PGID_UNICAST); @@ -433,7 +433,7 @@ static int ocelot_write_hwaddr(struct udevice *dev) static int ocelot_start(struct udevice *dev) { struct ocelot_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const unsigned char mac[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int ret; @@ -651,6 +651,6 @@ U_BOOT_DRIVER(ocelot) = { .probe = ocelot_probe, .remove = ocelot_remove, .ops = &ocelot_ops, - .priv_auto_alloc_size = sizeof(struct ocelot_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ocelot_private), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/mscc_eswitch/serval_switch.c b/drivers/net/mscc_eswitch/serval_switch.c index d8ee1a7..09ce334 100644 --- a/drivers/net/mscc_eswitch/serval_switch.c +++ b/drivers/net/mscc_eswitch/serval_switch.c @@ -373,7 +373,7 @@ static int serval_initialize(struct serval_private *priv) static int serval_write_hwaddr(struct udevice *dev) { struct serval_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); mscc_mac_table_add(priv->regs[ANA], serval_regs_ana_table, pdata->enetaddr, PGID_UNICAST); @@ -386,7 +386,7 @@ static int serval_write_hwaddr(struct udevice *dev) static int serval_start(struct udevice *dev) { struct serval_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const unsigned char mac[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int ret; @@ -604,6 +604,6 @@ U_BOOT_DRIVER(serval) = { .probe = serval_probe, .remove = serval_remove, .ops = &serval_ops, - .priv_auto_alloc_size = sizeof(struct serval_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct serval_private), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/mscc_eswitch/servalt_switch.c b/drivers/net/mscc_eswitch/servalt_switch.c index 1cf2273..4a4e9e4 100644 --- a/drivers/net/mscc_eswitch/servalt_switch.c +++ b/drivers/net/mscc_eswitch/servalt_switch.c @@ -323,7 +323,7 @@ static int servalt_mac_table_add(struct servalt_private *priv, static int servalt_write_hwaddr(struct udevice *dev) { struct servalt_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); return servalt_mac_table_add(priv, pdata->enetaddr, PGID_UNICAST); } @@ -331,7 +331,7 @@ static int servalt_write_hwaddr(struct udevice *dev) static int servalt_start(struct udevice *dev) { struct servalt_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const unsigned char mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int ret; @@ -523,6 +523,6 @@ U_BOOT_DRIVER(servalt) = { .probe = servalt_probe, .remove = servalt_remove, .ops = &servalt_ops, - .priv_auto_alloc_size = sizeof(struct servalt_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct servalt_private), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/mt7628-eth.c b/drivers/net/mt7628-eth.c index 64f1c8c..50d066a 100644 --- a/drivers/net/mt7628-eth.c +++ b/drivers/net/mt7628-eth.c @@ -361,7 +361,7 @@ static int mt7628_eth_write_hwaddr(struct udevice *dev) { struct mt7628_eth_dev *priv = dev_get_priv(dev); void __iomem *base = priv->base; - u8 *addr = ((struct eth_pdata *)dev_get_platdata(dev))->enetaddr; + u8 *addr = ((struct eth_pdata *)dev_get_plat(dev))->enetaddr; u32 val; /* Set MAC address. */ @@ -651,6 +651,6 @@ U_BOOT_DRIVER(mt7628_eth) = { .of_match = mt7628_eth_ids, .probe = mt7628_eth_probe, .ops = &mt7628_eth_ops, - .priv_auto_alloc_size = sizeof(struct mt7628_eth_dev), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct mt7628_eth_dev), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c index 5183c08..26f0284 100644 --- a/drivers/net/mtk_eth.c +++ b/drivers/net/mtk_eth.c @@ -1278,7 +1278,7 @@ static void mtk_eth_stop(struct udevice *dev) static int mtk_eth_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct mtk_eth_priv *priv = dev_get_priv(dev); unsigned char *mac = pdata->enetaddr; u32 macaddr_lsb, macaddr_msb; @@ -1358,7 +1358,7 @@ static int mtk_eth_free_pkt(struct udevice *dev, uchar *packet, int length) static int mtk_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct mtk_eth_priv *priv = dev_get_priv(dev); ulong iobase = pdata->iobase; int ret; @@ -1407,9 +1407,9 @@ static int mtk_eth_remove(struct udevice *dev) return 0; } -static int mtk_eth_ofdata_to_platdata(struct udevice *dev) +static int mtk_eth_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct mtk_eth_priv *priv = dev_get_priv(dev); struct ofnode_phandle_args args; struct regmap *regmap; @@ -1558,11 +1558,11 @@ U_BOOT_DRIVER(mtk_eth) = { .name = "mtk-eth", .id = UCLASS_ETH, .of_match = mtk_eth_ids, - .ofdata_to_platdata = mtk_eth_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .of_to_plat = mtk_eth_of_to_plat, + .plat_auto = sizeof(struct eth_pdata), .probe = mtk_eth_probe, .remove = mtk_eth_remove, .ops = &mtk_eth_ops, - .priv_auto_alloc_size = sizeof(struct mtk_eth_priv), + .priv_auto = sizeof(struct mtk_eth_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c index 2f9464b..2452859 100644 --- a/drivers/net/mvgbe.c +++ b/drivers/net/mvgbe.c @@ -554,7 +554,7 @@ static int mvgbe_halt(struct eth_device *dev) #ifdef CONFIG_DM_ETH static int mvgbe_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); port_uc_addr_set(dev_get_priv(dev), pdata->enetaddr); @@ -906,7 +906,7 @@ static int mvgbe_port_is_fixed_link(struct mvgbe_device *dmvgbe) static int mvgbe_start(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct mvgbe_device *dmvgbe = dev_get_priv(dev); int ret; @@ -948,7 +948,7 @@ static void mvgbe_stop(struct udevice *dev) static int mvgbe_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct mvgbe_device *dmvgbe = dev_get_priv(dev); struct mii_dev *bus; int ret; @@ -986,9 +986,9 @@ static const struct eth_ops mvgbe_ops = { .write_hwaddr = mvgbe_write_hwaddr, }; -static int mvgbe_ofdata_to_platdata(struct udevice *dev) +static int mvgbe_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct mvgbe_device *dmvgbe = dev_get_priv(dev); void *blob = (void *)gd->fdt_blob; int node = dev_of_offset(dev); @@ -1038,10 +1038,10 @@ U_BOOT_DRIVER(mvgbe) = { .name = "mvgbe", .id = UCLASS_ETH, .of_match = mvgbe_ids, - .ofdata_to_platdata = mvgbe_ofdata_to_platdata, + .of_to_plat = mvgbe_of_to_plat, .probe = mvgbe_probe, .ops = &mvgbe_ops, - .priv_auto_alloc_size = sizeof(struct mvgbe_device), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct mvgbe_device), + .plat_auto = sizeof(struct eth_pdata), }; #endif /* CONFIG_DM_ETH */ diff --git a/drivers/net/mvmdio.c b/drivers/net/mvmdio.c index a8e93e8..96f8dc6 100644 --- a/drivers/net/mvmdio.c +++ b/drivers/net/mvmdio.c @@ -197,8 +197,8 @@ static int mvmdio_write(struct udevice *dev, int addr, int devad, int reg, */ static int mvmdio_bind(struct udevice *dev) { - if (ofnode_valid(dev->node)) - device_set_name(dev, ofnode_get_name(dev->node)); + if (ofnode_valid(dev_ofnode(dev))) + device_set_name(dev, ofnode_get_name(dev_ofnode(dev))); return 0; } @@ -232,6 +232,6 @@ U_BOOT_DRIVER(mvmdio) = { .bind = mvmdio_bind, .probe = mvmdio_probe, .ops = &mvmdio_ops, - .priv_auto_alloc_size = sizeof(struct mvmdio_priv), + .priv_auto = sizeof(struct mvmdio_priv), }; diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index 83f99e5..3192cf5 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -896,7 +896,7 @@ static void mvneta_mac_addr_set(struct mvneta_port *pp, unsigned char *addr, static int mvneta_write_hwaddr(struct udevice *dev) { mvneta_mac_addr_set(dev_get_priv(dev), - ((struct eth_pdata *)dev_get_platdata(dev))->enetaddr, + ((struct eth_pdata *)dev_get_plat(dev))->enetaddr, rxq_def); return 0; @@ -1397,7 +1397,7 @@ static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) /* Device initialization routine */ static int mvneta_init(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct mvneta_port *pp = dev_get_priv(dev); int err; @@ -1690,7 +1690,7 @@ static int mvneta_recv(struct udevice *dev, int flags, uchar **packetp) static int mvneta_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct mvneta_port *pp = dev_get_priv(dev); void *blob = (void *)gd->fdt_blob; int node = dev_of_offset(dev); @@ -1732,7 +1732,7 @@ static int mvneta_probe(struct udevice *dev) else mvneta_conf_mbus_windows(pp); - /* PHY interface is already decoded in mvneta_ofdata_to_platdata() */ + /* PHY interface is already decoded in mvneta_of_to_plat() */ pp->phy_interface = pdata->phy_interface; /* fetch 'fixed-link' property from 'neta' node */ @@ -1795,9 +1795,9 @@ static const struct eth_ops mvneta_ops = { .write_hwaddr = mvneta_write_hwaddr, }; -static int mvneta_ofdata_to_platdata(struct udevice *dev) +static int mvneta_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const char *phy_mode; pdata->iobase = dev_read_addr(dev); @@ -1827,9 +1827,9 @@ U_BOOT_DRIVER(mvneta) = { .name = "mvneta", .id = UCLASS_ETH, .of_match = mvneta_ids, - .ofdata_to_platdata = mvneta_ofdata_to_platdata, + .of_to_plat = mvneta_of_to_plat, .probe = mvneta_probe, .ops = &mvneta_ops, - .priv_auto_alloc_size = sizeof(struct mvneta_port), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct mvneta_port), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c index 8f790a8..d266e6d 100644 --- a/drivers/net/mvpp2.c +++ b/drivers/net/mvpp2.c @@ -5186,7 +5186,7 @@ static int mvpp2_send(struct udevice *dev, void *packet, int length) static int mvpp2_start(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct mvpp2_port *port = dev_get_priv(dev); /* Load current MAC address */ @@ -5424,8 +5424,8 @@ static struct driver mvpp2_driver = { .probe = mvpp2_probe, .remove = mvpp2_remove, .ops = &mvpp2_ops, - .priv_auto_alloc_size = sizeof(struct mvpp2_port), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct mvpp2_port), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ACTIVE_DMA, }; @@ -5477,8 +5477,8 @@ static int mvpp2_base_bind(struct udevice *parent) sprintf(name, "mvpp2-%d", id); /* Create child device UCLASS_ETH and bind it */ - device_bind(parent, &mvpp2_driver, name, plat, subnode, &dev); - dev_set_of_offset(dev, subnode); + device_bind(parent, &mvpp2_driver, name, plat, + offset_to_ofnode(subnode), &dev); } return 0; @@ -5501,5 +5501,5 @@ U_BOOT_DRIVER(mvpp2_base) = { .id = UCLASS_MISC, .of_match = mvpp2_ids, .bind = mvpp2_base_bind, - .priv_auto_alloc_size = sizeof(struct mvpp2), + .priv_auto = sizeof(struct mvpp2), }; diff --git a/drivers/net/octeontx/bgx.c b/drivers/net/octeontx/bgx.c index fbe2e2c..2ea54be 100644 --- a/drivers/net/octeontx/bgx.c +++ b/drivers/net/octeontx/bgx.c @@ -1552,7 +1552,7 @@ U_BOOT_DRIVER(octeontx_bgx) = { .id = UCLASS_MISC, .probe = octeontx_bgx_probe, .remove = octeontx_bgx_remove, - .priv_auto_alloc_size = sizeof(struct bgx), + .priv_auto = sizeof(struct bgx), .flags = DM_FLAG_OS_PREPARE, }; diff --git a/drivers/net/octeontx/nic_main.c b/drivers/net/octeontx/nic_main.c index 1a805f7..8f05d4e 100644 --- a/drivers/net/octeontx/nic_main.c +++ b/drivers/net/octeontx/nic_main.c @@ -766,7 +766,7 @@ U_BOOT_DRIVER(octeontx_nic) = { .name = "octeontx_nic", .id = UCLASS_MISC, .probe = octeontx_nic_probe, - .priv_auto_alloc_size = sizeof(struct nicpf), + .priv_auto = sizeof(struct nicpf), }; static struct pci_device_id octeontx_nic_supported[] = { diff --git a/drivers/net/octeontx/nicvf_main.c b/drivers/net/octeontx/nicvf_main.c index e13c8b9..c30ba49 100644 --- a/drivers/net/octeontx/nicvf_main.c +++ b/drivers/net/octeontx/nicvf_main.c @@ -105,7 +105,7 @@ static int nicvf_check_pf_ready(struct nicvf *nic) static void nicvf_handle_mbx_intr(struct nicvf *nic) { union nic_mbx mbx = {}; - struct eth_pdata *pdata = dev_get_platdata(nic->dev); + struct eth_pdata *pdata = dev_get_plat(nic->dev); u64 *mbx_data; u64 mbx_addr; int i; @@ -165,7 +165,7 @@ static void nicvf_handle_mbx_intr(struct nicvf *nic) static int nicvf_hw_set_mac_addr(struct nicvf *nic, struct udevice *dev) { union nic_mbx mbx = {}; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); mbx.mac.msg = NIC_MBOX_MSG_SET_MAC; mbx.mac.vf_id = nic->vf_id; @@ -445,18 +445,19 @@ int nicvf_open(struct udevice *dev) int nicvf_write_hwaddr(struct udevice *dev) { unsigned char ethaddr[ARP_HLEN]; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct nicvf *nic = dev_get_priv(dev); /* If lower level firmware fails to set proper MAC * u-boot framework updates MAC to random address. * Use this hook to update mac address in environment. */ - if (!eth_env_get_enetaddr_by_index("eth", dev->seq, ethaddr)) { - eth_env_set_enetaddr_by_index("eth", dev->seq, pdata->enetaddr); + if (!eth_env_get_enetaddr_by_index("eth", dev_seq(dev), ethaddr)) { + eth_env_set_enetaddr_by_index("eth", dev_seq(dev), + pdata->enetaddr); debug("%s: pMAC %pM\n", __func__, pdata->enetaddr); } - eth_env_get_enetaddr_by_index("eth", dev->seq, ethaddr); + eth_env_get_enetaddr_by_index("eth", dev_seq(dev), ethaddr); if (memcmp(ethaddr, pdata->enetaddr, ARP_HLEN)) { debug("%s: pMAC %pM\n", __func__, pdata->enetaddr); nicvf_hw_set_mac_addr(nic, dev); @@ -484,7 +485,7 @@ static void nicvf_probe_mdio_devices(void) int nicvf_initialize(struct udevice *dev) { struct nicvf *nicvf = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); int ret = 0, bgx, lmac; char name[16]; unsigned char ethaddr[ARP_HLEN]; @@ -540,7 +541,7 @@ int nicvf_initialize(struct udevice *dev) if (is_valid_ethaddr(ethaddr)) { memcpy(pdata->enetaddr, ethaddr, ARP_HLEN); - eth_env_set_enetaddr_by_index("eth", dev->seq, ethaddr); + eth_env_set_enetaddr_by_index("eth", dev_seq(dev), ethaddr); } debug("%s enetaddr %pM ethaddr %pM\n", __func__, pdata->enetaddr, ethaddr); @@ -568,8 +569,8 @@ U_BOOT_DRIVER(octeontx_vnic) = { .id = UCLASS_ETH, .probe = octeontx_vnic_probe, .ops = &octeontx_vnic_ops, - .priv_auto_alloc_size = sizeof(struct nicvf), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct nicvf), + .plat_auto = sizeof(struct eth_pdata), }; static struct pci_device_id octeontx_vnic_supported[] = { diff --git a/drivers/net/octeontx/smi.c b/drivers/net/octeontx/smi.c index 8e2c3ca..5843641 100644 --- a/drivers/net/octeontx/smi.c +++ b/drivers/net/octeontx/smi.c @@ -313,13 +313,12 @@ read_error: int octeontx_smi_probe(struct udevice *dev) { - int ret, subnode, cnt = 0, node = dev->node.of_offset; + int ret, subnode, cnt = 0, node = dev_ofnode(dev).of_offset; struct mii_dev *bus; struct octeontx_smi_priv *priv; pci_dev_t bdf = dm_pci_get_bdf(dev); debug("SMI PCI device: %x\n", bdf); - dev->req_seq = PCI_FUNC(bdf); if (!dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM)) { printf("Failed to map PCI region for bdf %x\n", bdf); return -1; @@ -335,7 +334,7 @@ int octeontx_smi_probe(struct udevice *dev) priv = malloc(sizeof(*priv)); if (!bus || !priv) { printf("Failed to allocate OcteonTX MDIO bus # %u\n", - dev->seq); + dev_seq(dev)); return -1; } diff --git a/drivers/net/octeontx2/cgx.c b/drivers/net/octeontx2/cgx.c index ff2ebc2..189fe7c 100644 --- a/drivers/net/octeontx2/cgx.c +++ b/drivers/net/octeontx2/cgx.c @@ -285,7 +285,7 @@ U_BOOT_DRIVER(cgx) = { .id = UCLASS_MISC, .probe = cgx_probe, .remove = cgx_remove, - .priv_auto_alloc_size = sizeof(struct cgx), + .priv_auto = sizeof(struct cgx), }; static struct pci_device_id cgx_supported[] = { diff --git a/drivers/net/octeontx2/nix.c b/drivers/net/octeontx2/nix.c index 0a3e8e4..039c44b 100644 --- a/drivers/net/octeontx2/nix.c +++ b/drivers/net/octeontx2/nix.c @@ -727,7 +727,7 @@ int nix_lf_setup_mac(struct udevice *dev) { struct rvu_pf *rvu = dev_get_priv(dev); struct nix *nix = rvu->nix; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); /* If lower level firmware fails to set proper MAC * u-boot framework updates MAC to random address. @@ -736,7 +736,7 @@ int nix_lf_setup_mac(struct udevice *dev) */ if (memcmp(nix->lmac->mac_addr, pdata->enetaddr, ARP_HLEN)) { memcpy(nix->lmac->mac_addr, pdata->enetaddr, 6); - eth_env_set_enetaddr_by_index("eth", rvu->dev->seq, + eth_env_set_enetaddr_by_index("eth", dev_seq(rvu->dev), pdata->enetaddr); cgx_lmac_mac_filter_setup(nix->lmac); /* Update user given MAC address to ATF for update diff --git a/drivers/net/octeontx2/rvu_af.c b/drivers/net/octeontx2/rvu_af.c index 7750089..d2f9654 100644 --- a/drivers/net/octeontx2/rvu_af.c +++ b/drivers/net/octeontx2/rvu_af.c @@ -160,7 +160,7 @@ U_BOOT_DRIVER(rvu_af) = { .id = UCLASS_MISC, .probe = rvu_af_probe, .remove = rvu_af_remove, - .priv_auto_alloc_size = sizeof(struct rvu_af), + .priv_auto = sizeof(struct rvu_af), }; static struct pci_device_id rvu_af_supported[] = { diff --git a/drivers/net/octeontx2/rvu_pf.c b/drivers/net/octeontx2/rvu_pf.c index 201ecf2..4b00178 100644 --- a/drivers/net/octeontx2/rvu_pf.c +++ b/drivers/net/octeontx2/rvu_pf.c @@ -20,7 +20,7 @@ extern struct udevice *rvu_af_dev; int rvu_pf_init(struct rvu_pf *rvu) { struct nix *nix; - struct eth_pdata *pdata = dev_get_platdata(rvu->dev); + struct eth_pdata *pdata = dev_get_plat(rvu->dev); debug("%s: Allocating nix lf\n", __func__); nix = nix_lf_alloc(rvu->dev); @@ -34,7 +34,7 @@ int rvu_pf_init(struct rvu_pf *rvu) /* to make post_probe happy */ if (is_valid_ethaddr(nix->lmac->mac_addr)) { memcpy(pdata->enetaddr, nix->lmac->mac_addr, 6); - eth_env_set_enetaddr_by_index("eth", rvu->dev->seq, + eth_env_set_enetaddr_by_index("eth", dev_seq(rvu->dev), pdata->enetaddr); } @@ -59,7 +59,7 @@ int rvu_pf_probe(struct udevice *dev) debug("%s: name: %s\n", __func__, dev->name); rvu->pf_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_2, PCI_REGION_MEM); - rvu->pfid = dev->seq + 1; // RVU PF's start from 1; + rvu->pfid = dev_seq(dev) + 1; // RVU PF's start from 1; rvu->dev = dev; if (!rvu_af_dev) { printf("%s: Error: Could not find RVU AF device\n", @@ -80,7 +80,7 @@ int rvu_pf_probe(struct udevice *dev) * modify device name to include index/sequence number, * for better readability, this is 1:1 mapping with eth0/1/2.. names. */ - sprintf(name, "rvu_pf#%d", dev->seq); + sprintf(name, "rvu_pf#%d", dev_seq(dev)); device_set_name(dev, name); debug("%s: name: %s\n", __func__, dev->name); return err; @@ -104,8 +104,8 @@ U_BOOT_DRIVER(rvu_pf) = { .probe = rvu_pf_probe, .remove = rvu_pf_remove, .ops = &nix_eth_ops, - .priv_auto_alloc_size = sizeof(struct rvu_pf), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct rvu_pf), + .plat_auto = sizeof(struct eth_pdata), }; static struct pci_device_id rvu_pf_supported[] = { diff --git a/drivers/net/pch_gbe.c b/drivers/net/pch_gbe.c index 1daafbe..fabcf85 100644 --- a/drivers/net/pch_gbe.c +++ b/drivers/net/pch_gbe.c @@ -68,7 +68,7 @@ static int pch_gbe_mac_write(struct pch_gbe_regs *mac_regs, u8 *addr) static int pch_gbe_reset(struct udevice *dev) { struct pch_gbe_priv *priv = dev_get_priv(dev); - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct pch_gbe_regs *mac_regs = priv->mac_regs; ulong start; @@ -412,7 +412,7 @@ static int pch_gbe_mdio_init(const char *name, struct pch_gbe_regs *mac_regs) static int pch_gbe_phy_init(struct udevice *dev) { struct pch_gbe_priv *priv = dev_get_priv(dev); - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct phy_device *phydev; int mask = 0xffffffff; @@ -436,7 +436,7 @@ static int pch_gbe_phy_init(struct udevice *dev) static int pch_gbe_probe(struct udevice *dev) { struct pch_gbe_priv *priv; - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); void *iobase; int err; @@ -499,8 +499,8 @@ U_BOOT_DRIVER(eth_pch_gbe) = { .probe = pch_gbe_probe, .remove = pch_gbe_remove, .ops = &pch_gbe_ops, - .priv_auto_alloc_size = sizeof(struct pch_gbe_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct pch_gbe_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index ad5ac66..59ef104 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -585,7 +585,7 @@ int pcnet_initialize(struct bd_info *bis) #else /* DM_ETH */ static int pcnet_start(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct pcnet_priv *priv = dev_get_priv(dev); memcpy(priv->enetaddr, plat->enetaddr, sizeof(plat->enetaddr)); @@ -638,7 +638,7 @@ static int pcnet_bind(struct udevice *dev) static int pcnet_probe(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct pcnet_priv *lp = dev_get_priv(dev); u16 command, status; u32 iobase; @@ -689,8 +689,8 @@ U_BOOT_DRIVER(eth_pcnet) = { .bind = pcnet_bind, .probe = pcnet_probe, .ops = &pcnet_ops, - .priv_auto_alloc_size = sizeof(struct pcnet_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct pcnet_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_UC_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/pfe_eth/pfe_eth.c b/drivers/net/pfe_eth/pfe_eth.c index 3b4ca03..0c27a66 100644 --- a/drivers/net/pfe_eth/pfe_eth.c +++ b/drivers/net/pfe_eth/pfe_eth.c @@ -87,7 +87,7 @@ static int pfe_eth_write_hwaddr(struct udevice *dev) { struct pfe_eth_dev *priv = dev_get_priv(dev); struct gemac_s *gem = priv->gem; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); uchar *mac = pdata->enetaddr; writel((mac[0] << 24) + (mac[1] << 16) + (mac[2] << 8) + mac[3], @@ -157,7 +157,7 @@ static int pfe_eth_start(struct udevice *dev) static int pfe_eth_send(struct udevice *dev, void *packet, int length) { - struct pfe_eth_dev *priv = (struct pfe_eth_dev *)dev->priv; + struct pfe_eth_dev *priv = (struct pfe_eth_dev *)dev_get_priv(dev); int rc; int i = 0; @@ -215,7 +215,7 @@ static int pfe_eth_probe(struct udevice *dev) { struct pfe_eth_dev *priv = dev_get_priv(dev); struct pfe_ddr_address pfe_addr; - struct pfe_eth_pdata *pdata = dev_get_platdata(dev); + struct pfe_eth_pdata *pdata = dev_get_plat(dev); int ret = 0; static int init_done; @@ -266,7 +266,7 @@ static int pfe_eth_probe(struct udevice *dev) static int pfe_eth_bind(struct udevice *dev) { - struct pfe_eth_pdata *pdata = dev_get_platdata(dev); + struct pfe_eth_pdata *pdata = dev_get_plat(dev); char name[20]; sprintf(name, "pfe_eth%u", pdata->pfe_eth_pdata_mac.phy_interface); @@ -290,6 +290,6 @@ U_BOOT_DRIVER(pfe_eth) = { .probe = pfe_eth_probe, .remove = pfe_eth_remove, .ops = &pfe_eth_ops, - .priv_auto_alloc_size = sizeof(struct pfe_eth_dev), - .platdata_auto_alloc_size = sizeof(struct pfe_eth_pdata) + .priv_auto = sizeof(struct pfe_eth_dev), + .plat_auto = sizeof(struct pfe_eth_pdata) }; diff --git a/drivers/net/pic32_eth.c b/drivers/net/pic32_eth.c index 6a20849..9eba55a 100644 --- a/drivers/net/pic32_eth.c +++ b/drivers/net/pic32_eth.c @@ -326,7 +326,7 @@ static void pic32_rx_desc_init(struct pic32eth_dev *priv) static int pic32_eth_start(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct pic32eth_dev *priv = dev_get_priv(dev); /* controller */ @@ -531,7 +531,7 @@ static const struct eth_ops pic32_eth_ops = { static int pic32_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct pic32eth_dev *priv = dev_get_priv(dev); const char *phy_mode; void __iomem *iobase; @@ -606,6 +606,6 @@ U_BOOT_DRIVER(pic32_ethernet) = { .probe = pic32_eth_probe, .remove = pic32_eth_remove, .ops = &pic32_eth_ops, - .priv_auto_alloc_size = sizeof(struct pic32eth_dev), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct pic32eth_dev), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/qe/dm_qe_uec.c b/drivers/net/qe/dm_qe_uec.c index 3482b3f..a33068c 100644 --- a/drivers/net/qe/dm_qe_uec.c +++ b/drivers/net/qe/dm_qe_uec.c @@ -416,7 +416,7 @@ static void qe_uec_stop(struct udevice *dev) static int qe_uec_set_hwaddr(struct udevice *dev) { struct qe_uec_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct uec_priv *uec = priv->uec; uec_t *uec_regs = uec->uec_regs; uchar *mac = pdata->enetaddr; @@ -982,7 +982,7 @@ static void qe_uec_set_eth_type(struct udevice *dev) static int qe_uec_set_uec_info(struct udevice *dev) { struct qe_uec_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct uec_priv *uec = priv->uec; struct uec_inf *uec_info; struct ucc_fast_inf *uf_info; @@ -1086,7 +1086,7 @@ out: static int qe_uec_probe(struct udevice *dev) { struct qe_uec_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct uec_priv *uec; int ret; @@ -1129,9 +1129,9 @@ static int qe_uec_remove(struct udevice *dev) return 0; } -static int qe_uec_ofdata_to_platdata(struct udevice *dev) +static int qe_uec_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const char *phy_mode; pdata->iobase = (phys_addr_t)devfdt_get_addr(dev); @@ -1158,10 +1158,10 @@ U_BOOT_DRIVER(eth_qe_uec) = { .name = QE_UEC_DRIVER_NAME, .id = UCLASS_ETH, .of_match = qe_uec_ids, - .ofdata_to_platdata = qe_uec_ofdata_to_platdata, + .of_to_plat = qe_uec_of_to_plat, .probe = qe_uec_probe, .remove = qe_uec_remove, .ops = &qe_uec_eth_ops, - .priv_auto_alloc_size = sizeof(struct qe_uec_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct qe_uec_priv), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/qe/dm_qe_uec_phy.c b/drivers/net/qe/dm_qe_uec_phy.c index 02ce08e..038b810 100644 --- a/drivers/net/qe/dm_qe_uec_phy.c +++ b/drivers/net/qe/dm_qe_uec_phy.c @@ -159,5 +159,5 @@ U_BOOT_DRIVER(mvmdio) = { .of_match = qe_uec_mdio_ids, .probe = qe_uec_mdio_probe, .ops = &qe_uec_mdio_ops, - .priv_auto_alloc_size = sizeof(struct qe_uec_mdio_priv), + .priv_auto = sizeof(struct qe_uec_mdio_priv), }; diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c index 98883cd..34e2b8f 100644 --- a/drivers/net/ravb.c +++ b/drivers/net/ravb.c @@ -306,7 +306,7 @@ static void ravb_rx_desc_init(struct ravb_priv *eth) static int ravb_phy_config(struct udevice *dev) { struct ravb_priv *eth = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct phy_device *phydev; int mask = 0xffffffff, reg; @@ -346,7 +346,7 @@ static int ravb_phy_config(struct udevice *dev) static int ravb_write_hwaddr(struct udevice *dev) { struct ravb_priv *eth = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); unsigned char *mac = pdata->enetaddr; writel((mac[0] << 24) | (mac[1] << 16) | (mac[2] << 8) | mac[3], @@ -373,7 +373,7 @@ static int ravb_mac_init(struct ravb_priv *eth) static int ravb_dmac_init(struct udevice *dev) { struct ravb_priv *eth = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); int ret = 0; /* Set CONFIG mode */ @@ -474,7 +474,7 @@ static void ravb_stop(struct udevice *dev) static int ravb_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct ravb_priv *eth = dev_get_priv(dev); struct ofnode_phandle_args phandle_args; struct mii_dev *mdiodev; @@ -642,9 +642,9 @@ static const struct eth_ops ravb_ops = { .write_hwaddr = ravb_write_hwaddr, }; -int ravb_ofdata_to_platdata(struct udevice *dev) +int ravb_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const char *phy_mode; const fdt32_t *cell; int ret = 0; @@ -685,11 +685,11 @@ U_BOOT_DRIVER(eth_ravb) = { .name = "ravb", .id = UCLASS_ETH, .of_match = ravb_ids, - .ofdata_to_platdata = ravb_ofdata_to_platdata, + .of_to_plat = ravb_of_to_plat, .probe = ravb_probe, .remove = ravb_remove, .ops = &ravb_ops, - .priv_auto_alloc_size = sizeof(struct ravb_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ravb_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index 71f2aba..feeea93 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -660,7 +660,7 @@ int rtl8139_initialize(struct bd_info *bis) #else /* DM_ETH */ static int rtl8139_start(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct rtl8139_priv *priv = dev_get_priv(dev); memcpy(priv->enetaddr, plat->enetaddr, sizeof(plat->enetaddr)); @@ -704,7 +704,7 @@ static int rtl8139_free_pkt(struct udevice *dev, uchar *packet, int length) static int rtl8139_write_hwaddr(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct rtl8139_priv *priv = dev_get_priv(dev); memcpy(priv->enetaddr, plat->enetaddr, sizeof(plat->enetaddr)); @@ -735,7 +735,7 @@ static int rtl8139_bind(struct udevice *dev) static int rtl8139_probe(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct rtl8139_priv *priv = dev_get_priv(dev); u32 iobase; @@ -771,8 +771,8 @@ U_BOOT_DRIVER(eth_rtl8139) = { .bind = rtl8139_bind, .probe = rtl8139_probe, .ops = &rtl8139_ops, - .priv_auto_alloc_size = sizeof(struct rtl8139_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct rtl8139_priv), + .plat_auto = sizeof(struct eth_pdata), }; U_BOOT_PCI_DEVICE(eth_rtl8139, supported); diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 2e1304e..da2cfb7 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -890,7 +890,7 @@ static void rtl8169_common_start(pci_dev_t dev, unsigned char *enetaddr, #ifdef CONFIG_DM_ETH static int rtl8169_eth_start(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct rtl8169_private *priv = dev_get_priv(dev); rtl8169_common_start(dev, plat->enetaddr, priv->iobase); @@ -953,7 +953,7 @@ static void rtl_halt(struct eth_device *dev) #ifdef CONFIG_DM_ETH static int rtl8169_write_hwaddr(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); unsigned int i; RTL_W8(Cfg9346, Cfg9346_Unlock); @@ -1187,9 +1187,9 @@ int rtl8169_initialize(struct bd_info *bis) #ifdef CONFIG_DM_ETH static int rtl8169_eth_probe(struct udevice *dev) { - struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); + struct pci_child_plat *pplat = dev_get_parent_plat(dev); struct rtl8169_private *priv = dev_get_priv(dev); - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); u32 iobase; int region; int ret; @@ -1248,8 +1248,8 @@ U_BOOT_DRIVER(eth_rtl8169) = { .of_match = rtl8169_eth_ids, .probe = rtl8169_eth_probe, .ops = &rtl8169_eth_ops, - .priv_auto_alloc_size = sizeof(struct rtl8169_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct rtl8169_private), + .plat_auto = sizeof(struct eth_pdata), }; U_BOOT_PCI_DEVICE(eth_rtl8169, supported); diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c index 4bd94c3..8273f73 100644 --- a/drivers/net/sandbox-raw.c +++ b/drivers/net/sandbox-raw.c @@ -22,7 +22,7 @@ static struct in_addr arp_ip; static int sb_eth_raw_start(struct udevice *dev) { struct eth_sandbox_raw_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); int ret; debug("eth_sandbox_raw: Start\n"); @@ -65,7 +65,7 @@ static int sb_eth_raw_send(struct udevice *dev, void *packet, int length) static int sb_eth_raw_recv(struct udevice *dev, int flags, uchar **packetp) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct eth_sandbox_raw_priv *priv = dev_get_priv(dev); int retval = 0; int length; @@ -134,7 +134,7 @@ static void sb_eth_raw_stop(struct udevice *dev) static int sb_eth_raw_read_rom_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); net_random_ethaddr(pdata->enetaddr); @@ -149,9 +149,9 @@ static const struct eth_ops sb_eth_raw_ops = { .read_rom_hwaddr = sb_eth_raw_read_rom_hwaddr, }; -static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev) +static int sb_eth_raw_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct eth_sandbox_raw_priv *priv = dev_get_priv(dev); const char *ifname; int ret; @@ -191,8 +191,8 @@ U_BOOT_DRIVER(eth_sandbox_raw) = { .name = "eth_sandbox_raw", .id = UCLASS_ETH, .of_match = sb_eth_raw_ids, - .ofdata_to_platdata = sb_eth_raw_ofdata_to_platdata, + .of_to_plat = sb_eth_raw_of_to_plat, .ops = &sb_eth_raw_ops, - .priv_auto_alloc_size = sizeof(struct eth_sandbox_raw_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct eth_sandbox_raw_priv), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c index 4f7e3d4..a389e2b 100644 --- a/drivers/net/sandbox.c +++ b/drivers/net/sandbox.c @@ -393,7 +393,7 @@ static void sb_eth_stop(struct udevice *dev) static int sb_eth_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); debug("eth_sandbox %s: Write HW ADDR - %pM\n", dev->name, pdata->enetaddr); @@ -414,9 +414,9 @@ static int sb_eth_remove(struct udevice *dev) return 0; } -static int sb_eth_ofdata_to_platdata(struct udevice *dev) +static int sb_eth_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct eth_sandbox_priv *priv = dev_get_priv(dev); const u8 *mac; @@ -443,9 +443,9 @@ U_BOOT_DRIVER(eth_sandbox) = { .name = "eth_sandbox", .id = UCLASS_ETH, .of_match = sb_eth_ids, - .ofdata_to_platdata = sb_eth_ofdata_to_platdata, + .of_to_plat = sb_eth_of_to_plat, .remove = sb_eth_remove, .ops = &sb_eth_ops, - .priv_auto_alloc_size = sizeof(struct eth_sandbox_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct eth_sandbox_priv), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 4cbffb1..1666a8c 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -744,7 +744,7 @@ static int sh_ether_write_hwaddr(struct udevice *dev) struct sh_ether_priv *priv = dev_get_priv(dev); struct sh_eth_dev *eth = &priv->shdev; struct sh_eth_info *port_info = ð->port_info[eth->port]; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); sh_eth_write_hwaddr(port_info, pdata->enetaddr); @@ -754,7 +754,7 @@ static int sh_ether_write_hwaddr(struct udevice *dev) static int sh_eth_phy_config(struct udevice *dev) { struct sh_ether_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct sh_eth_dev *eth = &priv->shdev; int ret = 0; struct sh_eth_info *port_info = ð->port_info[eth->port]; @@ -776,7 +776,7 @@ static int sh_eth_phy_config(struct udevice *dev) static int sh_ether_start(struct udevice *dev) { struct sh_ether_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct sh_eth_dev *eth = &priv->shdev; int ret; @@ -808,7 +808,7 @@ static void sh_ether_stop(struct udevice *dev) static int sh_ether_probe(struct udevice *udev) { - struct eth_pdata *pdata = dev_get_platdata(udev); + struct eth_pdata *pdata = dev_get_plat(udev); struct sh_ether_priv *priv = dev_get_priv(udev); struct sh_eth_dev *eth = &priv->shdev; struct ofnode_phandle_args phandle_args; @@ -911,9 +911,9 @@ static const struct eth_ops sh_ether_ops = { .write_hwaddr = sh_ether_write_hwaddr, }; -int sh_ether_ofdata_to_platdata(struct udevice *dev) +int sh_ether_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const char *phy_mode; const fdt32_t *cell; int ret = 0; @@ -953,12 +953,12 @@ U_BOOT_DRIVER(eth_sh_ether) = { .name = "sh_ether", .id = UCLASS_ETH, .of_match = sh_ether_ids, - .ofdata_to_platdata = sh_ether_ofdata_to_platdata, + .of_to_plat = sh_ether_of_to_plat, .probe = sh_ether_probe, .remove = sh_ether_remove, .ops = &sh_ether_ops, - .priv_auto_alloc_size = sizeof(struct sh_ether_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct sh_ether_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 09372d7..7b79831 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -536,7 +536,7 @@ err_detect: static int smc911x_start(struct udevice *dev) { - struct eth_pdata *plat = dev_get_platdata(dev); + struct eth_pdata *plat = dev_get_plat(dev); struct smc911x_priv *priv = dev_get_priv(dev); memcpy(priv->enetaddr, plat->enetaddr, sizeof(plat->enetaddr)); @@ -577,7 +577,7 @@ static int smc911x_recv(struct udevice *dev, int flags, uchar **packetp) static int smc911x_read_rom_hwaddr(struct udevice *dev) { struct smc911x_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); if (!smc911x_read_mac_address(priv)) return -ENODEV; @@ -607,10 +607,10 @@ static int smc911x_probe(struct udevice *dev) return 0; } -static int smc911x_ofdata_to_platdata(struct udevice *dev) +static int smc911x_of_to_plat(struct udevice *dev) { struct smc911x_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); pdata->iobase = dev_read_addr(dev); priv->iobase = pdata->iobase; @@ -636,11 +636,11 @@ U_BOOT_DRIVER(smc911x) = { .id = UCLASS_ETH, .of_match = smc911x_ids, .bind = smc911x_bind, - .ofdata_to_platdata = smc911x_ofdata_to_platdata, + .of_to_plat = smc911x_of_to_plat, .probe = smc911x_probe, .ops = &smc911x_ops, - .priv_auto_alloc_size = sizeof(struct smc911x_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct smc911x_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif diff --git a/drivers/net/sni_ave.c b/drivers/net/sni_ave.c index 0f7ada8..0ebe86a 100644 --- a/drivers/net/sni_ave.c +++ b/drivers/net/sni_ave.c @@ -299,7 +299,7 @@ static int ave_mdiobus_write(struct mii_dev *bus, static int ave_adjust_link(struct ave_private *priv) { struct phy_device *phydev = priv->phydev; - struct eth_pdata *pdata = dev_get_platdata(phydev->dev); + struct eth_pdata *pdata = dev_get_plat(phydev->dev); u32 val, txcr, rxcr, rxcr_org; u16 rmt_adv = 0, lcl_adv = 0; u8 cap; @@ -516,7 +516,7 @@ static int ave_start(struct udevice *dev) static int ave_write_hwaddr(struct udevice *dev) { struct ave_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); u8 *mac = pdata->enetaddr; writel(mac[0] | mac[1] << 8 | mac[2] << 16 | mac[3] << 24, @@ -732,9 +732,9 @@ static int ave_pxs3_get_pinmode(struct ave_private *priv) return 0; } -static int ave_ofdata_to_platdata(struct udevice *dev) +static int ave_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct ave_private *priv = dev_get_priv(dev); struct ofnode_phandle_args args; const char *phy_mode; @@ -826,7 +826,7 @@ out_clk_free: static int ave_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct ave_private *priv = dev_get_priv(dev); int ret, nc, nr; @@ -996,8 +996,8 @@ U_BOOT_DRIVER(ave) = { .of_match = ave_ids, .probe = ave_probe, .remove = ave_remove, - .ofdata_to_platdata = ave_ofdata_to_platdata, + .of_to_plat = ave_of_to_plat, .ops = &ave_ops, - .priv_auto_alloc_size = sizeof(struct ave_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ave_private), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c index 4524604..cf15e9f 100644 --- a/drivers/net/sun8i_emac.c +++ b/drivers/net/sun8i_emac.c @@ -255,7 +255,7 @@ static int sun8i_mdio_write(struct mii_dev *bus, int addr, int devad, int reg, static int sun8i_eth_write_hwaddr(struct udevice *dev) { struct emac_eth_dev *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); uchar *mac_id = pdata->enetaddr; u32 macid_lo, macid_hi; @@ -712,7 +712,7 @@ static int sun8i_mdio_reset(struct mii_dev *bus) { struct udevice *dev = bus->priv; struct emac_eth_dev *priv = dev_get_priv(dev); - struct sun8i_eth_pdata *pdata = dev_get_platdata(dev); + struct sun8i_eth_pdata *pdata = dev_get_plat(dev); int ret; if (!dm_gpio_is_valid(&priv->reset_gpio)) @@ -799,7 +799,7 @@ static void sun8i_emac_eth_stop(struct udevice *dev) static int sun8i_emac_eth_probe(struct udevice *dev) { - struct sun8i_eth_pdata *sun8i_pdata = dev_get_platdata(dev); + struct sun8i_eth_pdata *sun8i_pdata = dev_get_plat(dev); struct eth_pdata *pdata = &sun8i_pdata->eth_pdata; struct emac_eth_dev *priv = dev_get_priv(dev); int ret; @@ -861,9 +861,9 @@ static int sun8i_handle_internal_phy(struct udevice *dev, struct emac_eth_dev *p return 0; } -static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev) +static int sun8i_emac_eth_of_to_plat(struct udevice *dev) { - struct sun8i_eth_pdata *sun8i_pdata = dev_get_platdata(dev); + struct sun8i_eth_pdata *sun8i_pdata = dev_get_plat(dev); struct eth_pdata *pdata = &sun8i_pdata->eth_pdata; struct emac_eth_dev *priv = dev_get_priv(dev); const char *phy_mode; @@ -1001,10 +1001,10 @@ U_BOOT_DRIVER(eth_sun8i_emac) = { .name = "eth_sun8i_emac", .id = UCLASS_ETH, .of_match = sun8i_emac_eth_ids, - .ofdata_to_platdata = sun8i_emac_eth_ofdata_to_platdata, + .of_to_plat = sun8i_emac_eth_of_to_plat, .probe = sun8i_emac_eth_probe, .ops = &sun8i_emac_eth_ops, - .priv_auto_alloc_size = sizeof(struct emac_eth_dev), - .platdata_auto_alloc_size = sizeof(struct sun8i_eth_pdata), + .priv_auto = sizeof(struct emac_eth_dev), + .plat_auto = sizeof(struct sun8i_eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c index 8e66ce2..17ad88e 100644 --- a/drivers/net/sunxi_emac.c +++ b/drivers/net/sunxi_emac.c @@ -535,9 +535,9 @@ static int sunxi_emac_board_setup(struct udevice *dev, static int sunxi_emac_eth_start(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); - return _sunxi_emac_eth_init(dev->priv, pdata->enetaddr); + return _sunxi_emac_eth_init(dev_get_priv(dev), pdata->enetaddr); } static int sunxi_emac_eth_send(struct udevice *dev, void *packet, int length) @@ -565,7 +565,7 @@ static void sunxi_emac_eth_stop(struct udevice *dev) static int sunxi_emac_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct emac_eth_dev *priv = dev_get_priv(dev); int ret; @@ -591,9 +591,9 @@ static const struct eth_ops sunxi_emac_eth_ops = { .stop = sunxi_emac_eth_stop, }; -static int sunxi_emac_eth_ofdata_to_platdata(struct udevice *dev) +static int sunxi_emac_eth_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); pdata->iobase = dev_read_addr(dev); @@ -609,9 +609,9 @@ U_BOOT_DRIVER(eth_sunxi_emac) = { .name = "eth_sunxi_emac", .id = UCLASS_ETH, .of_match = sunxi_emac_eth_ids, - .ofdata_to_platdata = sunxi_emac_eth_ofdata_to_platdata, + .of_to_plat = sunxi_emac_eth_of_to_plat, .probe = sunxi_emac_eth_probe, .ops = &sunxi_emac_eth_ops, - .priv_auto_alloc_size = sizeof(struct emac_eth_dev), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct emac_eth_dev), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c index 971bdcd..e6954b6 100644 --- a/drivers/net/ti/am65-cpsw-nuss.c +++ b/drivers/net/ti/am65-cpsw-nuss.c @@ -281,7 +281,7 @@ static void am65_cpsw_gmii_sel_k3(struct am65_cpsw_priv *priv, static int am65_cpsw_start(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct am65_cpsw_priv *priv = dev_get_priv(dev); struct am65_cpsw_common *common = priv->cpsw_common; struct am65_cpsw_port *port = &common->ports[priv->port_id]; @@ -514,7 +514,7 @@ static int am65_cpsw_read_rom_hwaddr(struct udevice *dev) { struct am65_cpsw_priv *priv = dev_get_priv(dev); struct am65_cpsw_common *common = priv->cpsw_common; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); u32 mac_hi, mac_lo; if (common->mac_efuse == FDT_ADDR_T_NONE) @@ -563,7 +563,7 @@ static int am65_cpsw_phy_init(struct udevice *dev) { struct am65_cpsw_priv *priv = dev_get_priv(dev); struct am65_cpsw_common *cpsw_common = priv->cpsw_common; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct phy_device *phydev; u32 supported = PHY_GBIT_FEATURES; int ret; @@ -599,7 +599,7 @@ static int am65_cpsw_phy_init(struct udevice *dev) static int am65_cpsw_ofdata_parse_phy(struct udevice *dev, ofnode port_np) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct am65_cpsw_priv *priv = dev_get_priv(dev); struct ofnode_phandle_args out_args; const char *phy_mode; @@ -649,7 +649,7 @@ out: static int am65_cpsw_probe_cpsw(struct udevice *dev) { struct am65_cpsw_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct am65_cpsw_common *cpsw_common; ofnode ports_np, node; int ret, i; @@ -791,7 +791,7 @@ U_BOOT_DRIVER(am65_cpsw_nuss_slave) = { .of_match = am65_cpsw_nuss_ids, .probe = am65_cpsw_probe_cpsw, .ops = &am65_cpsw_ops, - .priv_auto_alloc_size = sizeof(struct am65_cpsw_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct am65_cpsw_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c index 1c11257..68f4191 100644 --- a/drivers/net/ti/cpsw.c +++ b/drivers/net/ti/cpsw.c @@ -456,7 +456,7 @@ static void cpsw_set_slave_mac(struct cpsw_slave *slave, struct cpsw_priv *priv) { #ifdef CONFIG_DM_ETH - struct eth_pdata *pdata = dev_get_platdata(priv->dev); + struct eth_pdata *pdata = dev_get_plat(priv->dev); writel(mac_hi(pdata->enetaddr), &slave->regs->sa_hi); writel(mac_lo(pdata->enetaddr), &slave->regs->sa_lo); @@ -1014,7 +1014,7 @@ int cpsw_register(struct cpsw_platform_data *data) #else static int cpsw_eth_start(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct cpsw_priv *priv = dev_get_priv(dev); return _cpsw_init(priv, pdata->enetaddr); @@ -1176,7 +1176,7 @@ static void cpsw_phy_sel(struct cpsw_priv *priv, const char *compat, static int cpsw_eth_probe(struct udevice *dev) { struct cpsw_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); priv->dev = dev; priv->data = pdata->priv_pdata; @@ -1223,9 +1223,9 @@ static void cpsw_eth_of_parse_slave(struct cpsw_platform_data *data, "max-speed", 0); } -static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) +static int cpsw_eth_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct cpsw_platform_data *data; struct gpio_desc *mode_gpios; int slave_index = 0; @@ -1377,12 +1377,12 @@ U_BOOT_DRIVER(eth_cpsw) = { .id = UCLASS_ETH, #if CONFIG_IS_ENABLED(OF_CONTROL) .of_match = cpsw_eth_ids, - .ofdata_to_platdata = cpsw_eth_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .of_to_plat = cpsw_eth_of_to_plat, + .plat_auto = sizeof(struct eth_pdata), #endif .probe = cpsw_eth_probe, .ops = &cpsw_eth_ops, - .priv_auto_alloc_size = sizeof(struct cpsw_priv), + .priv_auto = sizeof(struct cpsw_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_PRE_RELOC, }; #endif /* CONFIG_DM_ETH */ diff --git a/drivers/net/ti/davinci_emac.c b/drivers/net/ti/davinci_emac.c index 56ea1fe..bfe1b84 100644 --- a/drivers/net/ti/davinci_emac.c +++ b/drivers/net/ti/davinci_emac.c @@ -112,7 +112,7 @@ phy_t phy[CONFIG_SYS_DAVINCI_EMAC_PHY_COUNT]; static int davinci_emac_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); unsigned long mac_hi; unsigned long mac_lo; @@ -865,5 +865,5 @@ U_BOOT_DRIVER(davinci_emac) = { .of_match = davinci_emac_ids, .probe = davinci_emac_probe, .ops = &davinci_emac_ops, - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/ti/keystone_net.c b/drivers/net/ti/keystone_net.c index 50f0d33..35b796c 100644 --- a/drivers/net/ti/keystone_net.c +++ b/drivers/net/ti/keystone_net.c @@ -496,7 +496,7 @@ static void ks2_eth_stop(struct udevice *dev) int ks2_eth_read_rom_hwaddr(struct udevice *dev) { struct ks2_eth_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); u32 maca = 0; u32 macb = 0; @@ -519,7 +519,7 @@ int ks2_eth_read_rom_hwaddr(struct udevice *dev) int ks2_eth_write_hwaddr(struct udevice *dev) { struct ks2_eth_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); writel(mac_hi(pdata->enetaddr), DEVICE_EMACSW_BASE(pdata->iobase, priv->slave_port - 1) + @@ -747,10 +747,10 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave, return 0; } -static int ks2_sl_eth_ofdata_to_platdata(struct udevice *dev) +static int ks2_sl_eth_of_to_plat(struct udevice *dev) { struct ks2_eth_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const void *fdt = gd->fdt_blob; int slave = dev_of_offset(dev); int interfaces; @@ -770,10 +770,10 @@ static int ks2_sl_eth_ofdata_to_platdata(struct udevice *dev) return 0; } -static int ks2_eth_ofdata_to_platdata(struct udevice *dev) +static int ks2_eth_of_to_plat(struct udevice *dev) { struct ks2_eth_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); const void *fdt = gd->fdt_blob; int gbe_0 = -ENODEV; int netcp_devices; @@ -800,12 +800,12 @@ static const struct udevice_id ks2_eth_ids[] = { U_BOOT_DRIVER(eth_ks2_slave) = { .name = "eth_ks2_sl", .id = UCLASS_ETH, - .ofdata_to_platdata = ks2_sl_eth_ofdata_to_platdata, + .of_to_plat = ks2_sl_eth_of_to_plat, .probe = ks2_eth_probe, .remove = ks2_eth_remove, .ops = &ks2_eth_ops, - .priv_auto_alloc_size = sizeof(struct ks2_eth_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ks2_eth_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; @@ -813,11 +813,11 @@ U_BOOT_DRIVER(eth_ks2) = { .name = "eth_ks2", .id = UCLASS_ETH, .of_match = ks2_eth_ids, - .ofdata_to_platdata = ks2_eth_ofdata_to_platdata, + .of_to_plat = ks2_eth_of_to_plat, .probe = ks2_eth_probe, .remove = ks2_eth_remove, .ops = &ks2_eth_ops, - .priv_auto_alloc_size = sizeof(struct ks2_eth_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ks2_eth_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index c436b83..ec48689 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -131,11 +131,17 @@ static int tsec_mcast_addr(struct eth_device *dev, const u8 *mcast_mac, static int tsec_mcast_addr(struct udevice *dev, const u8 *mcast_mac, int join) #endif { - struct tsec_private *priv = (struct tsec_private *)dev->priv; - struct tsec __iomem *regs = priv->regs; + struct tsec_private *priv; + struct tsec __iomem *regs; u32 result, value; u8 whichbit, whichreg; +#ifndef CONFIG_DM_ETH + priv = (struct tsec_private *)dev->priv; +#else + priv = dev_get_priv(dev); +#endif + regs = priv->regs; result = ether_crc(MAC_ADDR_LEN, mcast_mac); whichbit = (result >> 24) & 0x1f; /* the 5 LSB = which bit to set */ whichreg = result >> 29; /* the 3 MSB = which reg to set it in */ @@ -260,12 +266,18 @@ static int tsec_send(struct eth_device *dev, void *packet, int length) static int tsec_send(struct udevice *dev, void *packet, int length) #endif { - struct tsec_private *priv = (struct tsec_private *)dev->priv; - struct tsec __iomem *regs = priv->regs; + struct tsec_private *priv; + struct tsec __iomem *regs; int result = 0; u16 status; int i; +#ifndef CONFIG_DM_ETH + priv = (struct tsec_private *)dev->priv; +#else + priv = dev_get_priv(dev); +#endif + regs = priv->regs; /* Find an empty buffer descriptor */ for (i = 0; in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_READY; @@ -339,7 +351,7 @@ static int tsec_recv(struct eth_device *dev) #else static int tsec_recv(struct udevice *dev, int flags, uchar **packetp) { - struct tsec_private *priv = (struct tsec_private *)dev->priv; + struct tsec_private *priv = (struct tsec_private *)dev_get_priv(dev); struct tsec __iomem *regs = priv->regs; int ret = -1; @@ -368,7 +380,7 @@ static int tsec_recv(struct udevice *dev, int flags, uchar **packetp) static int tsec_free_pkt(struct udevice *dev, uchar *packet, int length) { - struct tsec_private *priv = (struct tsec_private *)dev->priv; + struct tsec_private *priv = (struct tsec_private *)dev_get_priv(dev); u16 status; out_be16(&priv->rxbd[priv->rx_idx].length, 0); @@ -392,8 +404,14 @@ static void tsec_halt(struct eth_device *dev) static void tsec_halt(struct udevice *dev) #endif { - struct tsec_private *priv = (struct tsec_private *)dev->priv; - struct tsec __iomem *regs = priv->regs; + struct tsec_private *priv; + struct tsec __iomem *regs; +#ifndef CONFIG_DM_ETH + priv = (struct tsec_private *)dev->priv; +#else + priv = dev_get_priv(dev); +#endif + regs = priv->regs; clrbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS); setbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS); @@ -560,16 +578,22 @@ static int tsec_init(struct eth_device *dev, struct bd_info *bd) static int tsec_init(struct udevice *dev) #endif { - struct tsec_private *priv = (struct tsec_private *)dev->priv; + struct tsec_private *priv; + struct tsec __iomem *regs; #ifdef CONFIG_DM_ETH - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); #else struct eth_device *pdata = dev; #endif - struct tsec __iomem *regs = priv->regs; u32 tempval; int ret; +#ifndef CONFIG_DM_ETH + priv = (struct tsec_private *)dev->priv; +#else + priv = dev_get_priv(dev); +#endif + regs = priv->regs; /* Make sure the controller is stopped */ tsec_halt(dev); @@ -683,7 +707,8 @@ static int init_phy(struct tsec_private *priv) tsec_configure_serdes(priv); #if defined(CONFIG_DM_ETH) && defined(CONFIG_DM_MDIO) - if (ofnode_valid(ofnode_find_subnode(priv->dev->node, "fixed-link"))) + if (ofnode_valid(ofnode_find_subnode(dev_ofnode(priv->dev), + "fixed-link"))) phydev = phy_connect(NULL, 0, priv->dev, priv->interface); else phydev = dm_eth_phy_connect(priv->dev); @@ -799,7 +824,7 @@ int tsec_standard_init(struct bd_info *bis) #else /* CONFIG_DM_ETH */ int tsec_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct tsec_private *priv = dev_get_priv(dev); struct ofnode_phandle_args phandle_args; u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE; @@ -865,7 +890,7 @@ int tsec_probe(struct udevice *dev) int tsec_remove(struct udevice *dev) { - struct tsec_private *priv = dev->priv; + struct tsec_private *priv = dev_get_priv(dev); free(priv->phydev); mdio_unregister(priv->bus); @@ -904,8 +929,8 @@ U_BOOT_DRIVER(eth_tsec) = { .probe = tsec_probe, .remove = tsec_remove, .ops = &tsec_ops, - .priv_auto_alloc_size = sizeof(struct tsec_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct tsec_private), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif /* CONFIG_DM_ETH */ diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c index 8af3711..343ab69 100644 --- a/drivers/net/xilinx_axi_emac.c +++ b/drivers/net/xilinx_axi_emac.c @@ -425,7 +425,7 @@ static int axi_ethernet_init(struct axidma_priv *priv) static int axiemac_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct axidma_priv *priv = dev_get_priv(dev); struct axi_regs *regs = priv->iobase; @@ -697,7 +697,7 @@ static int axi_emac_probe(struct udevice *dev) priv->bus->write = axiemac_miiphy_write; priv->bus->priv = priv; - ret = mdio_register_seq(priv->bus, dev->seq); + ret = mdio_register_seq(priv->bus, dev_seq(dev)); if (ret) return ret; @@ -726,9 +726,9 @@ static const struct eth_ops axi_emac_ops = { .write_hwaddr = axiemac_write_hwaddr, }; -static int axi_emac_ofdata_to_platdata(struct udevice *dev) +static int axi_emac_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct axidma_priv *priv = dev_get_priv(dev); int node = dev_of_offset(dev); int offset = 0; @@ -787,10 +787,10 @@ U_BOOT_DRIVER(axi_emac) = { .name = "axi_emac", .id = UCLASS_ETH, .of_match = axi_emac_ids, - .ofdata_to_platdata = axi_emac_ofdata_to_platdata, + .of_to_plat = axi_emac_of_to_plat, .probe = axi_emac_probe, .remove = axi_emac_remove, .ops = &axi_emac_ops, - .priv_auto_alloc_size = sizeof(struct axidma_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct axidma_priv), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 64c18ba..6b44753 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -322,7 +322,7 @@ static int setup_phy(struct udevice *dev) static int emaclite_start(struct udevice *dev) { struct xemaclite *emaclite = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct emaclite_regs *regs = emaclite->regs; debug("EmacLite Initialization Started\n"); @@ -457,7 +457,7 @@ static int emaclite_recv(struct udevice *dev, int flags, uchar **packetp) { u32 length, first_read, reg, attempt = 0; void *addr, *ack; - struct xemaclite *emaclite = dev->priv; + struct xemaclite *emaclite = dev_get_priv(dev); struct emaclite_regs *regs = emaclite->regs; struct ethernet_hdr *eth; struct ip_udp_hdr *ip; @@ -568,7 +568,7 @@ static int emaclite_probe(struct udevice *dev) emaclite->bus->write = emaclite_miiphy_write; emaclite->bus->priv = emaclite; - ret = mdio_register_seq(emaclite->bus, dev->seq); + ret = mdio_register_seq(emaclite->bus, dev_seq(dev)); if (ret) return ret; @@ -593,9 +593,9 @@ static const struct eth_ops emaclite_ops = { .stop = emaclite_stop, }; -static int emaclite_ofdata_to_platdata(struct udevice *dev) +static int emaclite_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct xemaclite *emaclite = dev_get_priv(dev); int offset = 0; @@ -631,10 +631,10 @@ U_BOOT_DRIVER(emaclite) = { .name = "emaclite", .id = UCLASS_ETH, .of_match = emaclite_ids, - .ofdata_to_platdata = emaclite_ofdata_to_platdata, + .of_to_plat = emaclite_of_to_plat, .probe = emaclite_probe, .remove = emaclite_remove, .ops = &emaclite_ops, - .priv_auto_alloc_size = sizeof(struct xemaclite), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct xemaclite), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 8afec8b..5cb02bb 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -270,7 +270,7 @@ static int phywrite(struct zynq_gem_priv *priv, u32 phy_addr, static int zynq_gem_setup_mac(struct udevice *dev) { u32 i, macaddrlow, macaddrhigh; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct zynq_gem_priv *priv = dev_get_priv(dev); struct zynq_gem_regs *regs = priv->iobase; @@ -635,7 +635,7 @@ __weak int zynq_board_read_rom_ethaddr(unsigned char *ethaddr) static int zynq_gem_read_rom_mac(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); if (!pdata) return -ENOSYS; @@ -705,7 +705,7 @@ static int zynq_gem_probe(struct udevice *dev) priv->bus->write = zynq_gem_miiphy_write; priv->bus->priv = priv; - ret = mdio_register_seq(priv->bus, dev->seq); + ret = mdio_register_seq(priv->bus, dev_seq(dev)); if (ret) goto err2; @@ -743,9 +743,9 @@ static const struct eth_ops zynq_gem_ops = { .read_rom_hwaddr = zynq_gem_read_rom_mac, }; -static int zynq_gem_ofdata_to_platdata(struct udevice *dev) +static int zynq_gem_of_to_plat(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct zynq_gem_priv *priv = dev_get_priv(dev); struct ofnode_phandle_args phandle_args; const char *phy_mode; @@ -807,10 +807,10 @@ U_BOOT_DRIVER(zynq_gem) = { .name = "zynq_gem", .id = UCLASS_ETH, .of_match = zynq_gem_ids, - .ofdata_to_platdata = zynq_gem_ofdata_to_platdata, + .of_to_plat = zynq_gem_of_to_plat, .probe = zynq_gem_probe, .remove = zynq_gem_remove, .ops = &zynq_gem_ops, - .priv_auto_alloc_size = sizeof(struct zynq_gem_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct zynq_gem_priv), + .plat_auto = sizeof(struct eth_pdata), }; diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index fc64d93..5d6331a 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -673,10 +673,10 @@ int nvme_scan_namespace(void) static int nvme_blk_probe(struct udevice *udev) { struct nvme_dev *ndev = dev_get_priv(udev->parent); - struct blk_desc *desc = dev_get_uclass_platdata(udev); + struct blk_desc *desc = dev_get_uclass_plat(udev); struct nvme_ns *ns = dev_get_priv(udev); u8 flbas; - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; struct nvme_id_ns *id; id = memalign(ndev->page_size, sizeof(struct nvme_id_ns)); @@ -704,7 +704,7 @@ static int nvme_blk_probe(struct udevice *udev) desc->log2blksz = ns->lba_shift; desc->blksz = 1 << ns->lba_shift; desc->bdev = udev; - pplat = dev_get_parent_platdata(udev->parent); + pplat = dev_get_parent_plat(udev->parent); sprintf(desc->vendor, "0x%.4x", pplat->vendor); memcpy(desc->product, ndev->serial, sizeof(ndev->serial)); memcpy(desc->revision, ndev->firmware_rev, sizeof(ndev->firmware_rev)); @@ -719,7 +719,7 @@ static ulong nvme_blk_rw(struct udevice *udev, lbaint_t blknr, struct nvme_ns *ns = dev_get_priv(udev); struct nvme_dev *dev = ns->dev; struct nvme_command c; - struct blk_desc *desc = dev_get_uclass_platdata(udev); + struct blk_desc *desc = dev_get_uclass_plat(udev); int status; u64 prp2; u64 total_len = blkcnt << desc->log2blksz; @@ -795,7 +795,7 @@ U_BOOT_DRIVER(nvme_blk) = { .id = UCLASS_BLK, .probe = nvme_blk_probe, .ops = &nvme_blk_ops, - .priv_auto_alloc_size = sizeof(struct nvme_ns), + .priv_auto = sizeof(struct nvme_ns), }; static int nvme_bind(struct udevice *udev) @@ -869,7 +869,7 @@ U_BOOT_DRIVER(nvme) = { .id = UCLASS_NVME, .bind = nvme_bind, .probe = nvme_probe, - .priv_auto_alloc_size = sizeof(struct nvme_dev), + .priv_auto = sizeof(struct nvme_dev), }; struct pci_device_id nvme_supported[] = { diff --git a/drivers/pch/sandbox_pch.c b/drivers/pch/sandbox_pch.c index 76f5525..37c3689 100644 --- a/drivers/pch/sandbox_pch.c +++ b/drivers/pch/sandbox_pch.c @@ -82,5 +82,5 @@ U_BOOT_DRIVER(sandbox_pch_drv) = { .id = UCLASS_PCH, .of_match = sandbox_pch_ids, .ops = &sandbox_pch_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_pch_priv), + .priv_auto = sizeof(struct sandbox_pch_priv), }; diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c index 5c6e30e..1534efb 100644 --- a/drivers/pci/pci-aardvark.c +++ b/drivers/pci/pci-aardvark.c @@ -638,7 +638,7 @@ static int pcie_advk_probe(struct udevice *dev) dev_warn(pcie->dev, "PCIE Reset on GPIO support is missing\n"); } - pcie->first_busno = dev->seq; + pcie->first_busno = dev_seq(dev); pcie->dev = pci_get_controller(dev); return pcie_advk_setup_hw(pcie); @@ -657,7 +657,7 @@ static int pcie_advk_remove(struct udevice *dev) } /** - * pcie_advk_ofdata_to_platdata() - Translate from DT to device state + * pcie_advk_of_to_plat() - Translate from DT to device state * * @dev: A pointer to the device being operated on * @@ -667,7 +667,7 @@ static int pcie_advk_remove(struct udevice *dev) * * Return: 0 on success, else -EINVAL */ -static int pcie_advk_ofdata_to_platdata(struct udevice *dev) +static int pcie_advk_of_to_plat(struct udevice *dev) { struct pcie_advk *pcie = dev_get_priv(dev); @@ -694,9 +694,9 @@ U_BOOT_DRIVER(pcie_advk) = { .id = UCLASS_PCI, .of_match = pcie_advk_ids, .ops = &pcie_advk_ops, - .ofdata_to_platdata = pcie_advk_ofdata_to_platdata, + .of_to_plat = pcie_advk_of_to_plat, .probe = pcie_advk_probe, .remove = pcie_advk_remove, .flags = DM_FLAG_OS_PREPARE, - .priv_auto_alloc_size = sizeof(struct pcie_advk), + .priv_auto = sizeof(struct pcie_advk), }; diff --git a/drivers/pci/pci-emul-uclass.c b/drivers/pci/pci-emul-uclass.c index a520643..a0b8afb 100644 --- a/drivers/pci/pci-emul-uclass.c +++ b/drivers/pci/pci-emul-uclass.c @@ -82,7 +82,7 @@ uint sandbox_pci_read_bar(u32 barval, int type, uint size) static int sandbox_pci_emul_post_probe(struct udevice *dev) { - struct sandbox_pci_emul_priv *priv = dev->uclass->priv; + struct sandbox_pci_emul_priv *priv = uclass_get_priv(dev->uclass); priv->dev_count++; sandbox_set_enable_pci_map(true); @@ -92,7 +92,7 @@ static int sandbox_pci_emul_post_probe(struct udevice *dev) static int sandbox_pci_emul_pre_remove(struct udevice *dev) { - struct sandbox_pci_emul_priv *priv = dev->uclass->priv; + struct sandbox_pci_emul_priv *priv = uclass_get_priv(dev->uclass); priv->dev_count--; sandbox_set_enable_pci_map(priv->dev_count > 0); @@ -105,14 +105,14 @@ UCLASS_DRIVER(pci_emul) = { .name = "pci_emul", .post_probe = sandbox_pci_emul_post_probe, .pre_remove = sandbox_pci_emul_pre_remove, - .priv_auto_alloc_size = sizeof(struct sandbox_pci_emul_priv), - .per_device_auto_alloc_size = sizeof(struct pci_emul_uc_priv), + .priv_auto = sizeof(struct sandbox_pci_emul_priv), + .per_device_auto = sizeof(struct pci_emul_uc_priv), }; /* - * This uclass is a child of the pci bus. Its platdata is not defined here so - * is defined by its parent, UCLASS_PCI, which uses struct pci_child_platdata. - * See per_child_platdata_auto_alloc_size in UCLASS_DRIVER(pci). + * This uclass is a child of the pci bus. Its plat is not defined here so + * is defined by its parent, UCLASS_PCI, which uses struct pci_child_plat. + * See per_child_plat_auto in UCLASS_DRIVER(pci). */ UCLASS_DRIVER(pci_emul_parent) = { .id = UCLASS_PCI_EMUL_PARENT, diff --git a/drivers/pci/pci-rcar-gen2.c b/drivers/pci/pci-rcar-gen2.c index e76abc1..dc11402 100644 --- a/drivers/pci/pci-rcar-gen2.c +++ b/drivers/pci/pci-rcar-gen2.c @@ -231,7 +231,7 @@ static int rcar_gen2_pci_probe(struct udevice *dev) return 0; } -static int rcar_gen2_pci_ofdata_to_platdata(struct udevice *dev) +static int rcar_gen2_pci_of_to_plat(struct udevice *dev) { struct rcar_gen2_pci_priv *priv = dev_get_priv(dev); @@ -259,6 +259,6 @@ U_BOOT_DRIVER(rcar_gen2_pci) = { .of_match = rcar_gen2_pci_ids, .ops = &rcar_gen2_pci_ops, .probe = rcar_gen2_pci_probe, - .ofdata_to_platdata = rcar_gen2_pci_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct rcar_gen2_pci_priv), + .of_to_plat = rcar_gen2_pci_of_to_plat, + .priv_auto = sizeof(struct rcar_gen2_pci_priv), }; diff --git a/drivers/pci/pci-rcar-gen3.c b/drivers/pci/pci-rcar-gen3.c index 1f51854..0d5b01f 100644 --- a/drivers/pci/pci-rcar-gen3.c +++ b/drivers/pci/pci-rcar-gen3.c @@ -129,7 +129,7 @@ struct rcar_gen3_pcie_priv { static void rcar_rmw32(struct udevice *dev, int where, u32 mask, u32 data) { - struct rcar_gen3_pcie_priv *priv = dev_get_platdata(dev); + struct rcar_gen3_pcie_priv *priv = dev_get_plat(dev); int shift = 8 * (where & 3); clrsetbits_le32(priv->regs + (where & ~3), @@ -138,7 +138,7 @@ static void rcar_rmw32(struct udevice *dev, int where, u32 mask, u32 data) static u32 rcar_read_conf(const struct udevice *dev, int where) { - struct rcar_gen3_pcie_priv *priv = dev_get_platdata(dev); + struct rcar_gen3_pcie_priv *priv = dev_get_plat(dev); int shift = 8 * (where & 3); return readl(priv->regs + (where & ~3)) >> shift; @@ -148,7 +148,7 @@ static int rcar_pcie_config_access(const struct udevice *udev, unsigned char access_type, pci_dev_t bdf, int where, ulong *data) { - struct rcar_gen3_pcie_priv *priv = dev_get_platdata(udev); + struct rcar_gen3_pcie_priv *priv = dev_get_plat(udev); u32 reg = where & ~3; /* Clear errors */ @@ -241,7 +241,7 @@ static int rcar_gen3_pcie_write_config(struct udevice *dev, pci_dev_t bdf, static int rcar_gen3_pcie_wait_for_phyrdy(struct udevice *dev) { - struct rcar_gen3_pcie_priv *priv = dev_get_platdata(dev); + struct rcar_gen3_pcie_priv *priv = dev_get_plat(dev); return wait_for_bit_le32((void *)priv->regs + PCIEPHYSR, PHYRDY, true, 50, false); @@ -249,7 +249,7 @@ static int rcar_gen3_pcie_wait_for_phyrdy(struct udevice *dev) static int rcar_gen3_pcie_wait_for_dl(struct udevice *dev) { - struct rcar_gen3_pcie_priv *priv = dev_get_platdata(dev); + struct rcar_gen3_pcie_priv *priv = dev_get_plat(dev); return wait_for_bit_le32((void *)priv->regs + PCIETSTR, DATA_LINK_ACTIVE, true, 50, false); @@ -257,7 +257,7 @@ static int rcar_gen3_pcie_wait_for_dl(struct udevice *dev) static int rcar_gen3_pcie_hw_init(struct udevice *dev) { - struct rcar_gen3_pcie_priv *priv = dev_get_platdata(dev); + struct rcar_gen3_pcie_priv *priv = dev_get_plat(dev); int ret; /* Begin initialization */ @@ -313,7 +313,7 @@ static int rcar_gen3_pcie_hw_init(struct udevice *dev) static int rcar_gen3_pcie_probe(struct udevice *dev) { - struct rcar_gen3_pcie_priv *priv = dev_get_platdata(dev); + struct rcar_gen3_pcie_priv *priv = dev_get_plat(dev); struct pci_controller *hose = dev_get_uclass_priv(dev); struct clk pci_clk; u32 mask; @@ -372,9 +372,9 @@ static int rcar_gen3_pcie_probe(struct udevice *dev) return 0; } -static int rcar_gen3_pcie_ofdata_to_platdata(struct udevice *dev) +static int rcar_gen3_pcie_of_to_plat(struct udevice *dev) { - struct rcar_gen3_pcie_priv *priv = dev_get_platdata(dev); + struct rcar_gen3_pcie_priv *priv = dev_get_plat(dev); priv->regs = devfdt_get_addr_index(dev, 0); if (!priv->regs) @@ -399,6 +399,6 @@ U_BOOT_DRIVER(rcar_gen3_pcie) = { .of_match = rcar_gen3_pcie_ids, .ops = &rcar_gen3_pcie_ops, .probe = rcar_gen3_pcie_probe, - .ofdata_to_platdata = rcar_gen3_pcie_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct rcar_gen3_pcie_priv), + .of_to_plat = rcar_gen3_pcie_of_to_plat, + .plat_auto = sizeof(struct rcar_gen3_pcie_priv), }; diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index eb07d25..4cdd06b 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -14,6 +14,7 @@ #include <asm/io.h> #include <dm/device-internal.h> #include <dm/lists.h> +#include <dm/uclass-internal.h> #if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP) #include <asm/fsp/fsp_support.h> #endif @@ -49,7 +50,7 @@ struct udevice *pci_get_controller(struct udevice *dev) pci_dev_t dm_pci_get_bdf(const struct udevice *dev) { - struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); + struct pci_child_plat *pplat = dev_get_parent_plat(dev); struct udevice *bus = dev->parent; /* @@ -58,14 +59,14 @@ pci_dev_t dm_pci_get_bdf(const struct udevice *dev) * will produce a bad BDF> * * A common cause of this problem is that this function is called in the - * ofdata_to_platdata() method of @dev. Accessing the PCI bus in that + * of_to_plat() method of @dev. Accessing the PCI bus in that * method is not allowed, since it has not yet been probed. To fix this, * move that access to the probe() method of @dev instead. */ if (!device_active(bus)) log_err("PCI: Device '%s' on unprobed bus '%s'\n", dev->name, bus->name); - return PCI_ADD_BUS(bus->seq, pplat->devfn); + return PCI_ADD_BUS(dev_seq(bus), pplat->devfn); } /** @@ -81,8 +82,8 @@ static int pci_get_bus_max(void) ret = uclass_get(UCLASS_PCI, &uc); uclass_foreach_dev(bus, uc) { - if (bus->seq > ret) - ret = bus->seq; + if (dev_seq(bus) > ret) + ret = dev_seq(bus); } debug("%s: ret=%d\n", __func__, ret); @@ -136,9 +137,9 @@ int pci_bus_find_devfn(const struct udevice *bus, pci_dev_t find_devfn, for (device_find_first_child(bus, &dev); dev; device_find_next_child(&dev)) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); if (pplat && pplat->devfn == find_devfn) { *devp = dev; return 0; @@ -162,10 +163,10 @@ int dm_pci_bus_find_bdf(pci_dev_t bdf, struct udevice **devp) static int pci_device_matches_ids(struct udevice *dev, struct pci_device_id *ids) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; int i; - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); if (!pplat) return -EINVAL; for (i = 0; ids[i].vendor != 0; i++) { @@ -218,13 +219,13 @@ static int dm_pci_bus_find_device(struct udevice *bus, unsigned int vendor, unsigned int device, int *indexp, struct udevice **devp) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; struct udevice *dev; for (device_find_first_child(bus, &dev); dev; device_find_next_child(&dev)) { - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); if (pplat->vendor == vendor && pplat->device == device) { if (!(*indexp)--) { *devp = dev; @@ -261,7 +262,7 @@ int dm_pci_find_class(uint find_class, int index, struct udevice **devp) for (pci_find_first_device(&dev); dev; pci_find_next_device(&dev)) { - struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); + struct pci_child_plat *pplat = dev_get_parent_plat(dev); if (pplat->class == find_class && !index--) { *devp = dev; @@ -513,7 +514,7 @@ static void set_vga_bridge_bits(struct udevice *dev) struct udevice *parent = dev->parent; u16 bc; - while (parent->seq != 0) { + while (dev_seq(parent) != 0) { dm_pci_read_config16(parent, PCI_BRIDGE_CONTROL, &bc); bc |= PCI_BRIDGE_CTL_VGA; dm_pci_write_config16(parent, PCI_BRIDGE_CONTROL, bc); @@ -523,13 +524,13 @@ static void set_vga_bridge_bits(struct udevice *dev) int pci_auto_config_devices(struct udevice *bus) { - struct pci_controller *hose = bus->uclass_priv; - struct pci_child_platdata *pplat; + struct pci_controller *hose = dev_get_uclass_priv(bus); + struct pci_child_plat *pplat; unsigned int sub_bus; struct udevice *dev; int ret; - sub_bus = bus->seq; + sub_bus = dev_seq(bus); debug("%s: start\n", __func__); pciauto_config_init(hose); for (ret = device_find_first_child(bus, &dev); @@ -539,22 +540,22 @@ int pci_auto_config_devices(struct udevice *bus) int ret; debug("%s: device %s\n", __func__, dev->name); - if (dev_of_valid(dev) && + if (dev_has_ofnode(dev) && dev_read_bool(dev, "pci,no-autoconfig")) continue; ret = dm_pciauto_config_device(dev); if (ret < 0) - return ret; + return log_msg_ret("auto", ret); max_bus = ret; sub_bus = max(sub_bus, max_bus); - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); if (pplat->class == (PCI_CLASS_DISPLAY_VGA << 8)) set_vga_bridge_bits(dev); } debug("%s: done\n", __func__); - return sub_bus; + return log_msg_ret("sub", sub_bus); } int pci_generic_mmap_write_config( @@ -641,17 +642,9 @@ int dm_pci_hose_probe_bus(struct udevice *bus) if (ret) { debug("%s: Cannot probe bus %s: %d\n", __func__, bus->name, ret); - return ret; + return log_msg_ret("probe", ret); } - if (!ea_pos) { - if (sub_bus != bus->seq) { - debug("%s: Internal error, bus '%s' got seq %d, expected %d\n", - __func__, bus->name, bus->seq, sub_bus); - return -EPIPE; - } - sub_bus = pci_get_bus_max(); - } dm_pciauto_postscan_setup_bridge(bus, sub_bus); return sub_bus; @@ -714,7 +707,7 @@ static int pci_find_and_bind_driver(struct udevice *parent, if (ofnode_valid(node) && !ofnode_is_available(node)) { debug("%s: Ignoring disabled device\n", __func__); - return -EPERM; + return log_msg_ret("dis", -EPERM); } start = ll_entry_start(struct pci_driver_entry, pci_driver_entry); @@ -740,18 +733,18 @@ static int pci_find_and_bind_driver(struct udevice *parent, */ if (!(gd->flags & GD_FLG_RELOC) && !(drv->flags & DM_FLAG_PRE_RELOC)) - return -EPERM; + return log_msg_ret("pre", -EPERM); /* * We could pass the descriptor to the driver as - * platdata (instead of NULL) and allow its bind() + * plat (instead of NULL) and allow its bind() * method to return -ENOENT if it doesn't support this * device. That way we could continue the search to * find another driver. For now this doesn't seem * necesssary, so just bind the first match. */ - ret = device_bind_ofnode(parent, drv, drv->name, NULL, - node, &dev); + ret = device_bind(parent, drv, drv->name, NULL, node, + &dev); if (ret) goto error; debug("%s: Match found: %s\n", __func__, drv->name); @@ -768,10 +761,10 @@ static int pci_find_and_bind_driver(struct udevice *parent, * limited (ie: using Cache As RAM). */ if (!(gd->flags & GD_FLG_RELOC) && !bridge) - return -EPERM; + return log_msg_ret("notbr", -EPERM); /* Bind a generic driver so that the device can be used */ - sprintf(name, "pci_%x:%x.%x", parent->seq, PCI_DEV(bdf), + sprintf(name, "pci_%x:%x.%x", dev_seq(parent), PCI_DEV(bdf), PCI_FUNC(bdf)); str = strdup(name); if (!str) @@ -803,11 +796,11 @@ int pci_bind_bus_devices(struct udevice *bus) int ret; found_multi = false; - end = PCI_BDF(bus->seq, PCI_MAX_PCI_DEVICES - 1, + end = PCI_BDF(dev_seq(bus), PCI_MAX_PCI_DEVICES - 1, PCI_MAX_PCI_FUNCTIONS - 1); - for (bdf = PCI_BDF(bus->seq, 0, 0); bdf <= end; + for (bdf = PCI_BDF(dev_seq(bus), 0, 0); bdf <= end; bdf += PCI_BDF(0, 0, 1)) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; struct udevice *dev; ulong class; @@ -832,7 +825,7 @@ int pci_bind_bus_devices(struct udevice *bus) found_multi = header_type & 0x80; debug("%s: bus %d/%s: found device %x, function %d", __func__, - bus->seq, bus->name, PCI_DEV(bdf), PCI_FUNC(bdf)); + dev_seq(bus), bus->name, PCI_DEV(bdf), PCI_FUNC(bdf)); pci_bus_read_config(bus, bdf, PCI_DEVICE_ID, &device, PCI_SIZE_16); pci_bus_read_config(bus, bdf, PCI_CLASS_REVISION, &class, @@ -868,7 +861,7 @@ int pci_bind_bus_devices(struct udevice *bus) return ret; /* Update the platform data */ - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); pplat->devfn = PCI_MASK_BUS(bdf); pplat->vendor = vendor; pplat->device = device; @@ -1009,10 +1002,25 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node, static int pci_uclass_pre_probe(struct udevice *bus) { struct pci_controller *hose; + struct uclass *uc; + int ret; - debug("%s, bus=%d/%s, parent=%s\n", __func__, bus->seq, bus->name, + debug("%s, bus=%d/%s, parent=%s\n", __func__, dev_seq(bus), bus->name, bus->parent->name); - hose = bus->uclass_priv; + hose = dev_get_uclass_priv(bus); + + /* + * Set the sequence number, if device_bind() doesn't. We want control + * of this so that numbers are allocated as devices are probed. That + * ensures that sub-bus numbered is correct (sub-buses must get numbers + * higher than their parents) + */ + if (dev_seq(bus) == -1) { + ret = uclass_get(UCLASS_PCI, &uc); + if (ret) + return ret; + bus->seq_ = uclass_find_next_free_seq(uc); + } /* For bridges, use the top-level PCI controller */ if (!device_is_on_pci_bus(bus)) { @@ -1024,10 +1032,11 @@ static int pci_uclass_pre_probe(struct udevice *bus) parent_hose = dev_get_uclass_priv(bus->parent); hose->ctlr = parent_hose->bus; } + hose->bus = bus; - hose->first_busno = bus->seq; - hose->last_busno = bus->seq; - if (dev_of_valid(bus)) { + hose->first_busno = dev_seq(bus); + hose->last_busno = dev_seq(bus); + if (dev_has_ofnode(bus)) { hose->skip_auto_config_until_reloc = dev_read_bool(bus, "u-boot,skip-auto-config-until-reloc"); @@ -1041,17 +1050,17 @@ static int pci_uclass_post_probe(struct udevice *bus) struct pci_controller *hose = dev_get_uclass_priv(bus); int ret; - debug("%s: probing bus %d\n", __func__, bus->seq); + debug("%s: probing bus %d\n", __func__, dev_seq(bus)); ret = pci_bind_bus_devices(bus); if (ret) - return ret; + return log_msg_ret("bind", ret); if (CONFIG_IS_ENABLED(PCI_PNP) && ll_boot_init() && (!hose->skip_auto_config_until_reloc || (gd->flags & GD_FLG_RELOC))) { ret = pci_auto_config_devices(bus); if (ret < 0) - return log_msg_ret("pci auto-config", ret); + return log_msg_ret("cfg", ret); } #if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP) @@ -1068,10 +1077,10 @@ static int pci_uclass_post_probe(struct udevice *bus) * Note we only call this 1) after U-Boot is relocated, and 2) * root bus has finished probing. */ - if ((gd->flags & GD_FLG_RELOC) && bus->seq == 0 && ll_boot_init()) { + if ((gd->flags & GD_FLG_RELOC) && dev_seq(bus) == 0 && ll_boot_init()) { ret = fsp_init_phase_pci(); if (ret) - return ret; + return log_msg_ret("fsp", ret); } #endif @@ -1080,12 +1089,12 @@ static int pci_uclass_post_probe(struct udevice *bus) static int pci_uclass_child_post_bind(struct udevice *dev) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) return 0; - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); /* Extract vendor id and device id if available */ ofnode_read_pci_vendev(dev_ofnode(dev), &pplat->vendor, &pplat->device); @@ -1100,7 +1109,7 @@ static int pci_bridge_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { - struct pci_controller *hose = bus->uclass_priv; + struct pci_controller *hose = dev_get_uclass_priv(bus); return pci_bus_read_config(hose->ctlr, bdf, offset, valuep, size); } @@ -1109,7 +1118,7 @@ static int pci_bridge_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong value, enum pci_size_t size) { - struct pci_controller *hose = bus->uclass_priv; + struct pci_controller *hose = dev_get_uclass_priv(bus); return pci_bus_write_config(hose->ctlr, bdf, offset, value, size); } @@ -1441,7 +1450,7 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr, } static phys_addr_t dm_pci_map_ea_virt(struct udevice *dev, int ea_off, - struct pci_child_platdata *pdata) + struct pci_child_plat *pdata) { phys_addr_t addr = 0; @@ -1472,7 +1481,7 @@ static phys_addr_t dm_pci_map_ea_virt(struct udevice *dev, int ea_off, } static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags, - int ea_off, struct pci_child_platdata *pdata) + int ea_off, struct pci_child_plat *pdata) { int ea_cnt, i, entry_size; int bar_id = (bar - PCI_BASE_ADDRESS_0) >> 2; @@ -1523,7 +1532,7 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags, void *dm_pci_map_bar(struct udevice *dev, int bar, int flags) { - struct pci_child_platdata *pdata = dev_get_parent_platdata(dev); + struct pci_child_plat *pdata = dev_get_parent_plat(dev); struct udevice *udev = dev; pci_addr_t pci_bus_addr; u32 bar_response; @@ -1725,14 +1734,14 @@ int pci_sriov_init(struct udevice *pdev, int vf_en) bdf += PCI_BDF(0, 0, vf_offset); for (vf = 0; vf < num_vfs; vf++) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; ulong class; pci_bus_read_config(bus, bdf, PCI_CLASS_DEVICE, &class, PCI_SIZE_16); debug("%s: bus %d/%s: found VF %x:%x\n", __func__, - bus->seq, bus->name, PCI_DEV(bdf), PCI_FUNC(bdf)); + dev_seq(bus), bus->name, PCI_DEV(bdf), PCI_FUNC(bdf)); /* Find this device in the device tree */ ret = pci_bus_find_devfn(bus, PCI_MASK_BUS(bdf), &dev); @@ -1753,7 +1762,7 @@ int pci_sriov_init(struct udevice *pdev, int vf_en) } /* Update the platform data */ - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); pplat->devfn = PCI_MASK_BUS(bdf); pplat->vendor = vendor; pplat->device = device; @@ -1763,7 +1772,7 @@ int pci_sriov_init(struct udevice *pdev, int vf_en) pplat->virtid = vf * vf_stride + vf_offset; debug("%s: bus %d/%s: found VF %x:%x %x:%x class %lx id %x\n", - __func__, dev->seq, dev->name, PCI_DEV(bdf), + __func__, dev_seq(dev), dev->name, PCI_DEV(bdf), PCI_FUNC(bdf), vendor, device, class, pplat->virtid); bdf += PCI_BDF(0, 0, vf_stride); } @@ -1791,14 +1800,13 @@ int pci_sriov_get_totalvfs(struct udevice *pdev) UCLASS_DRIVER(pci) = { .id = UCLASS_PCI, .name = "pci", - .flags = DM_UC_FLAG_SEQ_ALIAS, + .flags = DM_UC_FLAG_SEQ_ALIAS | DM_UC_FLAG_NO_AUTO_SEQ, .post_bind = dm_scan_fdt_dev, .pre_probe = pci_uclass_pre_probe, .post_probe = pci_uclass_post_probe, .child_post_bind = pci_uclass_child_post_bind, - .per_device_auto_alloc_size = sizeof(struct pci_controller), - .per_child_platdata_auto_alloc_size = - sizeof(struct pci_child_platdata), + .per_device_auto = sizeof(struct pci_controller), + .per_child_plat_auto = sizeof(struct pci_child_plat), }; static const struct dm_pci_ops pci_bridge_ops = { diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 3f46b76..68ef4e8 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -189,8 +189,8 @@ void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) /* Configure bus number registers */ dm_pci_write_config8(dev, PCI_PRIMARY_BUS, - PCI_BUS(dm_pci_get_bdf(dev)) - ctlr->seq); - dm_pci_write_config8(dev, PCI_SECONDARY_BUS, sub_bus - ctlr->seq); + PCI_BUS(dm_pci_get_bdf(dev)) - dev_seq(ctlr)); + dm_pci_write_config8(dev, PCI_SECONDARY_BUS, sub_bus - dev_seq(ctlr)); dm_pci_write_config8(dev, PCI_SUBORDINATE_BUS, 0xff); if (pci_mem) { @@ -265,7 +265,7 @@ void dm_pciauto_postscan_setup_bridge(struct udevice *dev, int sub_bus) pci_io = ctlr_hose->pci_io; /* Configure bus number registers */ - dm_pci_write_config8(dev, PCI_SUBORDINATE_BUS, sub_bus - ctlr->seq); + dm_pci_write_config8(dev, PCI_SUBORDINATE_BUS, sub_bus - dev_seq(ctlr)); if (pci_mem) { /* Round memory allocator to 1MB boundary */ @@ -321,7 +321,7 @@ int dm_pciauto_config_device(struct udevice *dev) bool enum_only = false; struct udevice *ctlr = pci_get_controller(dev); struct pci_controller *ctlr_hose = dev_get_uclass_priv(ctlr); - int n; + int ret; #ifdef CONFIG_PCI_ENUM_ONLY enum_only = true; @@ -341,10 +341,10 @@ int dm_pciauto_config_device(struct udevice *dev) dm_pciauto_setup_device(dev, 2, pci_mem, pci_prefetch, pci_io, enum_only); - n = dm_pci_hose_probe_bus(dev); - if (n < 0) - return n; - sub_bus = (unsigned int)n; + ret = dm_pci_hose_probe_bus(dev); + if (ret < 0) + return log_msg_ret("probe", ret); + sub_bus = ret; break; case PCI_CLASS_BRIDGE_CARDBUS: diff --git a/drivers/pci/pci_mpc85xx.c b/drivers/pci/pci_mpc85xx.c index 6576f53..ab6ff45 100644 --- a/drivers/pci/pci_mpc85xx.c +++ b/drivers/pci/pci_mpc85xx.c @@ -122,7 +122,7 @@ static int mpc85xx_pci_dm_remove(struct udevice *dev) return 0; } -static int mpc85xx_pci_ofdata_to_platdata(struct udevice *dev) +static int mpc85xx_pci_of_to_plat(struct udevice *dev) { struct mpc85xx_pci_priv *priv = dev_get_priv(dev); fdt_addr_t addr; @@ -154,6 +154,6 @@ U_BOOT_DRIVER(mpc85xx_pci) = { .ops = &mpc85xx_pci_ops, .probe = mpc85xx_pci_dm_probe, .remove = mpc85xx_pci_dm_remove, - .ofdata_to_platdata = mpc85xx_pci_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct mpc85xx_pci_priv), + .of_to_plat = mpc85xx_pci_of_to_plat, + .priv_auto = sizeof(struct mpc85xx_pci_priv), }; diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c index c9afe75..cf6e0a2 100644 --- a/drivers/pci/pci_mvebu.c +++ b/drivers/pci/pci_mvebu.c @@ -143,7 +143,7 @@ static int mvebu_pcie_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { - struct mvebu_pcie *pcie = dev_get_platdata(bus); + struct mvebu_pcie *pcie = dev_get_plat(bus); int local_bus = PCI_BUS(pcie->dev); int local_dev = PCI_DEV(pcie->dev); u32 reg; @@ -187,7 +187,7 @@ static int mvebu_pcie_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong value, enum pci_size_t size) { - struct mvebu_pcie *pcie = dev_get_platdata(bus); + struct mvebu_pcie *pcie = dev_get_plat(bus); int local_bus = PCI_BUS(pcie->dev); int local_dev = PCI_DEV(pcie->dev); u32 data; @@ -277,7 +277,7 @@ static void mvebu_pcie_setup_wins(struct mvebu_pcie *pcie) static int mvebu_pcie_probe(struct udevice *dev) { - struct mvebu_pcie *pcie = dev_get_platdata(dev); + struct mvebu_pcie *pcie = dev_get_plat(dev); struct udevice *ctlr = pci_get_controller(dev); struct pci_controller *hose = dev_get_uclass_priv(ctlr); static int bus; @@ -410,9 +410,9 @@ static int mvebu_get_tgt_attr(ofnode node, int devfn, return -ENOENT; } -static int mvebu_pcie_ofdata_to_platdata(struct udevice *dev) +static int mvebu_pcie_of_to_plat(struct udevice *dev) { - struct mvebu_pcie *pcie = dev_get_platdata(dev); + struct mvebu_pcie *pcie = dev_get_plat(dev); int ret = 0; /* Get port number, lane number and memory target / attr */ @@ -470,8 +470,8 @@ static struct driver pcie_mvebu_drv = { .id = UCLASS_PCI, .ops = &mvebu_pcie_ops, .probe = mvebu_pcie_probe, - .ofdata_to_platdata = mvebu_pcie_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct mvebu_pcie), + .of_to_plat = mvebu_pcie_of_to_plat, + .plat_auto = sizeof(struct mvebu_pcie), }; /* @@ -501,8 +501,8 @@ static int mvebu_pcie_bind(struct udevice *parent) return -ENOMEM; /* Create child device UCLASS_PCI and bind it */ - device_bind_ofnode(parent, &pcie_mvebu_drv, pcie->name, pcie, - subnode, &dev); + device_bind(parent, &pcie_mvebu_drv, pcie->name, pcie, subnode, + &dev); } return 0; diff --git a/drivers/pci/pci_octeontx.c b/drivers/pci/pci_octeontx.c index 3053754..1693283 100644 --- a/drivers/pci/pci_octeontx.c +++ b/drivers/pci/pci_octeontx.c @@ -311,7 +311,7 @@ int pci_octeontx_write_config(struct udevice *bus, pci_dev_t bdf, return ret; } -static int pci_octeontx_ofdata_to_platdata(struct udevice *dev) +static int pci_octeontx_of_to_plat(struct udevice *dev) { return 0; } @@ -357,8 +357,8 @@ U_BOOT_DRIVER(pci_octeontx) = { .id = UCLASS_PCI, .of_match = pci_octeontx_ids, .ops = &pci_octeontx_ops, - .ofdata_to_platdata = pci_octeontx_ofdata_to_platdata, + .of_to_plat = pci_octeontx_of_to_plat, .probe = pci_octeontx_probe, - .priv_auto_alloc_size = sizeof(struct octeontx_pci), + .priv_auto = sizeof(struct octeontx_pci), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c index fa29d69..4a21813 100644 --- a/drivers/pci/pci_rom.c +++ b/drivers/pci/pci_rom.c @@ -68,7 +68,7 @@ __weak uint32_t board_map_oprom_vendev(uint32_t vendev) static int pci_rom_probe(struct udevice *dev, struct pci_rom_header **hdrp) { - struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); + struct pci_child_plat *pplat = dev_get_parent_plat(dev); struct pci_rom_header *rom_header; struct pci_rom_data *rom_data; u16 rom_vendor, rom_device; @@ -236,7 +236,7 @@ void setup_video(struct screen_info *screen_info) int dm_pci_run_vga_bios(struct udevice *dev, int (*int15_handler)(void), int exec_method) { - struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); + struct pci_child_plat *pplat = dev_get_parent_plat(dev); struct pci_rom_header *rom = NULL, *ram = NULL; int vesa_mode = -1; bool emulate, alloced; @@ -328,7 +328,7 @@ err: #ifdef CONFIG_DM_VIDEO int vbe_setup_video_priv(struct vesa_mode_info *vesa, struct video_priv *uc_priv, - struct video_uc_platdata *plat) + struct video_uc_plat *plat) { if (!vesa->x_resolution) return log_msg_ret("No x resolution", -ENXIO); @@ -363,7 +363,7 @@ int vbe_setup_video_priv(struct vesa_mode_info *vesa, int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void)) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); int ret; diff --git a/drivers/pci/pci_sandbox.c b/drivers/pci/pci_sandbox.c index 8745f28..ca44d00 100644 --- a/drivers/pci/pci_sandbox.c +++ b/drivers/pci/pci_sandbox.c @@ -128,10 +128,9 @@ U_BOOT_DRIVER(pci_sandbox) = { .of_match = sandbox_pci_ids, .ops = &sandbox_pci_ops, .probe = sandbox_pci_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_pci_priv), + .priv_auto = sizeof(struct sandbox_pci_priv), /* Attach an emulator if we can */ .child_post_bind = dm_scan_fdt_dev, - .per_child_platdata_auto_alloc_size = - sizeof(struct pci_child_platdata), + .per_child_plat_auto = sizeof(struct pci_child_plat), }; diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c index 82f5c59..9cb4414 100644 --- a/drivers/pci/pci_tegra.c +++ b/drivers/pci/pci_tegra.c @@ -1092,7 +1092,7 @@ static const struct tegra_pcie_soc pci_tegra_soc[] = { }, }; -static int pci_tegra_ofdata_to_platdata(struct udevice *dev) +static int pci_tegra_of_to_plat(struct udevice *dev) { struct tegra_pcie *pcie = dev_get_priv(dev); enum tegra_pci_id id; @@ -1197,7 +1197,7 @@ U_BOOT_DRIVER(pci_tegra) = { .id = UCLASS_PCI, .of_match = pci_tegra_ids, .ops = &pci_tegra_ops, - .ofdata_to_platdata = pci_tegra_ofdata_to_platdata, + .of_to_plat = pci_tegra_of_to_plat, .probe = pci_tegra_probe, - .priv_auto_alloc_size = sizeof(struct tegra_pcie), + .priv_auto = sizeof(struct tegra_pcie), }; diff --git a/drivers/pci/pcie_brcmstb.c b/drivers/pci/pcie_brcmstb.c index dade79e..dd2a4ef 100644 --- a/drivers/pci/pcie_brcmstb.c +++ b/drivers/pci/pcie_brcmstb.c @@ -579,7 +579,7 @@ static int brcm_pcie_probe(struct udevice *dev) return 0; } -static int brcm_pcie_ofdata_to_platdata(struct udevice *dev) +static int brcm_pcie_of_to_plat(struct udevice *dev) { struct brcm_pcie *pcie = dev_get_priv(dev); ofnode dn = dev_ofnode(dev); @@ -618,6 +618,6 @@ U_BOOT_DRIVER(pcie_brcm_base) = { .ops = &brcm_pcie_ops, .of_match = brcm_pcie_ids, .probe = brcm_pcie_probe, - .ofdata_to_platdata = brcm_pcie_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct brcm_pcie), + .of_to_plat = brcm_pcie_of_to_plat, + .priv_auto = sizeof(struct brcm_pcie), }; diff --git a/drivers/pci/pcie_dw_mvebu.c b/drivers/pci/pcie_dw_mvebu.c index c773f8d..7ec149d 100644 --- a/drivers/pci/pcie_dw_mvebu.c +++ b/drivers/pci/pcie_dw_mvebu.c @@ -500,13 +500,13 @@ static int pcie_dw_mvebu_probe(struct udevice *dev) debug("PCIE Reset on GPIO support is missing\n"); #endif /* DM_GPIO */ - pcie->first_busno = dev->seq; + pcie->first_busno = dev_seq(dev); /* Don't register host if link is down */ if (!pcie_dw_mvebu_pcie_link_up(pcie->ctrl_base, LINK_SPEED_GEN_3)) { - printf("PCIE-%d: Link down\n", dev->seq); + printf("PCIE-%d: Link down\n", dev_seq(dev)); } else { - printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev->seq, + printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev_seq(dev), pcie_dw_get_link_speed(pcie->ctrl_base), pcie_dw_get_link_width(pcie->ctrl_base), hose->first_busno); @@ -535,7 +535,7 @@ static int pcie_dw_mvebu_probe(struct udevice *dev) } /** - * pcie_dw_mvebu_ofdata_to_platdata() - Translate from DT to device state + * pcie_dw_mvebu_of_to_plat() - Translate from DT to device state * * @dev: A pointer to the device being operated on * @@ -545,7 +545,7 @@ static int pcie_dw_mvebu_probe(struct udevice *dev) * * Return: 0 on success, else -EINVAL */ -static int pcie_dw_mvebu_ofdata_to_platdata(struct udevice *dev) +static int pcie_dw_mvebu_of_to_plat(struct udevice *dev) { struct pcie_dw_mvebu *pcie = dev_get_priv(dev); @@ -578,7 +578,7 @@ U_BOOT_DRIVER(pcie_dw_mvebu) = { .id = UCLASS_PCI, .of_match = pcie_dw_mvebu_ids, .ops = &pcie_dw_mvebu_ops, - .ofdata_to_platdata = pcie_dw_mvebu_ofdata_to_platdata, + .of_to_plat = pcie_dw_mvebu_of_to_plat, .probe = pcie_dw_mvebu_probe, - .priv_auto_alloc_size = sizeof(struct pcie_dw_mvebu), + .priv_auto = sizeof(struct pcie_dw_mvebu), }; diff --git a/drivers/pci/pcie_dw_ti.c b/drivers/pci/pcie_dw_ti.c index 742dd93..5e00fcd 100644 --- a/drivers/pci/pcie_dw_ti.c +++ b/drivers/pci/pcie_dw_ti.c @@ -634,7 +634,7 @@ static int pcie_dw_ti_probe(struct udevice *dev) generic_phy_init(&phy1); generic_phy_power_on(&phy1); - pci->first_busno = dev->seq; + pci->first_busno = dev_seq(dev); pci->dev = dev; pcie_dw_setup_host(pci); @@ -644,11 +644,11 @@ static int pcie_dw_ti_probe(struct udevice *dev) pcie_am654_set_mode(pci, DW_PCIE_RC_TYPE); if (!pcie_dw_ti_pcie_link_up(pci, LINK_SPEED_GEN_2)) { - printf("PCIE-%d: Link down\n", dev->seq); + printf("PCIE-%d: Link down\n", dev_seq(dev)); return -ENODEV; } - printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev->seq, + printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev_seq(dev), pcie_dw_get_link_speed(pci), pcie_dw_get_link_width(pci), hose->first_busno); @@ -671,7 +671,7 @@ static int pcie_dw_ti_probe(struct udevice *dev) } /** - * pcie_dw_ti_ofdata_to_platdata() - Translate from DT to device state + * pcie_dw_ti_of_to_plat() - Translate from DT to device state * * @dev: A pointer to the device being operated on * @@ -681,7 +681,7 @@ static int pcie_dw_ti_probe(struct udevice *dev) * * Return: 0 on success, else -EINVAL */ -static int pcie_dw_ti_ofdata_to_platdata(struct udevice *dev) +static int pcie_dw_ti_of_to_plat(struct udevice *dev) { struct pcie_dw_ti *pcie = dev_get_priv(dev); @@ -724,7 +724,7 @@ U_BOOT_DRIVER(pcie_dw_ti) = { .id = UCLASS_PCI, .of_match = pcie_dw_ti_ids, .ops = &pcie_dw_ti_ops, - .ofdata_to_platdata = pcie_dw_ti_ofdata_to_platdata, + .of_to_plat = pcie_dw_ti_of_to_plat, .probe = pcie_dw_ti_probe, - .priv_auto_alloc_size = sizeof(struct pcie_dw_ti), + .priv_auto = sizeof(struct pcie_dw_ti), }; diff --git a/drivers/pci/pcie_ecam_generic.c b/drivers/pci/pcie_ecam_generic.c index 890b6a8..7d1f13d 100644 --- a/drivers/pci/pcie_ecam_generic.c +++ b/drivers/pci/pcie_ecam_generic.c @@ -113,7 +113,7 @@ static int pci_generic_ecam_write_config(struct udevice *bus, pci_dev_t bdf, } /** - * pci_generic_ecam_ofdata_to_platdata() - Translate from DT to device state + * pci_generic_ecam_of_to_plat() - Translate from DT to device state * @dev: A pointer to the device being operated on * * Translate relevant data from the device tree pertaining to device @dev into @@ -122,7 +122,7 @@ static int pci_generic_ecam_write_config(struct udevice *bus, pci_dev_t bdf, * * Return: 0 on success, else -EINVAL */ -static int pci_generic_ecam_ofdata_to_platdata(struct udevice *dev) +static int pci_generic_ecam_of_to_plat(struct udevice *dev) { struct generic_ecam_pcie *pcie = dev_get_priv(dev); struct fdt_resource reg_res; @@ -146,7 +146,7 @@ static int pci_generic_ecam_probe(struct udevice *dev) { struct generic_ecam_pcie *pcie = dev_get_priv(dev); - pcie->first_busno = dev->seq; + pcie->first_busno = dev_seq(dev); return 0; } @@ -167,6 +167,6 @@ U_BOOT_DRIVER(pci_generic_ecam) = { .of_match = pci_generic_ecam_ids, .ops = &pci_generic_ecam_ops, .probe = pci_generic_ecam_probe, - .ofdata_to_platdata = pci_generic_ecam_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct generic_ecam_pcie), + .of_to_plat = pci_generic_ecam_of_to_plat, + .priv_auto = sizeof(struct generic_ecam_pcie), }; diff --git a/drivers/pci/pcie_fsl.c b/drivers/pci/pcie_fsl.c index fb50b8f..b061b31 100644 --- a/drivers/pci/pcie_fsl.c +++ b/drivers/pci/pcie_fsl.c @@ -29,16 +29,16 @@ static int fsl_pcie_addr_valid(struct fsl_pcie *pcie, pci_dev_t bdf) if (!pcie->enabled) return -ENXIO; - if (PCI_BUS(bdf) < bus->seq) + if (PCI_BUS(bdf) < dev_seq(bus)) return -EINVAL; - if (PCI_BUS(bdf) > bus->seq && (!fsl_pcie_link_up(pcie) || pcie->mode)) + if (PCI_BUS(bdf) > dev_seq(bus) && (!fsl_pcie_link_up(pcie) || pcie->mode)) return -EINVAL; - if (PCI_BUS(bdf) == bus->seq && (PCI_DEV(bdf) > 0 || PCI_FUNC(bdf) > 0)) + if (PCI_BUS(bdf) == dev_seq(bus) && (PCI_DEV(bdf) > 0 || PCI_FUNC(bdf) > 0)) return -EINVAL; - if (PCI_BUS(bdf) == (bus->seq + 1) && (PCI_DEV(bdf) > 0)) + if (PCI_BUS(bdf) == (dev_seq(bus) + 1) && (PCI_DEV(bdf) > 0)) return -EINVAL; return 0; @@ -57,7 +57,7 @@ static int fsl_pcie_read_config(const struct udevice *bus, pci_dev_t bdf, return 0; } - bdf = bdf - PCI_BDF(bus->seq, 0, 0); + bdf = bdf - PCI_BDF(dev_seq(bus), 0, 0); val = bdf | (offset & 0xfc) | ((offset & 0xf00) << 16) | 0x80000000; out_be32(®s->cfg_addr, val); @@ -93,7 +93,7 @@ static int fsl_pcie_write_config(struct udevice *bus, pci_dev_t bdf, if (fsl_pcie_addr_valid(pcie, bdf)) return 0; - bdf = bdf - PCI_BDF(bus->seq, 0, 0); + bdf = bdf - PCI_BDF(dev_seq(bus), 0, 0); val = bdf | (offset & 0xfc) | ((offset & 0xf00) << 16) | 0x80000000; out_be32(®s->cfg_addr, val); @@ -123,7 +123,7 @@ static int fsl_pcie_hose_read_config(struct fsl_pcie *pcie, uint offset, int ret; struct udevice *bus = pcie->bus; - ret = fsl_pcie_read_config(bus, PCI_BDF(bus->seq, 0, 0), + ret = fsl_pcie_read_config(bus, PCI_BDF(dev_seq(bus), 0, 0), offset, valuep, size); return ret; @@ -134,7 +134,7 @@ static int fsl_pcie_hose_write_config(struct fsl_pcie *pcie, uint offset, { struct udevice *bus = pcie->bus; - return fsl_pcie_write_config(bus, PCI_BDF(bus->seq, 0, 0), + return fsl_pcie_write_config(bus, PCI_BDF(dev_seq(bus), 0, 0), offset, value, size); } @@ -593,7 +593,7 @@ static int fsl_pcie_probe(struct udevice *dev) return 0; } -static int fsl_pcie_ofdata_to_platdata(struct udevice *dev) +static int fsl_pcie_of_to_plat(struct udevice *dev) { struct fsl_pcie *pcie = dev_get_priv(dev); struct fsl_pcie_data *info; @@ -661,7 +661,7 @@ U_BOOT_DRIVER(fsl_pcie) = { .id = UCLASS_PCI, .of_match = fsl_pcie_ids, .ops = &fsl_pcie_ops, - .ofdata_to_platdata = fsl_pcie_ofdata_to_platdata, + .of_to_plat = fsl_pcie_of_to_plat, .probe = fsl_pcie_probe, - .priv_auto_alloc_size = sizeof(struct fsl_pcie), + .priv_auto = sizeof(struct fsl_pcie), }; diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c index cbf1237..d9c2325 100644 --- a/drivers/pci/pcie_imx.c +++ b/drivers/pci/pcie_imx.c @@ -799,7 +799,7 @@ static int imx_pcie_dm_remove(struct udevice *dev) return 0; } -static int imx_pcie_ofdata_to_platdata(struct udevice *dev) +static int imx_pcie_of_to_plat(struct udevice *dev) { struct imx_pcie_priv *priv = dev_get_priv(dev); @@ -829,8 +829,8 @@ U_BOOT_DRIVER(imx_pcie) = { .ops = &imx_pcie_ops, .probe = imx_pcie_dm_probe, .remove = imx_pcie_dm_remove, - .ofdata_to_platdata = imx_pcie_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct imx_pcie_priv), + .of_to_plat = imx_pcie_of_to_plat, + .priv_auto = sizeof(struct imx_pcie_priv), .flags = DM_FLAG_OS_PREPARE, }; #endif diff --git a/drivers/pci/pcie_intel_fpga.c b/drivers/pci/pcie_intel_fpga.c index 9f102c6..b496475 100644 --- a/drivers/pci/pcie_intel_fpga.c +++ b/drivers/pci/pcie_intel_fpga.c @@ -369,7 +369,7 @@ static int pcie_intel_fpga_probe(struct udevice *dev) struct intel_fpga_pcie *pcie = dev_get_priv(dev); pcie->bus = pci_get_controller(dev); - pcie->first_busno = dev->seq; + pcie->first_busno = dev_seq(dev); /* clear all interrupts */ cra_writel(pcie, P2A_INT_STS_ALL, P2A_INT_STATUS); @@ -379,7 +379,7 @@ static int pcie_intel_fpga_probe(struct udevice *dev) return 0; } -static int pcie_intel_fpga_ofdata_to_platdata(struct udevice *dev) +static int pcie_intel_fpga_of_to_plat(struct udevice *dev) { struct intel_fpga_pcie *pcie = dev_get_priv(dev); struct fdt_resource reg_res; @@ -428,7 +428,7 @@ U_BOOT_DRIVER(pcie_intel_fpga) = { .id = UCLASS_PCI, .of_match = pcie_intel_fpga_ids, .ops = &pcie_intel_fpga_ops, - .ofdata_to_platdata = pcie_intel_fpga_ofdata_to_platdata, + .of_to_plat = pcie_intel_fpga_of_to_plat, .probe = pcie_intel_fpga_probe, - .priv_auto_alloc_size = sizeof(struct intel_fpga_pcie), + .priv_auto = sizeof(struct intel_fpga_pcie), }; diff --git a/drivers/pci/pcie_iproc.c b/drivers/pci/pcie_iproc.c index d77735f..6725ff6 100644 --- a/drivers/pci/pcie_iproc.c +++ b/drivers/pci/pcie_iproc.c @@ -1282,6 +1282,6 @@ U_BOOT_DRIVER(pci_iproc) = { .ops = &iproc_pcie_ops, .probe = iproc_pcie_probe, .remove = iproc_pcie_remove, - .priv_auto_alloc_size = sizeof(struct iproc_pcie), + .priv_auto = sizeof(struct iproc_pcie), .flags = DM_REMOVE_OS_PREPARE, }; diff --git a/drivers/pci/pcie_layerscape_ep.c b/drivers/pci/pcie_layerscape_ep.c index d7d4a44..041a526 100644 --- a/drivers/pci/pcie_layerscape_ep.c +++ b/drivers/pci/pcie_layerscape_ep.c @@ -332,5 +332,5 @@ U_BOOT_DRIVER(pci_layerscape_ep) = { .ops = &ls_pcie_ep_ops, .probe = ls_pcie_ep_probe, .remove = ls_pcie_ep_remove, - .priv_auto_alloc_size = sizeof(struct ls_pcie_ep), + .priv_auto = sizeof(struct ls_pcie_ep), }; diff --git a/drivers/pci/pcie_layerscape_fixup.c b/drivers/pci/pcie_layerscape_fixup.c index c75cf26..a58e7a3 100644 --- a/drivers/pci/pcie_layerscape_fixup.c +++ b/drivers/pci/pcie_layerscape_fixup.c @@ -479,7 +479,7 @@ static int fdt_fixup_pci_vfs(void *blob, struct extra_iommu_entry *entry, for (bus = dev; device_is_on_pci_bus(bus);) bus = bus->parent; - bdf = entry->bdf - PCI_BDF(bus->seq, 0, 0) + (vf_offset << 8); + bdf = entry->bdf - PCI_BDF(dev_seq(bus), 0, 0) + (vf_offset << 8); for (i = 0; i < entry->num_vfs; i++) { if (fdt_fixup_pcie_device_ls(blob, bdf, pcie_rc) < 0) @@ -518,7 +518,7 @@ static void fdt_fixup_pcie_ls(void *blob) pcie_rc = dev_get_priv(bus); /* the DT fixup must be relative to the hose first_busno */ - bdf = dm_pci_get_bdf(dev) - PCI_BDF(bus->seq, 0, 0); + bdf = dm_pci_get_bdf(dev) - PCI_BDF(dev_seq(bus), 0, 0); if (fdt_fixup_pcie_device_ls(blob, bdf, pcie_rc) < 0) break; diff --git a/drivers/pci/pcie_layerscape_gen4.c b/drivers/pci/pcie_layerscape_gen4.c index 6e71173..be9cb62 100644 --- a/drivers/pci/pcie_layerscape_gen4.c +++ b/drivers/pci/pcie_layerscape_gen4.c @@ -191,13 +191,13 @@ static int ls_pcie_g4_addr_valid(struct ls_pcie_g4 *pcie, pci_dev_t bdf) if (!pcie->enabled) return -ENXIO; - if (PCI_BUS(bdf) < bus->seq) + if (PCI_BUS(bdf) < dev_seq(bus)) return -EINVAL; - if ((PCI_BUS(bdf) > bus->seq) && (!ls_pcie_g4_link_up(pcie))) + if ((PCI_BUS(bdf) > dev_seq(bus)) && (!ls_pcie_g4_link_up(pcie))) return -EINVAL; - if (PCI_BUS(bdf) <= (bus->seq + 1) && (PCI_DEV(bdf) > 0)) + if (PCI_BUS(bdf) <= (dev_seq(bus) + 1) && (PCI_DEV(bdf) > 0)) return -EINVAL; return 0; @@ -209,7 +209,7 @@ void *ls_pcie_g4_conf_address(struct ls_pcie_g4 *pcie, pci_dev_t bdf, struct udevice *bus = pcie->bus; u32 target; - if (PCI_BUS(bdf) == bus->seq) { + if (PCI_BUS(bdf) == dev_seq(bus)) { if (offset < INDIRECT_ADDR_BNDRY) { ccsr_set_page(pcie, 0); return pcie->ccsr + offset; @@ -219,7 +219,7 @@ void *ls_pcie_g4_conf_address(struct ls_pcie_g4 *pcie, pci_dev_t bdf, return pcie->ccsr + OFFSET_TO_PAGE_ADDR(offset); } - target = PAB_TARGET_BUS(PCI_BUS(bdf) - bus->seq) | + target = PAB_TARGET_BUS(PCI_BUS(bdf) - dev_seq(bus)) | PAB_TARGET_DEV(PCI_DEV(bdf)) | PAB_TARGET_FUNC(PCI_FUNC(bdf)); @@ -580,5 +580,5 @@ U_BOOT_DRIVER(pcie_layerscape_gen4) = { .of_match = ls_pcie_g4_ids, .ops = &ls_pcie_g4_ops, .probe = ls_pcie_g4_probe, - .priv_auto_alloc_size = sizeof(struct ls_pcie_g4), + .priv_auto = sizeof(struct ls_pcie_g4), }; diff --git a/drivers/pci/pcie_layerscape_gen4_fixup.c b/drivers/pci/pcie_layerscape_gen4_fixup.c index 148b5d1..e9ee155 100644 --- a/drivers/pci/pcie_layerscape_gen4_fixup.c +++ b/drivers/pci/pcie_layerscape_gen4_fixup.c @@ -166,7 +166,7 @@ static void fdt_fixup_pcie_ls_gen4(void *blob) } /* the DT fixup must be relative to the hose first_busno */ - bdf = dm_pci_get_bdf(dev) - PCI_BDF(bus->seq, 0, 0); + bdf = dm_pci_get_bdf(dev) - PCI_BDF(dev_seq(bus), 0, 0); /* map PCI b.d.f to streamID in LUT */ ls_pcie_g4_lut_set_mapping(pcie, index, bdf >> 8, streamid); /* update msi-map in device tree */ diff --git a/drivers/pci/pcie_layerscape_rc.c b/drivers/pci/pcie_layerscape_rc.c index cdfcad6..517e7b5 100644 --- a/drivers/pci/pcie_layerscape_rc.c +++ b/drivers/pci/pcie_layerscape_rc.c @@ -130,13 +130,13 @@ static int ls_pcie_addr_valid(struct ls_pcie_rc *pcie_rc, pci_dev_t bdf) if (!pcie_rc->enabled) return -ENXIO; - if (PCI_BUS(bdf) < bus->seq) + if (PCI_BUS(bdf) < dev_seq(bus)) return -EINVAL; - if ((PCI_BUS(bdf) > bus->seq) && (!ls_pcie_link_up(pcie))) + if ((PCI_BUS(bdf) > dev_seq(bus)) && (!ls_pcie_link_up(pcie))) return -EINVAL; - if (PCI_BUS(bdf) <= (bus->seq + 1) && (PCI_DEV(bdf) > 0)) + if (PCI_BUS(bdf) <= (dev_seq(bus) + 1) && (PCI_DEV(bdf) > 0)) return -EINVAL; return 0; @@ -152,16 +152,16 @@ int ls_pcie_conf_address(const struct udevice *bus, pci_dev_t bdf, if (ls_pcie_addr_valid(pcie_rc, bdf)) return -EINVAL; - if (PCI_BUS(bdf) == bus->seq) { + if (PCI_BUS(bdf) == dev_seq(bus)) { *paddress = pcie->dbi + offset; return 0; } - busdev = PCIE_ATU_BUS(PCI_BUS(bdf) - bus->seq) | + busdev = PCIE_ATU_BUS(PCI_BUS(bdf) - dev_seq(bus)) | PCIE_ATU_DEV(PCI_DEV(bdf)) | PCIE_ATU_FUNC(PCI_FUNC(bdf)); - if (PCI_BUS(bdf) == bus->seq + 1) { + if (PCI_BUS(bdf) == dev_seq(bus) + 1) { ls_pcie_cfg0_set_busdev(pcie_rc, busdev); *paddress = pcie_rc->cfg0 + offset; } else { @@ -383,5 +383,5 @@ U_BOOT_DRIVER(pci_layerscape) = { .of_match = ls_pcie_ids, .ops = &ls_pcie_ops, .probe = ls_pcie_probe, - .priv_auto_alloc_size = sizeof(struct ls_pcie_rc), + .priv_auto = sizeof(struct ls_pcie_rc), }; diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c index 55b6a40..f555671 100644 --- a/drivers/pci/pcie_mediatek.c +++ b/drivers/pci/pcie_mediatek.c @@ -251,7 +251,7 @@ static struct mtk_pcie_port *mtk_pcie_find_port(const struct udevice *bus, struct mtk_pcie *pcie = dev_get_priv(bus); struct mtk_pcie_port *port; struct udevice *dev; - struct pci_child_platdata *pplat = NULL; + struct pci_child_plat *pplat = NULL; int ret = 0; if (PCI_BUS(bdf) != 0) { @@ -261,10 +261,10 @@ static struct mtk_pcie_port *mtk_pcie_find_port(const struct udevice *bus, return NULL; } - while (dev->parent->seq != 0) + while (dev_seq(dev->parent) != 0) dev = dev->parent; - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); } list_for_each_entry(port, &pcie->ports, list) { @@ -728,7 +728,7 @@ U_BOOT_DRIVER(pcie_mediatek_v1) = { .of_match = mtk_pcie_ids, .ops = &mtk_pcie_ops, .probe = mtk_pcie_probe, - .priv_auto_alloc_size = sizeof(struct mtk_pcie), + .priv_auto = sizeof(struct mtk_pcie), }; static const struct udevice_id mtk_pcie_ids_v2[] = { @@ -742,5 +742,5 @@ U_BOOT_DRIVER(pcie_mediatek_v2) = { .of_match = mtk_pcie_ids_v2, .ops = &mtk_pcie_ops_v2, .probe = mtk_pcie_probe_v2, - .priv_auto_alloc_size = sizeof(struct mtk_pcie), + .priv_auto = sizeof(struct mtk_pcie), }; diff --git a/drivers/pci/pcie_phytium.c b/drivers/pci/pcie_phytium.c index 51b2171..03ea04c 100644 --- a/drivers/pci/pcie_phytium.c +++ b/drivers/pci/pcie_phytium.c @@ -147,7 +147,7 @@ static int pci_phytium_write_config(struct udevice *bus, pci_dev_t bdf, } /** - * pci_phytium_ofdata_to_platdata() - Translate from DT to device state + * pci_phytium_of_to_plat() - Translate from DT to device state * @dev: A pointer to the device being operated on * * Translate relevant data from the device tree pertaining to device @dev into @@ -156,7 +156,7 @@ static int pci_phytium_write_config(struct udevice *bus, pci_dev_t bdf, * * Return: 0 on success, else -EINVAL */ -static int pci_phytium_ofdata_to_platdata(struct udevice *dev) +static int pci_phytium_of_to_plat(struct udevice *dev) { struct phytium_pcie *pcie = dev_get_priv(dev); struct fdt_resource reg_res; @@ -194,6 +194,6 @@ U_BOOT_DRIVER(pci_phytium) = { .id = UCLASS_PCI, .of_match = pci_phytium_ids, .ops = &pci_phytium_ops, - .ofdata_to_platdata = pci_phytium_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct phytium_pcie), + .of_to_plat = pci_phytium_of_to_plat, + .priv_auto = sizeof(struct phytium_pcie), }; diff --git a/drivers/pci/pcie_rockchip.c b/drivers/pci/pcie_rockchip.c index 04609f1..027745e 100644 --- a/drivers/pci/pcie_rockchip.c +++ b/drivers/pci/pcie_rockchip.c @@ -373,7 +373,7 @@ static int rockchip_pcie_init_port(struct udevice *dev) /* Configure Address Translation. */ ret = rockchip_pcie_atr_init(priv); if (ret) { - dev_err(dev, "PCIE-%d: ATR init failed\n", dev->seq); + dev_err(dev, "PCIE-%d: ATR init failed\n", dev_seq(dev)); goto err_power_off_phy; } @@ -528,7 +528,7 @@ static int rockchip_pcie_probe(struct udevice *dev) struct pci_controller *hose = dev_get_uclass_priv(ctlr); int ret; - priv->first_busno = dev->seq; + priv->first_busno = dev_seq(dev); priv->dev = dev; ret = rockchip_pcie_parse_dt(dev); @@ -544,7 +544,7 @@ static int rockchip_pcie_probe(struct udevice *dev) return ret; dev_info(dev, "PCIE-%d: Link up (Bus%d)\n", - dev->seq, hose->first_busno); + dev_seq(dev), hose->first_busno); return 0; } @@ -565,5 +565,5 @@ U_BOOT_DRIVER(rockchip_pcie) = { .of_match = rockchip_pcie_ids, .ops = &rockchip_pcie_ops, .probe = rockchip_pcie_probe, - .priv_auto_alloc_size = sizeof(struct rockchip_pcie), + .priv_auto = sizeof(struct rockchip_pcie), }; diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c index 713ad49..00879a2 100644 --- a/drivers/pci/pcie_xilinx.c +++ b/drivers/pci/pcie_xilinx.c @@ -129,7 +129,7 @@ static int pcie_xilinx_write_config(struct udevice *bus, pci_dev_t bdf, } /** - * pcie_xilinx_ofdata_to_platdata() - Translate from DT to device state + * pcie_xilinx_of_to_plat() - Translate from DT to device state * @dev: A pointer to the device being operated on * * Translate relevant data from the device tree pertaining to device @dev into @@ -138,7 +138,7 @@ static int pcie_xilinx_write_config(struct udevice *bus, pci_dev_t bdf, * * Return: 0 on success, else -EINVAL */ -static int pcie_xilinx_ofdata_to_platdata(struct udevice *dev) +static int pcie_xilinx_of_to_plat(struct udevice *dev) { struct xilinx_pcie *pcie = dev_get_priv(dev); struct fdt_resource reg_res; @@ -174,6 +174,6 @@ U_BOOT_DRIVER(pcie_xilinx) = { .id = UCLASS_PCI, .of_match = pcie_xilinx_ids, .ops = &pcie_xilinx_ops, - .ofdata_to_platdata = pcie_xilinx_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct xilinx_pcie), + .of_to_plat = pcie_xilinx_of_to_plat, + .priv_auto = sizeof(struct xilinx_pcie), }; diff --git a/drivers/pci_endpoint/pcie-cadence-ep.c b/drivers/pci_endpoint/pcie-cadence-ep.c index 74dfdde..7313428 100644 --- a/drivers/pci_endpoint/pcie-cadence-ep.c +++ b/drivers/pci_endpoint/pcie-cadence-ep.c @@ -173,5 +173,5 @@ U_BOOT_DRIVER(cdns_pcie) = { .ops = &cdns_pci_ep_ops, .probe = cdns_pci_ep_probe, .remove = cdns_pci_ep_remove, - .priv_auto_alloc_size = sizeof(struct cdns_pcie), + .priv_auto = sizeof(struct cdns_pcie), }; diff --git a/drivers/pci_endpoint/sandbox-pci_ep.c b/drivers/pci_endpoint/sandbox-pci_ep.c index 8e05d5b..de148cd 100644 --- a/drivers/pci_endpoint/sandbox-pci_ep.c +++ b/drivers/pci_endpoint/sandbox-pci_ep.c @@ -175,5 +175,5 @@ U_BOOT_DRIVER(pci_ep_sandbox) = { .of_match = sandbox_pci_ep_ids, .probe = sandbox_pci_ep_probe, .ops = &sandbox_pci_ep_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_pci_ep_priv), + .priv_auto = sizeof(struct sandbox_pci_ep_priv), }; diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index 7b9d3ee..5723c98 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -428,7 +428,7 @@ static struct phy_ops sun4i_usb_phy_ops = { static int sun4i_usb_phy_probe(struct udevice *dev) { - struct sun4i_usb_phy_plat *plat = dev_get_platdata(dev); + struct sun4i_usb_phy_plat *plat = dev_get_plat(dev); struct sun4i_usb_phy_data *data = dev_get_priv(dev); int i, ret; @@ -646,6 +646,6 @@ U_BOOT_DRIVER(sun4i_usb_phy) = { .of_match = sun4i_usb_phy_ids, .ops = &sun4i_usb_phy_ops, .probe = sun4i_usb_phy_probe, - .platdata_auto_alloc_size = sizeof(struct sun4i_usb_phy_plat[MAX_PHYS]), - .priv_auto_alloc_size = sizeof(struct sun4i_usb_phy_data), + .plat_auto = sizeof(struct sun4i_usb_phy_plat[MAX_PHYS]), + .priv_auto = sizeof(struct sun4i_usb_phy_data), }; diff --git a/drivers/phy/bcm6318-usbh-phy.c b/drivers/phy/bcm6318-usbh-phy.c index d29344d..60608a5 100644 --- a/drivers/phy/bcm6318-usbh-phy.c +++ b/drivers/phy/bcm6318-usbh-phy.c @@ -138,6 +138,6 @@ U_BOOT_DRIVER(bcm6318_usbh) = { .id = UCLASS_PHY, .of_match = bcm6318_usbh_ids, .ops = &bcm6318_usbh_ops, - .priv_auto_alloc_size = sizeof(struct bcm6318_usbh_priv), + .priv_auto = sizeof(struct bcm6318_usbh_priv), .probe = bcm6318_usbh_probe, }; diff --git a/drivers/phy/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c index 8d28292..1b6b5ad 100644 --- a/drivers/phy/bcm6348-usbh-phy.c +++ b/drivers/phy/bcm6348-usbh-phy.c @@ -87,6 +87,6 @@ U_BOOT_DRIVER(bcm6348_usbh) = { .id = UCLASS_PHY, .of_match = bcm6348_usbh_ids, .ops = &bcm6348_usbh_ops, - .priv_auto_alloc_size = sizeof(struct bcm6348_usbh_priv), + .priv_auto = sizeof(struct bcm6348_usbh_priv), .probe = bcm6348_usbh_probe, }; diff --git a/drivers/phy/bcm6358-usbh-phy.c b/drivers/phy/bcm6358-usbh-phy.c index 501b97f..bfdcfb0 100644 --- a/drivers/phy/bcm6358-usbh-phy.c +++ b/drivers/phy/bcm6358-usbh-phy.c @@ -87,6 +87,6 @@ U_BOOT_DRIVER(bcm6358_usbh) = { .id = UCLASS_PHY, .of_match = bcm6358_usbh_ids, .ops = &bcm6358_usbh_ops, - .priv_auto_alloc_size = sizeof(struct bcm6358_usbh_priv), + .priv_auto = sizeof(struct bcm6358_usbh_priv), .probe = bcm6358_usbh_probe, }; diff --git a/drivers/phy/bcm6368-usbh-phy.c b/drivers/phy/bcm6368-usbh-phy.c index 99fdd33..4d3a63f 100644 --- a/drivers/phy/bcm6368-usbh-phy.c +++ b/drivers/phy/bcm6368-usbh-phy.c @@ -191,6 +191,6 @@ U_BOOT_DRIVER(bcm6368_usbh) = { .id = UCLASS_PHY, .of_match = bcm6368_usbh_ids, .ops = &bcm6368_usbh_ops, - .priv_auto_alloc_size = sizeof(struct bcm6368_usbh_priv), + .priv_auto = sizeof(struct bcm6368_usbh_priv), .probe = bcm6368_usbh_probe, }; diff --git a/drivers/phy/keystone-usb-phy.c b/drivers/phy/keystone-usb-phy.c index 9faf501..12f8a26 100644 --- a/drivers/phy/keystone-usb-phy.c +++ b/drivers/phy/keystone-usb-phy.c @@ -130,5 +130,5 @@ U_BOOT_DRIVER(keystone_usb_phy) = { .of_match = keystone_usb_phy_ids, .ops = &keystone_usb_phy_ops, .probe = keystone_usb_phy_probe, - .priv_auto_alloc_size = sizeof(struct keystone_usb_phy), + .priv_auto = sizeof(struct keystone_usb_phy), }; diff --git a/drivers/phy/marvell/comphy_core.c b/drivers/phy/marvell/comphy_core.c index 5e8ce74..b220327 100644 --- a/drivers/phy/marvell/comphy_core.c +++ b/drivers/phy/marvell/comphy_core.c @@ -189,5 +189,5 @@ U_BOOT_DRIVER(mvebu_comphy) = { .id = UCLASS_MISC, .of_match = comphy_ids, .probe = comphy_probe, - .priv_auto_alloc_size = sizeof(struct chip_serdes_phy_config), + .priv_auto = sizeof(struct chip_serdes_phy_config), }; diff --git a/drivers/phy/meson-g12a-usb2.c b/drivers/phy/meson-g12a-usb2.c index 447ce72..2fbba7f 100644 --- a/drivers/phy/meson-g12a-usb2.c +++ b/drivers/phy/meson-g12a-usb2.c @@ -215,5 +215,5 @@ U_BOOT_DRIVER(meson_g12a_usb2_phy) = { .of_match = meson_g12a_usb2_phy_ids, .probe = meson_g12a_usb2_phy_probe, .ops = &meson_g12a_usb2_phy_ops, - .priv_auto_alloc_size = sizeof(struct phy_meson_g12a_usb2_priv), + .priv_auto = sizeof(struct phy_meson_g12a_usb2_priv), }; diff --git a/drivers/phy/meson-g12a-usb3-pcie.c b/drivers/phy/meson-g12a-usb3-pcie.c index 4e9696f..0433d93 100644 --- a/drivers/phy/meson-g12a-usb3-pcie.c +++ b/drivers/phy/meson-g12a-usb3-pcie.c @@ -343,5 +343,5 @@ U_BOOT_DRIVER(meson_g12a_usb3_pcie_phy) = { .of_match = meson_g12a_usb3_pcie_phy_ids, .probe = meson_g12a_usb3_pcie_phy_probe, .ops = &meson_g12a_usb3_pcie_phy_ops, - .priv_auto_alloc_size = sizeof(struct phy_g12a_usb3_pcie_priv), + .priv_auto = sizeof(struct phy_g12a_usb3_pcie_priv), }; diff --git a/drivers/phy/meson-gxbb-usb2.c b/drivers/phy/meson-gxbb-usb2.c index d1beebe..7a2e3d2 100644 --- a/drivers/phy/meson-gxbb-usb2.c +++ b/drivers/phy/meson-gxbb-usb2.c @@ -232,5 +232,5 @@ U_BOOT_DRIVER(meson_gxbb_usb2_phy) = { .probe = meson_gxbb_usb2_phy_probe, .remove = meson_gxbb_usb2_phy_remove, .ops = &meson_gxbb_usb2_phy_ops, - .priv_auto_alloc_size = sizeof(struct phy_meson_gxbb_usb2_priv), + .priv_auto = sizeof(struct phy_meson_gxbb_usb2_priv), }; diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c index 2267bd0..9fb376c 100644 --- a/drivers/phy/meson-gxl-usb2.c +++ b/drivers/phy/meson-gxl-usb2.c @@ -251,5 +251,5 @@ U_BOOT_DRIVER(meson_gxl_usb2_phy) = { .of_match = meson_gxl_usb2_phy_ids, .probe = meson_gxl_usb2_phy_probe, .ops = &meson_gxl_usb2_phy_ops, - .priv_auto_alloc_size = sizeof(struct phy_meson_gxl_usb2_priv), + .priv_auto = sizeof(struct phy_meson_gxl_usb2_priv), }; diff --git a/drivers/phy/msm8916-usbh-phy.c b/drivers/phy/msm8916-usbh-phy.c index 4efaddd..7c9d030 100644 --- a/drivers/phy/msm8916-usbh-phy.c +++ b/drivers/phy/msm8916-usbh-phy.c @@ -106,5 +106,5 @@ U_BOOT_DRIVER(msm8916_usbphy) = { .of_match = msm_phy_ids, .ops = &msm_phy_ops, .probe = msm_phy_probe, - .priv_auto_alloc_size = sizeof(struct msm_phy_priv), + .priv_auto = sizeof(struct msm_phy_priv), }; diff --git a/drivers/phy/mt76x8-usb-phy.c b/drivers/phy/mt76x8-usb-phy.c index 4c0818f..4069208 100644 --- a/drivers/phy/mt76x8-usb-phy.c +++ b/drivers/phy/mt76x8-usb-phy.c @@ -248,5 +248,5 @@ U_BOOT_DRIVER(mt76x8_usb_phy) = { .of_match = mt76x8_usb_phy_ids, .ops = &mt76x8_usb_phy_ops, .probe = mt76x8_usb_phy_probe, - .priv_auto_alloc_size = sizeof(struct mt76x8_usb_phy), + .priv_auto = sizeof(struct mt76x8_usb_phy), }; diff --git a/drivers/phy/nop-phy.c b/drivers/phy/nop-phy.c index ba71785..84aac80 100644 --- a/drivers/phy/nop-phy.c +++ b/drivers/phy/nop-phy.c @@ -56,5 +56,5 @@ U_BOOT_DRIVER(nop_phy) = { .of_match = nop_phy_ids, .ops = &nop_phy_ops, .probe = nop_phy_probe, - .priv_auto_alloc_size = sizeof(struct nop_phy_priv), + .priv_auto = sizeof(struct nop_phy_priv), }; diff --git a/drivers/phy/omap-usb2-phy.c b/drivers/phy/omap-usb2-phy.c index a981cb2..cb99143 100644 --- a/drivers/phy/omap-usb2-phy.c +++ b/drivers/phy/omap-usb2-phy.c @@ -261,5 +261,5 @@ U_BOOT_DRIVER(omap_usb2_phy) = { .of_match = omap_usb2_id_table, .probe = omap_usb2_phy_probe, .ops = &omap_usb2_phy_ops, - .priv_auto_alloc_size = sizeof(struct omap_usb2_phy), + .priv_auto = sizeof(struct omap_usb2_phy), }; diff --git a/drivers/phy/phy-bcm-sr-pcie.c b/drivers/phy/phy-bcm-sr-pcie.c index 36c77c4..f0e7953 100644 --- a/drivers/phy/phy-bcm-sr-pcie.c +++ b/drivers/phy/phy-bcm-sr-pcie.c @@ -172,6 +172,6 @@ U_BOOT_DRIVER(sr_pcie_phy) = { .probe = sr_pcie_phy_probe, .of_match = sr_pcie_phy_match_table, .ops = &sr_pcie_phy_ops, - .platdata_auto_alloc_size = sizeof(struct sr_pcie_phy_core), - .priv_auto_alloc_size = sizeof(struct sr_pcie_phy_core), + .plat_auto = sizeof(struct sr_pcie_phy_core), + .priv_auto = sizeof(struct sr_pcie_phy_core), }; diff --git a/drivers/phy/phy-mtk-tphy.c b/drivers/phy/phy-mtk-tphy.c index 3d7b9cd..824244b 100644 --- a/drivers/phy/phy-mtk-tphy.c +++ b/drivers/phy/phy-mtk-tphy.c @@ -749,5 +749,5 @@ U_BOOT_DRIVER(mtk_tphy) = { .of_match = mtk_tphy_id_table, .ops = &mtk_tphy_ops, .probe = mtk_tphy_probe, - .priv_auto_alloc_size = sizeof(struct mtk_tphy), + .priv_auto = sizeof(struct mtk_tphy), }; diff --git a/drivers/phy/phy-qcom-ipq4019-usb.c b/drivers/phy/phy-qcom-ipq4019-usb.c index 465f0d3..5808489 100644 --- a/drivers/phy/phy-qcom-ipq4019-usb.c +++ b/drivers/phy/phy-qcom-ipq4019-usb.c @@ -75,7 +75,7 @@ U_BOOT_DRIVER(ipq4019_usb_ss_phy) = { .of_match = ipq4019_usb_ss_phy_ids, .ops = &ipq4019_usb_ss_phy_ops, .probe = ipq4019_usb_ss_phy_probe, - .priv_auto_alloc_size = sizeof(struct ipq4019_usb_phy), + .priv_auto = sizeof(struct ipq4019_usb_phy), }; static int ipq4019_hs_phy_power_off(struct phy *_phy) @@ -141,5 +141,5 @@ U_BOOT_DRIVER(ipq4019_usb_hs_phy) = { .of_match = ipq4019_usb_hs_phy_ids, .ops = &ipq4019_usb_hs_phy_ops, .probe = ipq4019_usb_hs_phy_probe, - .priv_auto_alloc_size = sizeof(struct ipq4019_usb_phy), + .priv_auto = sizeof(struct ipq4019_usb_phy), }; diff --git a/drivers/phy/phy-rcar-gen2.c b/drivers/phy/phy-rcar-gen2.c index 18da86e..1794095 100644 --- a/drivers/phy/phy-rcar-gen2.c +++ b/drivers/phy/phy-rcar-gen2.c @@ -189,5 +189,5 @@ U_BOOT_DRIVER(rcar_gen2_phy) = { .ops = &rcar_gen2_phy_phy_ops, .probe = rcar_gen2_phy_probe, .remove = rcar_gen2_phy_remove, - .priv_auto_alloc_size = sizeof(struct rcar_gen2_phy), + .priv_auto = sizeof(struct rcar_gen2_phy), }; diff --git a/drivers/phy/phy-rcar-gen3.c b/drivers/phy/phy-rcar-gen3.c index ce39cd8..8c59631 100644 --- a/drivers/phy/phy-rcar-gen3.c +++ b/drivers/phy/phy-rcar-gen3.c @@ -158,5 +158,5 @@ U_BOOT_DRIVER(rcar_gen3_phy) = { .ops = &rcar_gen3_phy_phy_ops, .probe = rcar_gen3_phy_probe, .remove = rcar_gen3_phy_remove, - .priv_auto_alloc_size = sizeof(struct rcar_gen3_phy), + .priv_auto = sizeof(struct rcar_gen3_phy), }; diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c index ab4a913..f23aef4 100644 --- a/drivers/phy/phy-stm32-usbphyc.c +++ b/drivers/phy/phy-stm32-usbphyc.c @@ -419,5 +419,5 @@ U_BOOT_DRIVER(stm32_usb_phyc) = { .of_match = stm32_usbphyc_of_match, .ops = &stm32_usbphyc_phy_ops, .probe = stm32_usbphyc_probe, - .priv_auto_alloc_size = sizeof(struct stm32_usbphyc), + .priv_auto = sizeof(struct stm32_usbphyc), }; diff --git a/drivers/phy/phy-ti-am654.c b/drivers/phy/phy-ti-am654.c index cc73760..82010e7 100644 --- a/drivers/phy/phy-ti-am654.c +++ b/drivers/phy/phy-ti-am654.c @@ -187,7 +187,7 @@ U_BOOT_DRIVER(serdes_am654_mux_clk) = { .name = "ti-serdes-am654-mux-clk", .id = UCLASS_CLK, .probe = serdes_am654_mux_clk_probe, - .priv_auto_alloc_size = sizeof(struct serdes_am654_mux_clk_data), + .priv_auto = sizeof(struct serdes_am654_mux_clk_data), .ops = &serdes_am654_mux_clk_ops, }; @@ -344,7 +344,7 @@ static int serdes_am654_bind(struct udevice *dev) ret = device_bind_driver_to_node(dev->parent, "ti-serdes-am654-mux-clk", - dev_read_name(dev), dev->node, + dev_read_name(dev), dev_ofnode(dev), NULL); if (ret) { dev_err(dev, "%s: not able to bind clock driver\n", __func__); @@ -412,5 +412,5 @@ U_BOOT_DRIVER(am654_serdes_phy) = { .bind = serdes_am654_bind, .ops = &serdes_am654_phy_ops, .probe = serdes_am654_probe, - .priv_auto_alloc_size = sizeof(struct serdes_am654), + .priv_auto = sizeof(struct serdes_am654), }; diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index c5ea6ca..6744b8b 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -308,5 +308,5 @@ U_BOOT_DRIVER(rockchip_usb2phy) = { .of_match = rockchip_usb2phy_ids, .probe = rockchip_usb2phy_probe, .bind = rockchip_usb2phy_bind, - .priv_auto_alloc_size = sizeof(struct rockchip_usb2phy), + .priv_auto = sizeof(struct rockchip_usb2phy), }; diff --git a/drivers/phy/rockchip/phy-rockchip-pcie.c b/drivers/phy/rockchip/phy-rockchip-pcie.c index 617943f..bc6c0fe 100644 --- a/drivers/phy/rockchip/phy-rockchip-pcie.c +++ b/drivers/phy/rockchip/phy-rockchip-pcie.c @@ -267,5 +267,5 @@ U_BOOT_DRIVER(rockchip_pcie_phy) = { .of_match = rockchip_pcie_phy_ids, .ops = &rockchip_pcie_phy_ops, .probe = rockchip_pcie_phy_probe, - .priv_auto_alloc_size = sizeof(struct rockchip_pcie_phy), + .priv_auto = sizeof(struct rockchip_pcie_phy), }; diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index da00daa..a45a318 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -792,5 +792,5 @@ U_BOOT_DRIVER(rockchip_typec_phy) = { .of_match = rockchip_typec_phy_ids, .probe = rockchip_tcphy_probe, .bind = rockchip_tcphy_bind, - .priv_auto_alloc_size = sizeof(struct rockchip_tcphy), + .priv_auto = sizeof(struct rockchip_tcphy), }; diff --git a/drivers/phy/sandbox-phy.c b/drivers/phy/sandbox-phy.c index 5f36da7..7b3d988 100644 --- a/drivers/phy/sandbox-phy.c +++ b/drivers/phy/sandbox-phy.c @@ -116,5 +116,5 @@ U_BOOT_DRIVER(phy_sandbox) = { .of_match = sandbox_phy_ids, .ops = &sandbox_phy_ops, .probe = sandbox_phy_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_phy_priv), + .priv_auto = sizeof(struct sandbox_phy_priv), }; diff --git a/drivers/phy/sti_usb_phy.c b/drivers/phy/sti_usb_phy.c index 51468b4..87c1bcd 100644 --- a/drivers/phy/sti_usb_phy.c +++ b/drivers/phy/sti_usb_phy.c @@ -177,5 +177,5 @@ U_BOOT_DRIVER(sti_usb_phy) = { .of_match = sti_usb_phy_ids, .probe = sti_usb_phy_probe, .ops = &sti_usb_phy_ops, - .priv_auto_alloc_size = sizeof(struct sti_usb_phy), + .priv_auto = sizeof(struct sti_usb_phy), }; diff --git a/drivers/phy/ti-pipe3-phy.c b/drivers/phy/ti-pipe3-phy.c index 3f49851..98fe6c6f 100644 --- a/drivers/phy/ti-pipe3-phy.c +++ b/drivers/phy/ti-pipe3-phy.c @@ -604,5 +604,5 @@ U_BOOT_DRIVER(pipe3_phy) = { .of_match = pipe3_phy_ids, .ops = &pipe3_phy_ops, .probe = pipe3_phy_probe, - .priv_auto_alloc_size = sizeof(struct omap_pipe3), + .priv_auto = sizeof(struct omap_pipe3), }; diff --git a/drivers/pinctrl/aspeed/pinctrl_ast2500.c b/drivers/pinctrl/aspeed/pinctrl_ast2500.c index 05ef248..3c2e10b 100644 --- a/drivers/pinctrl/aspeed/pinctrl_ast2500.c +++ b/drivers/pinctrl/aspeed/pinctrl_ast2500.c @@ -121,7 +121,7 @@ U_BOOT_DRIVER(pinctrl_ast2500) = { .name = "aspeed_ast2500_pinctrl", .id = UCLASS_PINCTRL, .of_match = ast2500_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct ast2500_pinctrl_priv), + .priv_auto = sizeof(struct ast2500_pinctrl_priv), .ops = &ast2500_pinctrl_ops, .probe = ast2500_pinctrl_probe, }; diff --git a/drivers/pinctrl/ath79/pinctrl_ar933x.c b/drivers/pinctrl/ath79/pinctrl_ar933x.c index 61e8081..14408da 100644 --- a/drivers/pinctrl/ath79/pinctrl_ar933x.c +++ b/drivers/pinctrl/ath79/pinctrl_ar933x.c @@ -130,7 +130,7 @@ U_BOOT_DRIVER(pinctrl_ar933x) = { .name = "pinctrl_ar933x", .id = UCLASS_PINCTRL, .of_match = ar933x_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct ar933x_pinctrl_priv), + .priv_auto = sizeof(struct ar933x_pinctrl_priv), .ops = &ar933x_pinctrl_ops, .probe = ar933x_pinctrl_probe, }; diff --git a/drivers/pinctrl/ath79/pinctrl_qca953x.c b/drivers/pinctrl/ath79/pinctrl_qca953x.c index 2d5a4a3..b1c78be 100644 --- a/drivers/pinctrl/ath79/pinctrl_qca953x.c +++ b/drivers/pinctrl/ath79/pinctrl_qca953x.c @@ -150,7 +150,7 @@ U_BOOT_DRIVER(pinctrl_qca953x) = { .name = "pinctrl_qca953x", .id = UCLASS_PINCTRL, .of_match = qca953x_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct qca953x_pinctrl_priv), + .priv_auto = sizeof(struct qca953x_pinctrl_priv), .ops = &qca953x_pinctrl_ops, .probe = qca953x_pinctrl_probe, }; diff --git a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c index 41da814..44a310f 100644 --- a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c +++ b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c @@ -104,7 +104,7 @@ static const struct udevice_id bcm2835_pinctrl_id[] = { {} }; -int bcm283x_pinctl_ofdata_to_platdata(struct udevice *dev) +int bcm283x_pinctl_of_to_plat(struct udevice *dev) { struct bcm283x_pinctrl_priv *priv; @@ -126,7 +126,7 @@ int bcm283x_pinctl_probe(struct udevice *dev) /* Create GPIO device as well */ ret = device_bind(dev, lists_driver_lookup_name("gpio_bcm2835"), - "gpio_bcm2835", NULL, dev_of_offset(dev), &pdev); + "gpio_bcm2835", NULL, dev_ofnode(dev), &pdev); if (ret) { /* * While we really want the pinctrl driver to work to make @@ -149,8 +149,8 @@ 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), + .of_to_plat = bcm283x_pinctl_of_to_plat, + .priv_auto = sizeof(struct bcm283x_pinctrl_priv), .ops = &bcm283x_pinctrl_ops, .probe = bcm283x_pinctl_probe, #if CONFIG_IS_ENABLED(OF_BOARD) diff --git a/drivers/pinctrl/broadcom/pinctrl-bcm6838.c b/drivers/pinctrl/broadcom/pinctrl-bcm6838.c index 6c8a990..58f28a1 100644 --- a/drivers/pinctrl/broadcom/pinctrl-bcm6838.c +++ b/drivers/pinctrl/broadcom/pinctrl-bcm6838.c @@ -157,6 +157,6 @@ U_BOOT_DRIVER(bcm6838_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = bcm6838_pinctrl_match, .ops = &bcm6838_pinctrl_ops, - .priv_auto_alloc_size = sizeof(struct bcm6838_pinctrl_priv), + .priv_auto = sizeof(struct bcm6838_pinctrl_priv), .probe = bcm6838_pinctrl_probe, }; diff --git a/drivers/pinctrl/exynos/pinctrl-exynos.c b/drivers/pinctrl/exynos/pinctrl-exynos.c index 4cdc071..64d7821 100644 --- a/drivers/pinctrl/exynos/pinctrl-exynos.c +++ b/drivers/pinctrl/exynos/pinctrl-exynos.c @@ -133,7 +133,7 @@ int exynos_pinctrl_probe(struct udevice *dev) priv->base = base; priv->pin_ctrl = (struct samsung_pin_ctrl *)dev_get_driver_data(dev) + - dev->req_seq; + dev_seq(dev); return 0; } diff --git a/drivers/pinctrl/exynos/pinctrl-exynos7420.c b/drivers/pinctrl/exynos/pinctrl-exynos7420.c index ff6d6c4..07870b7 100644 --- a/drivers/pinctrl/exynos/pinctrl-exynos7420.c +++ b/drivers/pinctrl/exynos/pinctrl-exynos7420.c @@ -110,7 +110,7 @@ U_BOOT_DRIVER(pinctrl_exynos7420) = { .name = "pinctrl_exynos7420", .id = UCLASS_PINCTRL, .of_match = exynos7420_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct exynos_pinctrl_priv), + .priv_auto = sizeof(struct exynos_pinctrl_priv), .ops = &exynos7420_pinctrl_ops, .probe = exynos_pinctrl_probe, }; diff --git a/drivers/pinctrl/intel/pinctrl.c b/drivers/pinctrl/intel/pinctrl.c index e3d2464..987a56b 100644 --- a/drivers/pinctrl/intel/pinctrl.c +++ b/drivers/pinctrl/intel/pinctrl.c @@ -143,7 +143,7 @@ static int pinctrl_get_device(uint pad, struct udevice **devp) /* * We have to probe each one of these since the community link is only - * attached in intel_pinctrl_ofdata_to_platdata(). + * attached in intel_pinctrl_of_to_plat(). */ uclass_foreach_dev_probe(UCLASS_PINCTRL, dev) { struct intel_pinctrl_priv *priv = dev_get_priv(dev); @@ -274,7 +274,9 @@ static int pinctrl_configure_itss(struct udevice *dev, irq = pcr_read32(dev, PAD_CFG1_OFFSET(pad_cfg_offset)); irq &= PAD_CFG1_IRQ_MASK; if (!irq) { - log_err("GPIO %u doesn't support APIC routing\n", cfg->pad); + if (spl_phase() > PHASE_TPL) + log_err("GPIO %u doesn't support APIC routing\n", + cfg->pad); return -EPROTONOSUPPORT; } @@ -314,7 +316,8 @@ static int pinctrl_pad_reset_config_override(const struct pad_community *comm, return config_value; } } - log_err("Logical-to-Chipset mapping not found\n"); + if (spl_phase() > PHASE_TPL) + log_err("Logical-to-Chipset mapping not found\n"); return -ENOENT; } @@ -613,15 +616,16 @@ int pinctrl_config_pads_for_node(struct udevice *dev, ofnode node) return 0; } -int intel_pinctrl_ofdata_to_platdata(struct udevice *dev, - const struct pad_community *comm, - int num_cfgs) +int intel_pinctrl_of_to_plat(struct udevice *dev, + const struct pad_community *comm, int num_cfgs) { - struct p2sb_child_platdata *pplat = dev_get_parent_platdata(dev); + struct p2sb_child_plat *pplat = dev_get_parent_plat(dev); struct intel_pinctrl_priv *priv = dev_get_priv(dev); if (!comm) { - log_err("Cannot find community for pid %d\n", pplat->pid); + if (spl_phase() > PHASE_TPL) + log_err("Cannot find community for pid %d\n", + pplat->pid); return -EDOM; } priv->comm = comm; diff --git a/drivers/pinctrl/intel/pinctrl_apl.c b/drivers/pinctrl/intel/pinctrl_apl.c index 727bacf..acaa55d 100644 --- a/drivers/pinctrl/intel/pinctrl_apl.c +++ b/drivers/pinctrl/intel/pinctrl_apl.c @@ -17,18 +17,6 @@ #include <asm-generic/gpio.h> #include <asm/intel_pinctrl_defs.h> -/** - * struct apl_gpio_platdata - platform data for each device - * - * @dtplat: of-platdata data from C struct - */ -struct apl_gpio_platdata { -#if CONFIG_IS_ENABLED(OF_PLATDATA) - /* Put this first since driver model will copy the data here */ - struct dtd_intel_apl_pinctrl dtplat; -#endif -}; - static const struct reset_mapping rst_map[] = { { .logical = PAD_CFG0_LOGICAL_RESET_PWROK, .chipset = 0U << 30 }, { .logical = PAD_CFG0_LOGICAL_RESET_DEEP, .chipset = 1U << 30 }, @@ -136,14 +124,14 @@ static const struct pad_community apl_gpio_communities[] = { }, }; -static int apl_pinctrl_ofdata_to_platdata(struct udevice *dev) +static int apl_pinctrl_of_to_plat(struct udevice *dev) { - struct p2sb_child_platdata *pplat; + struct p2sb_child_plat *pplat; const struct pad_community *comm = NULL; int i; #if CONFIG_IS_ENABLED(OF_PLATDATA) - struct apl_gpio_platdata *plat = dev_get_platdata(dev); + struct apl_gpio_plat *plat = dev_get_plat(dev); int ret; /* @@ -152,38 +140,38 @@ static int apl_pinctrl_ofdata_to_platdata(struct udevice *dev) * linker list (i.e. alphabetical order by driver name). So the GPIO * device may well be bound before its parent (p2sb), and this call * will fail if p2sb is not bound yet. - * - * TODO(sjg@chromium.org): Add a parent pointer to child devices in dtoc */ ret = p2sb_set_port_id(dev, plat->dtplat.intel_p2sb_port_id); if (ret) return log_msg_ret("Could not set port id", ret); #endif /* Attach this device to its community structure */ - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); for (i = 0; i < ARRAY_SIZE(apl_gpio_communities); i++) { if (apl_gpio_communities[i].port == pplat->pid) comm = &apl_gpio_communities[i]; } - return intel_pinctrl_ofdata_to_platdata(dev, comm, 2); + return intel_pinctrl_of_to_plat(dev, comm, 2); } +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id apl_gpio_ids[] = { { .compatible = "intel,apl-pinctrl"}, { } }; +#endif U_BOOT_DRIVER(intel_apl_pinctrl) = { .name = "intel_apl_pinctrl", .id = UCLASS_PINCTRL, - .of_match = apl_gpio_ids, + .of_match = of_match_ptr(apl_gpio_ids), .probe = intel_pinctrl_probe, .ops = &intel_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, #endif - .ofdata_to_platdata = apl_pinctrl_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct intel_pinctrl_priv), - .platdata_auto_alloc_size = sizeof(struct apl_gpio_platdata), + .of_to_plat = apl_pinctrl_of_to_plat, + .priv_auto = sizeof(struct intel_pinctrl_priv), + .plat_auto = sizeof(struct apl_gpio_plat), }; diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c index 1aa323c..b413a4c 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c @@ -748,7 +748,7 @@ U_BOOT_DRIVER(mt7622_pinctrl) = { .of_match = mt7622_pctrl_match, .ops = &mtk_pinctrl_ops, .probe = mtk_pinctrl_mt7622_probe, - .priv_auto_alloc_size = sizeof(struct mtk_pinctrl_priv), + .priv_auto = sizeof(struct mtk_pinctrl_priv), }; diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7623.c b/drivers/pinctrl/mediatek/pinctrl-mt7623.c index 0f5dcb2..2e3ae34 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt7623.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt7623.c @@ -1411,5 +1411,5 @@ U_BOOT_DRIVER(mt7623_pinctrl) = { .of_match = mt7623_pctrl_match, .ops = &mtk_pinctrl_ops, .probe = mtk_pinctrl_mt7623_probe, - .priv_auto_alloc_size = sizeof(struct mtk_pinctrl_priv), + .priv_auto = sizeof(struct mtk_pinctrl_priv), }; diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7629.c b/drivers/pinctrl/mediatek/pinctrl-mt7629.c index 37640dd..7ce64fd 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt7629.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt7629.c @@ -407,5 +407,5 @@ U_BOOT_DRIVER(mt7629_pinctrl) = { .of_match = mt7629_pctrl_match, .ops = &mtk_pinctrl_ops, .probe = mtk_pinctrl_mt7629_probe, - .priv_auto_alloc_size = sizeof(struct mtk_pinctrl_priv), + .priv_auto = sizeof(struct mtk_pinctrl_priv), }; diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8512.c b/drivers/pinctrl/mediatek/pinctrl-mt8512.c index bf2a8dd9..3d9c0ab 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt8512.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt8512.c @@ -383,5 +383,5 @@ U_BOOT_DRIVER(mt8512_pinctrl) = { .of_match = mt8512_pctrl_match, .ops = &mtk_pinctrl_ops, .probe = mtk_pinctrl_mt8512_probe, - .priv_auto_alloc_size = sizeof(struct mtk_pinctrl_priv), + .priv_auto = sizeof(struct mtk_pinctrl_priv), }; diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8516.c b/drivers/pinctrl/mediatek/pinctrl-mt8516.c index 62e339e..6f94f76 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt8516.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt8516.c @@ -389,5 +389,5 @@ U_BOOT_DRIVER(mt8516_pinctrl) = { .of_match = mt8516_pctrl_match, .ops = &mtk_pinctrl_ops, .probe = mtk_pinctrl_mt8516_probe, - .priv_auto_alloc_size = sizeof(struct mtk_pinctrl_priv), + .priv_auto = sizeof(struct mtk_pinctrl_priv), }; diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8518.c b/drivers/pinctrl/mediatek/pinctrl-mt8518.c index 91427ae..ed51bd3 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt8518.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt8518.c @@ -409,5 +409,5 @@ U_BOOT_DRIVER(mt8518_pinctrl) = { .of_match = mt8518_pctrl_match, .ops = &mtk_pinctrl_ops, .probe = mtk_pinctrl_mt8518_probe, - .priv_auto_alloc_size = sizeof(struct mtk_pinctrl_priv), + .priv_auto = sizeof(struct mtk_pinctrl_priv), }; diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg.c b/drivers/pinctrl/meson/pinctrl-meson-axg.c index 11809b2..5d234bc 100644 --- a/drivers/pinctrl/meson/pinctrl-meson-axg.c +++ b/drivers/pinctrl/meson/pinctrl-meson-axg.c @@ -975,6 +975,6 @@ U_BOOT_DRIVER(meson_axg_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(meson_axg_pinctrl_match), .probe = meson_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct meson_pinctrl), + .priv_auto = sizeof(struct meson_pinctrl), .ops = &meson_axg_pinctrl_ops, }; diff --git a/drivers/pinctrl/meson/pinctrl-meson-g12a.c b/drivers/pinctrl/meson/pinctrl-meson-g12a.c index 115e8b5..8bd265a 100644 --- a/drivers/pinctrl/meson/pinctrl-meson-g12a.c +++ b/drivers/pinctrl/meson/pinctrl-meson-g12a.c @@ -1289,6 +1289,6 @@ U_BOOT_DRIVER(meson_axg_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(meson_g12a_pinctrl_match), .probe = meson_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct meson_pinctrl), + .priv_auto = sizeof(struct meson_pinctrl), .ops = &meson_axg_pinctrl_ops, }; diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c index 9e2e151..8c01c73 100644 --- a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c +++ b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c @@ -472,6 +472,6 @@ U_BOOT_DRIVER(meson_gxbb_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(meson_gxbb_pinctrl_match), .probe = meson_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct meson_pinctrl), + .priv_auto = sizeof(struct meson_pinctrl), .ops = &meson_gx_pinctrl_ops, }; diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c b/drivers/pinctrl/meson/pinctrl-meson-gxl.c index 5acc21b..51a0b4c 100644 --- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c +++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c @@ -734,6 +734,6 @@ U_BOOT_DRIVER(meson_gxl_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(meson_gxl_pinctrl_match), .probe = meson_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct meson_pinctrl), + .priv_auto = sizeof(struct meson_pinctrl), .ops = &meson_gx_pinctrl_ops, }; diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index 5065b62..b11a40e 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -347,6 +347,7 @@ int meson_pinctrl_probe(struct udevice *dev) int na, ns; char *name; + /* FIXME: Should use livetree */ na = fdt_address_cells(gd->fdt_blob, dev_of_offset(dev->parent)); if (na < 1) { debug("bad #address-cells\n"); @@ -419,8 +420,8 @@ int meson_pinctrl_probe(struct udevice *dev) sprintf(name, "meson-gpio"); /* Create child device UCLASS_GPIO and bind it */ - device_bind(dev, priv->data->gpio_driver, name, NULL, gpio, &gpio_dev); - dev_set_of_offset(gpio_dev, gpio); + device_bind(dev, priv->data->gpio_driver, name, NULL, + offset_to_ofnode(gpio), &gpio_dev); return 0; } diff --git a/drivers/pinctrl/mscc/pinctrl-jr2.c b/drivers/pinctrl/mscc/pinctrl-jr2.c index 72a9470..cb34058 100644 --- a/drivers/pinctrl/mscc/pinctrl-jr2.c +++ b/drivers/pinctrl/mscc/pinctrl-jr2.c @@ -300,7 +300,7 @@ static int jr2_pinctrl_probe(struct udevice *dev) return ret; ret = device_bind(dev, &jr2_gpio_driver, "jr2-gpio", NULL, - dev_of_offset(dev), NULL); + dev_ofnode(dev), NULL); if (ret) return ret; @@ -318,6 +318,6 @@ U_BOOT_DRIVER(jr2_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(jr2_pinctrl_of_match), .probe = jr2_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct mscc_pinctrl), + .priv_auto = sizeof(struct mscc_pinctrl), .ops = &mscc_pinctrl_ops, }; diff --git a/drivers/pinctrl/mscc/pinctrl-luton.c b/drivers/pinctrl/mscc/pinctrl-luton.c index 17fbc53..325c9a9 100644 --- a/drivers/pinctrl/mscc/pinctrl-luton.c +++ b/drivers/pinctrl/mscc/pinctrl-luton.c @@ -166,7 +166,7 @@ int luton_pinctrl_probe(struct udevice *dev) return ret; ret = device_bind(dev, &luton_gpio_driver, "luton-gpio", NULL, - dev_of_offset(dev), NULL); + dev_ofnode(dev), NULL); return 0; } @@ -181,6 +181,6 @@ U_BOOT_DRIVER(luton_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(luton_pinctrl_of_match), .probe = luton_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct mscc_pinctrl), + .priv_auto = sizeof(struct mscc_pinctrl), .ops = &mscc_pinctrl_ops, }; diff --git a/drivers/pinctrl/mscc/pinctrl-ocelot.c b/drivers/pinctrl/mscc/pinctrl-ocelot.c index 49e026b..57e2ef0 100644 --- a/drivers/pinctrl/mscc/pinctrl-ocelot.c +++ b/drivers/pinctrl/mscc/pinctrl-ocelot.c @@ -182,7 +182,7 @@ int ocelot_pinctrl_probe(struct udevice *dev) return ret; ret = device_bind(dev, &ocelot_gpio_driver, "ocelot-gpio", NULL, - dev_of_offset(dev), NULL); + dev_ofnode(dev), NULL); return ret; } @@ -197,6 +197,6 @@ U_BOOT_DRIVER(ocelot_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(ocelot_pinctrl_of_match), .probe = ocelot_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct mscc_pinctrl), + .priv_auto = sizeof(struct mscc_pinctrl), .ops = &mscc_pinctrl_ops, }; diff --git a/drivers/pinctrl/mscc/pinctrl-serval.c b/drivers/pinctrl/mscc/pinctrl-serval.c index d59f08d..a6b9796 100644 --- a/drivers/pinctrl/mscc/pinctrl-serval.c +++ b/drivers/pinctrl/mscc/pinctrl-serval.c @@ -210,7 +210,7 @@ static int serval_pinctrl_probe(struct udevice *dev) return ret; ret = device_bind(dev, &serval_gpio_driver, "serval-gpio", NULL, - dev_of_offset(dev), NULL); + dev_ofnode(dev), NULL); if (ret) return ret; @@ -228,6 +228,6 @@ U_BOOT_DRIVER(serval_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(serval_pinctrl_of_match), .probe = serval_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct mscc_pinctrl), + .priv_auto = sizeof(struct mscc_pinctrl), .ops = &mscc_pinctrl_ops, }; diff --git a/drivers/pinctrl/mscc/pinctrl-servalt.c b/drivers/pinctrl/mscc/pinctrl-servalt.c index 592b7c5..8e86785 100644 --- a/drivers/pinctrl/mscc/pinctrl-servalt.c +++ b/drivers/pinctrl/mscc/pinctrl-servalt.c @@ -246,7 +246,7 @@ static int servalt_pinctrl_probe(struct udevice *dev) return ret; ret = device_bind(dev, &servalt_gpio_driver, "servalt-gpio", NULL, - dev_of_offset(dev), NULL); + dev_ofnode(dev), NULL); if (ret) return ret; @@ -264,6 +264,6 @@ U_BOOT_DRIVER(servalt_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(servalt_pinctrl_of_match), .probe = servalt_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct mscc_pinctrl), + .priv_auto = sizeof(struct mscc_pinctrl), .ops = &mscc_pinctrl_ops, }; diff --git a/drivers/pinctrl/mtmips/pinctrl-mt7628.c b/drivers/pinctrl/mtmips/pinctrl-mt7628.c index fc9d8b5..c15da6b 100644 --- a/drivers/pinctrl/mtmips/pinctrl-mt7628.c +++ b/drivers/pinctrl/mtmips/pinctrl-mt7628.c @@ -534,7 +534,7 @@ static int mt7628_pinctrl_probe(struct udevice *dev) return ret; } -static int mt7628_pinctrl_ofdata_to_platdata(struct udevice *dev) +static int mt7628_pinctrl_of_to_plat(struct udevice *dev) { struct mt7628_pinctrl_priv *priv = dev_get_priv(dev); @@ -578,8 +578,8 @@ U_BOOT_DRIVER(mt7628_pinctrl) = { .name = "mt7628-pinctrl", .id = UCLASS_PINCTRL, .of_match = mt7628_pinctrl_ids, - .ofdata_to_platdata = mt7628_pinctrl_ofdata_to_platdata, + .of_to_plat = mt7628_pinctrl_of_to_plat, .ops = &mt7628_pinctrl_ops, .probe = mt7628_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct mt7628_pinctrl_priv), + .priv_auto = sizeof(struct mt7628_pinctrl_priv), }; diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index fb49780..4797d32 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -547,13 +547,14 @@ static int armada_37xx_gpiochip_register(struct udevice *parent, int subnode; char *name; - /* Lookup GPIO driver */ + /* FIXME: Should not need to lookup GPIO uclass */ drv = lists_uclass_lookup(UCLASS_GPIO); if (!drv) { puts("Cannot find GPIO driver\n"); return -ENOENT; } + /* FIXME: Use livtree and check the result of device_bind() below */ fdt_for_each_subnode(subnode, blob, node) { if (fdtdec_get_bool(blob, subnode, "gpio-controller")) { ret = 0; @@ -567,9 +568,8 @@ static int armada_37xx_gpiochip_register(struct udevice *parent, sprintf(name, "armada-37xx-gpio"); /* Create child device UCLASS_GPIO and bind it */ - device_bind(parent, &armada_37xx_gpio_driver, name, NULL, subnode, - &dev); - dev_set_of_offset(dev, subnode); + device_bind(parent, &armada_37xx_gpio_driver, name, NULL, + offset_to_ofnode(subnode), &dev); return 0; } @@ -643,6 +643,6 @@ U_BOOT_DRIVER(armada_37xx_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(armada_37xx_pinctrl_of_match), .probe = armada_37xx_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct armada_37xx_pinctrl), + .priv_auto = sizeof(struct armada_37xx_pinctrl), .ops = &armada_37xx_pinctrl_ops, }; diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index 146f5c6..5ced4fe 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -229,7 +229,7 @@ U_BOOT_DRIVER(pinctrl_mvebu) = { .name = "mvebu_pinctrl", .id = UCLASS_PINCTRL, .of_match = mvebu_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct mvebu_pinctrl_priv), + .priv_auto = sizeof(struct mvebu_pinctrl_priv), .ops = &mvebu_pinctrl_ops, .probe = mvebu_pinctl_probe }; diff --git a/drivers/pinctrl/nexell/pinctrl-s5pxx18.c b/drivers/pinctrl/nexell/pinctrl-s5pxx18.c index 96a2ed3..adc687a 100644 --- a/drivers/pinctrl/nexell/pinctrl-s5pxx18.c +++ b/drivers/pinctrl/nexell/pinctrl-s5pxx18.c @@ -213,7 +213,7 @@ U_BOOT_DRIVER(pinctrl_s5pxx18) = { .name = "pinctrl_s5pxx18", .id = UCLASS_PINCTRL, .of_match = s5pxx18_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct nexell_pinctrl_priv), + .priv_auto = sizeof(struct nexell_pinctrl_priv), .ops = &s5pxx18_pinctrl_ops, .probe = nexell_pinctrl_probe, .flags = DM_FLAG_PRE_RELOC diff --git a/drivers/pinctrl/nxp/pinctrl-imx5.c b/drivers/pinctrl/nxp/pinctrl-imx5.c index 9c3423b..71e0c94 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx5.c +++ b/drivers/pinctrl/nxp/pinctrl-imx5.c @@ -38,7 +38,7 @@ U_BOOT_DRIVER(imx5_pinctrl) = { .of_match = of_match_ptr(imx5_pinctrl_match), .probe = imx5_pinctrl_probe, .remove = imx_pinctrl_remove, - .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), + .priv_auto = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/pinctrl/nxp/pinctrl-imx6.c b/drivers/pinctrl/nxp/pinctrl-imx6.c index 84004e5..6994dbb 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx6.c +++ b/drivers/pinctrl/nxp/pinctrl-imx6.c @@ -47,9 +47,9 @@ U_BOOT_DRIVER(fsl_imx6q_iomuxc) = { .of_match = of_match_ptr(imx6_pinctrl_match), .probe = imx6_pinctrl_probe, .remove = imx_pinctrl_remove, - .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), + .priv_auto = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, .flags = DM_FLAG_PRE_RELOC, }; -U_BOOT_DRIVER_ALIAS(fsl_imx6q_iomuxc, fsl_imx6dl_iomuxc) +DM_DRIVER_ALIAS(fsl_imx6q_iomuxc, fsl_imx6dl_iomuxc) diff --git a/drivers/pinctrl/nxp/pinctrl-imx7.c b/drivers/pinctrl/nxp/pinctrl-imx7.c index 66b58ba..8301413 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx7.c +++ b/drivers/pinctrl/nxp/pinctrl-imx7.c @@ -35,7 +35,7 @@ U_BOOT_DRIVER(imx7_pinctrl) = { .of_match = of_match_ptr(imx7_pinctrl_match), .probe = imx7_pinctrl_probe, .remove = imx_pinctrl_remove, - .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), + .priv_auto = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/pinctrl/nxp/pinctrl-imx7ulp.c b/drivers/pinctrl/nxp/pinctrl-imx7ulp.c index 598bbfa..da0f6c9 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx7ulp.c +++ b/drivers/pinctrl/nxp/pinctrl-imx7ulp.c @@ -39,7 +39,7 @@ U_BOOT_DRIVER(imx7ulp_pinctrl) = { .of_match = of_match_ptr(imx7ulp_pinctrl_match), .probe = imx7ulp_pinctrl_probe, .remove = imx_pinctrl_remove, - .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), + .priv_auto = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/pinctrl/nxp/pinctrl-imx8.c b/drivers/pinctrl/nxp/pinctrl-imx8.c index c1b0ca4..2e5db2c 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx8.c +++ b/drivers/pinctrl/nxp/pinctrl-imx8.c @@ -35,7 +35,7 @@ U_BOOT_DRIVER(imx8_pinctrl) = { .of_match = of_match_ptr(imx8_pinctrl_match), .probe = imx8_pinctrl_probe, .remove = imx_pinctrl_remove, - .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), + .priv_auto = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/pinctrl/nxp/pinctrl-imx8m.c b/drivers/pinctrl/nxp/pinctrl-imx8m.c index 0626fde..99c6d01 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx8m.c +++ b/drivers/pinctrl/nxp/pinctrl-imx8m.c @@ -32,7 +32,7 @@ U_BOOT_DRIVER(imx8mq_pinctrl) = { .of_match = of_match_ptr(imx8m_pinctrl_match), .probe = imx8mq_pinctrl_probe, .remove = imx_pinctrl_remove, - .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), + .priv_auto = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/pinctrl/nxp/pinctrl-imxrt.c b/drivers/pinctrl/nxp/pinctrl-imxrt.c index 4a93941..53b70da 100644 --- a/drivers/pinctrl/nxp/pinctrl-imxrt.c +++ b/drivers/pinctrl/nxp/pinctrl-imxrt.c @@ -34,7 +34,7 @@ U_BOOT_DRIVER(imxrt_pinctrl) = { .of_match = of_match_ptr(imxrt_pinctrl_match), .probe = imxrt_pinctrl_probe, .remove = imx_pinctrl_remove, - .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), + .priv_auto = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/pinctrl/nxp/pinctrl-mxs.c b/drivers/pinctrl/nxp/pinctrl-mxs.c index db463fc..449a0aa 100644 --- a/drivers/pinctrl/nxp/pinctrl-mxs.c +++ b/drivers/pinctrl/nxp/pinctrl-mxs.c @@ -188,8 +188,8 @@ U_BOOT_DRIVER(fsl_imx23_pinctrl) = { #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, #endif - .priv_auto_alloc_size = sizeof(struct mxs_pinctrl_priv), + .priv_auto = sizeof(struct mxs_pinctrl_priv), .ops = &mxs_pinctrl_ops, }; -U_BOOT_DRIVER_ALIAS(fsl_imx23_pinctrl, fsl_imx28_pinctrl) +DM_DRIVER_ALIAS(fsl_imx23_pinctrl, fsl_imx28_pinctrl) diff --git a/drivers/pinctrl/nxp/pinctrl-vf610.c b/drivers/pinctrl/nxp/pinctrl-vf610.c index e795b5f..14e2e9d 100644 --- a/drivers/pinctrl/nxp/pinctrl-vf610.c +++ b/drivers/pinctrl/nxp/pinctrl-vf610.c @@ -34,7 +34,7 @@ U_BOOT_DRIVER(vf610_pinctrl) = { .of_match = of_match_ptr(vf610_pinctrl_match), .probe = vf610_pinctrl_probe, .remove = imx_pinctrl_remove, - .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), + .priv_auto = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index bf85cc9..1aba8a9 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -22,7 +22,7 @@ DECLARE_GLOBAL_DATA_PTR; * framework groups, Atmel PIO groups will be called banks. */ -struct atmel_pio4_platdata { +struct atmel_pio4_plat { struct atmel_pio4_port *reg_base; }; @@ -95,7 +95,7 @@ static u32 atmel_pinctrl_get_pinconf(const void *blob, int node) static inline struct atmel_pio4_port *atmel_pio4_bank_base(struct udevice *dev, u32 bank) { - struct atmel_pio4_platdata *plat = dev_get_platdata(dev); + struct atmel_pio4_plat *plat = dev_get_plat(dev); struct atmel_pio4_port *bank_base = (struct atmel_pio4_port *)((u32)plat->reg_base + ATMEL_PIO_BANK_OFFSET * bank); @@ -154,7 +154,7 @@ const struct pinctrl_ops atmel_pinctrl_ops = { static int atmel_pinctrl_probe(struct udevice *dev) { - struct atmel_pio4_platdata *plat = dev_get_platdata(dev); + struct atmel_pio4_plat *plat = dev_get_plat(dev); fdt_addr_t addr_base; dev = dev_get_parent(dev); @@ -178,6 +178,6 @@ U_BOOT_DRIVER(atmel_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = atmel_pinctrl_match, .probe = atmel_pinctrl_probe, - .platdata_auto_alloc_size = sizeof(struct atmel_pio4_platdata), + .plat_auto = sizeof(struct atmel_pio4_plat), .ops = &atmel_pinctrl_ops, }; diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index cd7b32c..ddaad55 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -524,8 +524,8 @@ U_BOOT_DRIVER(atmel_sama5d3_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = at91_pinctrl_match, .probe = at91_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct at91_pinctrl_priv), + .priv_auto = sizeof(struct at91_pinctrl_priv), .ops = &at91_pinctrl_ops, }; -U_BOOT_DRIVER_ALIAS(atmel_sama5d3_pinctrl, atmel_at91rm9200_pinctrl) +DM_DRIVER_ALIAS(atmel_sama5d3_pinctrl, atmel_at91rm9200_pinctrl) diff --git a/drivers/pinctrl/pinctrl-kendryte.c b/drivers/pinctrl/pinctrl-kendryte.c index 0416201..09d51ca 100644 --- a/drivers/pinctrl/pinctrl-kendryte.c +++ b/drivers/pinctrl/pinctrl-kendryte.c @@ -735,6 +735,6 @@ U_BOOT_DRIVER(pinctrl_k210) = { .id = UCLASS_PINCTRL, .of_match = k210_pc_ids, .probe = k210_pc_probe, - .priv_auto_alloc_size = sizeof(struct k210_pc_priv), + .priv_auto = sizeof(struct k210_pc_priv), .ops = &k210_pc_pinctrl_ops, }; diff --git a/drivers/pinctrl/pinctrl-qe-io.c b/drivers/pinctrl/pinctrl-qe-io.c index 85521ea..e129ab2 100644 --- a/drivers/pinctrl/pinctrl-qe-io.c +++ b/drivers/pinctrl/pinctrl-qe-io.c @@ -18,12 +18,12 @@ #include <linux/ioport.h> /** - * struct qe_io_platdata + * struct qe_io_plat * * @base: Base register address * @num_par_io_ports number of io ports */ -struct qe_io_platdata { +struct qe_io_plat { qepio83xx_t *base; u32 num_io_ports; }; @@ -120,9 +120,9 @@ void qe_config_iopin(u8 port, u8 pin, int dir, int open_drain, int assign) qe_cfg_iopin(par_io, port, pin, dir, open_drain, assign); } #else -static int qe_io_ofdata_to_platdata(struct udevice *dev) +static int qe_io_of_to_plat(struct udevice *dev) { - struct qe_io_platdata *plat = dev->platdata; + struct qe_io_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -143,7 +143,7 @@ static int qe_io_ofdata_to_platdata(struct udevice *dev) */ static int par_io_of_config_node(struct udevice *dev, ofnode pio) { - struct qe_io_platdata *plat = dev->platdata; + struct qe_io_plat *plat = dev_get_plat(dev); qepio83xx_t *par_io = plat->base; const unsigned int *pio_map; int pio_map_len; @@ -245,8 +245,8 @@ U_BOOT_DRIVER(par_io_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(par_io_pinctrl_match), .probe = par_io_pinctrl_probe, - .ofdata_to_platdata = qe_io_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct qe_io_platdata), + .of_to_plat = qe_io_of_to_plat, + .plat_auto = sizeof(struct qe_io_plat), .ops = &par_io_pinctrl_ops, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/pinctrl/pinctrl-sandbox.c b/drivers/pinctrl/pinctrl-sandbox.c index d27f742..7765977 100644 --- a/drivers/pinctrl/pinctrl-sandbox.c +++ b/drivers/pinctrl/pinctrl-sandbox.c @@ -296,6 +296,6 @@ U_BOOT_DRIVER(sandbox_pinctrl) = { .name = "sandbox_pinctrl", .id = UCLASS_PINCTRL, .of_match = sandbox_pinctrl_match, - .priv_auto_alloc_size = sizeof(struct sandbox_pinctrl_priv), + .priv_auto = sizeof(struct sandbox_pinctrl_priv), .ops = &sandbox_pinctrl_ops, }; diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 738f5bd..20c3c82 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -47,7 +47,7 @@ static int single_configure_pins(struct udevice *dev, const struct single_fdt_pin_cfg *pins, int size) { - struct single_pdata *pdata = dev->platdata; + struct single_pdata *pdata = dev_get_plat(dev); int count = size / sizeof(struct single_fdt_pin_cfg); phys_addr_t n, reg; u32 val; @@ -81,7 +81,7 @@ static int single_configure_bits(struct udevice *dev, const struct single_fdt_bits_cfg *pins, int size) { - struct single_pdata *pdata = dev->platdata; + struct single_pdata *pdata = dev_get_plat(dev); int count = size / sizeof(struct single_fdt_bits_cfg); phys_addr_t n, reg; u32 val, mask; @@ -148,12 +148,12 @@ static int single_set_state(struct udevice *dev, return len; } -static int single_ofdata_to_platdata(struct udevice *dev) +static int single_of_to_plat(struct udevice *dev) { fdt_addr_t addr; u32 of_reg[2]; int res; - struct single_pdata *pdata = dev->platdata; + struct single_pdata *pdata = dev_get_plat(dev); pdata->width = dev_read_u32_default(dev, "pinctrl-single,register-width", 0); @@ -191,6 +191,6 @@ U_BOOT_DRIVER(single_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = single_pinctrl_match, .ops = &single_pinctrl_ops, - .platdata_auto_alloc_size = sizeof(struct single_pdata), - .ofdata_to_platdata = single_ofdata_to_platdata, + .plat_auto = sizeof(struct single_pdata), + .of_to_plat = single_of_to_plat, }; diff --git a/drivers/pinctrl/pinctrl-sti.c b/drivers/pinctrl/pinctrl-sti.c index 2f3ee00..c5baf5d 100644 --- a/drivers/pinctrl/pinctrl-sti.c +++ b/drivers/pinctrl/pinctrl-sti.c @@ -41,7 +41,7 @@ DECLARE_GLOBAL_DATA_PTR; /* oe = 1, pu = 1, od = 1 */ #define BIDIR_PU (OE | PU | OD) -struct sti_pinctrl_platdata { +struct sti_pinctrl_plat { struct regmap *regmap; }; @@ -57,7 +57,7 @@ struct sti_pin_desc { */ void sti_alternate_select(struct udevice *dev, struct sti_pin_desc *pin_desc) { - struct sti_pinctrl_platdata *plat = dev_get_platdata(dev); + struct sti_pinctrl_plat *plat = dev_get_plat(dev); unsigned long sysconf, *sysconfreg; int alt = pin_desc->alt; int bank = pin_desc->bank; @@ -91,7 +91,7 @@ void sti_alternate_select(struct udevice *dev, struct sti_pin_desc *pin_desc) /* pin configuration */ void sti_pin_configure(struct udevice *dev, struct sti_pin_desc *pin_desc) { - struct sti_pinctrl_platdata *plat = dev_get_platdata(dev); + struct sti_pinctrl_plat *plat = dev_get_plat(dev); int bit; int oe = 0, pu = 0, od = 0; unsigned long *sysconfreg; @@ -277,7 +277,7 @@ static int sti_pinctrl_set_state(struct udevice *dev, struct udevice *config) static int sti_pinctrl_probe(struct udevice *dev) { - struct sti_pinctrl_platdata *plat = dev_get_platdata(dev); + struct sti_pinctrl_plat *plat = dev_get_plat(dev); struct udevice *syscon; int err; @@ -316,6 +316,6 @@ U_BOOT_DRIVER(pinctrl_sti) = { .of_match = sti_pinctrl_ids, .ops = &sti_pinctrl_ops, .probe = sti_pinctrl_probe, - .platdata_auto_alloc_size = sizeof(struct sti_pinctrl_platdata), + .plat_auto = sizeof(struct sti_pinctrl_plat), .ops = &sti_pinctrl_ops, }; diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c index a62be44..7cf08db 100644 --- a/drivers/pinctrl/pinctrl-stmfx.c +++ b/drivers/pinctrl/pinctrl-stmfx.c @@ -293,7 +293,7 @@ static int stmfx_pinctrl_conf_set(struct udevice *dev, unsigned int pin, unsigned int param, unsigned int arg) { int ret, dir; - struct stmfx_pinctrl *plat = dev_get_platdata(dev); + struct stmfx_pinctrl *plat = dev_get_plat(dev); dir = stmfx_gpio_get_function(plat->gpio, pin); @@ -334,7 +334,7 @@ static int stmfx_pinctrl_conf_set(struct udevice *dev, unsigned int pin, static int stmfx_pinctrl_get_pins_count(struct udevice *dev) { - struct stmfx_pinctrl *plat = dev_get_platdata(dev); + struct stmfx_pinctrl *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv; uc_priv = dev_get_uclass_priv(plat->gpio); @@ -390,7 +390,7 @@ static int stmfx_pinctrl_get_pin_muxing(struct udevice *dev, unsigned int selector, char *buf, int size) { - struct stmfx_pinctrl *plat = dev_get_platdata(dev); + struct stmfx_pinctrl *plat = dev_get_plat(dev); int func; func = stmfx_gpio_get_function(plat->gpio, selector); @@ -406,7 +406,7 @@ static int stmfx_pinctrl_get_pin_muxing(struct udevice *dev, static int stmfx_pinctrl_bind(struct udevice *dev) { - struct stmfx_pinctrl *plat = dev_get_platdata(dev); + struct stmfx_pinctrl *plat = dev_get_plat(dev); /* subnode name is not explicit: use father name */ device_set_name(dev, dev->parent->name); @@ -418,7 +418,7 @@ static int stmfx_pinctrl_bind(struct udevice *dev) static int stmfx_pinctrl_probe(struct udevice *dev) { - struct stmfx_pinctrl *plat = dev_get_platdata(dev); + struct stmfx_pinctrl *plat = dev_get_plat(dev); return device_probe(plat->gpio); }; @@ -446,7 +446,7 @@ U_BOOT_DRIVER(stmfx_pinctrl) = { .bind = stmfx_pinctrl_bind, .probe = stmfx_pinctrl_probe, .ops = &stmfx_pinctrl_ops, - .platdata_auto_alloc_size = sizeof(struct stmfx_pinctrl), + .plat_auto = sizeof(struct stmfx_pinctrl), }; static int stmfx_chip_init(struct udevice *dev) @@ -454,7 +454,7 @@ static int stmfx_chip_init(struct udevice *dev) u8 id; u8 version[2]; int ret; - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); ret = dm_i2c_reg_read(dev, STMFX_REG_CHIP_ID); if (ret < 0) { diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index aba8810..7919e54 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -112,7 +112,7 @@ static int pinconfig_post_bind(struct udevice *dev) ofnode node; int ret; - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) return 0; dev_for_each_subnode(node, dev) { @@ -305,7 +305,7 @@ int pinctrl_select_state(struct udevice *dev, const char *statename) * Some device which is logical like mmc.blk, do not have * a valid ofnode. */ - if (!ofnode_valid(dev->node)) + if (!dev_has_ofnode(dev)) return 0; /* * Try full-implemented pinctrl first. @@ -416,7 +416,9 @@ static int __maybe_unused pinctrl_post_bind(struct udevice *dev) UCLASS_DRIVER(pinctrl) = { .id = UCLASS_PINCTRL, +#if !CONFIG_IS_ENABLED(OF_PLATDATA) .post_bind = pinctrl_post_bind, +#endif .flags = DM_UC_FLAG_SEQ_ALIAS, .name = "pinctrl", }; diff --git a/drivers/pinctrl/pinctrl_pic32.c b/drivers/pinctrl/pinctrl_pic32.c index 899c279..a19758d 100644 --- a/drivers/pinctrl/pinctrl_pic32.c +++ b/drivers/pinctrl/pinctrl_pic32.c @@ -381,5 +381,5 @@ U_BOOT_DRIVER(pinctrl_pic32) = { .ops = &pic32_pinctrl_ops, .probe = pic32_pinctrl_probe, .bind = dm_scan_fdt_dev, - .priv_auto_alloc_size = sizeof(struct pic32_pinctrl_priv), + .priv_auto = sizeof(struct pic32_pinctrl_priv), }; diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index 262b2c3..591cd1a 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -500,5 +500,5 @@ U_BOOT_DRIVER(pinctrl_stm32) = { .ops = &stm32_pinctrl_ops, .bind = stm32_pinctrl_bind, .probe = stm32_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct stm32_pinctrl_priv), + .priv_auto = sizeof(struct stm32_pinctrl_priv), }; diff --git a/drivers/pinctrl/renesas/pfc-r7s72100.c b/drivers/pinctrl/renesas/pfc-r7s72100.c index 9d7814a..82bdf05 100644 --- a/drivers/pinctrl/renesas/pfc-r7s72100.c +++ b/drivers/pinctrl/renesas/pfc-r7s72100.c @@ -32,14 +32,14 @@ DECLARE_GLOBAL_DATA_PTR; -struct r7s72100_pfc_platdata { +struct r7s72100_pfc_plat { void __iomem *base; }; static void r7s72100_pfc_set_function(struct udevice *dev, u16 bank, u16 line, u16 func, u16 inbuf, u16 bidir) { - struct r7s72100_pfc_platdata *plat = dev_get_platdata(dev); + struct r7s72100_pfc_plat *plat = dev_get_plat(dev); clrsetbits_le16(plat->base + PFCAE(bank), BIT(line), (func & BIT(2)) ? BIT(line) : 0); @@ -108,7 +108,7 @@ const struct pinctrl_ops r7s72100_pfc_ops = { static int r7s72100_pfc_probe(struct udevice *dev) { - struct r7s72100_pfc_platdata *plat = dev_get_platdata(dev); + struct r7s72100_pfc_plat *plat = dev_get_plat(dev); fdt_addr_t addr_base; ofnode node; @@ -142,6 +142,6 @@ U_BOOT_DRIVER(r7s72100_pfc) = { .id = UCLASS_PINCTRL, .of_match = r7s72100_pfc_match, .probe = r7s72100_pfc_probe, - .platdata_auto_alloc_size = sizeof(struct r7s72100_pfc_platdata), + .plat_auto = sizeof(struct r7s72100_pfc_plat), .ops = &r7s72100_pfc_ops, }; diff --git a/drivers/pinctrl/renesas/pfc.c b/drivers/pinctrl/renesas/pfc.c index fb811a9..8bb7e16 100644 --- a/drivers/pinctrl/renesas/pfc.c +++ b/drivers/pinctrl/renesas/pfc.c @@ -990,7 +990,7 @@ U_BOOT_DRIVER(pinctrl_sh_pfc) = { .name = "sh_pfc_pinctrl", .id = UCLASS_PINCTRL, .of_match = sh_pfc_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct sh_pfc_pinctrl_priv), + .priv_auto = sizeof(struct sh_pfc_pinctrl_priv), .ops = &sh_pfc_pinctrl_ops, .probe = sh_pfc_pinctrl_probe, }; diff --git a/drivers/pinctrl/rockchip/pinctrl-px30.c b/drivers/pinctrl/rockchip/pinctrl-px30.c index 617721a..6058d0f 100644 --- a/drivers/pinctrl/rockchip/pinctrl-px30.c +++ b/drivers/pinctrl/rockchip/pinctrl-px30.c @@ -361,7 +361,7 @@ U_BOOT_DRIVER(pinctrl_px30) = { .name = "rockchip_px30_pinctrl", .id = UCLASS_PINCTRL, .of_match = px30_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3036.c b/drivers/pinctrl/rockchip/pinctrl-rk3036.c index d49e300..9ccee46 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3036.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3036.c @@ -101,7 +101,7 @@ U_BOOT_DRIVER(pinctrl_rockchip) = { .name = "rk3036-pinctrl", .id = UCLASS_PINCTRL, .of_match = rk3036_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3128.c b/drivers/pinctrl/rockchip/pinctrl-rk3128.c index a175d6c..85c2e61 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3128.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3128.c @@ -203,7 +203,7 @@ U_BOOT_DRIVER(pinctrl_rk3128) = { .name = "pinctrl_rk3128", .id = UCLASS_PINCTRL, .of_match = rk3128_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3188.c b/drivers/pinctrl/rockchip/pinctrl-rk3188.c index 8f19711..06d53e2 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3188.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3188.c @@ -124,7 +124,7 @@ U_BOOT_DRIVER(rockchip_rk3188_pinctrl) = { .name = "rockchip_rk3188_pinctrl", .id = UCLASS_PINCTRL, .of_match = rk3188_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk322x.c b/drivers/pinctrl/rockchip/pinctrl-rk322x.c index 85bc0ef..fe38693 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk322x.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk322x.c @@ -290,7 +290,7 @@ U_BOOT_DRIVER(pinctrl_rk3228) = { .name = "rockchip_rk3228_pinctrl", .id = UCLASS_PINCTRL, .of_match = rk3228_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3288.c b/drivers/pinctrl/rockchip/pinctrl-rk3288.c index 011ca28..fc28102 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3288.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3288.c @@ -246,7 +246,7 @@ U_BOOT_DRIVER(rockchip_rk3288_pinctrl) = { .name = "rockchip_rk3288_pinctrl", .id = UCLASS_PINCTRL, .of_match = rk3288_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3308.c b/drivers/pinctrl/rockchip/pinctrl-rk3308.c index db2b10a..a9b87b7 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3308.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3308.c @@ -457,7 +457,7 @@ U_BOOT_DRIVER(pinctrl_rk3308) = { .name = "rockchip_rk3308_pinctrl", .id = UCLASS_PINCTRL, .of_match = rk3308_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3328.c b/drivers/pinctrl/rockchip/pinctrl-rk3328.c index 61eb9e0..aa8bd76 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3328.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3328.c @@ -321,7 +321,7 @@ U_BOOT_DRIVER(rockchip_rk3328_pinctrl) = { .name = "rockchip_rk3328_pinctrl", .id = UCLASS_PINCTRL, .of_match = rk3328_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3368.c b/drivers/pinctrl/rockchip/pinctrl-rk3368.c index d8ccd4d..18d3e3a 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3368.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3368.c @@ -175,7 +175,7 @@ U_BOOT_DRIVER(rockchip_rk3368_pinctrl) = { .name = "rockchip_rk3368_pinctrl", .id = UCLASS_PINCTRL, .of_match = rk3368_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3399.c b/drivers/pinctrl/rockchip/pinctrl-rk3399.c index d04c1af..0c1adc3 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rk3399.c +++ b/drivers/pinctrl/rockchip/pinctrl-rk3399.c @@ -315,7 +315,7 @@ U_BOOT_DRIVER(pinctrl_rk3399) = { .name = "rockchip_rk3399_pinctrl", .id = UCLASS_PINCTRL, .of_match = rk3399_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/rockchip/pinctrl-rv1108.c b/drivers/pinctrl/rockchip/pinctrl-rv1108.c index 2233432..d35425b 100644 --- a/drivers/pinctrl/rockchip/pinctrl-rv1108.c +++ b/drivers/pinctrl/rockchip/pinctrl-rv1108.c @@ -289,7 +289,7 @@ U_BOOT_DRIVER(pinctrl_rv1108) = { .name = "pinctrl_rv1108", .id = UCLASS_PINCTRL, .of_match = rv1108_pinctrl_ids, - .priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv), + .priv_auto = sizeof(struct rockchip_pinctrl_priv), .ops = &rockchip_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .bind = dm_scan_fdt_dev, diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c index 5efaa2f..a1a3cd7 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c @@ -119,6 +119,6 @@ U_BOOT_DRIVER(uniphier_ld11_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(uniphier_ld11_pinctrl_match), .probe = uniphier_ld11_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .priv_auto = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, }; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c index d3c5833..7a92a46 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c @@ -152,6 +152,6 @@ U_BOOT_DRIVER(uniphier_ld20_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(uniphier_ld20_pinctrl_match), .probe = uniphier_ld20_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .priv_auto = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, }; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c index bf1a9e9..d33e4d7 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld4.c @@ -142,6 +142,6 @@ U_BOOT_DRIVER(uniphier_ld4_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(uniphier_ld4_pinctrl_match), .probe = uniphier_ld4_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .priv_auto = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, }; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c index f22c046..0e3eb13 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld6b.c @@ -153,6 +153,6 @@ U_BOOT_DRIVER(uniphier_ld6b_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(uniphier_ld6b_pinctrl_match), .probe = uniphier_ld6b_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .priv_auto = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, }; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c index 8bae163..7ba2266 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c @@ -177,7 +177,7 @@ U_BOOT_DRIVER(uniphier_pro4_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(uniphier_pro4_pinctrl_match), .probe = uniphier_pro4_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .priv_auto = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c index 1f4931b..9ce2e2c 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c @@ -163,7 +163,7 @@ U_BOOT_DRIVER(uniphier_pro5_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(uniphier_pro5_pinctrl_match), .probe = uniphier_pro5_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .priv_auto = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c index 038a7dd..e8c2018 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c @@ -157,6 +157,6 @@ U_BOOT_DRIVER(uniphier_pxs2_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(uniphier_pxs2_pinctrl_match), .probe = uniphier_pxs2_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .priv_auto = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, }; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs3.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs3.c index 452d76d..1fc7bdb 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs3.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-pxs3.c @@ -144,6 +144,6 @@ U_BOOT_DRIVER(uniphier_pxs3_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(uniphier_pxs3_pinctrl_match), .probe = uniphier_pxs3_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .priv_auto = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, }; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c index 1e38ba1..04c06fb 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-sld8.c @@ -139,6 +139,6 @@ U_BOOT_DRIVER(uniphier_sld8_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = of_match_ptr(uniphier_sld8_pinctrl_match), .probe = uniphier_sld8_pinctrl_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .priv_auto = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, }; diff --git a/drivers/power/acpi_pmc/acpi-pmc-uclass.c b/drivers/power/acpi_pmc/acpi-pmc-uclass.c index 828963d..34446a3 100644 --- a/drivers/power/acpi_pmc/acpi-pmc-uclass.c +++ b/drivers/power/acpi_pmc/acpi-pmc-uclass.c @@ -8,6 +8,7 @@ #include <common.h> #include <dm.h> #include <log.h> +#include <spl.h> #include <acpi/acpi_s3.h> #ifdef CONFIG_X86 #include <asm/intel_pinctrl.h> @@ -60,7 +61,8 @@ int pmc_gpe_init(struct udevice *dev) * are different and if they aren't, use the reset values. */ if (dw[0] == dw[1] || dw[1] == dw[2]) { - log_info("PMC: Using default GPE route"); + if (spl_phase() > PHASE_TPL) + log_info("PMC: Using default GPE route"); gpio_cfg = readl(upriv->gpe_cfg); for (i = 0; i < upriv->gpe0_count; i++) dw[i] = gpio_cfg >> gpe0_shift(upriv, i); @@ -204,7 +206,7 @@ void pmc_dump_info(struct udevice *dev) upriv->gen_pmcon1, upriv->gen_pmcon2, upriv->gen_pmcon3); } -int pmc_ofdata_to_uc_platdata(struct udevice *dev) +int pmc_ofdata_to_uc_plat(struct udevice *dev) { struct acpi_pmc_upriv *upriv = dev_get_uclass_priv(dev); int ret; @@ -231,5 +233,5 @@ int pmc_ofdata_to_uc_platdata(struct udevice *dev) UCLASS_DRIVER(acpi_pmc) = { .id = UCLASS_ACPI_PMC, .name = "power-mgr", - .per_device_auto_alloc_size = sizeof(struct acpi_pmc_upriv), + .per_device_auto = sizeof(struct acpi_pmc_upriv), }; diff --git a/drivers/power/acpi_pmc/pmc_emul.c b/drivers/power/acpi_pmc/pmc_emul.c index 5ed6fcc..a61eb5b 100644 --- a/drivers/power/acpi_pmc/pmc_emul.c +++ b/drivers/power/acpi_pmc/pmc_emul.c @@ -14,12 +14,12 @@ #include <power/acpi_pmc.h> /** - * struct pmc_emul_platdata - platform data for this device + * struct pmc_emul_plat - platform data for this device * * @command: Current PCI command value * @bar: Current base address values */ -struct pmc_emul_platdata { +struct pmc_emul_plat { u16 command; u32 bar[6]; }; @@ -46,7 +46,7 @@ struct pmc_emul_priv { static int sandbox_pmc_emul_read_config(const struct udevice *emul, uint offset, ulong *valuep, enum pci_size_t size) { - struct pmc_emul_platdata *plat = dev_get_platdata(emul); + struct pmc_emul_plat *plat = dev_get_plat(emul); switch (offset) { case PCI_COMMAND: @@ -99,7 +99,7 @@ static int sandbox_pmc_emul_read_config(const struct udevice *emul, uint offset, static int sandbox_pmc_emul_write_config(struct udevice *emul, uint offset, ulong value, enum pci_size_t size) { - struct pmc_emul_platdata *plat = dev_get_platdata(emul); + struct pmc_emul_plat *plat = dev_get_plat(emul); switch (offset) { case PCI_COMMAND: @@ -127,7 +127,7 @@ static int sandbox_pmc_emul_write_config(struct udevice *emul, uint offset, static int sandbox_pmc_emul_find_bar(struct udevice *emul, unsigned int addr, int *barnump, unsigned int *offsetp) { - struct pmc_emul_platdata *plat = dev_get_platdata(emul); + struct pmc_emul_plat *plat = dev_get_plat(emul); int barnum; for (barnum = 0; barnum < ARRAY_SIZE(barinfo); barnum++) { @@ -235,8 +235,8 @@ U_BOOT_DRIVER(sandbox_pmc_emul_emul) = { .of_match = sandbox_pmc_emul_ids, .ops = &sandbox_pmc_emul_emul_ops, .probe = sandbox_pmc_probe, - .priv_auto_alloc_size = sizeof(struct pmc_emul_priv), - .platdata_auto_alloc_size = sizeof(struct pmc_emul_platdata), + .priv_auto = sizeof(struct pmc_emul_priv), + .plat_auto = sizeof(struct pmc_emul_plat), }; static struct pci_device_id sandbox_pmc_emul_supported[] = { diff --git a/drivers/power/acpi_pmc/sandbox.c b/drivers/power/acpi_pmc/sandbox.c index 48a6c66..8cf03f7 100644 --- a/drivers/power/acpi_pmc/sandbox.c +++ b/drivers/power/acpi_pmc/sandbox.c @@ -74,7 +74,7 @@ static int sandbox_pmc_probe(struct udevice *dev) upriv->pmc_bar0 = map_sysmem(base, 0x2000); upriv->gpe_cfg = (u32 *)(upriv->pmc_bar0 + GPIO_GPE_CFG); - return pmc_ofdata_to_uc_platdata(dev); + return pmc_ofdata_to_uc_plat(dev); } static struct acpi_pmc_ops sandbox_pmc_ops = { @@ -94,5 +94,5 @@ U_BOOT_DRIVER(pmc_sandbox) = { .of_match = sandbox_pmc_ids, .probe = sandbox_pmc_probe, .ops = &sandbox_pmc_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_pmc_priv), + .priv_auto = sizeof(struct sandbox_pmc_priv), }; diff --git a/drivers/power/domain/bcm6328-power-domain.c b/drivers/power/domain/bcm6328-power-domain.c index a494bfa..6e720e0 100644 --- a/drivers/power/domain/bcm6328-power-domain.c +++ b/drivers/power/domain/bcm6328-power-domain.c @@ -75,6 +75,6 @@ U_BOOT_DRIVER(bcm6328_power_domain) = { .id = UCLASS_POWER_DOMAIN, .of_match = bcm6328_power_domain_ids, .ops = &bcm6328_power_domain_ops, - .priv_auto_alloc_size = sizeof(struct bcm6328_power_domain), + .priv_auto = sizeof(struct bcm6328_power_domain), .probe = bcm6328_power_domain_probe, }; diff --git a/drivers/power/domain/imx8-power-domain-legacy.c b/drivers/power/domain/imx8-power-domain-legacy.c index 889b65a..ec369ae 100644 --- a/drivers/power/domain/imx8-power-domain-legacy.c +++ b/drivers/power/domain/imx8-power-domain-legacy.c @@ -100,7 +100,7 @@ static int imx8_power_domain_free(struct power_domain *power_domain) static int imx8_power_domain_on(struct power_domain *power_domain) { struct udevice *dev = power_domain->dev; - struct imx8_power_domain_platdata *pdata; + struct imx8_power_domain_plat *pdata; struct imx8_power_domain_priv *ppriv; sc_err_t ret; int err; @@ -116,7 +116,7 @@ static int imx8_power_domain_on(struct power_domain *power_domain) return err; } - pdata = (struct imx8_power_domain_platdata *)dev_get_platdata(dev); + pdata = (struct imx8_power_domain_plat *)dev_get_plat(dev); ppriv = (struct imx8_power_domain_priv *)dev_get_priv(dev); debug("%s(power_domain=%s) resource_id %d\n", __func__, dev->name, @@ -151,11 +151,11 @@ static int imx8_power_domain_off_node(struct power_domain *power_domain) struct udevice *child; struct imx8_power_domain_priv *ppriv; struct imx8_power_domain_priv *child_ppriv; - struct imx8_power_domain_platdata *pdata; + struct imx8_power_domain_plat *pdata; sc_err_t ret; ppriv = dev_get_priv(dev); - pdata = dev_get_platdata(dev); + pdata = dev_get_plat(dev); debug("%s, %s, state_on %d\n", __func__, dev->name, ppriv->state_on); @@ -202,13 +202,13 @@ static int imx8_power_domain_off_parentnodes(struct power_domain *power_domain) struct udevice *child; struct imx8_power_domain_priv *ppriv; struct imx8_power_domain_priv *child_ppriv; - struct imx8_power_domain_platdata *pdata; + struct imx8_power_domain_plat *pdata; sc_err_t ret; struct power_domain parent_pd; if (device_get_uclass_id(parent) == UCLASS_POWER_DOMAIN) { pdata = - (struct imx8_power_domain_platdata *)dev_get_platdata(parent); + (struct imx8_power_domain_plat *)dev_get_plat(parent); ppriv = (struct imx8_power_domain_priv *)dev_get_priv(parent); debug("%s, %s, state_on %d\n", __func__, parent->name, @@ -340,10 +340,10 @@ static int imx8_power_domain_probe(struct udevice *dev) return 0; } -static int imx8_power_domain_ofdata_to_platdata(struct udevice *dev) +static int imx8_power_domain_of_to_plat(struct udevice *dev) { int reg; - struct imx8_power_domain_platdata *pdata = dev_get_platdata(dev); + struct imx8_power_domain_plat *pdata = dev_get_plat(dev); reg = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", -1); if (reg == -1) { @@ -376,9 +376,9 @@ U_BOOT_DRIVER(imx8_power_domain) = { .of_match = imx8_power_domain_ids, .bind = imx8_power_domain_bind, .probe = imx8_power_domain_probe, - .ofdata_to_platdata = imx8_power_domain_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct imx8_power_domain_platdata), - .priv_auto_alloc_size = sizeof(struct imx8_power_domain_priv), + .of_to_plat = imx8_power_domain_of_to_plat, + .plat_auto = sizeof(struct imx8_power_domain_plat), + .priv_auto = sizeof(struct imx8_power_domain_priv), .ops = &imx8_power_domain_ops, .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF, }; diff --git a/drivers/power/domain/imx8m-power-domain.c b/drivers/power/domain/imx8m-power-domain.c index 0ef460d..341c83b 100644 --- a/drivers/power/domain/imx8m-power-domain.c +++ b/drivers/power/domain/imx8m-power-domain.c @@ -30,9 +30,9 @@ static int imx8m_power_domain_free(struct power_domain *power_domain) static int imx8m_power_domain_on(struct power_domain *power_domain) { struct udevice *dev = power_domain->dev; - struct imx8m_power_domain_platdata *pdata; + struct imx8m_power_domain_plat *pdata; - pdata = dev_get_platdata(dev); + pdata = dev_get_plat(dev); if (pdata->resource_id < 0) return -EINVAL; @@ -49,8 +49,8 @@ static int imx8m_power_domain_on(struct power_domain *power_domain) static int imx8m_power_domain_off(struct power_domain *power_domain) { struct udevice *dev = power_domain->dev; - struct imx8m_power_domain_platdata *pdata; - pdata = dev_get_platdata(dev); + struct imx8m_power_domain_plat *pdata; + pdata = dev_get_plat(dev); if (pdata->resource_id < 0) return -EINVAL; @@ -104,9 +104,9 @@ static int imx8m_power_domain_probe(struct udevice *dev) return 0; } -static int imx8m_power_domain_ofdata_to_platdata(struct udevice *dev) +static int imx8m_power_domain_of_to_plat(struct udevice *dev) { - struct imx8m_power_domain_platdata *pdata = dev_get_platdata(dev); + struct imx8m_power_domain_plat *pdata = dev_get_plat(dev); pdata->resource_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", -1); @@ -136,7 +136,7 @@ U_BOOT_DRIVER(imx8m_power_domain) = { .of_match = imx8m_power_domain_ids, .bind = imx8m_power_domain_bind, .probe = imx8m_power_domain_probe, - .ofdata_to_platdata = imx8m_power_domain_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct imx8m_power_domain_platdata), + .of_to_plat = imx8m_power_domain_of_to_plat, + .plat_auto = sizeof(struct imx8m_power_domain_plat), .ops = &imx8m_power_domain_ops, }; diff --git a/drivers/power/domain/meson-ee-pwrc.c b/drivers/power/domain/meson-ee-pwrc.c index 8349a9c..ef8274c 100644 --- a/drivers/power/domain/meson-ee-pwrc.c +++ b/drivers/power/domain/meson-ee-pwrc.c @@ -397,11 +397,11 @@ static int meson_ee_pwrc_probe(struct udevice *dev) if (!priv->data) return -EINVAL; - priv->regmap_hhi = syscon_node_to_regmap(dev_get_parent(dev)->node); + priv->regmap_hhi = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev))); if (IS_ERR(priv->regmap_hhi)) return PTR_ERR(priv->regmap_hhi); - ret = ofnode_read_u32(dev->node, "amlogic,ao-sysctrl", + ret = ofnode_read_u32(dev_ofnode(dev), "amlogic,ao-sysctrl", &ao_phandle); if (ret) return ret; @@ -431,5 +431,5 @@ U_BOOT_DRIVER(meson_ee_pwrc) = { .of_match = meson_ee_pwrc_ids, .probe = meson_ee_pwrc_probe, .ops = &meson_ee_pwrc_ops, - .priv_auto_alloc_size = sizeof(struct meson_ee_pwrc_priv), + .priv_auto = sizeof(struct meson_ee_pwrc_priv), }; diff --git a/drivers/power/domain/meson-gx-pwrc-vpu.c b/drivers/power/domain/meson-gx-pwrc-vpu.c index a41b230..eb94af2 100644 --- a/drivers/power/domain/meson-gx-pwrc-vpu.c +++ b/drivers/power/domain/meson-gx-pwrc-vpu.c @@ -300,11 +300,11 @@ static int meson_gx_pwrc_vpu_probe(struct udevice *dev) ofnode hhi_node; int ret; - priv->regmap_ao = syscon_node_to_regmap(dev_get_parent(dev)->node); + priv->regmap_ao = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev))); if (IS_ERR(priv->regmap_ao)) return PTR_ERR(priv->regmap_ao); - ret = ofnode_read_u32(dev->node, "amlogic,hhi-sysctrl", + ret = ofnode_read_u32(dev_ofnode(dev), "amlogic,hhi-sysctrl", &hhi_phandle); if (ret) return ret; @@ -334,5 +334,5 @@ U_BOOT_DRIVER(meson_gx_pwrc_vpu) = { .of_match = meson_gx_pwrc_vpu_ids, .probe = meson_gx_pwrc_vpu_probe, .ops = &meson_gx_pwrc_vpu_ops, - .priv_auto_alloc_size = sizeof(struct meson_gx_pwrc_vpu_priv), + .priv_auto = sizeof(struct meson_gx_pwrc_vpu_priv), }; diff --git a/drivers/power/domain/mtk-power-domain.c b/drivers/power/domain/mtk-power-domain.c index fae4749..ca2ded0 100644 --- a/drivers/power/domain/mtk-power-domain.c +++ b/drivers/power/domain/mtk-power-domain.c @@ -411,5 +411,5 @@ U_BOOT_DRIVER(mtk_power_domain) = { .ops = &mtk_power_domain_ops, .probe = mtk_power_domain_probe, .of_match = mtk_power_domain_ids, - .priv_auto_alloc_size = sizeof(struct scp_domain), + .priv_auto = sizeof(struct scp_domain), }; diff --git a/drivers/power/domain/sandbox-power-domain-test.c b/drivers/power/domain/sandbox-power-domain-test.c index 2191a94..1bf52f1 100644 --- a/drivers/power/domain/sandbox-power-domain-test.c +++ b/drivers/power/domain/sandbox-power-domain-test.c @@ -51,5 +51,5 @@ U_BOOT_DRIVER(sandbox_power_domain_test) = { .name = "sandbox_power_domain_test", .id = UCLASS_MISC, .of_match = sandbox_power_domain_test_ids, - .priv_auto_alloc_size = sizeof(struct sandbox_power_domain_test), + .priv_auto = sizeof(struct sandbox_power_domain_test), }; diff --git a/drivers/power/domain/sandbox-power-domain.c b/drivers/power/domain/sandbox-power-domain.c index 4d9a200..04a0710 100644 --- a/drivers/power/domain/sandbox-power-domain.c +++ b/drivers/power/domain/sandbox-power-domain.c @@ -88,7 +88,7 @@ U_BOOT_DRIVER(sandbox_power_domain) = { .of_match = sandbox_power_domain_ids, .bind = sandbox_power_domain_bind, .probe = sandbox_power_domain_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_power_domain), + .priv_auto = sizeof(struct sandbox_power_domain), .ops = &sandbox_power_domain_ops, }; diff --git a/drivers/power/domain/ti-sci-power-domain.c b/drivers/power/domain/ti-sci-power-domain.c index 7ee121d..f18e456 100644 --- a/drivers/power/domain/ti-sci-power-domain.c +++ b/drivers/power/domain/ti-sci-power-domain.c @@ -135,6 +135,6 @@ U_BOOT_DRIVER(ti_sci_pm_domains) = { .id = UCLASS_POWER_DOMAIN, .of_match = ti_sci_power_domain_of_match, .probe = ti_sci_power_domain_probe, - .priv_auto_alloc_size = sizeof(struct ti_sci_power_domain_data), + .priv_auto = sizeof(struct ti_sci_power_domain_data), .ops = &ti_sci_power_domain_ops, }; diff --git a/drivers/power/pmic/i2c_pmic_emul.c b/drivers/power/pmic/i2c_pmic_emul.c index 404fe00..abe3a10 100644 --- a/drivers/power/pmic/i2c_pmic_emul.c +++ b/drivers/power/pmic/i2c_pmic_emul.c @@ -30,7 +30,7 @@ struct sandbox_i2c_pmic_plat_data { static int sandbox_i2c_pmic_read_data(struct udevice *emul, uchar chip, uchar *buffer, int len) { - struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul); + struct sandbox_i2c_pmic_plat_data *plat = dev_get_plat(emul); if (plat->rw_idx + len > plat->buf_size) { pr_err("Request exceeds PMIC register range! Max register: %#x", @@ -50,7 +50,7 @@ static int sandbox_i2c_pmic_write_data(struct udevice *emul, uchar chip, uchar *buffer, int len, bool next_is_read) { - struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul); + struct sandbox_i2c_pmic_plat_data *plat = dev_get_plat(emul); /* Probe only */ if (!len) @@ -103,9 +103,9 @@ static int sandbox_i2c_pmic_xfer(struct udevice *emul, struct i2c_msg *msg, return ret; } -static int sandbox_i2c_pmic_ofdata_to_platdata(struct udevice *emul) +static int sandbox_i2c_pmic_of_to_plat(struct udevice *emul) { - struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul); + struct sandbox_i2c_pmic_plat_data *plat = dev_get_plat(emul); struct udevice *pmic_dev = i2c_emul_get_device(emul); debug("%s:%d Setting PMIC default registers\n", __func__, __LINE__); @@ -116,7 +116,7 @@ static int sandbox_i2c_pmic_ofdata_to_platdata(struct udevice *emul) static int sandbox_i2c_pmic_probe(struct udevice *emul) { - struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul); + struct sandbox_i2c_pmic_plat_data *plat = dev_get_plat(emul); struct udevice *pmic_dev = i2c_emul_get_device(emul); struct uc_pmic_priv *upriv = dev_get_uclass_priv(pmic_dev); const u8 *reg_defaults; @@ -159,8 +159,8 @@ U_BOOT_DRIVER(sandbox_i2c_pmic_emul) = { .name = "sandbox_i2c_pmic_emul", .id = UCLASS_I2C_EMUL, .of_match = sandbox_i2c_pmic_ids, - .ofdata_to_platdata = sandbox_i2c_pmic_ofdata_to_platdata, + .of_to_plat = sandbox_i2c_pmic_of_to_plat, .probe = sandbox_i2c_pmic_probe, - .platdata_auto_alloc_size = sizeof(struct sandbox_i2c_pmic_plat_data), + .plat_auto = sizeof(struct sandbox_i2c_pmic_plat_data), .ops = &sandbox_i2c_pmic_emul_ops, }; diff --git a/drivers/power/pmic/pm8916.c b/drivers/power/pmic/pm8916.c index ddc3060..5f4386d 100644 --- a/drivers/power/pmic/pm8916.c +++ b/drivers/power/pmic/pm8916.c @@ -82,5 +82,5 @@ U_BOOT_DRIVER(pmic_pm8916) = { .bind = dm_scan_fdt_dev, .probe = pm8916_probe, .ops = &pm8916_ops, - .priv_auto_alloc_size = sizeof(struct pm8916_priv), + .priv_auto = sizeof(struct pm8916_priv), }; diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c index 7770171..79166b8 100644 --- a/drivers/power/pmic/pmic-uclass.c +++ b/drivers/power/pmic/pmic-uclass.c @@ -196,5 +196,5 @@ UCLASS_DRIVER(pmic) = { .id = UCLASS_PMIC, .name = "pmic", .pre_probe = pmic_pre_probe, - .per_device_auto_alloc_size = sizeof(struct uc_pmic_priv), + .per_device_auto = sizeof(struct uc_pmic_priv), }; diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c index 148ee29..5f442fe 100644 --- a/drivers/power/pmic/rk8xx.c +++ b/drivers/power/pmic/rk8xx.c @@ -190,9 +190,9 @@ U_BOOT_DRIVER(rockchip_rk805) = { #if CONFIG_IS_ENABLED(PMIC_CHILDREN) .bind = rk8xx_bind, #endif - .priv_auto_alloc_size = sizeof(struct rk8xx_priv), + .priv_auto = sizeof(struct rk8xx_priv), .probe = rk8xx_probe, .ops = &rk8xx_ops, }; -U_BOOT_DRIVER_ALIAS(rockchip_rk805, rockchip_rk808) +DM_DRIVER_ALIAS(rockchip_rk805, rockchip_rk808) diff --git a/drivers/power/regulator/act8846.c b/drivers/power/regulator/act8846.c index 1783813..bdce973 100644 --- a/drivers/power/regulator/act8846.c +++ b/drivers/power/regulator/act8846.c @@ -128,10 +128,10 @@ static int reg_get_enable(struct udevice *dev) static int act8846_reg_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int reg = dev->driver_data; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = reg <= 4 ? REGULATOR_TYPE_BUCK : REGULATOR_TYPE_LDO; uc_pdata->mode_count = 0; diff --git a/drivers/power/regulator/as3722_regulator.c b/drivers/power/regulator/as3722_regulator.c index 0fee9bf..ec0776b 100644 --- a/drivers/power/regulator/as3722_regulator.c +++ b/drivers/power/regulator/as3722_regulator.c @@ -114,9 +114,9 @@ static int ldo_get_enable(struct udevice *dev) static int as3722_stepdown_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; @@ -125,9 +125,9 @@ static int as3722_stepdown_probe(struct udevice *dev) static int as3722_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; diff --git a/drivers/power/regulator/bd71837.c b/drivers/power/regulator/bd71837.c index 931d753..74011d6 100644 --- a/drivers/power/regulator/bd71837.c +++ b/drivers/power/regulator/bd71837.c @@ -35,7 +35,7 @@ struct bd71837_vrange { }; /** - * struct bd71837_platdata - describe regulator control registers + * struct bd71837_plat - describe regulator control registers * * @name: name of the regulator. Used for matching the dt-entry * @enable_reg: register address used to enable/disable regulator @@ -49,7 +49,7 @@ struct bd71837_vrange { * @sel_mask: bit to toggle in order to transfer the register control to SW * @dvs: whether the voltage can be changed when regulator is enabled */ -struct bd71837_platdata { +struct bd71837_plat { const char *name; u8 enable_reg; u8 enablemask; @@ -160,7 +160,7 @@ static struct bd71837_vrange ldo7_vranges[] = { * is powering NXP i.MX8. In this use-case we (for now) only allow control * for BUCK3 and BUCK4 which are not boot critical. */ -static struct bd71837_platdata bd71837_reg_data[] = { +static struct bd71837_plat bd71837_reg_data[] = { /* Bucks 1-4 which support dynamic voltage scaling */ BD_DATA("BUCK1", BD718XX_BUCK1_CTRL, HW_STATE_CONTROL, BD718XX_BUCK1_VOLT_RUN, DVS_BUCK_RUN_MASK, dvs_buck_vranges, 0, @@ -205,7 +205,7 @@ static struct bd71837_platdata bd71837_reg_data[] = { BD71837_LDO7_MASK, ldo7_vranges, 0, false, BD718XX_LDO_SEL), }; -static struct bd71837_platdata bd71847_reg_data[] = { +static struct bd71837_plat bd71847_reg_data[] = { /* Bucks 1 and 2 which support dynamic voltage scaling */ BD_DATA("BUCK1", BD718XX_BUCK1_CTRL, HW_STATE_CONTROL, BD718XX_BUCK1_VOLT_RUN, DVS_BUCK_RUN_MASK, dvs_buck_vranges, 0, @@ -274,7 +274,7 @@ static int vrange_find_selector(struct bd71837_vrange *r, int val, static int bd71837_get_enable(struct udevice *dev) { int val; - struct bd71837_platdata *plat = dev_get_platdata(dev); + struct bd71837_plat *plat = dev_get_plat(dev); /* * boot critical regulators on bd71837 must not be controlled by sw @@ -298,7 +298,7 @@ static int bd71837_get_enable(struct udevice *dev) static int bd71837_set_enable(struct udevice *dev, bool enable) { int val = 0; - struct bd71837_platdata *plat = dev_get_platdata(dev); + struct bd71837_plat *plat = dev_get_plat(dev); /* * boot critical regulators on bd71837 must not be controlled by sw @@ -321,7 +321,7 @@ static int bd71837_set_value(struct udevice *dev, int uvolt) unsigned int range; int i; int found = 0; - struct bd71837_platdata *plat = dev_get_platdata(dev); + struct bd71837_plat *plat = dev_get_plat(dev); /* * An under/overshooting may occur if voltage is changed for other @@ -369,7 +369,7 @@ static int bd71837_get_value(struct udevice *dev) { unsigned int reg, range; unsigned int tmp; - struct bd71837_platdata *plat = dev_get_platdata(dev); + struct bd71837_plat *plat = dev_get_plat(dev); int i; reg = pmic_reg_read(dev->parent, plat->volt_reg); @@ -399,11 +399,11 @@ static int bd71837_get_value(struct udevice *dev) static int bd71837_regulator_probe(struct udevice *dev) { - struct bd71837_platdata *plat = dev_get_platdata(dev); + struct bd71837_plat *plat = dev_get_plat(dev); int i, ret; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int type; - struct bd71837_platdata *init_data; + struct bd71837_plat *init_data; int data_amnt; type = dev_get_driver_data(dev_get_parent(dev)); @@ -433,7 +433,7 @@ static int bd71837_regulator_probe(struct udevice *dev) * the initial state matches dt flags and then * write the SEL bit */ - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ret = bd71837_set_enable(dev, !!(uc_pdata->boot_on || uc_pdata->always_on)); @@ -466,5 +466,5 @@ U_BOOT_DRIVER(bd71837_regulator) = { .id = UCLASS_REGULATOR, .ops = &bd71837_regulator_ops, .probe = bd71837_regulator_probe, - .platdata_auto_alloc_size = sizeof(struct bd71837_platdata), + .plat_auto = sizeof(struct bd71837_plat), }; diff --git a/drivers/power/regulator/da9063.c b/drivers/power/regulator/da9063.c index 5055e39..8df1abc 100644 --- a/drivers/power/regulator/da9063.c +++ b/drivers/power/regulator/da9063.c @@ -135,7 +135,7 @@ static const struct da9063_reg_info da9063_buck_info[] = { static int da9063_get_enable(struct udevice *dev) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; int ret; @@ -148,7 +148,7 @@ static int da9063_get_enable(struct udevice *dev) static int da9063_set_enable(struct udevice *dev, bool enable) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; return pmic_clrsetbits(dev->parent, info->en_reg, @@ -157,7 +157,7 @@ static int da9063_set_enable(struct udevice *dev, bool enable) static int da9063_get_voltage(struct udevice *dev) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; int ret; @@ -170,7 +170,7 @@ static int da9063_get_voltage(struct udevice *dev) static int da9063_set_voltage(struct udevice *dev, int uV) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; uint sel; @@ -198,7 +198,7 @@ static const struct dm_regulator_mode static int ldo_get_mode(struct udevice *dev) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; int val; @@ -214,7 +214,7 @@ static int ldo_get_mode(struct udevice *dev) static int ldo_set_mode(struct udevice *dev, int mode_id) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; const struct dm_regulator_mode *mode; @@ -230,7 +230,7 @@ static int ldo_set_mode(struct udevice *dev, int mode_id) static int buck_get_mode(struct udevice *dev) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; int i; int val; @@ -261,7 +261,7 @@ static int buck_get_mode(struct udevice *dev) static int buck_set_mode(struct udevice *dev, int mode_id) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; const struct dm_regulator_mode *mode; @@ -277,7 +277,7 @@ static int buck_set_mode(struct udevice *dev, int mode_id) static int buck_get_current_limit(struct udevice *dev) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; int val; @@ -293,7 +293,7 @@ static int buck_get_current_limit(struct udevice *dev) static int buck_set_current_limit(struct udevice *dev, int uA) { - const struct da9063_priv *priv = dev->priv; + const struct da9063_priv *priv = dev_get_priv(dev); const struct da9063_reg_info *info = priv->reg_info; int val; @@ -309,8 +309,8 @@ static int buck_set_current_limit(struct udevice *dev, int uA) static int da9063_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; - struct da9063_priv *priv = dev->priv; + struct dm_regulator_uclass_plat *uc_pdata; + struct da9063_priv *priv = dev_get_priv(dev); /* LDOs are named numerically in DT so can directly index */ if (dev->driver_data < 1 || @@ -318,7 +318,7 @@ static int da9063_ldo_probe(struct udevice *dev) return -EINVAL; priv->reg_info = &da9063_ldo_info[dev->driver_data - 1]; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; uc_pdata->mode = da9063_ldo_modes; uc_pdata->mode_count = ARRAY_SIZE(da9063_ldo_modes); @@ -328,8 +328,8 @@ static int da9063_ldo_probe(struct udevice *dev) static int da9063_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; - struct da9063_priv *priv = dev->priv; + struct dm_regulator_uclass_plat *uc_pdata; + struct da9063_priv *priv = dev_get_priv(dev); int i; /* Bucks have names rather than numbers so need to match with DT */ @@ -344,7 +344,7 @@ static int da9063_buck_probe(struct udevice *dev) if (!priv->reg_info) return -ENODEV; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; uc_pdata->mode = da9063_buck_modes; uc_pdata->mode_count = ARRAY_SIZE(da9063_buck_modes); @@ -366,7 +366,7 @@ U_BOOT_DRIVER(da9063_ldo) = { .id = UCLASS_REGULATOR, .ops = &da9063_ldo_ops, .probe = da9063_ldo_probe, - .priv_auto_alloc_size = sizeof(struct da9063_priv), + .priv_auto = sizeof(struct da9063_priv), }; static const struct dm_regulator_ops da9063_buck_ops = { @@ -385,5 +385,5 @@ U_BOOT_DRIVER(da9063_buck) = { .id = UCLASS_REGULATOR, .ops = &da9063_buck_ops, .probe = da9063_buck_probe, - .priv_auto_alloc_size = sizeof(struct da9063_priv), + .priv_auto = sizeof(struct da9063_priv), }; diff --git a/drivers/power/regulator/fan53555.c b/drivers/power/regulator/fan53555.c index b407f55..9d8a235 100644 --- a/drivers/power/regulator/fan53555.c +++ b/drivers/power/regulator/fan53555.c @@ -78,7 +78,7 @@ enum { FAN53555_MONITOR, }; -struct fan53555_platdata { +struct fan53555_plat { /* Voltage setting register */ unsigned int vol_reg; unsigned int sleep_reg; @@ -100,11 +100,11 @@ struct fan53555_priv { unsigned int sleep_vol_cache; }; -static int fan53555_regulator_ofdata_to_platdata(struct udevice *dev) +static int fan53555_regulator_of_to_plat(struct udevice *dev) { - struct fan53555_platdata *dev_pdata = dev_get_platdata(dev); - struct dm_regulator_uclass_platdata *uc_pdata = - dev_get_uclass_platdata(dev); + struct fan53555_plat *dev_pdata = dev_get_plat(dev); + struct dm_regulator_uclass_plat *uc_pdata = + dev_get_uclass_plat(dev); u32 sleep_vsel; /* This is a buck regulator */ @@ -136,7 +136,7 @@ static int fan53555_regulator_ofdata_to_platdata(struct udevice *dev) static int fan53555_regulator_get_value(struct udevice *dev) { - struct fan53555_platdata *pdata = dev_get_platdata(dev); + struct fan53555_plat *pdata = dev_get_plat(dev); struct fan53555_priv *priv = dev_get_priv(dev); int reg; int voltage; @@ -153,7 +153,7 @@ static int fan53555_regulator_get_value(struct udevice *dev) static int fan53555_regulator_set_value(struct udevice *dev, int uV) { - struct fan53555_platdata *pdata = dev_get_platdata(dev); + struct fan53555_plat *pdata = dev_get_plat(dev); struct fan53555_priv *priv = dev_get_priv(dev); u8 vol; @@ -238,8 +238,8 @@ U_BOOT_DRIVER(fan53555_regulator) = { .name = "fan53555_regulator", .id = UCLASS_REGULATOR, .ops = &fan53555_regulator_ops, - .ofdata_to_platdata = fan53555_regulator_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct fan53555_platdata), - .priv_auto_alloc_size = sizeof(struct fan53555_priv), + .of_to_plat = fan53555_regulator_of_to_plat, + .plat_auto = sizeof(struct fan53555_plat), + .priv_auto = sizeof(struct fan53555_priv), .probe = fan53555_probe, }; diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c index 2fa6c7e..d3e0fb6 100644 --- a/drivers/power/regulator/fixed.c +++ b/drivers/power/regulator/fixed.c @@ -14,26 +14,26 @@ #include "regulator_common.h" -static int fixed_regulator_ofdata_to_platdata(struct udevice *dev) +static int fixed_regulator_of_to_plat(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; - struct regulator_common_platdata *dev_pdata; + struct dm_regulator_uclass_plat *uc_pdata; + struct regulator_common_plat *dev_pdata; - dev_pdata = dev_get_platdata(dev); - uc_pdata = dev_get_uclass_platdata(dev); + dev_pdata = dev_get_plat(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) return -ENXIO; uc_pdata->type = REGULATOR_TYPE_FIXED; - return regulator_common_ofdata_to_platdata(dev, dev_pdata, "gpio"); + return regulator_common_of_to_plat(dev, dev_pdata, "gpio"); } static int fixed_regulator_get_value(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) return -ENXIO; @@ -47,9 +47,9 @@ static int fixed_regulator_get_value(struct udevice *dev) static int fixed_regulator_get_current(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) return -ENXIO; @@ -63,12 +63,12 @@ static int fixed_regulator_get_current(struct udevice *dev) static int fixed_regulator_get_enable(struct udevice *dev) { - return regulator_common_get_enable(dev, dev_get_platdata(dev)); + return regulator_common_get_enable(dev, dev_get_plat(dev)); } static int fixed_regulator_set_enable(struct udevice *dev, bool enable) { - return regulator_common_set_enable(dev, dev_get_platdata(dev), enable); + return regulator_common_set_enable(dev, dev_get_plat(dev), enable); } static const struct dm_regulator_ops fixed_regulator_ops = { @@ -88,6 +88,6 @@ U_BOOT_DRIVER(regulator_fixed) = { .id = UCLASS_REGULATOR, .ops = &fixed_regulator_ops, .of_match = fixed_regulator_ids, - .ofdata_to_platdata = fixed_regulator_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct regulator_common_platdata), + .of_to_plat = fixed_regulator_of_to_plat, + .plat_auto = sizeof(struct regulator_common_plat), }; diff --git a/drivers/power/regulator/gpio-regulator.c b/drivers/power/regulator/gpio-regulator.c index 28c9e22..e5e08a3 100644 --- a/drivers/power/regulator/gpio-regulator.c +++ b/drivers/power/regulator/gpio-regulator.c @@ -18,23 +18,23 @@ #define GPIO_REGULATOR_MAX_STATES 2 -struct gpio_regulator_platdata { - struct regulator_common_platdata common; +struct gpio_regulator_plat { + struct regulator_common_plat common; struct gpio_desc gpio; /* GPIO for regulator voltage control */ int states[GPIO_REGULATOR_MAX_STATES]; int voltages[GPIO_REGULATOR_MAX_STATES]; }; -static int gpio_regulator_ofdata_to_platdata(struct udevice *dev) +static int gpio_regulator_of_to_plat(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; - struct gpio_regulator_platdata *dev_pdata; + struct dm_regulator_uclass_plat *uc_pdata; + struct gpio_regulator_plat *dev_pdata; struct gpio_desc *gpio; int ret, count, i, j; u32 states_array[GPIO_REGULATOR_MAX_STATES * 2]; - dev_pdata = dev_get_platdata(dev); - uc_pdata = dev_get_uclass_platdata(dev); + dev_pdata = dev_get_plat(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) return -ENXIO; @@ -74,19 +74,19 @@ static int gpio_regulator_ofdata_to_platdata(struct udevice *dev) j++; } - return regulator_common_ofdata_to_platdata(dev, &dev_pdata->common, "enable-gpios"); + return regulator_common_of_to_plat(dev, &dev_pdata->common, "enable-gpios"); } static int gpio_regulator_get_value(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; - struct gpio_regulator_platdata *dev_pdata = dev_get_platdata(dev); + struct dm_regulator_uclass_plat *uc_pdata; + struct gpio_regulator_plat *dev_pdata = dev_get_plat(dev); int enable; if (!dev_pdata->gpio.dev) return -ENOSYS; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (uc_pdata->min_uV > uc_pdata->max_uV) { debug("Invalid constraints for: %s\n", uc_pdata->name); return -EINVAL; @@ -101,7 +101,7 @@ static int gpio_regulator_get_value(struct udevice *dev) static int gpio_regulator_set_value(struct udevice *dev, int uV) { - struct gpio_regulator_platdata *dev_pdata = dev_get_platdata(dev); + struct gpio_regulator_plat *dev_pdata = dev_get_plat(dev); int ret; bool enable; @@ -127,13 +127,13 @@ static int gpio_regulator_set_value(struct udevice *dev, int uV) static int gpio_regulator_get_enable(struct udevice *dev) { - struct gpio_regulator_platdata *dev_pdata = dev_get_platdata(dev); + struct gpio_regulator_plat *dev_pdata = dev_get_plat(dev); return regulator_common_get_enable(dev, &dev_pdata->common); } static int gpio_regulator_set_enable(struct udevice *dev, bool enable) { - struct gpio_regulator_platdata *dev_pdata = dev_get_platdata(dev); + struct gpio_regulator_plat *dev_pdata = dev_get_plat(dev); return regulator_common_set_enable(dev, &dev_pdata->common, enable); } @@ -154,6 +154,6 @@ U_BOOT_DRIVER(gpio_regulator) = { .id = UCLASS_REGULATOR, .ops = &gpio_regulator_ops, .of_match = gpio_regulator_ids, - .ofdata_to_platdata = gpio_regulator_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct gpio_regulator_platdata), + .of_to_plat = gpio_regulator_of_to_plat, + .plat_auto = sizeof(struct gpio_regulator_plat), }; diff --git a/drivers/power/regulator/lp873x_regulator.c b/drivers/power/regulator/lp873x_regulator.c index 5b73f54..ec1037d 100644 --- a/drivers/power/regulator/lp873x_regulator.c +++ b/drivers/power/regulator/lp873x_regulator.c @@ -24,9 +24,9 @@ static int lp873x_buck_enable(struct udevice *dev, int op, bool *enable) { int ret; unsigned int adr; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); adr = uc_pdata->ctrl_reg; ret = pmic_reg_read(dev->parent, adr); @@ -87,9 +87,9 @@ static int lp873x_buck_val(struct udevice *dev, int op, int *uV) { unsigned int hex, adr; int ret; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (op == PMIC_OP_GET) *uV = 0; @@ -126,9 +126,9 @@ static int lp873x_ldo_enable(struct udevice *dev, int op, bool *enable) { int ret; unsigned int adr; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); adr = uc_pdata->ctrl_reg; ret = pmic_reg_read(dev->parent, adr); @@ -182,12 +182,12 @@ static int lp873x_ldo_val(struct udevice *dev, int op, int *uV) unsigned int hex, adr; int ret; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; if (op == PMIC_OP_GET) *uV = 0; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); adr = uc_pdata->volt_reg; @@ -219,9 +219,9 @@ static int lp873x_ldo_val(struct udevice *dev, int op, int *uV) static int lp873x_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; int idx = dev->driver_data; @@ -272,10 +272,10 @@ static int ldo_set_enable(struct udevice *dev, bool enable) static int lp873x_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int idx; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; idx = dev->driver_data; diff --git a/drivers/power/regulator/lp87565_regulator.c b/drivers/power/regulator/lp87565_regulator.c index 4ea6c34..7214dc1 100644 --- a/drivers/power/regulator/lp87565_regulator.c +++ b/drivers/power/regulator/lp87565_regulator.c @@ -23,9 +23,9 @@ static int lp87565_buck_enable(struct udevice *dev, int op, bool *enable) { int ret; unsigned int adr; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); adr = uc_pdata->ctrl_reg; ret = pmic_reg_read(dev->parent, adr); @@ -86,9 +86,9 @@ static int lp87565_buck_val(struct udevice *dev, int op, int *uV) { unsigned int hex, adr; int ret; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (op == PMIC_OP_GET) *uV = 0; @@ -123,10 +123,10 @@ static int lp87565_buck_val(struct udevice *dev, int op, int *uV) static int lp87565_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int idx; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; idx = dev->driver_data; diff --git a/drivers/power/regulator/max77686.c b/drivers/power/regulator/max77686.c index 752dc88..f05d791 100644 --- a/drivers/power/regulator/max77686.c +++ b/drivers/power/regulator/max77686.c @@ -657,9 +657,9 @@ static int max77686_buck_enable(struct udevice *dev, int op, bool *enable) static int max77686_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; uc_pdata->mode_count = max77686_ldo_modes(dev->driver_data, @@ -721,9 +721,9 @@ static int ldo_set_mode(struct udevice *dev, int mode) static int max77686_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; uc_pdata->mode_count = max77686_buck_modes(dev->driver_data, diff --git a/drivers/power/regulator/palmas_regulator.c b/drivers/power/regulator/palmas_regulator.c index 78909f7..aaa5f3c 100644 --- a/drivers/power/regulator/palmas_regulator.c +++ b/drivers/power/regulator/palmas_regulator.c @@ -51,9 +51,9 @@ static int palmas_smps_enable(struct udevice *dev, int op, bool *enable) { int ret; unsigned int adr; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); adr = uc_pdata->ctrl_reg; ret = pmic_reg_read(dev->parent, adr); @@ -120,9 +120,9 @@ static int palmas_smps_val(struct udevice *dev, int op, int *uV) unsigned int hex, adr; int ret; bool range; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (op == PMIC_OP_GET) *uV = 0; @@ -163,7 +163,7 @@ static int palmas_smps_val(struct udevice *dev, int op, int *uV) static int palmas_ldo_bypass_enable(struct udevice *dev, bool enabled) { int type = dev_get_driver_data(dev_get_parent(dev)); - struct dm_regulator_uclass_platdata *p; + struct dm_regulator_uclass_plat *p; unsigned int adr; int reg; @@ -177,7 +177,7 @@ static int palmas_ldo_bypass_enable(struct udevice *dev, bool enabled) return -ENOTSUPP; } - p = dev_get_uclass_platdata(dev); + p = dev_get_uclass_plat(dev); adr = p->ctrl_reg; reg = pmic_reg_read(dev->parent, adr); @@ -196,9 +196,9 @@ static int palmas_ldo_enable(struct udevice *dev, int op, bool *enable) { int ret; unsigned int adr; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); adr = uc_pdata->ctrl_reg; ret = pmic_reg_read(dev->parent, adr); @@ -256,12 +256,12 @@ static int palmas_ldo_val(struct udevice *dev, int op, int *uV) unsigned int hex, adr; int ret; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; if (op == PMIC_OP_GET) *uV = 0; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); adr = uc_pdata->volt_reg; @@ -292,10 +292,10 @@ static int palmas_ldo_val(struct udevice *dev, int op, int *uV) static int palmas_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; struct udevice *parent; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); parent = dev_get_parent(dev); int type = dev_get_driver_data(parent); @@ -356,11 +356,11 @@ static int ldo_set_enable(struct udevice *dev, bool enable) static int palmas_smps_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; struct udevice *parent; int idx; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); parent = dev_get_parent(dev); int type = dev_get_driver_data(parent); diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c index 28a9a14..5bf186e 100644 --- a/drivers/power/regulator/pbias_regulator.c +++ b/drivers/power/regulator/pbias_regulator.c @@ -16,6 +16,7 @@ #include <syscon.h> #include <linux/bitops.h> #include <linux/ioport.h> +#include <dm/device-internal.h> #include <dm/read.h> #ifdef CONFIG_MMC_OMAP36XX_PINS #include <asm/arch/sys_proto.h> @@ -64,7 +65,7 @@ static int pbias_read(struct udevice *dev, uint reg, uint8_t *buff, int len) return regmap_read(priv->regmap, priv->offset, (u32 *)buff); } -static int pbias_ofdata_to_platdata(struct udevice *dev) +static int pbias_of_to_plat(struct udevice *dev) { struct pbias_priv *priv = dev_get_priv(dev); struct udevice *syscon; @@ -102,7 +103,8 @@ static int pbias_bind(struct udevice *dev) { int children; - children = pmic_bind_children(dev, dev->node, pmic_children_info); + children = pmic_bind_children(dev, dev_ofnode(dev), + pmic_children_info); if (!children) debug("%s: %s - no child found\n", __func__, dev->name); @@ -129,8 +131,8 @@ U_BOOT_DRIVER(pbias_pmic) = { .of_match = pbias_ids, .bind = pbias_bind, .ops = &pbias_ops, - .ofdata_to_platdata = pbias_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct pbias_priv), + .of_to_plat = pbias_of_to_plat, + .priv_auto = sizeof(struct pbias_priv), }; static const struct pbias_reg_info pbias_mmc_omap2430 = { @@ -179,9 +181,9 @@ static const struct pbias_reg_info *pbias_reg_infos[] = { static int pbias_regulator_probe(struct udevice *dev) { const struct pbias_reg_info **p = pbias_reg_infos; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); while (*p) { int rc; @@ -208,7 +210,7 @@ static int pbias_regulator_probe(struct udevice *dev) } uc_pdata->type = REGULATOR_TYPE_OTHER; - dev->priv = (void *)*p; + dev_set_priv(dev, (void *)*p); return 0; } diff --git a/drivers/power/regulator/pfuze100.c b/drivers/power/regulator/pfuze100.c index b568430..698a6fa 100644 --- a/drivers/power/regulator/pfuze100.c +++ b/drivers/power/regulator/pfuze100.c @@ -41,11 +41,11 @@ struct pfuze100_regulator_desc { }; /** - * struct pfuze100_regulator_platdata - platform data for pfuze100 + * struct pfuze100_regulator_plat - platform data for pfuze100 * * @desc: Points the description entry of one regulator of pfuze100 */ -struct pfuze100_regulator_platdata { +struct pfuze100_regulator_plat { struct pfuze100_regulator_desc *desc; }; @@ -260,8 +260,8 @@ static struct pfuze100_regulator_desc *se_desc(struct pfuze100_regulator_desc *d static int pfuze100_regulator_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; - struct pfuze100_regulator_platdata *plat = dev_get_platdata(dev); + struct dm_regulator_uclass_plat *uc_pdata; + struct pfuze100_regulator_plat *plat = dev_get_plat(dev); struct pfuze100_regulator_desc *desc; switch (dev_get_driver_data(dev_get_parent(dev))) { @@ -290,7 +290,7 @@ static int pfuze100_regulator_probe(struct udevice *dev) } plat->desc = desc; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = desc->type; if (uc_pdata->type == REGULATOR_TYPE_BUCK) { @@ -315,7 +315,7 @@ static int pfuze100_regulator_probe(struct udevice *dev) static int pfuze100_regulator_mode(struct udevice *dev, int op, int *opmode) { int val; - struct pfuze100_regulator_platdata *plat = dev_get_platdata(dev); + struct pfuze100_regulator_plat *plat = dev_get_plat(dev); struct pfuze100_regulator_desc *desc = plat->desc; if (op == PMIC_OP_GET) { @@ -386,8 +386,8 @@ static int pfuze100_regulator_enable(struct udevice *dev, int op, bool *enable) { int val; int ret, on_off; - struct dm_regulator_uclass_platdata *uc_pdata = - dev_get_uclass_platdata(dev); + struct dm_regulator_uclass_plat *uc_pdata = + dev_get_uclass_plat(dev); if (op == PMIC_OP_GET) { if (!strcmp(dev->name, "vrefddr")) { @@ -449,10 +449,10 @@ static int pfuze100_regulator_val(struct udevice *dev, int op, int *uV) { int i; int val; - struct pfuze100_regulator_platdata *plat = dev_get_platdata(dev); + struct pfuze100_regulator_plat *plat = dev_get_plat(dev); struct pfuze100_regulator_desc *desc = plat->desc; - struct dm_regulator_uclass_platdata *uc_pdata = - dev_get_uclass_platdata(dev); + struct dm_regulator_uclass_plat *uc_pdata = + dev_get_uclass_plat(dev); if (op == PMIC_OP_GET) { *uV = 0; @@ -572,5 +572,5 @@ U_BOOT_DRIVER(pfuze100_regulator) = { .id = UCLASS_REGULATOR, .ops = &pfuze100_regulator_ops, .probe = pfuze100_regulator_probe, - .platdata_auto_alloc_size = sizeof(struct pfuze100_regulator_platdata), + .plat_auto = sizeof(struct pfuze100_regulator_plat), }; diff --git a/drivers/power/regulator/pwm_regulator.c b/drivers/power/regulator/pwm_regulator.c index f870622..18e57db 100644 --- a/drivers/power/regulator/pwm_regulator.c +++ b/drivers/power/regulator/pwm_regulator.c @@ -89,7 +89,7 @@ static int pwm_regulator_set_voltage(struct udevice *dev, int uvolt) return ret; } -static int pwm_regulator_ofdata_to_platdata(struct udevice *dev) +static int pwm_regulator_of_to_plat(struct udevice *dev) { struct pwm_regulator_info *priv = dev_get_priv(dev); struct ofnode_phandle_args args; @@ -122,9 +122,9 @@ static int pwm_regulator_ofdata_to_platdata(struct udevice *dev) static int pwm_regulator_probe(struct udevice *dev) { struct pwm_regulator_info *priv = dev_get_priv(dev); - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; uc_pdata->mode_count = 0; @@ -154,6 +154,6 @@ U_BOOT_DRIVER(pwm_regulator) = { .ops = &pwm_regulator_ops, .probe = pwm_regulator_probe, .of_match = pwm_regulator_ids, - .ofdata_to_platdata = pwm_regulator_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct pwm_regulator_info), + .of_to_plat = pwm_regulator_of_to_plat, + .priv_auto = sizeof(struct pwm_regulator_info), }; diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c index da679a5..4d2e730 100644 --- a/drivers/power/regulator/regulator-uclass.c +++ b/drivers/power/regulator/regulator-uclass.c @@ -15,11 +15,11 @@ int regulator_mode(struct udevice *dev, struct dm_regulator_mode **modep) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; *modep = NULL; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) return -ENXIO; @@ -51,10 +51,10 @@ static void regulator_set_value_ramp_delay(struct udevice *dev, int old_uV, int regulator_set_value(struct udevice *dev, int uV) { const struct dm_regulator_ops *ops = dev_get_driver_ops(dev); - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int ret, old_uV = uV, is_enabled = 0; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (uc_pdata->min_uV != -ENODATA && uV < uc_pdata->min_uV) return -EINVAL; if (uc_pdata->max_uV != -ENODATA && uV > uc_pdata->max_uV) @@ -82,9 +82,9 @@ int regulator_set_value(struct udevice *dev, int uV) int regulator_set_suspend_value(struct udevice *dev, int uV) { const struct dm_regulator_ops *ops = dev_get_driver_ops(dev); - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (uc_pdata->min_uV != -ENODATA && uV < uc_pdata->min_uV) return -EINVAL; if (uc_pdata->max_uV != -ENODATA && uV > uc_pdata->max_uV) @@ -133,9 +133,9 @@ int regulator_get_current(struct udevice *dev) int regulator_set_current(struct udevice *dev, int uA) { const struct dm_regulator_ops *ops = dev_get_driver_ops(dev); - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (uc_pdata->min_uA != -ENODATA && uA < uc_pdata->min_uA) return -EINVAL; if (uc_pdata->max_uA != -ENODATA && uA > uc_pdata->max_uA) @@ -160,13 +160,13 @@ int regulator_get_enable(struct udevice *dev) int regulator_set_enable(struct udevice *dev, bool enable) { const struct dm_regulator_ops *ops = dev_get_driver_ops(dev); - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int ret, old_enable = 0; if (!ops || !ops->set_enable) return -ENOSYS; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!enable && uc_pdata->always_on) return -EACCES; @@ -241,7 +241,7 @@ int regulator_set_mode(struct udevice *dev, int mode) int regulator_get_by_platname(const char *plat_name, struct udevice **devp) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; struct udevice *dev; int ret; @@ -254,7 +254,7 @@ int regulator_get_by_platname(const char *plat_name, struct udevice **devp) continue; } - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata || strcmp(plat_name, uc_pdata->name)) continue; @@ -280,10 +280,10 @@ int device_get_supply_regulator(struct udevice *dev, const char *supply_name, int regulator_autoset(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int ret = 0; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ret = regulator_set_suspend_enable(dev, uc_pdata->suspend_on); if (!ret && uc_pdata->suspend_on) { @@ -313,9 +313,9 @@ int regulator_autoset(struct udevice *dev) static void regulator_show(struct udevice *dev, int ret) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); printf("%s@%s: ", dev->name, uc_pdata->name); if (uc_pdata->flags & REGULATOR_FLAG_AUTOSET_UV) @@ -370,7 +370,7 @@ int regulator_list_autoset(const char *list_platname[], static bool regulator_name_is_unique(struct udevice *check_dev, const char *check_name) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; struct udevice *dev; int check_len = strlen(check_name); int ret; @@ -381,7 +381,7 @@ static bool regulator_name_is_unique(struct udevice *check_dev, if (ret || dev == check_dev) continue; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); len = strlen(uc_pdata->name); if (len != check_len) continue; @@ -395,10 +395,10 @@ static bool regulator_name_is_unique(struct udevice *check_dev, static int regulator_post_bind(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; const char *property = "regulator-name"; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); /* Regulator's mandatory constraint */ uc_pdata->name = dev_read_string(dev, property); @@ -421,10 +421,10 @@ static int regulator_post_bind(struct udevice *dev) static int regulator_pre_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; ofnode node; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) return -ENXIO; @@ -500,6 +500,5 @@ UCLASS_DRIVER(regulator) = { .name = "regulator", .post_bind = regulator_post_bind, .pre_probe = regulator_pre_probe, - .per_device_platdata_auto_alloc_size = - sizeof(struct dm_regulator_uclass_platdata), + .per_device_plat_auto = sizeof(struct dm_regulator_uclass_plat), }; diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c index 13906b9..93d8196 100644 --- a/drivers/power/regulator/regulator_common.c +++ b/drivers/power/regulator/regulator_common.c @@ -12,8 +12,9 @@ #include "regulator_common.h" -int regulator_common_ofdata_to_platdata(struct udevice *dev, - struct regulator_common_platdata *dev_pdata, const char *enable_gpio_name) +int regulator_common_of_to_plat(struct udevice *dev, + struct regulator_common_plat *dev_pdata, + const char *enable_gpio_name) { struct gpio_desc *gpio; int flags = GPIOD_IS_OUT; @@ -48,7 +49,7 @@ int regulator_common_ofdata_to_platdata(struct udevice *dev, } int regulator_common_get_enable(const struct udevice *dev, - struct regulator_common_platdata *dev_pdata) + struct regulator_common_plat *dev_pdata) { /* Enable GPIO is optional */ if (!dev_pdata->gpio.dev) @@ -58,7 +59,7 @@ int regulator_common_get_enable(const struct udevice *dev, } int regulator_common_set_enable(const struct udevice *dev, - struct regulator_common_platdata *dev_pdata, bool enable) + struct regulator_common_plat *dev_pdata, bool enable) { int ret; diff --git a/drivers/power/regulator/regulator_common.h b/drivers/power/regulator/regulator_common.h index bf80439..c10492f 100644 --- a/drivers/power/regulator/regulator_common.h +++ b/drivers/power/regulator/regulator_common.h @@ -9,17 +9,18 @@ #include <asm/gpio.h> -struct regulator_common_platdata { +struct regulator_common_plat { struct gpio_desc gpio; /* GPIO for regulator enable control */ unsigned int startup_delay_us; unsigned int off_on_delay_us; }; -int regulator_common_ofdata_to_platdata(struct udevice *dev, - struct regulator_common_platdata *dev_pdata, const char *enable_gpio_name); +int regulator_common_of_to_plat(struct udevice *dev, + struct regulator_common_plat *dev_pdata, const + char *enable_gpio_name); int regulator_common_get_enable(const struct udevice *dev, - struct regulator_common_platdata *dev_pdata); + struct regulator_common_plat *dev_pdata); int regulator_common_set_enable(const struct udevice *dev, - struct regulator_common_platdata *dev_pdata, bool enable); + struct regulator_common_plat *dev_pdata, bool enable); #endif /* _REGULATOR_COMMON_H */ diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c index a08e215..0ee07ad 100644 --- a/drivers/power/regulator/rk8xx.c +++ b/drivers/power/regulator/rk8xx.c @@ -1034,9 +1034,9 @@ static int switch_set_value(struct udevice *dev, int uvolt) static int rk8xx_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; uc_pdata->mode_count = 0; @@ -1046,9 +1046,9 @@ static int rk8xx_buck_probe(struct udevice *dev) static int rk8xx_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; uc_pdata->mode_count = 0; @@ -1058,9 +1058,9 @@ static int rk8xx_ldo_probe(struct udevice *dev) static int rk8xx_switch_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_FIXED; uc_pdata->mode_count = 0; diff --git a/drivers/power/regulator/s2mps11_regulator.c b/drivers/power/regulator/s2mps11_regulator.c index a6b4f15..1c6d835 100644 --- a/drivers/power/regulator/s2mps11_regulator.c +++ b/drivers/power/regulator/s2mps11_regulator.c @@ -305,9 +305,9 @@ static int buck_set_mode(struct udevice *dev, int mode) static int s2mps11_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; uc_pdata->mode = s2mps11_buck_modes; @@ -581,9 +581,9 @@ static int ldo_set_mode(struct udevice *dev, int mode) static int s2mps11_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; uc_pdata->mode = s2mps11_ldo_modes; uc_pdata->mode_count = ARRAY_SIZE(s2mps11_ldo_modes); diff --git a/drivers/power/regulator/s5m8767.c b/drivers/power/regulator/s5m8767.c index b46a2a4..ad0b986 100644 --- a/drivers/power/regulator/s5m8767.c +++ b/drivers/power/regulator/s5m8767.c @@ -130,9 +130,9 @@ static int reg_set_value(struct udevice *dev, const struct s5m8767_para *param, static int s5m8767_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; uc_pdata->mode_count = 0; @@ -199,9 +199,9 @@ static int ldo_set_enable(struct udevice *dev, bool enable) static int s5m8767_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; uc_pdata->mode_count = 0; diff --git a/drivers/power/regulator/sandbox.c b/drivers/power/regulator/sandbox.c index 9893a6b..c52fe3d 100644 --- a/drivers/power/regulator/sandbox.c +++ b/drivers/power/regulator/sandbox.c @@ -140,13 +140,13 @@ static int out_set_value(struct udevice *dev, int output_count, int reg_type, static int out_get_mode(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; uint8_t reg_val; uint reg; int ret; int i; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); reg = (dev->driver_data - 1) * OUT_REG_COUNT + OUT_REG_OM; ret = pmic_read(dev->parent, reg, ®_val, 1); @@ -166,13 +166,13 @@ static int out_get_mode(struct udevice *dev) static int out_set_mode(struct udevice *dev, int mode) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int reg_val = -1; uint reg; int ret; int i; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (mode >= uc_pdata->mode_count) return -EINVAL; @@ -246,9 +246,9 @@ static int buck_set_enable(struct udevice *dev, bool enable) static int sandbox_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; uc_pdata->mode = sandbox_buck_modes; @@ -322,9 +322,9 @@ static int ldo_set_enable(struct udevice *dev, bool enable) static int sandbox_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; uc_pdata->mode = sandbox_ldo_modes; diff --git a/drivers/power/regulator/stm32-vrefbuf.c b/drivers/power/regulator/stm32-vrefbuf.c index 9213696..c2c5770 100644 --- a/drivers/power/regulator/stm32-vrefbuf.c +++ b/drivers/power/regulator/stm32-vrefbuf.c @@ -165,5 +165,5 @@ U_BOOT_DRIVER(stm32_vrefbuf) = { .of_match = stm32_vrefbuf_ids, .probe = stm32_vrefbuf_probe, .ops = &stm32_vrefbuf_ops, - .priv_auto_alloc_size = sizeof(struct stm32_vrefbuf), + .priv_auto = sizeof(struct stm32_vrefbuf), }; diff --git a/drivers/power/regulator/stpmic1.c b/drivers/power/regulator/stpmic1.c index 3e342f4..4839d83 100644 --- a/drivers/power/regulator/stpmic1.c +++ b/drivers/power/regulator/stpmic1.c @@ -184,7 +184,7 @@ static int stpmic1_buck_get_enable(struct udevice *dev) static int stpmic1_buck_set_enable(struct udevice *dev, bool enable) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int delay = enable ? STPMIC1_DEFAULT_START_UP_DELAY_MS : STPMIC1_DEFAULT_STOP_DELAY_MS; int ret, uv; @@ -194,7 +194,7 @@ static int stpmic1_buck_set_enable(struct udevice *dev, bool enable) return 0; if (enable) { - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uv = stpmic1_buck_get_value(dev); if (uv < uc_pdata->min_uV || uv > uc_pdata->max_uV) stpmic1_buck_set_value(dev, uc_pdata->min_uV); @@ -231,12 +231,12 @@ static int stpmic1_buck_set_mode(struct udevice *dev, int mode) static int stpmic1_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; if (!dev->driver_data || dev->driver_data > STPMIC1_MAX_BUCK) return -EINVAL; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; uc_pdata->mode = (struct dm_regulator_mode *)buck_modes; @@ -363,7 +363,7 @@ static int stpmic1_ldo_get_enable(struct udevice *dev) static int stpmic1_ldo_set_enable(struct udevice *dev, bool enable) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int delay = enable ? STPMIC1_DEFAULT_START_UP_DELAY_MS : STPMIC1_DEFAULT_STOP_DELAY_MS; int ret, uv; @@ -373,7 +373,7 @@ static int stpmic1_ldo_set_enable(struct udevice *dev, bool enable) return 0; if (enable) { - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uv = stpmic1_ldo_get_value(dev); if (uv < uc_pdata->min_uV || uv > uc_pdata->max_uV) stpmic1_ldo_set_value(dev, uc_pdata->min_uV); @@ -437,12 +437,12 @@ static int stpmic1_ldo_set_mode(struct udevice *dev, int mode) static int stpmic1_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; if (!dev->driver_data || dev->driver_data > STPMIC1_MAX_LDO) return -EINVAL; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; if (dev->driver_data - 1 == STPMIC1_LDO3) { @@ -511,9 +511,9 @@ static int stpmic1_vref_ddr_set_enable(struct udevice *dev, bool enable) static int stpmic1_vref_ddr_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_FIXED; uc_pdata->mode_count = 0; @@ -575,9 +575,9 @@ static int stpmic1_boost_set_enable(struct udevice *dev, bool enable) static int stpmic1_boost_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_FIXED; uc_pdata->mode_count = 0; @@ -648,12 +648,12 @@ static int stpmic1_pwr_sw_set_enable(struct udevice *dev, bool enable) static int stpmic1_pwr_sw_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; if (!dev->driver_data || dev->driver_data > STPMIC1_MAX_PWR_SW) return -EINVAL; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_FIXED; uc_pdata->mode_count = 0; diff --git a/drivers/power/regulator/tps62360_regulator.c b/drivers/power/regulator/tps62360_regulator.c index ce54495..b9f4504 100644 --- a/drivers/power/regulator/tps62360_regulator.c +++ b/drivers/power/regulator/tps62360_regulator.c @@ -43,7 +43,7 @@ static struct tps62360_regulator_config tps62361_data = { static int tps62360_regulator_set_value(struct udevice *dev, int uV) { - struct tps62360_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps62360_regulator_pdata *pdata = dev_get_plat(dev); u8 regval; if (uV < pdata->config->vmin || uV > pdata->config->vmax) @@ -66,7 +66,7 @@ static int tps62360_regulator_get_value(struct udevice *dev) { u8 regval; int ret; - struct tps62360_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps62360_regulator_pdata *pdata = dev_get_plat(dev); ret = dm_i2c_read(pdata->i2c, TPS62360_REG_SET0 + pdata->vsel_offset, ®val, 1); @@ -80,7 +80,7 @@ static int tps62360_regulator_get_value(struct udevice *dev) static int tps62360_regulator_probe(struct udevice *dev) { - struct tps62360_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps62360_regulator_pdata *pdata = dev_get_plat(dev); u8 vsel0; u8 vsel1; int ret; @@ -119,6 +119,6 @@ U_BOOT_DRIVER(tps62360_regulator) = { .id = UCLASS_REGULATOR, .ops = &tps62360_regulator_ops, .of_match = tps62360_regulator_ids, - .platdata_auto_alloc_size = sizeof(struct tps62360_regulator_pdata), + .plat_auto = sizeof(struct tps62360_regulator_pdata), .probe = tps62360_regulator_probe, }; diff --git a/drivers/power/regulator/tps65090_regulator.c b/drivers/power/regulator/tps65090_regulator.c index 9e45627..174ee58 100644 --- a/drivers/power/regulator/tps65090_regulator.c +++ b/drivers/power/regulator/tps65090_regulator.c @@ -14,9 +14,9 @@ static int tps65090_fet_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_OTHER; uc_pdata->mode_count = 0; diff --git a/drivers/power/regulator/tps65910_regulator.c b/drivers/power/regulator/tps65910_regulator.c index 171afd3..0ed4952 100644 --- a/drivers/power/regulator/tps65910_regulator.c +++ b/drivers/power/regulator/tps65910_regulator.c @@ -141,7 +141,7 @@ static int tps65910_regulator_get_value(struct udevice *dev, const struct regulator_props *rgp) { int sel, val, vout; - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); int vin = pdata->supply; val = pmic_reg_read(dev->parent, rgp->reg); @@ -156,7 +156,7 @@ static int tps65910_regulator_get_value(struct udevice *dev, static int tps65910_ldo_get_value(struct udevice *dev) { - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); int vin; if (!pdata) @@ -194,7 +194,7 @@ static int tps65910_regulator_set_value(struct udevice *dev, { int val; int sel = 0; - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); do { /* we only allow exact voltage matches */ @@ -216,7 +216,7 @@ static int tps65910_regulator_set_value(struct udevice *dev, static int tps65910_ldo_set_value(struct udevice *dev, int uV) { - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); int vin = pdata->supply; switch (pdata->unit) { @@ -249,7 +249,7 @@ static int tps65910_ldo_set_value(struct udevice *dev, int uV) static int tps65910_get_enable(struct udevice *dev) { int reg, val; - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); reg = get_ctrl_reg_from_unit_addr(pdata->unit); if (reg < 0) @@ -267,7 +267,7 @@ static int tps65910_set_enable(struct udevice *dev, bool enable) { int reg; uint clr, set; - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); reg = get_ctrl_reg_from_unit_addr(pdata->unit); if (reg < 0) @@ -305,7 +305,7 @@ static int buck_get_vdd1_vdd2_value(struct udevice *dev, int reg_vdd) static int tps65910_buck_get_value(struct udevice *dev) { - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); switch (pdata->unit) { case TPS65910_UNIT_VIO: @@ -323,8 +323,8 @@ static int buck_set_vdd1_vdd2_value(struct udevice *dev, int uV) { int ret, reg_vdd, gain; int val; - struct dm_regulator_uclass_platdata *uc_pdata; - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct dm_regulator_uclass_plat *uc_pdata; + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); switch (pdata->unit) { case TPS65910_UNIT_VDD1: @@ -336,7 +336,7 @@ static int buck_set_vdd1_vdd2_value(struct udevice *dev, int uV) default: return -EINVAL; } - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); /* check setpoint is within limits */ if (uV < uc_pdata->min_uV) { @@ -369,7 +369,7 @@ static int buck_set_vdd1_vdd2_value(struct udevice *dev, int uV) static int tps65910_buck_set_value(struct udevice *dev, int uV) { - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); if (pdata->unit == TPS65910_UNIT_VIO) return tps65910_regulator_set_value(dev, &smps_props_vio, uV); @@ -380,18 +380,18 @@ static int tps65910_buck_set_value(struct udevice *dev, int uV) static int tps65910_boost_get_value(struct udevice *dev) { int vout; - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); vout = (pdata->supply >= 3000000) ? 5000000 : 0; return vout; } -static int tps65910_regulator_ofdata_to_platdata(struct udevice *dev) +static int tps65910_regulator_of_to_plat(struct udevice *dev) { struct udevice *supply; int ret; const char *supply_name; - struct tps65910_regulator_pdata *pdata = dev_get_platdata(dev); + struct tps65910_regulator_pdata *pdata = dev_get_plat(dev); pdata->unit = dev_get_driver_data(dev); if (pdata->unit > TPS65910_UNIT_VMMC) @@ -424,8 +424,8 @@ U_BOOT_DRIVER(tps65910_boost) = { .name = TPS65910_BOOST_DRIVER, .id = UCLASS_REGULATOR, .ops = &tps65910_boost_ops, - .platdata_auto_alloc_size = sizeof(struct tps65910_regulator_pdata), - .ofdata_to_platdata = tps65910_regulator_ofdata_to_platdata, + .plat_auto = sizeof(struct tps65910_regulator_pdata), + .of_to_plat = tps65910_regulator_of_to_plat, }; static const struct dm_regulator_ops tps65910_buck_ops = { @@ -439,8 +439,8 @@ U_BOOT_DRIVER(tps65910_buck) = { .name = TPS65910_BUCK_DRIVER, .id = UCLASS_REGULATOR, .ops = &tps65910_buck_ops, - .platdata_auto_alloc_size = sizeof(struct tps65910_regulator_pdata), - .ofdata_to_platdata = tps65910_regulator_ofdata_to_platdata, + .plat_auto = sizeof(struct tps65910_regulator_pdata), + .of_to_plat = tps65910_regulator_of_to_plat, }; static const struct dm_regulator_ops tps65910_ldo_ops = { @@ -454,6 +454,6 @@ U_BOOT_DRIVER(tps65910_ldo) = { .name = TPS65910_LDO_DRIVER, .id = UCLASS_REGULATOR, .ops = &tps65910_ldo_ops, - .platdata_auto_alloc_size = sizeof(struct tps65910_regulator_pdata), - .ofdata_to_platdata = tps65910_regulator_ofdata_to_platdata, + .plat_auto = sizeof(struct tps65910_regulator_pdata), + .of_to_plat = tps65910_regulator_of_to_plat, }; diff --git a/drivers/power/regulator/tps65941_regulator.c b/drivers/power/regulator/tps65941_regulator.c index 150c72d..d73f832 100644 --- a/drivers/power/regulator/tps65941_regulator.c +++ b/drivers/power/regulator/tps65941_regulator.c @@ -30,9 +30,9 @@ static int tps65941_buck_enable(struct udevice *dev, int op, bool *enable) { int ret; unsigned int adr; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); adr = uc_pdata->ctrl_reg; ret = pmic_reg_read(dev->parent, adr); @@ -121,9 +121,9 @@ static int tps65941_buck_val(struct udevice *dev, int op, int *uV) { unsigned int hex, adr; int ret, delta, uwait, slew; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (op == PMIC_OP_GET) *uV = 0; @@ -182,9 +182,9 @@ static int tps65941_ldo_enable(struct udevice *dev, int op, bool *enable) { int ret; unsigned int adr; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); adr = uc_pdata->ctrl_reg; ret = pmic_reg_read(dev->parent, adr); @@ -227,9 +227,9 @@ static int tps65941_ldo_val(struct udevice *dev, int op, int *uV) { unsigned int hex, adr; int ret; - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (op == PMIC_OP_GET) *uV = 0; @@ -264,10 +264,10 @@ static int tps65941_ldo_val(struct udevice *dev, int op, int *uV) static int tps65941_ldo_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int idx; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_LDO; idx = dev->driver_data; @@ -286,10 +286,10 @@ static int tps65941_ldo_probe(struct udevice *dev) static int tps65941_buck_probe(struct udevice *dev) { - struct dm_regulator_uclass_platdata *uc_pdata; + struct dm_regulator_uclass_plat *uc_pdata; int idx; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); uc_pdata->type = REGULATOR_TYPE_BUCK; idx = dev->driver_data; diff --git a/drivers/pwm/exynos_pwm.c b/drivers/pwm/exynos_pwm.c index e55fcce..1afaf78 100644 --- a/drivers/pwm/exynos_pwm.c +++ b/drivers/pwm/exynos_pwm.c @@ -88,7 +88,7 @@ static int exynos_pwm_probe(struct udevice *dev) return 0; } -static int exynos_pwm_ofdata_to_platdata(struct udevice *dev) +static int exynos_pwm_of_to_plat(struct udevice *dev) { struct exynos_pwm_priv *priv = dev_get_priv(dev); @@ -113,6 +113,6 @@ U_BOOT_DRIVER(exynos_pwm) = { .of_match = exynos_channels, .ops = &exynos_pwm_ops, .probe = exynos_pwm_probe, - .ofdata_to_platdata = exynos_pwm_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct exynos_pwm_priv), + .of_to_plat = exynos_pwm_of_to_plat, + .priv_auto = sizeof(struct exynos_pwm_priv), }; diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c index 77a1907..2008c15 100644 --- a/drivers/pwm/pwm-imx.c +++ b/drivers/pwm/pwm-imx.c @@ -126,7 +126,7 @@ static int imx_pwm_set_enable(struct udevice *dev, uint channel, bool enable) return 0; }; -static int imx_pwm_ofdata_to_platdata(struct udevice *dev) +static int imx_pwm_of_to_plat(struct udevice *dev) { struct imx_pwm_priv *priv = dev_get_priv(dev); @@ -156,8 +156,8 @@ U_BOOT_DRIVER(imx_pwm) = { .id = UCLASS_PWM, .of_match = imx_pwm_ids, .ops = &imx_pwm_ops, - .ofdata_to_platdata = imx_pwm_ofdata_to_platdata, + .of_to_plat = imx_pwm_of_to_plat, .probe = imx_pwm_probe, - .priv_auto_alloc_size = sizeof(struct imx_pwm_priv), + .priv_auto = sizeof(struct imx_pwm_priv), }; #endif diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index cafb571..03eeacc 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -249,7 +249,7 @@ static int meson_pwm_set_invert(struct udevice *dev, uint channeln, bool polarit return meson_pwm_set_config(dev, channeln, channel->period_ns, channel->duty_ns); } -static int meson_pwm_ofdata_to_platdata(struct udevice *dev) +static int meson_pwm_of_to_plat(struct udevice *dev) { struct meson_pwm *priv = dev_get_priv(dev); @@ -304,13 +304,14 @@ static int meson_pwm_probe(struct udevice *dev) if (strcmp(cdev->driver->name, "fixed_rate_clock")) continue; - str = ofnode_read_string(cdev->node, "clock-output-names"); + str = ofnode_read_string(dev_ofnode(cdev), + "clock-output-names"); if (!str) continue; if (!strcmp(str, "xtal")) { err = uclass_get_device_by_ofnode(UCLASS_CLK, - cdev->node, + dev_ofnode(cdev), &cdev); if (err) { printf("%s%d: Failed to get xtal clk\n", __func__, i); @@ -345,7 +346,9 @@ static int meson_pwm_probe(struct udevice *dev) return -EINVAL; } - err = uclass_get_device_by_ofnode(UCLASS_CLK, cdev->node, &cdev); + err = uclass_get_device_by_ofnode(UCLASS_CLK, + dev_ofnode(cdev), + &cdev); if (err) { printf("%s%d: Failed to get clk controller\n", __func__, i); return err; @@ -522,7 +525,7 @@ U_BOOT_DRIVER(meson_pwm) = { .id = UCLASS_PWM, .of_match = meson_pwm_ids, .ops = &meson_pwm_ops, - .ofdata_to_platdata = meson_pwm_ofdata_to_platdata, + .of_to_plat = meson_pwm_of_to_plat, .probe = meson_pwm_probe, - .priv_auto_alloc_size = sizeof(struct meson_pwm), + .priv_auto = sizeof(struct meson_pwm), }; diff --git a/drivers/pwm/pwm-mtk.c b/drivers/pwm/pwm-mtk.c index 7bd8251..aee1d82 100644 --- a/drivers/pwm/pwm-mtk.c +++ b/drivers/pwm/pwm-mtk.c @@ -184,5 +184,5 @@ U_BOOT_DRIVER(mtk_pwm) = { .of_match = mtk_pwm_ids, .ops = &mtk_pwm_ops, .probe = mtk_pwm_probe, - .priv_auto_alloc_size = sizeof(struct mtk_pwm_priv), + .priv_auto = sizeof(struct mtk_pwm_priv), }; diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index 77bc659..30c3043 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -115,7 +115,7 @@ static int pwm_sifive_set_enable(struct udevice *dev, uint channel, bool enable) return 0; } -static int pwm_sifive_ofdata_to_platdata(struct udevice *dev) +static int pwm_sifive_of_to_plat(struct udevice *dev) { struct pwm_sifive_priv *priv = dev_get_priv(dev); @@ -166,7 +166,7 @@ U_BOOT_DRIVER(pwm_sifive) = { .id = UCLASS_PWM, .of_match = pwm_sifive_ids, .ops = &pwm_sifive_ops, - .ofdata_to_platdata = pwm_sifive_ofdata_to_platdata, + .of_to_plat = pwm_sifive_of_to_plat, .probe = pwm_sifive_probe, - .priv_auto_alloc_size = sizeof(struct pwm_sifive_priv), + .priv_auto = sizeof(struct pwm_sifive_priv), }; diff --git a/drivers/pwm/rk_pwm.c b/drivers/pwm/rk_pwm.c index 911da1d..a64fc4a 100644 --- a/drivers/pwm/rk_pwm.c +++ b/drivers/pwm/rk_pwm.c @@ -121,7 +121,7 @@ static int rk_pwm_set_enable(struct udevice *dev, uint channel, bool enable) return 0; } -static int rk_pwm_ofdata_to_platdata(struct udevice *dev) +static int rk_pwm_of_to_plat(struct udevice *dev) { struct rk_pwm_priv *priv = dev_get_priv(dev); @@ -213,7 +213,7 @@ U_BOOT_DRIVER(rk_pwm) = { .id = UCLASS_PWM, .of_match = rk_pwm_ids, .ops = &rk_pwm_ops, - .ofdata_to_platdata = rk_pwm_ofdata_to_platdata, + .of_to_plat = rk_pwm_of_to_plat, .probe = rk_pwm_probe, - .priv_auto_alloc_size = sizeof(struct rk_pwm_priv), + .priv_auto = sizeof(struct rk_pwm_priv), }; diff --git a/drivers/pwm/sandbox_pwm.c b/drivers/pwm/sandbox_pwm.c index 2898818..318dce7 100644 --- a/drivers/pwm/sandbox_pwm.c +++ b/drivers/pwm/sandbox_pwm.c @@ -109,5 +109,5 @@ U_BOOT_DRIVER(warm_pwm_sandbox) = { .id = UCLASS_PWM, .of_match = sandbox_pwm_ids, .ops = &sandbox_pwm_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_pwm_priv), + .priv_auto = sizeof(struct sandbox_pwm_priv), }; diff --git a/drivers/pwm/sunxi_pwm.c b/drivers/pwm/sunxi_pwm.c index e2ae1a8..6146355 100644 --- a/drivers/pwm/sunxi_pwm.c +++ b/drivers/pwm/sunxi_pwm.c @@ -148,7 +148,7 @@ static int sunxi_pwm_set_enable(struct udevice *dev, uint channel, bool enable) return 0; } -static int sunxi_pwm_ofdata_to_platdata(struct udevice *dev) +static int sunxi_pwm_of_to_plat(struct udevice *dev) { struct sunxi_pwm_priv *priv = dev_get_priv(dev); @@ -179,7 +179,7 @@ U_BOOT_DRIVER(sunxi_pwm) = { .id = UCLASS_PWM, .of_match = sunxi_pwm_ids, .ops = &sunxi_pwm_ops, - .ofdata_to_platdata = sunxi_pwm_ofdata_to_platdata, + .of_to_plat = sunxi_pwm_of_to_plat, .probe = sunxi_pwm_probe, - .priv_auto_alloc_size = sizeof(struct sunxi_pwm_priv), + .priv_auto = sizeof(struct sunxi_pwm_priv), }; diff --git a/drivers/pwm/tegra_pwm.c b/drivers/pwm/tegra_pwm.c index 5e98d0f..36c35c6 100644 --- a/drivers/pwm/tegra_pwm.c +++ b/drivers/pwm/tegra_pwm.c @@ -53,7 +53,7 @@ static int tegra_pwm_set_enable(struct udevice *dev, uint channel, bool enable) return 0; } -static int tegra_pwm_ofdata_to_platdata(struct udevice *dev) +static int tegra_pwm_of_to_plat(struct udevice *dev) { struct tegra_pwm_priv *priv = dev_get_priv(dev); @@ -78,6 +78,6 @@ U_BOOT_DRIVER(tegra_pwm) = { .id = UCLASS_PWM, .of_match = tegra_pwm_ids, .ops = &tegra_pwm_ops, - .ofdata_to_platdata = tegra_pwm_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct tegra_pwm_priv), + .of_to_plat = tegra_pwm_of_to_plat, + .priv_auto = sizeof(struct tegra_pwm_priv), }; diff --git a/drivers/ram/aspeed/sdram_ast2500.c b/drivers/ram/aspeed/sdram_ast2500.c index 9f4304c..905ef30 100644 --- a/drivers/ram/aspeed/sdram_ast2500.c +++ b/drivers/ram/aspeed/sdram_ast2500.c @@ -386,7 +386,7 @@ static int ast2500_sdrammc_probe(struct udevice *dev) return 0; } -static int ast2500_sdrammc_ofdata_to_platdata(struct udevice *dev) +static int ast2500_sdrammc_of_to_plat(struct udevice *dev) { struct dram_info *priv = dev_get_priv(dev); struct regmap *map; @@ -433,7 +433,7 @@ U_BOOT_DRIVER(sdrammc_ast2500) = { .id = UCLASS_RAM, .of_match = ast2500_sdrammc_ids, .ops = &ast2500_sdrammc_ops, - .ofdata_to_platdata = ast2500_sdrammc_ofdata_to_platdata, + .of_to_plat = ast2500_sdrammc_of_to_plat, .probe = ast2500_sdrammc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), + .priv_auto = sizeof(struct dram_info), }; diff --git a/drivers/ram/bmips_ram.c b/drivers/ram/bmips_ram.c index 8f953e7..9804524 100644 --- a/drivers/ram/bmips_ram.c +++ b/drivers/ram/bmips_ram.c @@ -172,6 +172,6 @@ U_BOOT_DRIVER(bmips_ram) = { .id = UCLASS_RAM, .of_match = bmips_ram_ids, .probe = bmips_ram_probe, - .priv_auto_alloc_size = sizeof(struct bmips_ram_priv), + .priv_auto = sizeof(struct bmips_ram_priv), .ops = &bmips_ram_ops, }; diff --git a/drivers/ram/imxrt_sdram.c b/drivers/ram/imxrt_sdram.c index b6ee02d..ca2eec7 100644 --- a/drivers/ram/imxrt_sdram.c +++ b/drivers/ram/imxrt_sdram.c @@ -224,7 +224,7 @@ static int imxrt_sdram_ipcmd(struct imxrt_semc_regs *regs, u32 mem_addr, int imxrt_sdram_init(struct udevice *dev) { - struct imxrt_sdram_params *params = dev_get_platdata(dev); + struct imxrt_sdram_params *params = dev_get_plat(dev); struct imxrt_sdram_mux *mux = params->sdram_mux; struct imxrt_sdram_control *ctrl = params->sdram_control; struct imxrt_sdram_timing *time = params->sdram_timing; @@ -302,9 +302,9 @@ int imxrt_sdram_init(struct udevice *dev) return 0; } -static int imxrt_semc_ofdata_to_platdata(struct udevice *dev) +static int imxrt_semc_of_to_plat(struct udevice *dev) { - struct imxrt_sdram_params *params = dev_get_platdata(dev); + struct imxrt_sdram_params *params = dev_get_plat(dev); ofnode bank_node; u8 bank = 0; @@ -389,7 +389,7 @@ static int imxrt_semc_ofdata_to_platdata(struct udevice *dev) static int imxrt_semc_probe(struct udevice *dev) { - struct imxrt_sdram_params *params = dev_get_platdata(dev); + struct imxrt_sdram_params *params = dev_get_plat(dev); int ret; fdt_addr_t addr; @@ -439,7 +439,7 @@ U_BOOT_DRIVER(imxrt_semc) = { .id = UCLASS_RAM, .of_match = imxrt_semc_ids, .ops = &imxrt_semc_ops, - .ofdata_to_platdata = imxrt_semc_ofdata_to_platdata, + .of_to_plat = imxrt_semc_of_to_plat, .probe = imxrt_semc_probe, - .platdata_auto_alloc_size = sizeof(struct imxrt_sdram_params), + .plat_auto = sizeof(struct imxrt_sdram_params), }; diff --git a/drivers/ram/k3-am654-ddrss.c b/drivers/ram/k3-am654-ddrss.c index 21e5a65..4ec12bf 100644 --- a/drivers/ram/k3-am654-ddrss.c +++ b/drivers/ram/k3-am654-ddrss.c @@ -1082,5 +1082,5 @@ U_BOOT_DRIVER(am654_ddrss) = { .of_match = am654_ddrss_ids, .ops = &am654_ddrss_ops, .probe = am654_ddrss_probe, - .priv_auto_alloc_size = sizeof(struct am654_ddrss_desc), + .priv_auto = sizeof(struct am654_ddrss_desc), }; diff --git a/drivers/ram/k3-j721e/k3-j721e-ddrss.c b/drivers/ram/k3-j721e/k3-j721e-ddrss.c index d647a8a..9fb1eee 100644 --- a/drivers/ram/k3-j721e/k3-j721e-ddrss.c +++ b/drivers/ram/k3-j721e/k3-j721e-ddrss.c @@ -371,5 +371,5 @@ U_BOOT_DRIVER(j721e_ddrss) = { .of_match = j721e_ddrss_ids, .ops = &j721e_ddrss_ops, .probe = j721e_ddrss_probe, - .priv_auto_alloc_size = sizeof(struct j721e_ddrss_desc), + .priv_auto = sizeof(struct j721e_ddrss_desc), }; diff --git a/drivers/ram/mediatek/ddr3-mt7629.c b/drivers/ram/mediatek/ddr3-mt7629.c index b3a68cb..d12a3b4 100644 --- a/drivers/ram/mediatek/ddr3-mt7629.c +++ b/drivers/ram/mediatek/ddr3-mt7629.c @@ -764,5 +764,5 @@ U_BOOT_DRIVER(mediatek_ddr3) = { .of_match = mtk_ddr3_ids, .ops = &mtk_ddr3_ops, .probe = mtk_ddr3_probe, - .priv_auto_alloc_size = sizeof(struct mtk_ddr3_priv), + .priv_auto = sizeof(struct mtk_ddr3_priv), }; diff --git a/drivers/ram/mpc83xx_sdram.c b/drivers/ram/mpc83xx_sdram.c index a226bac..783834c 100644 --- a/drivers/ram/mpc83xx_sdram.c +++ b/drivers/ram/mpc83xx_sdram.c @@ -305,7 +305,7 @@ static int mpc83xx_sdram_spd_init(ofnode node, u32 cs, u32 mapaddr, u32 size) return 0; } -static int mpc83xx_sdram_ofdata_to_platdata(struct udevice *dev) +static int mpc83xx_sdram_of_to_plat(struct udevice *dev) { return 0; } @@ -1093,7 +1093,7 @@ U_BOOT_DRIVER(mpc83xx_sdram) = { .id = UCLASS_RAM, .of_match = mpc83xx_sdram_ids, .ops = &mpc83xx_sdram_ops, - .ofdata_to_platdata = mpc83xx_sdram_ofdata_to_platdata, + .of_to_plat = mpc83xx_sdram_of_to_plat, .probe = mpc83xx_sdram_probe, - .priv_auto_alloc_size = sizeof(struct mpc83xx_sdram_priv), + .priv_auto = sizeof(struct mpc83xx_sdram_priv), }; diff --git a/drivers/ram/octeon/octeon_ddr.c b/drivers/ram/octeon/octeon_ddr.c index aaff9c3..6bec68d 100644 --- a/drivers/ram/octeon/octeon_ddr.c +++ b/drivers/ram/octeon/octeon_ddr.c @@ -2724,5 +2724,5 @@ U_BOOT_DRIVER(octeon_ddr) = { .of_match = octeon_ids, .ops = &octeon_ops, .probe = octeon_ddr_probe, - .priv_auto_alloc_size = sizeof(struct ddr_priv), + .plat_auto = sizeof(struct ddr_priv), }; diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c index 4fa6321..a9d0518 100644 --- a/drivers/ram/rockchip/dmc-rk3368.c +++ b/drivers/ram/rockchip/dmc-rk3368.c @@ -604,7 +604,7 @@ static int ddrphy_data_training(struct rk3368_ddr_pctl *pctl, static int sdram_col_row_detect(struct udevice *dev) { struct dram_info *priv = dev_get_priv(dev); - struct rk3368_sdram_params *params = dev_get_platdata(dev); + struct rk3368_sdram_params *params = dev_get_plat(dev); struct rk3368_ddr_pctl *pctl = priv->pctl; struct rk3368_msch *msch = priv->msch; const u32 test_pattern = 0x5aa5f00f; @@ -774,7 +774,7 @@ static void dram_all_config(struct udevice *dev) { struct dram_info *priv = dev_get_priv(dev); struct rk3368_pmu_grf *pmugrf = priv->pmugrf; - struct rk3368_sdram_params *params = dev_get_platdata(dev); + struct rk3368_sdram_params *params = dev_get_plat(dev); const struct rk3288_sdram_channel *info = ¶ms->chan; u32 sys_reg = 0; const int chan = 0; @@ -798,7 +798,7 @@ static void dram_all_config(struct udevice *dev) static int setup_sdram(struct udevice *dev) { struct dram_info *priv = dev_get_priv(dev); - struct rk3368_sdram_params *params = dev_get_platdata(dev); + struct rk3368_sdram_params *params = dev_get_plat(dev); struct rk3368_ddr_pctl *pctl = priv->pctl; struct rk3368_ddrphy *ddrphy = priv->phy; @@ -879,12 +879,12 @@ error: } #endif -static int rk3368_dmc_ofdata_to_platdata(struct udevice *dev) +static int rk3368_dmc_of_to_plat(struct udevice *dev) { int ret = 0; #if !CONFIG_IS_ENABLED(OF_PLATDATA) - struct rk3368_sdram_params *plat = dev_get_platdata(dev); + struct rk3368_sdram_params *plat = dev_get_plat(dev); ret = regmap_init_mem(dev_ofnode(dev), &plat->map); if (ret) @@ -895,9 +895,9 @@ static int rk3368_dmc_ofdata_to_platdata(struct udevice *dev) } #if CONFIG_IS_ENABLED(OF_PLATDATA) -static int conv_of_platdata(struct udevice *dev) +static int conv_of_plat(struct udevice *dev) { - struct rk3368_sdram_params *plat = dev_get_platdata(dev); + struct rk3368_sdram_params *plat = dev_get_plat(dev); struct dtd_rockchip_rk3368_dmc *of_plat = &plat->of_plat; plat->ddr_freq = of_plat->rockchip_ddr_frequency; @@ -911,7 +911,7 @@ static int conv_of_platdata(struct udevice *dev) static int rk3368_dmc_probe(struct udevice *dev) { #ifdef CONFIG_TPL_BUILD - struct rk3368_sdram_params *plat = dev_get_platdata(dev); + struct rk3368_sdram_params *plat = dev_get_plat(dev); struct rk3368_ddr_pctl *pctl; struct rk3368_ddrphy *ddrphy; struct rk3368_cru *cru; @@ -923,7 +923,7 @@ static int rk3368_dmc_probe(struct udevice *dev) struct dram_info *priv = dev_get_priv(dev); #if CONFIG_IS_ENABLED(OF_PLATDATA) - ret = conv_of_platdata(dev); + ret = conv_of_plat(dev); if (ret) return ret; #endif @@ -998,9 +998,9 @@ U_BOOT_DRIVER(rockchip_rk3368_dmc) = { .of_match = rk3368_dmc_ids, .ops = &rk3368_dmc_ops, .probe = rk3368_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), - .ofdata_to_platdata = rk3368_dmc_ofdata_to_platdata, + .priv_auto = sizeof(struct dram_info), + .of_to_plat = rk3368_dmc_of_to_plat, .probe = rk3368_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), - .platdata_auto_alloc_size = sizeof(struct rk3368_sdram_params), + .priv_auto = sizeof(struct dram_info), + .plat_auto = sizeof(struct rk3368_sdram_params), }; diff --git a/drivers/ram/rockchip/sdram_px30.c b/drivers/ram/rockchip/sdram_px30.c index 2f1f6e9..c024a0c 100644 --- a/drivers/ram/rockchip/sdram_px30.c +++ b/drivers/ram/rockchip/sdram_px30.c @@ -757,6 +757,6 @@ U_BOOT_DRIVER(dmc_px30) = { .of_match = px30_dmc_ids, .ops = &px30_dmc_ops, .probe = px30_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), + .priv_auto = sizeof(struct dram_info), }; #endif /* CONFIG_TPL_BUILD */ diff --git a/drivers/ram/rockchip/sdram_rk3128.c b/drivers/ram/rockchip/sdram_rk3128.c index 0162955..16cfbf9 100644 --- a/drivers/ram/rockchip/sdram_rk3128.c +++ b/drivers/ram/rockchip/sdram_rk3128.c @@ -54,5 +54,5 @@ U_BOOT_DRIVER(dmc_rk3128) = { .of_match = rk3128_dmc_ids, .ops = &rk3128_dmc_ops, .probe = rk3128_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), + .priv_auto = sizeof(struct dram_info), }; diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c index 06f9eba..25ae69e 100644 --- a/drivers/ram/rockchip/sdram_rk3188.c +++ b/drivers/ram/rockchip/sdram_rk3188.c @@ -809,15 +809,15 @@ error: static int setup_sdram(struct udevice *dev) { struct dram_info *priv = dev_get_priv(dev); - struct rk3188_sdram_params *params = dev_get_platdata(dev); + struct rk3188_sdram_params *params = dev_get_plat(dev); return sdram_init(priv, params); } -static int rk3188_dmc_ofdata_to_platdata(struct udevice *dev) +static int rk3188_dmc_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) - struct rk3188_sdram_params *params = dev_get_platdata(dev); + struct rk3188_sdram_params *params = dev_get_plat(dev); int ret; /* rk3188 supports only one-channel */ @@ -853,9 +853,9 @@ static int rk3188_dmc_ofdata_to_platdata(struct udevice *dev) #endif /* CONFIG_SPL_BUILD */ #if CONFIG_IS_ENABLED(OF_PLATDATA) -static int conv_of_platdata(struct udevice *dev) +static int conv_of_plat(struct udevice *dev) { - struct rk3188_sdram_params *plat = dev_get_platdata(dev); + struct rk3188_sdram_params *plat = dev_get_plat(dev); struct dtd_rockchip_rk3188_dmc *of_plat = &plat->of_plat; int ret; @@ -866,9 +866,8 @@ static int conv_of_platdata(struct udevice *dev) memcpy(&plat->base, of_plat->rockchip_sdram_params, sizeof(plat->base)); /* rk3188 supports dual-channel, set default channel num to 2 */ plat->num_channels = 1; - ret = regmap_init_mem_platdata(dev, of_plat->reg, - ARRAY_SIZE(of_plat->reg) / 2, - &plat->map); + ret = regmap_init_mem_plat(dev, of_plat->reg, + ARRAY_SIZE(of_plat->reg) / 2, &plat->map); if (ret) return ret; @@ -879,7 +878,7 @@ static int conv_of_platdata(struct udevice *dev) static int rk3188_dmc_probe(struct udevice *dev) { #ifdef CONFIG_SPL_BUILD - struct rk3188_sdram_params *plat = dev_get_platdata(dev); + struct rk3188_sdram_params *plat = dev_get_plat(dev); struct regmap *map; struct udevice *dev_clk; int ret; @@ -890,7 +889,7 @@ static int rk3188_dmc_probe(struct udevice *dev) #ifdef CONFIG_SPL_BUILD #if CONFIG_IS_ENABLED(OF_PLATDATA) - ret = conv_of_platdata(dev); + ret = conv_of_plat(dev); if (ret) return ret; #endif @@ -951,11 +950,11 @@ U_BOOT_DRIVER(rockchip_rk3188_dmc) = { .of_match = rk3188_dmc_ids, .ops = &rk3188_dmc_ops, #ifdef CONFIG_SPL_BUILD - .ofdata_to_platdata = rk3188_dmc_ofdata_to_platdata, + .of_to_plat = rk3188_dmc_of_to_plat, #endif .probe = rk3188_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), + .priv_auto = sizeof(struct dram_info), #ifdef CONFIG_SPL_BUILD - .platdata_auto_alloc_size = sizeof(struct rk3188_sdram_params), + .plat_auto = sizeof(struct rk3188_sdram_params), #endif }; diff --git a/drivers/ram/rockchip/sdram_rk322x.c b/drivers/ram/rockchip/sdram_rk322x.c index 094693c..66235bd 100644 --- a/drivers/ram/rockchip/sdram_rk322x.c +++ b/drivers/ram/rockchip/sdram_rk322x.c @@ -713,10 +713,10 @@ out: return ret; } -static int rk322x_dmc_ofdata_to_platdata(struct udevice *dev) +static int rk322x_dmc_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) - struct rk322x_sdram_params *params = dev_get_platdata(dev); + struct rk322x_sdram_params *params = dev_get_plat(dev); const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); int ret; @@ -754,9 +754,9 @@ static int rk322x_dmc_ofdata_to_platdata(struct udevice *dev) #endif /* CONFIG_TPL_BUILD */ #if CONFIG_IS_ENABLED(OF_PLATDATA) -static int conv_of_platdata(struct udevice *dev) +static int conv_of_plat(struct udevice *dev) { - struct rk322x_sdram_params *plat = dev_get_platdata(dev); + struct rk322x_sdram_params *plat = dev_get_plat(dev); struct dtd_rockchip_rk322x_dmc *of_plat = &plat->of_plat; int ret; @@ -767,9 +767,8 @@ static int conv_of_platdata(struct udevice *dev) memcpy(&plat->base, of_plat->rockchip_sdram_params, sizeof(plat->base)); plat->num_channels = 1; - ret = regmap_init_mem_platdata(dev, of_plat->reg, - ARRAY_SIZE(of_plat->reg) / 2, - &plat->map); + ret = regmap_init_mem_plat(dev, of_plat->reg, + ARRAY_SIZE(of_plat->reg) / 2, &plat->map); if (ret) return ret; @@ -780,7 +779,7 @@ static int conv_of_platdata(struct udevice *dev) static int rk322x_dmc_probe(struct udevice *dev) { #ifdef CONFIG_TPL_BUILD - struct rk322x_sdram_params *plat = dev_get_platdata(dev); + struct rk322x_sdram_params *plat = dev_get_plat(dev); int ret; struct udevice *dev_clk; #endif @@ -789,7 +788,7 @@ static int rk322x_dmc_probe(struct udevice *dev) priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); #ifdef CONFIG_TPL_BUILD #if CONFIG_IS_ENABLED(OF_PLATDATA) - ret = conv_of_platdata(dev); + ret = conv_of_plat(dev); if (ret) return ret; #endif @@ -844,12 +843,12 @@ U_BOOT_DRIVER(dmc_rk322x) = { .of_match = rk322x_dmc_ids, .ops = &rk322x_dmc_ops, #ifdef CONFIG_TPL_BUILD - .ofdata_to_platdata = rk322x_dmc_ofdata_to_platdata, + .of_to_plat = rk322x_dmc_of_to_plat, #endif .probe = rk322x_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), + .priv_auto = sizeof(struct dram_info), #ifdef CONFIG_TPL_BUILD - .platdata_auto_alloc_size = sizeof(struct rk322x_sdram_params), + .plat_auto = sizeof(struct rk322x_sdram_params), #endif }; diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c index 26e8d05..a933abf 100644 --- a/drivers/ram/rockchip/sdram_rk3288.c +++ b/drivers/ram/rockchip/sdram_rk3288.c @@ -956,7 +956,7 @@ static int veyron_init(struct dram_info *priv) static int setup_sdram(struct udevice *dev) { struct dram_info *priv = dev_get_priv(dev); - struct rk3288_sdram_params *params = dev_get_platdata(dev); + struct rk3288_sdram_params *params = dev_get_plat(dev); # ifdef CONFIG_ROCKCHIP_FAST_SPL if (priv->is_veyron) { @@ -971,10 +971,10 @@ static int setup_sdram(struct udevice *dev) return sdram_init(priv, params); } -static int rk3288_dmc_ofdata_to_platdata(struct udevice *dev) +static int rk3288_dmc_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) - struct rk3288_sdram_params *params = dev_get_platdata(dev); + struct rk3288_sdram_params *params = dev_get_plat(dev); int ret; /* Rk3288 supports dual-channel, set default channel num to 2 */ @@ -1015,9 +1015,9 @@ static int rk3288_dmc_ofdata_to_platdata(struct udevice *dev) #endif /* CONFIG_SPL_BUILD */ #if CONFIG_IS_ENABLED(OF_PLATDATA) -static int conv_of_platdata(struct udevice *dev) +static int conv_of_plat(struct udevice *dev) { - struct rk3288_sdram_params *plat = dev_get_platdata(dev); + struct rk3288_sdram_params *plat = dev_get_plat(dev); struct dtd_rockchip_rk3288_dmc *of_plat = &plat->of_plat; int ret; @@ -1028,9 +1028,8 @@ static int conv_of_platdata(struct udevice *dev) memcpy(&plat->base, of_plat->rockchip_sdram_params, sizeof(plat->base)); /* Rk3288 supports dual-channel, set default channel num to 2 */ plat->num_channels = 2; - ret = regmap_init_mem_platdata(dev, of_plat->reg, - ARRAY_SIZE(of_plat->reg) / 2, - &plat->map); + ret = regmap_init_mem_plat(dev, of_plat->reg, + ARRAY_SIZE(of_plat->reg) / 2, &plat->map); if (ret) return ret; @@ -1042,7 +1041,7 @@ static int rk3288_dmc_probe(struct udevice *dev) { #if defined(CONFIG_TPL_BUILD) || \ (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) - struct rk3288_sdram_params *plat = dev_get_platdata(dev); + struct rk3288_sdram_params *plat = dev_get_plat(dev); struct udevice *dev_clk; struct regmap *map; int ret; @@ -1053,7 +1052,7 @@ static int rk3288_dmc_probe(struct udevice *dev) #if defined(CONFIG_TPL_BUILD) || \ (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) #if CONFIG_IS_ENABLED(OF_PLATDATA) - ret = conv_of_platdata(dev); + ret = conv_of_plat(dev); if (ret) return ret; #endif @@ -1120,12 +1119,12 @@ U_BOOT_DRIVER(rockchip_rk3288_dmc) = { .ops = &rk3288_dmc_ops, #if defined(CONFIG_TPL_BUILD) || \ (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) - .ofdata_to_platdata = rk3288_dmc_ofdata_to_platdata, + .of_to_plat = rk3288_dmc_of_to_plat, #endif .probe = rk3288_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), + .priv_auto = sizeof(struct dram_info), #if defined(CONFIG_TPL_BUILD) || \ (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) - .platdata_auto_alloc_size = sizeof(struct rk3288_sdram_params), + .plat_auto = sizeof(struct rk3288_sdram_params), #endif }; diff --git a/drivers/ram/rockchip/sdram_rk3308.c b/drivers/ram/rockchip/sdram_rk3308.c index 310df79..44d7d8a 100644 --- a/drivers/ram/rockchip/sdram_rk3308.c +++ b/drivers/ram/rockchip/sdram_rk3308.c @@ -51,5 +51,5 @@ U_BOOT_DRIVER(dmc_rk3308) = { .of_match = rk3308_dmc_ids, .ops = &rk3308_dmc_ops, .probe = rk3308_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), + .priv_auto = sizeof(struct dram_info), }; diff --git a/drivers/ram/rockchip/sdram_rk3328.c b/drivers/ram/rockchip/sdram_rk3328.c index 98c7feb..9af4c37 100644 --- a/drivers/ram/rockchip/sdram_rk3328.c +++ b/drivers/ram/rockchip/sdram_rk3328.c @@ -48,15 +48,14 @@ struct rockchip_dmc_plat { }; #if CONFIG_IS_ENABLED(OF_PLATDATA) -static int conv_of_platdata(struct udevice *dev) +static int conv_of_plat(struct udevice *dev) { - struct rockchip_dmc_plat *plat = dev_get_platdata(dev); + struct rockchip_dmc_plat *plat = dev_get_plat(dev); struct dtd_rockchip_rk3328_dmc *dtplat = &plat->dtplat; int ret; - ret = regmap_init_mem_platdata(dev, dtplat->reg, - ARRAY_SIZE(dtplat->reg) / 2, - &plat->map); + ret = regmap_init_mem_plat(dev, dtplat->reg, + ARRAY_SIZE(dtplat->reg) / 2, &plat->map); if (ret) return ret; @@ -515,7 +514,7 @@ static int sdram_init_detect(struct dram_info *dram, static int rk3328_dmc_init(struct udevice *dev) { struct dram_info *priv = dev_get_priv(dev); - struct rockchip_dmc_plat *plat = dev_get_platdata(dev); + struct rockchip_dmc_plat *plat = dev_get_plat(dev); int ret; #if !CONFIG_IS_ENABLED(OF_PLATDATA) @@ -525,7 +524,7 @@ static int rk3328_dmc_init(struct udevice *dev) struct rk3328_sdram_params *params = (void *)dtplat->rockchip_sdram_params; - ret = conv_of_platdata(dev); + ret = conv_of_plat(dev); if (ret) return ret; #endif @@ -548,10 +547,10 @@ static int rk3328_dmc_init(struct udevice *dev) return 0; } -static int rk3328_dmc_ofdata_to_platdata(struct udevice *dev) +static int rk3328_dmc_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) - struct rockchip_dmc_plat *plat = dev_get_platdata(dev); + struct rockchip_dmc_plat *plat = dev_get_plat(dev); int ret; ret = dev_read_u32_array(dev, "rockchip,sdram-params", @@ -612,11 +611,11 @@ U_BOOT_DRIVER(rockchip_rk3328_dmc) = { .of_match = rk3328_dmc_ids, .ops = &rk3328_dmc_ops, #ifdef CONFIG_TPL_BUILD - .ofdata_to_platdata = rk3328_dmc_ofdata_to_platdata, + .of_to_plat = rk3328_dmc_of_to_plat, #endif .probe = rk3328_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), + .priv_auto = sizeof(struct dram_info), #ifdef CONFIG_TPL_BUILD - .platdata_auto_alloc_size = sizeof(struct rockchip_dmc_plat), + .plat_auto = sizeof(struct rockchip_dmc_plat), #endif }; diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 530c8a2..a83a670 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -3011,10 +3011,10 @@ static int sdram_init(struct dram_info *dram, return 0; } -static int rk3399_dmc_ofdata_to_platdata(struct udevice *dev) +static int rk3399_dmc_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) - struct rockchip_dmc_plat *plat = dev_get_platdata(dev); + struct rockchip_dmc_plat *plat = dev_get_plat(dev); int ret; ret = dev_read_u32_array(dev, "rockchip,sdram-params", @@ -3034,15 +3034,14 @@ static int rk3399_dmc_ofdata_to_platdata(struct udevice *dev) } #if CONFIG_IS_ENABLED(OF_PLATDATA) -static int conv_of_platdata(struct udevice *dev) +static int conv_of_plat(struct udevice *dev) { - struct rockchip_dmc_plat *plat = dev_get_platdata(dev); + struct rockchip_dmc_plat *plat = dev_get_plat(dev); struct dtd_rockchip_rk3399_dmc *dtplat = &plat->dtplat; int ret; - ret = regmap_init_mem_platdata(dev, dtplat->reg, - ARRAY_SIZE(dtplat->reg) / 2, - &plat->map); + ret = regmap_init_mem_plat(dev, dtplat->reg, + ARRAY_SIZE(dtplat->reg) / 2, &plat->map); if (ret) return ret; @@ -3067,7 +3066,7 @@ static const struct sdram_rk3399_ops rk3399_ops = { static int rk3399_dmc_init(struct udevice *dev) { struct dram_info *priv = dev_get_priv(dev); - struct rockchip_dmc_plat *plat = dev_get_platdata(dev); + struct rockchip_dmc_plat *plat = dev_get_plat(dev); int ret; #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct rk3399_sdram_params *params = &plat->sdram_params; @@ -3076,7 +3075,7 @@ static int rk3399_dmc_init(struct udevice *dev) struct rk3399_sdram_params *params = (void *)dtplat->rockchip_sdram_params; - ret = conv_of_platdata(dev); + ret = conv_of_plat(dev); if (ret) return ret; #endif @@ -3175,12 +3174,12 @@ U_BOOT_DRIVER(dmc_rk3399) = { .ops = &rk3399_dmc_ops, #if defined(CONFIG_TPL_BUILD) || \ (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) - .ofdata_to_platdata = rk3399_dmc_ofdata_to_platdata, + .of_to_plat = rk3399_dmc_of_to_plat, #endif .probe = rk3399_dmc_probe, - .priv_auto_alloc_size = sizeof(struct dram_info), + .priv_auto = sizeof(struct dram_info), #if defined(CONFIG_TPL_BUILD) || \ (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) - .platdata_auto_alloc_size = sizeof(struct rockchip_dmc_plat), + .plat_auto = sizeof(struct rockchip_dmc_plat), #endif }; diff --git a/drivers/ram/sifive/fu540_ddr.c b/drivers/ram/sifive/fu540_ddr.c index 60d4945..5a7484c 100644 --- a/drivers/ram/sifive/fu540_ddr.c +++ b/drivers/ram/sifive/fu540_ddr.c @@ -230,7 +230,7 @@ static u32 fu540_ddr_get_dram_class(volatile u32 *ctl) static int fu540_ddr_setup(struct udevice *dev) { struct fu540_ddr_info *priv = dev_get_priv(dev); - struct sifive_dmc_plat *plat = dev_get_platdata(dev); + struct sifive_dmc_plat *plat = dev_get_plat(dev); struct fu540_ddr_params *params = &plat->ddr_params; volatile u32 *denali_ctl = priv->ctl->denali_ctl; volatile u32 *denali_phy = priv->phy->denali_phy; @@ -402,8 +402,8 @@ U_BOOT_DRIVER(fu540_ddr) = { .of_match = fu540_ddr_ids, .ops = &fu540_ddr_ops, .probe = fu540_ddr_probe, - .priv_auto_alloc_size = sizeof(struct fu540_ddr_info), + .priv_auto = sizeof(struct fu540_ddr_info), #if defined(CONFIG_SPL_BUILD) - .platdata_auto_alloc_size = sizeof(struct sifive_dmc_plat), + .plat_auto = sizeof(struct sifive_dmc_plat), #endif }; diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c index 3fddf4d..4003db0 100644 --- a/drivers/ram/stm32_sdram.c +++ b/drivers/ram/stm32_sdram.c @@ -161,7 +161,7 @@ struct stm32_sdram_params { int stm32_sdram_init(struct udevice *dev) { - struct stm32_sdram_params *params = dev_get_platdata(dev); + struct stm32_sdram_params *params = dev_get_plat(dev); struct stm32_sdram_control *control; struct stm32_sdram_timing *timing; struct stm32_fmc_regs *regs = params->base; @@ -256,9 +256,9 @@ int stm32_sdram_init(struct udevice *dev) return 0; } -static int stm32_fmc_ofdata_to_platdata(struct udevice *dev) +static int stm32_fmc_of_to_plat(struct udevice *dev) { - struct stm32_sdram_params *params = dev_get_platdata(dev); + struct stm32_sdram_params *params = dev_get_plat(dev); struct bank_params *bank_params; struct ofnode_phandle_args args; u32 *syscfg_base; @@ -355,7 +355,7 @@ static int stm32_fmc_ofdata_to_platdata(struct udevice *dev) static int stm32_fmc_probe(struct udevice *dev) { - struct stm32_sdram_params *params = dev_get_platdata(dev); + struct stm32_sdram_params *params = dev_get_plat(dev); int ret; fdt_addr_t addr; @@ -407,7 +407,7 @@ U_BOOT_DRIVER(stm32_fmc) = { .id = UCLASS_RAM, .of_match = stm32_fmc_ids, .ops = &stm32_fmc_ops, - .ofdata_to_platdata = stm32_fmc_ofdata_to_platdata, + .of_to_plat = stm32_fmc_of_to_plat, .probe = stm32_fmc_probe, - .platdata_auto_alloc_size = sizeof(struct stm32_sdram_params), + .plat_auto = sizeof(struct stm32_sdram_params), }; diff --git a/drivers/ram/stm32mp1/stm32mp1_ram.c b/drivers/ram/stm32mp1/stm32mp1_ram.c index 9022679..0b6d20f 100644 --- a/drivers/ram/stm32mp1/stm32mp1_ram.c +++ b/drivers/ram/stm32mp1/stm32mp1_ram.c @@ -235,5 +235,5 @@ U_BOOT_DRIVER(ddr_stm32mp1) = { .of_match = stm32mp1_ddr_ids, .ops = &stm32mp1_ddr_ops, .probe = stm32mp1_ddr_probe, - .priv_auto_alloc_size = sizeof(struct ddr_info), + .priv_auto = sizeof(struct ddr_info), }; diff --git a/drivers/remoteproc/k3_system_controller.c b/drivers/remoteproc/k3_system_controller.c index 702d98d..89cb902 100644 --- a/drivers/remoteproc/k3_system_controller.c +++ b/drivers/remoteproc/k3_system_controller.c @@ -322,5 +322,5 @@ U_BOOT_DRIVER(k3_sysctrler) = { .id = UCLASS_REMOTEPROC, .ops = &k3_sysctrler_ops, .probe = k3_sysctrler_probe, - .priv_auto_alloc_size = sizeof(struct k3_sysctrler_privdata), + .priv_auto = sizeof(struct k3_sysctrler_privdata), }; diff --git a/drivers/remoteproc/rproc-uclass.c b/drivers/remoteproc/rproc-uclass.c index 9640a81..c2d6a4e 100644 --- a/drivers/remoteproc/rproc-uclass.c +++ b/drivers/remoteproc/rproc-uclass.c @@ -42,7 +42,7 @@ static int for_each_remoteproc_device(int (*fn) (struct udevice *dev, ret = uclass_find_next_device(&dev)) { if (ret || dev == skip_dev) continue; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ret = fn(dev, uc_pdata, data); if (ret) return ret; @@ -111,11 +111,11 @@ static int rproc_pre_probe(struct udevice *dev) struct dm_rproc_uclass_pdata *uc_pdata; const struct dm_rproc_ops *ops; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); /* See if we need to populate via fdt */ - if (!dev->platdata) { + if (!dev_get_plat(dev)) { #if CONFIG_IS_ENABLED(OF_CONTROL) int node = dev_of_offset(dev); const void *blob = gd->fdt_blob; @@ -140,7 +140,7 @@ static int rproc_pre_probe(struct udevice *dev) #endif } else { - struct dm_rproc_uclass_pdata *pdata = dev->platdata; + struct dm_rproc_uclass_pdata *pdata = dev_get_plat(dev); debug("'%s': using legacy data\n", dev->name); if (pdata->name) @@ -210,8 +210,7 @@ UCLASS_DRIVER(rproc) = { .flags = DM_UC_FLAG_SEQ_ALIAS, .pre_probe = rproc_pre_probe, .post_probe = rproc_post_probe, - .per_device_platdata_auto_alloc_size = - sizeof(struct dm_rproc_uclass_pdata), + .per_device_plat_auto = sizeof(struct dm_rproc_uclass_pdata), }; /* Remoteproc subsystem access functions */ @@ -248,7 +247,7 @@ static int _rproc_dev_is_probed(struct udevice *dev, struct dm_rproc_uclass_pdata *uc_pdata, const void *data) { - if (dev->flags & DM_FLAG_ACTIVATED) + if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) return 0; return -EAGAIN; @@ -306,7 +305,7 @@ int rproc_load(int id, ulong addr, ulong size) return ret; } - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ops = rproc_get_ops(dev); if (!ops) { @@ -366,7 +365,7 @@ static int _rproc_ops_wrapper(int id, enum rproc_ops op) return ret; } - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ops = rproc_get_ops(dev); if (!ops) { diff --git a/drivers/remoteproc/sandbox_testproc.c b/drivers/remoteproc/sandbox_testproc.c index 2b58b27..6836eca 100644 --- a/drivers/remoteproc/sandbox_testproc.c +++ b/drivers/remoteproc/sandbox_testproc.c @@ -128,7 +128,7 @@ static int sandbox_testproc_probe(struct udevice *dev) struct sandbox_test_devdata *ddata; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ddata = dev_get_priv(dev); if (!ddata) { debug("%s: platform private data missing\n", uc_pdata->name); @@ -151,7 +151,7 @@ static int sandbox_testproc_init(struct udevice *dev) struct dm_rproc_uclass_pdata *uc_pdata; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ret = sandbox_dev_move_to_state(dev, sb_init); @@ -173,7 +173,7 @@ static int sandbox_testproc_reset(struct udevice *dev) struct dm_rproc_uclass_pdata *uc_pdata; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ret = sandbox_dev_move_to_state(dev, sb_reset); @@ -197,7 +197,7 @@ static int sandbox_testproc_load(struct udevice *dev, ulong addr, ulong size) struct dm_rproc_uclass_pdata *uc_pdata; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ret = sandbox_dev_move_to_state(dev, sb_loaded); @@ -220,7 +220,7 @@ static int sandbox_testproc_start(struct udevice *dev) struct dm_rproc_uclass_pdata *uc_pdata; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ret = sandbox_dev_move_to_state(dev, sb_running); @@ -242,7 +242,7 @@ static int sandbox_testproc_stop(struct udevice *dev) struct dm_rproc_uclass_pdata *uc_pdata; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ret = sandbox_dev_move_to_state(dev, sb_init); @@ -265,7 +265,7 @@ static int sandbox_testproc_is_running(struct udevice *dev) struct sandbox_test_devdata *ddata; int ret = 1; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ddata = dev_get_priv(dev); if (ddata->current_state == sb_running) @@ -287,7 +287,7 @@ static int sandbox_testproc_ping(struct udevice *dev) struct sandbox_test_devdata *ddata; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); ddata = dev_get_priv(dev); if (ddata->current_state == sb_running) @@ -343,7 +343,7 @@ U_BOOT_DRIVER(sandbox_testproc) = { .id = UCLASS_REMOTEPROC, .ops = &sandbox_testproc_ops, .probe = sandbox_testproc_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_test_devdata), + .priv_auto = sizeof(struct sandbox_test_devdata), }; /* TODO(nm@ti.com): Remove this along with non-DT support */ @@ -352,7 +352,7 @@ static struct dm_rproc_uclass_pdata proc_3_test = { .mem_type = RPROC_INTERNAL_MEMORY_MAPPED, }; -U_BOOT_DEVICE(proc_3_demo) = { +U_BOOT_DRVINFO(proc_3_demo) = { .name = "sandbox_test_proc", - .platdata = &proc_3_test, + .plat = &proc_3_test, }; diff --git a/drivers/remoteproc/stm32_copro.c b/drivers/remoteproc/stm32_copro.c index dc87cb7..ec7694d 100644 --- a/drivers/remoteproc/stm32_copro.c +++ b/drivers/remoteproc/stm32_copro.c @@ -222,5 +222,5 @@ U_BOOT_DRIVER(stm32_copro) = { .id = UCLASS_REMOTEPROC, .ops = &stm32_copro_ops, .probe = stm32_copro_probe, - .priv_auto_alloc_size = sizeof(struct stm32_copro_privdata), + .priv_auto = sizeof(struct stm32_copro_privdata), }; diff --git a/drivers/remoteproc/ti_k3_arm64_rproc.c b/drivers/remoteproc/ti_k3_arm64_rproc.c index 28c6ddb..1041f38 100644 --- a/drivers/remoteproc/ti_k3_arm64_rproc.c +++ b/drivers/remoteproc/ti_k3_arm64_rproc.c @@ -226,6 +226,6 @@ U_BOOT_DRIVER(k3_arm64) = { .id = UCLASS_REMOTEPROC, .ops = &k3_arm64_ops, .probe = k3_arm64_probe, - .priv_auto_alloc_size = sizeof(struct k3_arm64_privdata), + .priv_auto = sizeof(struct k3_arm64_privdata), .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF, }; diff --git a/drivers/remoteproc/ti_k3_dsp_rproc.c b/drivers/remoteproc/ti_k3_dsp_rproc.c index 3361555..1a2e9dd 100644 --- a/drivers/remoteproc/ti_k3_dsp_rproc.c +++ b/drivers/remoteproc/ti_k3_dsp_rproc.c @@ -456,5 +456,5 @@ U_BOOT_DRIVER(k3_dsp) = { .ops = &k3_dsp_ops, .probe = k3_dsp_probe, .remove = k3_dsp_remove, - .priv_auto_alloc_size = sizeof(struct k3_dsp_privdata), + .priv_auto = sizeof(struct k3_dsp_privdata), }; diff --git a/drivers/remoteproc/ti_k3_r5f_rproc.c b/drivers/remoteproc/ti_k3_r5f_rproc.c index 9332a63..10bc4e9 100644 --- a/drivers/remoteproc/ti_k3_r5f_rproc.c +++ b/drivers/remoteproc/ti_k3_r5f_rproc.c @@ -866,7 +866,7 @@ U_BOOT_DRIVER(k3_r5f_rproc) = { .ops = &k3_r5f_rproc_ops, .probe = k3_r5f_probe, .remove = k3_r5f_remove, - .priv_auto_alloc_size = sizeof(struct k3_r5f_core), + .priv_auto = sizeof(struct k3_r5f_core), }; static int k3_r5f_cluster_probe(struct udevice *dev) @@ -901,6 +901,6 @@ U_BOOT_DRIVER(k3_r5fss) = { .of_match = k3_r5fss_ids, .id = UCLASS_MISC, .probe = k3_r5f_cluster_probe, - .priv_auto_alloc_size = sizeof(struct k3_r5f_cluster), + .priv_auto = sizeof(struct k3_r5f_cluster), .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF, }; diff --git a/drivers/remoteproc/ti_power_proc.c b/drivers/remoteproc/ti_power_proc.c index 350450d..9dbbb44 100644 --- a/drivers/remoteproc/ti_power_proc.c +++ b/drivers/remoteproc/ti_power_proc.c @@ -71,7 +71,7 @@ static int ti_powerproc_probe(struct udevice *dev) struct ti_powerproc_privdata *priv; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); priv = dev_get_priv(dev); ret = ti_of_to_priv(dev, priv); @@ -96,7 +96,7 @@ static int ti_powerproc_load(struct udevice *dev, ulong addr, ulong size) struct ti_powerproc_privdata *priv; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) { debug("%s: no uc pdata!\n", dev->name); return -EINVAL; @@ -131,7 +131,7 @@ static int ti_powerproc_start(struct udevice *dev) struct ti_powerproc_privdata *priv; int ret; - uc_pdata = dev_get_uclass_platdata(dev); + uc_pdata = dev_get_uclass_plat(dev); if (!uc_pdata) { debug("%s: no uc pdata!\n", dev->name); return -EINVAL; @@ -177,5 +177,5 @@ U_BOOT_DRIVER(ti_powerproc) = { .id = UCLASS_REMOTEPROC, .ops = &ti_powerproc_ops, .probe = ti_powerproc_probe, - .priv_auto_alloc_size = sizeof(struct ti_powerproc_privdata), + .priv_auto = sizeof(struct ti_powerproc_privdata), }; diff --git a/drivers/reset/reset-ast2500.c b/drivers/reset/reset-ast2500.c index e7b5c7d..c3d650f 100644 --- a/drivers/reset/reset-ast2500.c +++ b/drivers/reset/reset-ast2500.c @@ -72,7 +72,7 @@ static int ast2500_reset_probe(struct udevice *dev) /* get SCU base from clock device */ rc = uclass_get_device_by_driver(UCLASS_CLK, - DM_GET_DRIVER(aspeed_ast2500_scu), &scu_dev); + DM_DRIVER_GET(aspeed_ast2500_scu), &scu_dev); if (rc) { debug("%s: clock device not found, rc=%d\n", __func__, rc); return rc; @@ -105,5 +105,5 @@ U_BOOT_DRIVER(ast2500_reset) = { .of_match = ast2500_reset_ids, .probe = ast2500_reset_probe, .ops = &ast2500_reset_ops, - .priv_auto_alloc_size = sizeof(struct ast2500_reset_priv), + .priv_auto = sizeof(struct ast2500_reset_priv), }; diff --git a/drivers/reset/reset-bcm6345.c b/drivers/reset/reset-bcm6345.c index 156703e..f691898 100644 --- a/drivers/reset/reset-bcm6345.c +++ b/drivers/reset/reset-bcm6345.c @@ -84,5 +84,5 @@ U_BOOT_DRIVER(bcm6345_reset) = { .of_match = bcm6345_reset_ids, .ops = &bcm6345_reset_reset_ops, .probe = bcm6345_reset_probe, - .priv_auto_alloc_size = sizeof(struct bcm6345_reset_priv), + .priv_auto = sizeof(struct bcm6345_reset_priv), }; diff --git a/drivers/reset/reset-hisilicon.c b/drivers/reset/reset-hisilicon.c index 139bc5d..3f9da8c 100644 --- a/drivers/reset/reset-hisilicon.c +++ b/drivers/reset/reset-hisilicon.c @@ -102,5 +102,5 @@ U_BOOT_DRIVER(hisi_reset) = { .of_match = hisi_reset_ids, .ops = &hisi_reset_reset_ops, .probe = hisi_reset_probe, - .priv_auto_alloc_size = sizeof(struct hisi_reset_priv), + .priv_auto = sizeof(struct hisi_reset_priv), }; diff --git a/drivers/reset/reset-hsdk.c b/drivers/reset/reset-hsdk.c index 0c8f276..8318d0a 100644 --- a/drivers/reset/reset-hsdk.c +++ b/drivers/reset/reset-hsdk.c @@ -114,5 +114,5 @@ U_BOOT_DRIVER(hsdk_reset) = { .of_match = hsdk_reset_dt_match, .ops = &hsdk_reset_ops, .probe = hsdk_reset_probe, - .priv_auto_alloc_size = sizeof(struct hsdk_rst), + .priv_auto = sizeof(struct hsdk_rst), }; diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c index 96916b6..e5085ae 100644 --- a/drivers/reset/reset-imx7.c +++ b/drivers/reset/reset-imx7.c @@ -312,5 +312,5 @@ U_BOOT_DRIVER(imx7_reset) = { .of_match = imx7_reset_ids, .ops = &imx7_reset_reset_ops, .probe = imx7_reset_probe, - .priv_auto_alloc_size = sizeof(struct imx7_reset_priv), + .priv_auto = sizeof(struct imx7_reset_priv), }; diff --git a/drivers/reset/reset-ipq4019.c b/drivers/reset/reset-ipq4019.c index f216db4..15858f3 100644 --- a/drivers/reset/reset-ipq4019.c +++ b/drivers/reset/reset-ipq4019.c @@ -169,5 +169,5 @@ U_BOOT_DRIVER(ipq4019_reset) = { .of_match = ipq4019_reset_ids, .ops = &ipq4019_reset_ops, .probe = ipq4019_reset_probe, - .priv_auto_alloc_size = sizeof(struct ipq4019_reset_priv), + .priv_auto = sizeof(struct ipq4019_reset_priv), }; diff --git a/drivers/reset/reset-mediatek.c b/drivers/reset/reset-mediatek.c index 97d3d57..7427013 100644 --- a/drivers/reset/reset-mediatek.c +++ b/drivers/reset/reset-mediatek.c @@ -14,6 +14,7 @@ #include <regmap.h> #include <reset-uclass.h> #include <syscon.h> +#include <dm/device-internal.h> #include <linux/bitops.h> #include <linux/err.h> @@ -92,7 +93,7 @@ int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs) priv = malloc(sizeof(struct mediatek_reset_priv)); priv->regofs = regofs; priv->nr_resets = num_regs * 32; - rst_dev->priv = priv; + dev_set_priv(rst_dev, priv); return 0; } @@ -102,5 +103,5 @@ U_BOOT_DRIVER(mediatek_reset) = { .id = UCLASS_RESET, .probe = mediatek_reset_probe, .ops = &mediatek_reset_ops, - .priv_auto_alloc_size = sizeof(struct mediatek_reset_priv), + .priv_auto = sizeof(struct mediatek_reset_priv), }; diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 4e33278..d4e0745 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -89,5 +89,5 @@ U_BOOT_DRIVER(meson_reset) = { .of_match = meson_reset_ids, .probe = meson_reset_probe, .ops = &meson_reset_ops, - .priv_auto_alloc_size = sizeof(struct meson_reset_priv), + .priv_auto = sizeof(struct meson_reset_priv), }; diff --git a/drivers/reset/reset-mtmips.c b/drivers/reset/reset-mtmips.c index bc20e33..848425a 100644 --- a/drivers/reset/reset-mtmips.c +++ b/drivers/reset/reset-mtmips.c @@ -58,7 +58,7 @@ static int mtmips_reset_probe(struct udevice *dev) return 0; } -static int mtmips_reset_ofdata_to_platdata(struct udevice *dev) +static int mtmips_reset_of_to_plat(struct udevice *dev) { struct mtmips_reset_priv *priv = dev_get_priv(dev); @@ -78,8 +78,8 @@ U_BOOT_DRIVER(mtmips_reset) = { .name = "mtmips-reset", .id = UCLASS_RESET, .of_match = mtmips_reset_ids, - .ofdata_to_platdata = mtmips_reset_ofdata_to_platdata, + .of_to_plat = mtmips_reset_of_to_plat, .probe = mtmips_reset_probe, - .priv_auto_alloc_size = sizeof(struct mtmips_reset_priv), + .priv_auto = sizeof(struct mtmips_reset_priv), .ops = &mtmips_reset_ops, }; diff --git a/drivers/reset/reset-rockchip.c b/drivers/reset/reset-rockchip.c index 8092555..eeb3d2e 100644 --- a/drivers/reset/reset-rockchip.c +++ b/drivers/reset/reset-rockchip.c @@ -11,6 +11,7 @@ #include <linux/bitops.h> #include <linux/io.h> #include <asm/arch-rockchip/hardware.h> +#include <dm/device-internal.h> #include <dm/lists.h> /* * Each reg has 16 bits reset signal for devices @@ -121,7 +122,7 @@ int rockchip_reset_bind(struct udevice *pdev, u32 reg_offset, u32 reg_number) priv = malloc(sizeof(struct rockchip_reset_priv)); priv->reset_reg_offset = reg_offset; priv->reset_reg_num = reg_number; - rst_dev->priv = priv; + dev_set_priv(rst_dev, priv); return 0; } @@ -131,5 +132,5 @@ U_BOOT_DRIVER(rockchip_reset) = { .id = UCLASS_RESET, .probe = rockchip_reset_probe, .ops = &rockchip_reset_ops, - .priv_auto_alloc_size = sizeof(struct rockchip_reset_priv), + .priv_auto = sizeof(struct rockchip_reset_priv), }; diff --git a/drivers/reset/reset-sifive.c b/drivers/reset/reset-sifive.c index 527757f..eec840d 100644 --- a/drivers/reset/reset-sifive.c +++ b/drivers/reset/reset-sifive.c @@ -9,6 +9,7 @@ #include <reset-uclass.h> #include <asm/io.h> #include <dm/device_compat.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <linux/bitops.h> @@ -97,7 +98,7 @@ int sifive_reset_bind(struct udevice *dev, ulong count) } priv = malloc(sizeof(struct sifive_reset_priv)); priv->nr_reset = count; - rst_dev->priv = priv; + dev_set_priv(rst_dev, priv); return 0; } @@ -114,5 +115,5 @@ U_BOOT_DRIVER(sifive_reset) = { .id = UCLASS_RESET, .ops = &sifive_reset_ops, .probe = sifive_reset_probe, - .priv_auto_alloc_size = sizeof(struct sifive_reset_priv), + .priv_auto = sizeof(struct sifive_reset_priv), }; diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c index 1849db4..98450db 100644 --- a/drivers/reset/reset-socfpga.c +++ b/drivers/reset/reset-socfpga.c @@ -148,7 +148,7 @@ static int socfpga_reset_bind(struct udevice *dev) * Bind it to the node, too, so that it can get its base address. */ ret = device_bind_driver_to_node(dev, "socfpga_sysreset", "sysreset", - dev->node, &sys_child); + dev_ofnode(dev), &sys_child); if (ret) debug("Warning: No sysreset driver: ret=%d\n", ret); @@ -166,7 +166,7 @@ U_BOOT_DRIVER(socfpga_reset) = { .of_match = socfpga_reset_match, .bind = socfpga_reset_bind, .probe = socfpga_reset_probe, - .priv_auto_alloc_size = sizeof(struct socfpga_reset_data), + .priv_auto = sizeof(struct socfpga_reset_data), .ops = &socfpga_reset_ops, .remove = socfpga_reset_remove, .flags = DM_FLAG_OS_PREPARE, diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c index 05f7f59..264337e 100644 --- a/drivers/reset/reset-sunxi.c +++ b/drivers/reset/reset-sunxi.c @@ -11,6 +11,7 @@ #include <malloc.h> #include <reset-uclass.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <dm/lists.h> #include <linux/bitops.h> #include <linux/log2.h> @@ -113,7 +114,7 @@ int sunxi_reset_bind(struct udevice *dev, ulong count) priv = malloc(sizeof(struct sunxi_reset_priv)); priv->count = count; priv->desc = (const struct ccu_desc *)dev_get_driver_data(dev); - rst_dev->priv = priv; + dev_set_priv(rst_dev, priv); return 0; } @@ -123,5 +124,5 @@ U_BOOT_DRIVER(sunxi_reset) = { .id = UCLASS_RESET, .ops = &sunxi_reset_ops, .probe = sunxi_reset_probe, - .priv_auto_alloc_size = sizeof(struct sunxi_reset_priv), + .priv_auto = sizeof(struct sunxi_reset_priv), }; diff --git a/drivers/reset/reset-syscon.c b/drivers/reset/reset-syscon.c index 8520227..ff387ab 100644 --- a/drivers/reset/reset-syscon.c +++ b/drivers/reset/reset-syscon.c @@ -76,6 +76,6 @@ U_BOOT_DRIVER(syscon_reset) = { .id = UCLASS_RESET, .of_match = syscon_reset_ids, .probe = syscon_reset_probe, - .priv_auto_alloc_size = sizeof(struct syscon_reset_priv), + .priv_auto = sizeof(struct syscon_reset_priv), .ops = &syscon_reset_ops, }; diff --git a/drivers/reset/reset-ti-sci.c b/drivers/reset/reset-ti-sci.c index 95cd388..d8510a4 100644 --- a/drivers/reset/reset-ti-sci.c +++ b/drivers/reset/reset-ti-sci.c @@ -205,6 +205,6 @@ U_BOOT_DRIVER(ti_sci_reset) = { .id = UCLASS_RESET, .of_match = ti_sci_reset_of_match, .probe = ti_sci_reset_probe, - .priv_auto_alloc_size = sizeof(struct ti_sci_reset_data), + .priv_auto = sizeof(struct ti_sci_reset_data), .ops = &ti_sci_reset_ops, }; diff --git a/drivers/reset/reset-uniphier.c b/drivers/reset/reset-uniphier.c index fe1bd55..2694d13 100644 --- a/drivers/reset/reset-uniphier.c +++ b/drivers/reset/reset-uniphier.c @@ -372,6 +372,6 @@ U_BOOT_DRIVER(uniphier_reset) = { .id = UCLASS_RESET, .of_match = uniphier_reset_match, .probe = uniphier_reset_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_reset_priv), + .priv_auto = sizeof(struct uniphier_reset_priv), .ops = &uniphier_reset_ops, }; diff --git a/drivers/reset/sandbox-reset-test.c b/drivers/reset/sandbox-reset-test.c index 10e02f1..51b7981 100644 --- a/drivers/reset/sandbox-reset-test.c +++ b/drivers/reset/sandbox-reset-test.c @@ -120,5 +120,5 @@ U_BOOT_DRIVER(sandbox_reset_test) = { .name = "sandbox_reset_test", .id = UCLASS_MISC, .of_match = sandbox_reset_test_ids, - .priv_auto_alloc_size = sizeof(struct sandbox_reset_test), + .priv_auto = sizeof(struct sandbox_reset_test), }; diff --git a/drivers/reset/sandbox-reset.c b/drivers/reset/sandbox-reset.c index 08008d8..97b1b92 100644 --- a/drivers/reset/sandbox-reset.c +++ b/drivers/reset/sandbox-reset.c @@ -99,7 +99,7 @@ U_BOOT_DRIVER(sandbox_reset) = { .of_match = sandbox_reset_ids, .bind = sandbox_reset_bind, .probe = sandbox_reset_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_reset), + .priv_auto = sizeof(struct sandbox_reset), .ops = &sandbox_reset_reset_ops, }; diff --git a/drivers/reset/sti-reset.c b/drivers/reset/sti-reset.c index 2cca67d..8041490 100644 --- a/drivers/reset/sti-reset.c +++ b/drivers/reset/sti-reset.c @@ -336,6 +336,6 @@ U_BOOT_DRIVER(sti_reset) = { .id = UCLASS_RESET, .of_match = sti_reset_ids, .probe = sti_reset_probe, - .priv_auto_alloc_size = sizeof(struct sti_reset), + .priv_auto = sizeof(struct sti_reset), .ops = &sti_reset_ops, }; diff --git a/drivers/reset/stm32-reset.c b/drivers/reset/stm32-reset.c index d8902e9..b84c9da 100644 --- a/drivers/reset/stm32-reset.c +++ b/drivers/reset/stm32-reset.c @@ -100,6 +100,6 @@ U_BOOT_DRIVER(stm32_rcc_reset) = { .name = "stm32_rcc_reset", .id = UCLASS_RESET, .probe = stm32_reset_probe, - .priv_auto_alloc_size = sizeof(struct stm32_reset_priv), + .priv_auto = sizeof(struct stm32_reset_priv), .ops = &stm32_reset_ops, }; diff --git a/drivers/rng/meson-rng.c b/drivers/rng/meson-rng.c index 57a5a70..5a4f45a 100644 --- a/drivers/rng/meson-rng.c +++ b/drivers/rng/meson-rng.c @@ -11,7 +11,7 @@ #include <rng.h> #include <asm/io.h> -struct meson_rng_platdata { +struct meson_rng_plat { fdt_addr_t base; struct clk clk; }; @@ -26,7 +26,7 @@ struct meson_rng_platdata { */ static int meson_rng_read(struct udevice *dev, void *data, size_t len) { - struct meson_rng_platdata *pdata = dev_get_platdata(dev); + struct meson_rng_plat *pdata = dev_get_plat(dev); char *buffer = (char *)data; while (len) { @@ -52,7 +52,7 @@ static int meson_rng_read(struct udevice *dev, void *data, size_t len) */ static int meson_rng_probe(struct udevice *dev) { - struct meson_rng_platdata *pdata = dev_get_platdata(dev); + struct meson_rng_plat *pdata = dev_get_plat(dev); int err; err = clk_enable(&pdata->clk); @@ -70,20 +70,20 @@ static int meson_rng_probe(struct udevice *dev) */ static int meson_rng_remove(struct udevice *dev) { - struct meson_rng_platdata *pdata = dev_get_platdata(dev); + struct meson_rng_plat *pdata = dev_get_plat(dev); return clk_disable(&pdata->clk); } /** - * meson_rng_ofdata_to_platdata() - transfer device tree data to plaform data + * meson_rng_of_to_plat() - transfer device tree data to plaform data * * @dev: device * Return: 0 if ok */ -static int meson_rng_ofdata_to_platdata(struct udevice *dev) +static int meson_rng_of_to_plat(struct udevice *dev) { - struct meson_rng_platdata *pdata = dev_get_platdata(dev); + struct meson_rng_plat *pdata = dev_get_plat(dev); int err; pdata->base = dev_read_addr(dev); @@ -116,6 +116,6 @@ U_BOOT_DRIVER(meson_rng) = { .ops = &meson_rng_ops, .probe = meson_rng_probe, .remove = meson_rng_remove, - .platdata_auto_alloc_size = sizeof(struct meson_rng_platdata), - .ofdata_to_platdata = meson_rng_ofdata_to_platdata, + .plat_auto = sizeof(struct meson_rng_plat), + .of_to_plat = meson_rng_of_to_plat, }; diff --git a/drivers/rng/msm_rng.c b/drivers/rng/msm_rng.c index d511193..29e7354 100644 --- a/drivers/rng/msm_rng.c +++ b/drivers/rng/msm_rng.c @@ -139,5 +139,5 @@ U_BOOT_DRIVER(msm_rng) = { .ops = &msm_rng_ops, .probe = msm_rng_probe, .remove = msm_rng_remove, - .priv_auto_alloc_size = sizeof(struct msm_rng_priv), + .priv_auto = sizeof(struct msm_rng_priv), }; diff --git a/drivers/rng/rockchip_rng.c b/drivers/rng/rockchip_rng.c index c6a834b..800150f 100644 --- a/drivers/rng/rockchip_rng.c +++ b/drivers/rng/rockchip_rng.c @@ -49,7 +49,7 @@ struct rk_rng_soc_data { int (*rk_rng_read)(struct udevice *dev, void *data, size_t len); }; -struct rk_rng_platdata { +struct rk_rng_plat { fdt_addr_t base; struct rk_rng_soc_data *soc_data; }; @@ -77,7 +77,7 @@ static int rk_rng_read_regs(fdt_addr_t addr, void *buf, size_t size) static int rk_v1_rng_read(struct udevice *dev, void *data, size_t len) { - struct rk_rng_platdata *pdata = dev_get_priv(dev); + struct rk_rng_plat *pdata = dev_get_priv(dev); u32 reg = 0; int retval; @@ -108,7 +108,7 @@ exit: static int rk_v2_rng_read(struct udevice *dev, void *data, size_t len) { - struct rk_rng_platdata *pdata = dev_get_priv(dev); + struct rk_rng_plat *pdata = dev_get_priv(dev); u32 reg = 0; int retval; @@ -146,7 +146,7 @@ static int rockchip_rng_read(struct udevice *dev, void *data, size_t len) unsigned int i; int ret = -EIO; - struct rk_rng_platdata *pdata = dev_get_priv(dev); + struct rk_rng_plat *pdata = dev_get_priv(dev); if (!len) return 0; @@ -168,9 +168,9 @@ exit: return ret; } -static int rockchip_rng_ofdata_to_platdata(struct udevice *dev) +static int rockchip_rng_of_to_plat(struct udevice *dev) { - struct rk_rng_platdata *pdata = dev_get_priv(dev); + struct rk_rng_plat *pdata = dev_get_priv(dev); memset(pdata, 0x00, sizeof(*pdata)); @@ -183,7 +183,7 @@ static int rockchip_rng_ofdata_to_platdata(struct udevice *dev) static int rockchip_rng_probe(struct udevice *dev) { - struct rk_rng_platdata *pdata = dev_get_priv(dev); + struct rk_rng_plat *pdata = dev_get_priv(dev); pdata->soc_data = (struct rk_rng_soc_data *)dev_get_driver_data(dev); @@ -220,6 +220,6 @@ U_BOOT_DRIVER(rockchip_rng) = { .of_match = rockchip_rng_match, .ops = &rockchip_rng_ops, .probe = rockchip_rng_probe, - .ofdata_to_platdata = rockchip_rng_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct rk_rng_platdata), + .of_to_plat = rockchip_rng_of_to_plat, + .priv_auto = sizeof(struct rk_rng_plat), }; diff --git a/drivers/rng/stm32mp1_rng.c b/drivers/rng/stm32mp1_rng.c index c1bae18..8ea00e3 100644 --- a/drivers/rng/stm32mp1_rng.c +++ b/drivers/rng/stm32mp1_rng.c @@ -30,7 +30,7 @@ #define RNG_DR 0x08 -struct stm32_rng_platdata { +struct stm32_rng_plat { fdt_addr_t base; struct clk clk; struct reset_ctl rst; @@ -41,7 +41,7 @@ static int stm32_rng_read(struct udevice *dev, void *data, size_t len) int retval, i; u32 sr, count, reg; size_t increment; - struct stm32_rng_platdata *pdata = dev_get_platdata(dev); + struct stm32_rng_plat *pdata = dev_get_plat(dev); while (len > 0) { retval = readl_poll_timeout(pdata->base + RNG_SR, sr, @@ -80,7 +80,7 @@ static int stm32_rng_read(struct udevice *dev, void *data, size_t len) return 0; } -static int stm32_rng_init(struct stm32_rng_platdata *pdata) +static int stm32_rng_init(struct stm32_rng_plat *pdata) { int err; @@ -97,7 +97,7 @@ static int stm32_rng_init(struct stm32_rng_platdata *pdata) return 0; } -static int stm32_rng_cleanup(struct stm32_rng_platdata *pdata) +static int stm32_rng_cleanup(struct stm32_rng_plat *pdata) { writel(0, pdata->base + RNG_CR); @@ -106,7 +106,7 @@ static int stm32_rng_cleanup(struct stm32_rng_platdata *pdata) static int stm32_rng_probe(struct udevice *dev) { - struct stm32_rng_platdata *pdata = dev_get_platdata(dev); + struct stm32_rng_plat *pdata = dev_get_plat(dev); reset_assert(&pdata->rst); udelay(20); @@ -117,14 +117,14 @@ static int stm32_rng_probe(struct udevice *dev) static int stm32_rng_remove(struct udevice *dev) { - struct stm32_rng_platdata *pdata = dev_get_platdata(dev); + struct stm32_rng_plat *pdata = dev_get_plat(dev); return stm32_rng_cleanup(pdata); } -static int stm32_rng_ofdata_to_platdata(struct udevice *dev) +static int stm32_rng_of_to_plat(struct udevice *dev) { - struct stm32_rng_platdata *pdata = dev_get_platdata(dev); + struct stm32_rng_plat *pdata = dev_get_plat(dev); int err; pdata->base = dev_read_addr(dev); @@ -160,6 +160,6 @@ U_BOOT_DRIVER(stm32_rng) = { .ops = &stm32_rng_ops, .probe = stm32_rng_probe, .remove = stm32_rng_remove, - .platdata_auto_alloc_size = sizeof(struct stm32_rng_platdata), - .ofdata_to_platdata = stm32_rng_ofdata_to_platdata, + .plat_auto = sizeof(struct stm32_rng_plat), + .of_to_plat = stm32_rng_of_to_plat, }; diff --git a/drivers/rtc/ds3232.c b/drivers/rtc/ds3232.c index 0a30e0e..16501cf 100644 --- a/drivers/rtc/ds3232.c +++ b/drivers/rtc/ds3232.c @@ -272,5 +272,5 @@ U_BOOT_DRIVER(rtc_ds3232) = { .probe = ds3232_probe, .of_match = ds3232_rtc_ids, .ops = &ds3232_rtc_ops, - .priv_auto_alloc_size = sizeof(struct ds3232_priv_data), + .priv_auto = sizeof(struct ds3232_priv_data), }; diff --git a/drivers/rtc/emul_rtc.c b/drivers/rtc/emul_rtc.c index 7e52210..8f0e1ab 100644 --- a/drivers/rtc/emul_rtc.c +++ b/drivers/rtc/emul_rtc.c @@ -88,9 +88,9 @@ U_BOOT_DRIVER(rtc_emul) = { .id = UCLASS_RTC, .ops = &emul_rtc_ops, .probe = emul_rtc_probe, - .priv_auto_alloc_size = sizeof(struct emul_rtc), + .priv_auto = sizeof(struct emul_rtc), }; -U_BOOT_DEVICE(rtc_emul) = { +U_BOOT_DRVINFO(rtc_emul) = { .name = "rtc_emul", }; diff --git a/drivers/rtc/i2c_rtc_emul.c b/drivers/rtc/i2c_rtc_emul.c index 7f78ff8..5a2a154 100644 --- a/drivers/rtc/i2c_rtc_emul.c +++ b/drivers/rtc/i2c_rtc_emul.c @@ -50,7 +50,7 @@ struct sandbox_i2c_rtc { long sandbox_i2c_rtc_set_offset(struct udevice *dev, bool use_system_time, int offset) { - struct sandbox_i2c_rtc_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_rtc_plat_data *plat = dev_get_plat(dev); long old_offset; old_offset = plat->offset; @@ -63,7 +63,7 @@ long sandbox_i2c_rtc_set_offset(struct udevice *dev, bool use_system_time, long sandbox_i2c_rtc_get_set_base_time(struct udevice *dev, long base_time) { - struct sandbox_i2c_rtc_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_rtc_plat_data *plat = dev_get_plat(dev); long old_base_time; old_base_time = plat->base_time; @@ -75,7 +75,7 @@ long sandbox_i2c_rtc_get_set_base_time(struct udevice *dev, long base_time) static void reset_time(struct udevice *dev) { - struct sandbox_i2c_rtc_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_rtc_plat_data *plat = dev_get_plat(dev); struct rtc_time now; os_localtime(&now); @@ -86,7 +86,7 @@ static void reset_time(struct udevice *dev) static int sandbox_i2c_rtc_get(struct udevice *dev, struct rtc_time *time) { - struct sandbox_i2c_rtc_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_rtc_plat_data *plat = dev_get_plat(dev); struct rtc_time tm_now; long now; @@ -104,7 +104,7 @@ static int sandbox_i2c_rtc_get(struct udevice *dev, struct rtc_time *time) static int sandbox_i2c_rtc_set(struct udevice *dev, const struct rtc_time *time) { - struct sandbox_i2c_rtc_plat_data *plat = dev_get_platdata(dev); + struct sandbox_i2c_rtc_plat_data *plat = dev_get_plat(dev); struct rtc_time tm_now; long now; @@ -122,7 +122,7 @@ static int sandbox_i2c_rtc_set(struct udevice *dev, const struct rtc_time *time) /* Update the current time in the registers */ static int sandbox_i2c_rtc_prepare_read(struct udevice *emul) { - struct sandbox_i2c_rtc_plat_data *plat = dev_get_platdata(emul); + struct sandbox_i2c_rtc_plat_data *plat = dev_get_plat(emul); struct rtc_time time; int ret; @@ -143,7 +143,7 @@ static int sandbox_i2c_rtc_prepare_read(struct udevice *emul) static int sandbox_i2c_rtc_complete_write(struct udevice *emul) { - struct sandbox_i2c_rtc_plat_data *plat = dev_get_platdata(emul); + struct sandbox_i2c_rtc_plat_data *plat = dev_get_plat(emul); struct rtc_time time; int ret; @@ -165,7 +165,7 @@ static int sandbox_i2c_rtc_complete_write(struct udevice *emul) static int sandbox_i2c_rtc_xfer(struct udevice *emul, struct i2c_msg *msg, int nmsgs) { - struct sandbox_i2c_rtc_plat_data *plat = dev_get_platdata(emul); + struct sandbox_i2c_rtc_plat_data *plat = dev_get_plat(emul); uint offset = 0; int ret; @@ -230,7 +230,7 @@ U_BOOT_DRIVER(sandbox_i2c_rtc_emul) = { .id = UCLASS_I2C_EMUL, .of_match = sandbox_i2c_rtc_ids, .bind = sandbox_i2c_rtc_bind, - .priv_auto_alloc_size = sizeof(struct sandbox_i2c_rtc), - .platdata_auto_alloc_size = sizeof(struct sandbox_i2c_rtc_plat_data), + .priv_auto = sizeof(struct sandbox_i2c_rtc), + .plat_auto = sizeof(struct sandbox_i2c_rtc_plat_data), .ops = &sandbox_i2c_rtc_emul_ops, }; diff --git a/drivers/rtc/mvrtc.c b/drivers/rtc/mvrtc.c index ed057f7..50240d5 100644 --- a/drivers/rtc/mvrtc.c +++ b/drivers/rtc/mvrtc.c @@ -133,7 +133,7 @@ void rtc_reset(void) #ifdef CONFIG_DM_RTC static int mv_rtc_get(struct udevice *dev, struct rtc_time *tm) { - struct mvrtc_pdata *pdata = dev_get_platdata(dev); + struct mvrtc_pdata *pdata = dev_get_plat(dev); struct mvrtc_registers *regs = (struct mvrtc_registers *)pdata->iobase; return __mv_rtc_get(regs, tm); @@ -141,7 +141,7 @@ static int mv_rtc_get(struct udevice *dev, struct rtc_time *tm) static int mv_rtc_set(struct udevice *dev, const struct rtc_time *tm) { - struct mvrtc_pdata *pdata = dev_get_platdata(dev); + struct mvrtc_pdata *pdata = dev_get_plat(dev); struct mvrtc_registers *regs = (struct mvrtc_registers *)pdata->iobase; return __mv_rtc_set(regs, tm); @@ -149,7 +149,7 @@ static int mv_rtc_set(struct udevice *dev, const struct rtc_time *tm) static int mv_rtc_reset(struct udevice *dev) { - struct mvrtc_pdata *pdata = dev_get_platdata(dev); + struct mvrtc_pdata *pdata = dev_get_plat(dev); struct mvrtc_registers *regs = (struct mvrtc_registers *)pdata->iobase; __mv_rtc_reset(regs); @@ -168,9 +168,9 @@ static const struct udevice_id mv_rtc_ids[] = { { } }; -static int mv_rtc_ofdata_to_platdata(struct udevice *dev) +static int mv_rtc_of_to_plat(struct udevice *dev) { - struct mvrtc_pdata *pdata = dev_get_platdata(dev); + struct mvrtc_pdata *pdata = dev_get_plat(dev); pdata->iobase = dev_read_addr(dev); return 0; @@ -179,7 +179,7 @@ static int mv_rtc_ofdata_to_platdata(struct udevice *dev) U_BOOT_DRIVER(rtc_mv) = { .name = "rtc-mv", .id = UCLASS_RTC, - .ofdata_to_platdata = mv_rtc_ofdata_to_platdata, + .of_to_plat = mv_rtc_of_to_plat, .of_match = mv_rtc_ids, .ops = &mv_rtc_ops, }; diff --git a/drivers/rtc/pcf2127.c b/drivers/rtc/pcf2127.c index 88ff8c5..57f8640 100644 --- a/drivers/rtc/pcf2127.c +++ b/drivers/rtc/pcf2127.c @@ -25,7 +25,7 @@ static int pcf2127_rtc_read(struct udevice *dev, uint offset, u8 *buffer, uint len) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); struct i2c_msg msg; int ret; diff --git a/drivers/rtc/pl031.c b/drivers/rtc/pl031.c index 1b67172..a1d3766 100644 --- a/drivers/rtc/pl031.c +++ b/drivers/rtc/pl031.c @@ -29,20 +29,20 @@ #define RTC_CR_START (1 << 0) -struct pl031_platdata { +struct pl031_plat { phys_addr_t base; }; static inline u32 pl031_read_reg(struct udevice *dev, int reg) { - struct pl031_platdata *pdata = dev_get_platdata(dev); + struct pl031_plat *pdata = dev_get_plat(dev); return readl(pdata->base + reg); } static inline u32 pl031_write_reg(struct udevice *dev, int reg, u32 value) { - struct pl031_platdata *pdata = dev_get_platdata(dev); + struct pl031_plat *pdata = dev_get_plat(dev); return writel(value, pdata->base + reg); } @@ -122,9 +122,9 @@ static const struct udevice_id pl031_ids[] = { { } }; -static int pl031_ofdata_to_platdata(struct udevice *dev) +static int pl031_of_to_plat(struct udevice *dev) { - struct pl031_platdata *pdata = dev_get_platdata(dev); + struct pl031_plat *pdata = dev_get_plat(dev); pdata->base = dev_read_addr(dev); @@ -136,7 +136,7 @@ U_BOOT_DRIVER(rtc_pl031) = { .id = UCLASS_RTC, .of_match = pl031_ids, .probe = pl031_probe, - .ofdata_to_platdata = pl031_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct pl031_platdata), + .of_to_plat = pl031_of_to_plat, + .plat_auto = sizeof(struct pl031_plat), .ops = &pl031_ops, }; diff --git a/drivers/rtc/stm32_rtc.c b/drivers/rtc/stm32_rtc.c index f9db318..f1d0ea9 100644 --- a/drivers/rtc/stm32_rtc.c +++ b/drivers/rtc/stm32_rtc.c @@ -327,5 +327,5 @@ U_BOOT_DRIVER(rtc_stm32) = { .probe = stm32_rtc_probe, .of_match = stm32_rtc_ids, .ops = &stm32_rtc_ops, - .priv_auto_alloc_size = sizeof(struct stm32_rtc_priv), + .priv_auto = sizeof(struct stm32_rtc_priv), }; diff --git a/drivers/scsi/scsi-uclass.c b/drivers/scsi/scsi-uclass.c index acf3b3d..90a0add 100644 --- a/drivers/scsi/scsi-uclass.c +++ b/drivers/scsi/scsi-uclass.c @@ -35,5 +35,5 @@ int scsi_bus_reset(struct udevice *dev) UCLASS_DRIVER(scsi) = { .id = UCLASS_SCSI, .name = "scsi", - .per_device_platdata_auto_alloc_size = sizeof(struct scsi_platdata), + .per_device_plat_auto = sizeof(struct scsi_plat), }; diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 0ab1d44..7389484 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -149,9 +149,9 @@ static void scsi_setup_write_ext(struct scsi_cmd *pccb, lbaint_t start, static ulong scsi_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer) { - struct blk_desc *block_dev = dev_get_uclass_platdata(dev); + struct blk_desc *block_dev = dev_get_uclass_plat(dev); struct udevice *bdev = dev->parent; - struct scsi_platdata *uc_plat = dev_get_uclass_platdata(bdev); + struct scsi_plat *uc_plat = dev_get_uclass_plat(bdev); lbaint_t start, blks, max_blks; uintptr_t buf_addr; unsigned short smallblks = 0; @@ -219,9 +219,9 @@ static ulong scsi_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, static ulong scsi_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, const void *buffer) { - struct blk_desc *block_dev = dev_get_uclass_platdata(dev); + struct blk_desc *block_dev = dev_get_uclass_plat(dev); struct udevice *bdev = dev->parent; - struct scsi_platdata *uc_plat = dev_get_uclass_platdata(bdev); + struct scsi_plat *uc_plat = dev_get_uclass_plat(bdev); lbaint_t start, blks, max_blks; uintptr_t buf_addr; unsigned short smallblks; @@ -586,7 +586,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose) return ret; } - bdesc = dev_get_uclass_platdata(bdev); + bdesc = dev_get_uclass_plat(bdev); bdesc->target = id; bdesc->lun = lun; bdesc->removable = bd.removable; @@ -604,7 +604,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose) int scsi_scan_dev(struct udevice *dev, bool verbose) { - struct scsi_platdata *uc_plat; /* scsi controller platdata */ + struct scsi_plat *uc_plat; /* scsi controller plat */ int ret; int i; int lun; @@ -614,8 +614,8 @@ int scsi_scan_dev(struct udevice *dev, bool verbose) if (ret) return ret; - /* Get controller platdata */ - uc_plat = dev_get_uclass_platdata(dev); + /* Get controller plat */ + uc_plat = dev_get_uclass_plat(dev); for (i = 0; i < uc_plat->max_id; i++) for (lun = 0; lun < uc_plat->max_lun; lun++) diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c index 35b76f5..4435fcf 100644 --- a/drivers/serial/altera_jtag_uart.c +++ b/drivers/serial/altera_jtag_uart.c @@ -26,7 +26,7 @@ struct altera_jtaguart_regs { u32 control; /* Control register */ }; -struct altera_jtaguart_platdata { +struct altera_jtaguart_plat { struct altera_jtaguart_regs *regs; }; @@ -37,7 +37,7 @@ static int altera_jtaguart_setbrg(struct udevice *dev, int baudrate) static int altera_jtaguart_putc(struct udevice *dev, const char ch) { - struct altera_jtaguart_platdata *plat = dev->platdata; + struct altera_jtaguart_plat *plat = dev_get_plat(dev); struct altera_jtaguart_regs *const regs = plat->regs; u32 st = readl(®s->control); @@ -56,7 +56,7 @@ static int altera_jtaguart_putc(struct udevice *dev, const char ch) static int altera_jtaguart_pending(struct udevice *dev, bool input) { - struct altera_jtaguart_platdata *plat = dev->platdata; + struct altera_jtaguart_plat *plat = dev_get_plat(dev); struct altera_jtaguart_regs *const regs = plat->regs; u32 st = readl(®s->control); @@ -68,7 +68,7 @@ static int altera_jtaguart_pending(struct udevice *dev, bool input) static int altera_jtaguart_getc(struct udevice *dev) { - struct altera_jtaguart_platdata *plat = dev->platdata; + struct altera_jtaguart_plat *plat = dev_get_plat(dev); struct altera_jtaguart_regs *const regs = plat->regs; u32 val; @@ -83,7 +83,7 @@ static int altera_jtaguart_getc(struct udevice *dev) static int altera_jtaguart_probe(struct udevice *dev) { #ifdef CONFIG_ALTERA_JTAG_UART_BYPASS - struct altera_jtaguart_platdata *plat = dev->platdata; + struct altera_jtaguart_plat *plat = dev_get_plat(dev); struct altera_jtaguart_regs *const regs = plat->regs; writel(ALTERA_JTAG_AC, ®s->control); /* clear AC flag */ @@ -91,9 +91,9 @@ static int altera_jtaguart_probe(struct udevice *dev) return 0; } -static int altera_jtaguart_ofdata_to_platdata(struct udevice *dev) +static int altera_jtaguart_of_to_plat(struct udevice *dev) { - struct altera_jtaguart_platdata *plat = dev_get_platdata(dev); + struct altera_jtaguart_plat *plat = dev_get_plat(dev); plat->regs = map_physmem(dev_read_addr(dev), sizeof(struct altera_jtaguart_regs), @@ -118,8 +118,8 @@ U_BOOT_DRIVER(altera_jtaguart) = { .name = "altera_jtaguart", .id = UCLASS_SERIAL, .of_match = altera_jtaguart_ids, - .ofdata_to_platdata = altera_jtaguart_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct altera_jtaguart_platdata), + .of_to_plat = altera_jtaguart_of_to_plat, + .plat_auto = sizeof(struct altera_jtaguart_plat), .probe = altera_jtaguart_probe, .ops = &altera_jtaguart_ops, }; diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c index 0be5cd7..b18be6e 100644 --- a/drivers/serial/altera_uart.c +++ b/drivers/serial/altera_uart.c @@ -25,14 +25,14 @@ struct altera_uart_regs { u32 endofpacket; /* End-of-packet reg */ }; -struct altera_uart_platdata { +struct altera_uart_plat { struct altera_uart_regs *regs; unsigned int uartclk; }; static int altera_uart_setbrg(struct udevice *dev, int baudrate) { - struct altera_uart_platdata *plat = dev->platdata; + struct altera_uart_plat *plat = dev_get_plat(dev); struct altera_uart_regs *const regs = plat->regs; u32 div; @@ -44,7 +44,7 @@ static int altera_uart_setbrg(struct udevice *dev, int baudrate) static int altera_uart_putc(struct udevice *dev, const char ch) { - struct altera_uart_platdata *plat = dev->platdata; + struct altera_uart_plat *plat = dev_get_plat(dev); struct altera_uart_regs *const regs = plat->regs; if (!(readl(®s->status) & ALTERA_UART_TRDY)) @@ -57,7 +57,7 @@ static int altera_uart_putc(struct udevice *dev, const char ch) static int altera_uart_pending(struct udevice *dev, bool input) { - struct altera_uart_platdata *plat = dev->platdata; + struct altera_uart_plat *plat = dev_get_plat(dev); struct altera_uart_regs *const regs = plat->regs; u32 st = readl(®s->status); @@ -69,7 +69,7 @@ static int altera_uart_pending(struct udevice *dev, bool input) static int altera_uart_getc(struct udevice *dev) { - struct altera_uart_platdata *plat = dev->platdata; + struct altera_uart_plat *plat = dev_get_plat(dev); struct altera_uart_regs *const regs = plat->regs; if (!(readl(®s->status) & ALTERA_UART_RRDY)) @@ -83,9 +83,9 @@ static int altera_uart_probe(struct udevice *dev) return 0; } -static int altera_uart_ofdata_to_platdata(struct udevice *dev) +static int altera_uart_of_to_plat(struct udevice *dev) { - struct altera_uart_platdata *plat = dev_get_platdata(dev); + struct altera_uart_plat *plat = dev_get_plat(dev); plat->regs = map_physmem(dev_read_addr(dev), sizeof(struct altera_uart_regs), @@ -111,8 +111,8 @@ U_BOOT_DRIVER(altera_uart) = { .name = "altera_uart", .id = UCLASS_SERIAL, .of_match = altera_uart_ids, - .ofdata_to_platdata = altera_uart_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct altera_uart_platdata), + .of_to_plat = altera_uart_of_to_plat, + .plat_auto = sizeof(struct altera_uart_plat), .probe = altera_uart_probe, .ops = &altera_uart_ops, }; diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index f759ea8..7edec23 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -262,7 +262,7 @@ static int atmel_serial_enable_clk(struct udevice *dev) static int atmel_serial_probe(struct udevice *dev) { - struct atmel_serial_platdata *plat = dev->platdata; + struct atmel_serial_plat *plat = dev_get_plat(dev); struct atmel_serial_priv *priv = dev_get_priv(dev); int ret; #if CONFIG_IS_ENABLED(OF_CONTROL) @@ -304,14 +304,14 @@ U_BOOT_DRIVER(serial_atmel) = { .id = UCLASS_SERIAL, #if CONFIG_IS_ENABLED(OF_CONTROL) .of_match = atmel_serial_ids, - .platdata_auto_alloc_size = sizeof(struct atmel_serial_platdata), + .plat_auto = sizeof(struct atmel_serial_plat), #endif .probe = atmel_serial_probe, .ops = &atmel_serial_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, #endif - .priv_auto_alloc_size = sizeof(struct atmel_serial_priv), + .priv_auto = sizeof(struct atmel_serial_priv), }; #endif diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c index 7d31c6d..d39a3c0 100644 --- a/drivers/serial/lpc32xx_hsuart.c +++ b/drivers/serial/lpc32xx_hsuart.c @@ -85,10 +85,10 @@ static int lpc32xx_serial_init(struct hsuart_regs *hsuart) static int lpc32xx_hsuart_probe(struct udevice *dev) { - struct lpc32xx_hsuart_platdata *platdata = dev_get_platdata(dev); + struct lpc32xx_hsuart_plat *plat = dev_get_plat(dev); struct lpc32xx_hsuart_priv *priv = dev_get_priv(dev); - priv->hsuart = (struct hsuart_regs *)platdata->base; + priv->hsuart = (struct hsuart_regs *)plat->base; lpc32xx_serial_init(priv->hsuart); @@ -107,6 +107,6 @@ U_BOOT_DRIVER(lpc32xx_hsuart) = { .id = UCLASS_SERIAL, .probe = lpc32xx_hsuart_probe, .ops = &lpc32xx_hsuart_ops, - .priv_auto_alloc_size = sizeof(struct lpc32xx_hsuart_priv), + .priv_auto = sizeof(struct lpc32xx_hsuart_priv), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 702109b..65c6db0 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -103,7 +103,7 @@ static inline int serial_in_shift(void *addr, int shift) * on a platform */ #ifdef CONFIG_NS16550_DYNAMIC -static void serial_out_dynamic(struct ns16550_platdata *plat, u8 *addr, +static void serial_out_dynamic(struct ns16550_plat *plat, u8 *addr, int value) { if (plat->flags & NS16550_FLAG_IO) { @@ -124,7 +124,7 @@ static void serial_out_dynamic(struct ns16550_platdata *plat, u8 *addr, } } -static int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr) +static int serial_in_dynamic(struct ns16550_plat *plat, u8 *addr) { if (plat->flags & NS16550_FLAG_IO) { return inb(addr); @@ -144,21 +144,21 @@ static int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr) } } #else -static inline void serial_out_dynamic(struct ns16550_platdata *plat, u8 *addr, +static inline void serial_out_dynamic(struct ns16550_plat *plat, u8 *addr, int value) { } -static inline int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr) +static inline int serial_in_dynamic(struct ns16550_plat *plat, u8 *addr) { return 0; } #endif /* CONFIG_NS16550_DYNAMIC */ -static void ns16550_writeb(NS16550_t port, int offset, int value) +static void ns16550_writeb(struct ns16550 *port, int offset, int value) { - struct ns16550_platdata *plat = port->plat; + struct ns16550_plat *plat = port->plat; unsigned char *addr; offset *= 1 << plat->reg_shift; @@ -170,9 +170,9 @@ static void ns16550_writeb(NS16550_t port, int offset, int value) serial_out_shift(addr, plat->reg_shift, value); } -static int ns16550_readb(NS16550_t port, int offset) +static int ns16550_readb(struct ns16550 *port, int offset) { - struct ns16550_platdata *plat = port->plat; + struct ns16550_plat *plat = port->plat; unsigned char *addr; offset *= 1 << plat->reg_shift; @@ -184,9 +184,9 @@ static int ns16550_readb(NS16550_t port, int offset) return serial_in_shift(addr, plat->reg_shift); } -static u32 ns16550_getfcr(NS16550_t port) +static u32 ns16550_getfcr(struct ns16550 *port) { - struct ns16550_platdata *plat = port->plat; + struct ns16550_plat *plat = port->plat; return plat->fcr; } @@ -199,20 +199,20 @@ static u32 ns16550_getfcr(NS16550_t port) ns16550_readb(com_port, \ (unsigned char *)addr - (unsigned char *)com_port) #else -static u32 ns16550_getfcr(NS16550_t port) +static u32 ns16550_getfcr(struct ns16550 *port) { return UART_FCR_DEFVAL; } #endif -int ns16550_calc_divisor(NS16550_t port, int clock, int baudrate) +int ns16550_calc_divisor(struct ns16550 *port, int clock, int baudrate) { const unsigned int mode_x_div = 16; return DIV_ROUND_CLOSEST(clock, mode_x_div * baudrate); } -static void NS16550_setbrg(NS16550_t com_port, int baud_divisor) +static void ns16550_setbrg(struct ns16550 *com_port, int baud_divisor) { /* to keep serial format, read lcr before writing BKSE */ int lcr_val = serial_in(&com_port->lcr) & ~UART_LCR_BKSE; @@ -223,7 +223,7 @@ static void NS16550_setbrg(NS16550_t com_port, int baud_divisor) serial_out(lcr_val, &com_port->lcr); } -void NS16550_init(NS16550_t com_port, int baud_divisor) +void ns16550_init(struct ns16550 *com_port, int baud_divisor) { #if (defined(CONFIG_SPL_BUILD) && \ (defined(CONFIG_OMAP34XX) || defined(CONFIG_OMAP44XX))) @@ -235,13 +235,13 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE)) == UART_LSR_THRE) { if (baud_divisor != -1) - NS16550_setbrg(com_port, baud_divisor); + ns16550_setbrg(com_port, baud_divisor); else { // Re-use old baud rate divisor to flush transmit reg. const int dll = serial_in(&com_port->dll); const int dlm = serial_in(&com_port->dlm); const int divisor = dll | (dlm << 8); - NS16550_setbrg(com_port, divisor); + ns16550_setbrg(com_port, divisor); } serial_out(0, &com_port->mdr1); } @@ -260,7 +260,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) /* initialize serial config to 8N1 before writing baudrate */ serial_out(UART_LCRVAL, &com_port->lcr); if (baud_divisor != -1) - NS16550_setbrg(com_port, baud_divisor); + ns16550_setbrg(com_port, baud_divisor); #if defined(CONFIG_ARCH_OMAP2PLUS) || defined(CONFIG_SOC_DA8XX) || \ defined(CONFIG_OMAP_SERIAL) /* /16 is proper to hit 115200 with 48MHz */ @@ -272,17 +272,17 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) } #ifndef CONFIG_NS16550_MIN_FUNCTIONS -void NS16550_reinit(NS16550_t com_port, int baud_divisor) +void ns16550_reinit(struct ns16550 *com_port, int baud_divisor) { serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier); - NS16550_setbrg(com_port, 0); + ns16550_setbrg(com_port, 0); serial_out(UART_MCRVAL, &com_port->mcr); serial_out(ns16550_getfcr(com_port), &com_port->fcr); - NS16550_setbrg(com_port, baud_divisor); + ns16550_setbrg(com_port, baud_divisor); } #endif /* CONFIG_NS16550_MIN_FUNCTIONS */ -void NS16550_putc(NS16550_t com_port, char c) +void ns16550_putc(struct ns16550 *com_port, char c) { while ((serial_in(&com_port->lsr) & UART_LSR_THRE) == 0) ; @@ -299,7 +299,7 @@ void NS16550_putc(NS16550_t com_port, char c) } #ifndef CONFIG_NS16550_MIN_FUNCTIONS -char NS16550_getc(NS16550_t com_port) +char ns16550_getc(struct ns16550 *com_port) { while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) { #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USB_TTY) @@ -311,7 +311,7 @@ char NS16550_getc(NS16550_t com_port) return serial_in(&com_port->rbr); } -int NS16550_tstc(NS16550_t com_port) +int ns16550_tstc(struct ns16550 *com_port) { return (serial_in(&com_port->lsr) & UART_LSR_DR) != 0; } @@ -324,7 +324,7 @@ int NS16550_tstc(NS16550_t com_port) static inline void _debug_uart_init(void) { - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; + struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE; int baud_divisor; /* @@ -345,7 +345,7 @@ static inline void _debug_uart_init(void) serial_dout(&com_port->lcr, UART_LCRVAL); } -static inline int NS16550_read_baud_divisor(struct NS16550 *com_port) +static inline int NS16550_read_baud_divisor(struct ns16550 *com_port) { int ret; @@ -359,7 +359,7 @@ static inline int NS16550_read_baud_divisor(struct NS16550 *com_port) static inline void _debug_uart_putc(int ch) { - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; + struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE; while (!(serial_din(&com_port->lsr) & UART_LSR_THRE)) { #ifdef CONFIG_DEBUG_UART_NS16550_CHECK_ENABLED @@ -377,7 +377,7 @@ DEBUG_UART_FUNCS #if CONFIG_IS_ENABLED(DM_SERIAL) static int ns16550_serial_putc(struct udevice *dev, const char ch) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); if (!(serial_in(&com_port->lsr) & UART_LSR_THRE)) return -EAGAIN; @@ -397,7 +397,7 @@ static int ns16550_serial_putc(struct udevice *dev, const char ch) static int ns16550_serial_pending(struct udevice *dev, bool input) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); if (input) return (serial_in(&com_port->lsr) & UART_LSR_DR) ? 1 : 0; @@ -407,7 +407,7 @@ static int ns16550_serial_pending(struct udevice *dev, bool input) static int ns16550_serial_getc(struct udevice *dev) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); if (!(serial_in(&com_port->lsr) & UART_LSR_DR)) return -EAGAIN; @@ -417,20 +417,20 @@ static int ns16550_serial_getc(struct udevice *dev) static int ns16550_serial_setbrg(struct udevice *dev, int baudrate) { - struct NS16550 *const com_port = dev_get_priv(dev); - struct ns16550_platdata *plat = com_port->plat; + struct ns16550 *const com_port = dev_get_priv(dev); + struct ns16550_plat *plat = com_port->plat; int clock_divisor; clock_divisor = ns16550_calc_divisor(com_port, plat->clock, baudrate); - NS16550_setbrg(com_port, clock_divisor); + ns16550_setbrg(com_port, clock_divisor); return 0; } static int ns16550_serial_setconfig(struct udevice *dev, uint serial_config) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); int lcr_val = UART_LCR_WLS_8; uint parity = SERIAL_GET_PARITY(serial_config); uint bits = SERIAL_GET_BITS(serial_config); @@ -464,8 +464,8 @@ static int ns16550_serial_setconfig(struct udevice *dev, uint serial_config) static int ns16550_serial_getinfo(struct udevice *dev, struct serial_device_info *info) { - struct NS16550 *const com_port = dev_get_priv(dev); - struct ns16550_platdata *plat = com_port->plat; + struct ns16550 *const com_port = dev_get_priv(dev); + struct ns16550_plat *plat = com_port->plat; info->type = SERIAL_CHIP_16550_COMPATIBLE; #ifdef CONFIG_SYS_NS16550_PORT_MAPPED @@ -482,7 +482,7 @@ static int ns16550_serial_getinfo(struct udevice *dev, return 0; } -static int ns16550_serial_assign_base(struct ns16550_platdata *plat, ulong base) +static int ns16550_serial_assign_base(struct ns16550_plat *plat, ulong base) { if (base == FDT_ADDR_T_NONE) return -EINVAL; @@ -498,15 +498,15 @@ static int ns16550_serial_assign_base(struct ns16550_platdata *plat, ulong base) int ns16550_serial_probe(struct udevice *dev) { - struct ns16550_platdata *plat = dev->platdata; - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550_plat *plat = dev_get_plat(dev); + struct ns16550 *const com_port = dev_get_priv(dev); struct reset_ctl_bulk reset_bulk; fdt_addr_t addr; int ret; /* * If we are on PCI bus, either directly attached to a PCI root port, - * or via a PCI bridge, assign platdata->base before probing hardware. + * or via a PCI bridge, assign plat->base before probing hardware. */ if (device_is_on_pci_bus(dev)) { addr = devfdt_get_addr_pci(dev); @@ -519,8 +519,8 @@ int ns16550_serial_probe(struct udevice *dev) if (!ret) reset_deassert_bulk(&reset_bulk); - com_port->plat = dev_get_platdata(dev); - NS16550_init(com_port, -1); + com_port->plat = dev_get_plat(dev); + ns16550_init(com_port, -1); return 0; } @@ -533,9 +533,9 @@ enum { #endif #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -int ns16550_serial_ofdata_to_platdata(struct udevice *dev) +int ns16550_serial_of_to_plat(struct udevice *dev) { - struct ns16550_platdata *plat = dev->platdata; + struct ns16550_plat *plat = dev_get_plat(dev); const u32 port_type = dev_get_driver_data(dev); fdt_addr_t addr; struct clk clk; @@ -610,10 +610,10 @@ U_BOOT_DRIVER(ns16550_serial) = { .id = UCLASS_SERIAL, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = ns16550_serial_ids, - .ofdata_to_platdata = ns16550_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct ns16550_platdata), + .of_to_plat = ns16550_serial_of_to_plat, + .plat_auto = sizeof(struct ns16550_plat), #endif - .priv_auto_alloc_size = sizeof(struct NS16550), + .priv_auto = sizeof(struct ns16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) @@ -621,9 +621,9 @@ U_BOOT_DRIVER(ns16550_serial) = { #endif }; -U_BOOT_DRIVER_ALIAS(ns16550_serial, rockchip_rk3328_uart) -U_BOOT_DRIVER_ALIAS(ns16550_serial, rockchip_rk3368_uart) -U_BOOT_DRIVER_ALIAS(ns16550_serial, ti_da830_uart) +DM_DRIVER_ALIAS(ns16550_serial, rockchip_rk3328_uart) +DM_DRIVER_ALIAS(ns16550_serial, rockchip_rk3368_uart) +DM_DRIVER_ALIAS(ns16550_serial, ti_da830_uart) #endif #endif /* SERIAL_PRESENT */ diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index db2fbac..756738c 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -12,39 +12,16 @@ #include <common.h> #include <console.h> #include <dm.h> -#include <fdtdec.h> #include <lcd.h> #include <os.h> #include <serial.h> #include <video.h> #include <linux/compiler.h> +#include <asm/serial.h> #include <asm/state.h> DECLARE_GLOBAL_DATA_PTR; -#if CONFIG_IS_ENABLED(OF_CONTROL) - -/* - * - * serial_buf: A buffer that holds keyboard characters for the - * Sandbox U-Boot. - * - * invariants: - * serial_buf_write == serial_buf_read -> empty buffer - * (serial_buf_write + 1) % 16 == serial_buf_read -> full buffer - */ -static unsigned char serial_buf[16]; -static unsigned int serial_buf_write; -static unsigned int serial_buf_read; - -struct sandbox_serial_platdata { - int colour; /* Text colour to use for output, -1 for none */ -}; - -struct sandbox_serial_priv { - bool start_of_line; -}; - /** * output_ansi_colour() - Output an ANSI colour code * @@ -74,13 +51,14 @@ static int sandbox_serial_probe(struct udevice *dev) if (state->term_raw != STATE_TERM_RAW) disable_ctrlc(1); + membuff_init(&priv->buf, priv->serial_buf, sizeof(priv->serial_buf)); return 0; } static int sandbox_serial_remove(struct udevice *dev) { - struct sandbox_serial_platdata *plat = dev->platdata; + struct sandbox_serial_plat *plat = dev_get_plat(dev); if (plat->colour != -1) output_ansi_reset(); @@ -91,7 +69,7 @@ static int sandbox_serial_remove(struct udevice *dev) static int sandbox_serial_putc(struct udevice *dev, const char ch) { struct sandbox_serial_priv *priv = dev_get_priv(dev); - struct sandbox_serial_platdata *plat = dev->platdata; + struct sandbox_serial_plat *plat = dev_get_plat(dev); /* With of-platdata we don't real the colour correctly, so disable it */ if (!CONFIG_IS_ENABLED(OF_PLATDATA) && priv->start_of_line && @@ -107,46 +85,39 @@ static int sandbox_serial_putc(struct udevice *dev, const char ch) return 0; } -static unsigned int increment_buffer_index(unsigned int index) -{ - return (index + 1) % ARRAY_SIZE(serial_buf); -} - static int sandbox_serial_pending(struct udevice *dev, bool input) { - const unsigned int next_index = - increment_buffer_index(serial_buf_write); + struct sandbox_serial_priv *priv = dev_get_priv(dev); ssize_t count; + char *data; + int avail; if (!input) return 0; os_usleep(100); -#ifndef CONFIG_SPL_BUILD - video_sync_all(); -#endif - if (next_index == serial_buf_read) + if (!IS_ENABLED(CONFIG_SPL_BUILD)) + video_sync_all(); + avail = membuff_putraw(&priv->buf, 100, false, &data); + if (!avail) return 1; /* buffer full */ - count = os_read(0, &serial_buf[serial_buf_write], 1); - if (count == 1) - serial_buf_write = next_index; + count = os_read(0, data, avail); + if (count > 0) + membuff_putraw(&priv->buf, count, true, &data); - return serial_buf_write != serial_buf_read; + return membuff_avail(&priv->buf); } static int sandbox_serial_getc(struct udevice *dev) { - int result; + struct sandbox_serial_priv *priv = dev_get_priv(dev); if (!sandbox_serial_pending(dev, true)) return -EAGAIN; /* buffer empty */ - result = serial_buf[serial_buf_read]; - serial_buf_read = increment_buffer_index(serial_buf_read); - return result; + return membuff_getbyte(&priv->buf); } -#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */ #ifdef CONFIG_DEBUG_UART_SANDBOX @@ -211,23 +182,21 @@ static int sandbox_serial_getinfo(struct udevice *dev, return 0; } -#if CONFIG_IS_ENABLED(OF_CONTROL) static const char * const ansi_colour[] = { "black", "red", "green", "yellow", "blue", "megenta", "cyan", "white", }; -static int sandbox_serial_ofdata_to_platdata(struct udevice *dev) +static int sandbox_serial_of_to_plat(struct udevice *dev) { - struct sandbox_serial_platdata *plat = dev->platdata; + struct sandbox_serial_plat *plat = dev_get_plat(dev); const char *colour; int i; if (CONFIG_IS_ENABLED(OF_PLATDATA)) return 0; plat->colour = -1; - colour = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), - "sandbox,text-colour", NULL); + colour = dev_read_string(dev, "sandbox,text-colour"); if (colour) { for (i = 0; i < ARRAY_SIZE(ansi_colour); i++) { if (!strcmp(colour, ansi_colour[i])) { @@ -258,9 +227,9 @@ U_BOOT_DRIVER(sandbox_serial) = { .name = "sandbox_serial", .id = UCLASS_SERIAL, .of_match = sandbox_serial_ids, - .ofdata_to_platdata = sandbox_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct sandbox_serial_platdata), - .priv_auto_alloc_size = sizeof(struct sandbox_serial_priv), + .of_to_plat = sandbox_serial_of_to_plat, + .plat_auto = sizeof(struct sandbox_serial_plat), + .priv_auto = sizeof(struct sandbox_serial_priv), .probe = sandbox_serial_probe, .remove = sandbox_serial_remove, .ops = &sandbox_serial_ops, @@ -268,14 +237,12 @@ U_BOOT_DRIVER(sandbox_serial) = { }; #if !CONFIG_IS_ENABLED(OF_PLATDATA) -static const struct sandbox_serial_platdata platdata_non_fdt = { +static const struct sandbox_serial_plat platdata_non_fdt = { .colour = -1, }; -U_BOOT_DEVICE(serial_sandbox_non_fdt) = { +U_BOOT_DRVINFO(serial_sandbox_non_fdt) = { .name = "sandbox_serial", - .platdata = &platdata_non_fdt, + .plat = &platdata_non_fdt, }; #endif - -#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */ diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index f3c25d4..58a6541 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -123,7 +123,7 @@ static void serial_find_console_or_panic(void) #ifdef CONFIG_SERIAL_SEARCH_ALL if (!uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) || !uclass_get_device(UCLASS_SERIAL, INDEX, &dev)) { - if (dev->flags & DM_FLAG_ACTIVATED) { + if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) { gd->cur_serial_dev = dev; return; } @@ -507,6 +507,6 @@ UCLASS_DRIVER(serial) = { .flags = DM_UC_FLAG_SEQ_ALIAS, .post_probe = serial_post_probe, .pre_remove = serial_pre_remove, - .per_device_auto_alloc_size = sizeof(struct serial_dev_priv), + .per_device_auto = sizeof(struct serial_dev_priv), }; #endif diff --git a/drivers/serial/serial_ar933x.c b/drivers/serial/serial_ar933x.c index 9de94b6..da06bef 100644 --- a/drivers/serial/serial_ar933x.c +++ b/drivers/serial/serial_ar933x.c @@ -188,7 +188,7 @@ U_BOOT_DRIVER(serial_ar933x) = { .name = "serial_ar933x", .id = UCLASS_SERIAL, .of_match = ar933x_serial_ids, - .priv_auto_alloc_size = sizeof(struct ar933x_serial_priv), + .priv_auto = sizeof(struct ar933x_serial_priv), .probe = ar933x_serial_probe, .ops = &ar933x_serial_ops, }; diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c index 04063fb..445eacc 100644 --- a/drivers/serial/serial_arc.c +++ b/drivers/serial/serial_arc.c @@ -25,7 +25,7 @@ struct arc_serial_regs { }; -struct arc_serial_platdata { +struct arc_serial_plat { struct arc_serial_regs *reg; unsigned int uartclk; }; @@ -37,7 +37,7 @@ struct arc_serial_platdata { static int arc_serial_setbrg(struct udevice *dev, int baudrate) { - struct arc_serial_platdata *plat = dev->platdata; + struct arc_serial_plat *plat = dev_get_plat(dev); struct arc_serial_regs *const regs = plat->reg; int arc_console_baud = gd->cpu_clk / (baudrate * 4) - 1; @@ -49,7 +49,7 @@ static int arc_serial_setbrg(struct udevice *dev, int baudrate) static int arc_serial_putc(struct udevice *dev, const char c) { - struct arc_serial_platdata *plat = dev->platdata; + struct arc_serial_plat *plat = dev_get_plat(dev); struct arc_serial_regs *const regs = plat->reg; while (!(readb(®s->status) & UART_TXEMPTY)) @@ -67,7 +67,7 @@ static int arc_serial_tstc(struct arc_serial_regs *const regs) static int arc_serial_pending(struct udevice *dev, bool input) { - struct arc_serial_platdata *plat = dev->platdata; + struct arc_serial_plat *plat = dev_get_plat(dev); struct arc_serial_regs *const regs = plat->reg; uint32_t status = readb(®s->status); @@ -79,7 +79,7 @@ static int arc_serial_pending(struct udevice *dev, bool input) static int arc_serial_getc(struct udevice *dev) { - struct arc_serial_platdata *plat = dev->platdata; + struct arc_serial_plat *plat = dev_get_plat(dev); struct arc_serial_regs *const regs = plat->reg; while (!arc_serial_tstc(regs)) @@ -109,9 +109,9 @@ static const struct udevice_id arc_serial_ids[] = { { } }; -static int arc_serial_ofdata_to_platdata(struct udevice *dev) +static int arc_serial_of_to_plat(struct udevice *dev) { - struct arc_serial_platdata *plat = dev_get_platdata(dev); + struct arc_serial_plat *plat = dev_get_plat(dev); DECLARE_GLOBAL_DATA_PTR; plat->reg = dev_read_addr_ptr(dev); @@ -125,8 +125,8 @@ U_BOOT_DRIVER(serial_arc) = { .name = "serial_arc", .id = UCLASS_SERIAL, .of_match = arc_serial_ids, - .ofdata_to_platdata = arc_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct arc_serial_platdata), + .of_to_plat = arc_serial_of_to_plat, + .plat_auto = sizeof(struct arc_serial_plat), .probe = arc_serial_probe, .ops = &arc_serial_ops, }; diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c index 8a4af87..58fa722 100644 --- a/drivers/serial/serial_bcm283x_mu.c +++ b/drivers/serial/serial_bcm283x_mu.c @@ -55,7 +55,7 @@ static int bcm283x_mu_serial_getc(struct udevice *dev); static int bcm283x_mu_serial_setbrg(struct udevice *dev, int baudrate) { - struct bcm283x_mu_serial_platdata *plat = dev_get_platdata(dev); + struct bcm283x_mu_serial_plat *plat = dev_get_plat(dev); struct bcm283x_mu_priv *priv = dev_get_priv(dev); struct bcm283x_mu_regs *regs = priv->regs; u32 divider; @@ -158,7 +158,7 @@ static bool bcm283x_is_serial_muxed(void) static int bcm283x_mu_serial_probe(struct udevice *dev) { - struct bcm283x_mu_serial_platdata *plat = dev_get_platdata(dev); + struct bcm283x_mu_serial_plat *plat = dev_get_plat(dev); struct bcm283x_mu_priv *priv = dev_get_priv(dev); fdt_addr_t addr; @@ -167,7 +167,7 @@ static int bcm283x_mu_serial_probe(struct udevice *dev) return -ENODEV; /* - * Read the ofdata here rather than in an ofdata_to_platdata() method + * Read the ofdata here rather than in an of_to_plat() method * since we need the soc simple-bus to be probed so that the 'ranges' * property is used. */ @@ -194,11 +194,11 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = { .name = "serial_bcm283x_mu", .id = UCLASS_SERIAL, .of_match = of_match_ptr(bcm283x_mu_serial_id), - .platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata), + .plat_auto = sizeof(struct bcm283x_mu_serial_plat), .probe = bcm283x_mu_serial_probe, .ops = &bcm283x_mu_serial_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif - .priv_auto_alloc_size = sizeof(struct bcm283x_mu_priv), + .priv_auto = sizeof(struct bcm283x_mu_priv), }; diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c index 923f402..2d2e970 100644 --- a/drivers/serial/serial_bcm283x_pl011.c +++ b/drivers/serial/serial_bcm283x_pl011.c @@ -35,7 +35,7 @@ static bool bcm283x_is_serial_muxed(void) static int bcm283x_pl011_serial_probe(struct udevice *dev) { - struct pl01x_serial_platdata *plat = dev_get_platdata(dev); + struct pl01x_serial_plat *plat = dev_get_plat(dev); int ret; /* Don't spawn the device if it's not muxed */ @@ -43,11 +43,11 @@ static int bcm283x_pl011_serial_probe(struct udevice *dev) return -ENODEV; /* - * Read the ofdata here rather than in an ofdata_to_platdata() method + * Read the ofdata here rather than in an of_to_plat() method * since we need the soc simple-bus to be probed so that the 'ranges' * property is used. */ - ret = pl01x_serial_ofdata_to_platdata(dev); + ret = pl01x_serial_of_to_plat(dev); if (ret) return ret; @@ -92,10 +92,10 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = { .id = UCLASS_SERIAL, .of_match = of_match_ptr(bcm283x_pl011_serial_id), .probe = bcm283x_pl011_serial_probe, - .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata), + .plat_auto = sizeof(struct pl01x_serial_plat), .ops = &bcm283x_pl011_serial_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif - .priv_auto_alloc_size = sizeof(struct pl01x_priv), + .priv_auto = sizeof(struct pl01x_priv), }; diff --git a/drivers/serial/serial_bcm6345.c b/drivers/serial/serial_bcm6345.c index 5b963ce..f08e91f 100644 --- a/drivers/serial/serial_bcm6345.c +++ b/drivers/serial/serial_bcm6345.c @@ -262,7 +262,7 @@ U_BOOT_DRIVER(bcm6345_serial) = { .id = UCLASS_SERIAL, .of_match = bcm6345_serial_ids, .probe = bcm6345_serial_probe, - .priv_auto_alloc_size = sizeof(struct bcm6345_serial_priv), + .priv_auto = sizeof(struct bcm6345_serial_priv), .ops = &bcm6345_serial_ops, }; diff --git a/drivers/serial/serial_coreboot.c b/drivers/serial/serial_coreboot.c index ccab347..88c8209 100644 --- a/drivers/serial/serial_coreboot.c +++ b/drivers/serial/serial_coreboot.c @@ -11,9 +11,9 @@ #include <serial.h> #include <asm/arch/sysinfo.h> -static int coreboot_ofdata_to_platdata(struct udevice *dev) +static int coreboot_of_to_plat(struct udevice *dev) { - struct ns16550_platdata *plat = dev_get_platdata(dev); + struct ns16550_plat *plat = dev_get_plat(dev); struct cb_serial *cb_info = lib_sysinfo.serial; plat->base = cb_info->baseaddr; @@ -37,9 +37,9 @@ U_BOOT_DRIVER(coreboot_uart) = { .name = "coreboot_uart", .id = UCLASS_SERIAL, .of_match = coreboot_serial_ids, - .priv_auto_alloc_size = sizeof(struct NS16550), - .platdata_auto_alloc_size = sizeof(struct ns16550_platdata), - .ofdata_to_platdata = coreboot_ofdata_to_platdata, + .priv_auto = sizeof(struct ns16550), + .plat_auto = sizeof(struct ns16550_plat), + .of_to_plat = coreboot_of_to_plat, .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/serial/serial_cortina.c b/drivers/serial/serial_cortina.c index cc20673..6dc81a7 100644 --- a/drivers/serial/serial_cortina.c +++ b/drivers/serial/serial_cortina.c @@ -131,7 +131,7 @@ static int ca_serial_probe(struct udevice *dev) return 0; } -static int ca_serial_ofdata_to_platdata(struct udevice *dev) +static int ca_serial_of_to_plat(struct udevice *dev) { struct ca_uart_priv *priv = dev_get_priv(dev); @@ -158,8 +158,8 @@ U_BOOT_DRIVER(serial_cortina) = { .name = "serial_cortina", .id = UCLASS_SERIAL, .of_match = ca_serial_ids, - .ofdata_to_platdata = ca_serial_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct ca_uart_priv), + .of_to_plat = ca_serial_of_to_plat, + .priv_auto = sizeof(struct ca_uart_priv), .probe = ca_serial_probe, .ops = &ca_serial_ops }; diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c index b152e10..33ddbd6 100644 --- a/drivers/serial/serial_efi.c +++ b/drivers/serial/serial_efi.c @@ -150,7 +150,7 @@ U_BOOT_DRIVER(serial_efi) = { .name = "serial_efi", .id = UCLASS_SERIAL, .of_match = serial_efi_ids, - .priv_auto_alloc_size = sizeof(struct serial_efi_priv), + .priv_auto = sizeof(struct serial_efi_priv), .probe = serial_efi_probe, .ops = &serial_efi_ops, }; diff --git a/drivers/serial/serial_intel_mid.c b/drivers/serial/serial_intel_mid.c index 39bd40e..bbf1905 100644 --- a/drivers/serial/serial_intel_mid.c +++ b/drivers/serial/serial_intel_mid.c @@ -21,7 +21,7 @@ #define UART_MUL 0x34 #define UART_DIV 0x38 -static void mid_writel(struct ns16550_platdata *plat, int offset, int value) +static void mid_writel(struct ns16550_plat *plat, int offset, int value) { unsigned char *addr; @@ -33,7 +33,7 @@ static void mid_writel(struct ns16550_platdata *plat, int offset, int value) static int mid_serial_probe(struct udevice *dev) { - struct ns16550_platdata *plat = dev_get_platdata(dev); + struct ns16550_plat *plat = dev_get_plat(dev); /* * Initialize fractional divider correctly for Intel Edison @@ -59,9 +59,9 @@ U_BOOT_DRIVER(serial_intel_mid) = { .name = "serial_intel_mid", .id = UCLASS_SERIAL, .of_match = mid_serial_ids, - .ofdata_to_platdata = ns16550_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct ns16550_platdata), - .priv_auto_alloc_size = sizeof(struct NS16550), + .of_to_plat = ns16550_serial_of_to_plat, + .plat_auto = sizeof(struct ns16550_plat), + .priv_auto = sizeof(struct ns16550), .probe = mid_serial_probe, .ops = &ns16550_serial_ops, }; diff --git a/drivers/serial/serial_linflexuart.c b/drivers/serial/serial_linflexuart.c index 83dc96c..c3714e1 100644 --- a/drivers/serial/serial_linflexuart.c +++ b/drivers/serial/serial_linflexuart.c @@ -115,7 +115,7 @@ static int _linflex_serial_init(struct linflex_fsl *base) return 0; } -struct linflex_serial_platdata { +struct linflex_serial_plat { struct linflex_fsl *base_addr; u8 port_id; /* do we need this? */ }; @@ -168,7 +168,7 @@ static void linflex_serial_init_internal(struct linflex_fsl *lfuart) static int linflex_serial_probe(struct udevice *dev) { - struct linflex_serial_platdata *plat = dev->platdata; + struct linflex_serial_plat *plat = dev_get_plat(dev); struct linflex_serial_priv *priv = dev_get_priv(dev); priv->lfuart = (struct linflex_fsl *)plat->base_addr; @@ -190,7 +190,7 @@ U_BOOT_DRIVER(serial_linflex) = { .probe = linflex_serial_probe, .ops = &linflex_serial_ops, .flags = DM_FLAG_PRE_RELOC, - .priv_auto_alloc_size = sizeof(struct linflex_serial_priv), + .priv_auto = sizeof(struct linflex_serial_priv), }; #ifdef CONFIG_DEBUG_UART_LINFLEXUART diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c index 95cbe63..a35e5be 100644 --- a/drivers/serial/serial_lpuart.c +++ b/drivers/serial/serial_lpuart.c @@ -74,7 +74,7 @@ enum lpuart_devtype { DEV_IMXRT, }; -struct lpuart_serial_platdata { +struct lpuart_serial_plat { void *reg; enum lpuart_devtype devtype; ulong flags; @@ -138,7 +138,7 @@ static inline int get_lpuart_clk_rate(struct udevice *dev, u32 *clk) static bool is_lpuart32(struct udevice *dev) { - struct lpuart_serial_platdata *plat = dev->platdata; + struct lpuart_serial_plat *plat = dev_get_plat(dev); return plat->flags & LPUART_FLAG_REGMAP_32BIT_REG; } @@ -146,7 +146,7 @@ static bool is_lpuart32(struct udevice *dev) static void _lpuart_serial_setbrg(struct udevice *dev, int baudrate) { - struct lpuart_serial_platdata *plat = dev_get_platdata(dev); + struct lpuart_serial_plat *plat = dev_get_plat(dev); struct lpuart_fsl *base = plat->reg; u32 clk; u16 sbr; @@ -167,7 +167,7 @@ static void _lpuart_serial_setbrg(struct udevice *dev, __raw_writeb(sbr & 0xff, &base->ubdl); } -static int _lpuart_serial_getc(struct lpuart_serial_platdata *plat) +static int _lpuart_serial_getc(struct lpuart_serial_plat *plat) { struct lpuart_fsl *base = plat->reg; while (!(__raw_readb(&base->us1) & (US1_RDRF | US1_OR))) @@ -178,7 +178,7 @@ static int _lpuart_serial_getc(struct lpuart_serial_platdata *plat) return __raw_readb(&base->ud); } -static void _lpuart_serial_putc(struct lpuart_serial_platdata *plat, +static void _lpuart_serial_putc(struct lpuart_serial_plat *plat, const char c) { struct lpuart_fsl *base = plat->reg; @@ -190,7 +190,7 @@ static void _lpuart_serial_putc(struct lpuart_serial_platdata *plat, } /* Test whether a character is in the RX buffer */ -static int _lpuart_serial_tstc(struct lpuart_serial_platdata *plat) +static int _lpuart_serial_tstc(struct lpuart_serial_plat *plat) { struct lpuart_fsl *base = plat->reg; @@ -206,7 +206,7 @@ static int _lpuart_serial_tstc(struct lpuart_serial_platdata *plat) */ static int _lpuart_serial_init(struct udevice *dev) { - struct lpuart_serial_platdata *plat = dev_get_platdata(dev); + struct lpuart_serial_plat *plat = dev_get_plat(dev); struct lpuart_fsl *base = (struct lpuart_fsl *)plat->reg; u8 ctrl; @@ -235,7 +235,7 @@ static int _lpuart_serial_init(struct udevice *dev) static void _lpuart32_serial_setbrg_7ulp(struct udevice *dev, int baudrate) { - struct lpuart_serial_platdata *plat = dev_get_platdata(dev); + struct lpuart_serial_plat *plat = dev_get_plat(dev); struct lpuart_fsl_reg32 *base = plat->reg; u32 sbr, osr, baud_diff, tmp_osr, tmp_sbr, tmp_diff, tmp; u32 clk; @@ -304,7 +304,7 @@ static void _lpuart32_serial_setbrg_7ulp(struct udevice *dev, static void _lpuart32_serial_setbrg(struct udevice *dev, int baudrate) { - struct lpuart_serial_platdata *plat = dev_get_platdata(dev); + struct lpuart_serial_plat *plat = dev_get_plat(dev); struct lpuart_fsl_reg32 *base = plat->reg; u32 clk; u32 sbr; @@ -324,7 +324,7 @@ static void _lpuart32_serial_setbrg(struct udevice *dev, lpuart_write32(plat->flags, &base->baud, sbr); } -static int _lpuart32_serial_getc(struct lpuart_serial_platdata *plat) +static int _lpuart32_serial_getc(struct lpuart_serial_plat *plat) { struct lpuart_fsl_reg32 *base = plat->reg; u32 stat, val; @@ -345,7 +345,7 @@ static int _lpuart32_serial_getc(struct lpuart_serial_platdata *plat) return val & 0x3ff; } -static void _lpuart32_serial_putc(struct lpuart_serial_platdata *plat, +static void _lpuart32_serial_putc(struct lpuart_serial_plat *plat, const char c) { struct lpuart_fsl_reg32 *base = plat->reg; @@ -367,7 +367,7 @@ static void _lpuart32_serial_putc(struct lpuart_serial_platdata *plat, } /* Test whether a character is in the RX buffer */ -static int _lpuart32_serial_tstc(struct lpuart_serial_platdata *plat) +static int _lpuart32_serial_tstc(struct lpuart_serial_plat *plat) { struct lpuart_fsl_reg32 *base = plat->reg; u32 water; @@ -386,7 +386,7 @@ static int _lpuart32_serial_tstc(struct lpuart_serial_platdata *plat) */ static int _lpuart32_serial_init(struct udevice *dev) { - struct lpuart_serial_platdata *plat = dev_get_platdata(dev); + struct lpuart_serial_plat *plat = dev_get_plat(dev); struct lpuart_fsl_reg32 *base = (struct lpuart_fsl_reg32 *)plat->reg; u32 val, tx_fifo_size; @@ -428,7 +428,7 @@ static int _lpuart32_serial_init(struct udevice *dev) static int lpuart_serial_setbrg(struct udevice *dev, int baudrate) { - struct lpuart_serial_platdata *plat = dev_get_platdata(dev); + struct lpuart_serial_plat *plat = dev_get_plat(dev); if (is_lpuart32(dev)) { if (plat->devtype == DEV_MX7ULP || plat->devtype == DEV_IMX8 || @@ -445,7 +445,7 @@ static int lpuart_serial_setbrg(struct udevice *dev, int baudrate) static int lpuart_serial_getc(struct udevice *dev) { - struct lpuart_serial_platdata *plat = dev->platdata; + struct lpuart_serial_plat *plat = dev_get_plat(dev); if (is_lpuart32(dev)) return _lpuart32_serial_getc(plat); @@ -455,7 +455,7 @@ static int lpuart_serial_getc(struct udevice *dev) static int lpuart_serial_putc(struct udevice *dev, const char c) { - struct lpuart_serial_platdata *plat = dev->platdata; + struct lpuart_serial_plat *plat = dev_get_plat(dev); if (is_lpuart32(dev)) _lpuart32_serial_putc(plat, c); @@ -467,7 +467,7 @@ static int lpuart_serial_putc(struct udevice *dev, const char c) static int lpuart_serial_pending(struct udevice *dev, bool input) { - struct lpuart_serial_platdata *plat = dev->platdata; + struct lpuart_serial_plat *plat = dev_get_plat(dev); struct lpuart_fsl *reg = plat->reg; struct lpuart_fsl_reg32 *reg32 = plat->reg; u32 stat; @@ -511,9 +511,9 @@ static int lpuart_serial_probe(struct udevice *dev) return _lpuart_serial_init(dev); } -static int lpuart_serial_ofdata_to_platdata(struct udevice *dev) +static int lpuart_serial_of_to_plat(struct udevice *dev) { - struct lpuart_serial_platdata *plat = dev->platdata; + struct lpuart_serial_plat *plat = dev_get_plat(dev); const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); fdt_addr_t addr; @@ -566,8 +566,8 @@ U_BOOT_DRIVER(serial_lpuart) = { .name = "serial_lpuart", .id = UCLASS_SERIAL, .of_match = lpuart_serial_ids, - .ofdata_to_platdata = lpuart_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata), + .of_to_plat = lpuart_serial_of_to_plat, + .plat_auto = sizeof(struct lpuart_serial_plat), .probe = lpuart_serial_probe, .ops = &lpuart_serial_ops, }; diff --git a/drivers/serial/serial_mcf.c b/drivers/serial/serial_mcf.c index 402fd53..e6e21b2 100644 --- a/drivers/serial/serial_mcf.c +++ b/drivers/serial/serial_mcf.c @@ -83,9 +83,9 @@ static void mcf_serial_setbrg_common(uart_t *uart, int baudrate) static int coldfire_serial_probe(struct udevice *dev) { - struct coldfire_serial_platdata *plat = dev->platdata; + struct coldfire_serial_plat *plat = dev_get_plat(dev); - plat->port = dev->seq; + plat->port = dev_seq(dev); return mcf_serial_init_common((uart_t *)plat->base, plat->port, plat->baudrate); @@ -93,7 +93,7 @@ static int coldfire_serial_probe(struct udevice *dev) static int coldfire_serial_putc(struct udevice *dev, const char ch) { - struct coldfire_serial_platdata *plat = dev->platdata; + struct coldfire_serial_plat *plat = dev_get_plat(dev); uart_t *uart = (uart_t *)plat->base; /* Wait for last character to go. */ @@ -107,7 +107,7 @@ static int coldfire_serial_putc(struct udevice *dev, const char ch) static int coldfire_serial_getc(struct udevice *dev) { - struct coldfire_serial_platdata *plat = dev->platdata; + struct coldfire_serial_plat *plat = dev_get_plat(dev); uart_t *uart = (uart_t *)(plat->base); /* Wait for a character to arrive. */ @@ -119,7 +119,7 @@ static int coldfire_serial_getc(struct udevice *dev) int coldfire_serial_setbrg(struct udevice *dev, int baudrate) { - struct coldfire_serial_platdata *plat = dev->platdata; + struct coldfire_serial_plat *plat = dev_get_plat(dev); uart_t *uart = (uart_t *)(plat->base); mcf_serial_setbrg_common(uart, baudrate); @@ -129,7 +129,7 @@ int coldfire_serial_setbrg(struct udevice *dev, int baudrate) static int coldfire_serial_pending(struct udevice *dev, bool input) { - struct coldfire_serial_platdata *plat = dev->platdata; + struct coldfire_serial_plat *plat = dev_get_plat(dev); uart_t *uart = (uart_t *)(plat->base); if (input) @@ -140,9 +140,9 @@ static int coldfire_serial_pending(struct udevice *dev, bool input) return 0; } -static int coldfire_ofdata_to_platdata(struct udevice *dev) +static int coldfire_of_to_plat(struct udevice *dev) { - struct coldfire_serial_platdata *plat = dev_get_platdata(dev); + struct coldfire_serial_plat *plat = dev_get_plat(dev); fdt_addr_t addr_base; addr_base = dev_read_addr(dev); @@ -171,8 +171,8 @@ U_BOOT_DRIVER(serial_coldfire) = { .name = "serial_coldfire", .id = UCLASS_SERIAL, .of_match = coldfire_serial_ids, - .ofdata_to_platdata = coldfire_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct coldfire_serial_platdata), + .of_to_plat = coldfire_of_to_plat, + .plat_auto = sizeof(struct coldfire_serial_plat), .probe = coldfire_serial_probe, .ops = &coldfire_serial_ops, .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c index 496a2ca..d69ec22 100644 --- a/drivers/serial/serial_meson.c +++ b/drivers/serial/serial_meson.c @@ -19,7 +19,7 @@ struct meson_uart { u32 misc; }; -struct meson_serial_platdata { +struct meson_serial_plat { struct meson_uart *reg; }; @@ -57,7 +57,7 @@ static void meson_serial_init(struct meson_uart *uart) static int meson_serial_probe(struct udevice *dev) { - struct meson_serial_platdata *plat = dev->platdata; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; meson_serial_init(uart); @@ -67,7 +67,7 @@ static int meson_serial_probe(struct udevice *dev) static void meson_serial_rx_error(struct udevice *dev) { - struct meson_serial_platdata *plat = dev->platdata; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; u32 val = readl(&uart->control); @@ -83,7 +83,7 @@ static void meson_serial_rx_error(struct udevice *dev) static int meson_serial_getc(struct udevice *dev) { - struct meson_serial_platdata *plat = dev->platdata; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; uint32_t status = readl(&uart->status); @@ -100,7 +100,7 @@ static int meson_serial_getc(struct udevice *dev) static int meson_serial_putc(struct udevice *dev, const char ch) { - struct meson_serial_platdata *plat = dev->platdata; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; if (readl(&uart->status) & AML_UART_TX_FULL) @@ -113,7 +113,7 @@ static int meson_serial_putc(struct udevice *dev, const char ch) static int meson_serial_pending(struct udevice *dev, bool input) { - struct meson_serial_platdata *plat = dev->platdata; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; uint32_t status = readl(&uart->status); @@ -136,9 +136,9 @@ static int meson_serial_pending(struct udevice *dev, bool input) } } -static int meson_serial_ofdata_to_platdata(struct udevice *dev) +static int meson_serial_of_to_plat(struct udevice *dev) { - struct meson_serial_platdata *plat = dev->platdata; + struct meson_serial_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -168,8 +168,8 @@ U_BOOT_DRIVER(serial_meson) = { .of_match = meson_serial_ids, .probe = meson_serial_probe, .ops = &meson_serial_ops, - .ofdata_to_platdata = meson_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct meson_serial_platdata), + .of_to_plat = meson_serial_of_to_plat, + .plat_auto = sizeof(struct meson_serial_plat), }; #ifdef CONFIG_DEBUG_UART_MESON diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index c8946c3..024c2c9 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -216,7 +216,7 @@ static int msm_serial_probe(struct udevice *dev) return 0; } -static int msm_serial_ofdata_to_platdata(struct udevice *dev) +static int msm_serial_of_to_plat(struct udevice *dev) { struct msm_serial_data *priv = dev_get_priv(dev); @@ -239,8 +239,8 @@ U_BOOT_DRIVER(serial_msm) = { .name = "serial_msm", .id = UCLASS_SERIAL, .of_match = msm_serial_ids, - .ofdata_to_platdata = msm_serial_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct msm_serial_data), + .of_to_plat = msm_serial_of_to_plat, + .priv_auto = sizeof(struct msm_serial_data), .probe = msm_serial_probe, .ops = &msm_serial_ops, }; diff --git a/drivers/serial/serial_mtk.c b/drivers/serial/serial_mtk.c index 778a04d..665b2aa 100644 --- a/drivers/serial/serial_mtk.c +++ b/drivers/serial/serial_mtk.c @@ -216,7 +216,7 @@ static int mtk_serial_probe(struct udevice *dev) return 0; } -static int mtk_serial_ofdata_to_platdata(struct udevice *dev) +static int mtk_serial_of_to_plat(struct udevice *dev) { struct mtk_serial_priv *priv = dev_get_priv(dev); fdt_addr_t addr; @@ -267,8 +267,8 @@ U_BOOT_DRIVER(serial_mtk) = { .name = "serial_mtk", .id = UCLASS_SERIAL, .of_match = mtk_serial_ids, - .ofdata_to_platdata = mtk_serial_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct mtk_serial_priv), + .of_to_plat = mtk_serial_of_to_plat, + .priv_auto = sizeof(struct mtk_serial_priv), .probe = mtk_serial_probe, .ops = &mtk_serial_ops, .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c index fb43f88..5a1d40e 100644 --- a/drivers/serial/serial_mvebu_a3700.c +++ b/drivers/serial/serial_mvebu_a3700.c @@ -8,7 +8,7 @@ #include <serial.h> #include <asm/io.h> -struct mvebu_platdata { +struct mvebu_plat { void __iomem *base; }; @@ -32,7 +32,7 @@ struct mvebu_platdata { static int mvebu_serial_putc(struct udevice *dev, const char ch) { - struct mvebu_platdata *plat = dev_get_platdata(dev); + struct mvebu_plat *plat = dev_get_plat(dev); void __iomem *base = plat->base; while (readl(base + UART_STATUS_REG) & UART_STATUS_TXFIFO_FULL) @@ -45,7 +45,7 @@ static int mvebu_serial_putc(struct udevice *dev, const char ch) static int mvebu_serial_getc(struct udevice *dev) { - struct mvebu_platdata *plat = dev_get_platdata(dev); + struct mvebu_plat *plat = dev_get_plat(dev); void __iomem *base = plat->base; while (!(readl(base + UART_STATUS_REG) & UART_STATUS_RX_RDY)) @@ -56,7 +56,7 @@ static int mvebu_serial_getc(struct udevice *dev) static int mvebu_serial_pending(struct udevice *dev, bool input) { - struct mvebu_platdata *plat = dev_get_platdata(dev); + struct mvebu_plat *plat = dev_get_plat(dev); void __iomem *base = plat->base; if (readl(base + UART_STATUS_REG) & UART_STATUS_RX_RDY) @@ -67,7 +67,7 @@ static int mvebu_serial_pending(struct udevice *dev, bool input) static int mvebu_serial_setbrg(struct udevice *dev, int baudrate) { - struct mvebu_platdata *plat = dev_get_platdata(dev); + struct mvebu_plat *plat = dev_get_plat(dev); void __iomem *base = plat->base; /* @@ -87,7 +87,7 @@ static int mvebu_serial_setbrg(struct udevice *dev, int baudrate) static int mvebu_serial_probe(struct udevice *dev) { - struct mvebu_platdata *plat = dev_get_platdata(dev); + struct mvebu_plat *plat = dev_get_plat(dev); void __iomem *base = plat->base; /* reset FIFOs */ @@ -100,9 +100,9 @@ static int mvebu_serial_probe(struct udevice *dev) return 0; } -static int mvebu_serial_ofdata_to_platdata(struct udevice *dev) +static int mvebu_serial_of_to_plat(struct udevice *dev) { - struct mvebu_platdata *plat = dev_get_platdata(dev); + struct mvebu_plat *plat = dev_get_plat(dev); plat->base = dev_read_addr_ptr(dev); @@ -125,8 +125,8 @@ U_BOOT_DRIVER(serial_mvebu) = { .name = "serial_mvebu", .id = UCLASS_SERIAL, .of_match = mvebu_serial_ids, - .ofdata_to_platdata = mvebu_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct mvebu_platdata), + .of_to_plat = mvebu_serial_of_to_plat, + .plat_auto = sizeof(struct mvebu_plat), .probe = mvebu_serial_probe, .ops = &mvebu_serial_ops, }; diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c index de6cefc..e5795da 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -264,7 +264,7 @@ __weak struct serial_device *default_serial_console(void) int mxc_serial_setbrg(struct udevice *dev, int baudrate) { - struct mxc_serial_platdata *plat = dev->platdata; + struct mxc_serial_plat *plat = dev_get_plat(dev); u32 clk = imx_get_uartclk(); _mxc_serial_setbrg(plat->reg, clk, baudrate, plat->use_dte); @@ -274,7 +274,7 @@ int mxc_serial_setbrg(struct udevice *dev, int baudrate) static int mxc_serial_probe(struct udevice *dev) { - struct mxc_serial_platdata *plat = dev->platdata; + struct mxc_serial_plat *plat = dev_get_plat(dev); _mxc_serial_init(plat->reg, plat->use_dte); @@ -283,7 +283,7 @@ static int mxc_serial_probe(struct udevice *dev) static int mxc_serial_getc(struct udevice *dev) { - struct mxc_serial_platdata *plat = dev->platdata; + struct mxc_serial_plat *plat = dev_get_plat(dev); struct mxc_uart *const uart = plat->reg; if (readl(&uart->ts) & UTS_RXEMPTY) @@ -294,7 +294,7 @@ static int mxc_serial_getc(struct udevice *dev) static int mxc_serial_putc(struct udevice *dev, const char ch) { - struct mxc_serial_platdata *plat = dev->platdata; + struct mxc_serial_plat *plat = dev_get_plat(dev); struct mxc_uart *const uart = plat->reg; if (!(readl(&uart->ts) & UTS_TXEMPTY)) @@ -307,7 +307,7 @@ static int mxc_serial_putc(struct udevice *dev, const char ch) static int mxc_serial_pending(struct udevice *dev, bool input) { - struct mxc_serial_platdata *plat = dev->platdata; + struct mxc_serial_plat *plat = dev_get_plat(dev); struct mxc_uart *const uart = plat->reg; uint32_t sr2 = readl(&uart->sr2); @@ -325,9 +325,9 @@ static const struct dm_serial_ops mxc_serial_ops = { }; #if CONFIG_IS_ENABLED(OF_CONTROL) -static int mxc_serial_ofdata_to_platdata(struct udevice *dev) +static int mxc_serial_of_to_plat(struct udevice *dev) { - struct mxc_serial_platdata *plat = dev->platdata; + struct mxc_serial_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -357,8 +357,8 @@ U_BOOT_DRIVER(serial_mxc) = { .id = UCLASS_SERIAL, #if CONFIG_IS_ENABLED(OF_CONTROL) .of_match = mxc_serial_ids, - .ofdata_to_platdata = mxc_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct mxc_serial_platdata), + .of_to_plat = mxc_serial_of_to_plat, + .plat_auto = sizeof(struct mxc_serial_plat), #endif .probe = mxc_serial_probe, .ops = &mxc_serial_ops, diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c index ef394b7..b5beca9 100644 --- a/drivers/serial/serial_ns16550.c +++ b/drivers/serial/serial_ns16550.c @@ -36,34 +36,34 @@ DECLARE_GLOBAL_DATA_PTR; /* Note: The port number specified in the functions is 1 based. * the array is 0 based. */ -static NS16550_t serial_ports[6] = { +static struct ns16550 *serial_ports[6] = { #ifdef CONFIG_SYS_NS16550_COM1 - (NS16550_t)CONFIG_SYS_NS16550_COM1, + (struct ns16550 *)CONFIG_SYS_NS16550_COM1, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM2 - (NS16550_t)CONFIG_SYS_NS16550_COM2, + (struct ns16550 *)CONFIG_SYS_NS16550_COM2, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM3 - (NS16550_t)CONFIG_SYS_NS16550_COM3, + (struct ns16550 *)CONFIG_SYS_NS16550_COM3, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM4 - (NS16550_t)CONFIG_SYS_NS16550_COM4, + (struct ns16550 *)CONFIG_SYS_NS16550_COM4, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM5 - (NS16550_t)CONFIG_SYS_NS16550_COM5, + (struct ns16550 *)CONFIG_SYS_NS16550_COM5, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM6 - (NS16550_t)CONFIG_SYS_NS16550_COM6 + (struct ns16550 *)CONFIG_SYS_NS16550_COM6 #else NULL #endif @@ -78,7 +78,7 @@ static NS16550_t serial_ports[6] = { int clock_divisor; \ clock_divisor = ns16550_calc_divisor(serial_ports[port-1], \ CONFIG_SYS_NS16550_CLK, gd->baudrate); \ - NS16550_init(serial_ports[port-1], clock_divisor); \ + ns16550_init(serial_ports[port - 1], clock_divisor); \ return 0 ; \ } \ static void eserial##port##_setbrg(void) \ @@ -117,9 +117,9 @@ static NS16550_t serial_ports[6] = { static void _serial_putc(const char c, const int port) { if (c == '\n') - NS16550_putc(PORT, '\r'); + ns16550_putc(PORT, '\r'); - NS16550_putc(PORT, c); + ns16550_putc(PORT, c); } static void _serial_puts(const char *s, const int port) @@ -131,12 +131,12 @@ static void _serial_puts(const char *s, const int port) static int _serial_getc(const int port) { - return NS16550_getc(PORT); + return ns16550_getc(PORT); } static int _serial_tstc(const int port) { - return NS16550_tstc(PORT); + return ns16550_tstc(PORT); } static void _serial_setbrg(const int port) @@ -145,7 +145,7 @@ static void _serial_setbrg(const int port) clock_divisor = ns16550_calc_divisor(PORT, CONFIG_SYS_NS16550_CLK, gd->baudrate); - NS16550_reinit(PORT, clock_divisor); + ns16550_reinit(PORT, clock_divisor); } static inline void diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c index f7997fc..2b23ece 100644 --- a/drivers/serial/serial_omap.c +++ b/drivers/serial/serial_omap.c @@ -66,7 +66,7 @@ static inline int serial_in_shift(void *addr, int shift) static inline void _debug_uart_init(void) { - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; + struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE; int baud_divisor; baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK, @@ -85,7 +85,7 @@ static inline void _debug_uart_init(void) static inline void _debug_uart_putc(int ch) { - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; + struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE; while (!(serial_din(&com_port->lsr) & UART_LSR_THRE)) ; @@ -99,9 +99,9 @@ DEBUG_UART_FUNCS #if CONFIG_IS_ENABLED(DM_SERIAL) #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -static int omap_serial_ofdata_to_platdata(struct udevice *dev) +static int omap_serial_of_to_plat(struct udevice *dev) { - struct ns16550_platdata *plat = dev->platdata; + struct ns16550_plat *plat = dev_get_plat(dev); fdt_addr_t addr; struct clk clk; int err; @@ -157,10 +157,10 @@ U_BOOT_DRIVER(omap_serial) = { .id = UCLASS_SERIAL, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = omap_serial_ids, - .ofdata_to_platdata = omap_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct ns16550_platdata), + .of_to_plat = omap_serial_of_to_plat, + .plat_auto = sizeof(struct ns16550_plat), #endif - .priv_auto_alloc_size = sizeof(struct NS16550), + .priv_auto = sizeof(struct ns16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) diff --git a/drivers/serial/serial_owl.c b/drivers/serial/serial_owl.c index 2651a45..3b79578 100644 --- a/drivers/serial/serial_owl.c +++ b/drivers/serial/serial_owl.c @@ -102,7 +102,7 @@ static int owl_serial_probe(struct udevice *dev) return 0; } -static int owl_serial_ofdata_to_platdata(struct udevice *dev) +static int owl_serial_of_to_plat(struct udevice *dev) { struct owl_serial_priv *priv = dev_get_priv(dev); @@ -129,8 +129,8 @@ U_BOOT_DRIVER(serial_owl) = { .name = "serial_owl", .id = UCLASS_SERIAL, .of_match = owl_serial_ids, - .ofdata_to_platdata = owl_serial_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct owl_serial_priv), + .of_to_plat = owl_serial_of_to_plat, + .priv_auto = sizeof(struct owl_serial_priv), .probe = owl_serial_probe, .ops = &owl_serial_ops, }; diff --git a/drivers/serial/serial_pic32.c b/drivers/serial/serial_pic32.c index a492063..5d1dbe7 100644 --- a/drivers/serial/serial_pic32.c +++ b/drivers/serial/serial_pic32.c @@ -178,7 +178,7 @@ U_BOOT_DRIVER(pic32_serial) = { .of_match = pic32_uart_ids, .probe = pic32_uart_probe, .ops = &pic32_uart_ops, - .priv_auto_alloc_size = sizeof(struct pic32_uart_priv), + .priv_auto = sizeof(struct pic32_uart_priv), }; #ifdef CONFIG_DEBUG_UART_PIC32 diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index d9e35c6..b21e943 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -281,7 +281,7 @@ __weak struct serial_device *default_serial_console(void) int pl01x_serial_setbrg(struct udevice *dev, int baudrate) { - struct pl01x_serial_platdata *plat = dev_get_platdata(dev); + struct pl01x_serial_plat *plat = dev_get_plat(dev); struct pl01x_priv *priv = dev_get_priv(dev); if (!plat->skip_init) { @@ -294,7 +294,7 @@ int pl01x_serial_setbrg(struct udevice *dev, int baudrate) int pl01x_serial_probe(struct udevice *dev) { - struct pl01x_serial_platdata *plat = dev_get_platdata(dev); + struct pl01x_serial_plat *plat = dev_get_plat(dev); struct pl01x_priv *priv = dev_get_priv(dev); priv->regs = (struct pl01x_regs *)plat->base; @@ -348,9 +348,9 @@ static const struct udevice_id pl01x_serial_id[] ={ #define CONFIG_PL011_CLOCK 0 #endif -int pl01x_serial_ofdata_to_platdata(struct udevice *dev) +int pl01x_serial_of_to_plat(struct udevice *dev) { - struct pl01x_serial_platdata *plat = dev_get_platdata(dev); + struct pl01x_serial_plat *plat = dev_get_plat(dev); struct clk clk; fdt_addr_t addr; int ret; @@ -387,12 +387,12 @@ U_BOOT_DRIVER(serial_pl01x) = { .name = "serial_pl01x", .id = UCLASS_SERIAL, .of_match = of_match_ptr(pl01x_serial_id), - .ofdata_to_platdata = of_match_ptr(pl01x_serial_ofdata_to_platdata), - .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata), + .of_to_plat = of_match_ptr(pl01x_serial_of_to_plat), + .plat_auto = sizeof(struct pl01x_serial_plat), .probe = pl01x_serial_probe, .ops = &pl01x_serial_ops, .flags = DM_FLAG_PRE_RELOC, - .priv_auto_alloc_size = sizeof(struct pl01x_priv), + .priv_auto = sizeof(struct pl01x_priv), }; #endif diff --git a/drivers/serial/serial_pl01x_internal.h b/drivers/serial/serial_pl01x_internal.h index c5c706b..dfd95a0 100644 --- a/drivers/serial/serial_pl01x_internal.h +++ b/drivers/serial/serial_pl01x_internal.h @@ -40,7 +40,7 @@ struct pl01x_regs { #ifdef CONFIG_DM_SERIAL -int pl01x_serial_ofdata_to_platdata(struct udevice *dev); +int pl01x_serial_of_to_plat(struct udevice *dev); int pl01x_serial_probe(struct udevice *dev); /* Needed for external pl01x_serial_ops drivers */ diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c index 6f8f7e1..669841e 100644 --- a/drivers/serial/serial_pxa.c +++ b/drivers/serial/serial_pxa.c @@ -268,7 +268,7 @@ void pxa_serial_initialize(void) #ifdef CONFIG_DM_SERIAL static int pxa_serial_probe(struct udevice *dev) { - struct pxa_serial_platdata *plat = dev->platdata; + struct pxa_serial_plat *plat = dev_get_plat(dev); pxa_setbrg_common((struct pxa_uart_regs *)plat->base, plat->port, plat->baudrate); @@ -277,7 +277,7 @@ static int pxa_serial_probe(struct udevice *dev) static int pxa_serial_putc(struct udevice *dev, const char ch) { - struct pxa_serial_platdata *plat = dev->platdata; + struct pxa_serial_plat *plat = dev_get_plat(dev); struct pxa_uart_regs *uart_regs = (struct pxa_uart_regs *)plat->base; /* Wait for last character to go. */ @@ -291,7 +291,7 @@ static int pxa_serial_putc(struct udevice *dev, const char ch) static int pxa_serial_getc(struct udevice *dev) { - struct pxa_serial_platdata *plat = dev->platdata; + struct pxa_serial_plat *plat = dev_get_plat(dev); struct pxa_uart_regs *uart_regs = (struct pxa_uart_regs *)plat->base; /* Wait for a character to arrive. */ @@ -303,7 +303,7 @@ static int pxa_serial_getc(struct udevice *dev) int pxa_serial_setbrg(struct udevice *dev, int baudrate) { - struct pxa_serial_platdata *plat = dev->platdata; + struct pxa_serial_plat *plat = dev_get_plat(dev); struct pxa_uart_regs *uart_regs = (struct pxa_uart_regs *)plat->base; int port = plat->port; @@ -314,7 +314,7 @@ int pxa_serial_setbrg(struct udevice *dev, int baudrate) static int pxa_serial_pending(struct udevice *dev, bool input) { - struct pxa_serial_platdata *plat = dev->platdata; + struct pxa_serial_plat *plat = dev_get_plat(dev); struct pxa_uart_regs *uart_regs = (struct pxa_uart_regs *)plat->base; if (input) diff --git a/drivers/serial/serial_rockchip.c b/drivers/serial/serial_rockchip.c index b1718f7..97d4086 100644 --- a/drivers/serial/serial_rockchip.c +++ b/drivers/serial/serial_rockchip.c @@ -10,31 +10,32 @@ #include <ns16550.h> #include <serial.h> #include <asm/arch-rockchip/clock.h> +#include <dm/device-internal.h> #if defined(CONFIG_ROCKCHIP_RK3188) -struct rockchip_uart_platdata { +struct rockchip_uart_plat { struct dtd_rockchip_rk3188_uart dtplat; - struct ns16550_platdata plat; + struct ns16550_plat plat; }; struct dtd_rockchip_rk3188_uart *dtplat, s_dtplat; #elif defined(CONFIG_ROCKCHIP_RK3288) -struct rockchip_uart_platdata { +struct rockchip_uart_plat { struct dtd_rockchip_rk3288_uart dtplat; - struct ns16550_platdata plat; + struct ns16550_plat plat; }; struct dtd_rockchip_rk3288_uart *dtplat, s_dtplat; #endif static int rockchip_serial_probe(struct udevice *dev) { - struct rockchip_uart_platdata *plat = dev_get_platdata(dev); + struct rockchip_uart_plat *plat = dev_get_plat(dev); /* Create some new platform data for the standard driver */ plat->plat.base = plat->dtplat.reg[0]; plat->plat.reg_shift = plat->dtplat.reg_shift; plat->plat.clock = plat->dtplat.clock_frequency; plat->plat.fcr = UART_FCR_DEFVAL; - dev->platdata = &plat->plat; + dev_set_plat(dev, &plat->plat); return ns16550_serial_probe(dev); } @@ -42,8 +43,8 @@ static int rockchip_serial_probe(struct udevice *dev) U_BOOT_DRIVER(rockchip_rk3188_uart) = { .name = "rockchip_rk3188_uart", .id = UCLASS_SERIAL, - .priv_auto_alloc_size = sizeof(struct NS16550), - .platdata_auto_alloc_size = sizeof(struct rockchip_uart_platdata), + .priv_auto = sizeof(struct ns16550), + .plat_auto = sizeof(struct rockchip_uart_plat), .probe = rockchip_serial_probe, .ops = &ns16550_serial_ops, .flags = DM_FLAG_PRE_RELOC, @@ -52,8 +53,8 @@ U_BOOT_DRIVER(rockchip_rk3188_uart) = { U_BOOT_DRIVER(rockchip_rk3288_uart) = { .name = "rockchip_rk3288_uart", .id = UCLASS_SERIAL, - .priv_auto_alloc_size = sizeof(struct NS16550), - .platdata_auto_alloc_size = sizeof(struct rockchip_uart_platdata), + .priv_auto = sizeof(struct ns16550), + .plat_auto = sizeof(struct rockchip_uart_plat), .probe = rockchip_serial_probe, .ops = &ns16550_serial_ops, .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index 9bb2be2..0eac0d5 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR; #define TX_FIFO_FULL (1 << 24) /* Information about a serial port */ -struct s5p_serial_platdata { +struct s5p_serial_plat { struct s5p_uart *reg; /* address of registers in physical memory */ u8 port_id; /* uart port number */ }; @@ -88,7 +88,7 @@ static void __maybe_unused s5p_serial_baud(struct s5p_uart *uart, uint uclk, #ifndef CONFIG_SPL_BUILD int s5p_serial_setbrg(struct udevice *dev, int baudrate) { - struct s5p_serial_platdata *plat = dev->platdata; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; u32 uclk; @@ -111,7 +111,7 @@ int s5p_serial_setbrg(struct udevice *dev, int baudrate) static int s5p_serial_probe(struct udevice *dev) { - struct s5p_serial_platdata *plat = dev->platdata; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; s5p_serial_init(uart); @@ -140,7 +140,7 @@ static int serial_err_check(const struct s5p_uart *const uart, int op) static int s5p_serial_getc(struct udevice *dev) { - struct s5p_serial_platdata *plat = dev->platdata; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; if (!(readl(&uart->ufstat) & RX_FIFO_COUNT_MASK)) @@ -152,7 +152,7 @@ static int s5p_serial_getc(struct udevice *dev) static int s5p_serial_putc(struct udevice *dev, const char ch) { - struct s5p_serial_platdata *plat = dev->platdata; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; if (readl(&uart->ufstat) & TX_FIFO_FULL) @@ -166,7 +166,7 @@ static int s5p_serial_putc(struct udevice *dev, const char ch) static int s5p_serial_pending(struct udevice *dev, bool input) { - struct s5p_serial_platdata *plat = dev->platdata; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; uint32_t ufstat = readl(&uart->ufstat); @@ -176,9 +176,9 @@ static int s5p_serial_pending(struct udevice *dev, bool input) return (ufstat & TX_FIFO_COUNT_MASK) >> TX_FIFO_COUNT_SHIFT; } -static int s5p_serial_ofdata_to_platdata(struct udevice *dev) +static int s5p_serial_of_to_plat(struct udevice *dev) { - struct s5p_serial_platdata *plat = dev->platdata; + struct s5p_serial_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -187,7 +187,7 @@ static int s5p_serial_ofdata_to_platdata(struct udevice *dev) plat->reg = (struct s5p_uart *)addr; plat->port_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "id", dev->seq); + "id", dev_seq(dev)); return 0; } @@ -207,8 +207,8 @@ U_BOOT_DRIVER(serial_s5p) = { .name = "serial_s5p", .id = UCLASS_SERIAL, .of_match = s5p_serial_ids, - .ofdata_to_platdata = s5p_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct s5p_serial_platdata), + .of_to_plat = s5p_serial_of_to_plat, + .plat_auto = sizeof(struct s5p_serial_plat), .probe = s5p_serial_probe, .ops = &s5p_serial_ops, }; diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c index e27d256..d74f890 100644 --- a/drivers/serial/serial_sh.c +++ b/drivers/serial/serial_sh.c @@ -169,7 +169,7 @@ static int sh_serial_getc(struct udevice *dev) static int sh_serial_setbrg(struct udevice *dev, int baudrate) { - struct sh_serial_platdata *plat = dev_get_platdata(dev); + struct sh_serial_plat *plat = dev_get_plat(dev); struct uart_port *priv = dev_get_priv(dev); sh_serial_setbrg_generic(priv, plat->clk, baudrate); @@ -179,7 +179,7 @@ static int sh_serial_setbrg(struct udevice *dev, int baudrate) static int sh_serial_probe(struct udevice *dev) { - struct sh_serial_platdata *plat = dev_get_platdata(dev); + struct sh_serial_plat *plat = dev_get_plat(dev); struct uart_port *priv = dev_get_priv(dev); priv->membase = (unsigned char *)plat->base; @@ -207,9 +207,9 @@ static const struct udevice_id sh_serial_id[] ={ {} }; -static int sh_serial_ofdata_to_platdata(struct udevice *dev) +static int sh_serial_of_to_plat(struct udevice *dev) { - struct sh_serial_platdata *plat = dev_get_platdata(dev); + struct sh_serial_plat *plat = dev_get_plat(dev); struct clk sh_serial_clk; fdt_addr_t addr; int ret; @@ -239,14 +239,14 @@ U_BOOT_DRIVER(serial_sh) = { .name = "serial_sh", .id = UCLASS_SERIAL, .of_match = of_match_ptr(sh_serial_id), - .ofdata_to_platdata = of_match_ptr(sh_serial_ofdata_to_platdata), - .platdata_auto_alloc_size = sizeof(struct sh_serial_platdata), + .of_to_plat = of_match_ptr(sh_serial_of_to_plat), + .plat_auto = sizeof(struct sh_serial_plat), .probe = sh_serial_probe, .ops = &sh_serial_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, #endif - .priv_auto_alloc_size = sizeof(struct uart_port), + .priv_auto = sizeof(struct uart_port), }; #else /* CONFIG_DM_SERIAL */ diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c index fcc47fb..d26fe7e 100644 --- a/drivers/serial/serial_sifive.c +++ b/drivers/serial/serial_sifive.c @@ -37,7 +37,7 @@ struct uart_sifive { u32 div; }; -struct sifive_uart_platdata { +struct sifive_uart_plat { unsigned long clock; struct uart_sifive *regs; }; @@ -105,7 +105,7 @@ static int sifive_serial_setbrg(struct udevice *dev, int baudrate) { int ret; struct clk clk; - struct sifive_uart_platdata *platdata = dev_get_platdata(dev); + struct sifive_uart_plat *plat = dev_get_plat(dev); u32 clock = 0; ret = clk_get_by_index(dev, 0, &clk); @@ -123,21 +123,21 @@ static int sifive_serial_setbrg(struct udevice *dev, int baudrate) return 0; } } - platdata->clock = clock; - _sifive_serial_setbrg(platdata->regs, platdata->clock, baudrate); + plat->clock = clock; + _sifive_serial_setbrg(plat->regs, plat->clock, baudrate); return 0; } static int sifive_serial_probe(struct udevice *dev) { - struct sifive_uart_platdata *platdata = dev_get_platdata(dev); + struct sifive_uart_plat *plat = dev_get_plat(dev); /* No need to reinitialize the UART after relocation */ if (gd->flags & GD_FLG_RELOC) return 0; - _sifive_serial_init(platdata->regs); + _sifive_serial_init(plat->regs); return 0; } @@ -145,8 +145,8 @@ static int sifive_serial_probe(struct udevice *dev) static int sifive_serial_getc(struct udevice *dev) { int c; - struct sifive_uart_platdata *platdata = dev_get_platdata(dev); - struct uart_sifive *regs = platdata->regs; + struct sifive_uart_plat *plat = dev_get_plat(dev); + struct uart_sifive *regs = plat->regs; while ((c = _sifive_serial_getc(regs)) == -EAGAIN) ; @@ -156,17 +156,17 @@ static int sifive_serial_getc(struct udevice *dev) static int sifive_serial_putc(struct udevice *dev, const char ch) { int rc; - struct sifive_uart_platdata *platdata = dev_get_platdata(dev); + struct sifive_uart_plat *plat = dev_get_plat(dev); - while ((rc = _sifive_serial_putc(platdata->regs, ch)) == -EAGAIN) ; + while ((rc = _sifive_serial_putc(plat->regs, ch)) == -EAGAIN) ; return rc; } static int sifive_serial_pending(struct udevice *dev, bool input) { - struct sifive_uart_platdata *platdata = dev_get_platdata(dev); - struct uart_sifive *regs = platdata->regs; + struct sifive_uart_plat *plat = dev_get_plat(dev); + struct uart_sifive *regs = plat->regs; if (input) return (readl(®s->ip) & UART_IP_RXWM); @@ -174,13 +174,13 @@ static int sifive_serial_pending(struct udevice *dev, bool input) return !!(readl(®s->txfifo) & UART_TXFIFO_FULL); } -static int sifive_serial_ofdata_to_platdata(struct udevice *dev) +static int sifive_serial_of_to_plat(struct udevice *dev) { - struct sifive_uart_platdata *platdata = dev_get_platdata(dev); + struct sifive_uart_plat *plat = dev_get_plat(dev); - platdata->regs = (struct uart_sifive *)dev_read_addr(dev); - if (IS_ERR(platdata->regs)) - return PTR_ERR(platdata->regs); + plat->regs = (struct uart_sifive *)dev_read_addr(dev); + if (IS_ERR(plat->regs)) + return PTR_ERR(plat->regs); return 0; } @@ -201,8 +201,8 @@ U_BOOT_DRIVER(serial_sifive) = { .name = "serial_sifive", .id = UCLASS_SERIAL, .of_match = sifive_serial_ids, - .ofdata_to_platdata = sifive_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct sifive_uart_platdata), + .of_to_plat = sifive_serial_of_to_plat, + .plat_auto = sizeof(struct sifive_uart_plat), .probe = sifive_serial_probe, .ops = &sifive_serial_ops, }; diff --git a/drivers/serial/serial_sti_asc.c b/drivers/serial/serial_sti_asc.c index 91e1574..5d1a46c 100644 --- a/drivers/serial/serial_sti_asc.c +++ b/drivers/serial/serial_sti_asc.c @@ -206,6 +206,6 @@ U_BOOT_DRIVER(serial_sti_asc) = { .of_match = sti_serial_of_match, .ops = &sti_asc_serial_ops, .probe = sti_asc_serial_probe, - .priv_auto_alloc_size = sizeof(struct sti_asc_serial), + .priv_auto = sizeof(struct sti_asc_serial), }; diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c index cab0db2..818c34c 100644 --- a/drivers/serial/serial_stm32.c +++ b/drivers/serial/serial_stm32.c @@ -44,7 +44,7 @@ static void _stm32_serial_setbrg(fdt_addr_t base, static int stm32_serial_setbrg(struct udevice *dev, int baudrate) { - struct stm32x7_serial_platdata *plat = dev_get_platdata(dev); + struct stm32x7_serial_plat *plat = dev_get_plat(dev); _stm32_serial_setbrg(plat->base, plat->uart_info, plat->clock_rate, baudrate); @@ -54,7 +54,7 @@ static int stm32_serial_setbrg(struct udevice *dev, int baudrate) static int stm32_serial_setconfig(struct udevice *dev, uint serial_config) { - struct stm32x7_serial_platdata *plat = dev_get_platdata(dev); + struct stm32x7_serial_plat *plat = dev_get_plat(dev); bool stm32f4 = plat->uart_info->stm32f4; u8 uart_enable_bit = plat->uart_info->uart_enable_bit; u32 cr1 = plat->base + CR1_OFFSET(stm32f4); @@ -102,7 +102,7 @@ static int stm32_serial_setconfig(struct udevice *dev, uint serial_config) static int stm32_serial_getc(struct udevice *dev) { - struct stm32x7_serial_platdata *plat = dev_get_platdata(dev); + struct stm32x7_serial_plat *plat = dev_get_plat(dev); bool stm32f4 = plat->uart_info->stm32f4; fdt_addr_t base = plat->base; u32 isr = readl(base + ISR_OFFSET(stm32f4)); @@ -139,14 +139,14 @@ static int _stm32_serial_putc(fdt_addr_t base, static int stm32_serial_putc(struct udevice *dev, const char c) { - struct stm32x7_serial_platdata *plat = dev_get_platdata(dev); + struct stm32x7_serial_plat *plat = dev_get_plat(dev); return _stm32_serial_putc(plat->base, plat->uart_info, c); } static int stm32_serial_pending(struct udevice *dev, bool input) { - struct stm32x7_serial_platdata *plat = dev_get_platdata(dev); + struct stm32x7_serial_plat *plat = dev_get_plat(dev); bool stm32f4 = plat->uart_info->stm32f4; fdt_addr_t base = plat->base; @@ -175,7 +175,7 @@ static void _stm32_serial_init(fdt_addr_t base, static int stm32_serial_probe(struct udevice *dev) { - struct stm32x7_serial_platdata *plat = dev_get_platdata(dev); + struct stm32x7_serial_plat *plat = dev_get_plat(dev); struct clk clk; struct reset_ctl reset; int ret; @@ -217,9 +217,9 @@ static const struct udevice_id stm32_serial_id[] = { {} }; -static int stm32_serial_ofdata_to_platdata(struct udevice *dev) +static int stm32_serial_of_to_plat(struct udevice *dev) { - struct stm32x7_serial_platdata *plat = dev_get_platdata(dev); + struct stm32x7_serial_plat *plat = dev_get_plat(dev); plat->base = dev_read_addr(dev); if (plat->base == FDT_ADDR_T_NONE) @@ -240,8 +240,8 @@ U_BOOT_DRIVER(serial_stm32) = { .name = "serial_stm32", .id = UCLASS_SERIAL, .of_match = of_match_ptr(stm32_serial_id), - .ofdata_to_platdata = of_match_ptr(stm32_serial_ofdata_to_platdata), - .platdata_auto_alloc_size = sizeof(struct stm32x7_serial_platdata), + .of_to_plat = of_match_ptr(stm32_serial_of_to_plat), + .plat_auto = sizeof(struct stm32x7_serial_plat), .ops = &stm32_serial_ops, .probe = stm32_serial_probe, #if !CONFIG_IS_ENABLED(OF_CONTROL) diff --git a/drivers/serial/serial_stm32.h b/drivers/serial/serial_stm32.h index 5737651..5bee68f 100644 --- a/drivers/serial/serial_stm32.h +++ b/drivers/serial/serial_stm32.h @@ -48,7 +48,7 @@ struct stm32_uart_info stm32h7_info = { }; /* Information about a serial port */ -struct stm32x7_serial_platdata { +struct stm32x7_serial_plat { fdt_addr_t base; /* address of registers in physical memory */ struct stm32_uart_info *uart_info; unsigned long int clock_rate; diff --git a/drivers/serial/serial_uniphier.c b/drivers/serial/serial_uniphier.c index a098028..27e4b92 100644 --- a/drivers/serial/serial_uniphier.c +++ b/drivers/serial/serial_uniphier.c @@ -172,6 +172,6 @@ U_BOOT_DRIVER(uniphier_serial) = { .id = UCLASS_SERIAL, .of_match = uniphier_uart_of_match, .probe = uniphier_serial_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_serial_priv), + .priv_auto = sizeof(struct uniphier_serial_priv), .ops = &uniphier_serial_ops, }; diff --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c index ba6504b..dbb7b22 100644 --- a/drivers/serial/serial_xen.c +++ b/drivers/serial/serial_xen.c @@ -172,7 +172,7 @@ U_BOOT_DRIVER(serial_xen) = { #if CONFIG_IS_ENABLED(OF_CONTROL) .of_match = xen_serial_ids, #endif - .priv_auto_alloc_size = sizeof(struct xen_uart_priv), + .priv_auto = sizeof(struct xen_uart_priv), .probe = xen_serial_probe, .ops = &xen_serial_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c index 236ab86..9780a44 100644 --- a/drivers/serial/serial_xuartlite.c +++ b/drivers/serial/serial_xuartlite.c @@ -32,7 +32,7 @@ struct uartlite { unsigned int control; }; -struct uartlite_platdata { +struct uartlite_plat { struct uartlite *regs; }; @@ -54,7 +54,7 @@ static void uart_out32(void __iomem *addr, u32 val) static int uartlite_serial_putc(struct udevice *dev, const char ch) { - struct uartlite_platdata *plat = dev_get_platdata(dev); + struct uartlite_plat *plat = dev_get_plat(dev); struct uartlite *regs = plat->regs; if (uart_in32(®s->status) & SR_TX_FIFO_FULL) @@ -67,7 +67,7 @@ static int uartlite_serial_putc(struct udevice *dev, const char ch) static int uartlite_serial_getc(struct udevice *dev) { - struct uartlite_platdata *plat = dev_get_platdata(dev); + struct uartlite_plat *plat = dev_get_plat(dev); struct uartlite *regs = plat->regs; if (!(uart_in32(®s->status) & SR_RX_FIFO_VALID_DATA)) @@ -78,7 +78,7 @@ static int uartlite_serial_getc(struct udevice *dev) static int uartlite_serial_pending(struct udevice *dev, bool input) { - struct uartlite_platdata *plat = dev_get_platdata(dev); + struct uartlite_plat *plat = dev_get_plat(dev); struct uartlite *regs = plat->regs; if (input) @@ -89,7 +89,7 @@ static int uartlite_serial_pending(struct udevice *dev, bool input) static int uartlite_serial_probe(struct udevice *dev) { - struct uartlite_platdata *plat = dev_get_platdata(dev); + struct uartlite_plat *plat = dev_get_plat(dev); struct uartlite *regs = plat->regs; int ret; @@ -106,9 +106,9 @@ static int uartlite_serial_probe(struct udevice *dev) return 0; } -static int uartlite_serial_ofdata_to_platdata(struct udevice *dev) +static int uartlite_serial_of_to_plat(struct udevice *dev) { - struct uartlite_platdata *plat = dev_get_platdata(dev); + struct uartlite_plat *plat = dev_get_plat(dev); plat->regs = dev_read_addr_ptr(dev); @@ -131,8 +131,8 @@ U_BOOT_DRIVER(serial_uartlite) = { .name = "serial_uartlite", .id = UCLASS_SERIAL, .of_match = uartlite_serial_ids, - .ofdata_to_platdata = uartlite_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct uartlite_platdata), + .of_to_plat = uartlite_serial_of_to_plat, + .plat_auto = sizeof(struct uartlite_plat), .probe = uartlite_serial_probe, .ops = &uartlite_serial_ops, }; @@ -148,7 +148,7 @@ static inline void _debug_uart_init(void) uart_out32(®s->control, 0); uart_out32(®s->control, ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX); - uart_in32(®s->status); + ret = uart_in32(®s->status); /* Endianness detection */ if ((ret & SR_TX_FIFO_EMPTY) != SR_TX_FIFO_EMPTY) { little_endian = true; diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index 0e71cad..2883e24 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -41,7 +41,7 @@ struct uart_zynq { u32 baud_rate_divider; /* 0x34 - Baud Rate Divider [7:0] */ }; -struct zynq_uart_platdata { +struct zynq_uart_plat { struct uart_zynq *regs; }; @@ -107,7 +107,7 @@ static int _uart_zynq_serial_putc(struct uart_zynq *regs, const char c) static int zynq_serial_setbrg(struct udevice *dev, int baudrate) { - struct zynq_uart_platdata *platdata = dev_get_platdata(dev); + struct zynq_uart_plat *plat = dev_get_plat(dev); unsigned long clock; int ret; @@ -132,15 +132,15 @@ static int zynq_serial_setbrg(struct udevice *dev, int baudrate) return ret; } - _uart_zynq_serial_setbrg(platdata->regs, clock, baudrate); + _uart_zynq_serial_setbrg(plat->regs, clock, baudrate); return 0; } static int zynq_serial_probe(struct udevice *dev) { - struct zynq_uart_platdata *platdata = dev_get_platdata(dev); - struct uart_zynq *regs = platdata->regs; + struct zynq_uart_plat *plat = dev_get_plat(dev); + struct uart_zynq *regs = plat->regs; u32 val; /* No need to reinitialize the UART if TX already enabled */ @@ -148,15 +148,15 @@ static int zynq_serial_probe(struct udevice *dev) if (val & ZYNQ_UART_CR_TX_EN) return 0; - _uart_zynq_serial_init(platdata->regs); + _uart_zynq_serial_init(plat->regs); return 0; } static int zynq_serial_getc(struct udevice *dev) { - struct zynq_uart_platdata *platdata = dev_get_platdata(dev); - struct uart_zynq *regs = platdata->regs; + struct zynq_uart_plat *plat = dev_get_plat(dev); + struct uart_zynq *regs = plat->regs; if (readl(®s->channel_sts) & ZYNQ_UART_SR_RXEMPTY) return -EAGAIN; @@ -166,15 +166,15 @@ static int zynq_serial_getc(struct udevice *dev) static int zynq_serial_putc(struct udevice *dev, const char ch) { - struct zynq_uart_platdata *platdata = dev_get_platdata(dev); + struct zynq_uart_plat *plat = dev_get_plat(dev); - return _uart_zynq_serial_putc(platdata->regs, ch); + return _uart_zynq_serial_putc(plat->regs, ch); } static int zynq_serial_pending(struct udevice *dev, bool input) { - struct zynq_uart_platdata *platdata = dev_get_platdata(dev); - struct uart_zynq *regs = platdata->regs; + struct zynq_uart_plat *plat = dev_get_plat(dev); + struct uart_zynq *regs = plat->regs; if (input) return !(readl(®s->channel_sts) & ZYNQ_UART_SR_RXEMPTY); @@ -182,13 +182,13 @@ static int zynq_serial_pending(struct udevice *dev, bool input) return !!(readl(®s->channel_sts) & ZYNQ_UART_SR_TXACTIVE); } -static int zynq_serial_ofdata_to_platdata(struct udevice *dev) +static int zynq_serial_of_to_plat(struct udevice *dev) { - struct zynq_uart_platdata *platdata = dev_get_platdata(dev); + struct zynq_uart_plat *plat = dev_get_plat(dev); - platdata->regs = (struct uart_zynq *)dev_read_addr(dev); - if (IS_ERR(platdata->regs)) - return PTR_ERR(platdata->regs); + plat->regs = (struct uart_zynq *)dev_read_addr(dev); + if (IS_ERR(plat->regs)) + return PTR_ERR(plat->regs); return 0; } @@ -211,8 +211,8 @@ U_BOOT_DRIVER(serial_zynq) = { .name = "serial_zynq", .id = UCLASS_SERIAL, .of_match = zynq_serial_ids, - .ofdata_to_platdata = zynq_serial_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct zynq_uart_platdata), + .of_to_plat = zynq_serial_of_to_plat, + .plat_auto = sizeof(struct zynq_uart_plat), .probe = zynq_serial_probe, .ops = &zynq_serial_ops, }; diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c index 9428540..ecc3278 100644 --- a/drivers/soc/soc_ti_k3.c +++ b/drivers/soc/soc_ti_k3.c @@ -22,7 +22,7 @@ #define JTAG_ID_PARTNO_SHIFT 12 #define JTAG_ID_PARTNO_MASK (0xffff << 12) -struct soc_ti_k3_platdata { +struct soc_ti_k3_plat { const char *family; const char *revision; }; @@ -74,7 +74,7 @@ static const char *get_rev_string(u32 idreg) static int soc_ti_k3_get_family(struct udevice *dev, char *buf, int size) { - struct soc_ti_k3_platdata *plat = dev_get_platdata(dev); + struct soc_ti_k3_plat *plat = dev_get_plat(dev); snprintf(buf, size, "%s", plat->family); @@ -83,7 +83,7 @@ static int soc_ti_k3_get_family(struct udevice *dev, char *buf, int size) static int soc_ti_k3_get_revision(struct udevice *dev, char *buf, int size) { - struct soc_ti_k3_platdata *plat = dev_get_platdata(dev); + struct soc_ti_k3_plat *plat = dev_get_plat(dev); snprintf(buf, size, "SR%s", plat->revision); @@ -97,7 +97,7 @@ static const struct soc_ops soc_ti_k3_ops = { int soc_ti_k3_probe(struct udevice *dev) { - struct soc_ti_k3_platdata *plat = dev_get_platdata(dev); + struct soc_ti_k3_plat *plat = dev_get_plat(dev); u32 idreg; void *idreg_addr; @@ -124,5 +124,5 @@ U_BOOT_DRIVER(soc_ti_k3) = { .ops = &soc_ti_k3_ops, .of_match = soc_ti_k3_ids, .probe = soc_ti_k3_probe, - .platdata_auto_alloc_size = sizeof(struct soc_ti_k3_platdata), + .plat_auto = sizeof(struct soc_ti_k3_plat), }; diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c index c48e9be..c5099ad 100644 --- a/drivers/soc/ti/k3-navss-ringacc.c +++ b/drivers/soc/ti/k3-navss-ringacc.c @@ -1130,5 +1130,5 @@ U_BOOT_DRIVER(k3_navss_ringacc) = { .id = UCLASS_MISC, .of_match = knav_ringacc_ids, .probe = k3_nav_ringacc_probe, - .priv_auto_alloc_size = sizeof(struct k3_nav_ringacc), + .priv_auto = sizeof(struct k3_nav_ringacc), }; diff --git a/drivers/sound/broadwell_i2s.c b/drivers/sound/broadwell_i2s.c index adb0b2b..7f754e6 100644 --- a/drivers/sound/broadwell_i2s.c +++ b/drivers/sound/broadwell_i2s.c @@ -304,5 +304,5 @@ U_BOOT_DRIVER(broadwell_i2s) = { .of_match = broadwell_i2s_ids, .probe = broadwell_i2s_probe, .ops = &broadwell_i2s_ops, - .priv_auto_alloc_size = sizeof(struct broadwell_i2s_priv), + .priv_auto = sizeof(struct broadwell_i2s_priv), }; diff --git a/drivers/sound/hda_codec.c b/drivers/sound/hda_codec.c index 4154d29..eb92830 100644 --- a/drivers/sound/hda_codec.c +++ b/drivers/sound/hda_codec.c @@ -539,7 +539,7 @@ U_BOOT_DRIVER(hda_codec) = { .name = "hda_codec", .id = UCLASS_SOUND, .ops = &hda_codec_ops, - .priv_auto_alloc_size = sizeof(struct hda_codec_priv), + .priv_auto = sizeof(struct hda_codec_priv), .probe = hda_codec_init, }; diff --git a/drivers/sound/i2s-uclass.c b/drivers/sound/i2s-uclass.c index b741e39..2639c86 100644 --- a/drivers/sound/i2s-uclass.c +++ b/drivers/sound/i2s-uclass.c @@ -21,5 +21,5 @@ int i2s_tx_data(struct udevice *dev, void *data, uint data_size) UCLASS_DRIVER(i2s) = { .id = UCLASS_I2S, .name = "i2s", - .per_device_auto_alloc_size = sizeof(struct i2s_uc_priv), + .per_device_auto = sizeof(struct i2s_uc_priv), }; diff --git a/drivers/sound/ivybridge_sound.c b/drivers/sound/ivybridge_sound.c index bc3c1e8..492a86c 100644 --- a/drivers/sound/ivybridge_sound.c +++ b/drivers/sound/ivybridge_sound.c @@ -22,7 +22,7 @@ static int bd82x6x_azalia_probe(struct udevice *dev) { - struct pci_child_platdata *plat; + struct pci_child_plat *plat; struct hda_codec_priv *priv; struct udevice *pch; u32 codec_mask; @@ -71,7 +71,7 @@ static int bd82x6x_azalia_probe(struct udevice *dev) dm_pci_clrset_config32(dev, 0xd0, 1U << 31, 0); /* Additional step on Panther Point */ - plat = dev_get_parent_platdata(dev); + plat = dev_get_parent_plat(dev); if (plat->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_HDA) dm_pci_clrset_config32(dev, 0xc4, 0, 1 << 17); @@ -135,5 +135,5 @@ U_BOOT_DRIVER(bd82x6x_azalia_drv) = { .of_match = bd82x6x_azalia_ids, .probe = bd82x6x_azalia_probe, .ops = &bd82x6x_azalia_ops, - .priv_auto_alloc_size = sizeof(struct hda_codec_priv), + .priv_auto = sizeof(struct hda_codec_priv), }; diff --git a/drivers/sound/max98088.c b/drivers/sound/max98088.c index 5b4c489..4bcb748 100644 --- a/drivers/sound/max98088.c +++ b/drivers/sound/max98088.c @@ -421,5 +421,5 @@ U_BOOT_DRIVER(max98088) = { .of_match = max98088_ids, .probe = max98088_probe, .ops = &max98088_ops, - .priv_auto_alloc_size = sizeof(struct maxim_priv), + .priv_auto = sizeof(struct maxim_priv), }; diff --git a/drivers/sound/max98090.c b/drivers/sound/max98090.c index d23955d..c77a732 100644 --- a/drivers/sound/max98090.c +++ b/drivers/sound/max98090.c @@ -368,5 +368,5 @@ U_BOOT_DRIVER(max98090) = { .of_match = max98090_ids, .probe = max98090_probe, .ops = &max98090_ops, - .priv_auto_alloc_size = sizeof(struct maxim_priv), + .priv_auto = sizeof(struct maxim_priv), }; diff --git a/drivers/sound/max98095.c b/drivers/sound/max98095.c index 5037f95..002dab4 100644 --- a/drivers/sound/max98095.c +++ b/drivers/sound/max98095.c @@ -462,5 +462,5 @@ U_BOOT_DRIVER(max98095) = { .of_match = max98095_ids, .probe = max98095_probe, .ops = &max98095_ops, - .priv_auto_alloc_size = sizeof(struct maxim_priv), + .priv_auto = sizeof(struct maxim_priv), }; diff --git a/drivers/sound/max98357a.c b/drivers/sound/max98357a.c index b3d27a3..a2088f0 100644 --- a/drivers/sound/max98357a.c +++ b/drivers/sound/max98357a.c @@ -25,7 +25,7 @@ struct max98357a_priv { struct gpio_desc sdmode_gpio; }; -static int max98357a_ofdata_to_platdata(struct udevice *dev) +static int max98357a_of_to_plat(struct udevice *dev) { struct max98357a_priv *priv = dev_get_priv(dev); int ret; @@ -155,7 +155,7 @@ U_BOOT_DRIVER(max98357a) = { .name = "max98357a", .id = UCLASS_AUDIO_CODEC, .of_match = max98357a_ids, - .ofdata_to_platdata = max98357a_ofdata_to_platdata, + .of_to_plat = max98357a_of_to_plat, .ops = &max98357a_ops, ACPI_OPS_PTR(&max98357a_acpi_ops) }; diff --git a/drivers/sound/rt5677.c b/drivers/sound/rt5677.c index 16aa9df..b655bb4 100644 --- a/drivers/sound/rt5677.c +++ b/drivers/sound/rt5677.c @@ -331,5 +331,5 @@ U_BOOT_DRIVER(rt5677_drv) = { .of_match = rt5677_ids, .ops = &rt5677_ops, .probe = rt5677_probe, - .priv_auto_alloc_size = sizeof(struct rt5677_priv), + .priv_auto = sizeof(struct rt5677_priv), }; diff --git a/drivers/sound/samsung-i2s.c b/drivers/sound/samsung-i2s.c index aa1d6bb..d3d75c0 100644 --- a/drivers/sound/samsung-i2s.c +++ b/drivers/sound/samsung-i2s.c @@ -385,7 +385,7 @@ static int samsung_i2s_probe(struct udevice *dev) return i2s_tx_init(priv); } -static int samsung_i2s_ofdata_to_platdata(struct udevice *dev) +static int samsung_i2s_of_to_plat(struct udevice *dev) { struct i2s_uc_priv *priv = dev_get_uclass_priv(dev); ulong base; @@ -451,6 +451,6 @@ U_BOOT_DRIVER(samsung_i2s) = { .id = UCLASS_I2S, .of_match = samsung_i2s_ids, .probe = samsung_i2s_probe, - .ofdata_to_platdata = samsung_i2s_ofdata_to_platdata, + .of_to_plat = samsung_i2s_of_to_plat, .ops = &samsung_i2s_ops, }; diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c index 0686add..4a2c87a 100644 --- a/drivers/sound/sandbox.c +++ b/drivers/sound/sandbox.c @@ -223,7 +223,7 @@ U_BOOT_DRIVER(sandbox_codec) = { .id = UCLASS_AUDIO_CODEC, .of_match = sandbox_codec_ids, .ops = &sandbox_codec_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_codec_priv), + .priv_auto = sizeof(struct sandbox_codec_priv), }; static const struct i2s_ops sandbox_i2s_ops = { @@ -241,7 +241,7 @@ U_BOOT_DRIVER(sandbox_i2s) = { .of_match = sandbox_i2s_ids, .ops = &sandbox_i2s_ops, .probe = sandbox_i2s_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_i2s_priv), + .priv_auto = sizeof(struct sandbox_i2s_priv), }; static const struct sound_ops sandbox_sound_ops = { @@ -262,6 +262,6 @@ U_BOOT_DRIVER(sandbox_sound) = { .id = UCLASS_SOUND, .of_match = sandbox_sound_ids, .ops = &sandbox_sound_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_sound_priv), + .priv_auto = sizeof(struct sandbox_sound_priv), .probe = sandbox_sound_probe, }; diff --git a/drivers/sound/sound-uclass.c b/drivers/sound/sound-uclass.c index 92f4b0b..0c71e01 100644 --- a/drivers/sound/sound-uclass.c +++ b/drivers/sound/sound-uclass.c @@ -172,5 +172,5 @@ int sound_find_codec_i2s(struct udevice *dev) UCLASS_DRIVER(sound) = { .id = UCLASS_SOUND, .name = "sound", - .per_device_auto_alloc_size = sizeof(struct sound_uc_priv), + .per_device_auto = sizeof(struct sound_uc_priv), }; diff --git a/drivers/sound/tegra_ahub.c b/drivers/sound/tegra_ahub.c index 26d4572..8708fc4 100644 --- a/drivers/sound/tegra_ahub.c +++ b/drivers/sound/tegra_ahub.c @@ -253,5 +253,5 @@ U_BOOT_DRIVER(tegra_ahub) = { .of_match = tegra_ahub_ids, .ops = &tegra_ahub_ops, .probe = tegra_ahub_probe, - .priv_auto_alloc_size = sizeof(struct tegra_ahub_priv), + .priv_auto = sizeof(struct tegra_ahub_priv), }; diff --git a/drivers/sound/wm8994.c b/drivers/sound/wm8994.c index 367e144..cb1e97d 100644 --- a/drivers/sound/wm8994.c +++ b/drivers/sound/wm8994.c @@ -873,5 +873,5 @@ U_BOOT_DRIVER(wm8994) = { .of_match = wm8994_ids, .probe = wm8994_probe, .ops = &wm8994_ops, - .priv_auto_alloc_size = sizeof(struct wm8994_priv), + .priv_auto = sizeof(struct wm8994_priv), }; diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c index 61372c5..fadc9f3 100644 --- a/drivers/spi/altera_spi.c +++ b/drivers/spi/altera_spi.c @@ -32,7 +32,7 @@ struct altera_spi_regs { u32 slave_sel; }; -struct altera_spi_platdata { +struct altera_spi_plat { struct altera_spi_regs *regs; }; @@ -89,7 +89,7 @@ static int altera_spi_xfer(struct udevice *dev, unsigned int bitlen, struct udevice *bus = dev->parent; struct altera_spi_priv *priv = dev_get_priv(bus); struct altera_spi_regs *const regs = priv->regs; - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); /* assume spi core configured to do 8 bit transfers */ unsigned int bytes = bitlen / 8; @@ -98,7 +98,7 @@ static int altera_spi_xfer(struct udevice *dev, unsigned int bitlen, uint32_t reg, data, start; debug("%s: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", __func__, - bus->seq, slave_plat->cs, bitlen, bytes, flags); + dev_seq(bus), slave_plat->cs, bitlen, bytes, flags); if (bitlen == 0) goto done; @@ -161,7 +161,7 @@ static int altera_spi_set_mode(struct udevice *bus, uint mode) static int altera_spi_probe(struct udevice *bus) { - struct altera_spi_platdata *plat = dev_get_platdata(bus); + struct altera_spi_plat *plat = dev_get_plat(bus); struct altera_spi_priv *priv = dev_get_priv(bus); priv->regs = plat->regs; @@ -169,9 +169,9 @@ static int altera_spi_probe(struct udevice *bus) return 0; } -static int altera_spi_ofdata_to_platdata(struct udevice *bus) +static int altera_spi_of_to_plat(struct udevice *bus) { - struct altera_spi_platdata *plat = dev_get_platdata(bus); + struct altera_spi_plat *plat = dev_get_plat(bus); plat->regs = map_physmem(dev_read_addr(bus), sizeof(struct altera_spi_regs), @@ -202,8 +202,8 @@ U_BOOT_DRIVER(altera_spi) = { .id = UCLASS_SPI, .of_match = altera_spi_ids, .ops = &altera_spi_ops, - .ofdata_to_platdata = altera_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct altera_spi_platdata), - .priv_auto_alloc_size = sizeof(struct altera_spi_priv), + .of_to_plat = altera_spi_of_to_plat, + .plat_auto = sizeof(struct altera_spi_plat), + .priv_auto = sizeof(struct altera_spi_priv), .probe = altera_spi_probe, }; diff --git a/drivers/spi/atcspi200_spi.c b/drivers/spi/atcspi200_spi.c index 39c6e22..0f05158 100644 --- a/drivers/spi/atcspi200_spi.c +++ b/drivers/spi/atcspi200_spi.c @@ -309,8 +309,8 @@ static int atcspi200_spi_set_mode(struct udevice *bus, uint mode) static int atcspi200_spi_claim_bus(struct udevice *dev) { - struct dm_spi_slave_platdata *slave_plat = - dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = + dev_get_parent_plat(dev); struct udevice *bus = dev->parent; struct nds_spi_slave *ns = dev_get_priv(bus); @@ -408,7 +408,7 @@ U_BOOT_DRIVER(atcspi200_spi) = { .id = UCLASS_SPI, .of_match = atcspi200_spi_ids, .ops = &atcspi200_spi_ops, - .ofdata_to_platdata = atcspi200_ofdata_to_platadata, - .priv_auto_alloc_size = sizeof(struct nds_spi_slave), + .of_to_plat = atcspi200_ofdata_to_platadata, + .priv_auto = sizeof(struct nds_spi_slave), .probe = atcspi200_spi_probe, }; diff --git a/drivers/spi/ath79_spi.c b/drivers/spi/ath79_spi.c index 70bedc7..205567e 100644 --- a/drivers/spi/ath79_spi.c +++ b/drivers/spi/ath79_spi.c @@ -59,7 +59,7 @@ static int ath79_spi_xfer(struct udevice *dev, unsigned int bitlen, { struct udevice *bus = dev_get_parent(dev); struct ath79_spi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave = dev_get_parent_plat(dev); u8 *rx = din; const u8 *tx = dout; u8 curbyte, curbitlen, restbits; @@ -224,6 +224,6 @@ U_BOOT_DRIVER(ath79_spi) = { .id = UCLASS_SPI, .of_match = ath79_spi_ids, .ops = &ath79_spi_ops, - .priv_auto_alloc_size = sizeof(struct ath79_spi_priv), + .priv_auto = sizeof(struct ath79_spi_priv), .probe = ath79_spi_probe, }; diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 9320a8b..b1a3aa9 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -624,6 +624,6 @@ U_BOOT_DRIVER(atmel_qspi) = { .id = UCLASS_SPI, .of_match = atmel_qspi_ids, .ops = &atmel_qspi_ops, - .priv_auto_alloc_size = sizeof(struct atmel_qspi), + .priv_auto = sizeof(struct atmel_qspi), .probe = atmel_qspi_probe, }; diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index c65733c..702e225 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c @@ -105,7 +105,7 @@ #define spi_writel(as, reg, value) \ writel(value, as->regs + ATMEL_SPI_##reg) -struct atmel_spi_platdata { +struct atmel_spi_plat { struct at91_spi *regs; }; @@ -121,9 +121,9 @@ struct atmel_spi_priv { static int atmel_spi_claim_bus(struct udevice *dev) { struct udevice *bus = dev_get_parent(dev); - struct atmel_spi_platdata *bus_plat = dev_get_platdata(bus); + struct atmel_spi_plat *bus_plat = dev_get_plat(bus); struct atmel_spi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); struct at91_spi *reg_base = bus_plat->regs; u32 cs = slave_plat->cs; u32 freq = priv->freq; @@ -161,7 +161,7 @@ static int atmel_spi_claim_bus(struct udevice *dev) static int atmel_spi_release_bus(struct udevice *dev) { struct udevice *bus = dev_get_parent(dev); - struct atmel_spi_platdata *bus_plat = dev_get_platdata(bus); + struct atmel_spi_plat *bus_plat = dev_get_plat(bus); writel(ATMEL_SPI_CR_SPIDIS, &bus_plat->regs->cr); @@ -173,7 +173,7 @@ static void atmel_spi_cs_activate(struct udevice *dev) #if CONFIG_IS_ENABLED(DM_GPIO) struct udevice *bus = dev_get_parent(dev); struct atmel_spi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); u32 cs = slave_plat->cs; if (!dm_gpio_is_valid(&priv->cs_gpios[cs])) @@ -188,7 +188,7 @@ static void atmel_spi_cs_deactivate(struct udevice *dev) #if CONFIG_IS_ENABLED(DM_GPIO) struct udevice *bus = dev_get_parent(dev); struct atmel_spi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); u32 cs = slave_plat->cs; if (!dm_gpio_is_valid(&priv->cs_gpios[cs])) @@ -202,7 +202,7 @@ static int atmel_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev_get_parent(dev); - struct atmel_spi_platdata *bus_plat = dev_get_platdata(bus); + struct atmel_spi_plat *bus_plat = dev_get_plat(bus); struct at91_spi *reg_base = bus_plat->regs; u32 len_tx, len_rx, len; @@ -344,7 +344,7 @@ static int atmel_spi_enable_clk(struct udevice *bus) static int atmel_spi_probe(struct udevice *bus) { - struct atmel_spi_platdata *bus_plat = dev_get_platdata(bus); + struct atmel_spi_plat *bus_plat = dev_get_plat(bus); int ret; ret = atmel_spi_enable_clk(bus); @@ -388,7 +388,7 @@ U_BOOT_DRIVER(atmel_spi) = { .id = UCLASS_SPI, .of_match = atmel_spi_ids, .ops = &atmel_spi_ops, - .platdata_auto_alloc_size = sizeof(struct atmel_spi_platdata), - .priv_auto_alloc_size = sizeof(struct atmel_spi_priv), + .plat_auto = sizeof(struct atmel_spi_plat), + .priv_auto = sizeof(struct atmel_spi_priv), .probe = atmel_spi_probe, }; diff --git a/drivers/spi/bcm63xx_hsspi.c b/drivers/spi/bcm63xx_hsspi.c index f30a8a4..85108df 100644 --- a/drivers/spi/bcm63xx_hsspi.c +++ b/drivers/spi/bcm63xx_hsspi.c @@ -140,7 +140,7 @@ static int bcm63xx_hsspi_set_speed(struct udevice *bus, uint speed) } static void bcm63xx_hsspi_activate_cs(struct bcm63xx_hsspi_priv *priv, - struct dm_spi_slave_platdata *plat) + struct dm_spi_slave_plat *plat) { uint32_t clr, set; @@ -217,7 +217,7 @@ static int bcm63xx_hsspi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct bcm63xx_hsspi_priv *priv = dev_get_priv(dev->parent); - struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); size_t data_bytes = bitlen / 8; size_t step_size = HSSPI_FIFO_SIZE; uint16_t opcode = 0; @@ -316,7 +316,7 @@ static const struct udevice_id bcm63xx_hsspi_ids[] = { static int bcm63xx_hsspi_child_pre_probe(struct udevice *dev) { struct bcm63xx_hsspi_priv *priv = dev_get_priv(dev->parent); - struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); /* check cs */ if (plat->cs >= priv->num_cs) { @@ -403,7 +403,7 @@ U_BOOT_DRIVER(bcm63xx_hsspi) = { .id = UCLASS_SPI, .of_match = bcm63xx_hsspi_ids, .ops = &bcm63xx_hsspi_ops, - .priv_auto_alloc_size = sizeof(struct bcm63xx_hsspi_priv), + .priv_auto = sizeof(struct bcm63xx_hsspi_priv), .child_pre_probe = bcm63xx_hsspi_child_pre_probe, .probe = bcm63xx_hsspi_probe, }; diff --git a/drivers/spi/bcm63xx_spi.c b/drivers/spi/bcm63xx_spi.c index acc1a49..dd5e62b 100644 --- a/drivers/spi/bcm63xx_spi.c +++ b/drivers/spi/bcm63xx_spi.c @@ -236,8 +236,8 @@ static int bcm63xx_spi_xfer(struct udevice *dev, unsigned int bitlen, } if (flags & SPI_XFER_END) { - struct dm_spi_slave_platdata *plat = - dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = + dev_get_parent_plat(dev); uint16_t val, cmd; int ret; @@ -351,7 +351,7 @@ static int bcm63xx_spi_child_pre_probe(struct udevice *dev) struct bcm63xx_spi_priv *priv = dev_get_priv(dev->parent); const unsigned long *regs = priv->regs; struct spi_slave *slave = dev_get_parent_priv(dev); - struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); /* check cs */ if (plat->cs >= priv->num_cs) { @@ -422,7 +422,7 @@ U_BOOT_DRIVER(bcm63xx_spi) = { .id = UCLASS_SPI, .of_match = bcm63xx_spi_ids, .ops = &bcm63xx_spi_ops, - .priv_auto_alloc_size = sizeof(struct bcm63xx_spi_priv), + .priv_auto = sizeof(struct bcm63xx_spi_priv), .child_pre_probe = bcm63xx_spi_child_pre_probe, .probe = bcm63xx_spi_probe, }; diff --git a/drivers/spi/bcmstb_spi.c b/drivers/spi/bcmstb_spi.c index fb1dc46..dc4fdac 100644 --- a/drivers/spi/bcmstb_spi.c +++ b/drivers/spi/bcmstb_spi.c @@ -76,7 +76,7 @@ enum bcmstb_base_type { BASE_LAST, }; -struct bcmstb_spi_platdata { +struct bcmstb_spi_plat { void *base[4]; }; @@ -94,9 +94,9 @@ struct bcmstb_spi_priv { void *saved_din_addr; }; -static int bcmstb_spi_ofdata_to_platdata(struct udevice *bus) +static int bcmstb_spi_of_to_plat(struct udevice *bus) { - struct bcmstb_spi_platdata *plat = dev_get_platdata(bus); + struct bcmstb_spi_plat *plat = dev_get_plat(bus); const void *fdt = gd->fdt_blob; int node = dev_of_offset(bus); int ret = 0; @@ -159,7 +159,7 @@ static void bcmstb_spi_clear_interrupt(void *base, u32 mask) static int bcmstb_spi_probe(struct udevice *bus) { - struct bcmstb_spi_platdata *plat = dev_get_platdata(bus); + struct bcmstb_spi_plat *plat = dev_get_plat(bus); struct bcmstb_spi_priv *priv = dev_get_priv(bus); priv->regs = plat->base[HIF_MSPI]; @@ -432,8 +432,8 @@ U_BOOT_DRIVER(bcmstb_spi) = { .id = UCLASS_SPI, .of_match = bcmstb_spi_id, .ops = &bcmstb_spi_ops, - .ofdata_to_platdata = bcmstb_spi_ofdata_to_platdata, + .of_to_plat = bcmstb_spi_of_to_plat, .probe = bcmstb_spi_probe, - .platdata_auto_alloc_size = sizeof(struct bcmstb_spi_platdata), - .priv_auto_alloc_size = sizeof(struct bcmstb_spi_priv), + .plat_auto = sizeof(struct bcmstb_spi_plat), + .priv_auto = sizeof(struct bcmstb_spi_priv), }; diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c index 1e85749..6798043 100644 --- a/drivers/spi/cadence_qspi.c +++ b/drivers/spi/cadence_qspi.c @@ -27,7 +27,7 @@ static int cadence_spi_write_speed(struct udevice *bus, uint hz) { - struct cadence_spi_platdata *plat = bus->platdata; + struct cadence_spi_plat *plat = dev_get_plat(bus); struct cadence_spi_priv *priv = dev_get_priv(bus); cadence_qspi_apb_config_baudrate_div(priv->regbase, @@ -130,7 +130,7 @@ static int spi_calibration(struct udevice *bus, uint hz) static int cadence_spi_set_speed(struct udevice *bus, uint hz) { - struct cadence_spi_platdata *plat = bus->platdata; + struct cadence_spi_plat *plat = dev_get_plat(bus); struct cadence_spi_priv *priv = dev_get_priv(bus); int err; @@ -165,7 +165,7 @@ static int cadence_spi_set_speed(struct udevice *bus, uint hz) static int cadence_spi_probe(struct udevice *bus) { - struct cadence_spi_platdata *plat = bus->platdata; + struct cadence_spi_plat *plat = dev_get_plat(bus); struct cadence_spi_priv *priv = dev_get_priv(bus); struct clk clk; int ret; @@ -212,7 +212,7 @@ static int cadence_spi_remove(struct udevice *dev) static int cadence_spi_set_mode(struct udevice *bus, uint mode) { - struct cadence_spi_platdata *plat = bus->platdata; + struct cadence_spi_plat *plat = dev_get_plat(bus); struct cadence_spi_priv *priv = dev_get_priv(bus); /* Disable QSPI */ @@ -235,7 +235,7 @@ static int cadence_spi_mem_exec_op(struct spi_slave *spi, const struct spi_mem_op *op) { struct udevice *bus = spi->dev->parent; - struct cadence_spi_platdata *plat = bus->platdata; + struct cadence_spi_plat *plat = dev_get_plat(bus); struct cadence_spi_priv *priv = dev_get_priv(bus); void *base = priv->regbase; int err = 0; @@ -282,9 +282,9 @@ static int cadence_spi_mem_exec_op(struct spi_slave *spi, return err; } -static int cadence_spi_ofdata_to_platdata(struct udevice *bus) +static int cadence_spi_of_to_plat(struct udevice *bus) { - struct cadence_spi_platdata *plat = bus->platdata; + struct cadence_spi_plat *plat = dev_get_plat(bus); ofnode subnode; plat->regbase = (void *)devfdt_get_addr_index(bus, 0); @@ -353,9 +353,9 @@ U_BOOT_DRIVER(cadence_spi) = { .id = UCLASS_SPI, .of_match = cadence_spi_ids, .ops = &cadence_spi_ops, - .ofdata_to_platdata = cadence_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata), - .priv_auto_alloc_size = sizeof(struct cadence_spi_priv), + .of_to_plat = cadence_spi_of_to_plat, + .plat_auto = sizeof(struct cadence_spi_plat), + .priv_auto = sizeof(struct cadence_spi_priv), .probe = cadence_spi_probe, .remove = cadence_spi_remove, .flags = DM_FLAG_OS_PREPARE, diff --git a/drivers/spi/cadence_qspi.h b/drivers/spi/cadence_qspi.h index ae459c7..64c5867 100644 --- a/drivers/spi/cadence_qspi.h +++ b/drivers/spi/cadence_qspi.h @@ -15,7 +15,7 @@ #define CQSPI_DECODER_MAX_CS 16 #define CQSPI_READ_CAPTURE_MAX_DELAY 16 -struct cadence_spi_platdata { +struct cadence_spi_plat { unsigned int ref_clk_hz; unsigned int max_hz; void *regbase; @@ -52,7 +52,7 @@ struct cadence_spi_priv { }; /* Functions call declaration */ -void cadence_qspi_apb_controller_init(struct cadence_spi_platdata *plat); +void cadence_qspi_apb_controller_init(struct cadence_spi_plat *plat); void cadence_qspi_apb_controller_enable(void *reg_base_addr); void cadence_qspi_apb_controller_disable(void *reg_base_addr); void cadence_qspi_apb_dac_mode_enable(void *reg_base); @@ -62,13 +62,13 @@ int cadence_qspi_apb_command_read(void *reg_base_addr, int cadence_qspi_apb_command_write(void *reg_base_addr, const struct spi_mem_op *op); -int cadence_qspi_apb_read_setup(struct cadence_spi_platdata *plat, +int cadence_qspi_apb_read_setup(struct cadence_spi_plat *plat, const struct spi_mem_op *op); -int cadence_qspi_apb_read_execute(struct cadence_spi_platdata *plat, +int cadence_qspi_apb_read_execute(struct cadence_spi_plat *plat, const struct spi_mem_op *op); -int cadence_qspi_apb_write_setup(struct cadence_spi_platdata *plat, +int cadence_qspi_apb_write_setup(struct cadence_spi_plat *plat, const struct spi_mem_op *op); -int cadence_qspi_apb_write_execute(struct cadence_spi_platdata *plat, +int cadence_qspi_apb_write_execute(struct cadence_spi_plat *plat, const struct spi_mem_op *op); void cadence_qspi_apb_chipselect(void *reg_base, diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c index f9675f7..b051f46 100644 --- a/drivers/spi/cadence_qspi_apb.c +++ b/drivers/spi/cadence_qspi_apb.c @@ -377,7 +377,7 @@ void cadence_qspi_apb_delay(void *reg_base, cadence_qspi_apb_controller_enable(reg_base); } -void cadence_qspi_apb_controller_init(struct cadence_spi_platdata *plat) +void cadence_qspi_apb_controller_init(struct cadence_spi_plat *plat) { unsigned reg; @@ -526,7 +526,7 @@ int cadence_qspi_apb_command_write(void *reg_base, const struct spi_mem_op *op) } /* Opcode + Address (3/4 bytes) + dummy bytes (0-4 bytes) */ -int cadence_qspi_apb_read_setup(struct cadence_spi_platdata *plat, +int cadence_qspi_apb_read_setup(struct cadence_spi_plat *plat, const struct spi_mem_op *op) { unsigned int reg; @@ -572,14 +572,14 @@ int cadence_qspi_apb_read_setup(struct cadence_spi_platdata *plat, return 0; } -static u32 cadence_qspi_get_rd_sram_level(struct cadence_spi_platdata *plat) +static u32 cadence_qspi_get_rd_sram_level(struct cadence_spi_plat *plat) { u32 reg = readl(plat->regbase + CQSPI_REG_SDRAMLEVEL); reg >>= CQSPI_REG_SDRAMLEVEL_RD_LSB; return reg & CQSPI_REG_SDRAMLEVEL_RD_MASK; } -static int cadence_qspi_wait_for_data(struct cadence_spi_platdata *plat) +static int cadence_qspi_wait_for_data(struct cadence_spi_plat *plat) { unsigned int timeout = 10000; u32 reg; @@ -595,7 +595,7 @@ static int cadence_qspi_wait_for_data(struct cadence_spi_platdata *plat) } static int -cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat, +cadence_qspi_apb_indirect_read_execute(struct cadence_spi_plat *plat, unsigned int n_rx, u8 *rxbuf) { unsigned int remaining = n_rx; @@ -657,7 +657,7 @@ failrd: return ret; } -int cadence_qspi_apb_read_execute(struct cadence_spi_platdata *plat, +int cadence_qspi_apb_read_execute(struct cadence_spi_plat *plat, const struct spi_mem_op *op) { u64 from = op->addr.val; @@ -678,7 +678,7 @@ int cadence_qspi_apb_read_execute(struct cadence_spi_platdata *plat, } /* Opcode + Address (3/4 bytes) */ -int cadence_qspi_apb_write_setup(struct cadence_spi_platdata *plat, +int cadence_qspi_apb_write_setup(struct cadence_spi_plat *plat, const struct spi_mem_op *op) { unsigned int reg; @@ -701,7 +701,7 @@ int cadence_qspi_apb_write_setup(struct cadence_spi_platdata *plat, } static int -cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, +cadence_qspi_apb_indirect_write_execute(struct cadence_spi_plat *plat, unsigned int n_tx, const u8 *txbuf) { unsigned int page_size = plat->page_size; @@ -774,7 +774,7 @@ failwr: return ret; } -int cadence_qspi_apb_write_execute(struct cadence_spi_platdata *plat, +int cadence_qspi_apb_write_execute(struct cadence_spi_plat *plat, const struct spi_mem_op *op) { u32 to = op->addr.val; diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c index 8fa6d35..298f350 100644 --- a/drivers/spi/cf_spi.c +++ b/drivers/spi/cf_spi.c @@ -114,8 +114,8 @@ static int coldfire_spi_claim_bus(struct udevice *dev) struct udevice *bus = dev->parent; struct coldfire_spi_priv *cfspi = dev_get_priv(bus); struct dspi *dspi = cfspi->regs; - struct dm_spi_slave_platdata *slave_plat = - dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = + dev_get_parent_plat(dev); if ((in_be32(&dspi->sr) & DSPI_SR_TXRXS) != DSPI_SR_TXRXS) return -1; @@ -133,8 +133,8 @@ static int coldfire_spi_release_bus(struct udevice *dev) struct udevice *bus = dev->parent; struct coldfire_spi_priv *cfspi = dev_get_priv(bus); struct dspi *dspi = cfspi->regs; - struct dm_spi_slave_platdata *slave_plat = - dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = + dev_get_parent_plat(dev); /* Clear FIFO */ clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF); @@ -150,7 +150,7 @@ static int coldfire_spi_xfer(struct udevice *dev, unsigned int bitlen, { struct udevice *bus = dev_get_parent(dev); struct coldfire_spi_priv *cfspi = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); u16 *spi_rd16 = NULL, *spi_wr16 = NULL; u8 *spi_rd = NULL, *spi_wr = NULL; static u32 ctrl; @@ -240,7 +240,7 @@ static int coldfire_spi_set_speed(struct udevice *bus, uint max_hz) cfspi->baudrate = max_hz; /* Read current setup */ - bus_setup = readl(&dspi->ctar[bus->seq]); + bus_setup = readl(&dspi->ctar[dev_seq(bus)]); tmp = (prescaler[3] * scaler[15]); /* Maximum and minimum baudrate it can handle */ @@ -294,7 +294,7 @@ static int coldfire_spi_set_speed(struct udevice *bus, uint max_hz) bus_setup &= ~(DSPI_CTAR_PBR(0x03) | DSPI_CTAR_BR(0x0f)); bus_setup |= (DSPI_CTAR_PBR(best_i) | DSPI_CTAR_BR(best_j)); - writel(bus_setup, &dspi->ctar[bus->seq]); + writel(bus_setup, &dspi->ctar[dev_seq(bus)]); return 0; } @@ -318,7 +318,7 @@ static int coldfire_spi_set_mode(struct udevice *bus, uint mode) if (cfspi->mode & SPI_MODE_MOD) { if ((cfspi->mode & SPI_MODE_XFER_SZ_MASK) == 0) bus_setup |= - readl(&dspi->ctar[bus->seq]) & MCF_FRM_SZ_16BIT; + readl(&dspi->ctar[dev_seq(bus)]) & MCF_FRM_SZ_16BIT; else bus_setup |= ((cfspi->mode & SPI_MODE_XFER_SZ_MASK) >> 1); @@ -329,21 +329,21 @@ static int coldfire_spi_set_mode(struct udevice *bus, uint mode) bus_setup |= (cfspi->mode & SPI_MODE_DLY_SCA_MASK) >> 4; } else { bus_setup |= - (readl(&dspi->ctar[bus->seq]) & MCF_CTAR_MODE_MASK); + (readl(&dspi->ctar[dev_seq(bus)]) & MCF_CTAR_MODE_MASK); } cfspi->charbit = - ((readl(&dspi->ctar[bus->seq]) & MCF_FRM_SZ_16BIT) == + ((readl(&dspi->ctar[dev_seq(bus)]) & MCF_FRM_SZ_16BIT) == MCF_FRM_SZ_16BIT) ? 16 : 8; - setbits_be32(&dspi->ctar[bus->seq], bus_setup); + setbits_be32(&dspi->ctar[dev_seq(bus)], bus_setup); return 0; } static int coldfire_spi_probe(struct udevice *bus) { - struct coldfire_spi_platdata *plat = dev_get_platdata(bus); + struct coldfire_spi_plat *plat = dev_get_plat(bus); struct coldfire_spi_priv *cfspi = dev_get_priv(bus); struct dspi *dspi = cfspi->regs; int i; @@ -384,10 +384,10 @@ static int coldfire_spi_probe(struct udevice *bus) } #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -static int coldfire_dspi_ofdata_to_platdata(struct udevice *bus) +static int coldfire_dspi_of_to_plat(struct udevice *bus) { fdt_addr_t addr; - struct coldfire_spi_platdata *plat = bus->platdata; + struct coldfire_spi_plat *plat = dev_get_plat(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); int *ctar, len; @@ -451,10 +451,10 @@ U_BOOT_DRIVER(coldfire_spi) = { .id = UCLASS_SPI, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = coldfire_spi_ids, - .ofdata_to_platdata = coldfire_dspi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct coldfire_spi_platdata), + .of_to_plat = coldfire_dspi_of_to_plat, + .plat_auto = sizeof(struct coldfire_spi_plat), #endif .probe = coldfire_spi_probe, .ops = &coldfire_spi_ops, - .priv_auto_alloc_size = sizeof(struct coldfire_spi_priv), + .priv_auto = sizeof(struct coldfire_spi_priv), }; diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c index a11433d..53a791e 100644 --- a/drivers/spi/davinci_spi.c +++ b/drivers/spi/davinci_spi.c @@ -333,8 +333,8 @@ static int davinci_spi_set_mode(struct udevice *bus, uint mode) static int davinci_spi_claim_bus(struct udevice *dev) { - struct dm_spi_slave_platdata *slave_plat = - dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = + dev_get_parent_plat(dev); struct udevice *bus = dev->parent; struct davinci_spi_slave *ds = dev_get_priv(bus); @@ -358,8 +358,8 @@ static int davinci_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { - struct dm_spi_slave_platdata *slave = - dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave = + dev_get_parent_plat(dev); struct udevice *bus = dev->parent; struct davinci_spi_slave *ds = dev_get_priv(bus); @@ -383,7 +383,7 @@ static const struct dm_spi_ops davinci_spi_ops = { static int davinci_spi_probe(struct udevice *bus) { struct davinci_spi_slave *ds = dev_get_priv(bus); - struct davinci_spi_platdata *plat = bus->platdata; + struct davinci_spi_plat *plat = dev_get_plat(bus); ds->regs = plat->regs; ds->num_cs = plat->num_cs; @@ -393,7 +393,7 @@ static int davinci_spi_probe(struct udevice *bus) #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) static int davinci_ofdata_to_platadata(struct udevice *bus) { - struct davinci_spi_platdata *plat = bus->platdata; + struct davinci_spi_plat *plat = dev_get_plat(bus); fdt_addr_t addr; addr = dev_read_addr(bus); @@ -419,10 +419,10 @@ U_BOOT_DRIVER(davinci_spi) = { .id = UCLASS_SPI, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = davinci_spi_ids, - .ofdata_to_platdata = davinci_ofdata_to_platadata, - .platdata_auto_alloc_size = sizeof(struct davinci_spi_platdata), + .of_to_plat = davinci_ofdata_to_platadata, + .plat_auto = sizeof(struct davinci_spi_plat), #endif .probe = davinci_spi_probe, .ops = &davinci_spi_ops, - .priv_auto_alloc_size = sizeof(struct davinci_spi_slave), + .priv_auto = sizeof(struct davinci_spi_slave), }; diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c index ce74ac0..7421211 100644 --- a/drivers/spi/designware_spi.c +++ b/drivers/spi/designware_spi.c @@ -113,7 +113,7 @@ #define RX_TIMEOUT 1000 /* timeout in ms */ -struct dw_spi_platdata { +struct dw_spi_plat { s32 frequency; /* Default clock frequency, -1 for none */ void __iomem *regs; }; @@ -228,9 +228,9 @@ static int request_gpio_cs(struct udevice *bus) return 0; } -static int dw_spi_ofdata_to_platdata(struct udevice *bus) +static int dw_spi_of_to_plat(struct udevice *bus) { - struct dw_spi_platdata *plat = bus->platdata; + struct dw_spi_plat *plat = dev_get_plat(bus); plat->regs = dev_read_addr_ptr(bus); if (!plat->regs) @@ -342,7 +342,7 @@ typedef int (*dw_spi_init_t)(struct udevice *bus, struct dw_spi_priv *priv); static int dw_spi_probe(struct udevice *bus) { dw_spi_init_t init = (dw_spi_init_t)dev_get_driver_data(bus); - struct dw_spi_platdata *plat = dev_get_platdata(bus); + struct dw_spi_plat *plat = dev_get_plat(bus); struct dw_spi_priv *priv = dev_get_priv(bus); int ret; u32 version; @@ -665,7 +665,7 @@ static const struct spi_controller_mem_ops dw_spi_mem_ops = { static int dw_spi_set_speed(struct udevice *bus, uint speed) { - struct dw_spi_platdata *plat = dev_get_platdata(bus); + struct dw_spi_plat *plat = dev_get_plat(bus); struct dw_spi_priv *priv = dev_get_priv(bus); u16 clk_div; @@ -774,9 +774,9 @@ U_BOOT_DRIVER(dw_spi) = { .id = UCLASS_SPI, .of_match = dw_spi_ids, .ops = &dw_spi_ops, - .ofdata_to_platdata = dw_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct dw_spi_platdata), - .priv_auto_alloc_size = sizeof(struct dw_spi_priv), + .of_to_plat = dw_spi_of_to_plat, + .plat_auto = sizeof(struct dw_spi_plat), + .priv_auto = sizeof(struct dw_spi_priv), .probe = dw_spi_probe, .remove = dw_spi_remove, }; diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c index d338ff5..30b1a77 100644 --- a/drivers/spi/exynos_spi.c +++ b/drivers/spi/exynos_spi.c @@ -23,7 +23,7 @@ DECLARE_GLOBAL_DATA_PTR; -struct exynos_spi_platdata { +struct exynos_spi_plat { enum periph_id periph_id; s32 frequency; /* Default clock frequency, -1 for none */ struct exynos_spi *regs; @@ -213,7 +213,7 @@ static int spi_rx_tx(struct exynos_spi_priv *priv, int todo, static void spi_cs_activate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct exynos_spi_platdata *pdata = dev_get_platdata(bus); + struct exynos_spi_plat *pdata = dev_get_plat(bus); struct exynos_spi_priv *priv = dev_get_priv(bus); /* If it's too soon to do another transaction, wait */ @@ -239,7 +239,7 @@ static void spi_cs_activate(struct udevice *dev) static void spi_cs_deactivate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct exynos_spi_platdata *pdata = dev_get_platdata(bus); + struct exynos_spi_plat *pdata = dev_get_plat(bus); struct exynos_spi_priv *priv = dev_get_priv(bus); setbits_le32(&priv->regs->cs_reg, SPI_SLAVE_SIG_INACT); @@ -251,9 +251,9 @@ static void spi_cs_deactivate(struct udevice *dev) debug("Deactivate CS, bus '%s'\n", bus->name); } -static int exynos_spi_ofdata_to_platdata(struct udevice *bus) +static int exynos_spi_of_to_plat(struct udevice *bus) { - struct exynos_spi_platdata *plat = bus->platdata; + struct exynos_spi_plat *plat = dev_get_plat(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); @@ -280,7 +280,7 @@ static int exynos_spi_ofdata_to_platdata(struct udevice *bus) static int exynos_spi_probe(struct udevice *bus) { - struct exynos_spi_platdata *plat = dev_get_platdata(bus); + struct exynos_spi_plat *plat = dev_get_plat(bus); struct exynos_spi_priv *priv = dev_get_priv(bus); priv->regs = plat->regs; @@ -368,7 +368,7 @@ static int exynos_spi_xfer(struct udevice *dev, unsigned int bitlen, static int exynos_spi_set_speed(struct udevice *bus, uint speed) { - struct exynos_spi_platdata *plat = bus->platdata; + struct exynos_spi_plat *plat = dev_get_plat(bus); struct exynos_spi_priv *priv = dev_get_priv(bus); int ret; @@ -426,8 +426,8 @@ U_BOOT_DRIVER(exynos_spi) = { .id = UCLASS_SPI, .of_match = exynos_spi_ids, .ops = &exynos_spi_ops, - .ofdata_to_platdata = exynos_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct exynos_spi_platdata), - .priv_auto_alloc_size = sizeof(struct exynos_spi_priv), + .of_to_plat = exynos_spi_of_to_plat, + .plat_auto = sizeof(struct exynos_spi_plat), + .priv_auto = sizeof(struct exynos_spi_priv), .probe = exynos_spi_probe, }; diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c index b22c9b3..c17a552 100644 --- a/drivers/spi/fsl_dspi.c +++ b/drivers/spi/fsl_dspi.c @@ -31,7 +31,7 @@ DECLARE_GLOBAL_DATA_PTR; -/* fsl_dspi_platdata flags */ +/* fsl_dspi_plat flags */ #define DSPI_FLAG_REGMAP_ENDIAN_BIG BIT(0) /* idle data value */ @@ -65,14 +65,14 @@ DECLARE_GLOBAL_DATA_PTR; DSPI_CTAR_DT(15)) /** - * struct fsl_dspi_platdata - platform data for Freescale DSPI + * struct fsl_dspi_plat - platform data for Freescale DSPI * * @flags: Flags for DSPI DSPI_FLAG_... * @speed_hz: Default SCK frequency * @num_chipselect: Number of DSPI chipselect signals * @regs_addr: Base address of DSPI registers */ -struct fsl_dspi_platdata { +struct fsl_dspi_plat { uint flags; uint speed_hz; uint num_chipselect; @@ -448,7 +448,7 @@ static int fsl_dspi_cfg_speed(struct fsl_dspi_priv *priv, uint speed) static int fsl_dspi_child_pre_probe(struct udevice *dev) { - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); struct fsl_dspi_priv *priv = dev_get_priv(dev->parent); u32 cs_sck_delay = 0, sck_cs_delay = 0; unsigned char pcssck = 0, cssck = 0; @@ -460,8 +460,10 @@ static int fsl_dspi_child_pre_probe(struct udevice *dev) return -EINVAL; } - ofnode_read_u32(dev->node, "fsl,spi-cs-sck-delay", &cs_sck_delay); - ofnode_read_u32(dev->node, "fsl,spi-sck-cs-delay", &sck_cs_delay); + ofnode_read_u32(dev_ofnode(dev), "fsl,spi-cs-sck-delay", + &cs_sck_delay); + ofnode_read_u32(dev_ofnode(dev), "fsl,spi-sck-cs-delay", + &sck_cs_delay); /* Set PCS to SCK delay scale values */ ns_delay_scale(&pcssck, &cssck, cs_sck_delay, priv->bus_clk); @@ -481,12 +483,12 @@ static int fsl_dspi_child_pre_probe(struct udevice *dev) static int fsl_dspi_probe(struct udevice *bus) { - struct fsl_dspi_platdata *plat = dev_get_platdata(bus); + struct fsl_dspi_plat *plat = dev_get_plat(bus); struct fsl_dspi_priv *priv = dev_get_priv(bus); struct dm_spi_bus *dm_spi_bus; uint mcr_cfg_val; - dm_spi_bus = bus->uclass_priv; + dm_spi_bus = dev_get_uclass_priv(bus); /* cpu speical pin muxing configure */ cpu_dspi_port_conf(); @@ -511,7 +513,7 @@ static int fsl_dspi_probe(struct udevice *bus) DSPI_MCR_CRXF | DSPI_MCR_CTXF; fsl_dspi_init_mcr(priv, mcr_cfg_val); - debug("%s probe done, bus-num %d.\n", bus->name, bus->seq); + debug("%s probe done, bus-num %d.\n", bus->name, dev_seq(bus)); return 0; } @@ -521,13 +523,13 @@ static int fsl_dspi_claim_bus(struct udevice *dev) uint sr_val; struct fsl_dspi_priv *priv; struct udevice *bus = dev->parent; - struct dm_spi_slave_platdata *slave_plat = - dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = + dev_get_parent_plat(dev); priv = dev_get_priv(bus); /* processor special preparation work */ - cpu_dspi_claim_bus(bus->seq, slave_plat->cs); + cpu_dspi_claim_bus(dev_seq(bus), slave_plat->cs); /* configure transfer mode */ fsl_dspi_cfg_ctar_mode(priv, slave_plat->cs, priv->mode); @@ -552,14 +554,14 @@ static int fsl_dspi_release_bus(struct udevice *dev) { struct udevice *bus = dev->parent; struct fsl_dspi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = - dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = + dev_get_parent_plat(dev); /* halt module */ dspi_halt(priv, 1); /* processor special release work */ - cpu_dspi_release_bus(bus->seq, slave_plat->cs); + cpu_dspi_release_bus(dev_seq(bus), slave_plat->cs); return 0; } @@ -569,14 +571,14 @@ static int fsl_dspi_release_bus(struct udevice *dev) */ static int fsl_dspi_bind(struct udevice *bus) { - debug("%s assigned req_seq %d.\n", bus->name, bus->req_seq); + debug("%s assigned seq %d.\n", bus->name, dev_seq(bus)); return 0; } -static int fsl_dspi_ofdata_to_platdata(struct udevice *bus) +static int fsl_dspi_of_to_plat(struct udevice *bus) { fdt_addr_t addr; - struct fsl_dspi_platdata *plat = bus->platdata; + struct fsl_dspi_plat *plat = dev_get_plat(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); @@ -608,7 +610,7 @@ static int fsl_dspi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct fsl_dspi_priv *priv; - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); struct udevice *bus; bus = dev->parent; @@ -659,9 +661,9 @@ U_BOOT_DRIVER(fsl_dspi) = { .id = UCLASS_SPI, .of_match = fsl_dspi_ids, .ops = &fsl_dspi_ops, - .ofdata_to_platdata = fsl_dspi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct fsl_dspi_platdata), - .priv_auto_alloc_size = sizeof(struct fsl_dspi_priv), + .of_to_plat = fsl_dspi_of_to_plat, + .plat_auto = sizeof(struct fsl_dspi_plat), + .priv_auto = sizeof(struct fsl_dspi_priv), .probe = fsl_dspi_probe, .child_pre_probe = fsl_dspi_child_pre_probe, .bind = fsl_dspi_bind, diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index 5c76fd9..abc28e3 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -508,7 +508,7 @@ static int fsl_espi_set_mode(struct udevice *bus, uint mode) static int fsl_espi_child_pre_probe(struct udevice *dev) { - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); struct udevice *bus = dev->parent; struct fsl_spi_slave *fsl = dev_get_priv(bus); @@ -520,14 +520,14 @@ static int fsl_espi_child_pre_probe(struct udevice *dev) static int fsl_espi_probe(struct udevice *bus) { - struct fsl_espi_platdata *plat = dev_get_platdata(bus); + struct fsl_espi_plat *plat = dev_get_plat(bus); struct fsl_spi_slave *fsl = dev_get_priv(bus); fsl->espi = (ccsr_espi_t *)((u32)plat->regs_addr); fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN; fsl->speed_hz = plat->speed_hz; - debug("%s probe done, bus-num %d.\n", bus->name, bus->seq); + debug("%s probe done, bus-num %d.\n", bus->name, dev_seq(bus)); return 0; } @@ -541,10 +541,10 @@ static const struct dm_spi_ops fsl_espi_ops = { }; #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -static int fsl_espi_ofdata_to_platdata(struct udevice *bus) +static int fsl_espi_of_to_plat(struct udevice *bus) { fdt_addr_t addr; - struct fsl_espi_platdata *plat = bus->platdata; + struct fsl_espi_plat *plat = dev_get_plat(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); @@ -573,11 +573,11 @@ U_BOOT_DRIVER(fsl_espi) = { .id = UCLASS_SPI, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = fsl_espi_ids, - .ofdata_to_platdata = fsl_espi_ofdata_to_platdata, + .of_to_plat = fsl_espi_of_to_plat, #endif .ops = &fsl_espi_ops, - .platdata_auto_alloc_size = sizeof(struct fsl_espi_platdata), - .priv_auto_alloc_size = sizeof(struct fsl_spi_slave), + .plat_auto = sizeof(struct fsl_espi_plat), + .priv_auto = sizeof(struct fsl_spi_slave), .probe = fsl_espi_probe, .child_pre_probe = fsl_espi_child_pre_probe, }; diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c index 128f958..8bc7038 100644 --- a/drivers/spi/fsl_qspi.c +++ b/drivers/spi/fsl_qspi.c @@ -515,8 +515,8 @@ static void fsl_qspi_invalidate(struct fsl_qspi *q) static void fsl_qspi_select_mem(struct fsl_qspi *q, struct spi_slave *slave) { - struct dm_spi_slave_platdata *plat = - dev_get_parent_platdata(slave->dev); + struct dm_spi_slave_plat *plat = + dev_get_parent_plat(slave->dev); if (q->selected == plat->cs) return; @@ -795,7 +795,7 @@ static const struct spi_controller_mem_ops fsl_qspi_mem_ops = { static int fsl_qspi_probe(struct udevice *bus) { - struct dm_spi_bus *dm_bus = bus->uclass_priv; + struct dm_spi_bus *dm_bus = dev_get_uclass_priv(bus); struct fsl_qspi *q = dev_get_priv(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); @@ -887,6 +887,6 @@ U_BOOT_DRIVER(fsl_qspi) = { .id = UCLASS_SPI, .of_match = fsl_qspi_ids, .ops = &fsl_qspi_ops, - .priv_auto_alloc_size = sizeof(struct fsl_qspi), + .priv_auto = sizeof(struct fsl_qspi), .probe = fsl_qspi_probe, }; diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c index a91cb78..1cd4104 100644 --- a/drivers/spi/ich.c +++ b/drivers/spi/ich.c @@ -38,17 +38,6 @@ #define debug_trace(x, args...) #endif -struct ich_spi_platdata { -#if CONFIG_IS_ENABLED(OF_PLATDATA) - struct dtd_intel_fast_spi dtplat; -#endif - enum ich_version ich_version; /* Controller version, 7 or 9 */ - bool lockdown; /* lock down controller settings? */ - ulong mmio_base; /* Base of MMIO registers */ - pci_dev_t bdf; /* PCI address used by of-platdata */ - bool hwseq; /* Use hardware sequencing (not s/w) */ -}; - static u8 ich_readb(struct ich_spi_priv *priv, int reg) { u8 value = readb(priv->base + reg); @@ -139,7 +128,7 @@ static bool ich9_can_do_33mhz(struct udevice *dev) return speed == 1; } -static void spi_lock_down(struct ich_spi_platdata *plat, void *sbase) +static void spi_lock_down(struct ich_spi_plat *plat, void *sbase) { if (plat->ich_version == ICHV_7) { struct ich7_spi_regs *ich7_spi = sbase; @@ -152,7 +141,7 @@ static void spi_lock_down(struct ich_spi_platdata *plat, void *sbase) } } -static bool spi_lock_status(struct ich_spi_platdata *plat, void *sbase) +static bool spi_lock_status(struct ich_spi_plat *plat, void *sbase) { int lock = 0; @@ -264,7 +253,7 @@ static int ich_spi_exec_op_swseq(struct spi_slave *slave, const struct spi_mem_op *op) { struct udevice *bus = dev_get_parent(slave->dev); - struct ich_spi_platdata *plat = dev_get_platdata(bus); + struct ich_spi_plat *plat = dev_get_plat(bus); struct ich_spi_priv *ctlr = dev_get_priv(bus); uint16_t control; int16_t opcode_index; @@ -602,7 +591,7 @@ static int ich_spi_exec_op_hwseq(struct spi_slave *slave, static int ich_spi_exec_op(struct spi_slave *slave, const struct spi_mem_op *op) { struct udevice *bus = dev_get_parent(slave->dev); - struct ich_spi_platdata *plat = dev_get_platdata(bus); + struct ich_spi_plat *plat = dev_get_plat(bus); int ret; bootstage_start(BOOTSTAGE_ID_ACCUM_SPI, "fast_spi"); @@ -667,7 +656,7 @@ static int ich_spi_get_basics(struct udevice *bus, bool can_probe, * 1. Using of-platdata, in which case we have the BDF and can access the * registers by reading the BAR * 2. Not using of-platdata, but still with a SPI controller that is on its own - * PCI PDF. In this case we read the BDF from the parent platdata and again get + * PCI PDF. In this case we read the BDF from the parent plat and again get * the registers by reading the BAR * 3. Using a SPI controller that is a child of the PCH, in which case we try * to find the registers by asking the PCH. This only works if the PCH has @@ -685,9 +674,9 @@ static int ich_get_mmap_bus(struct udevice *bus, ulong *map_basep, pci_dev_t spi_bdf; #if !CONFIG_IS_ENABLED(OF_PLATDATA) if (device_is_on_pci_bus(bus)) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; - pplat = dev_get_parent_platdata(bus); + pplat = dev_get_parent_plat(bus); spi_bdf = pplat->devfn; } else { enum ich_version ich_version; @@ -706,7 +695,7 @@ static int ich_get_mmap_bus(struct udevice *bus, ulong *map_basep, offsetp); } #else - struct ich_spi_platdata *plat = dev_get_platdata(bus); + struct ich_spi_plat *plat = dev_get_plat(bus); /* * We cannot rely on plat->bdf being set up yet since this method can @@ -758,7 +747,7 @@ static int ich_spi_adjust_size(struct spi_slave *slave, struct spi_mem_op *op) static int ich_protect_lockdown(struct udevice *dev) { - struct ich_spi_platdata *plat = dev_get_platdata(dev); + struct ich_spi_plat *plat = dev_get_plat(dev); struct ich_spi_priv *priv = dev_get_priv(dev); int ret = -ENOSYS; @@ -788,11 +777,11 @@ static int ich_protect_lockdown(struct udevice *dev) } static int ich_init_controller(struct udevice *dev, - struct ich_spi_platdata *plat, + struct ich_spi_plat *plat, struct ich_spi_priv *ctlr) { if (spl_phase() == PHASE_TPL) { - struct ich_spi_platdata *plat = dev_get_platdata(dev); + struct ich_spi_plat *plat = dev_get_plat(dev); int ret; ret = fast_spi_early_init(plat->bdf, plat->mmio_base); @@ -871,7 +860,7 @@ static int ich_cache_bios_region(struct udevice *dev) static int ich_spi_probe(struct udevice *dev) { - struct ich_spi_platdata *plat = dev_get_platdata(dev); + struct ich_spi_plat *plat = dev_get_plat(dev); struct ich_spi_priv *priv = dev_get_priv(dev); int ret; @@ -924,7 +913,7 @@ static int ich_spi_set_mode(struct udevice *bus, uint mode) static int ich_spi_child_pre_probe(struct udevice *dev) { struct udevice *bus = dev_get_parent(dev); - struct ich_spi_platdata *plat = dev_get_platdata(bus); + struct ich_spi_plat *plat = dev_get_plat(bus); struct ich_spi_priv *priv = dev_get_priv(bus); struct spi_slave *slave = dev_get_parent_priv(dev); @@ -945,9 +934,9 @@ static int ich_spi_child_pre_probe(struct udevice *dev) return 0; } -static int ich_spi_ofdata_to_platdata(struct udevice *dev) +static int ich_spi_of_to_plat(struct udevice *dev) { - struct ich_spi_platdata *plat = dev_get_platdata(dev); + struct ich_spi_plat *plat = dev_get_plat(dev); #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct ich_spi_priv *priv = dev_get_priv(dev); @@ -1004,9 +993,9 @@ U_BOOT_DRIVER(intel_fast_spi) = { .id = UCLASS_SPI, .of_match = ich_spi_ids, .ops = &ich_spi_ops, - .ofdata_to_platdata = ich_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct ich_spi_platdata), - .priv_auto_alloc_size = sizeof(struct ich_spi_priv), + .of_to_plat = ich_spi_of_to_plat, + .plat_auto = sizeof(struct ich_spi_plat), + .priv_auto = sizeof(struct ich_spi_priv), .child_pre_probe = ich_spi_child_pre_probe, .probe = ich_spi_probe, .remove = ich_spi_remove, diff --git a/drivers/spi/ich.h b/drivers/spi/ich.h index 23c7827..8fd150d 100644 --- a/drivers/spi/ich.h +++ b/drivers/spi/ich.h @@ -230,4 +230,15 @@ struct ich_spi_priv { struct udevice *pch; /* PCH, used to control SPI access */ }; +struct ich_spi_plat { +#if CONFIG_IS_ENABLED(OF_PLATDATA) + struct dtd_intel_fast_spi dtplat; +#endif + enum ich_version ich_version; /* Controller version, 7 or 9 */ + bool lockdown; /* lock down controller settings? */ + ulong mmio_base; /* Base of MMIO registers */ + pci_dev_t bdf; /* PCI address used by of-platdata */ + bool hwseq; /* Use hardware sequencing (not s/w) */ +}; + #endif /* _ICH_H_ */ diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c index dc7d2bc..43812da 100644 --- a/drivers/spi/kirkwood_spi.c +++ b/drivers/spi/kirkwood_spi.c @@ -23,7 +23,7 @@ struct mvebu_spi_dev { bool is_errata_50mhz_ac; }; -struct mvebu_spi_platdata { +struct mvebu_spi_plat { struct kwspi_registers *spireg; bool is_errata_50mhz_ac; }; @@ -109,7 +109,7 @@ static int _spi_xfer(struct kwspi_registers *reg, unsigned int bitlen, static int mvebu_spi_set_speed(struct udevice *bus, uint hz) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); struct kwspi_registers *reg = plat->spireg; u32 data; @@ -127,7 +127,7 @@ static int mvebu_spi_set_speed(struct udevice *bus, uint hz) static void mvebu_spi_50mhz_ac_timing_erratum(struct udevice *bus, uint mode) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); struct kwspi_registers *reg = plat->spireg; u32 data; @@ -160,7 +160,7 @@ static void mvebu_spi_50mhz_ac_timing_erratum(struct udevice *bus, uint mode) static int mvebu_spi_set_mode(struct udevice *bus, uint mode) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); struct kwspi_registers *reg = plat->spireg; u32 data = readl(®->cfg); @@ -185,7 +185,7 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev->parent; - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); return _spi_xfer(plat->spireg, bitlen, dout, din, flags); } @@ -198,7 +198,7 @@ __attribute__((weak)) int mvebu_board_spi_claim_bus(struct udevice *dev) static int mvebu_spi_claim_bus(struct udevice *dev) { struct udevice *bus = dev->parent; - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); /* Configure the chip-select in the CTRL register */ clrsetbits_le32(&plat->spireg->ctrl, @@ -220,7 +220,7 @@ static int mvebu_spi_release_bus(struct udevice *dev) static int mvebu_spi_probe(struct udevice *bus) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); struct kwspi_registers *reg = plat->spireg; writel(KWSPI_SMEMRDY, ®->ctrl); @@ -230,9 +230,9 @@ static int mvebu_spi_probe(struct udevice *bus) return 0; } -static int mvebu_spi_ofdata_to_platdata(struct udevice *bus) +static int mvebu_spi_of_to_plat(struct udevice *bus) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); const struct mvebu_spi_dev *drvdata = (struct mvebu_spi_dev *)dev_get_driver_data(bus); @@ -295,8 +295,8 @@ U_BOOT_DRIVER(mvebu_spi) = { .id = UCLASS_SPI, .of_match = mvebu_spi_ids, .ops = &mvebu_spi_ops, - .ofdata_to_platdata = mvebu_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct mvebu_spi_platdata), - .priv_auto_alloc_size = sizeof(struct mvebu_spi_priv), + .of_to_plat = mvebu_spi_of_to_plat, + .plat_auto = sizeof(struct mvebu_spi_plat), + .priv_auto = sizeof(struct mvebu_spi_priv), .probe = mvebu_spi_probe, }; diff --git a/drivers/spi/meson_spifc.c b/drivers/spi/meson_spifc.c index 2cdc018..d99a151 100644 --- a/drivers/spi/meson_spifc.c +++ b/drivers/spi/meson_spifc.c @@ -318,5 +318,5 @@ U_BOOT_DRIVER(meson_spifc) = { .of_match = meson_spifc_ids, .ops = &meson_spifc_ops, .probe = meson_spifc_probe, - .priv_auto_alloc_size = sizeof(struct meson_spifc_priv), + .priv_auto = sizeof(struct meson_spifc_priv), }; diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c index ec39c12..6869d60 100644 --- a/drivers/spi/mpc8xxx_spi.c +++ b/drivers/spi/mpc8xxx_spi.c @@ -48,7 +48,7 @@ struct mpc8xxx_priv { #define SPI_TIMEOUT 1000 -static int mpc8xxx_spi_ofdata_to_platdata(struct udevice *dev) +static int mpc8xxx_spi_of_to_plat(struct udevice *dev) { struct mpc8xxx_priv *priv = dev_get_priv(dev); struct clk clk; @@ -107,17 +107,17 @@ static int mpc8xxx_spi_probe(struct udevice *dev) static void mpc8xxx_spi_cs_activate(struct udevice *dev) { struct mpc8xxx_priv *priv = dev_get_priv(dev->parent); - struct dm_spi_slave_platdata *platdata = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); - dm_gpio_set_value(&priv->gpios[platdata->cs], 1); + dm_gpio_set_value(&priv->gpios[plat->cs], 1); } static void mpc8xxx_spi_cs_deactivate(struct udevice *dev) { struct mpc8xxx_priv *priv = dev_get_priv(dev->parent); - struct dm_spi_slave_platdata *platdata = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); - dm_gpio_set_value(&priv->gpios[platdata->cs], 0); + dm_gpio_set_value(&priv->gpios[plat->cs], 0); } static int mpc8xxx_spi_xfer(struct udevice *dev, uint bitlen, @@ -126,16 +126,16 @@ static int mpc8xxx_spi_xfer(struct udevice *dev, uint bitlen, struct udevice *bus = dev->parent; struct mpc8xxx_priv *priv = dev_get_priv(bus); spi8xxx_t *spi = priv->spi; - struct dm_spi_slave_platdata *platdata = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); u32 tmpdin = 0, tmpdout = 0, n; const u8 *cout = dout; u8 *cin = din; debug("%s: slave %s:%u dout %08X din %08X bitlen %u\n", __func__, - bus->name, platdata->cs, (uint)dout, (uint)din, bitlen); - if (platdata->cs >= priv->cs_count) { + bus->name, plat->cs, (uint)dout, (uint)din, bitlen); + if (plat->cs >= priv->cs_count) { dev_err(dev, "chip select index %d too large (cs_count=%d)\n", - platdata->cs, priv->cs_count); + plat->cs, priv->cs_count); return -EINVAL; } if (bitlen % 8) { @@ -279,7 +279,7 @@ U_BOOT_DRIVER(mpc8xxx_spi) = { .id = UCLASS_SPI, .of_match = mpc8xxx_spi_ids, .ops = &mpc8xxx_spi_ops, - .ofdata_to_platdata = mpc8xxx_spi_ofdata_to_platdata, + .of_to_plat = mpc8xxx_spi_of_to_plat, .probe = mpc8xxx_spi_probe, - .priv_auto_alloc_size = sizeof(struct mpc8xxx_priv), + .priv_auto = sizeof(struct mpc8xxx_priv), }; diff --git a/drivers/spi/mscc_bb_spi.c b/drivers/spi/mscc_bb_spi.c index e77447b..2a01ea0 100644 --- a/drivers/spi/mscc_bb_spi.c +++ b/drivers/spi/mscc_bb_spi.c @@ -117,7 +117,7 @@ int mscc_bb_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev_get_parent(dev); - struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); struct mscc_bb_priv *priv = dev_get_priv(bus); u32 i, count; const u8 *txd = dout; @@ -232,6 +232,6 @@ U_BOOT_DRIVER(mscc_bb) = { .id = UCLASS_SPI, .of_match = mscc_bb_ids, .ops = &mscc_bb_ops, - .priv_auto_alloc_size = sizeof(struct mscc_bb_priv), + .priv_auto = sizeof(struct mscc_bb_priv), .probe = mscc_bb_spi_probe, }; diff --git a/drivers/spi/mt7621_spi.c b/drivers/spi/mt7621_spi.c index 3a0738e..eb09317 100644 --- a/drivers/spi/mt7621_spi.c +++ b/drivers/spi/mt7621_spi.c @@ -304,6 +304,6 @@ U_BOOT_DRIVER(mt7621_spi) = { .id = UCLASS_SPI, .of_match = mt7621_spi_ids, .ops = &mt7621_spi_ops, - .priv_auto_alloc_size = sizeof(struct mt7621_spi), + .priv_auto = sizeof(struct mt7621_spi), .probe = mt7621_spi_probe, }; diff --git a/drivers/spi/mtk_snfi_spi.c b/drivers/spi/mtk_snfi_spi.c index c30c8f4..b6ab5fa 100644 --- a/drivers/spi/mtk_snfi_spi.c +++ b/drivers/spi/mtk_snfi_spi.c @@ -313,6 +313,6 @@ U_BOOT_DRIVER(mtk_snfi_spi) = { .id = UCLASS_SPI, .of_match = mtk_snfi_spi_ids, .ops = &mtk_snfi_spi_ops, - .priv_auto_alloc_size = sizeof(struct mtk_snfi_priv), + .priv_auto = sizeof(struct mtk_snfi_priv), .probe = mtk_snfi_spi_probe, }; diff --git a/drivers/spi/mvebu_a3700_spi.c b/drivers/spi/mvebu_a3700_spi.c index eb13cf3..c40d7d1 100644 --- a/drivers/spi/mvebu_a3700_spi.c +++ b/drivers/spi/mvebu_a3700_spi.c @@ -38,13 +38,13 @@ struct spi_reg { u32 din; /* 0x1060c */ }; -struct mvebu_spi_platdata { +struct mvebu_spi_plat { struct spi_reg *spireg; struct clk clk; struct gpio_desc cs_gpios[MAX_CS_COUNT]; }; -static void spi_cs_activate(struct mvebu_spi_platdata *plat, int cs) +static void spi_cs_activate(struct mvebu_spi_plat *plat, int cs) { if (CONFIG_IS_ENABLED(DM_GPIO) && dm_gpio_is_valid(&plat->cs_gpios[cs])) dm_gpio_set_value(&plat->cs_gpios[cs], 1); @@ -52,7 +52,7 @@ static void spi_cs_activate(struct mvebu_spi_platdata *plat, int cs) setbits_le32(&plat->spireg->ctrl, MVEBU_SPI_A3700_SPI_EN_0 << cs); } -static void spi_cs_deactivate(struct mvebu_spi_platdata *plat, int cs) +static void spi_cs_deactivate(struct mvebu_spi_plat *plat, int cs) { if (CONFIG_IS_ENABLED(DM_GPIO) && dm_gpio_is_valid(&plat->cs_gpios[cs])) dm_gpio_set_value(&plat->cs_gpios[cs], 0); @@ -146,7 +146,7 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev->parent; - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); struct spi_reg *reg = plat->spireg; unsigned int bytelen; int ret; @@ -186,7 +186,7 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen, static int mvebu_spi_set_speed(struct udevice *bus, uint hz) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); struct spi_reg *reg = plat->spireg; u32 data, prescale; @@ -207,7 +207,7 @@ static int mvebu_spi_set_speed(struct udevice *bus, uint hz) static int mvebu_spi_set_mode(struct udevice *bus, uint mode) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); struct spi_reg *reg = plat->spireg; /* @@ -229,7 +229,7 @@ static int mvebu_spi_set_mode(struct udevice *bus, uint mode) static int mvebu_spi_probe(struct udevice *bus) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); struct spi_reg *reg = plat->spireg; u32 data; int ret; @@ -279,9 +279,9 @@ static int mvebu_spi_probe(struct udevice *bus) return 0; } -static int mvebu_spi_ofdata_to_platdata(struct udevice *bus) +static int mvebu_spi_of_to_plat(struct udevice *bus) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); int ret; plat->spireg = dev_read_addr_ptr(bus); @@ -297,7 +297,7 @@ static int mvebu_spi_ofdata_to_platdata(struct udevice *bus) static int mvebu_spi_remove(struct udevice *bus) { - struct mvebu_spi_platdata *plat = dev_get_platdata(bus); + struct mvebu_spi_plat *plat = dev_get_plat(bus); clk_free(&plat->clk); @@ -324,8 +324,8 @@ U_BOOT_DRIVER(mvebu_spi) = { .id = UCLASS_SPI, .of_match = mvebu_spi_ids, .ops = &mvebu_spi_ops, - .ofdata_to_platdata = mvebu_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct mvebu_spi_platdata), + .of_to_plat = mvebu_spi_of_to_plat, + .plat_auto = sizeof(struct mvebu_spi_plat), .probe = mvebu_spi_probe, .remove = mvebu_spi_remove, }; diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index e90a06a..c5ffad8 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/mxc_spi.c @@ -69,7 +69,7 @@ static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs) { #if CONFIG_IS_ENABLED(DM_SPI) struct udevice *dev = mxcs->dev; - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); u32 cs = slave_plat->cs; @@ -87,7 +87,7 @@ static void mxc_spi_cs_deactivate(struct mxc_spi_slave *mxcs) { #if CONFIG_IS_ENABLED(DM_SPI) struct udevice *dev = mxcs->dev; - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); u32 cs = slave_plat->cs; @@ -512,7 +512,7 @@ void spi_release_bus(struct spi_slave *slave) static int mxc_spi_probe(struct udevice *bus) { - struct mxc_spi_slave *mxcs = dev_get_platdata(bus); + struct mxc_spi_slave *mxcs = dev_get_plat(bus); int node = dev_of_offset(bus); const void *blob = gd->fdt_blob; int ret; @@ -550,7 +550,7 @@ static int mxc_spi_probe(struct udevice *bus) static int mxc_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { - struct mxc_spi_slave *mxcs = dev_get_platdata(dev->parent); + struct mxc_spi_slave *mxcs = dev_get_plat(dev->parent); return mxc_spi_xfer_internal(mxcs, bitlen, dout, din, flags); @@ -558,8 +558,8 @@ static int mxc_spi_xfer(struct udevice *dev, unsigned int bitlen, static int mxc_spi_claim_bus(struct udevice *dev) { - struct mxc_spi_slave *mxcs = dev_get_platdata(dev->parent); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct mxc_spi_slave *mxcs = dev_get_plat(dev->parent); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); mxcs->dev = dev; @@ -579,7 +579,7 @@ static int mxc_spi_set_speed(struct udevice *bus, uint speed) static int mxc_spi_set_mode(struct udevice *bus, uint mode) { - struct mxc_spi_slave *mxcs = dev_get_platdata(bus); + struct mxc_spi_slave *mxcs = dev_get_plat(bus); mxcs->mode = mode; mxcs->ss_pol = (mode & SPI_CS_HIGH) ? 1 : 0; @@ -605,7 +605,7 @@ U_BOOT_DRIVER(mxc_spi) = { .id = UCLASS_SPI, .of_match = mxc_spi_ids, .ops = &mxc_spi_ops, - .platdata_auto_alloc_size = sizeof(struct mxc_spi_slave), + .plat_auto = sizeof(struct mxc_spi_slave), .probe = mxc_spi_probe, }; #endif diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c index fb0af02..d41352a 100644 --- a/drivers/spi/mxs_spi.c +++ b/drivers/spi/mxs_spi.c @@ -41,7 +41,7 @@ #define MXS_SSP_IMX23_CLKID_SSP0 33 #define MXS_SSP_IMX28_CLKID_SSP0 46 -struct mxs_spi_platdata { +struct mxs_spi_plat { #if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_fsl_imx23_spi dtplat; #endif @@ -311,7 +311,7 @@ int mxs_spi_xfer(struct udevice *dev, unsigned int bitlen, static int mxs_spi_probe(struct udevice *bus) { - struct mxs_spi_platdata *plat = dev_get_platdata(bus); + struct mxs_spi_plat *plat = dev_get_plat(bus); struct mxs_spi_priv *priv = dev_get_priv(bus); int ret; @@ -441,9 +441,9 @@ static const struct dm_spi_ops mxs_spi_ops = { }; #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -static int mxs_ofdata_to_platdata(struct udevice *bus) +static int mxs_of_to_plat(struct udevice *bus) { - struct mxs_spi_platdata *plat = bus->platdata; + struct mxs_spi_plat *plat = dev_get_plat(bus); u32 prop[2]; int ret; @@ -485,12 +485,12 @@ U_BOOT_DRIVER(fsl_imx23_spi) = { .id = UCLASS_SPI, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = mxs_spi_ids, - .ofdata_to_platdata = mxs_ofdata_to_platdata, + .of_to_plat = mxs_of_to_plat, #endif - .platdata_auto_alloc_size = sizeof(struct mxs_spi_platdata), + .plat_auto = sizeof(struct mxs_spi_plat), .ops = &mxs_spi_ops, - .priv_auto_alloc_size = sizeof(struct mxs_spi_priv), + .priv_auto = sizeof(struct mxs_spi_priv), .probe = mxs_spi_probe, }; -U_BOOT_DRIVER_ALIAS(fsl_imx23_spi, fsl_imx28_spi) +DM_DRIVER_ALIAS(fsl_imx23_spi, fsl_imx28_spi) diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c index 9661e9e..006dd04 100644 --- a/drivers/spi/nxp_fspi.c +++ b/drivers/spi/nxp_fspi.c @@ -887,7 +887,7 @@ static int nxp_fspi_claim_bus(struct udevice *dev) { struct nxp_fspi *f; struct udevice *bus; - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); bus = dev->parent; f = dev_get_priv(bus); @@ -922,7 +922,7 @@ static int nxp_fspi_set_mode(struct udevice *bus, uint mode) return 0; } -static int nxp_fspi_ofdata_to_platdata(struct udevice *bus) +static int nxp_fspi_of_to_plat(struct udevice *bus) { struct nxp_fspi *f = dev_get_priv(bus); #if CONFIG_IS_ENABLED(CLK) @@ -993,7 +993,7 @@ U_BOOT_DRIVER(nxp_fspi) = { .id = UCLASS_SPI, .of_match = nxp_fspi_ids, .ops = &nxp_fspi_ops, - .ofdata_to_platdata = nxp_fspi_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct nxp_fspi), + .of_to_plat = nxp_fspi_of_to_plat, + .priv_auto = sizeof(struct nxp_fspi), .probe = nxp_fspi_probe, }; diff --git a/drivers/spi/octeon_spi.c b/drivers/spi/octeon_spi.c index 7e88e55..6ac66d2 100644 --- a/drivers/spi/octeon_spi.c +++ b/drivers/spi/octeon_spi.c @@ -81,7 +81,7 @@ struct octeon_spi { static u64 octeon_spi_set_mpicfg(struct udevice *dev) { - struct dm_spi_slave_platdata *slave = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave = dev_get_parent_plat(dev); struct udevice *bus = dev_get_parent(dev); struct octeon_spi *priv = dev_get_priv(bus); u64 mpi_cfg; @@ -593,7 +593,7 @@ static int octeon_spi_probe(struct udevice *dev) if (ret) return ret; - debug("SPI bus %s %d at %p\n", dev->name, dev->seq, priv->base); + debug("SPI bus %s %d at %p\n", dev->name, dev_seq(dev), priv->base); return 0; } @@ -611,6 +611,6 @@ U_BOOT_DRIVER(octeon_spi) = { .id = UCLASS_SPI, .of_match = octeon_spi_ids, .probe = octeon_spi_probe, - .priv_auto_alloc_size = sizeof(struct octeon_spi), + .priv_auto = sizeof(struct octeon_spi), .ops = &octeon_spi_ops, }; diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c index 56cb217..78e2a25 100644 --- a/drivers/spi/omap3_spi.c +++ b/drivers/spi/omap3_spi.c @@ -378,7 +378,7 @@ static int omap3_spi_claim_bus(struct udevice *dev) { struct udevice *bus = dev->parent; struct omap3_spi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); priv->cs = slave_plat->cs; priv->freq = slave_plat->max_hz; @@ -402,7 +402,7 @@ static int omap3_spi_set_wordlen(struct udevice *dev, unsigned int wordlen) { struct udevice *bus = dev->parent; struct omap3_spi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); priv->cs = slave_plat->cs; priv->wordlen = wordlen; @@ -414,7 +414,7 @@ static int omap3_spi_set_wordlen(struct udevice *dev, unsigned int wordlen) static int omap3_spi_probe(struct udevice *dev) { struct omap3_spi_priv *priv = dev_get_priv(dev); - struct omap3_spi_plat *plat = dev_get_platdata(dev); + struct omap3_spi_plat *plat = dev_get_plat(dev); priv->regs = plat->regs; priv->pin_dir = plat->pin_dir; @@ -478,11 +478,11 @@ static struct omap2_mcspi_platform_config omap4_pdata = { .regs_offset = OMAP4_MCSPI_REG_OFFSET, }; -static int omap3_spi_ofdata_to_platdata(struct udevice *dev) +static int omap3_spi_of_to_plat(struct udevice *dev) { struct omap2_mcspi_platform_config *data = (struct omap2_mcspi_platform_config *)dev_get_driver_data(dev); - struct omap3_spi_plat *plat = dev_get_platdata(dev); + struct omap3_spi_plat *plat = dev_get_plat(dev); plat->regs = (struct mcspi *)(dev_read_addr(dev) + data->regs_offset); @@ -506,10 +506,10 @@ U_BOOT_DRIVER(omap3_spi) = { .flags = DM_FLAG_PRE_RELOC, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = omap3_spi_ids, - .ofdata_to_platdata = omap3_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct omap3_spi_plat), + .of_to_plat = omap3_spi_of_to_plat, + .plat_auto = sizeof(struct omap3_spi_plat), #endif .probe = omap3_spi_probe, .ops = &omap3_spi_ops, - .priv_auto_alloc_size = sizeof(struct omap3_spi_priv), + .priv_auto = sizeof(struct omap3_spi_priv), }; diff --git a/drivers/spi/pic32_spi.c b/drivers/spi/pic32_spi.c index 52e9eff..34d7d3e 100644 --- a/drivers/spi/pic32_spi.c +++ b/drivers/spi/pic32_spi.c @@ -236,7 +236,7 @@ static int pic32_spi_xfer(struct udevice *slave, unsigned int bitlen, const void *tx_buf, void *rx_buf, unsigned long flags) { - struct dm_spi_slave_platdata *slave_plat; + struct dm_spi_slave_plat *slave_plat; struct udevice *bus = slave->parent; struct pic32_spi_priv *priv; int len = bitlen / 8; @@ -244,10 +244,10 @@ static int pic32_spi_xfer(struct udevice *slave, unsigned int bitlen, ulong tbase; priv = dev_get_priv(bus); - slave_plat = dev_get_parent_platdata(slave); + slave_plat = dev_get_parent_plat(slave); debug("spi_xfer: bus:%i cs:%i flags:%lx\n", - bus->seq, slave_plat->cs, flags); + dev_seq(bus), slave_plat->cs, flags); debug("msg tx %p, rx %p submitted of %d byte(s)\n", tx_buf, rx_buf, len); @@ -384,7 +384,7 @@ static int pic32_spi_probe(struct udevice *bus) fdt_size_t size; int ret; - debug("%s: %d, bus: %i\n", __func__, __LINE__, bus->seq); + debug("%s: %d, bus: %i\n", __func__, __LINE__, dev_seq(bus)); addr = fdtdec_get_addr_size(gd->fdt_blob, node, "reg", &size); if (addr == FDT_ADDR_T_NONE) return -EINVAL; @@ -444,6 +444,6 @@ U_BOOT_DRIVER(pic32_spi) = { .id = UCLASS_SPI, .of_match = pic32_spi_ids, .ops = &pic32_spi_ops, - .priv_auto_alloc_size = sizeof(struct pic32_spi_priv), + .priv_auto = sizeof(struct pic32_spi_priv), .probe = pic32_spi_probe, }; diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c index 32bb8c8..133363e 100644 --- a/drivers/spi/pl022_spi.c +++ b/drivers/spi/pl022_spi.c @@ -89,7 +89,7 @@ static int pl022_is_supported(struct pl022_spi_slave *ps) static int pl022_spi_probe(struct udevice *bus) { - struct pl022_spi_pdata *plat = dev_get_platdata(bus); + struct pl022_spi_pdata *plat = dev_get_plat(bus); struct pl022_spi_slave *ps = dev_get_priv(bus); ps->base = ioremap(plat->addr, plat->size); @@ -286,9 +286,9 @@ static const struct dm_spi_ops pl022_spi_ops = { }; #if !CONFIG_IS_ENABLED(OF_PLATDATA) -static int pl022_spi_ofdata_to_platdata(struct udevice *bus) +static int pl022_spi_of_to_plat(struct udevice *bus) { - struct pl022_spi_pdata *plat = bus->platdata; + struct pl022_spi_pdata *plat = dev_get_plat(bus); const void *fdt = gd->fdt_blob; int node = dev_of_offset(bus); struct clk clkdev; @@ -316,10 +316,10 @@ U_BOOT_DRIVER(pl022_spi) = { .id = UCLASS_SPI, #if !CONFIG_IS_ENABLED(OF_PLATDATA) .of_match = pl022_spi_ids, - .ofdata_to_platdata = pl022_spi_ofdata_to_platdata, + .of_to_plat = pl022_spi_of_to_plat, #endif .ops = &pl022_spi_ops, - .platdata_auto_alloc_size = sizeof(struct pl022_spi_pdata), - .priv_auto_alloc_size = sizeof(struct pl022_spi_slave), + .plat_auto = sizeof(struct pl022_spi_pdata), + .priv_auto = sizeof(struct pl022_spi_slave), .probe = pl022_spi_probe, }; diff --git a/drivers/spi/renesas_rpc_spi.c b/drivers/spi/renesas_rpc_spi.c index d0ff918..1057651 100644 --- a/drivers/spi/renesas_rpc_spi.c +++ b/drivers/spi/renesas_rpc_spi.c @@ -156,7 +156,7 @@ DECLARE_GLOBAL_DATA_PTR; -struct rpc_spi_platdata { +struct rpc_spi_plat { fdt_addr_t regs; fdt_addr_t extr; s32 freq; /* Default clock freq, -1 for none */ @@ -406,7 +406,7 @@ static int rpc_spi_bind(struct udevice *parent) static int rpc_spi_probe(struct udevice *dev) { - struct rpc_spi_platdata *plat = dev_get_platdata(dev); + struct rpc_spi_plat *plat = dev_get_plat(dev); struct rpc_spi_priv *priv = dev_get_priv(dev); priv->regs = plat->regs; @@ -417,9 +417,9 @@ static int rpc_spi_probe(struct udevice *dev) return 0; } -static int rpc_spi_ofdata_to_platdata(struct udevice *bus) +static int rpc_spi_of_to_plat(struct udevice *bus) { - struct rpc_spi_platdata *plat = dev_get_platdata(bus); + struct rpc_spi_plat *plat = dev_get_plat(bus); plat->regs = dev_read_addr_index(bus, 0); plat->extr = dev_read_addr_index(bus, 1); @@ -463,9 +463,9 @@ U_BOOT_DRIVER(rpc_spi) = { .id = UCLASS_SPI, .of_match = rpc_spi_ids, .ops = &rpc_spi_ops, - .ofdata_to_platdata = rpc_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct rpc_spi_platdata), - .priv_auto_alloc_size = sizeof(struct rpc_spi_priv), + .of_to_plat = rpc_spi_of_to_plat, + .plat_auto = sizeof(struct rpc_spi_plat), + .priv_auto = sizeof(struct rpc_spi_priv), .bind = rpc_spi_bind, .probe = rpc_spi_probe, }; diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index c5363c2..40bd885 100644 --- a/drivers/spi/rk_spi.c +++ b/drivers/spi/rk_spi.c @@ -40,7 +40,7 @@ struct rockchip_spi_params { bool master_manages_fifo; }; -struct rockchip_spi_platdata { +struct rockchip_spi_plat { #if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_rockchip_rk3288_spi of_plat; #endif @@ -135,7 +135,7 @@ static int rkspi_wait_till_not_busy(struct rockchip_spi *regs) static void spi_cs_activate(struct udevice *dev, uint cs) { struct udevice *bus = dev->parent; - struct rockchip_spi_platdata *plat = bus->platdata; + struct rockchip_spi_plat *plat = dev_get_plat(bus); struct rockchip_spi_priv *priv = dev_get_priv(bus); struct rockchip_spi *regs = priv->regs; @@ -161,7 +161,7 @@ static void spi_cs_activate(struct udevice *dev, uint cs) static void spi_cs_deactivate(struct udevice *dev, uint cs) { struct udevice *bus = dev->parent; - struct rockchip_spi_platdata *plat = bus->platdata; + struct rockchip_spi_plat *plat = dev_get_plat(bus); struct rockchip_spi_priv *priv = dev_get_priv(bus); struct rockchip_spi *regs = priv->regs; @@ -174,9 +174,9 @@ static void spi_cs_deactivate(struct udevice *dev, uint cs) } #if CONFIG_IS_ENABLED(OF_PLATDATA) -static int conv_of_platdata(struct udevice *dev) +static int conv_of_plat(struct udevice *dev) { - struct rockchip_spi_platdata *plat = dev->platdata; + struct rockchip_spi_plat *plat = dev_get_plat(dev); struct dtd_rockchip_rk3288_spi *dtplat = &plat->of_plat; struct rockchip_spi_priv *priv = dev_get_priv(dev); int ret; @@ -186,16 +186,15 @@ static int conv_of_platdata(struct udevice *dev) ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->clk); if (ret < 0) return ret; - dev->req_seq = 0; return 0; } #endif -static int rockchip_spi_ofdata_to_platdata(struct udevice *bus) +static int rockchip_spi_of_to_plat(struct udevice *bus) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) - struct rockchip_spi_platdata *plat = dev_get_platdata(bus); + struct rockchip_spi_plat *plat = dev_get_plat(bus); struct rockchip_spi_priv *priv = dev_get_priv(bus); int ret; @@ -253,13 +252,13 @@ static int rockchip_spi_calc_modclk(ulong max_freq) static int rockchip_spi_probe(struct udevice *bus) { - struct rockchip_spi_platdata *plat = dev_get_platdata(bus); + struct rockchip_spi_plat *plat = dev_get_plat(bus); struct rockchip_spi_priv *priv = dev_get_priv(bus); int ret; debug("%s: probe\n", __func__); #if CONFIG_IS_ENABLED(OF_PLATDATA) - ret = conv_of_platdata(bus); + ret = conv_of_plat(bus); if (ret) return ret; #endif @@ -432,7 +431,7 @@ static int rockchip_spi_xfer(struct udevice *dev, unsigned int bitlen, struct udevice *bus = dev->parent; struct rockchip_spi_priv *priv = dev_get_priv(bus); struct rockchip_spi *regs = priv->regs; - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); int len = bitlen >> 3; const u8 *out = dout; u8 *in = din; @@ -560,10 +559,10 @@ U_BOOT_DRIVER(rockchip_rk3288_spi) = { .id = UCLASS_SPI, .of_match = rockchip_spi_ids, .ops = &rockchip_spi_ops, - .ofdata_to_platdata = rockchip_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct rockchip_spi_platdata), - .priv_auto_alloc_size = sizeof(struct rockchip_spi_priv), + .of_to_plat = rockchip_spi_of_to_plat, + .plat_auto = sizeof(struct rockchip_spi_plat), + .priv_auto = sizeof(struct rockchip_spi_priv), .probe = rockchip_spi_probe, }; -U_BOOT_DRIVER_ALIAS(rockchip_rk3288_spi, rockchip_rk3368_spi) +DM_DRIVER_ALIAS(rockchip_rk3288_spi, rockchip_rk3368_spi) diff --git a/drivers/spi/sandbox_spi.c b/drivers/spi/sandbox_spi.c index 755f176..0564d8b 100644 --- a/drivers/spi/sandbox_spi.c +++ b/drivers/spi/sandbox_spi.c @@ -28,21 +28,22 @@ # define CONFIG_SPI_IDLE_VAL 0xFF #endif -const char *sandbox_spi_parse_spec(const char *arg, unsigned long *bus, - unsigned long *cs) -{ - char *endp; - - *bus = simple_strtoul(arg, &endp, 0); - if (*endp != ':' || *bus >= CONFIG_SANDBOX_SPI_MAX_BUS) - return NULL; - - *cs = simple_strtoul(endp + 1, &endp, 0); - if (*endp != ':' || *cs >= CONFIG_SANDBOX_SPI_MAX_CS) - return NULL; - - return endp + 1; -} +/** + * struct sandbox_spi_priv - Sandbox SPI private data + * + * Helper struct to keep track of the sandbox SPI bus internal state. It is + * used in unit tests to verify that dm spi functions update the bus + * speed/mode properly (for instance, when jumping back and forth between spi + * slaves claiming the bus, we need to make sure that the bus speed is updated + * accordingly for each slave). + * + * @speed: Current bus speed. + * @mode: Current bus mode. + */ +struct sandbox_spi_priv { + uint speed; + uint mode; +}; __weak int sandbox_spi_get_emul(struct sandbox_state *state, struct udevice *bus, struct udevice *slave, @@ -51,6 +52,20 @@ __weak int sandbox_spi_get_emul(struct sandbox_state *state, return -ENOENT; } +uint sandbox_spi_get_speed(struct udevice *dev) +{ + struct sandbox_spi_priv *priv = dev_get_priv(dev); + + return priv->speed; +} + +uint sandbox_spi_get_mode(struct udevice *dev) +{ + struct sandbox_spi_priv *priv = dev_get_priv(dev); + + return priv->mode; +} + static int sandbox_spi_xfer(struct udevice *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { @@ -72,7 +87,7 @@ static int sandbox_spi_xfer(struct udevice *slave, unsigned int bitlen, return -EINVAL; } - busnum = bus->seq; + busnum = dev_seq(bus); cs = spi_chip_select(slave); if (busnum >= CONFIG_SANDBOX_SPI_MAX_BUS || cs >= CONFIG_SANDBOX_SPI_MAX_CS) { @@ -106,19 +121,27 @@ static int sandbox_spi_xfer(struct udevice *slave, unsigned int bitlen, static int sandbox_spi_set_speed(struct udevice *bus, uint speed) { + struct sandbox_spi_priv *priv = dev_get_priv(bus); + + priv->speed = speed; + return 0; } static int sandbox_spi_set_mode(struct udevice *bus, uint mode) { + struct sandbox_spi_priv *priv = dev_get_priv(bus); + + priv->mode = mode; + return 0; } static int sandbox_cs_info(struct udevice *bus, uint cs, struct spi_cs_info *info) { - /* Always allow activity on CS 0 */ - if (cs >= 1) + /* Always allow activity on CS 0, CS 1 */ + if (cs >= 2) return -EINVAL; return 0; @@ -152,4 +175,5 @@ U_BOOT_DRIVER(sandbox_spi) = { .id = UCLASS_SPI, .of_match = sandbox_spi_ids, .ops = &sandbox_spi_ops, + .priv_auto = sizeof(struct sandbox_spi_priv), }; diff --git a/drivers/spi/sh_qspi.c b/drivers/spi/sh_qspi.c index aa1c030..5ba8a8e 100644 --- a/drivers/spi/sh_qspi.c +++ b/drivers/spi/sh_qspi.c @@ -302,7 +302,7 @@ static int sh_qspi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev->parent; - struct sh_qspi_slave *ss = dev_get_platdata(bus); + struct sh_qspi_slave *ss = dev_get_plat(bus); return sh_qspi_xfer_common(ss, bitlen, dout, din, flags); } @@ -321,16 +321,16 @@ static int sh_qspi_set_mode(struct udevice *dev, uint mode) static int sh_qspi_probe(struct udevice *dev) { - struct sh_qspi_slave *ss = dev_get_platdata(dev); + struct sh_qspi_slave *ss = dev_get_plat(dev); sh_qspi_init(ss); return 0; } -static int sh_qspi_ofdata_to_platdata(struct udevice *dev) +static int sh_qspi_of_to_plat(struct udevice *dev) { - struct sh_qspi_slave *plat = dev_get_platdata(dev); + struct sh_qspi_slave *plat = dev_get_plat(dev); plat->regs = (struct sh_qspi_regs *)dev_read_addr(dev); @@ -353,8 +353,8 @@ U_BOOT_DRIVER(sh_qspi) = { .id = UCLASS_SPI, .of_match = sh_qspi_ids, .ops = &sh_qspi_ops, - .ofdata_to_platdata = sh_qspi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct sh_qspi_slave), + .of_to_plat = sh_qspi_of_to_plat, + .plat_auto = sizeof(struct sh_qspi_slave), .probe = sh_qspi_probe, }; #endif diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c index 153bbf8..3425d99 100644 --- a/drivers/spi/soft_spi.c +++ b/drivers/spi/soft_spi.c @@ -22,7 +22,7 @@ DECLARE_GLOBAL_DATA_PTR; -struct soft_spi_platdata { +struct soft_spi_plat { struct gpio_desc cs; struct gpio_desc sclk; struct gpio_desc mosi; @@ -41,7 +41,7 @@ struct soft_spi_priv { static int soft_spi_scl(struct udevice *dev, int bit) { struct udevice *bus = dev_get_parent(dev); - struct soft_spi_platdata *plat = dev_get_platdata(bus); + struct soft_spi_plat *plat = dev_get_plat(bus); dm_gpio_set_value(&plat->sclk, bit); @@ -51,7 +51,7 @@ static int soft_spi_scl(struct udevice *dev, int bit) static int soft_spi_sda(struct udevice *dev, int bit) { struct udevice *bus = dev_get_parent(dev); - struct soft_spi_platdata *plat = dev_get_platdata(bus); + struct soft_spi_plat *plat = dev_get_plat(bus); dm_gpio_set_value(&plat->mosi, bit); @@ -62,7 +62,7 @@ static int soft_spi_cs_activate(struct udevice *dev) { struct udevice *bus = dev_get_parent(dev); struct soft_spi_priv *priv = dev_get_priv(bus); - struct soft_spi_platdata *plat = dev_get_platdata(bus); + struct soft_spi_plat *plat = dev_get_plat(bus); int cidle = !!(priv->mode & SPI_CPOL); dm_gpio_set_value(&plat->cs, 0); @@ -75,7 +75,7 @@ static int soft_spi_cs_activate(struct udevice *dev) static int soft_spi_cs_deactivate(struct udevice *dev) { struct udevice *bus = dev_get_parent(dev); - struct soft_spi_platdata *plat = dev_get_platdata(bus); + struct soft_spi_plat *plat = dev_get_plat(bus); dm_gpio_set_value(&plat->cs, 0); @@ -117,7 +117,7 @@ static int soft_spi_xfer(struct udevice *dev, unsigned int bitlen, { struct udevice *bus = dev_get_parent(dev); struct soft_spi_priv *priv = dev_get_priv(bus); - struct soft_spi_platdata *plat = dev_get_platdata(bus); + struct soft_spi_plat *plat = dev_get_plat(bus); uchar tmpdin = 0; uchar tmpdout = 0; const u8 *txd = dout; @@ -226,9 +226,9 @@ static const struct dm_spi_ops soft_spi_ops = { .set_mode = soft_spi_set_mode, }; -static int soft_spi_ofdata_to_platdata(struct udevice *dev) +static int soft_spi_of_to_plat(struct udevice *dev) { - struct soft_spi_platdata *plat = dev->platdata; + struct soft_spi_plat *plat = dev_get_plat(dev); const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); @@ -240,7 +240,7 @@ static int soft_spi_ofdata_to_platdata(struct udevice *dev) static int soft_spi_probe(struct udevice *dev) { struct spi_slave *slave = dev_get_parent_priv(dev); - struct soft_spi_platdata *plat = dev->platdata; + struct soft_spi_plat *plat = dev_get_plat(dev); int cs_flags, clk_flags; int ret; @@ -280,8 +280,8 @@ U_BOOT_DRIVER(soft_spi) = { .id = UCLASS_SPI, .of_match = soft_spi_ids, .ops = &soft_spi_ops, - .ofdata_to_platdata = soft_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct soft_spi_platdata), - .priv_auto_alloc_size = sizeof(struct soft_spi_priv), + .of_to_plat = soft_spi_of_to_plat, + .plat_auto = sizeof(struct soft_spi_plat), + .priv_auto = sizeof(struct soft_spi_priv), .probe = soft_spi_probe, }; diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index 6f8df55..cdea540 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -701,7 +701,7 @@ static int qup_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev_get_parent(dev); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); unsigned int len; const u8 *txp = dout; u8 *rxp = din; @@ -798,6 +798,6 @@ U_BOOT_DRIVER(spi_qup) = { .id = UCLASS_SPI, .of_match = qup_spi_ids, .ops = &qup_spi_ops, - .priv_auto_alloc_size = sizeof(struct qup_spi_priv), + .priv_auto = sizeof(struct qup_spi_priv), .probe = qup_spi_probe, }; diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c index c7345d9..0a00df0 100644 --- a/drivers/spi/spi-sifive.c +++ b/drivers/spi/spi-sifive.c @@ -105,7 +105,7 @@ struct sifive_spi { }; static void sifive_spi_prep_device(struct sifive_spi *spi, - struct dm_spi_slave_platdata *slave_plat) + struct dm_spi_slave_plat *slave_plat) { /* Update the chip select polarity */ if (slave_plat->mode & SPI_CS_HIGH) @@ -119,7 +119,7 @@ static void sifive_spi_prep_device(struct sifive_spi *spi, } static int sifive_spi_set_cs(struct sifive_spi *spi, - struct dm_spi_slave_platdata *slave_plat) + struct dm_spi_slave_plat *slave_plat) { u32 cs_mode = SIFIVE_SPI_CSMODE_MODE_HOLD; @@ -137,7 +137,7 @@ static void sifive_spi_clear_cs(struct sifive_spi *spi) } static void sifive_spi_prep_transfer(struct sifive_spi *spi, - struct dm_spi_slave_platdata *slave_plat, + struct dm_spi_slave_plat *slave_plat, u8 *rx_ptr) { u32 cr; @@ -212,7 +212,7 @@ static int sifive_spi_xfer(struct udevice *dev, unsigned int bitlen, { struct udevice *bus = dev->parent; struct sifive_spi *spi = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); const u8 *tx_ptr = dout; u8 *rx_ptr = din; u32 remaining_len; @@ -475,6 +475,6 @@ U_BOOT_DRIVER(sifive_spi) = { .id = UCLASS_SPI, .of_match = sifive_spi_ids, .ops = &sifive_spi_ops, - .priv_auto_alloc_size = sizeof(struct sifive_spi), + .priv_auto = sizeof(struct sifive_spi), .probe = sifive_spi_probe, }; diff --git a/drivers/spi/spi-sunxi.c b/drivers/spi/spi-sunxi.c index 0844a5a..1145380 100644 --- a/drivers/spi/spi-sunxi.c +++ b/drivers/spi/spi-sunxi.c @@ -122,7 +122,7 @@ struct sun4i_spi_variant { bool has_burst_ctl; }; -struct sun4i_spi_platdata { +struct sun4i_spi_plat { struct sun4i_spi_variant *variant; u32 base; u32 max_hz; @@ -339,7 +339,7 @@ static int sun4i_spi_xfer(struct udevice *dev, unsigned int bitlen, { struct udevice *bus = dev->parent; struct sun4i_spi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); u32 len = bitlen / 8; u32 rx_fifocnt; @@ -407,7 +407,7 @@ static int sun4i_spi_xfer(struct udevice *dev, unsigned int bitlen, static int sun4i_spi_set_speed(struct udevice *dev, uint speed) { - struct sun4i_spi_platdata *plat = dev_get_platdata(dev); + struct sun4i_spi_plat *plat = dev_get_plat(dev); struct sun4i_spi_priv *priv = dev_get_priv(dev); unsigned int div; u32 reg; @@ -483,7 +483,7 @@ static const struct dm_spi_ops sun4i_spi_ops = { static int sun4i_spi_probe(struct udevice *bus) { - struct sun4i_spi_platdata *plat = dev_get_platdata(bus); + struct sun4i_spi_plat *plat = dev_get_plat(bus); struct sun4i_spi_priv *priv = dev_get_priv(bus); int ret; @@ -514,9 +514,9 @@ static int sun4i_spi_probe(struct udevice *bus) return 0; } -static int sun4i_spi_ofdata_to_platdata(struct udevice *bus) +static int sun4i_spi_of_to_plat(struct udevice *bus) { - struct sun4i_spi_platdata *plat = dev_get_platdata(bus); + struct sun4i_spi_plat *plat = dev_get_plat(bus); int node = dev_of_offset(bus); plat->base = dev_read_addr(bus); @@ -630,8 +630,8 @@ U_BOOT_DRIVER(sun4i_spi) = { .id = UCLASS_SPI, .of_match = sun4i_spi_ids, .ops = &sun4i_spi_ops, - .ofdata_to_platdata = sun4i_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct sun4i_spi_platdata), - .priv_auto_alloc_size = sizeof(struct sun4i_spi_priv), + .of_to_plat = sun4i_spi_of_to_plat, + .plat_auto = sizeof(struct sun4i_spi_plat), + .priv_auto = sizeof(struct sun4i_spi_priv), .probe = sun4i_spi_probe, }; diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index d5a1e3a..3fe351f 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -54,23 +54,28 @@ int dm_spi_claim_bus(struct udevice *dev) struct dm_spi_ops *ops = spi_get_ops(bus); struct dm_spi_bus *spi = dev_get_uclass_priv(bus); struct spi_slave *slave = dev_get_parent_priv(dev); - int speed; + uint speed, mode; speed = slave->max_hz; + mode = slave->mode; + if (spi->max_hz) { if (speed) - speed = min(speed, (int)spi->max_hz); + speed = min(speed, spi->max_hz); else speed = spi->max_hz; } if (!speed) speed = SPI_DEFAULT_SPEED_HZ; - if (speed != slave->speed) { + + if (speed != spi->speed || mode != spi->mode) { int ret = spi_set_speed_mode(bus, speed, slave->mode); if (ret) return log_ret(ret); - slave->speed = speed; + + spi->speed = speed; + spi->mode = mode; } return log_ret(ops->claim_bus ? ops->claim_bus(dev) : 0); @@ -158,12 +163,12 @@ int spi_write_then_read(struct spi_slave *slave, const u8 *opcode, #if !CONFIG_IS_ENABLED(OF_PLATDATA) static int spi_child_post_bind(struct udevice *dev) { - struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) return 0; - return spi_slave_ofdata_to_platdata(dev, plat); + return spi_slave_of_to_plat(dev, plat); } #endif @@ -202,7 +207,7 @@ static int spi_post_probe(struct udevice *bus) static int spi_child_pre_probe(struct udevice *dev) { - struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); struct spi_slave *slave = dev_get_parent_priv(dev); /* @@ -223,7 +228,7 @@ static int spi_child_pre_probe(struct udevice *dev) int spi_chip_select(struct udevice *dev) { - struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); return plat ? plat->cs : -ENOENT; } @@ -259,9 +264,9 @@ int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp) for (device_find_first_child(bus, &dev); dev; device_find_next_child(&dev)) { - struct dm_spi_slave_platdata *plat; + struct dm_spi_slave_plat *plat; - plat = dev_get_parent_platdata(dev); + plat = dev_get_parent_plat(dev); dev_dbg(bus, "%s: plat=%p, cs=%d\n", __func__, plat, plat->cs); if (plat->cs == cs) { *devp = dev; @@ -278,7 +283,7 @@ int spi_cs_is_valid(unsigned int busnum, unsigned int cs) struct udevice *bus; int ret; - ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, false, &bus); + ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, &bus); if (ret) { log_debug("%s: No bus %d\n", __func__, busnum); return ret; @@ -307,7 +312,7 @@ int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp, struct udevice *bus, *dev; int ret; - ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, false, &bus); + ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, &bus); if (ret) { log_debug("%s: No bus %d\n", __func__, busnum); return ret; @@ -328,7 +333,8 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, struct udevice **busp, struct spi_slave **devp) { struct udevice *bus, *dev; - struct dm_spi_slave_platdata *plat; + struct dm_spi_slave_plat *plat; + struct dm_spi_bus *bus_data; struct spi_slave *slave; bool created = false; int ret; @@ -358,7 +364,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, __func__, ret); return ret; } - plat = dev_get_parent_platdata(dev); + plat = dev_get_parent_plat(dev); plat->cs = cs; if (speed) { plat->max_hz = speed; @@ -386,12 +392,13 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, } slave = dev_get_parent_priv(dev); + bus_data = dev_get_uclass_priv(bus); /* * In case the operation speed is not yet established by * dm_spi_claim_bus() ensure the bus is configured properly. */ - if (!slave->speed) { + if (!bus_data->speed) { ret = spi_claim_bus(slave); if (ret) goto err; @@ -433,11 +440,9 @@ struct spi_slave *spi_setup_slave(unsigned int busnum, unsigned int cs, void spi_free_slave(struct spi_slave *slave) { device_remove(slave->dev, DM_REMOVE_NORMAL); - slave->dev = NULL; } -int spi_slave_ofdata_to_platdata(struct udevice *dev, - struct dm_spi_slave_platdata *plat) +int spi_slave_of_to_plat(struct udevice *dev, struct dm_spi_slave_plat *plat) { int mode = 0; int value; @@ -507,10 +512,9 @@ UCLASS_DRIVER(spi) = { #endif .post_probe = spi_post_probe, .child_pre_probe = spi_child_pre_probe, - .per_device_auto_alloc_size = sizeof(struct dm_spi_bus), - .per_child_auto_alloc_size = sizeof(struct spi_slave), - .per_child_platdata_auto_alloc_size = - sizeof(struct dm_spi_slave_platdata), + .per_device_auto = sizeof(struct dm_spi_bus), + .per_child_auto = sizeof(struct spi_slave), + .per_child_plat_auto = sizeof(struct dm_spi_slave_plat), #if !CONFIG_IS_ENABLED(OF_PLATDATA) .child_post_bind = spi_child_post_bind, #endif diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c index a53b941..4400857 100644 --- a/drivers/spi/stm32_qspi.c +++ b/drivers/spi/stm32_qspi.c @@ -400,7 +400,7 @@ static int stm32_qspi_probe(struct udevice *bus) static int stm32_qspi_claim_bus(struct udevice *dev) { struct stm32_qspi_priv *priv = dev_get_priv(dev->parent); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); int slave_cs = slave_plat->cs; if (slave_cs >= STM32_QSPI_MAX_CHIP) @@ -541,6 +541,6 @@ U_BOOT_DRIVER(stm32_qspi) = { .id = UCLASS_SPI, .of_match = stm32_qspi_ids, .ops = &stm32_qspi_ops, - .priv_auto_alloc_size = sizeof(struct stm32_qspi_priv), + .priv_auto = sizeof(struct stm32_qspi_priv), .probe = stm32_qspi_probe, }; diff --git a/drivers/spi/stm32_spi.c b/drivers/spi/stm32_spi.c index 4a0833b..720103d 100644 --- a/drivers/spi/stm32_spi.c +++ b/drivers/spi/stm32_spi.c @@ -362,7 +362,7 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev_get_parent(slave); - struct dm_spi_slave_platdata *slave_plat; + struct dm_spi_slave_plat *slave_plat; struct stm32_spi_priv *priv = dev_get_priv(bus); u32 sr; u32 ifcr = 0; @@ -407,7 +407,7 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen, debug("%s: priv->tx_len=%d priv->rx_len=%d\n", __func__, priv->tx_len, priv->rx_len); - slave_plat = dev_get_parent_platdata(slave); + slave_plat = dev_get_parent_plat(slave); if (flags & SPI_XFER_BEGIN) stm32_spi_set_cs(bus, slave_plat->cs, false); @@ -615,7 +615,7 @@ U_BOOT_DRIVER(stm32_spi) = { .id = UCLASS_SPI, .of_match = stm32_spi_ids, .ops = &stm32_spi_ops, - .priv_auto_alloc_size = sizeof(struct stm32_spi_priv), + .priv_auto = sizeof(struct stm32_spi_priv), .probe = stm32_spi_probe, .remove = stm32_spi_remove, }; diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c index 0e8198c..f0256d8 100644 --- a/drivers/spi/tegra114_spi.c +++ b/drivers/spi/tegra114_spi.c @@ -97,9 +97,9 @@ struct tegra114_spi_priv { int last_transaction_us; }; -static int tegra114_spi_ofdata_to_platdata(struct udevice *bus) +static int tegra114_spi_of_to_plat(struct udevice *bus) { - struct tegra_spi_platdata *plat = bus->platdata; + struct tegra_spi_plat *plat = dev_get_plat(bus); plat->base = dev_read_addr(bus); plat->periph_id = clock_decode_periph_id(bus); @@ -124,7 +124,7 @@ static int tegra114_spi_ofdata_to_platdata(struct udevice *bus) static int tegra114_spi_probe(struct udevice *bus) { - struct tegra_spi_platdata *plat = dev_get_platdata(bus); + struct tegra_spi_plat *plat = dev_get_plat(bus); struct tegra114_spi_priv *priv = dev_get_priv(bus); struct spi_regs *regs; ulong rate; @@ -181,7 +181,7 @@ static int tegra114_spi_probe(struct udevice *bus) static void spi_cs_activate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct tegra_spi_platdata *pdata = dev_get_platdata(bus); + struct tegra_spi_plat *pdata = dev_get_plat(bus); struct tegra114_spi_priv *priv = dev_get_priv(bus); /* If it's too soon to do another transaction, wait */ @@ -205,7 +205,7 @@ static void spi_cs_activate(struct udevice *dev) static void spi_cs_deactivate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct tegra_spi_platdata *pdata = dev_get_platdata(bus); + struct tegra_spi_plat *pdata = dev_get_plat(bus); struct tegra114_spi_priv *priv = dev_get_priv(bus); setbits_le32(&priv->regs->command1, SPI_CMD1_CS_SW_VAL); @@ -231,7 +231,7 @@ static int tegra114_spi_xfer(struct udevice *dev, unsigned int bitlen, int ret; debug("%s: slave %u:%u dout %p din %p bitlen %u\n", - __func__, bus->seq, spi_chip_select(dev), dout, din, bitlen); + __func__, dev_seq(bus), spi_chip_select(dev), dout, din, bitlen); if (bitlen % 8) return -1; num_bytes = bitlen / 8; @@ -352,7 +352,7 @@ static int tegra114_spi_xfer(struct udevice *dev, unsigned int bitlen, static int tegra114_spi_set_speed(struct udevice *bus, uint speed) { - struct tegra_spi_platdata *plat = bus->platdata; + struct tegra_spi_plat *plat = dev_get_plat(bus); struct tegra114_spi_priv *priv = dev_get_priv(bus); if (speed > plat->frequency) @@ -393,8 +393,8 @@ U_BOOT_DRIVER(tegra114_spi) = { .id = UCLASS_SPI, .of_match = tegra114_spi_ids, .ops = &tegra114_spi_ops, - .ofdata_to_platdata = tegra114_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata), - .priv_auto_alloc_size = sizeof(struct tegra114_spi_priv), + .of_to_plat = tegra114_spi_of_to_plat, + .plat_auto = sizeof(struct tegra_spi_plat), + .priv_auto = sizeof(struct tegra114_spi_priv), .probe = tegra114_spi_probe, }; diff --git a/drivers/spi/tegra20_sflash.c b/drivers/spi/tegra20_sflash.c index 771744d..4384a48 100644 --- a/drivers/spi/tegra20_sflash.c +++ b/drivers/spi/tegra20_sflash.c @@ -87,9 +87,9 @@ int tegra20_sflash_cs_info(struct udevice *bus, unsigned int cs, return 0; } -static int tegra20_sflash_ofdata_to_platdata(struct udevice *bus) +static int tegra20_sflash_of_to_plat(struct udevice *bus) { - struct tegra_spi_platdata *plat = bus->platdata; + struct tegra_spi_plat *plat = dev_get_plat(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); @@ -116,7 +116,7 @@ static int tegra20_sflash_ofdata_to_platdata(struct udevice *bus) static int tegra20_sflash_probe(struct udevice *bus) { - struct tegra_spi_platdata *plat = dev_get_platdata(bus); + struct tegra_spi_plat *plat = dev_get_plat(bus); struct tegra20_sflash_priv *priv = dev_get_priv(bus); priv->regs = (struct spi_regs *)plat->base; @@ -173,7 +173,7 @@ static int tegra20_sflash_claim_bus(struct udevice *dev) static void spi_cs_activate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct tegra_spi_platdata *pdata = dev_get_platdata(bus); + struct tegra_spi_plat *pdata = dev_get_plat(bus); struct tegra20_sflash_priv *priv = dev_get_priv(bus); /* If it's too soon to do another transaction, wait */ @@ -192,7 +192,7 @@ static void spi_cs_activate(struct udevice *dev) static void spi_cs_deactivate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct tegra_spi_platdata *pdata = dev_get_platdata(bus); + struct tegra_spi_plat *pdata = dev_get_plat(bus); struct tegra20_sflash_priv *priv = dev_get_priv(bus); /* CS is negated on Tegra, so drive a 0 to get a 1 */ @@ -217,7 +217,7 @@ static int tegra20_sflash_xfer(struct udevice *dev, unsigned int bitlen, int ret; debug("%s: slave %u:%u dout %p din %p bitlen %u\n", - __func__, bus->seq, spi_chip_select(dev), dout, din, bitlen); + __func__, dev_seq(bus), spi_chip_select(dev), dout, din, bitlen); if (bitlen % 8) return -1; num_bytes = bitlen / 8; @@ -314,7 +314,7 @@ static int tegra20_sflash_xfer(struct udevice *dev, unsigned int bitlen, static int tegra20_sflash_set_speed(struct udevice *bus, uint speed) { - struct tegra_spi_platdata *plat = bus->platdata; + struct tegra_spi_plat *plat = dev_get_plat(bus); struct tegra20_sflash_priv *priv = dev_get_priv(bus); if (speed > plat->frequency) @@ -353,8 +353,8 @@ U_BOOT_DRIVER(tegra20_sflash) = { .id = UCLASS_SPI, .of_match = tegra20_sflash_ids, .ops = &tegra20_sflash_ops, - .ofdata_to_platdata = tegra20_sflash_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata), - .priv_auto_alloc_size = sizeof(struct tegra20_sflash_priv), + .of_to_plat = tegra20_sflash_of_to_plat, + .plat_auto = sizeof(struct tegra_spi_plat), + .priv_auto = sizeof(struct tegra20_sflash_priv), .probe = tegra20_sflash_probe, }; diff --git a/drivers/spi/tegra20_slink.c b/drivers/spi/tegra20_slink.c index f9846ee..3057fe1 100644 --- a/drivers/spi/tegra20_slink.c +++ b/drivers/spi/tegra20_slink.c @@ -93,9 +93,9 @@ struct tegra_spi_slave { struct tegra30_spi_priv *ctrl; }; -static int tegra30_spi_ofdata_to_platdata(struct udevice *bus) +static int tegra30_spi_of_to_plat(struct udevice *bus) { - struct tegra_spi_platdata *plat = bus->platdata; + struct tegra_spi_plat *plat = dev_get_plat(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); @@ -122,7 +122,7 @@ static int tegra30_spi_ofdata_to_platdata(struct udevice *bus) static int tegra30_spi_probe(struct udevice *bus) { - struct tegra_spi_platdata *plat = dev_get_platdata(bus); + struct tegra_spi_plat *plat = dev_get_plat(bus); struct tegra30_spi_priv *priv = dev_get_priv(bus); priv->regs = (struct spi_regs *)plat->base; @@ -167,7 +167,7 @@ static int tegra30_spi_claim_bus(struct udevice *dev) static void spi_cs_activate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct tegra_spi_platdata *pdata = dev_get_platdata(bus); + struct tegra_spi_plat *pdata = dev_get_plat(bus); struct tegra30_spi_priv *priv = dev_get_priv(bus); /* If it's too soon to do another transaction, wait */ @@ -186,7 +186,7 @@ static void spi_cs_activate(struct udevice *dev) static void spi_cs_deactivate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct tegra_spi_platdata *pdata = dev_get_platdata(bus); + struct tegra_spi_plat *pdata = dev_get_plat(bus); struct tegra30_spi_priv *priv = dev_get_priv(bus); /* CS is negated on Tegra, so drive a 0 to get a 1 */ @@ -211,7 +211,7 @@ static int tegra30_spi_xfer(struct udevice *dev, unsigned int bitlen, int ret; debug("%s: slave %u:%u dout %p din %p bitlen %u\n", - __func__, bus->seq, spi_chip_select(dev), dout, din, bitlen); + __func__, dev_seq(bus), spi_chip_select(dev), dout, din, bitlen); if (bitlen % 8) return -1; num_bytes = bitlen / 8; @@ -314,7 +314,7 @@ static int tegra30_spi_xfer(struct udevice *dev, unsigned int bitlen, static int tegra30_spi_set_speed(struct udevice *bus, uint speed) { - struct tegra_spi_platdata *plat = bus->platdata; + struct tegra_spi_plat *plat = dev_get_plat(bus); struct tegra30_spi_priv *priv = dev_get_priv(bus); if (speed > plat->frequency) @@ -372,8 +372,8 @@ U_BOOT_DRIVER(tegra30_spi) = { .id = UCLASS_SPI, .of_match = tegra30_spi_ids, .ops = &tegra30_spi_ops, - .ofdata_to_platdata = tegra30_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata), - .priv_auto_alloc_size = sizeof(struct tegra30_spi_priv), + .of_to_plat = tegra30_spi_of_to_plat, + .plat_auto = sizeof(struct tegra_spi_plat), + .priv_auto = sizeof(struct tegra30_spi_priv), .probe = tegra30_spi_probe, }; diff --git a/drivers/spi/tegra210_qspi.c b/drivers/spi/tegra210_qspi.c index ae16b45..b464b9c 100644 --- a/drivers/spi/tegra210_qspi.c +++ b/drivers/spi/tegra210_qspi.c @@ -97,9 +97,9 @@ struct tegra210_qspi_priv { int last_transaction_us; }; -static int tegra210_qspi_ofdata_to_platdata(struct udevice *bus) +static int tegra210_qspi_of_to_plat(struct udevice *bus) { - struct tegra_spi_platdata *plat = bus->platdata; + struct tegra_spi_plat *plat = dev_get_plat(bus); plat->base = dev_read_addr(bus); plat->periph_id = clock_decode_periph_id(bus); @@ -125,7 +125,7 @@ static int tegra210_qspi_ofdata_to_platdata(struct udevice *bus) static int tegra210_qspi_probe(struct udevice *bus) { - struct tegra_spi_platdata *plat = dev_get_platdata(bus); + struct tegra_spi_plat *plat = dev_get_plat(bus); struct tegra210_qspi_priv *priv = dev_get_priv(bus); priv->regs = (struct qspi_regs *)plat->base; @@ -174,7 +174,7 @@ static int tegra210_qspi_claim_bus(struct udevice *dev) static void spi_cs_activate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct tegra_spi_platdata *pdata = dev_get_platdata(bus); + struct tegra_spi_plat *pdata = dev_get_plat(bus); struct tegra210_qspi_priv *priv = dev_get_priv(bus); /* If it's too soon to do another transaction, wait */ @@ -198,7 +198,7 @@ static void spi_cs_activate(struct udevice *dev) static void spi_cs_deactivate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct tegra_spi_platdata *pdata = dev_get_platdata(bus); + struct tegra_spi_plat *pdata = dev_get_plat(bus); struct tegra210_qspi_priv *priv = dev_get_priv(bus); setbits_le32(&priv->regs->command1, QSPI_CMD1_CS_SW_VAL); @@ -223,7 +223,7 @@ static int tegra210_qspi_xfer(struct udevice *dev, unsigned int bitlen, int num_bytes, tm, ret; debug("%s: slave %u:%u dout %p din %p bitlen %u\n", - __func__, bus->seq, spi_chip_select(dev), dout, din, bitlen); + __func__, dev_seq(bus), spi_chip_select(dev), dout, din, bitlen); if (bitlen % 8) return -1; num_bytes = bitlen / 8; @@ -380,7 +380,7 @@ static int tegra210_qspi_xfer(struct udevice *dev, unsigned int bitlen, static int tegra210_qspi_set_speed(struct udevice *bus, uint speed) { - struct tegra_spi_platdata *plat = bus->platdata; + struct tegra_spi_plat *plat = dev_get_plat(bus); struct tegra210_qspi_priv *priv = dev_get_priv(bus); if (speed > plat->frequency) @@ -422,9 +422,9 @@ U_BOOT_DRIVER(tegra210_qspi) = { .id = UCLASS_SPI, .of_match = tegra210_qspi_ids, .ops = &tegra210_qspi_ops, - .ofdata_to_platdata = tegra210_qspi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct tegra_spi_platdata), - .priv_auto_alloc_size = sizeof(struct tegra210_qspi_priv), - .per_child_auto_alloc_size = sizeof(struct spi_slave), + .of_to_plat = tegra210_qspi_of_to_plat, + .plat_auto = sizeof(struct tegra_spi_plat), + .priv_auto = sizeof(struct tegra210_qspi_priv), + .per_child_auto = sizeof(struct spi_slave), .probe = tegra210_qspi_probe, }; diff --git a/drivers/spi/tegra_spi.h b/drivers/spi/tegra_spi.h index e997d66..ab69ea4 100644 --- a/drivers/spi/tegra_spi.h +++ b/drivers/spi/tegra_spi.h @@ -3,7 +3,7 @@ * (C) Copyright 2014 Google, Inc */ -struct tegra_spi_platdata { +struct tegra_spi_plat { enum periph_id periph_id; int frequency; /* Default clock frequency, -1 for none */ ulong base; diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c index 5fdbb49..7c3b1f7 100644 --- a/drivers/spi/ti_qspi.c +++ b/drivers/spi/ti_qspi.c @@ -154,7 +154,7 @@ static void ti_qspi_ctrl_mode_mmap(void *ctrl_mod_mmap, int cs, bool enable) static int ti_qspi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { - struct dm_spi_slave_platdata *slave = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave = dev_get_parent_plat(dev); struct ti_qspi_priv *priv; struct udevice *bus; uint words = bitlen >> 3; /* fixed 8-bit word length */ @@ -323,7 +323,7 @@ static int ti_qspi_set_mode(struct udevice *bus, uint mode) static int ti_qspi_exec_mem_op(struct spi_slave *slave, const struct spi_mem_op *op) { - struct dm_spi_slave_platdata *slave_plat; + struct dm_spi_slave_plat *slave_plat; struct ti_qspi_priv *priv; struct udevice *bus; u32 from = 0; @@ -331,7 +331,7 @@ static int ti_qspi_exec_mem_op(struct spi_slave *slave, bus = slave->dev->parent; priv = dev_get_priv(bus); - slave_plat = dev_get_parent_platdata(slave->dev); + slave_plat = dev_get_parent_plat(slave->dev); /* Only optimize read path. */ if (!op->data.nbytes || op->data.dir != SPI_MEM_DATA_IN || @@ -355,7 +355,7 @@ static int ti_qspi_exec_mem_op(struct spi_slave *slave, static int ti_qspi_claim_bus(struct udevice *dev) { - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); struct ti_qspi_priv *priv; struct udevice *bus; @@ -384,7 +384,7 @@ static int ti_qspi_claim_bus(struct udevice *dev) static int ti_qspi_release_bus(struct udevice *dev) { - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); struct ti_qspi_priv *priv; struct udevice *bus; @@ -452,7 +452,7 @@ static void *map_syscon_chipselects(struct udevice *bus) #endif } -static int ti_qspi_ofdata_to_platdata(struct udevice *bus) +static int ti_qspi_of_to_plat(struct udevice *bus) { struct ti_qspi_priv *priv = dev_get_priv(bus); const void *blob = gd->fdt_blob; @@ -504,7 +504,7 @@ U_BOOT_DRIVER(ti_qspi) = { .id = UCLASS_SPI, .of_match = ti_qspi_ids, .ops = &ti_qspi_ops, - .ofdata_to_platdata = ti_qspi_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct ti_qspi_priv), + .of_to_plat = ti_qspi_of_to_plat, + .priv_auto = sizeof(struct ti_qspi_priv), .probe = ti_qspi_probe, }; diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c index b645668..e47ed5b 100644 --- a/drivers/spi/uniphier_spi.c +++ b/drivers/spi/uniphier_spi.c @@ -68,7 +68,7 @@ DECLARE_GLOBAL_DATA_PTR; #define SSI_CLK 50000000 /* internal I/O clock: 50MHz */ -struct uniphier_spi_platdata { +struct uniphier_spi_plat { void __iomem *base; u32 frequency; /* input frequency */ u32 speed_hz; @@ -113,7 +113,7 @@ static void uniphier_spi_regdump(struct uniphier_spi_priv *priv) static void spi_cs_activate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct uniphier_spi_platdata *plat = bus->platdata; + struct uniphier_spi_plat *plat = dev_get_plat(bus); struct uniphier_spi_priv *priv = dev_get_priv(bus); ulong delay_us; /* The delay completed so far */ u32 val; @@ -139,7 +139,7 @@ static void spi_cs_activate(struct udevice *dev) static void spi_cs_deactivate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct uniphier_spi_platdata *plat = bus->platdata; + struct uniphier_spi_plat *plat = dev_get_plat(bus); struct uniphier_spi_priv *priv = dev_get_priv(bus); u32 val; @@ -279,7 +279,7 @@ static int uniphier_spi_xfer(struct udevice *dev, unsigned int bitlen, static int uniphier_spi_set_speed(struct udevice *bus, uint speed) { - struct uniphier_spi_platdata *plat = bus->platdata; + struct uniphier_spi_plat *plat = dev_get_plat(bus); struct uniphier_spi_priv *priv = dev_get_priv(bus); u32 val, ckdiv; @@ -362,9 +362,9 @@ static int uniphier_spi_set_mode(struct udevice *bus, uint mode) return 0; } -static int uniphier_spi_ofdata_to_platdata(struct udevice *bus) +static int uniphier_spi_of_to_plat(struct udevice *bus) { - struct uniphier_spi_platdata *plat = bus->platdata; + struct uniphier_spi_plat *plat = dev_get_plat(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); @@ -383,7 +383,7 @@ static int uniphier_spi_ofdata_to_platdata(struct udevice *bus) static int uniphier_spi_probe(struct udevice *bus) { - struct uniphier_spi_platdata *plat = dev_get_platdata(bus); + struct uniphier_spi_plat *plat = dev_get_plat(bus); struct uniphier_spi_priv *priv = dev_get_priv(bus); priv->base = plat->base; @@ -411,8 +411,8 @@ U_BOOT_DRIVER(uniphier_spi) = { .id = UCLASS_SPI, .of_match = uniphier_spi_ids, .ops = &uniphier_spi_ops, - .ofdata_to_platdata = uniphier_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct uniphier_spi_platdata), - .priv_auto_alloc_size = sizeof(struct uniphier_spi_priv), + .of_to_plat = uniphier_spi_of_to_plat, + .plat_auto = sizeof(struct uniphier_spi_plat), + .priv_auto = sizeof(struct uniphier_spi_priv), .probe = uniphier_spi_probe, }; diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 47a5571..0274afd 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -211,7 +211,7 @@ static void xilinx_spi_startup_block(struct udevice *dev, unsigned int bytes, struct udevice *bus = dev_get_parent(dev); struct xilinx_spi_priv *priv = dev_get_priv(bus); struct xilinx_spi_regs *regs = priv->regs; - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); const unsigned char *txp = dout; unsigned char *rxp = din; u32 reg; @@ -244,7 +244,7 @@ static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen, struct udevice *bus = dev_get_parent(dev); struct xilinx_spi_priv *priv = dev_get_priv(bus); struct xilinx_spi_regs *regs = priv->regs; - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); /* assume spi core configured to do 8 bit transfers */ unsigned int bytes = bitlen / XILSPI_MAX_XFER_BITS; const unsigned char *txp = dout; @@ -255,7 +255,7 @@ static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen, int ret; debug("spi_xfer: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", - bus->seq, slave_plat->cs, bitlen, bytes, flags); + dev_seq(bus), slave_plat->cs, bitlen, bytes, flags); if (bitlen == 0) goto done; @@ -364,6 +364,6 @@ U_BOOT_DRIVER(xilinx_spi) = { .id = UCLASS_SPI, .of_match = xilinx_spi_ids, .ops = &xilinx_spi_ops, - .priv_auto_alloc_size = sizeof(struct xilinx_spi_priv), + .priv_auto = sizeof(struct xilinx_spi_priv), .probe = xilinx_spi_probe, }; diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c index f2eddec..845f2d2 100644 --- a/drivers/spi/zynq_qspi.c +++ b/drivers/spi/zynq_qspi.c @@ -76,7 +76,7 @@ struct zynq_qspi_regs { }; /* zynq qspi platform data */ -struct zynq_qspi_platdata { +struct zynq_qspi_plat { struct zynq_qspi_regs *regs; u32 frequency; /* input frequency */ u32 speed_hz; @@ -98,9 +98,9 @@ struct zynq_qspi_priv { unsigned cs_change:1; }; -static int zynq_qspi_ofdata_to_platdata(struct udevice *bus) +static int zynq_qspi_of_to_plat(struct udevice *bus) { - struct zynq_qspi_platdata *plat = bus->platdata; + struct zynq_qspi_plat *plat = dev_get_plat(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); @@ -171,7 +171,7 @@ static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv) static int zynq_qspi_probe(struct udevice *bus) { - struct zynq_qspi_platdata *plat = dev_get_platdata(bus); + struct zynq_qspi_plat *plat = dev_get_plat(bus); struct zynq_qspi_priv *priv = dev_get_priv(bus); struct clk clk; unsigned long clock; @@ -560,7 +560,7 @@ static int zynq_qspi_xfer(struct udevice *dev, unsigned int bitlen, { struct udevice *bus = dev->parent; struct zynq_qspi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); priv->cs = slave_plat->cs; priv->tx_buf = dout; @@ -568,7 +568,7 @@ static int zynq_qspi_xfer(struct udevice *dev, unsigned int bitlen, priv->len = bitlen / 8; debug("zynq_qspi_xfer: bus:%i cs:%i bitlen:%i len:%i flags:%lx\n", - bus->seq, slave_plat->cs, bitlen, priv->len, flags); + dev_seq(bus), slave_plat->cs, bitlen, priv->len, flags); /* * Festering sore. @@ -592,7 +592,7 @@ static int zynq_qspi_xfer(struct udevice *dev, unsigned int bitlen, static int zynq_qspi_set_speed(struct udevice *bus, uint speed) { - struct zynq_qspi_platdata *plat = bus->platdata; + struct zynq_qspi_plat *plat = dev_get_plat(bus); struct zynq_qspi_priv *priv = dev_get_priv(bus); struct zynq_qspi_regs *regs = priv->regs; uint32_t confr; @@ -666,8 +666,8 @@ U_BOOT_DRIVER(zynq_qspi) = { .id = UCLASS_SPI, .of_match = zynq_qspi_ids, .ops = &zynq_qspi_ops, - .ofdata_to_platdata = zynq_qspi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct zynq_qspi_platdata), - .priv_auto_alloc_size = sizeof(struct zynq_qspi_priv), + .of_to_plat = zynq_qspi_of_to_plat, + .plat_auto = sizeof(struct zynq_qspi_plat), + .priv_auto = sizeof(struct zynq_qspi_priv), .probe = zynq_qspi_probe, }; diff --git a/drivers/spi/zynq_spi.c b/drivers/spi/zynq_spi.c index cb911c3..2971e55 100644 --- a/drivers/spi/zynq_spi.c +++ b/drivers/spi/zynq_spi.c @@ -55,7 +55,7 @@ struct zynq_spi_regs { /* zynq spi platform data */ -struct zynq_spi_platdata { +struct zynq_spi_plat { struct zynq_spi_regs *regs; u32 frequency; /* input frequency */ u32 speed_hz; @@ -73,9 +73,9 @@ struct zynq_spi_priv { u32 freq; /* required frequency */ }; -static int zynq_spi_ofdata_to_platdata(struct udevice *bus) +static int zynq_spi_of_to_plat(struct udevice *bus) { - struct zynq_spi_platdata *plat = bus->platdata; + struct zynq_spi_plat *plat = dev_get_plat(bus); const void *blob = gd->fdt_blob; int node = dev_of_offset(bus); @@ -121,7 +121,7 @@ static void zynq_spi_init_hw(struct zynq_spi_priv *priv) static int zynq_spi_probe(struct udevice *bus) { - struct zynq_spi_platdata *plat = dev_get_platdata(bus); + struct zynq_spi_plat *plat = dev_get_plat(bus); struct zynq_spi_priv *priv = dev_get_priv(bus); struct clk clk; unsigned long clock; @@ -162,7 +162,7 @@ static int zynq_spi_probe(struct udevice *bus) static void spi_cs_activate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct zynq_spi_platdata *plat = bus->platdata; + struct zynq_spi_plat *plat = dev_get_plat(bus); struct zynq_spi_priv *priv = dev_get_priv(bus); struct zynq_spi_regs *regs = priv->regs; u32 cr; @@ -193,7 +193,7 @@ static void spi_cs_activate(struct udevice *dev) static void spi_cs_deactivate(struct udevice *dev) { struct udevice *bus = dev->parent; - struct zynq_spi_platdata *plat = bus->platdata; + struct zynq_spi_plat *plat = dev_get_plat(bus); struct zynq_spi_priv *priv = dev_get_priv(bus); struct zynq_spi_regs *regs = priv->regs; @@ -234,7 +234,7 @@ static int zynq_spi_xfer(struct udevice *dev, unsigned int bitlen, struct udevice *bus = dev->parent; struct zynq_spi_priv *priv = dev_get_priv(bus); struct zynq_spi_regs *regs = priv->regs; - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); u32 len = bitlen / 8; u32 tx_len = len, rx_len = len, tx_tvl; const u8 *tx_buf = dout; @@ -242,7 +242,7 @@ static int zynq_spi_xfer(struct udevice *dev, unsigned int bitlen, u32 ts, status; debug("spi_xfer: bus:%i cs:%i bitlen:%i len:%i flags:%lx\n", - bus->seq, slave_plat->cs, bitlen, len, flags); + dev_seq(bus), slave_plat->cs, bitlen, len, flags); if (bitlen % 8) { debug("spi_xfer: Non byte aligned SPI transfer\n"); @@ -296,7 +296,7 @@ static int zynq_spi_xfer(struct udevice *dev, unsigned int bitlen, static int zynq_spi_set_speed(struct udevice *bus, uint speed) { - struct zynq_spi_platdata *plat = bus->platdata; + struct zynq_spi_plat *plat = dev_get_plat(bus); struct zynq_spi_priv *priv = dev_get_priv(bus); struct zynq_spi_regs *regs = priv->regs; uint32_t confr; @@ -371,8 +371,8 @@ U_BOOT_DRIVER(zynq_spi) = { .id = UCLASS_SPI, .of_match = zynq_spi_ids, .ops = &zynq_spi_ops, - .ofdata_to_platdata = zynq_spi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct zynq_spi_platdata), - .priv_auto_alloc_size = sizeof(struct zynq_spi_priv), + .of_to_plat = zynq_spi_of_to_plat, + .plat_auto = sizeof(struct zynq_spi_plat), + .priv_auto = sizeof(struct zynq_spi_priv), .probe = zynq_spi_probe, }; diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c index e0e6687..efcbd05 100644 --- a/drivers/spi/zynqmp_gqspi.c +++ b/drivers/spi/zynqmp_gqspi.c @@ -156,7 +156,7 @@ struct zynqmp_qspi_dma_regs { DECLARE_GLOBAL_DATA_PTR; -struct zynqmp_qspi_platdata { +struct zynqmp_qspi_plat { struct zynqmp_qspi_regs *regs; struct zynqmp_qspi_dma_regs *dma_regs; u32 frequency; @@ -175,9 +175,9 @@ struct zynqmp_qspi_priv { unsigned int cs_change:1; }; -static int zynqmp_qspi_ofdata_to_platdata(struct udevice *bus) +static int zynqmp_qspi_of_to_plat(struct udevice *bus) { - struct zynqmp_qspi_platdata *plat = bus->platdata; + struct zynqmp_qspi_plat *plat = dev_get_plat(bus); debug("%s\n", __func__); @@ -255,7 +255,7 @@ static void zynqmp_qspi_chipselect(struct zynqmp_qspi_priv *priv, int is_on) void zynqmp_qspi_set_tapdelay(struct udevice *bus, u32 baudrateval) { - struct zynqmp_qspi_platdata *plat = bus->platdata; + struct zynqmp_qspi_plat *plat = dev_get_plat(bus); struct zynqmp_qspi_priv *priv = dev_get_priv(bus); struct zynqmp_qspi_regs *regs = priv->regs; u32 tapdlybypass = 0, lpbkdlyadj = 0, datadlyadj = 0, clk_rate; @@ -295,7 +295,7 @@ void zynqmp_qspi_set_tapdelay(struct udevice *bus, u32 baudrateval) static int zynqmp_qspi_set_speed(struct udevice *bus, uint speed) { - struct zynqmp_qspi_platdata *plat = bus->platdata; + struct zynqmp_qspi_plat *plat = dev_get_plat(bus); struct zynqmp_qspi_priv *priv = dev_get_priv(bus); struct zynqmp_qspi_regs *regs = priv->regs; u32 confr; @@ -333,7 +333,7 @@ static int zynqmp_qspi_set_speed(struct udevice *bus, uint speed) static int zynqmp_qspi_probe(struct udevice *bus) { - struct zynqmp_qspi_platdata *plat = dev_get_platdata(bus); + struct zynqmp_qspi_plat *plat = dev_get_plat(bus); struct zynqmp_qspi_priv *priv = dev_get_priv(bus); struct clk clk; unsigned long clock; @@ -429,10 +429,8 @@ static int zynqmp_qspi_fill_tx_fifo(struct zynqmp_qspi_priv *priv, u32 size) data |= GENMASK(31, 16); break; case 3: - data = *((u16 *)buf); - buf += 2; - data |= (*((u8 *)buf) << 16); - buf += 1; + data = *buf; + buf += 3; data |= GENMASK(31, 24); break; } @@ -727,8 +725,8 @@ U_BOOT_DRIVER(zynqmp_qspi) = { .id = UCLASS_SPI, .of_match = zynqmp_qspi_ids, .ops = &zynqmp_qspi_ops, - .ofdata_to_platdata = zynqmp_qspi_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct zynqmp_qspi_platdata), - .priv_auto_alloc_size = sizeof(struct zynqmp_qspi_priv), + .of_to_plat = zynqmp_qspi_of_to_plat, + .plat_auto = sizeof(struct zynqmp_qspi_plat), + .priv_auto = sizeof(struct zynqmp_qspi_priv), .probe = zynqmp_qspi_probe, }; diff --git a/drivers/spmi/spmi-msm.c b/drivers/spmi/spmi-msm.c index 2f430ae..7f21443 100644 --- a/drivers/spmi/spmi-msm.c +++ b/drivers/spmi/spmi-msm.c @@ -194,5 +194,5 @@ U_BOOT_DRIVER(msm_spmi) = { .of_match = msm_spmi_ids, .ops = &msm_spmi_ops, .probe = msm_spmi_probe, - .priv_auto_alloc_size = sizeof(struct msm_spmi_priv), + .priv_auto = sizeof(struct msm_spmi_priv), }; diff --git a/drivers/spmi/spmi-sandbox.c b/drivers/spmi/spmi-sandbox.c index 0da419c..f677294 100644 --- a/drivers/spmi/spmi-sandbox.c +++ b/drivers/spmi/spmi-sandbox.c @@ -151,5 +151,5 @@ U_BOOT_DRIVER(msm_spmi) = { .of_match = sandbox_spmi_ids, .ops = &sandbox_spmi_ops, .probe = sandbox_spmi_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_spmi_priv), + .priv_auto = sizeof(struct sandbox_spmi_priv), }; diff --git a/drivers/sysinfo/gazerbeam.c b/drivers/sysinfo/gazerbeam.c index 9e7a496..c1fae6c 100644 --- a/drivers/sysinfo/gazerbeam.c +++ b/drivers/sysinfo/gazerbeam.c @@ -260,6 +260,6 @@ U_BOOT_DRIVER(sysinfo_gazerbeam) = { .id = UCLASS_SYSINFO, .of_match = sysinfo_gazerbeam_ids, .ops = &sysinfo_gazerbeam_ops, - .priv_auto_alloc_size = sizeof(struct sysinfo_gazerbeam_priv), + .priv_auto = sizeof(struct sysinfo_gazerbeam_priv), .probe = sysinfo_gazerbeam_probe, }; diff --git a/drivers/sysinfo/sandbox.c b/drivers/sysinfo/sandbox.c index 62a1cb4..d270a26 100644 --- a/drivers/sysinfo/sandbox.c +++ b/drivers/sysinfo/sandbox.c @@ -102,6 +102,6 @@ U_BOOT_DRIVER(sysinfo_sandbox) = { .id = UCLASS_SYSINFO, .of_match = sysinfo_sandbox_ids, .ops = &sysinfo_sandbox_ops, - .priv_auto_alloc_size = sizeof(struct sysinfo_sandbox_priv), + .priv_auto = sizeof(struct sysinfo_sandbox_priv), .probe = sysinfo_sandbox_probe, }; diff --git a/drivers/sysreset/poweroff_gpio.c b/drivers/sysreset/poweroff_gpio.c index ac482c3..a5c24fd 100644 --- a/drivers/sysreset/poweroff_gpio.c +++ b/drivers/sysreset/poweroff_gpio.c @@ -87,6 +87,6 @@ U_BOOT_DRIVER(poweroff_gpio) = { .id = UCLASS_SYSRESET, .ops = &poweroff_gpio_ops, .probe = poweroff_gpio_probe, - .priv_auto_alloc_size = sizeof(struct poweroff_gpio_info), + .priv_auto = sizeof(struct poweroff_gpio_info), .of_match = poweroff_gpio_ids, }; diff --git a/drivers/sysreset/sysreset-ti-sci.c b/drivers/sysreset/sysreset-ti-sci.c index 7707c72..81bfd67 100644 --- a/drivers/sysreset/sysreset-ti-sci.c +++ b/drivers/sysreset/sysreset-ti-sci.c @@ -70,6 +70,6 @@ U_BOOT_DRIVER(ti_sci_sysreset) = { .id = UCLASS_SYSRESET, .of_match = ti_sci_sysreset_of_match, .probe = ti_sci_sysreset_probe, - .priv_auto_alloc_size = sizeof(struct ti_sci_sysreset_data), + .priv_auto = sizeof(struct ti_sci_sysreset_data), .ops = &ti_sci_sysreset_ops, }; diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c index 3f5414e..e69fb22 100644 --- a/drivers/sysreset/sysreset-uclass.c +++ b/drivers/sysreset/sysreset-uclass.c @@ -9,12 +9,13 @@ #include <common.h> #include <command.h> #include <cpu_func.h> -#include <hang.h> -#include <log.h> -#include <sysreset.h> #include <dm.h> #include <errno.h> +#include <hang.h> +#include <log.h> #include <regmap.h> +#include <spl.h> +#include <sysreset.h> #include <dm/device-internal.h> #include <dm/lists.h> #include <dm/root.h> @@ -101,7 +102,10 @@ void sysreset_walk_halt(enum sysreset_t type) mdelay(100); /* Still no reset? Give up */ - log_err("System reset not supported on this platform\n"); + if (spl_phase() <= PHASE_SPL) + log_err("no sysreset\n"); + else + log_err("System reset not supported on this platform\n"); hang(); } diff --git a/drivers/sysreset/sysreset_gpio.c b/drivers/sysreset/sysreset_gpio.c index d7280ee..680b759 100644 --- a/drivers/sysreset/sysreset_gpio.c +++ b/drivers/sysreset/sysreset_gpio.c @@ -55,6 +55,6 @@ U_BOOT_DRIVER(gpio_reboot) = { .name = "gpio_restart", .of_match = led_gpio_ids, .ops = &gpio_reboot_ops, - .priv_auto_alloc_size = sizeof(struct gpio_reboot_priv), + .priv_auto = sizeof(struct gpio_reboot_priv), .probe = gpio_reboot_probe, }; diff --git a/drivers/sysreset/sysreset_octeon.c b/drivers/sysreset/sysreset_octeon.c index a05dac3..ebdea6a 100644 --- a/drivers/sysreset/sysreset_octeon.c +++ b/drivers/sysreset/sysreset_octeon.c @@ -45,7 +45,7 @@ static const struct udevice_id octeon_sysreset_ids[] = { U_BOOT_DRIVER(sysreset_octeon) = { .id = UCLASS_SYSRESET, .name = "octeon_sysreset", - .priv_auto_alloc_size = sizeof(struct octeon_sysreset_data), + .priv_auto = sizeof(struct octeon_sysreset_data), .ops = &octeon_sysreset, .probe = octeon_sysreset_probe, .of_match = octeon_sysreset_ids, diff --git a/drivers/sysreset/sysreset_resetctl.c b/drivers/sysreset/sysreset_resetctl.c index b8203ba..c039521 100644 --- a/drivers/sysreset/sysreset_resetctl.c +++ b/drivers/sysreset/sysreset_resetctl.c @@ -43,6 +43,6 @@ U_BOOT_DRIVER(resetctl_reboot) = { .name = "resetctl_reboot", .of_match = resetctl_reboot_ids, .ops = &resetctl_reboot_ops, - .priv_auto_alloc_size = sizeof(struct resetctl_reboot_priv), + .priv_auto = sizeof(struct resetctl_reboot_priv), .probe = resetctl_reboot_probe, }; diff --git a/drivers/sysreset/sysreset_sandbox.c b/drivers/sysreset/sysreset_sandbox.c index 7026a48..0868582 100644 --- a/drivers/sysreset/sysreset_sandbox.c +++ b/drivers/sysreset/sysreset_sandbox.c @@ -47,10 +47,10 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type) /* * If we have a device tree, the device we created from platform data - * (see the U_BOOT_DEVICE() declaration below) should not do anything. + * (see the U_BOOT_DRVINFO() declaration below) should not do anything. * If we are that device, return an error. */ - if (state->fdt_fname && !dev_of_valid(dev)) + if (state->fdt_fname && !dev_has_ofnode(dev)) return -ENODEV; switch (type) { @@ -135,7 +135,7 @@ U_BOOT_DRIVER(warm_sysreset_sandbox) = { #if !CONFIG_IS_ENABLED(OF_PLATDATA) /* This is here in case we don't have a device tree */ -U_BOOT_DEVICE(sysreset_sandbox_non_fdt) = { +U_BOOT_DRVINFO(sysreset_sandbox_non_fdt) = { .name = "sysreset_sandbox", }; #endif diff --git a/drivers/sysreset/sysreset_socfpga.c b/drivers/sysreset/sysreset_socfpga.c index 67cec65..e38296a 100644 --- a/drivers/sysreset/sysreset_socfpga.c +++ b/drivers/sysreset/sysreset_socfpga.c @@ -51,7 +51,7 @@ static struct sysreset_ops socfpga_sysreset = { U_BOOT_DRIVER(sysreset_socfpga) = { .id = UCLASS_SYSRESET, .name = "socfpga_sysreset", - .priv_auto_alloc_size = sizeof(struct socfpga_sysreset_data), + .priv_auto = sizeof(struct socfpga_sysreset_data), .ops = &socfpga_sysreset, .probe = socfpga_sysreset_probe, }; diff --git a/drivers/sysreset/sysreset_sti.c b/drivers/sysreset/sysreset_sti.c index 43e161c..29e88db 100644 --- a/drivers/sysreset/sysreset_sti.c +++ b/drivers/sysreset/sysreset_sti.c @@ -79,5 +79,5 @@ U_BOOT_DRIVER(sysreset_sti) = { .ops = &sti_sysreset, .probe = sti_sysreset_probe, .of_match = sti_sysreset_ids, - .priv_auto_alloc_size = sizeof(struct sti_sysreset_priv), + .priv_auto = sizeof(struct sti_sysreset_priv), }; diff --git a/drivers/sysreset/sysreset_syscon.c b/drivers/sysreset/sysreset_syscon.c index 1c47486..28fdfb0 100644 --- a/drivers/sysreset/sysreset_syscon.c +++ b/drivers/sysreset/sysreset_syscon.c @@ -87,6 +87,6 @@ U_BOOT_DRIVER(syscon_reboot) = { .id = UCLASS_SYSRESET, .of_match = syscon_reboot_ids, .probe = syscon_reboot_probe, - .priv_auto_alloc_size = sizeof(struct syscon_reboot_priv), + .priv_auto = sizeof(struct syscon_reboot_priv), .ops = &syscon_reboot_ops, }; diff --git a/drivers/sysreset/sysreset_watchdog.c b/drivers/sysreset/sysreset_watchdog.c index d500d41..0dc2d8b 100644 --- a/drivers/sysreset/sysreset_watchdog.c +++ b/drivers/sysreset/sysreset_watchdog.c @@ -54,6 +54,6 @@ U_BOOT_DRIVER(wdt_reboot) = { .id = UCLASS_SYSRESET, .of_match = wdt_reboot_ids, .ops = &wdt_reboot_ops, - .priv_auto_alloc_size = sizeof(struct wdt_reboot_priv), + .priv_auto = sizeof(struct wdt_reboot_priv), .probe = wdt_reboot_probe, }; diff --git a/drivers/sysreset/sysreset_x86.c b/drivers/sysreset/sysreset_x86.c index 7682ffb..8042f39 100644 --- a/drivers/sysreset/sysreset_x86.c +++ b/drivers/sysreset/sysreset_x86.c @@ -13,10 +13,7 @@ #include <acpi/acpi_s3.h> #include <asm/io.h> #include <asm/processor.h> - -struct x86_sysreset_platdata { - struct udevice *pch; -}; +#include <asm/sysreset.h> /* * Power down the machine by using the power management sleep control @@ -30,7 +27,7 @@ struct x86_sysreset_platdata { */ int pch_sysreset_power_off(struct udevice *dev) { - struct x86_sysreset_platdata *plat = dev_get_platdata(dev); + struct x86_sysreset_plat *plat = dev_get_plat(dev); struct pch_pmbase_info pm; u32 reg32; int ret; @@ -130,7 +127,7 @@ void __efi_runtime EFIAPI efi_reset_system( static int x86_sysreset_probe(struct udevice *dev) { - struct x86_sysreset_platdata *plat = dev_get_platdata(dev); + struct x86_sysreset_plat *plat = dev_get_plat(dev); /* Locate the PCH if there is one. It isn't essential */ uclass_first_device(UCLASS_PCH, &plat->pch); @@ -154,5 +151,5 @@ U_BOOT_DRIVER(x86_reset) = { .of_match = x86_sysreset_ids, .ops = &x86_sysreset_ops, .probe = x86_sysreset_probe, - .platdata_auto_alloc_size = sizeof(struct x86_sysreset_platdata), + .plat_auto = sizeof(struct x86_sysreset_plat), }; diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index 66ade37..b898c32 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -297,7 +297,7 @@ static u32 call_err_to_res(u32 call_err) static u32 do_call_with_arg(struct udevice *dev, struct optee_msg_arg *arg) { - struct optee_pdata *pdata = dev_get_platdata(dev); + struct optee_pdata *pdata = dev_get_plat(dev); struct rpc_param param = { .a0 = OPTEE_SMC_CALL_WITH_ARG }; void *page_list = NULL; @@ -592,7 +592,7 @@ static optee_invoke_fn *get_invoke_func(struct udevice *dev) const char *method; debug("optee: looking for conduit method in DT.\n"); - method = ofnode_get_property(dev->node, "method", NULL); + method = ofnode_get_property(dev_ofnode(dev), "method", NULL); if (!method) { debug("optee: missing \"method\" property\n"); return ERR_PTR(-ENXIO); @@ -607,9 +607,9 @@ static optee_invoke_fn *get_invoke_func(struct udevice *dev) return ERR_PTR(-EINVAL); } -static int optee_ofdata_to_platdata(struct udevice *dev) +static int optee_of_to_plat(struct udevice *dev) { - struct optee_pdata *pdata = dev_get_platdata(dev); + struct optee_pdata *pdata = dev_get_plat(dev); pdata->invoke_fn = get_invoke_func(dev); if (IS_ERR(pdata->invoke_fn)) @@ -620,7 +620,7 @@ static int optee_ofdata_to_platdata(struct udevice *dev) static int optee_probe(struct udevice *dev) { - struct optee_pdata *pdata = dev_get_platdata(dev); + struct optee_pdata *pdata = dev_get_plat(dev); u32 sec_caps; if (!is_optee_api(pdata->invoke_fn)) { @@ -658,9 +658,9 @@ U_BOOT_DRIVER(optee) = { .name = "optee", .id = UCLASS_TEE, .of_match = optee_match, - .ofdata_to_platdata = optee_ofdata_to_platdata, + .of_to_plat = optee_of_to_plat, .probe = optee_probe, .ops = &optee_ops, - .platdata_auto_alloc_size = sizeof(struct optee_pdata), - .priv_auto_alloc_size = sizeof(struct optee_private), + .plat_auto = sizeof(struct optee_pdata), + .priv_auto = sizeof(struct optee_private), }; diff --git a/drivers/tee/sandbox.c b/drivers/tee/sandbox.c index 4b91e7d..e1ba027 100644 --- a/drivers/tee/sandbox.c +++ b/drivers/tee/sandbox.c @@ -385,7 +385,7 @@ U_BOOT_DRIVER(sandbox_tee) = { .id = UCLASS_TEE, .of_match = sandbox_tee_match, .ops = &sandbox_tee_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_tee_state), + .priv_auto = sizeof(struct sandbox_tee_state), .probe = sandbox_tee_probe, .remove = sandbox_tee_remove, }; diff --git a/drivers/tee/tee-uclass.c b/drivers/tee/tee-uclass.c index 112e216..2cc6b6c 100644 --- a/drivers/tee/tee-uclass.c +++ b/drivers/tee/tee-uclass.c @@ -205,7 +205,7 @@ static int tee_pre_remove(struct udevice *dev) UCLASS_DRIVER(tee) = { .id = UCLASS_TEE, .name = "tee", - .per_device_auto_alloc_size = sizeof(struct tee_uclass_priv), + .per_device_auto = sizeof(struct tee_uclass_priv), .pre_probe = tee_pre_probe, .pre_remove = tee_pre_remove, }; diff --git a/drivers/thermal/imx_scu_thermal.c b/drivers/thermal/imx_scu_thermal.c index 83ec753..b785be7 100644 --- a/drivers/thermal/imx_scu_thermal.c +++ b/drivers/thermal/imx_scu_thermal.c @@ -33,7 +33,7 @@ static int read_temperature(struct udevice *dev, int *temp) sc_rsrc_t *sensor_rsrc = (sc_rsrc_t *)dev_get_driver_data(dev); - struct imx_sc_thermal_plat *pdata = dev_get_platdata(dev); + struct imx_sc_thermal_plat *pdata = dev_get_plat(dev); if (!temp) return -EINVAL; @@ -52,7 +52,7 @@ static int read_temperature(struct udevice *dev, int *temp) int imx_sc_thermal_get_temp(struct udevice *dev, int *temp) { - struct imx_sc_thermal_plat *pdata = dev_get_platdata(dev); + struct imx_sc_thermal_plat *pdata = dev_get_plat(dev); int cpu_temp = 0; int ret; @@ -89,7 +89,7 @@ static int imx_sc_thermal_probe(struct udevice *dev) static int imx_sc_thermal_bind(struct udevice *dev) { - struct imx_sc_thermal_plat *pdata = dev_get_platdata(dev); + struct imx_sc_thermal_plat *pdata = dev_get_plat(dev); int reg, ret; int offset; const char *name; @@ -126,9 +126,9 @@ static int imx_sc_thermal_bind(struct udevice *dev) return 0; } -static int imx_sc_thermal_ofdata_to_platdata(struct udevice *dev) +static int imx_sc_thermal_of_to_plat(struct udevice *dev) { - struct imx_sc_thermal_plat *pdata = dev_get_platdata(dev); + struct imx_sc_thermal_plat *pdata = dev_get_plat(dev); struct fdtdec_phandle_args args; const char *type; int ret; @@ -210,7 +210,7 @@ U_BOOT_DRIVER(imx_sc_thermal) = { .of_match = imx_sc_thermal_ids, .bind = imx_sc_thermal_bind, .probe = imx_sc_thermal_probe, - .ofdata_to_platdata = imx_sc_thermal_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct imx_sc_thermal_plat), + .of_to_plat = imx_sc_thermal_of_to_plat, + .plat_auto = sizeof(struct imx_sc_thermal_plat), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 101bd5e..2f6343e 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -52,7 +52,7 @@ static int read_cpu_temperature(struct udevice *dev) { int temperature; unsigned int reg, n_meas; - const struct imx_thermal_plat *pdata = dev_get_platdata(dev); + const struct imx_thermal_plat *pdata = dev_get_plat(dev); struct anatop_regs *anatop = (struct anatop_regs *)pdata->regs; struct thermal_data *priv = dev_get_priv(dev); u32 fuse = priv->fuse; @@ -237,7 +237,7 @@ static int imx_thermal_probe(struct udevice *dev) { unsigned int fuse = ~0; - const struct imx_thermal_plat *pdata = dev_get_platdata(dev); + const struct imx_thermal_plat *pdata = dev_get_plat(dev); struct thermal_data *priv = dev_get_priv(dev); /* Read Temperature calibration data fuse */ @@ -274,6 +274,6 @@ U_BOOT_DRIVER(imx_thermal) = { .id = UCLASS_THERMAL, .ops = &imx_thermal_ops, .probe = imx_thermal_probe, - .priv_auto_alloc_size = sizeof(struct thermal_data), + .priv_auto = sizeof(struct thermal_data), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/thermal/imx_tmu.c b/drivers/thermal/imx_tmu.c index 936068c..1bd0340 100644 --- a/drivers/thermal/imx_tmu.c +++ b/drivers/thermal/imx_tmu.c @@ -126,7 +126,7 @@ struct imx_tmu_plat { static int read_temperature(struct udevice *dev, int *temp) { - struct imx_tmu_plat *pdata = dev_get_platdata(dev); + struct imx_tmu_plat *pdata = dev_get_plat(dev); ulong drv_data = dev_get_driver_data(dev); u32 val; u32 retry = 10; @@ -175,7 +175,7 @@ static int read_temperature(struct udevice *dev, int *temp) int imx_tmu_get_temp(struct udevice *dev, int *temp) { - struct imx_tmu_plat *pdata = dev_get_platdata(dev); + struct imx_tmu_plat *pdata = dev_get_plat(dev); int cpu_tmp = 0; int ret; @@ -206,7 +206,7 @@ static int imx_tmu_calibration(struct udevice *dev) int i, val, len, ret; u32 range[4]; const fdt32_t *calibration; - struct imx_tmu_plat *pdata = dev_get_platdata(dev); + struct imx_tmu_plat *pdata = dev_get_plat(dev); ulong drv_data = dev_get_driver_data(dev); debug("%s\n", __func__); @@ -248,7 +248,7 @@ void __weak imx_tmu_arch_init(void *reg_base) static void imx_tmu_init(struct udevice *dev) { - struct imx_tmu_plat *pdata = dev_get_platdata(dev); + struct imx_tmu_plat *pdata = dev_get_plat(dev); ulong drv_data = dev_get_driver_data(dev); debug("%s\n", __func__); @@ -282,7 +282,7 @@ static void imx_tmu_init(struct udevice *dev) static int imx_tmu_enable_msite(struct udevice *dev) { - struct imx_tmu_plat *pdata = dev_get_platdata(dev); + struct imx_tmu_plat *pdata = dev_get_plat(dev); ulong drv_data = dev_get_driver_data(dev); u32 reg; @@ -338,7 +338,7 @@ static int imx_tmu_enable_msite(struct udevice *dev) static int imx_tmu_bind(struct udevice *dev) { - struct imx_tmu_plat *pdata = dev_get_platdata(dev); + struct imx_tmu_plat *pdata = dev_get_plat(dev); int ret; ofnode node, offset; const char *name; @@ -370,7 +370,7 @@ static int imx_tmu_bind(struct udevice *dev) static int imx_tmu_parse_fdt(struct udevice *dev) { - struct imx_tmu_plat *pdata = dev_get_platdata(dev), *p_parent_data; + struct imx_tmu_plat *pdata = dev_get_plat(dev), *p_parent_data; struct ofnode_phandle_args args; ofnode trips_np; int ret; @@ -385,7 +385,7 @@ static int imx_tmu_parse_fdt(struct udevice *dev) return 0; } - p_parent_data = dev_get_platdata(dev->parent); + p_parent_data = dev_get_plat(dev->parent); if (p_parent_data->zone_node) pdata->regs = p_parent_data->regs; @@ -430,7 +430,7 @@ static int imx_tmu_parse_fdt(struct udevice *dev) static int imx_tmu_probe(struct udevice *dev) { - struct imx_tmu_plat *pdata = dev_get_platdata(dev); + struct imx_tmu_plat *pdata = dev_get_plat(dev); int ret; ret = imx_tmu_parse_fdt(dev); @@ -463,6 +463,6 @@ U_BOOT_DRIVER(imx_tmu) = { .of_match = imx_tmu_ids, .bind = imx_tmu_bind, .probe = imx_tmu_probe, - .platdata_auto_alloc_size = sizeof(struct imx_tmu_plat), + .plat_auto = sizeof(struct imx_tmu_plat), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/thermal/ti-bandgap.c b/drivers/thermal/ti-bandgap.c index 8b332f1..0b533d4 100644 --- a/drivers/thermal/ti-bandgap.c +++ b/drivers/thermal/ti-bandgap.c @@ -194,5 +194,5 @@ U_BOOT_DRIVER(ti_bandgap_thermal) = { .ops = &ti_thermal_ops, .probe = ti_bandgap_probe, .of_match = of_ti_bandgap_match, - .priv_auto_alloc_size = sizeof(struct ti_bandgap), + .priv_auto = sizeof(struct ti_bandgap), }; diff --git a/drivers/timer/ag101p_timer.c b/drivers/timer/ag101p_timer.c index 23ad5b2..27cf9b0 100644 --- a/drivers/timer/ag101p_timer.c +++ b/drivers/timer/ag101p_timer.c @@ -58,13 +58,13 @@ struct atftmr_timer_regs { u32 int_mask; /* 0x38 */ }; -struct atftmr_timer_platdata { +struct atftmr_timer_plat { struct atftmr_timer_regs *regs; }; static u64 atftmr_timer_get_count(struct udevice *dev) { - struct atftmr_timer_platdata *plat = dev->platdata; + struct atftmr_timer_plat *plat = dev_get_plat(dev); struct atftmr_timer_regs *const regs = plat->regs; u32 val; val = readl(®s->t3_counter); @@ -73,7 +73,7 @@ static u64 atftmr_timer_get_count(struct udevice *dev) static int atftmr_timer_probe(struct udevice *dev) { - struct atftmr_timer_platdata *plat = dev->platdata; + struct atftmr_timer_plat *plat = dev_get_plat(dev); struct atftmr_timer_regs *const regs = plat->regs; u32 cr; writel(0, ®s->t3_load); @@ -88,9 +88,9 @@ static int atftmr_timer_probe(struct udevice *dev) return 0; } -static int atftme_timer_ofdata_to_platdata(struct udevice *dev) +static int atftme_timer_of_to_plat(struct udevice *dev) { - struct atftmr_timer_platdata *plat = dev_get_platdata(dev); + struct atftmr_timer_plat *plat = dev_get_plat(dev); plat->regs = map_physmem(dev_read_addr(dev), sizeof(struct atftmr_timer_regs), MAP_NOCACHE); @@ -110,8 +110,8 @@ U_BOOT_DRIVER(altera_timer) = { .name = "ag101p_timer", .id = UCLASS_TIMER, .of_match = ag101p_timer_ids, - .ofdata_to_platdata = atftme_timer_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct atftmr_timer_platdata), + .of_to_plat = atftme_timer_of_to_plat, + .plat_auto = sizeof(struct atftmr_timer_plat), .probe = atftmr_timer_probe, .ops = &ag101p_timer_ops, }; diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c index ccc164e..040dc65 100644 --- a/drivers/timer/altera_timer.c +++ b/drivers/timer/altera_timer.c @@ -28,13 +28,13 @@ struct altera_timer_regs { u32 snaph; /* Snapshot high */ }; -struct altera_timer_platdata { +struct altera_timer_plat { struct altera_timer_regs *regs; }; static u64 altera_timer_get_count(struct udevice *dev) { - struct altera_timer_platdata *plat = dev->platdata; + struct altera_timer_plat *plat = dev_get_plat(dev); struct altera_timer_regs *const regs = plat->regs; u32 val; @@ -49,7 +49,7 @@ static u64 altera_timer_get_count(struct udevice *dev) static int altera_timer_probe(struct udevice *dev) { - struct altera_timer_platdata *plat = dev->platdata; + struct altera_timer_plat *plat = dev_get_plat(dev); struct altera_timer_regs *const regs = plat->regs; writel(0, ®s->status); @@ -63,9 +63,9 @@ static int altera_timer_probe(struct udevice *dev) return 0; } -static int altera_timer_ofdata_to_platdata(struct udevice *dev) +static int altera_timer_of_to_plat(struct udevice *dev) { - struct altera_timer_platdata *plat = dev_get_platdata(dev); + struct altera_timer_plat *plat = dev_get_plat(dev); plat->regs = map_physmem(dev_read_addr(dev), sizeof(struct altera_timer_regs), @@ -87,8 +87,8 @@ U_BOOT_DRIVER(altera_timer) = { .name = "altera_timer", .id = UCLASS_TIMER, .of_match = altera_timer_ids, - .ofdata_to_platdata = altera_timer_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct altera_timer_platdata), + .of_to_plat = altera_timer_of_to_plat, + .plat_auto = sizeof(struct altera_timer_plat), .probe = altera_timer_probe, .ops = &altera_timer_ops, }; diff --git a/drivers/timer/andes_plmt_timer.c b/drivers/timer/andes_plmt_timer.c index cec8671..db2cf86 100644 --- a/drivers/timer/andes_plmt_timer.c +++ b/drivers/timer/andes_plmt_timer.c @@ -12,6 +12,7 @@ #include <dm.h> #include <timer.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <linux/err.h> /* mtime register */ @@ -19,7 +20,7 @@ static u64 andes_plmt_get_count(struct udevice *dev) { - return readq((void __iomem *)MTIME_REG(dev->priv)); + return readq((void __iomem *)MTIME_REG(dev_get_priv(dev))); } static const struct timer_ops andes_plmt_ops = { @@ -28,8 +29,8 @@ static const struct timer_ops andes_plmt_ops = { static int andes_plmt_probe(struct udevice *dev) { - dev->priv = dev_read_addr_ptr(dev); - if (!dev->priv) + dev_set_priv(dev, dev_read_addr_ptr(dev)); + if (!dev_get_priv(dev)) return -EINVAL; return timer_timebase_fallback(dev); diff --git a/drivers/timer/arc_timer.c b/drivers/timer/arc_timer.c index 2dea9f4..9049504 100644 --- a/drivers/timer/arc_timer.c +++ b/drivers/timer/arc_timer.c @@ -105,5 +105,5 @@ U_BOOT_DRIVER(arc_timer) = { .of_match = arc_timer_ids, .probe = arc_timer_probe, .ops = &arc_timer_ops, - .priv_auto_alloc_size = sizeof(struct arc_timer_priv), + .priv_auto = sizeof(struct arc_timer_priv), }; diff --git a/drivers/timer/ast_timer.c b/drivers/timer/ast_timer.c index 35369a4..78adc96 100644 --- a/drivers/timer/ast_timer.c +++ b/drivers/timer/ast_timer.c @@ -58,7 +58,7 @@ static u64 ast_timer_get_count(struct udevice *dev) return AST_TMC_RELOAD_VAL - readl(&priv->tmc->status); } -static int ast_timer_ofdata_to_platdata(struct udevice *dev) +static int ast_timer_of_to_plat(struct udevice *dev) { struct ast_timer_priv *priv = dev_get_priv(dev); @@ -86,7 +86,7 @@ U_BOOT_DRIVER(ast_timer) = { .id = UCLASS_TIMER, .of_match = ast_timer_ids, .probe = ast_timer_probe, - .priv_auto_alloc_size = sizeof(struct ast_timer_priv), - .ofdata_to_platdata = ast_timer_ofdata_to_platdata, + .priv_auto = sizeof(struct ast_timer_priv), + .of_to_plat = ast_timer_of_to_plat, .ops = &ast_timer_ops, }; diff --git a/drivers/timer/atcpit100_timer.c b/drivers/timer/atcpit100_timer.c index fcb8a45..fbc7fac 100644 --- a/drivers/timer/atcpit100_timer.c +++ b/drivers/timer/atcpit100_timer.c @@ -64,13 +64,13 @@ struct atctmr_timer_regs { u32 int_mask; /* 0x38 */ }; -struct atcpit_timer_platdata { +struct atcpit_timer_plat { u32 *regs; }; static u64 atcpit_timer_get_count(struct udevice *dev) { - struct atcpit_timer_platdata *plat = dev_get_platdata(dev); + struct atcpit_timer_plat *plat = dev_get_plat(dev); u32 val; val = ~(REG32_TMR(CH_CNT(1))+0xffffffff); return timer_conv_64(val); @@ -78,16 +78,16 @@ static u64 atcpit_timer_get_count(struct udevice *dev) static int atcpit_timer_probe(struct udevice *dev) { - struct atcpit_timer_platdata *plat = dev_get_platdata(dev); + struct atcpit_timer_plat *plat = dev_get_plat(dev); REG32_TMR(CH_REL(1)) = 0xffffffff; REG32_TMR(CH_CTL(1)) = APB_CLK|TMR_32; REG32_TMR(CH_EN) |= CH_TMR_EN(1 , 0); return 0; } -static int atcpit_timer_ofdata_to_platdata(struct udevice *dev) +static int atcpit_timer_of_to_plat(struct udevice *dev) { - struct atcpit_timer_platdata *plat = dev_get_platdata(dev); + struct atcpit_timer_plat *plat = dev_get_plat(dev); plat->regs = map_physmem(dev_read_addr(dev), 0x100 , MAP_NOCACHE); return 0; } @@ -105,8 +105,8 @@ U_BOOT_DRIVER(atcpit100_timer) = { .name = "atcpit100_timer", .id = UCLASS_TIMER, .of_match = atcpit_timer_ids, - .ofdata_to_platdata = atcpit_timer_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct atcpit_timer_platdata), + .of_to_plat = atcpit_timer_of_to_plat, + .plat_auto = sizeof(struct atcpit_timer_plat), .probe = atcpit_timer_probe, .ops = &atcpit_timer_ops, }; diff --git a/drivers/timer/atmel_pit_timer.c b/drivers/timer/atmel_pit_timer.c index 9f0ad1d..3178e58 100644 --- a/drivers/timer/atmel_pit_timer.c +++ b/drivers/timer/atmel_pit_timer.c @@ -21,13 +21,13 @@ struct atmel_pit_regs { u32 value_image; }; -struct atmel_pit_platdata { +struct atmel_pit_plat { struct atmel_pit_regs *regs; }; static u64 atmel_pit_get_count(struct udevice *dev) { - struct atmel_pit_platdata *plat = dev_get_platdata(dev); + struct atmel_pit_plat *plat = dev_get_plat(dev); struct atmel_pit_regs *const regs = plat->regs; u32 val = readl(®s->value_image); @@ -36,7 +36,7 @@ static u64 atmel_pit_get_count(struct udevice *dev) static int atmel_pit_probe(struct udevice *dev) { - struct atmel_pit_platdata *plat = dev_get_platdata(dev); + struct atmel_pit_plat *plat = dev_get_plat(dev); struct atmel_pit_regs *const regs = plat->regs; struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct clk clk; @@ -58,9 +58,9 @@ static int atmel_pit_probe(struct udevice *dev) return 0; } -static int atmel_pit_ofdata_to_platdata(struct udevice *dev) +static int atmel_pit_of_to_plat(struct udevice *dev) { - struct atmel_pit_platdata *plat = dev_get_platdata(dev); + struct atmel_pit_plat *plat = dev_get_plat(dev); plat->regs = dev_read_addr_ptr(dev); @@ -80,8 +80,8 @@ U_BOOT_DRIVER(atmel_pit) = { .name = "atmel_pit", .id = UCLASS_TIMER, .of_match = atmel_pit_ids, - .ofdata_to_platdata = atmel_pit_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct atmel_pit_platdata), + .of_to_plat = atmel_pit_of_to_plat, + .plat_auto = sizeof(struct atmel_pit_plat), .probe = atmel_pit_probe, .ops = &atmel_pit_ops, }; diff --git a/drivers/timer/cadence-ttc.c b/drivers/timer/cadence-ttc.c index bebb2c2..3cac2ec 100644 --- a/drivers/timer/cadence-ttc.c +++ b/drivers/timer/cadence-ttc.c @@ -84,7 +84,7 @@ static int cadence_ttc_probe(struct udevice *dev) return 0; } -static int cadence_ttc_ofdata_to_platdata(struct udevice *dev) +static int cadence_ttc_of_to_plat(struct udevice *dev) { struct cadence_ttc_priv *priv = dev_get_priv(dev); @@ -109,8 +109,8 @@ U_BOOT_DRIVER(cadence_ttc) = { .name = "cadence_ttc", .id = UCLASS_TIMER, .of_match = cadence_ttc_ids, - .ofdata_to_platdata = cadence_ttc_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct cadence_ttc_priv), + .of_to_plat = cadence_ttc_of_to_plat, + .priv_auto = sizeof(struct cadence_ttc_priv), .probe = cadence_ttc_probe, .ops = &cadence_ttc_ops, }; diff --git a/drivers/timer/dw-apb-timer.c b/drivers/timer/dw-apb-timer.c index 68bc258..9aed5dd 100644 --- a/drivers/timer/dw-apb-timer.c +++ b/drivers/timer/dw-apb-timer.c @@ -66,7 +66,7 @@ static int dw_apb_timer_probe(struct udevice *dev) return 0; } -static int dw_apb_timer_ofdata_to_platdata(struct udevice *dev) +static int dw_apb_timer_of_to_plat(struct udevice *dev) { struct dw_apb_timer_priv *priv = dev_get_priv(dev); @@ -97,7 +97,7 @@ U_BOOT_DRIVER(dw_apb_timer) = { .ops = &dw_apb_timer_ops, .probe = dw_apb_timer_probe, .of_match = dw_apb_timer_ids, - .ofdata_to_platdata = dw_apb_timer_ofdata_to_platdata, + .of_to_plat = dw_apb_timer_of_to_plat, .remove = dw_apb_timer_remove, - .priv_auto_alloc_size = sizeof(struct dw_apb_timer_priv), + .priv_auto = sizeof(struct dw_apb_timer_priv), }; diff --git a/drivers/timer/mchp-pit64b-timer.c b/drivers/timer/mchp-pit64b-timer.c index ad96209..c9806d7 100644 --- a/drivers/timer/mchp-pit64b-timer.c +++ b/drivers/timer/mchp-pit64b-timer.c @@ -100,7 +100,7 @@ U_BOOT_DRIVER(mchp_pit64b) = { .name = "mchp-pit64b", .id = UCLASS_TIMER, .of_match = mchp_pit64b_ids, - .priv_auto_alloc_size = sizeof(struct mchp_pit64b_priv), + .priv_auto = sizeof(struct mchp_pit64b_priv), .probe = mchp_pit64b_probe, .ops = &mchp_pit64b_ops, .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c index 6139252..2f2b8be 100644 --- a/drivers/timer/mpc83xx_timer.c +++ b/drivers/timer/mpc83xx_timer.c @@ -206,7 +206,7 @@ static u64 mpc83xx_timer_get_count(struct udevice *dev) static int mpc83xx_timer_probe(struct udevice *dev) { - struct timer_dev_priv *uc_priv = dev->uclass_priv; + struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct clk clock; int ret; @@ -244,5 +244,5 @@ U_BOOT_DRIVER(mpc83xx_timer) = { .of_match = mpc83xx_timer_ids, .probe = mpc83xx_timer_probe, .ops = &mpc83xx_timer_ops, - .priv_auto_alloc_size = sizeof(struct mpc83xx_timer_priv), + .priv_auto = sizeof(struct mpc83xx_timer_priv), }; diff --git a/drivers/timer/mtk_timer.c b/drivers/timer/mtk_timer.c index 74e9ea3..448a76a 100644 --- a/drivers/timer/mtk_timer.c +++ b/drivers/timer/mtk_timer.c @@ -78,7 +78,7 @@ U_BOOT_DRIVER(mtk_timer) = { .name = "mtk_timer", .id = UCLASS_TIMER, .of_match = mtk_timer_ids, - .priv_auto_alloc_size = sizeof(struct mtk_timer_priv), + .priv_auto = sizeof(struct mtk_timer_priv), .probe = mtk_timer_probe, .ops = &mtk_timer_ops, .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/timer/nomadik-mtu-timer.c b/drivers/timer/nomadik-mtu-timer.c index d7f7ca4..417b419 100644 --- a/drivers/timer/nomadik-mtu-timer.c +++ b/drivers/timer/nomadik-mtu-timer.c @@ -107,7 +107,7 @@ U_BOOT_DRIVER(nomadik_mtu) = { .name = "nomadik_mtu", .id = UCLASS_TIMER, .of_match = nomadik_mtu_ids, - .priv_auto_alloc_size = sizeof(struct nomadik_mtu_priv), + .priv_auto = sizeof(struct nomadik_mtu_priv), .probe = nomadik_mtu_probe, .ops = &nomadik_mtu_ops, }; diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c index 4eecb3e..7ac20d7 100644 --- a/drivers/timer/omap-timer.c +++ b/drivers/timer/omap-timer.c @@ -73,7 +73,7 @@ static int omap_timer_probe(struct udevice *dev) return 0; } -static int omap_timer_ofdata_to_platdata(struct udevice *dev) +static int omap_timer_of_to_plat(struct udevice *dev) { struct omap_timer_priv *priv = dev_get_priv(dev); @@ -99,8 +99,8 @@ U_BOOT_DRIVER(omap_timer) = { .name = "omap_timer", .id = UCLASS_TIMER, .of_match = omap_timer_ids, - .ofdata_to_platdata = omap_timer_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct omap_timer_priv), + .of_to_plat = omap_timer_of_to_plat, + .priv_auto = sizeof(struct omap_timer_priv), .probe = omap_timer_probe, .ops = &omap_timer_ops, }; diff --git a/drivers/timer/ostm_timer.c b/drivers/timer/ostm_timer.c index bb0636a..99bd36f 100644 --- a/drivers/timer/ostm_timer.c +++ b/drivers/timer/ostm_timer.c @@ -63,7 +63,7 @@ static int ostm_probe(struct udevice *dev) return 0; } -static int ostm_ofdata_to_platdata(struct udevice *dev) +static int ostm_of_to_plat(struct udevice *dev) { struct ostm_priv *priv = dev_get_priv(dev); @@ -87,6 +87,6 @@ U_BOOT_DRIVER(ostm_timer) = { .ops = &ostm_ops, .probe = ostm_probe, .of_match = ostm_ids, - .ofdata_to_platdata = ostm_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct ostm_priv), + .of_to_plat = ostm_of_to_plat, + .priv_auto = sizeof(struct ostm_priv), }; diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c index 53cdf09..8d3eceb 100644 --- a/drivers/timer/rockchip_timer.c +++ b/drivers/timer/rockchip_timer.c @@ -97,7 +97,7 @@ static u64 rockchip_timer_get_count(struct udevice *dev) return ~0ull - cntr; } -static int rockchip_clk_ofdata_to_platdata(struct udevice *dev) +static int rockchip_clk_of_to_plat(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct rockchip_timer_priv *priv = dev_get_priv(dev); @@ -139,7 +139,7 @@ static int rockchip_timer_probe(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_PLATDATA) struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct rockchip_timer_priv *priv = dev_get_priv(dev); - struct rockchip_timer_plat *plat = dev_get_platdata(dev); + struct rockchip_timer_plat *plat = dev_get_plat(dev); priv->timer = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]); uc_priv->clock_rate = plat->dtd.clock_frequency; @@ -165,9 +165,9 @@ U_BOOT_DRIVER(rockchip_rk3368_timer) = { .of_match = rockchip_timer_ids, .probe = rockchip_timer_probe, .ops = &rockchip_timer_ops, - .priv_auto_alloc_size = sizeof(struct rockchip_timer_priv), + .priv_auto = sizeof(struct rockchip_timer_priv), #if CONFIG_IS_ENABLED(OF_PLATDATA) - .platdata_auto_alloc_size = sizeof(struct rockchip_timer_plat), + .plat_auto = sizeof(struct rockchip_timer_plat), #endif - .ofdata_to_platdata = rockchip_clk_ofdata_to_platdata, + .of_to_plat = rockchip_clk_of_to_plat, }; diff --git a/drivers/timer/sandbox_timer.c b/drivers/timer/sandbox_timer.c index 135c0f3..2075cd4 100644 --- a/drivers/timer/sandbox_timer.c +++ b/drivers/timer/sandbox_timer.c @@ -65,6 +65,6 @@ U_BOOT_DRIVER(sandbox_timer) = { }; /* This is here in case we don't have a device tree */ -U_BOOT_DEVICE(sandbox_timer_non_fdt) = { +U_BOOT_DRVINFO(sandbox_timer_non_fdt) = { .name = "sandbox_timer", }; diff --git a/drivers/timer/sifive_clint_timer.c b/drivers/timer/sifive_clint_timer.c index 00ce0f0..de23b85 100644 --- a/drivers/timer/sifive_clint_timer.c +++ b/drivers/timer/sifive_clint_timer.c @@ -9,6 +9,7 @@ #include <dm.h> #include <timer.h> #include <asm/io.h> +#include <dm/device-internal.h> #include <linux/err.h> /* mtime register */ @@ -16,7 +17,7 @@ static u64 sifive_clint_get_count(struct udevice *dev) { - return readq((void __iomem *)MTIME_REG(dev->priv)); + return readq((void __iomem *)MTIME_REG(dev_get_priv(dev))); } static const struct timer_ops sifive_clint_ops = { @@ -25,8 +26,8 @@ static const struct timer_ops sifive_clint_ops = { static int sifive_clint_probe(struct udevice *dev) { - dev->priv = dev_read_addr_ptr(dev); - if (!dev->priv) + dev_set_priv(dev, dev_read_addr_ptr(dev)); + if (!dev_get_priv(dev)) return -EINVAL; return timer_timebase_fallback(dev); diff --git a/drivers/timer/sti-timer.c b/drivers/timer/sti-timer.c index 9d95f56..87444a0 100644 --- a/drivers/timer/sti-timer.c +++ b/drivers/timer/sti-timer.c @@ -79,7 +79,7 @@ U_BOOT_DRIVER(sti_timer) = { .name = "sti_timer", .id = UCLASS_TIMER, .of_match = sti_timer_ids, - .priv_auto_alloc_size = sizeof(struct sti_timer_priv), + .priv_auto = sizeof(struct sti_timer_priv), .probe = sti_timer_probe, .ops = &sti_timer_ops, }; diff --git a/drivers/timer/stm32_timer.c b/drivers/timer/stm32_timer.c index 2f5f8f4..215334f 100644 --- a/drivers/timer/stm32_timer.c +++ b/drivers/timer/stm32_timer.c @@ -129,7 +129,7 @@ U_BOOT_DRIVER(stm32_timer) = { .name = "stm32_timer", .id = UCLASS_TIMER, .of_match = stm32_timer_ids, - .priv_auto_alloc_size = sizeof(struct stm32_timer_priv), + .priv_auto = sizeof(struct stm32_timer_priv), .probe = stm32_timer_probe, .ops = &stm32_timer_ops, }; diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index 62d0e86..da1a72f 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -40,7 +40,7 @@ int notrace timer_get_count(struct udevice *dev, u64 *count) unsigned long notrace timer_get_rate(struct udevice *dev) { - struct timer_dev_priv *uc_priv = dev->uclass_priv; + struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); return uc_priv->clock_rate; } @@ -54,7 +54,7 @@ static int timer_pre_probe(struct udevice *dev) ulong ret; /* It is possible that a timer device has a null ofnode */ - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) return 0; err = clk_get_by_index(dev, 0, &timer_clk); @@ -90,7 +90,7 @@ static int timer_post_probe(struct udevice *dev) int timer_timebase_fallback(struct udevice *dev) { struct udevice *cpu; - struct cpu_platdata *cpu_plat; + struct cpu_plat *cpu_plat; struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); /* Did we get our clock rate from the device tree? */ @@ -103,7 +103,7 @@ int timer_timebase_fallback(struct udevice *dev) if (!cpu) return -ENODEV; - cpu_plat = dev_get_parent_platdata(cpu); + cpu_plat = dev_get_parent_plat(cpu); if (!cpu_plat) return -ENODEV; @@ -176,5 +176,5 @@ UCLASS_DRIVER(timer) = { .pre_probe = timer_pre_probe, .flags = DM_UC_FLAG_SEQ_ALIAS, .post_probe = timer_post_probe, - .per_device_auto_alloc_size = sizeof(struct timer_dev_priv), + .per_device_auto = sizeof(struct timer_dev_priv), }; diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index e367770..706d52b 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c @@ -477,15 +477,17 @@ static const struct timer_ops tsc_timer_ops = { .get_count = tsc_timer_get_count, }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id tsc_timer_ids[] = { { .compatible = "x86,tsc-timer", }, { } }; +#endif U_BOOT_DRIVER(x86_tsc_timer) = { .name = "x86_tsc_timer", .id = UCLASS_TIMER, - .of_match = tsc_timer_ids, + .of_match = of_match_ptr(tsc_timer_ids), .probe = tsc_timer_probe, .ops = &tsc_timer_ops, }; diff --git a/drivers/tpm/cr50_i2c.c b/drivers/tpm/cr50_i2c.c index a761e3d..ce61b72 100644 --- a/drivers/tpm/cr50_i2c.c +++ b/drivers/tpm/cr50_i2c.c @@ -547,7 +547,7 @@ static int claim_locality(struct udevice *dev, int loc) static int cr50_i2c_get_desc(struct udevice *dev, char *buf, int size) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); struct cr50_priv *priv = dev_get_priv(dev); return snprintf(buf, size, "cr50 TPM 2.0 (i2c %02x id %x) irq=%d", @@ -637,7 +637,7 @@ enum { LONG_TIMEOUT_MS = 2000, }; -static int cr50_i2c_ofdata_to_platdata(struct udevice *dev) +static int cr50_i2c_of_to_plat(struct udevice *dev) { struct tpm_chip_priv *upriv = dev_get_uclass_priv(dev); struct cr50_priv *priv = dev_get_priv(dev); @@ -725,10 +725,10 @@ U_BOOT_DRIVER(cr50_i2c) = { .id = UCLASS_TPM, .of_match = cr50_i2c_ids, .ops = &cr50_i2c_ops, - .ofdata_to_platdata = cr50_i2c_ofdata_to_platdata, + .of_to_plat = cr50_i2c_of_to_plat, .probe = cr50_i2c_probe, .remove = cr50_i2c_cleanup, - .priv_auto_alloc_size = sizeof(struct cr50_priv), + .priv_auto = sizeof(struct cr50_priv), ACPI_OPS_PTR(&cr50_acpi_ops) .flags = DM_FLAG_OS_PREPARE, }; diff --git a/drivers/tpm/tpm-uclass.c b/drivers/tpm/tpm-uclass.c index 6ea795b..beb0fa3 100644 --- a/drivers/tpm/tpm-uclass.c +++ b/drivers/tpm/tpm-uclass.c @@ -141,5 +141,5 @@ UCLASS_DRIVER(tpm) = { #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .post_bind = dm_scan_fdt_dev, #endif - .per_device_auto_alloc_size = sizeof(struct tpm_chip_priv), + .per_device_auto = sizeof(struct tpm_chip_priv), }; diff --git a/drivers/tpm/tpm2_ftpm_tee.c b/drivers/tpm/tpm2_ftpm_tee.c index 3197e0e..53e59f4 100644 --- a/drivers/tpm/tpm2_ftpm_tee.c +++ b/drivers/tpm/tpm2_ftpm_tee.c @@ -247,5 +247,5 @@ U_BOOT_DRIVER(ftpm_tee) = { .probe = ftpm_tee_probe, .remove = ftpm_tee_remove, .flags = DM_FLAG_OS_PREPARE, - .priv_auto_alloc_size = sizeof(struct ftpm_tee_private), + .priv_auto = sizeof(struct ftpm_tee_private), }; diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c index 41a15bd..c74bacf 100644 --- a/drivers/tpm/tpm2_tis_sandbox.c +++ b/drivers/tpm/tpm2_tis_sandbox.c @@ -625,5 +625,5 @@ U_BOOT_DRIVER(sandbox_tpm2) = { .of_match = sandbox_tpm2_ids, .ops = &sandbox_tpm2_ops, .probe = sandbox_tpm2_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_tpm2), + .priv_auto = sizeof(struct sandbox_tpm2), }; diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c index 0045bed..4b33ac8 100644 --- a/drivers/tpm/tpm2_tis_spi.c +++ b/drivers/tpm/tpm2_tis_spi.c @@ -686,5 +686,5 @@ U_BOOT_DRIVER(tpm_tis_spi) = { .ops = &tpm_tis_spi_ops, .probe = tpm_tis_spi_probe, .remove = tpm_tis_spi_remove, - .priv_auto_alloc_size = sizeof(struct tpm_chip), + .priv_auto = sizeof(struct tpm_chip), }; diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c index f47813e..f414e56 100644 --- a/drivers/tpm/tpm_tis_infineon.c +++ b/drivers/tpm/tpm_tis_infineon.c @@ -633,5 +633,5 @@ U_BOOT_DRIVER(tpm_tis_i2c) = { .of_match = tpm_tis_i2c_ids, .ops = &tpm_tis_i2c_ops, .probe = tpm_tis_i2c_probe, - .priv_auto_alloc_size = sizeof(struct tpm_chip), + .priv_auto = sizeof(struct tpm_chip), }; diff --git a/drivers/tpm/tpm_tis_lpc.c b/drivers/tpm/tpm_tis_lpc.c index 2dd374c..003c0d8 100644 --- a/drivers/tpm/tpm_tis_lpc.c +++ b/drivers/tpm/tpm_tis_lpc.c @@ -475,5 +475,5 @@ U_BOOT_DRIVER(tpm_tis_lpc) = { .of_match = tpm_tis_lpc_ids, .ops = &tpm_tis_lpc_ops, .probe = tpm_tis_lpc_probe, - .priv_auto_alloc_size = sizeof(struct tpm_tis_lpc_priv), + .priv_auto = sizeof(struct tpm_tis_lpc_priv), }; diff --git a/drivers/tpm/tpm_tis_sandbox.c b/drivers/tpm/tpm_tis_sandbox.c index e167d0a..67139ce 100644 --- a/drivers/tpm/tpm_tis_sandbox.c +++ b/drivers/tpm/tpm_tis_sandbox.c @@ -361,5 +361,5 @@ U_BOOT_DRIVER(google_sandbox_tpm) = { .of_match = sandbox_tpm_ids, .ops = &sandbox_tpm_ops, .probe = sandbox_tpm_probe, - .priv_auto_alloc_size = sizeof(struct tpm_state), + .priv_auto = sizeof(struct tpm_state), }; diff --git a/drivers/tpm/tpm_tis_st33zp24_i2c.c b/drivers/tpm/tpm_tis_st33zp24_i2c.c index a253ee1..e0eeabb 100644 --- a/drivers/tpm/tpm_tis_st33zp24_i2c.c +++ b/drivers/tpm/tpm_tis_st33zp24_i2c.c @@ -542,5 +542,5 @@ U_BOOT_DRIVER(st33zp24_i2c) = { .probe = st33zp24_i2c_probe, .remove = st33zp24_i2c_remove, .ops = &st33zp24_i2c_tpm_ops, - .priv_auto_alloc_size = sizeof(struct tpm_chip), + .priv_auto = sizeof(struct tpm_chip), }; diff --git a/drivers/tpm/tpm_tis_st33zp24_spi.c b/drivers/tpm/tpm_tis_st33zp24_spi.c index ef54e3b..f0de8a6 100644 --- a/drivers/tpm/tpm_tis_st33zp24_spi.c +++ b/drivers/tpm/tpm_tis_st33zp24_spi.c @@ -116,7 +116,7 @@ static int st33zp24_spi_write(struct udevice *dev, u8 tpm_register, { int total_length = 0, ret; struct spi_slave *slave = dev_get_parent_priv(dev); - struct st33zp24_spi_phy *phy = dev_get_platdata(dev); + struct st33zp24_spi_phy *phy = dev_get_plat(dev); u8 *tx_buf = (u8 *)phy->tx_buf; u8 *rx_buf = phy->rx_buf; @@ -167,7 +167,7 @@ static u8 st33zp24_spi_read8_reg(struct udevice *dev, u8 tpm_register, { int total_length = 0, ret; struct spi_slave *slave = dev_get_parent_priv(dev); - struct st33zp24_spi_phy *phy = dev_get_platdata(dev); + struct st33zp24_spi_phy *phy = dev_get_plat(dev); u8 *tx_buf = (u8 *)phy->tx_buf; u8 *rx_buf = phy->rx_buf; @@ -223,7 +223,7 @@ static int st33zp24_spi_evaluate_latency(struct udevice *dev) { int latency = 1, status = 0; u8 data = 0; - struct st33zp24_spi_phy *phy = dev_get_platdata(dev); + struct st33zp24_spi_phy *phy = dev_get_plat(dev); while (!status && latency < MAX_SPI_LATENCY) { phy->latency = latency; @@ -562,7 +562,7 @@ static int st33zp24_spi_cleanup(struct udevice *dev) static int st33zp24_spi_init(struct udevice *dev) { struct tpm_chip *chip = dev_get_priv(dev); - struct st33zp24_spi_phy *phy = dev_get_platdata(dev); + struct st33zp24_spi_phy *phy = dev_get_plat(dev); chip->is_open = 1; @@ -670,6 +670,6 @@ U_BOOT_DRIVER(st33zp24_spi_spi) = { .probe = st33zp24_spi_probe, .remove = st33zp24_spi_remove, .ops = &st33zp24_spi_tpm_ops, - .priv_auto_alloc_size = sizeof(struct tpm_chip), - .platdata_auto_alloc_size = sizeof(struct st33zp24_spi_phy), + .priv_auto = sizeof(struct tpm_chip), + .plat_auto = sizeof(struct st33zp24_spi_phy), }; diff --git a/drivers/ufs/ufs-uclass.c b/drivers/ufs/ufs-uclass.c index 920bfa6..034d14f 100644 --- a/drivers/ufs/ufs-uclass.c +++ b/drivers/ufs/ufs-uclass.c @@ -12,5 +12,5 @@ UCLASS_DRIVER(ufs) = { .id = UCLASS_UFS, .name = "ufs", - .per_device_auto_alloc_size = sizeof(struct ufs_hba), + .per_device_auto = sizeof(struct ufs_hba), }; diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 92b7e9f..13e730b 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -1865,7 +1865,7 @@ int ufs_start(struct ufs_hba *hba) int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops) { struct ufs_hba *hba = dev_get_uclass_priv(ufs_dev); - struct scsi_platdata *scsi_plat; + struct scsi_plat *scsi_plat; struct udevice *scsi_dev; int err; @@ -1873,7 +1873,7 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops) if (!scsi_dev) return -ENODEV; - scsi_plat = dev_get_uclass_platdata(scsi_dev); + scsi_plat = dev_get_uclass_plat(scsi_dev); scsi_plat->max_id = UFSHCD_MAX_ID; scsi_plat->max_lun = UFS_MAX_LUNS; scsi_plat->max_bytes_per_req = UFS_MAX_BYTES; diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index cd7b211..7b205c5 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -87,7 +87,7 @@ static inline void cdns_ti_writel(struct cdns_ti *data, u32 offset, u32 value) static int cdns_ti_probe(struct udevice *dev) { - struct cdns_ti *data = dev_get_platdata(dev); + struct cdns_ti *data = dev_get_plat(dev); struct clk usb2_refclk; int modestrap_mode; unsigned long rate; @@ -167,7 +167,7 @@ static int cdns_ti_probe(struct udevice *dev) static int cdns_ti_remove(struct udevice *dev) { - struct cdns_ti *data = dev_get_platdata(dev); + struct cdns_ti *data = dev_get_plat(dev); u32 reg; /* put device back to RESET*/ @@ -190,6 +190,6 @@ U_BOOT_DRIVER(cdns_ti) = { .bind = cdns3_bind, .probe = cdns_ti_probe, .remove = cdns_ti_remove, - .platdata_auto_alloc_size = sizeof(struct cdns_ti), + .plat_auto = sizeof(struct cdns_ti), .flags = DM_FLAG_OS_PREPARE, }; diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index ea86a25..798a217 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -110,7 +110,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns) enum usb_dr_mode dr_mode; int ret = 0; - dr_mode = usb_get_dr_mode(dev->node); + dr_mode = usb_get_dr_mode(dev_ofnode(dev)); cdns->role = USB_ROLE_NONE; /* @@ -393,7 +393,7 @@ int cdns3_bind(struct udevice *parent) ofnode node; int ret; - node = ofnode_by_compatible(parent->node, "cdns,usb3"); + node = ofnode_by_compatible(dev_ofnode(parent), "cdns,usb3"); if (!ofnode_valid(node)) { ret = -ENODEV; goto fail; @@ -461,7 +461,7 @@ U_BOOT_DRIVER(cdns_usb3_peripheral) = { .of_match = cdns3_ids, .probe = cdns3_gadget_probe, .remove = cdns3_gadget_remove, - .priv_auto_alloc_size = sizeof(struct cdns3_gadget_priv), + .priv_auto = sizeof(struct cdns3_gadget_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif @@ -492,7 +492,7 @@ U_BOOT_DRIVER(cdns_usb3_host) = { .of_match = cdns3_ids, .probe = cdns3_host_probe, .remove = cdns3_host_remove, - .priv_auto_alloc_size = sizeof(struct cdns3_host_priv), + .priv_auto = sizeof(struct cdns3_host_priv), .ops = &xhci_usb_ops, .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 2e00353..dfd7cf6 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -905,7 +905,7 @@ void dwc3_of_parse(struct dwc3 *dwc) */ hird_threshold = 12; - dwc->hsphy_mode = usb_get_phy_mode(dev->node); + dwc->hsphy_mode = usb_get_phy_mode(dev_ofnode(dev)); dwc->has_lpm_erratum = dev_read_bool(dev, "snps,has-lpm-erratum"); diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 222358d..30f835e 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -53,9 +53,9 @@ static int dwc3_generic_probe(struct udevice *dev, struct dwc3_generic_priv *priv) { int rc; - struct dwc3_generic_plat *plat = dev_get_platdata(dev); + struct dwc3_generic_plat *plat = dev_get_plat(dev); struct dwc3 *dwc3 = &priv->dwc3; - struct dwc3_glue_data *glue = dev_get_platdata(dev->parent); + struct dwc3_glue_data *glue = dev_get_plat(dev->parent); dwc3->dev = dev; dwc3->maximum_speed = plat->maximum_speed; @@ -105,10 +105,10 @@ static int dwc3_generic_remove(struct udevice *dev, return 0; } -static int dwc3_generic_ofdata_to_platdata(struct udevice *dev) +static int dwc3_generic_of_to_plat(struct udevice *dev) { - struct dwc3_generic_plat *plat = dev_get_platdata(dev); - ofnode node = dev->node; + struct dwc3_generic_plat *plat = dev_get_plat(dev); + ofnode node = dev_ofnode(dev); plat->base = dev_read_addr(dev); @@ -155,11 +155,11 @@ static int dwc3_generic_peripheral_remove(struct udevice *dev) U_BOOT_DRIVER(dwc3_generic_peripheral) = { .name = "dwc3-generic-peripheral", .id = UCLASS_USB_GADGET_GENERIC, - .ofdata_to_platdata = dwc3_generic_ofdata_to_platdata, + .of_to_plat = dwc3_generic_of_to_plat, .probe = dwc3_generic_peripheral_probe, .remove = dwc3_generic_peripheral_remove, - .priv_auto_alloc_size = sizeof(struct dwc3_generic_priv), - .platdata_auto_alloc_size = sizeof(struct dwc3_generic_plat), + .priv_auto = sizeof(struct dwc3_generic_priv), + .plat_auto = sizeof(struct dwc3_generic_plat), }; #endif @@ -197,11 +197,11 @@ static int dwc3_generic_host_remove(struct udevice *dev) U_BOOT_DRIVER(dwc3_generic_host) = { .name = "dwc3-generic-host", .id = UCLASS_USB, - .ofdata_to_platdata = dwc3_generic_ofdata_to_platdata, + .of_to_plat = dwc3_generic_of_to_plat, .probe = dwc3_generic_host_probe, .remove = dwc3_generic_host_remove, - .priv_auto_alloc_size = sizeof(struct dwc3_generic_host_priv), - .platdata_auto_alloc_size = sizeof(struct dwc3_generic_plat), + .priv_auto = sizeof(struct dwc3_generic_host_priv), + .plat_auto = sizeof(struct dwc3_generic_plat), .ops = &xhci_usb_ops, .flags = DM_FLAG_ALLOC_PRIV_DMA, }; @@ -238,7 +238,7 @@ enum dwc3_omap_utmi_mode { u32 utmi_mode; u32 utmi_status_offset = USBOTGSS_UTMI_OTG_STATUS; - struct dwc3_glue_data *glue = dev_get_platdata(dev); + struct dwc3_glue_data *glue = dev_get_plat(dev); void *base = map_physmem(glue->regs, 0x10000, MAP_NOCACHE); if (device_is_compatible(dev, "ti,am437x-dwc3")) @@ -301,7 +301,7 @@ static int dwc3_glue_bind(struct udevice *parent) ofnode node; int ret; - ofnode_for_each_subnode(node, parent->node) { + ofnode_for_each_subnode(node, dev_ofnode(parent)) { const char *name = ofnode_get_name(node); enum usb_dr_mode dr_mode; struct udevice *dev; @@ -390,7 +390,7 @@ static int dwc3_glue_clk_init(struct udevice *dev, static int dwc3_glue_probe(struct udevice *dev) { struct dwc3_glue_ops *ops = (struct dwc3_glue_ops *)dev_get_driver_data(dev); - struct dwc3_glue_data *glue = dev_get_platdata(dev); + struct dwc3_glue_data *glue = dev_get_plat(dev); struct udevice *child = NULL; int index = 0; int ret; @@ -418,7 +418,7 @@ static int dwc3_glue_probe(struct udevice *dev) while (child) { enum usb_dr_mode dr_mode; - dr_mode = usb_get_dr_mode(child->node); + dr_mode = usb_get_dr_mode(dev_ofnode(child)); device_find_next_child(&child); if (ops && ops->select_dr_mode) ops->select_dr_mode(dev, index, dr_mode); @@ -430,7 +430,7 @@ static int dwc3_glue_probe(struct udevice *dev) static int dwc3_glue_remove(struct udevice *dev) { - struct dwc3_glue_data *glue = dev_get_platdata(dev); + struct dwc3_glue_data *glue = dev_get_plat(dev); reset_release_bulk(&glue->resets); @@ -460,6 +460,6 @@ U_BOOT_DRIVER(dwc3_generic_wrapper) = { .bind = dwc3_glue_bind, .probe = dwc3_glue_probe, .remove = dwc3_glue_remove, - .platdata_auto_alloc_size = sizeof(struct dwc3_glue_data), + .plat_auto = sizeof(struct dwc3_glue_data), }; diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index 6f0bac2..bd8bf22 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -258,7 +258,7 @@ static int dwc3_meson_g12a_usb_init(struct dwc3_meson_g12a *priv) int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode) { - struct dwc3_meson_g12a *priv = dev_get_platdata(dev); + struct dwc3_meson_g12a *priv = dev_get_plat(dev); if (!priv) return -EINVAL; @@ -356,7 +356,7 @@ static int dwc3_meson_g12a_clk_init(struct dwc3_meson_g12a *priv) static int dwc3_meson_g12a_probe(struct udevice *dev) { - struct dwc3_meson_g12a *priv = dev_get_platdata(dev); + struct dwc3_meson_g12a *priv = dev_get_plat(dev); int ret, i; priv->dev = dev; @@ -392,7 +392,7 @@ static int dwc3_meson_g12a_probe(struct udevice *dev) } #endif - priv->otg_mode = usb_get_dr_mode(dev->node); + priv->otg_mode = usb_get_dr_mode(dev_ofnode(dev)); ret = dwc3_meson_g12a_usb_init(priv); if (ret) @@ -431,7 +431,7 @@ err_phy_init: static int dwc3_meson_g12a_remove(struct udevice *dev) { - struct dwc3_meson_g12a *priv = dev_get_platdata(dev); + struct dwc3_meson_g12a *priv = dev_get_plat(dev); int i; reset_release_all(&priv->reset, 1); @@ -466,6 +466,6 @@ U_BOOT_DRIVER(dwc3_generic_wrapper) = { .of_match = dwc3_meson_g12a_ids, .probe = dwc3_meson_g12a_probe, .remove = dwc3_meson_g12a_remove, - .platdata_auto_alloc_size = sizeof(struct dwc3_meson_g12a), + .plat_auto = sizeof(struct dwc3_meson_g12a), }; diff --git a/drivers/usb/dwc3/dwc3-meson-gxl.c b/drivers/usb/dwc3/dwc3-meson-gxl.c index 92ee086..08467d6 100644 --- a/drivers/usb/dwc3/dwc3-meson-gxl.c +++ b/drivers/usb/dwc3/dwc3-meson-gxl.c @@ -196,7 +196,7 @@ static int dwc3_meson_gxl_usb_init(struct dwc3_meson_gxl *priv) int dwc3_meson_gxl_force_mode(struct udevice *dev, enum usb_dr_mode mode) { - struct dwc3_meson_gxl *priv = dev_get_platdata(dev); + struct dwc3_meson_gxl *priv = dev_get_plat(dev); if (!priv) return -EINVAL; @@ -295,7 +295,7 @@ static int dwc3_meson_gxl_clk_init(struct dwc3_meson_gxl *priv) static int dwc3_meson_gxl_probe(struct udevice *dev) { - struct dwc3_meson_gxl *priv = dev_get_platdata(dev); + struct dwc3_meson_gxl *priv = dev_get_plat(dev); int ret, i; priv->dev = dev; @@ -338,7 +338,7 @@ static int dwc3_meson_gxl_probe(struct udevice *dev) if (ret) return ret; - priv->otg_mode = usb_get_dr_mode(dev->node); + priv->otg_mode = usb_get_dr_mode(dev_ofnode(dev)); if (priv->otg_mode == USB_DR_MODE_PERIPHERAL) priv->otg_phy_mode = USB_DR_MODE_PERIPHERAL; @@ -384,7 +384,7 @@ err_phy_init: static int dwc3_meson_gxl_remove(struct udevice *dev) { - struct dwc3_meson_gxl *priv = dev_get_platdata(dev); + struct dwc3_meson_gxl *priv = dev_get_plat(dev); int i; reset_release_all(&priv->reset, 1); @@ -420,6 +420,6 @@ U_BOOT_DRIVER(dwc3_generic_wrapper) = { .of_match = dwc3_meson_gxl_ids, .probe = dwc3_meson_gxl_probe, .remove = dwc3_meson_gxl_remove, - .platdata_auto_alloc_size = sizeof(struct dwc3_meson_gxl), + .plat_auto = sizeof(struct dwc3_meson_gxl), }; diff --git a/drivers/usb/emul/sandbox_flash.c b/drivers/usb/emul/sandbox_flash.c index 9c305f4..edabc1b3 100644 --- a/drivers/usb/emul/sandbox_flash.c +++ b/drivers/usb/emul/sandbox_flash.c @@ -297,7 +297,7 @@ static int handle_ufi_command(struct sandbox_flash_plat *plat, static int sandbox_flash_bulk(struct udevice *dev, struct usb_device *udev, unsigned long pipe, void *buff, int len) { - struct sandbox_flash_plat *plat = dev_get_platdata(dev); + struct sandbox_flash_plat *plat = dev_get_plat(dev); struct sandbox_flash_priv *priv = dev_get_priv(dev); int ep = usb_pipeendpoint(pipe); struct umass_bbb_cbw *cbw = buff; @@ -366,9 +366,9 @@ err: return 0; } -static int sandbox_flash_ofdata_to_platdata(struct udevice *dev) +static int sandbox_flash_of_to_plat(struct udevice *dev) { - struct sandbox_flash_plat *plat = dev_get_platdata(dev); + struct sandbox_flash_plat *plat = dev_get_plat(dev); plat->pathname = dev_read_string(dev, "sandbox,filepath"); @@ -377,7 +377,7 @@ static int sandbox_flash_ofdata_to_platdata(struct udevice *dev) static int sandbox_flash_bind(struct udevice *dev) { - struct sandbox_flash_plat *plat = dev_get_platdata(dev); + struct sandbox_flash_plat *plat = dev_get_plat(dev); struct usb_string *fs; fs = plat->flash_strings; @@ -393,7 +393,7 @@ static int sandbox_flash_bind(struct udevice *dev) static int sandbox_flash_probe(struct udevice *dev) { - struct sandbox_flash_plat *plat = dev_get_platdata(dev); + struct sandbox_flash_plat *plat = dev_get_plat(dev); struct sandbox_flash_priv *priv = dev_get_priv(dev); priv->fd = os_open(plat->pathname, OS_O_RDONLY); @@ -419,8 +419,8 @@ U_BOOT_DRIVER(usb_sandbox_flash) = { .of_match = sandbox_usb_flash_ids, .bind = sandbox_flash_bind, .probe = sandbox_flash_probe, - .ofdata_to_platdata = sandbox_flash_ofdata_to_platdata, + .of_to_plat = sandbox_flash_of_to_plat, .ops = &sandbox_usb_flash_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_flash_priv), - .platdata_auto_alloc_size = sizeof(struct sandbox_flash_plat), + .priv_auto = sizeof(struct sandbox_flash_priv), + .plat_auto = sizeof(struct sandbox_flash_plat), }; diff --git a/drivers/usb/emul/sandbox_hub.c b/drivers/usb/emul/sandbox_hub.c index 21bf3bd..041ec37 100644 --- a/drivers/usb/emul/sandbox_hub.c +++ b/drivers/usb/emul/sandbox_hub.c @@ -13,8 +13,8 @@ /* We only support up to 8 */ #define SANDBOX_NUM_PORTS 4 -struct sandbox_hub_platdata { - struct usb_dev_platdata plat; +struct sandbox_hub_plat { + struct usb_dev_plat plat; int port; /* Port number (numbered from 0) */ }; @@ -129,9 +129,9 @@ static struct udevice *hub_find_device(struct udevice *hub, int port, for (device_find_first_child(hub, &dev); dev; device_find_next_child(&dev)) { - struct sandbox_hub_platdata *plat; + struct sandbox_hub_plat *plat; - plat = dev_get_parent_platdata(dev); + plat = dev_get_parent_plat(dev); if (plat->port == port) { gen_desc = plat->plat.desc_list; gen_desc = usb_emul_find_descriptor(gen_desc, @@ -304,8 +304,8 @@ static int sandbox_hub_bind(struct udevice *dev) static int sandbox_child_post_bind(struct udevice *dev) { - struct sandbox_hub_platdata *plat = dev_get_parent_platdata(dev); - struct usb_emul_platdata *emul = dev_get_uclass_platdata(dev); + struct sandbox_hub_plat *plat = dev_get_parent_plat(dev); + struct usb_emul_plat *emul = dev_get_uclass_plat(dev); plat->port = dev_read_u32_default(dev, "reg", -1); emul->port1 = plat->port + 1; @@ -328,8 +328,7 @@ U_BOOT_DRIVER(usb_sandbox_hub) = { .of_match = sandbox_usb_hub_ids, .bind = sandbox_hub_bind, .ops = &sandbox_usb_hub_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_hub_priv), - .per_child_platdata_auto_alloc_size = - sizeof(struct sandbox_hub_platdata), + .priv_auto = sizeof(struct sandbox_hub_priv), + .per_child_plat_auto = sizeof(struct sandbox_hub_plat), .child_post_bind = sandbox_child_post_bind, }; diff --git a/drivers/usb/emul/sandbox_keyb.c b/drivers/usb/emul/sandbox_keyb.c index f562fb7..5ec1e98 100644 --- a/drivers/usb/emul/sandbox_keyb.c +++ b/drivers/usb/emul/sandbox_keyb.c @@ -202,7 +202,7 @@ static int sandbox_keyb_interrupt(struct udevice *dev, struct usb_device *udev, static int sandbox_keyb_bind(struct udevice *dev) { - struct sandbox_keyb_plat *plat = dev_get_platdata(dev); + struct sandbox_keyb_plat *plat = dev_get_plat(dev); struct usb_string *fs; fs = plat->keyb_strings; @@ -241,6 +241,6 @@ U_BOOT_DRIVER(usb_sandbox_keyb) = { .bind = sandbox_keyb_bind, .probe = sandbox_keyb_probe, .ops = &sandbox_usb_keyb_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_keyb_priv), - .platdata_auto_alloc_size = sizeof(struct sandbox_keyb_plat), + .priv_auto = sizeof(struct sandbox_keyb_priv), + .plat_auto = sizeof(struct sandbox_keyb_plat), }; diff --git a/drivers/usb/emul/usb-emul-uclass.c b/drivers/usb/emul/usb-emul-uclass.c index e3419e2..f5d98b9 100644 --- a/drivers/usb/emul/usb-emul-uclass.c +++ b/drivers/usb/emul/usb-emul-uclass.c @@ -75,7 +75,7 @@ struct usb_generic_descriptor **usb_emul_find_descriptor( return ptr; } -static int usb_emul_get_descriptor(struct usb_dev_platdata *plat, int value, +static int usb_emul_get_descriptor(struct usb_dev_plat *plat, int value, void *buffer, int length) { struct usb_generic_descriptor **ptr; @@ -115,7 +115,7 @@ static int usb_emul_find_devnum(int devnum, int port1, struct udevice **emulp) if (ret) return ret; uclass_foreach_dev(dev, uc) { - struct usb_dev_platdata *udev = dev_get_parent_platdata(dev); + struct usb_dev_plat *udev = dev_get_parent_plat(dev); /* * devnum is initialzied to zero at the beginning of the @@ -126,7 +126,7 @@ static int usb_emul_find_devnum(int devnum, int port1, struct udevice **emulp) * emulator device. */ if (!devnum) { - struct usb_emul_platdata *plat; + struct usb_emul_plat *plat; /* * If the parent is sandbox USB controller, we are @@ -140,7 +140,7 @@ static int usb_emul_find_devnum(int devnum, int port1, struct udevice **emulp) return 0; } - plat = dev_get_uclass_platdata(dev); + plat = dev_get_uclass_plat(dev); if (plat->port1 == port1) { debug("%s: Found emulator '%s', port %d\n", __func__, dev->name, port1); @@ -169,7 +169,7 @@ int usb_emul_find(struct udevice *bus, ulong pipe, int port1, int usb_emul_find_for_dev(struct udevice *dev, struct udevice **emulp) { - struct usb_dev_platdata *udev = dev_get_parent_platdata(dev); + struct usb_dev_plat *udev = dev_get_parent_plat(dev); return usb_emul_find_devnum(udev->devnum, 0, emulp); } @@ -179,11 +179,11 @@ int usb_emul_control(struct udevice *emul, struct usb_device *udev, struct devrequest *setup) { struct dm_usb_ops *ops = usb_get_emul_ops(emul); - struct usb_dev_platdata *plat; + struct usb_dev_plat *plat; int ret; /* We permit getting the descriptor before we are probed */ - plat = dev_get_parent_platdata(emul); + plat = dev_get_parent_plat(emul); if (!ops->control) return -ENOSYS; debug("%s: dev=%s\n", __func__, emul->name); @@ -262,7 +262,7 @@ int usb_emul_int(struct udevice *emul, struct usb_device *udev, int usb_emul_setup_device(struct udevice *dev, struct usb_string *strings, void **desc_list) { - struct usb_dev_platdata *plat = dev_get_parent_platdata(dev); + struct usb_dev_plat *plat = dev_get_parent_plat(dev); struct usb_generic_descriptor **ptr; struct usb_config_descriptor *cdesc; int upto; @@ -298,7 +298,7 @@ UCLASS_DRIVER(usb_emul) = { .id = UCLASS_USB_EMUL, .name = "usb_emul", .post_bind = dm_scan_fdt_dev, - .per_device_platdata_auto_alloc_size = sizeof(struct usb_emul_platdata), - .per_child_auto_alloc_size = sizeof(struct usb_device), - .per_child_platdata_auto_alloc_size = sizeof(struct usb_dev_platdata), + .per_device_plat_auto = sizeof(struct usb_emul_plat), + .per_child_auto = sizeof(struct usb_device), + .per_child_plat_auto = sizeof(struct usb_dev_plat), }; diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c index ac4a27f..674f78e 100644 --- a/drivers/usb/eth/asix.c +++ b/drivers/usb/eth/asix.c @@ -743,7 +743,7 @@ int asix_eth_get_info(struct usb_device *dev, struct ueth_data *ss, #ifdef CONFIG_DM_ETH static int asix_eth_start(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct asix_private *priv = dev_get_priv(dev); return asix_init_common(&priv->ueth, pdata->enetaddr); @@ -825,7 +825,7 @@ static int asix_free_pkt(struct udevice *dev, uchar *packet, int packet_len) int asix_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct asix_private *priv = dev_get_priv(dev); if (priv->flags & FLAG_TYPE_AX88172) @@ -836,7 +836,7 @@ int asix_write_hwaddr(struct udevice *dev) static int asix_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct asix_private *priv = dev_get_priv(dev); struct ueth_data *ss = &priv->ueth; int ret; @@ -876,8 +876,8 @@ U_BOOT_DRIVER(asix_eth) = { .id = UCLASS_ETH, .probe = asix_eth_probe, .ops = &asix_eth_ops, - .priv_auto_alloc_size = sizeof(struct asix_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct asix_private), + .plat_auto = sizeof(struct eth_pdata), }; static const struct usb_device_id asix_eth_id_table[] = { diff --git a/drivers/usb/eth/asix88179.c b/drivers/usb/eth/asix88179.c index c142b8b..4742a95 100644 --- a/drivers/usb/eth/asix88179.c +++ b/drivers/usb/eth/asix88179.c @@ -857,7 +857,7 @@ static int ax88179_free_pkt(struct udevice *dev, uchar *packet, int packet_len) int ax88179_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct asix_private *priv = dev_get_priv(dev); struct ueth_data *ueth = &priv->ueth; @@ -866,7 +866,7 @@ int ax88179_write_hwaddr(struct udevice *dev) static int ax88179_eth_probe(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct asix_private *priv = dev_get_priv(dev); struct usb_device *usb_dev; int ret; @@ -902,8 +902,8 @@ U_BOOT_DRIVER(ax88179_eth) = { .id = UCLASS_ETH, .probe = ax88179_eth_probe, .ops = &ax88179_eth_ops, - .priv_auto_alloc_size = sizeof(struct asix_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct asix_private), + .plat_auto = sizeof(struct eth_pdata), }; static const struct usb_device_id ax88179_eth_id_table[] = { diff --git a/drivers/usb/eth/lan75xx.c b/drivers/usb/eth/lan75xx.c index 46b92e8..4effbc5 100644 --- a/drivers/usb/eth/lan75xx.c +++ b/drivers/usb/eth/lan75xx.c @@ -133,7 +133,7 @@ static int lan75xx_basic_reset(struct usb_device *udev, int lan75xx_write_hwaddr(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); unsigned char *enetaddr = pdata->enetaddr; u32 addr_lo = get_unaligned_le32(&enetaddr[0]); u32 addr_hi = (u32)get_unaligned_le16(&enetaddr[4]); @@ -242,7 +242,7 @@ static int lan75xx_eth_start(struct udevice *dev) int lan75xx_read_rom_hwaddr(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); int ret; /* @@ -261,7 +261,7 @@ static int lan75xx_eth_probe(struct udevice *dev) struct usb_device *udev = dev_get_parent_priv(dev); struct lan7x_private *priv = dev_get_priv(dev); struct ueth_data *ueth = &priv->ueth; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); int ret; /* Do a reset in order to get the MAC address from HW */ @@ -304,8 +304,8 @@ U_BOOT_DRIVER(lan75xx_eth) = { .probe = lan75xx_eth_probe, .remove = lan7x_eth_remove, .ops = &lan75xx_eth_ops, - .priv_auto_alloc_size = sizeof(struct lan7x_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct lan7x_private), + .plat_auto = sizeof(struct eth_pdata), }; static const struct usb_device_id lan75xx_eth_id_table[] = { diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c index e34ad26..37912a1 100644 --- a/drivers/usb/eth/lan78xx.c +++ b/drivers/usb/eth/lan78xx.c @@ -306,7 +306,7 @@ static int lan78xx_basic_reset(struct usb_device *udev, int lan78xx_write_hwaddr(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); unsigned char *enetaddr = pdata->enetaddr; u32 addr_lo = get_unaligned_le32(&enetaddr[0]); u32 addr_hi = (u32)get_unaligned_le16(&enetaddr[4]); @@ -410,7 +410,7 @@ static int lan78xx_eth_start(struct udevice *dev) int lan78xx_read_rom_hwaddr(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct lan7x_private *priv = dev_get_priv(dev); int ret; @@ -426,7 +426,7 @@ static int lan78xx_eth_probe(struct udevice *dev) struct usb_device *udev = dev_get_parent_priv(dev); struct lan7x_private *priv = dev_get_priv(dev); struct ueth_data *ueth = &priv->ueth; - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); int ret; /* Do a reset in order to get the MAC address from HW */ @@ -466,8 +466,8 @@ U_BOOT_DRIVER(lan78xx_eth) = { .probe = lan78xx_eth_probe, .remove = lan7x_eth_remove, .ops = &lan78xx_eth_ops, - .priv_auto_alloc_size = sizeof(struct lan7x_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct lan7x_private), + .plat_auto = sizeof(struct eth_pdata), }; static const struct usb_device_id lan78xx_eth_id_table[] = { diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c index c829a43..783ab62 100644 --- a/drivers/usb/eth/mcs7830.c +++ b/drivers/usb/eth/mcs7830.c @@ -893,7 +893,7 @@ static int mcs7830_free_pkt(struct udevice *dev, uchar *packet, int packet_len) int mcs7830_write_hwaddr(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); return mcs7830_write_mac_common(udev, pdata->enetaddr); } @@ -902,7 +902,7 @@ static int mcs7830_eth_probe(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); struct mcs7830_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct ueth_data *ueth = &priv->ueth; if (mcs7830_basic_reset(udev, priv)) @@ -928,8 +928,8 @@ U_BOOT_DRIVER(mcs7830_eth) = { .id = UCLASS_ETH, .probe = mcs7830_eth_probe, .ops = &mcs7830_eth_ops, - .priv_auto_alloc_size = sizeof(struct mcs7830_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct mcs7830_private), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/eth/r8152.c b/drivers/usb/eth/r8152.c index 5f30919..4677da9 100644 --- a/drivers/usb/eth/r8152.c +++ b/drivers/usb/eth/r8152.c @@ -1792,7 +1792,7 @@ static int r8152_free_pkt(struct udevice *dev, uchar *packet, int packet_len) static int r8152_write_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct r8152 *tp = dev_get_priv(dev); unsigned char enetaddr[8] = { 0 }; @@ -1810,7 +1810,7 @@ static int r8152_write_hwaddr(struct udevice *dev) int r8152_read_rom_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct r8152 *tp = dev_get_priv(dev); debug("** %s (%d)\n", __func__, __LINE__); @@ -1821,7 +1821,7 @@ int r8152_read_rom_hwaddr(struct udevice *dev) static int r8152_eth_probe(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct r8152 *tp = dev_get_priv(dev); struct ueth_data *ueth = &tp->ueth; int ret; @@ -1860,8 +1860,8 @@ U_BOOT_DRIVER(r8152_eth) = { .id = UCLASS_ETH, .probe = r8152_eth_probe, .ops = &r8152_eth_ops, - .priv_auto_alloc_size = sizeof(struct r8152), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct r8152), + .plat_auto = sizeof(struct eth_pdata), }; static const struct usb_device_id r8152_eth_id_table[] = { diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c index b293a80..283c52c 100644 --- a/drivers/usb/eth/smsc95xx.c +++ b/drivers/usb/eth/smsc95xx.c @@ -937,7 +937,7 @@ static int smsc95xx_eth_start(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); struct smsc95xx_private *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); /* Driver-model Ethernet ensures we have this */ priv->have_hwaddr = 1; @@ -1020,7 +1020,7 @@ static int smsc95xx_free_pkt(struct udevice *dev, uchar *packet, int packet_len) int smsc95xx_write_hwaddr(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); struct smsc95xx_private *priv = dev_get_priv(dev); return smsc95xx_write_hwaddr_common(udev, priv, pdata->enetaddr); @@ -1029,7 +1029,7 @@ int smsc95xx_write_hwaddr(struct udevice *dev) int smsc95xx_read_rom_hwaddr(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); int ret; ret = smsc95xx_init_mac_address(pdata->enetaddr, udev); @@ -1062,8 +1062,8 @@ U_BOOT_DRIVER(smsc95xx_eth) = { .id = UCLASS_ETH, .probe = smsc95xx_eth_probe, .ops = &smsc95xx_eth_ops, - .priv_auto_alloc_size = sizeof(struct smsc95xx_private), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct smsc95xx_private), + .plat_auto = sizeof(struct eth_pdata), }; static const struct usb_device_id smsc95xx_eth_id_table[] = { diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index 8a8e217..e3871e3 100644 --- a/drivers/usb/gadget/dwc2_udc_otg.c +++ b/drivers/usb/gadget/dwc2_udc_otg.c @@ -980,48 +980,47 @@ static void dwc2_phy_shutdown(struct udevice *dev, struct phy_bulk *phys) generic_phy_exit_bulk(phys); } -static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) +static int dwc2_udc_otg_of_to_plat(struct udevice *dev) { - struct dwc2_plat_otg_data *platdata = dev_get_platdata(dev); + struct dwc2_plat_otg_data *plat = dev_get_plat(dev); ulong drvdata; void (*set_params)(struct dwc2_plat_otg_data *data); int ret; - if (usb_get_dr_mode(dev->node) != USB_DR_MODE_PERIPHERAL && - usb_get_dr_mode(dev->node) != USB_DR_MODE_OTG) { + if (usb_get_dr_mode(dev_ofnode(dev)) != USB_DR_MODE_PERIPHERAL && + usb_get_dr_mode(dev_ofnode(dev)) != USB_DR_MODE_OTG) { dev_dbg(dev, "Invalid mode\n"); return -ENODEV; } - platdata->regs_otg = dev_read_addr(dev); + plat->regs_otg = dev_read_addr(dev); - platdata->rx_fifo_sz = dev_read_u32_default(dev, "g-rx-fifo-size", 0); - platdata->np_tx_fifo_sz = dev_read_u32_default(dev, - "g-np-tx-fifo-size", 0); + plat->rx_fifo_sz = dev_read_u32_default(dev, "g-rx-fifo-size", 0); + plat->np_tx_fifo_sz = dev_read_u32_default(dev, "g-np-tx-fifo-size", 0); - platdata->tx_fifo_sz_nb = + plat->tx_fifo_sz_nb = dev_read_size(dev, "g-tx-fifo-size") / sizeof(u32); - if (platdata->tx_fifo_sz_nb > DWC2_MAX_HW_ENDPOINTS) - platdata->tx_fifo_sz_nb = DWC2_MAX_HW_ENDPOINTS; - if (platdata->tx_fifo_sz_nb) { + if (plat->tx_fifo_sz_nb > DWC2_MAX_HW_ENDPOINTS) + plat->tx_fifo_sz_nb = DWC2_MAX_HW_ENDPOINTS; + if (plat->tx_fifo_sz_nb) { ret = dev_read_u32_array(dev, "g-tx-fifo-size", - platdata->tx_fifo_sz_array, - platdata->tx_fifo_sz_nb); + plat->tx_fifo_sz_array, + plat->tx_fifo_sz_nb); if (ret) return ret; } - platdata->force_b_session_valid = + plat->force_b_session_valid = dev_read_bool(dev, "u-boot,force-b-session-valid"); - platdata->force_vbus_detection = + plat->force_vbus_detection = dev_read_bool(dev, "u-boot,force-vbus-detection"); - /* force platdata according compatible */ + /* force plat according compatible */ drvdata = dev_get_driver_data(dev); if (drvdata) { set_params = (void *)drvdata; - set_params(platdata); + set_params(plat); } return 0; @@ -1091,10 +1090,10 @@ static int dwc2_udc_otg_clk_init(struct udevice *dev, static int dwc2_udc_otg_probe(struct udevice *dev) { - struct dwc2_plat_otg_data *platdata = dev_get_platdata(dev); + struct dwc2_plat_otg_data *plat = dev_get_plat(dev); struct dwc2_priv_data *priv = dev_get_priv(dev); struct dwc2_usbotg_reg *usbotg_reg = - (struct dwc2_usbotg_reg *)platdata->regs_otg; + (struct dwc2_usbotg_reg *)plat->regs_otg; int ret; ret = dwc2_udc_otg_clk_init(dev, &priv->clks); @@ -1109,10 +1108,10 @@ static int dwc2_udc_otg_probe(struct udevice *dev) if (ret) return ret; - if (platdata->activate_stm_id_vb_detection) { + if (plat->activate_stm_id_vb_detection) { if (CONFIG_IS_ENABLED(DM_REGULATOR) && - (!platdata->force_b_session_valid || - platdata->force_vbus_detection)) { + (!plat->force_b_session_valid || + plat->force_vbus_detection)) { ret = device_get_supply_regulator(dev, "usb33d-supply", &priv->usb33d_supply); if (ret) { @@ -1126,8 +1125,8 @@ static int dwc2_udc_otg_probe(struct udevice *dev) } } - if (platdata->force_b_session_valid && - !platdata->force_vbus_detection) { + if (plat->force_b_session_valid && + !plat->force_vbus_detection) { /* Override VBUS detection: enable then value*/ setbits_le32(&usbotg_reg->gotgctl, VB_VALOEN); setbits_le32(&usbotg_reg->gotgctl, VB_VALOVAL); @@ -1136,7 +1135,7 @@ static int dwc2_udc_otg_probe(struct udevice *dev) setbits_le32(&usbotg_reg->ggpio, GGPIO_STM32_OTG_GCCFG_VBDEN); } - if (platdata->force_b_session_valid) { + if (plat->force_b_session_valid) { /* Override B session bits: enable then value */ setbits_le32(&usbotg_reg->gotgctl, A_VALOEN | B_VALOEN); setbits_le32(&usbotg_reg->gotgctl, @@ -1148,7 +1147,7 @@ static int dwc2_udc_otg_probe(struct udevice *dev) } } - ret = dwc2_udc_probe(platdata); + ret = dwc2_udc_probe(plat); if (ret) return ret; @@ -1186,18 +1185,18 @@ U_BOOT_DRIVER(dwc2_udc_otg) = { .name = "dwc2-udc-otg", .id = UCLASS_USB_GADGET_GENERIC, .of_match = dwc2_udc_otg_ids, - .ofdata_to_platdata = dwc2_udc_otg_ofdata_to_platdata, + .of_to_plat = dwc2_udc_otg_of_to_plat, .probe = dwc2_udc_otg_probe, .remove = dwc2_udc_otg_remove, - .platdata_auto_alloc_size = sizeof(struct dwc2_plat_otg_data), - .priv_auto_alloc_size = sizeof(struct dwc2_priv_data), + .plat_auto = sizeof(struct dwc2_plat_otg_data), + .priv_auto = sizeof(struct dwc2_priv_data), }; int dwc2_udc_B_session_valid(struct udevice *dev) { - struct dwc2_plat_otg_data *platdata = dev_get_platdata(dev); + struct dwc2_plat_otg_data *plat = dev_get_plat(dev); struct dwc2_usbotg_reg *usbotg_reg = - (struct dwc2_usbotg_reg *)platdata->regs_otg; + (struct dwc2_usbotg_reg *)plat->regs_otg; return readl(&usbotg_reg->gotgctl) & B_SESSION_VALID; } diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index a8e8bfc..16922ff 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1860,10 +1860,18 @@ static int rndis_control_ack(struct eth_device *net) static int rndis_control_ack(struct udevice *net) #endif { - struct ether_priv *priv = (struct ether_priv *)net->priv; - struct eth_dev *dev = &priv->ethdev; - int length; - struct usb_request *resp = dev->stat_req; + struct ether_priv *priv; + struct eth_dev *dev; + int length; + struct usb_request *resp; + +#ifndef CONFIG_DM_ETH + priv = (struct ether_priv *)net->priv; +#else + priv = dev_get_priv(net); +#endif + dev = &priv->ethdev; + resp = dev->stat_req; /* in case RNDIS calls this after disconnect */ if (!dev->status) { @@ -2009,7 +2017,7 @@ static int eth_bind(struct usb_gadget *gadget) int gcnum; u8 tmp[7]; #ifdef CONFIG_DM_ETH - struct eth_pdata *pdata = dev_get_platdata(l_priv->netdev); + struct eth_pdata *pdata = dev_get_plat(l_priv->netdev); #endif /* these flags are only ever cleared; compiler take note */ @@ -2646,7 +2654,7 @@ static void usb_eth_stop(struct udevice *dev) static int usb_eth_probe(struct udevice *dev) { struct ether_priv *priv = dev_get_priv(dev); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); priv->netdev = dev; l_priv = priv; @@ -2691,8 +2699,8 @@ U_BOOT_DRIVER(eth_usb) = { .id = UCLASS_ETH, .probe = usb_eth_probe, .ops = &usb_eth_ops, - .priv_auto_alloc_size = sizeof(struct ether_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct ether_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif /* CONFIG_DM_ETH */ diff --git a/drivers/usb/gadget/max3420_udc.c b/drivers/usb/gadget/max3420_udc.c index b38b9dc..a16095f 100644 --- a/drivers/usb/gadget/max3420_udc.c +++ b/drivers/usb/gadget/max3420_udc.c @@ -819,14 +819,14 @@ int dm_usb_gadget_handle_interrupts(struct udevice *dev) static int max3420_udc_probe(struct udevice *dev) { struct max3420_udc *udc = dev_get_priv(dev); - struct dm_spi_slave_platdata *slave_pdata; + struct dm_spi_slave_plat *slave_pdata; struct udevice *bus = dev->parent; - int busnum = bus->seq; + int busnum = dev_seq(bus); unsigned int cs; uint speed, mode; struct udevice *spid; - slave_pdata = dev_get_parent_platdata(dev); + slave_pdata = dev_get_parent_plat(dev); cs = slave_pdata->cs; speed = slave_pdata->max_hz; mode = slave_pdata->mode; @@ -871,5 +871,5 @@ U_BOOT_DRIVER(max3420_generic_udc) = { .of_match = max3420_ids, .probe = max3420_udc_probe, .remove = max3420_udc_remove, - .priv_auto_alloc_size = sizeof(struct max3420_udc), + .priv_auto = sizeof(struct max3420_udc), }; diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c index f1d13b1..ec643e9 100644 --- a/drivers/usb/host/dwc2.c +++ b/drivers/usb/host/dwc2.c @@ -1326,7 +1326,7 @@ static int dwc2_submit_int_msg(struct udevice *dev, struct usb_device *udev, nonblock); } -static int dwc2_usb_ofdata_to_platdata(struct udevice *dev) +static int dwc2_usb_of_to_plat(struct udevice *dev) { struct dwc2_priv *priv = dev_get_priv(dev); @@ -1473,11 +1473,11 @@ U_BOOT_DRIVER(usb_dwc2) = { .name = "dwc2_usb", .id = UCLASS_USB, .of_match = dwc2_usb_ids, - .ofdata_to_platdata = dwc2_usb_ofdata_to_platdata, + .of_to_plat = dwc2_usb_of_to_plat, .probe = dwc2_usb_probe, .remove = dwc2_usb_remove, .ops = &dwc2_usb_ops, - .priv_auto_alloc_size = sizeof(struct dwc2_priv), + .priv_auto = sizeof(struct dwc2_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif diff --git a/drivers/usb/host/dwc3-octeon-glue.c b/drivers/usb/host/dwc3-octeon-glue.c index c3cac9c..742e156 100644 --- a/drivers/usb/host/dwc3-octeon-glue.c +++ b/drivers/usb/host/dwc3-octeon-glue.c @@ -366,7 +366,7 @@ static int octeon_dwc3_glue_bind(struct udevice *dev) /* Find snps,dwc3 node from subnode */ dwc3_node = ofnode_null(); - ofnode_for_each_subnode(node, dev->node) { + ofnode_for_each_subnode(node, dev_ofnode(dev)) { if (ofnode_device_is_compatible(node, "snps,dwc3")) dwc3_node = node; } diff --git a/drivers/usb/host/dwc3-of-simple.c b/drivers/usb/host/dwc3-of-simple.c index e4abc6f..66b3e96 100644 --- a/drivers/usb/host/dwc3-of-simple.c +++ b/drivers/usb/host/dwc3-of-simple.c @@ -64,7 +64,7 @@ static int dwc3_of_simple_clk_init(struct udevice *dev, static int dwc3_of_simple_probe(struct udevice *dev) { - struct dwc3_of_simple *simple = dev_get_platdata(dev); + struct dwc3_of_simple *simple = dev_get_plat(dev); int ret; ret = dwc3_of_simple_clk_init(dev, simple); @@ -80,7 +80,7 @@ static int dwc3_of_simple_probe(struct udevice *dev) static int dwc3_of_simple_remove(struct udevice *dev) { - struct dwc3_of_simple *simple = dev_get_platdata(dev); + struct dwc3_of_simple *simple = dev_get_plat(dev); reset_release_bulk(&simple->resets); @@ -102,6 +102,6 @@ U_BOOT_DRIVER(dwc3_of_simple) = { .of_match = dwc3_of_simple_ids, .probe = dwc3_of_simple_probe, .remove = dwc3_of_simple_remove, - .platdata_auto_alloc_size = sizeof(struct dwc3_of_simple), + .plat_auto = sizeof(struct dwc3_of_simple), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c index 9dec087..1234399 100644 --- a/drivers/usb/host/dwc3-sti-glue.c +++ b/drivers/usb/host/dwc3-sti-glue.c @@ -24,7 +24,7 @@ DECLARE_GLOBAL_DATA_PTR; /* - * struct sti_dwc3_glue_platdata - dwc3 STi glue driver private structure + * struct sti_dwc3_glue_plat - dwc3 STi glue driver private structure * @syscfg_base: addr for the glue syscfg * @glue_base: addr for the glue registers * @syscfg_offset: usb syscfg control offset @@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR; * @softreset_ctl: reset controller for softreset signal * @mode: drd static host/device config */ -struct sti_dwc3_glue_platdata { +struct sti_dwc3_glue_plat { phys_addr_t syscfg_base; phys_addr_t glue_base; phys_addr_t syscfg_offset; @@ -41,7 +41,7 @@ struct sti_dwc3_glue_platdata { enum usb_dr_mode mode; }; -static int sti_dwc3_glue_drd_init(struct sti_dwc3_glue_platdata *plat) +static int sti_dwc3_glue_drd_init(struct sti_dwc3_glue_plat *plat) { unsigned long val; @@ -77,7 +77,7 @@ static int sti_dwc3_glue_drd_init(struct sti_dwc3_glue_platdata *plat) return 0; } -static void sti_dwc3_glue_init(struct sti_dwc3_glue_platdata *plat) +static void sti_dwc3_glue_init(struct sti_dwc3_glue_plat *plat) { unsigned long reg; @@ -100,15 +100,16 @@ static void sti_dwc3_glue_init(struct sti_dwc3_glue_platdata *plat) setbits_le32(plat->glue_base + CLKRST_CTRL, SW_PIPEW_RESET_N); } -static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev) +static int sti_dwc3_glue_of_to_plat(struct udevice *dev) { - struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); + struct sti_dwc3_glue_plat *plat = dev_get_plat(dev); struct udevice *syscon; struct regmap *regmap; int ret; u32 reg[4]; - ret = ofnode_read_u32_array(dev->node, "reg", reg, ARRAY_SIZE(reg)); + ret = ofnode_read_u32_array(dev_ofnode(dev), "reg", reg, + ARRAY_SIZE(reg)); if (ret) { pr_err("unable to find st,stih407-dwc3 reg property(%d)\n", ret); return ret; @@ -150,11 +151,11 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev) static int sti_dwc3_glue_bind(struct udevice *dev) { - struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); + struct sti_dwc3_glue_plat *plat = dev_get_plat(dev); ofnode node, dwc3_node; /* Find snps,dwc3 node from subnode */ - ofnode_for_each_subnode(node, dev->node) { + ofnode_for_each_subnode(node, dev_ofnode(dev)) { if (ofnode_device_is_compatible(node, "snps,dwc3")) dwc3_node = node; } @@ -175,7 +176,7 @@ static int sti_dwc3_glue_bind(struct udevice *dev) static int sti_dwc3_glue_probe(struct udevice *dev) { - struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); + struct sti_dwc3_glue_plat *plat = dev_get_plat(dev); int ret; /* deassert both powerdown and softreset */ @@ -216,7 +217,7 @@ softreset_err: static int sti_dwc3_glue_remove(struct udevice *dev) { - struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev); + struct sti_dwc3_glue_plat *plat = dev_get_plat(dev); int ret; /* assert both powerdown and softreset */ @@ -242,10 +243,10 @@ U_BOOT_DRIVER(dwc3_sti_glue) = { .name = "dwc3_sti_glue", .id = UCLASS_NOP, .of_match = sti_dwc3_glue_ids, - .ofdata_to_platdata = sti_dwc3_glue_ofdata_to_platdata, + .of_to_plat = sti_dwc3_glue_of_to_plat, .probe = sti_dwc3_glue_probe, .remove = sti_dwc3_glue_remove, .bind = sti_dwc3_glue_bind, - .platdata_auto_alloc_size = sizeof(struct sti_dwc3_glue_platdata), + .plat_auto = sizeof(struct sti_dwc3_glue_plat), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index 3b208e8..fba3595 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c @@ -124,8 +124,8 @@ U_BOOT_DRIVER(ehci_atmel) = { .probe = ehci_atmel_probe, .remove = ehci_deregister, .ops = &ehci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct ehci_atmel_priv), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct ehci_atmel_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 6a37c5d..fda04c4 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -26,8 +26,8 @@ /* Declare global data pointer */ DECLARE_GLOBAL_DATA_PTR; -struct exynos_ehci_platdata { - struct usb_platdata usb_plat; +struct exynos_ehci_plat { + struct usb_plat usb_plat; fdt_addr_t hcd_base; fdt_addr_t phy_base; struct gpio_desc vbus_gpio; @@ -43,9 +43,9 @@ struct exynos_ehci { struct ehci_hccr *hcd; }; -static int ehci_usb_ofdata_to_platdata(struct udevice *dev) +static int ehci_usb_of_to_plat(struct udevice *dev) { - struct exynos_ehci_platdata *plat = dev_get_platdata(dev); + struct exynos_ehci_plat *plat = dev_get_plat(dev); const void *blob = gd->fdt_blob; unsigned int node; int depth; @@ -214,7 +214,7 @@ static void reset_usb_phy(struct exynos_usb_phy *usb) static int ehci_usb_probe(struct udevice *dev) { - struct exynos_ehci_platdata *plat = dev_get_platdata(dev); + struct exynos_ehci_plat *plat = dev_get_plat(dev); struct exynos_ehci *ctx = dev_get_priv(dev); struct ehci_hcor *hcor; @@ -254,11 +254,11 @@ U_BOOT_DRIVER(usb_ehci) = { .name = "ehci_exynos", .id = UCLASS_USB, .of_match = ehci_usb_ids, - .ofdata_to_platdata = ehci_usb_ofdata_to_platdata, + .of_to_plat = ehci_usb_of_to_plat, .probe = ehci_usb_probe, .remove = ehci_usb_remove, .ops = &ehci_usb_ops, - .priv_auto_alloc_size = sizeof(struct exynos_ehci), - .platdata_auto_alloc_size = sizeof(struct exynos_ehci_platdata), + .priv_auto = sizeof(struct exynos_ehci), + .plat_auto = sizeof(struct exynos_ehci_plat), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 5423d10..8e79bdd 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -58,7 +58,7 @@ static int usb_phy_clk_valid(struct usb_ehci *ehci) } #if CONFIG_IS_ENABLED(DM_USB) -static int ehci_fsl_ofdata_to_platdata(struct udevice *dev) +static int ehci_fsl_of_to_plat(struct udevice *dev) { struct ehci_fsl_priv *priv = dev_get_priv(dev); const void *prop; @@ -141,12 +141,12 @@ U_BOOT_DRIVER(ehci_fsl) = { .name = "ehci_fsl", .id = UCLASS_USB, .of_match = ehci_usb_ids, - .ofdata_to_platdata = ehci_fsl_ofdata_to_platdata, + .of_to_plat = ehci_fsl_of_to_plat, .probe = ehci_fsl_probe, .remove = ehci_deregister, .ops = &ehci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct ehci_fsl_priv), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct ehci_fsl_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #else diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index c93a705..4c28a69 100644 --- a/drivers/usb/host/ehci-generic.c +++ b/drivers/usb/host/ehci-generic.c @@ -221,6 +221,6 @@ U_BOOT_DRIVER(ehci_generic) = { .probe = ehci_usb_probe, .remove = ehci_usb_remove, .ops = &ehci_usb_ops, - .priv_auto_alloc_size = sizeof(struct generic_ehci), + .priv_auto = sizeof(struct generic_ehci), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ehci-marvell.c b/drivers/usb/host/ehci-marvell.c index 62414bb..3ecbfd0 100644 --- a/drivers/usb/host/ehci-marvell.c +++ b/drivers/usb/host/ehci-marvell.c @@ -152,8 +152,8 @@ U_BOOT_DRIVER(ehci_mvebu) = { .probe = ehci_mvebu_probe, .remove = ehci_deregister, .ops = &ehci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct ehci_mvebu_priv), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct ehci_mvebu_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index dd92808..d160cf0 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c @@ -47,7 +47,7 @@ static int ehci_usb_probe(struct udevice *dev) { struct msm_ehci_priv *p = dev_get_priv(dev); struct usb_ehci *ehci = p->ehci; - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); struct ehci_hccr *hccr; struct ehci_hcor *hcor; int ret; @@ -101,7 +101,7 @@ static int ehci_usb_remove(struct udevice *dev) return 0; } -static int ehci_usb_ofdata_to_platdata(struct udevice *dev) +static int ehci_usb_of_to_plat(struct udevice *dev) { struct msm_ehci_priv *priv = dev_get_priv(dev); @@ -140,11 +140,11 @@ U_BOOT_DRIVER(usb_ehci) = { .name = "ehci_msm", .id = UCLASS_USB, .of_match = ehci_usb_ids, - .ofdata_to_platdata = ehci_usb_ofdata_to_platdata, + .of_to_plat = ehci_usb_of_to_plat, .probe = ehci_usb_probe, .remove = ehci_usb_remove, .ops = &ehci_usb_ops, - .priv_auto_alloc_size = sizeof(struct msm_ehci_priv), - .platdata_auto_alloc_size = sizeof(struct usb_platdata), + .priv_auto = sizeof(struct msm_ehci_priv), + .plat_auto = sizeof(struct usb_plat), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c index caafa68..0af02ba 100644 --- a/drivers/usb/host/ehci-mx5.c +++ b/drivers/usb/host/ehci-mx5.c @@ -285,9 +285,9 @@ static const struct ehci_ops mx5_ehci_ops = { .powerup_fixup = mx5_ehci_powerup_fixup, }; -static int ehci_usb_ofdata_to_platdata(struct udevice *dev) +static int ehci_usb_of_to_plat(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); const char *mode; mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "dr_mode", NULL); @@ -305,7 +305,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev) static int ehci_usb_probe(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); struct usb_ehci *ehci = dev_read_addr_ptr(dev); struct ehci_mx5_priv_data *priv = dev_get_priv(dev); enum usb_init_type type = plat->init_type; @@ -321,7 +321,7 @@ static int ehci_usb_probe(struct udevice *dev) mdelay(1); priv->ehci = ehci; - priv->portnr = dev->seq; + priv->portnr = dev_seq(dev); priv->init_type = type; ret = device_get_supply_regulator(dev, "vbus-supply", @@ -363,12 +363,12 @@ U_BOOT_DRIVER(usb_mx5) = { .name = "ehci_mx5", .id = UCLASS_USB, .of_match = mx5_usb_ids, - .ofdata_to_platdata = ehci_usb_ofdata_to_platdata, + .of_to_plat = ehci_usb_of_to_plat, .probe = ehci_usb_probe, .remove = ehci_deregister, .ops = &ehci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct ehci_mx5_priv_data), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct ehci_mx5_priv_data), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif /* !CONFIG_IS_ENABLED(DM_USB) */ diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 37b5975..ef3a63a 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -472,7 +472,7 @@ static const struct ehci_ops mx6_ehci_ops = { static int ehci_usb_phy_mode(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); void *__iomem addr = dev_read_addr_ptr(dev); void *__iomem phy_ctrl, *__iomem phy_status; const void *blob = gd->fdt_blob; @@ -518,12 +518,12 @@ static int ehci_usb_phy_mode(struct udevice *dev) return 0; } -static int ehci_usb_ofdata_to_platdata(struct udevice *dev) +static int ehci_usb_of_to_plat(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); enum usb_dr_mode dr_mode; - dr_mode = usb_get_dr_mode(dev->node); + dr_mode = usb_get_dr_mode(dev_ofnode(dev)); switch (dr_mode) { case USB_DR_MODE_HOST: @@ -569,17 +569,23 @@ static int ehci_usb_bind(struct udevice *dev) * With these changes in place, the ad-hoc indexing goes away and * the driver is fully converted to DT probing. */ - u32 controller_spacing = is_mx7() ? 0x10000 : 0x200; - fdt_addr_t addr = devfdt_get_addr_index(dev, 0); - dev->req_seq = (addr - USB_BASE_ADDR) / controller_spacing; + /* + * FIXME: This cannot work with the new sequence numbers. + * Please complete the DM conversion. + * + * u32 controller_spacing = is_mx7() ? 0x10000 : 0x200; + * fdt_addr_t addr = devfdt_get_addr_index(dev, 0); + * + * dev->req_seq = (addr - USB_BASE_ADDR) / controller_spacing; + */ return 0; } static int ehci_usb_probe(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); struct usb_ehci *ehci = dev_read_addr_ptr(dev); struct ehci_mx6_priv_data *priv = dev_get_priv(dev); enum usb_init_type type = plat->init_type; @@ -596,7 +602,7 @@ static int ehci_usb_probe(struct udevice *dev) } priv->ehci = ehci; - priv->portnr = dev->seq; + priv->portnr = dev_seq(dev); priv->init_type = type; #if CONFIG_IS_ENABLED(DM_REGULATOR) @@ -645,13 +651,13 @@ U_BOOT_DRIVER(usb_mx6) = { .name = "ehci_mx6", .id = UCLASS_USB, .of_match = mx6_usb_ids, - .ofdata_to_platdata = ehci_usb_ofdata_to_platdata, + .of_to_plat = ehci_usb_of_to_plat, .bind = ehci_usb_bind, .probe = ehci_usb_probe, .remove = ehci_deregister, .ops = &ehci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct ehci_mx6_priv_data), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct ehci_mx6_priv_data), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 82b99ee..12c422d 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -366,9 +366,9 @@ struct ehci_omap_priv_data { int nports; }; -static int ehci_usb_ofdata_to_platdata(struct udevice *dev) +static int ehci_usb_of_to_plat(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); plat->init_type = USB_INIT_HOST; @@ -377,13 +377,13 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev) static int omap_ehci_probe(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); struct ehci_omap_priv_data *priv = dev_get_priv(dev); struct ehci_hccr *hccr; struct ehci_hcor *hcor; priv->ehci = dev_read_addr_ptr(dev); - priv->portnr = dev->seq; + priv->portnr = dev_seq(dev); priv->init_type = plat->init_type; hccr = (struct ehci_hccr *)&priv->ehci->hccapbase; @@ -402,9 +402,9 @@ U_BOOT_DRIVER(usb_omap_ehci) = { .id = UCLASS_USB, .of_match = omap_ehci_dt_ids, .probe = omap_ehci_probe, - .ofdata_to_platdata = ehci_usb_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct ehci_omap_priv_data), + .of_to_plat = ehci_usb_of_to_plat, + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct ehci_omap_priv_data), .remove = ehci_deregister, .ops = &ehci_usb_ops, .flags = DM_FLAG_ALLOC_PRIV_DMA, diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 7dd5c33..4f711de 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -163,8 +163,8 @@ U_BOOT_DRIVER(ehci_pci) = { .remove = ehci_pci_remove, .of_match = ehci_pci_ids, .ops = &ehci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct ehci_pci_priv), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct ehci_pci_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index d81f4a0..b02ee89 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -812,7 +812,7 @@ static const struct ehci_ops tegra_ehci_ops = { .powerup_fixup = tegra_ehci_powerup_fixup, }; -static int ehci_usb_ofdata_to_platdata(struct udevice *dev) +static int ehci_usb_of_to_plat(struct udevice *dev) { struct fdt_usb *priv = dev_get_priv(dev); int ret; @@ -828,7 +828,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev) static int ehci_usb_probe(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); struct fdt_usb *priv = dev_get_priv(dev); struct ehci_hccr *hccr; struct ehci_hcor *hcor; @@ -861,11 +861,11 @@ U_BOOT_DRIVER(usb_ehci) = { .name = "ehci_tegra", .id = UCLASS_USB, .of_match = ehci_usb_ids, - .ofdata_to_platdata = ehci_usb_ofdata_to_platdata, + .of_to_plat = ehci_usb_of_to_plat, .probe = ehci_usb_probe, .remove = ehci_deregister, .ops = &ehci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct fdt_usb), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct fdt_usb), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c index 2768d40..25f76c9 100644 --- a/drivers/usb/host/ehci-vf.c +++ b/drivers/usb/host/ehci-vf.c @@ -215,14 +215,14 @@ struct ehci_vf_priv_data { u32 portnr; }; -static int vf_usb_ofdata_to_platdata(struct udevice *dev) +static int vf_usb_of_to_plat(struct udevice *dev) { struct ehci_vf_priv_data *priv = dev_get_priv(dev); const void *dt_blob = gd->fdt_blob; int node = dev_of_offset(dev); const char *mode; - priv->portnr = dev->seq; + priv->portnr = dev_seq(dev); priv->ehci = dev_read_addr_ptr(dev); mode = fdt_getprop(dt_blob, node, "dr_mode", NULL); @@ -296,23 +296,21 @@ static const struct ehci_ops vf_ehci_ops = { static int vf_usb_bind(struct udevice *dev) { - static int num_controllers; - /* * Without this hack, if we return ENODEV for USB Controller 0, on * probe for the next controller, USB Controller 1 will be given a * sequence number of 0. This conflicts with our requirement of * sequence numbers while initialising the peripherals. + * + * FIXME: Check that this still works OK with the new sequence numbers */ - dev->req_seq = num_controllers; - num_controllers++; return 0; } static int ehci_usb_probe(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); struct ehci_vf_priv_data *priv = dev_get_priv(dev); struct usb_ehci *ehci = priv->ehci; struct ehci_hccr *hccr; @@ -354,9 +352,9 @@ U_BOOT_DRIVER(usb_ehci) = { .probe = ehci_usb_probe, .remove = ehci_deregister, .ops = &ehci_usb_ops, - .ofdata_to_platdata = vf_usb_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct ehci_vf_priv_data), + .of_to_plat = vf_usb_of_to_plat, + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct ehci_vf_priv_data), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif diff --git a/drivers/usb/host/ehci-zynq.c b/drivers/usb/host/ehci-zynq.c index 80f1d6f..f7e458c 100644 --- a/drivers/usb/host/ehci-zynq.c +++ b/drivers/usb/host/ehci-zynq.c @@ -21,7 +21,7 @@ struct zynq_ehci_priv { struct usb_ehci *ehci; }; -static int ehci_zynq_ofdata_to_platdata(struct udevice *dev) +static int ehci_zynq_of_to_plat(struct udevice *dev) { struct zynq_ehci_priv *priv = dev_get_priv(dev); @@ -34,7 +34,7 @@ static int ehci_zynq_ofdata_to_platdata(struct udevice *dev) static int ehci_zynq_probe(struct udevice *dev) { - struct usb_platdata *plat = dev_get_platdata(dev); + struct usb_plat *plat = dev_get_plat(dev); struct zynq_ehci_priv *priv = dev_get_priv(dev); struct ehci_hccr *hccr; struct ehci_hcor *hcor; @@ -81,11 +81,11 @@ U_BOOT_DRIVER(ehci_zynq) = { .name = "ehci_zynq", .id = UCLASS_USB, .of_match = ehci_zynq_ids, - .ofdata_to_platdata = ehci_zynq_ofdata_to_platdata, + .of_to_plat = ehci_zynq_of_to_plat, .probe = ehci_zynq_probe, .remove = ehci_deregister, .ops = &ehci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct zynq_ehci_priv), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct zynq_ehci_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index aa1eba2..33c4a91 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -174,7 +174,7 @@ U_BOOT_DRIVER(ohci_generic) = { .probe = ohci_da8xx_probe, .remove = ohci_da8xx_remove, .ops = &ohci_usb_ops, - .priv_auto_alloc_size = sizeof(struct da8xx_ohci), + .priv_auto = sizeof(struct da8xx_ohci), .flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_OS_PREPARE, }; #endif diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c index ac9b7e1..163f0ef 100644 --- a/drivers/usb/host/ohci-generic.c +++ b/drivers/usb/host/ohci-generic.c @@ -198,6 +198,6 @@ U_BOOT_DRIVER(ohci_generic) = { .probe = ohci_usb_probe, .remove = ohci_usb_remove, .ops = &ohci_usb_ops, - .priv_auto_alloc_size = sizeof(struct generic_ohci), + .priv_auto = sizeof(struct generic_ohci), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 4c1c778..6ddc9da 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -39,8 +39,8 @@ U_BOOT_DRIVER(ohci_pci) = { .remove = ohci_pci_remove, .of_match = ohci_pci_ids, .ops = &ohci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(ohci_t), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(ohci_t), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 37aa2c5..f1fc93f 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -805,7 +805,7 @@ static int r8a66597_submit_bulk_msg(struct udevice *udev, return ret; } -static int r8a66597_usb_ofdata_to_platdata(struct udevice *dev) +static int r8a66597_usb_of_to_plat(struct udevice *dev) { struct r8a66597 *priv = dev_get_priv(dev); fdt_addr_t addr; @@ -890,10 +890,10 @@ U_BOOT_DRIVER(usb_r8a66597) = { .name = "r8a66597_usb", .id = UCLASS_USB, .of_match = r8a66597_usb_ids, - .ofdata_to_platdata = r8a66597_usb_ofdata_to_platdata, + .of_to_plat = r8a66597_usb_of_to_plat, .probe = r8a66597_usb_probe, .remove = r8a66597_usb_remove, .ops = &r8a66597_usb_ops, - .priv_auto_alloc_size = sizeof(struct r8a66597), + .priv_auto = sizeof(struct r8a66597), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/usb-sandbox.c b/drivers/usb/host/usb-sandbox.c index beb62eb..d7cc92a 100644 --- a/drivers/usb/host/usb-sandbox.c +++ b/drivers/usb/host/usb-sandbox.c @@ -23,7 +23,7 @@ static void usbmon_trace(struct udevice *bus, ulong pipe, type = (pipe & USB_PIPE_TYPE_MASK) >> USB_PIPE_TYPE_SHIFT; debug("0 0 S %c%c:%d:%03ld:%ld", types[type], pipe & USB_DIR_IN ? 'i' : 'o', - bus->seq, + dev_seq(bus), (pipe & USB_PIPE_DEV_MASK) >> USB_PIPE_DEV_SHIFT, (pipe & USB_PIPE_EP_MASK) >> USB_PIPE_EP_SHIFT); if (setup) { @@ -155,5 +155,5 @@ U_BOOT_DRIVER(usb_sandbox) = { .of_match = sandbox_usb_ids, .probe = sandbox_usb_probe, .ops = &sandbox_usb_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_usb_ctrl), + .priv_auto = sizeof(struct sandbox_usb_ctrl), }; diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 8773824..e3b616c 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -60,7 +60,7 @@ int submit_control_msg(struct usb_device *udev, unsigned long pipe, { struct udevice *bus = udev->controller_dev; struct dm_usb_ops *ops = usb_get_ops(bus); - struct usb_uclass_priv *uc_priv = bus->uclass->priv; + struct usb_uclass_priv *uc_priv = uclass_get_priv(bus->uclass); int err; if (!ops->control) @@ -184,7 +184,7 @@ int usb_stop(void) if (ret) return ret; - uc_priv = uc->priv; + uc_priv = uclass_get_priv(uc); uclass_foreach_dev(bus, uc) { ret = device_remove(bus, DM_REMOVE_NORMAL); @@ -263,7 +263,7 @@ int usb_init(void) if (ret) return ret; - uc_priv = uc->priv; + uc_priv = uclass_get_priv(uc); uclass_foreach_dev(bus, uc) { /* init low_level USB */ @@ -389,19 +389,19 @@ struct usb_device *usb_get_dev_index(struct udevice *bus, int index) int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) { - struct usb_platdata *plat; + struct usb_plat *plat; struct udevice *dev; int ret; /* Find the old device and remove it */ - ret = uclass_find_device_by_seq(UCLASS_USB, 0, true, &dev); + ret = uclass_find_device_by_seq(UCLASS_USB, 0, &dev); if (ret) return ret; ret = device_remove(dev, DM_REMOVE_NORMAL); if (ret) return ret; - plat = dev_get_platdata(dev); + plat = dev_get_plat(dev); plat->init_type = USB_INIT_DEVICE; ret = device_probe(dev); if (ret) @@ -417,7 +417,7 @@ int usb_remove_ehci_gadget(struct ehci_ctrl **ctlrp) int ret; /* Find the old device and remove it */ - ret = uclass_find_device_by_seq(UCLASS_USB, 0, true, &dev); + ret = uclass_find_device_by_seq(UCLASS_USB, 0, &dev); if (ret) return ret; ret = device_remove(dev, DM_REMOVE_NORMAL); @@ -517,7 +517,7 @@ static ofnode usb_get_ofnode(struct udevice *hub, int port) ofnode node; u32 reg; - if (!dev_has_of_node(hub)) + if (!dev_has_ofnode(hub)) return ofnode_null(); /* @@ -566,7 +566,7 @@ static int usb_find_and_bind_driver(struct udevice *parent, const struct usb_device_id *id; struct udevice *dev; const struct driver *drv; - struct usb_dev_platdata *plat; + struct usb_dev_plat *plat; for (id = entry->match; id->match_flags; id++) { if (!usb_match_one_id(desc, iface, id)) @@ -575,19 +575,19 @@ static int usb_find_and_bind_driver(struct udevice *parent, drv = entry->driver; /* * We could pass the descriptor to the driver as - * platdata (instead of NULL) and allow its bind() + * plat (instead of NULL) and allow its bind() * method to return -ENOENT if it doesn't support this * device. That way we could continue the search to * find another driver. For now this doesn't seem * necesssary, so just bind the first match. */ - ret = device_bind_ofnode(parent, drv, drv->name, NULL, - node, &dev); + ret = device_bind(parent, drv, drv->name, NULL, node, + &dev); if (ret) goto error; debug("%s: Match found: %s\n", __func__, drv->name); dev->driver_data = id->driver_info; - plat = dev_get_parent_platdata(dev); + plat = dev_get_parent_plat(dev); plat->id = *id; *devp = dev; return 0; @@ -622,7 +622,7 @@ static int usb_find_child(struct udevice *parent, for (device_find_first_child(parent, &dev); dev; device_find_next_child(&dev)) { - struct usb_dev_platdata *plat = dev_get_parent_platdata(dev); + struct usb_dev_plat *plat = dev_get_parent_plat(dev); /* If this device is already in use, skip it */ if (device_active(dev)) @@ -643,7 +643,7 @@ int usb_scan_device(struct udevice *parent, int port, { struct udevice *dev; bool created = false; - struct usb_dev_platdata *plat; + struct usb_dev_plat *plat; struct usb_bus_priv *priv; struct usb_device *parent_udev; int ret; @@ -701,13 +701,13 @@ int usb_scan_device(struct udevice *parent, int port, return ret; ret = usb_find_and_bind_driver(parent, &udev->descriptor, iface, - udev->controller_dev->seq, + dev_seq(udev->controller_dev), udev->devnum, port, &dev); if (ret) return ret; created = true; } - plat = dev_get_parent_platdata(dev); + plat = dev_get_parent_plat(dev); debug("%s: Probing '%s', plat=%p\n", __func__, dev->name, plat); plat->devnum = udev->devnum; plat->udev = udev; @@ -770,10 +770,10 @@ int usb_detect_change(void) static int usb_child_post_bind(struct udevice *dev) { - struct usb_dev_platdata *plat = dev_get_parent_platdata(dev); + struct usb_dev_plat *plat = dev_get_parent_plat(dev); int val; - if (!dev_of_valid(dev)) + if (!dev_has_ofnode(dev)) return 0; /* We only support matching a few things */ @@ -809,7 +809,7 @@ struct udevice *usb_get_bus(struct udevice *dev) int usb_child_pre_probe(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); - struct usb_dev_platdata *plat = dev_get_parent_platdata(dev); + struct usb_dev_plat *plat = dev_get_parent_plat(dev); int ret; if (plat->udev) { @@ -849,12 +849,12 @@ UCLASS_DRIVER(usb) = { .name = "usb", .flags = DM_UC_FLAG_SEQ_ALIAS, .post_bind = dm_scan_fdt_dev, - .priv_auto_alloc_size = sizeof(struct usb_uclass_priv), - .per_child_auto_alloc_size = sizeof(struct usb_device), - .per_device_auto_alloc_size = sizeof(struct usb_bus_priv), + .priv_auto = sizeof(struct usb_uclass_priv), + .per_child_auto = sizeof(struct usb_device), + .per_device_auto = sizeof(struct usb_bus_priv), .child_post_bind = usb_child_post_bind, .child_pre_probe = usb_child_pre_probe, - .per_child_platdata_auto_alloc_size = sizeof(struct usb_dev_platdata), + .per_child_plat_auto = sizeof(struct usb_dev_plat), }; UCLASS_DRIVER(usb_dev_generic) = { diff --git a/drivers/usb/host/xhci-brcm.c b/drivers/usb/host/xhci-brcm.c index ee65f51..27c4bbf 100644 --- a/drivers/usb/host/xhci-brcm.c +++ b/drivers/usb/host/xhci-brcm.c @@ -22,7 +22,7 @@ #define USBAXI_SA_UA_MASK (USBAXI_UA_MASK | USBAXI_SA_MASK) #define USBAXI_SA_UA_VAL (USBAXI_UA_VAL | USBAXI_SA_VAL) -struct brcm_xhci_platdata { +struct brcm_xhci_plat { unsigned int arcache; unsigned int awcache; void __iomem *hc_base; @@ -30,7 +30,7 @@ struct brcm_xhci_platdata { static int xhci_brcm_probe(struct udevice *dev) { - struct brcm_xhci_platdata *plat = dev_get_platdata(dev); + struct brcm_xhci_plat *plat = dev_get_plat(dev); struct xhci_hcor *hcor; struct xhci_hccr *hcd; int len, ret = 0; @@ -71,7 +71,7 @@ static int xhci_brcm_probe(struct udevice *dev) static int xhci_brcm_deregister(struct udevice *dev) { - struct brcm_xhci_platdata *plat = dev_get_platdata(dev); + struct brcm_xhci_plat *plat = dev_get_plat(dev); /* Restore the default values for AXI read and write attributes */ writel(plat->awcache, plat->hc_base + DRD2U3H_XHC_REGS_AXIWRA); @@ -92,7 +92,7 @@ U_BOOT_DRIVER(usb_xhci) = { .remove = xhci_brcm_deregister, .ops = &xhci_usb_ops, .of_match = xhci_brcm_ids, - .platdata_auto_alloc_size = sizeof(struct brcm_xhci_platdata), - .priv_auto_alloc_size = sizeof(struct xhci_ctrl), + .plat_auto = sizeof(struct brcm_xhci_plat), + .priv_auto = sizeof(struct xhci_ctrl), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c index 045de2f..3e0ae80 100644 --- a/drivers/usb/host/xhci-dwc3.c +++ b/drivers/usb/host/xhci-dwc3.c @@ -20,7 +20,7 @@ #include <linux/usb/dwc3.h> #include <linux/usb/otg.h> -struct xhci_dwc3_platdata { +struct xhci_dwc3_plat { struct phy_bulk phys; }; @@ -117,7 +117,7 @@ static int xhci_dwc3_probe(struct udevice *dev) struct xhci_hccr *hccr; struct dwc3 *dwc3_reg; enum usb_dr_mode dr_mode; - struct xhci_dwc3_platdata *plat = dev_get_platdata(dev); + struct xhci_dwc3_plat *plat = dev_get_plat(dev); const char *phy; u32 reg; int ret; @@ -155,7 +155,7 @@ static int xhci_dwc3_probe(struct udevice *dev) writel(reg, &dwc3_reg->g_usb2phycfg[0]); - dr_mode = usb_get_dr_mode(dev->node); + dr_mode = usb_get_dr_mode(dev_ofnode(dev)); if (dr_mode == USB_DR_MODE_UNKNOWN) /* by default set dual role mode to HOST */ dr_mode = USB_DR_MODE_HOST; @@ -167,7 +167,7 @@ static int xhci_dwc3_probe(struct udevice *dev) static int xhci_dwc3_remove(struct udevice *dev) { - struct xhci_dwc3_platdata *plat = dev_get_platdata(dev); + struct xhci_dwc3_plat *plat = dev_get_plat(dev); dwc3_shutdown_phy(dev, &plat->phys); @@ -186,8 +186,8 @@ U_BOOT_DRIVER(xhci_dwc3) = { .probe = xhci_dwc3_probe, .remove = xhci_dwc3_remove, .ops = &xhci_usb_ops, - .priv_auto_alloc_size = sizeof(struct xhci_ctrl), - .platdata_auto_alloc_size = sizeof(struct xhci_dwc3_platdata), + .priv_auto = sizeof(struct xhci_ctrl), + .plat_auto = sizeof(struct xhci_dwc3_plat), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #endif diff --git a/drivers/usb/host/xhci-exynos5.c b/drivers/usb/host/xhci-exynos5.c index 6fb7a7f..9893a8c 100644 --- a/drivers/usb/host/xhci-exynos5.c +++ b/drivers/usb/host/xhci-exynos5.c @@ -34,7 +34,7 @@ /* Declare global data pointer */ DECLARE_GLOBAL_DATA_PTR; -struct exynos_xhci_platdata { +struct exynos_xhci_plat { fdt_addr_t hcd_base; fdt_addr_t phy_base; struct gpio_desc vbus_gpio; @@ -45,16 +45,16 @@ struct exynos_xhci_platdata { * for the usb controller. */ struct exynos_xhci { - struct usb_platdata usb_plat; + struct usb_plat usb_plat; struct xhci_ctrl ctrl; struct exynos_usb3_phy *usb3_phy; struct xhci_hccr *hcd; struct dwc3 *dwc3_reg; }; -static int xhci_usb_ofdata_to_platdata(struct udevice *dev) +static int xhci_usb_of_to_plat(struct udevice *dev) { - struct exynos_xhci_platdata *plat = dev_get_platdata(dev); + struct exynos_xhci_plat *plat = dev_get_plat(dev); const void *blob = gd->fdt_blob; unsigned int node; int depth; @@ -205,7 +205,7 @@ static void exynos_xhci_core_exit(struct exynos_xhci *exynos) static int xhci_usb_probe(struct udevice *dev) { - struct exynos_xhci_platdata *plat = dev_get_platdata(dev); + struct exynos_xhci_plat *plat = dev_get_plat(dev); struct exynos_xhci *ctx = dev_get_priv(dev); struct xhci_hcor *hcor; int ret; @@ -251,11 +251,11 @@ U_BOOT_DRIVER(usb_xhci) = { .name = "xhci_exynos", .id = UCLASS_USB, .of_match = xhci_usb_ids, - .ofdata_to_platdata = xhci_usb_ofdata_to_platdata, + .of_to_plat = xhci_usb_of_to_plat, .probe = xhci_usb_probe, .remove = xhci_usb_remove, .ops = &xhci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct exynos_xhci_platdata), - .priv_auto_alloc_size = sizeof(struct exynos_xhci), + .plat_auto = sizeof(struct exynos_xhci_plat), + .priv_auto = sizeof(struct exynos_xhci), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/xhci-fsl.c b/drivers/usb/host/xhci-fsl.c index 0a2da70..f062f12 100644 --- a/drivers/usb/host/xhci-fsl.c +++ b/drivers/usb/host/xhci-fsl.c @@ -169,8 +169,8 @@ U_BOOT_DRIVER(xhci_fsl) = { .probe = xhci_fsl_probe, .remove = xhci_fsl_remove, .ops = &xhci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct xhci_fsl_priv), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct xhci_fsl_priv), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; #else diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index f62e232..d301acc 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -300,6 +300,6 @@ U_BOOT_DRIVER(usb_xhci) = { .remove = xhci_mtk_remove, .ops = &xhci_usb_ops, .bind = dm_scan_fdt_dev, - .priv_auto_alloc_size = sizeof(struct mtk_xhci), + .priv_auto = sizeof(struct mtk_xhci), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c index f2e338f..46b89de 100644 --- a/drivers/usb/host/xhci-mvebu.c +++ b/drivers/usb/host/xhci-mvebu.c @@ -15,7 +15,7 @@ #include <usb/xhci.h> -struct mvebu_xhci_platdata { +struct mvebu_xhci_plat { fdt_addr_t hcd_base; }; @@ -25,7 +25,7 @@ struct mvebu_xhci_platdata { */ struct mvebu_xhci { struct xhci_ctrl ctrl; /* Needs to come first in this struct! */ - struct usb_platdata usb_plat; + struct usb_plat usb_plat; struct xhci_hccr *hcd; }; @@ -40,7 +40,7 @@ __weak int board_xhci_enable(fdt_addr_t base) static int xhci_usb_probe(struct udevice *dev) { - struct mvebu_xhci_platdata *plat = dev_get_platdata(dev); + struct mvebu_xhci_plat *plat = dev_get_plat(dev); struct mvebu_xhci *ctx = dev_get_priv(dev); struct xhci_hcor *hcor; int len, ret; @@ -65,9 +65,9 @@ static int xhci_usb_probe(struct udevice *dev) return xhci_register(dev, ctx->hcd, hcor); } -static int xhci_usb_ofdata_to_platdata(struct udevice *dev) +static int xhci_usb_of_to_plat(struct udevice *dev) { - struct mvebu_xhci_platdata *plat = dev_get_platdata(dev); + struct mvebu_xhci_plat *plat = dev_get_plat(dev); /* * Get the base address for XHCI controller from the device node @@ -92,11 +92,11 @@ U_BOOT_DRIVER(usb_xhci) = { .name = "xhci_mvebu", .id = UCLASS_USB, .of_match = xhci_usb_ids, - .ofdata_to_platdata = xhci_usb_ofdata_to_platdata, + .of_to_plat = xhci_usb_of_to_plat, .probe = xhci_usb_probe, .remove = xhci_deregister, .ops = &xhci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct mvebu_xhci_platdata), - .priv_auto_alloc_size = sizeof(struct mvebu_xhci), + .plat_auto = sizeof(struct mvebu_xhci_plat), + .priv_auto = sizeof(struct mvebu_xhci), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 9fb6d2f..2b445f2 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -59,8 +59,8 @@ U_BOOT_DRIVER(xhci_pci) = { .remove = xhci_deregister, .of_match = xhci_pci_ids, .ops = &xhci_usb_ops, - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct xhci_ctrl), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct xhci_ctrl), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c index 5379dba..5fc7afb 100644 --- a/drivers/usb/host/xhci-rcar.c +++ b/drivers/usb/host/xhci-rcar.c @@ -29,7 +29,7 @@ #define RCAR_USB3_DL_CTRL_FW_SUCCESS BIT(4) #define RCAR_USB3_DL_CTRL_FW_SET_DATA0 BIT(8) -struct rcar_xhci_platdata { +struct rcar_xhci_plat { fdt_addr_t hcd_base; struct clk clk; }; @@ -40,7 +40,7 @@ struct rcar_xhci_platdata { */ struct rcar_xhci { struct xhci_ctrl ctrl; /* Needs to come first in this struct! */ - struct usb_platdata usb_plat; + struct usb_plat usb_plat; struct xhci_hccr *hcd; }; @@ -76,7 +76,7 @@ static int xhci_rcar_download_fw(struct rcar_xhci *ctx, const u32 *fw_data, static int xhci_rcar_probe(struct udevice *dev) { - struct rcar_xhci_platdata *plat = dev_get_platdata(dev); + struct rcar_xhci_plat *plat = dev_get_plat(dev); struct rcar_xhci *ctx = dev_get_priv(dev); struct xhci_hcor *hcor; int len, ret; @@ -122,7 +122,7 @@ err_clk: static int xhci_rcar_deregister(struct udevice *dev) { int ret; - struct rcar_xhci_platdata *plat = dev_get_platdata(dev); + struct rcar_xhci_plat *plat = dev_get_plat(dev); ret = xhci_deregister(dev); @@ -132,9 +132,9 @@ static int xhci_rcar_deregister(struct udevice *dev) return ret; } -static int xhci_rcar_ofdata_to_platdata(struct udevice *dev) +static int xhci_rcar_of_to_plat(struct udevice *dev) { - struct rcar_xhci_platdata *plat = dev_get_platdata(dev); + struct rcar_xhci_plat *plat = dev_get_plat(dev); plat->hcd_base = dev_read_addr(dev); if (plat->hcd_base == FDT_ADDR_T_NONE) { @@ -160,8 +160,8 @@ U_BOOT_DRIVER(usb_xhci) = { .remove = xhci_rcar_deregister, .ops = &xhci_usb_ops, .of_match = xhci_rcar_ids, - .ofdata_to_platdata = xhci_rcar_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct rcar_xhci_platdata), - .priv_auto_alloc_size = sizeof(struct rcar_xhci), + .of_to_plat = xhci_rcar_of_to_plat, + .plat_auto = sizeof(struct rcar_xhci_plat), + .priv_auto = sizeof(struct rcar_xhci), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index 28136f8..2f5cc9b 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -802,7 +802,7 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb) mtu->ippc_base = ssusb->ippc_base; mtu->mac_base = ssusb->mac_base; mtu->ssusb = ssusb; - mtu->max_speed = usb_get_maximum_speed(dev->node); + mtu->max_speed = usb_get_maximum_speed(dev_ofnode(dev)); mtu->force_vbus = dev_read_bool(dev, "mediatek,force-vbus"); ret = mtu3_hw_init(mtu); diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c index 3795e69..b097471 100644 --- a/drivers/usb/mtu3/mtu3_plat.c +++ b/drivers/usb/mtu3/mtu3_plat.c @@ -173,7 +173,7 @@ static int get_ssusb_rscs(struct udevice *dev, struct ssusb_mtk *ssusb) return -ENODEV; } - ssusb->dr_mode = usb_get_dr_mode(child->node); + ssusb->dr_mode = usb_get_dr_mode(dev_ofnode(child)); if (ssusb->dr_mode == USB_DR_MODE_UNKNOWN || ssusb->dr_mode == USB_DR_MODE_OTG) @@ -257,7 +257,7 @@ U_BOOT_DRIVER(mtu3_peripheral) = { .of_match = ssusb_of_match, .probe = mtu3_gadget_probe, .remove = mtu3_gadget_remove, - .priv_auto_alloc_size = sizeof(struct mtu3), + .priv_auto = sizeof(struct mtu3), }; #endif @@ -298,7 +298,7 @@ U_BOOT_DRIVER(mtu3_host) = { .of_match = ssusb_of_match, .probe = mtu3_host_probe, .remove = mtu3_host_remove, - .priv_auto_alloc_size = sizeof(struct mtu3_host), + .priv_auto = sizeof(struct mtu3_host), .ops = &xhci_usb_ops, .flags = DM_FLAG_ALLOC_PRIV_DMA, }; @@ -313,7 +313,7 @@ static int mtu3_glue_bind(struct udevice *parent) ofnode node; int ret; - node = ofnode_by_compatible(parent->node, "mediatek,ssusb"); + node = ofnode_by_compatible(dev_ofnode(parent), "mediatek,ssusb"); if (!ofnode_valid(node)) return -ENODEV; @@ -365,5 +365,5 @@ U_BOOT_DRIVER(mtu3) = { .bind = mtu3_glue_bind, .probe = mtu3_probe, .remove = mtu3_remove, - .priv_auto_alloc_size = sizeof(struct ssusb_mtk), + .priv_auto = sizeof(struct ssusb_mtk), }; diff --git a/drivers/usb/musb-new/da8xx.c b/drivers/usb/musb-new/da8xx.c index 67488dd..f428035 100644 --- a/drivers/usb/musb-new/da8xx.c +++ b/drivers/usb/musb-new/da8xx.c @@ -247,7 +247,7 @@ const struct musb_platform_ops da8xx_ops = { .disable = da8xx_musb_disable, }; -struct da8xx_musb_platdata { +struct da8xx_musb_plat { void *base; void *ctrl_mod_base; struct musb_hdrc_platform_data plat; @@ -256,45 +256,45 @@ struct da8xx_musb_platdata { struct phy phy; }; -static int da8xx_musb_ofdata_to_platdata(struct udevice *dev) +static int da8xx_musb_of_to_plat(struct udevice *dev) { - struct da8xx_musb_platdata *platdata = dev_get_platdata(dev); + struct da8xx_musb_plat *plat = dev_get_plat(dev); const void *fdt = gd->fdt_blob; int node = dev_of_offset(dev); - platdata->base = (void *)dev_read_addr_ptr(dev); - platdata->musb_config.multipoint = 1; - platdata->musb_config.dyn_fifo = 1; - platdata->musb_config.num_eps = 5; - platdata->musb_config.ram_bits = 10; - platdata->plat.power = fdtdec_get_int(fdt, node, "power", 50); - platdata->otg_board_data.interface_type = MUSB_INTERFACE_UTMI; - platdata->plat.mode = MUSB_HOST; - platdata->otg_board_data.dev = dev; - platdata->plat.config = &platdata->musb_config; - platdata->plat.platform_ops = &da8xx_ops; - platdata->plat.board_data = &platdata->otg_board_data; - platdata->otg_board_data.clear_irq = da8xx_musb_clear_irq; - platdata->otg_board_data.reset = da8xx_musb_reset; + plat->base = (void *)dev_read_addr_ptr(dev); + plat->musb_config.multipoint = 1; + plat->musb_config.dyn_fifo = 1; + plat->musb_config.num_eps = 5; + plat->musb_config.ram_bits = 10; + plat->plat.power = fdtdec_get_int(fdt, node, "power", 50); + plat->otg_board_data.interface_type = MUSB_INTERFACE_UTMI; + plat->plat.mode = MUSB_HOST; + plat->otg_board_data.dev = dev; + plat->plat.config = &plat->musb_config; + plat->plat.platform_ops = &da8xx_ops; + plat->plat.board_data = &plat->otg_board_data; + plat->otg_board_data.clear_irq = da8xx_musb_clear_irq; + plat->otg_board_data.reset = da8xx_musb_reset; return 0; } static int da8xx_musb_probe(struct udevice *dev) { struct musb_host_data *host = dev_get_priv(dev); - struct da8xx_musb_platdata *platdata = dev_get_platdata(dev); + struct da8xx_musb_plat *plat = dev_get_plat(dev); struct usb_bus_priv *priv = dev_get_uclass_priv(dev); struct omap_musb_board_data *otg_board_data; int ret; void *base = dev_read_addr_ptr(dev); /* Get the phy info from the device tree */ - ret = generic_phy_get_by_name(dev, "usb-phy", &platdata->phy); + ret = generic_phy_get_by_name(dev, "usb-phy", &plat->phy); if (ret) return ret; /* Initialize the phy */ - ret = generic_phy_init(&platdata->phy); + ret = generic_phy_init(&plat->phy); if (ret) return ret; @@ -302,14 +302,14 @@ static int da8xx_musb_probe(struct udevice *dev) lpsc_on(33); /* Enable phy */ - generic_phy_power_on(&platdata->phy); + generic_phy_power_on(&plat->phy); priv->desc_before_addr = true; - otg_board_data = &platdata->otg_board_data; + otg_board_data = &plat->otg_board_data; - host->host = musb_init_controller(&platdata->plat, + host->host = musb_init_controller(&plat->plat, (struct device *)otg_board_data, - platdata->base); + plat->base); if (!host->host) { ret = -ENODEV; goto shutdown; /* Shutdown what we started */ @@ -321,7 +321,7 @@ static int da8xx_musb_probe(struct udevice *dev) return 0; shutdown: /* Turn off the phy if we fail */ - generic_phy_power_off(&platdata->phy); + generic_phy_power_off(&plat->phy); lpsc_disable(33); return ret; } @@ -344,10 +344,10 @@ U_BOOT_DRIVER(da8xx_musb) = { .name = "da8xx-musb", .id = UCLASS_USB, .of_match = da8xx_musb_ids, - .ofdata_to_platdata = da8xx_musb_ofdata_to_platdata, + .of_to_plat = da8xx_musb_of_to_plat, .probe = da8xx_musb_probe, .remove = da8xx_musb_remove, .ops = &musb_usb_ops, - .platdata_auto_alloc_size = sizeof(struct da8xx_musb_platdata), - .priv_auto_alloc_size = sizeof(struct musb_host_data), + .plat_auto = sizeof(struct da8xx_musb_plat), + .priv_auto = sizeof(struct musb_host_data), }; diff --git a/drivers/usb/musb-new/mt85xx.c b/drivers/usb/musb-new/mt85xx.c index 8f0561e..730045c 100644 --- a/drivers/usb/musb-new/mt85xx.c +++ b/drivers/usb/musb-new/mt85xx.c @@ -414,6 +414,6 @@ U_BOOT_DRIVER(mtk_musb) = { #ifdef CONFIG_USB_MUSB_HOST .ops = &musb_usb_ops, #endif - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct mtk_musb_glue), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct mtk_musb_glue), }; diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c index da63cc2..3fdcaea 100644 --- a/drivers/usb/musb-new/omap2430.c +++ b/drivers/usb/musb-new/omap2430.c @@ -141,7 +141,7 @@ const struct musb_platform_ops omap2430_ops = { #if CONFIG_IS_ENABLED(DM_USB) -struct omap2430_musb_platdata { +struct omap2430_musb_plat { void *base; void *ctrl_mod_base; struct musb_hdrc_platform_data plat; @@ -149,69 +149,65 @@ struct omap2430_musb_platdata { struct omap_musb_board_data otg_board_data; }; -static int omap2430_musb_ofdata_to_platdata(struct udevice *dev) +static int omap2430_musb_of_to_plat(struct udevice *dev) { - struct omap2430_musb_platdata *platdata = dev_get_platdata(dev); + struct omap2430_musb_plat *plat = dev_get_plat(dev); const void *fdt = gd->fdt_blob; int node = dev_of_offset(dev); - platdata->base = (void *)dev_read_addr_ptr(dev); + plat->base = (void *)dev_read_addr_ptr(dev); - platdata->musb_config.multipoint = fdtdec_get_int(fdt, node, - "multipoint", - -1); - if (platdata->musb_config.multipoint < 0) { + plat->musb_config.multipoint = fdtdec_get_int(fdt, node, "multipoint", + -1); + if (plat->musb_config.multipoint < 0) { pr_err("MUSB multipoint DT entry missing\n"); return -ENOENT; } - platdata->musb_config.dyn_fifo = 1; - platdata->musb_config.num_eps = fdtdec_get_int(fdt, node, - "num-eps", -1); - if (platdata->musb_config.num_eps < 0) { + plat->musb_config.dyn_fifo = 1; + plat->musb_config.num_eps = fdtdec_get_int(fdt, node, "num-eps", -1); + if (plat->musb_config.num_eps < 0) { pr_err("MUSB num-eps DT entry missing\n"); return -ENOENT; } - platdata->musb_config.ram_bits = fdtdec_get_int(fdt, node, - "ram-bits", -1); - if (platdata->musb_config.ram_bits < 0) { + plat->musb_config.ram_bits = fdtdec_get_int(fdt, node, "ram-bits", -1); + if (plat->musb_config.ram_bits < 0) { pr_err("MUSB ram-bits DT entry missing\n"); return -ENOENT; } - platdata->plat.power = fdtdec_get_int(fdt, node, - "power", -1); - if (platdata->plat.power < 0) { + plat->plat.power = fdtdec_get_int(fdt, node, "power", -1); + if (plat->plat.power < 0) { pr_err("MUSB power DT entry missing\n"); return -ENOENT; } - platdata->otg_board_data.interface_type = fdtdec_get_int(fdt, node, - "interface-type", -1); - if (platdata->otg_board_data.interface_type < 0) { + plat->otg_board_data.interface_type = fdtdec_get_int(fdt, node, + "interface-type", + -1); + if (plat->otg_board_data.interface_type < 0) { pr_err("MUSB interface-type DT entry missing\n"); return -ENOENT; } #if 0 /* In a perfect world, mode would be set to OTG, mode 3 from DT */ - platdata->plat.mode = fdtdec_get_int(fdt, node, - "mode", -1); - if (platdata->plat.mode < 0) { + plat->plat.mode = fdtdec_get_int(fdt, node, "mode", -1); + if (plat->plat.mode < 0) { pr_err("MUSB mode DT entry missing\n"); return -ENOENT; } #else /* MUSB_OTG, it doesn't work */ #ifdef CONFIG_USB_MUSB_HOST /* Host seems to be the only option that works */ - platdata->plat.mode = MUSB_HOST; + plat->plat.mode = MUSB_HOST; #else /* For that matter, MUSB_PERIPHERAL doesn't either */ - platdata->plat.mode = MUSB_PERIPHERAL; + plat->plat.mode = MUSB_PERIPHERAL; #endif #endif - platdata->otg_board_data.dev = dev; - platdata->plat.config = &platdata->musb_config; - platdata->plat.platform_ops = &omap2430_ops; - platdata->plat.board_data = &platdata->otg_board_data; + plat->otg_board_data.dev = dev; + plat->plat.config = &plat->musb_config; + plat->plat.platform_ops = &omap2430_ops; + plat->plat.board_data = &plat->otg_board_data; return 0; } @@ -222,7 +218,7 @@ static int omap2430_musb_probe(struct udevice *dev) #else struct musb *musbp; #endif - struct omap2430_musb_platdata *platdata = dev_get_platdata(dev); + struct omap2430_musb_plat *plat = dev_get_plat(dev); struct usb_bus_priv *priv = dev_get_uclass_priv(dev); struct omap_musb_board_data *otg_board_data; int ret = 0; @@ -230,21 +226,20 @@ static int omap2430_musb_probe(struct udevice *dev) priv->desc_before_addr = true; - otg_board_data = &platdata->otg_board_data; + otg_board_data = &plat->otg_board_data; #ifdef CONFIG_USB_MUSB_HOST - host->host = musb_init_controller(&platdata->plat, + host->host = musb_init_controller(&plat->plat, (struct device *)otg_board_data, - platdata->base); + plat->base); if (!host->host) { return -EIO; } ret = musb_lowlevel_init(host); #else - musbp = musb_register(&platdata->plat, - (struct device *)otg_board_data, - platdata->base); + musbp = musb_register(&plat->plat, (struct device *)otg_board_data, + plat->base); if (IS_ERR_OR_NULL(musbp)) return -EINVAL; #endif @@ -274,14 +269,14 @@ U_BOOT_DRIVER(omap2430_musb) = { .id = UCLASS_USB_GADGET_GENERIC, #endif .of_match = omap2430_musb_ids, - .ofdata_to_platdata = omap2430_musb_ofdata_to_platdata, + .of_to_plat = omap2430_musb_of_to_plat, .probe = omap2430_musb_probe, .remove = omap2430_musb_remove, #ifdef CONFIG_USB_MUSB_HOST .ops = &musb_usb_ops, #endif - .platdata_auto_alloc_size = sizeof(struct omap2430_musb_platdata), - .priv_auto_alloc_size = sizeof(struct musb_host_data), + .plat_auto = sizeof(struct omap2430_musb_plat), + .priv_auto = sizeof(struct musb_host_data), }; #endif /* CONFIG_IS_ENABLED(DM_USB) */ diff --git a/drivers/usb/musb-new/pic32.c b/drivers/usb/musb-new/pic32.c index 2fbe9be..b833f10 100644 --- a/drivers/usb/musb-new/pic32.c +++ b/drivers/usb/musb-new/pic32.c @@ -288,6 +288,6 @@ U_BOOT_DRIVER(usb_musb) = { #ifdef CONFIG_USB_MUSB_HOST .ops = &musb_usb_ops, #endif - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct pic32_musb_data), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct pic32_musb_data), }; diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index 187db77..fea4105 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -552,6 +552,6 @@ U_BOOT_DRIVER(usb_musb) = { #ifdef CONFIG_USB_MUSB_HOST .ops = &musb_usb_ops, #endif - .platdata_auto_alloc_size = sizeof(struct usb_platdata), - .priv_auto_alloc_size = sizeof(struct sunxi_glue), + .plat_auto = sizeof(struct usb_plat), + .priv_auto = sizeof(struct sunxi_glue), }; diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index f4f26d8..75cf181 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -33,17 +33,17 @@ DECLARE_GLOBAL_DATA_PTR; static void ti_musb_set_phy_power(struct udevice *dev, u8 on) { - struct ti_musb_platdata *platdata = dev_get_platdata(dev); + struct ti_musb_plat *plat = dev_get_plat(dev); - if (!platdata->ctrl_mod_base) + if (!plat->ctrl_mod_base) return; if (on) { - clrsetbits_le32(platdata->ctrl_mod_base, + clrsetbits_le32(plat->ctrl_mod_base, CM_PHY_PWRDN | CM_PHY_OTG_PWRDN, OTGVDET_EN | OTGSESSENDEN); } else { - clrsetbits_le32(platdata->ctrl_mod_base, 0, + clrsetbits_le32(plat->ctrl_mod_base, 0, CM_PHY_PWRDN | CM_PHY_OTG_PWRDN); } } @@ -77,9 +77,9 @@ static int ti_musb_get_usb_index(int node) return -ENOENT; } -static int ti_musb_ofdata_to_platdata(struct udevice *dev) +static int ti_musb_of_to_plat(struct udevice *dev) { - struct ti_musb_platdata *platdata = dev_get_platdata(dev); + struct ti_musb_plat *plat = dev_get_plat(dev); const void *fdt = gd->fdt_blob; int node = dev_of_offset(dev); int phys; @@ -87,18 +87,18 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) int usb_index; struct musb_hdrc_config *musb_config; - platdata->base = (void *)devfdt_get_addr_index(dev, 1); + plat->base = (void *)devfdt_get_addr_index(dev, 1); phys = fdtdec_lookup_phandle(fdt, node, "phys"); ctrl_mod = fdtdec_lookup_phandle(fdt, phys, "ti,ctrl_mod"); - platdata->ctrl_mod_base = (void *)fdtdec_get_addr(fdt, ctrl_mod, "reg"); + plat->ctrl_mod_base = (void *)fdtdec_get_addr(fdt, ctrl_mod, "reg"); usb_index = ti_musb_get_usb_index(node); switch (usb_index) { case 1: - platdata->ctrl_mod_base += AM335X_USB1_CTRL; + plat->ctrl_mod_base += AM335X_USB1_CTRL; break; case 0: - platdata->ctrl_mod_base += AM335X_USB0_CTRL; + plat->ctrl_mod_base += AM335X_USB0_CTRL; break; default: break; @@ -130,15 +130,15 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) return -ENOENT; } - platdata->plat.config = musb_config; + plat->plat.config = musb_config; - platdata->plat.power = fdtdec_get_int(fdt, node, "mentor,power", -1); - if (platdata->plat.power < 0) { + plat->plat.power = fdtdec_get_int(fdt, node, "mentor,power", -1); + if (plat->plat.power < 0) { pr_err("MUSB mentor,power DT entry missing\n"); return -ENOENT; } - platdata->plat.platform_ops = &musb_dsps_ops; + plat->plat.platform_ops = &musb_dsps_ops; return 0; } @@ -147,15 +147,15 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) static int ti_musb_host_probe(struct udevice *dev) { struct musb_host_data *host = dev_get_priv(dev); - struct ti_musb_platdata *platdata = dev_get_platdata(dev); + struct ti_musb_plat *plat = dev_get_plat(dev); struct usb_bus_priv *priv = dev_get_uclass_priv(dev); int ret; priv->desc_before_addr = true; - host->host = musb_init_controller(&platdata->plat, + host->host = musb_init_controller(&plat->plat, NULL, - platdata->base); + plat->base); if (!host->host) return -EIO; @@ -176,20 +176,20 @@ static int ti_musb_host_remove(struct udevice *dev) } #if CONFIG_IS_ENABLED(OF_CONTROL) -static int ti_musb_host_ofdata_to_platdata(struct udevice *dev) +static int ti_musb_host_of_to_plat(struct udevice *dev) { - struct ti_musb_platdata *platdata = dev_get_platdata(dev); + struct ti_musb_plat *plat = dev_get_plat(dev); const void *fdt = gd->fdt_blob; int node = dev_of_offset(dev); int ret; - ret = ti_musb_ofdata_to_platdata(dev); + ret = ti_musb_of_to_plat(dev); if (ret) { - pr_err("platdata dt parse error\n"); + pr_err("plat dt parse error\n"); return ret; } - platdata->plat.mode = MUSB_HOST; + plat->plat.mode = MUSB_HOST; return 0; } @@ -199,13 +199,13 @@ U_BOOT_DRIVER(ti_musb_host) = { .name = "ti-musb-host", .id = UCLASS_USB, #if CONFIG_IS_ENABLED(OF_CONTROL) - .ofdata_to_platdata = ti_musb_host_ofdata_to_platdata, + .of_to_plat = ti_musb_host_of_to_plat, #endif .probe = ti_musb_host_probe, .remove = ti_musb_host_remove, .ops = &musb_usb_ops, - .platdata_auto_alloc_size = sizeof(struct ti_musb_platdata), - .priv_auto_alloc_size = sizeof(struct musb_host_data), + .plat_auto = sizeof(struct ti_musb_plat), + .priv_auto = sizeof(struct musb_host_data), }; #if CONFIG_IS_ENABLED(DM_USB_GADGET) @@ -214,19 +214,19 @@ struct ti_musb_peripheral { }; #if CONFIG_IS_ENABLED(OF_CONTROL) -static int ti_musb_peripheral_ofdata_to_platdata(struct udevice *dev) +static int ti_musb_peripheral_of_to_plat(struct udevice *dev) { - struct ti_musb_platdata *platdata = dev_get_platdata(dev); + struct ti_musb_plat *plat = dev_get_plat(dev); const void *fdt = gd->fdt_blob; int node = dev_of_offset(dev); int ret; - ret = ti_musb_ofdata_to_platdata(dev); + ret = ti_musb_of_to_plat(dev); if (ret) { - pr_err("platdata dt parse error\n"); + pr_err("plat dt parse error\n"); return ret; } - platdata->plat.mode = MUSB_PERIPHERAL; + plat->plat.mode = MUSB_PERIPHERAL; return 0; } @@ -244,12 +244,12 @@ int dm_usb_gadget_handle_interrupts(struct udevice *dev) static int ti_musb_peripheral_probe(struct udevice *dev) { struct ti_musb_peripheral *priv = dev_get_priv(dev); - struct ti_musb_platdata *platdata = dev_get_platdata(dev); + struct ti_musb_plat *plat = dev_get_plat(dev); int ret; - priv->periph = musb_init_controller(&platdata->plat, + priv->periph = musb_init_controller(&plat->plat, NULL, - platdata->base); + plat->base); if (!priv->periph) return -EIO; @@ -272,13 +272,13 @@ U_BOOT_DRIVER(ti_musb_peripheral) = { .name = "ti-musb-peripheral", .id = UCLASS_USB_GADGET_GENERIC, #if CONFIG_IS_ENABLED(OF_CONTROL) - .ofdata_to_platdata = ti_musb_peripheral_ofdata_to_platdata, + .of_to_plat = ti_musb_peripheral_of_to_plat, #endif .probe = ti_musb_peripheral_probe, .remove = ti_musb_peripheral_remove, .ops = &musb_usb_ops, - .platdata_auto_alloc_size = sizeof(struct ti_musb_platdata), - .priv_auto_alloc_size = sizeof(struct ti_musb_peripheral), + .plat_auto = sizeof(struct ti_musb_plat), + .priv_auto = sizeof(struct ti_musb_peripheral), .flags = DM_FLAG_PRE_RELOC, }; #endif @@ -289,7 +289,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) ofnode node; int ret; - ofnode_for_each_subnode(node, parent->node) { + ofnode_for_each_subnode(node, dev_ofnode(parent)) { struct udevice *dev; const char *name = ofnode_get_name(node); enum usb_dr_mode dr_mode; diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 998271b..7136340 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -652,6 +652,13 @@ config VIDEO_NX HDMI. This option enables this support which can be used on devices which have an eDP display connected. +config VIDEO_SEPS525 + bool "Enable video support for Seps525" + depends on DM_VIDEO + help + Enable support for the Syncoam PM-OLED display driver (RGB 160x128). + Currently driver is supporting only SPI interface. + source "drivers/video/nexell/Kconfig" config VIDEO diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 67a492a..9db96aa 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_VESA) += vesa.o +obj-$(CONFIG_VIDEO_SEPS525) += seps525.o obj-y += bridge/ obj-y += sunxi/ diff --git a/drivers/video/am335x-fb.c b/drivers/video/am335x-fb.c index 2707ff5..e99a918 100644 --- a/drivers/video/am335x-fb.c +++ b/drivers/video/am335x-fb.c @@ -368,7 +368,7 @@ struct am335x_fb_priv { static int am335x_fb_remove(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); uc_plat->base -= 0x20; uc_plat->size += 0x20; @@ -377,7 +377,7 @@ static int am335x_fb_remove(struct udevice *dev) static int am335x_fb_probe(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct am335x_fb_priv *priv = dev_get_priv(dev); struct am335x_lcdhw *regs = priv->regs; @@ -498,7 +498,7 @@ static int am335x_fb_probe(struct udevice *dev) return 0; } -static int am335x_fb_ofdata_to_platdata(struct udevice *dev) +static int am335x_fb_of_to_plat(struct udevice *dev) { struct am335x_fb_priv *priv = dev_get_priv(dev); struct tilcdc_panel_info *panel = &priv->panel; @@ -592,7 +592,7 @@ static int am335x_fb_ofdata_to_platdata(struct udevice *dev) static int am335x_fb_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); uc_plat->size = ((LCD_MAX_WIDTH * LCD_MAX_HEIGHT * (1 << LCD_MAX_LOG2_BPP)) >> 3) + 0x20; @@ -611,10 +611,10 @@ U_BOOT_DRIVER(am335x_fb) = { .id = UCLASS_VIDEO, .of_match = am335x_fb_ids, .bind = am335x_fb_bind, - .ofdata_to_platdata = am335x_fb_ofdata_to_platdata, + .of_to_plat = am335x_fb_of_to_plat, .probe = am335x_fb_probe, .remove = am335x_fb_remove, - .priv_auto_alloc_size = sizeof(struct am335x_fb_priv), + .priv_auto = sizeof(struct am335x_fb_priv), }; #endif /* CONFIG_DM_VIDEO */ diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c index 38def28..0485ae2 100644 --- a/drivers/video/atmel_hlcdfb.c +++ b/drivers/video/atmel_hlcdfb.c @@ -293,7 +293,7 @@ static int at91_hlcdc_enable_clk(struct udevice *dev) static void atmel_hlcdc_init(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct atmel_hlcdc_priv *priv = dev_get_priv(dev); struct atmel_hlcd_regs *regs = priv->regs; struct display_timing *timing = &priv->timing; @@ -501,7 +501,7 @@ static int atmel_hlcdc_probe(struct udevice *dev) return 0; } -static int atmel_hlcdc_ofdata_to_platdata(struct udevice *dev) +static int atmel_hlcdc_of_to_plat(struct udevice *dev) { struct atmel_hlcdc_priv *priv = dev_get_priv(dev); const void *blob = gd->fdt_blob; @@ -539,7 +539,7 @@ static int atmel_hlcdc_ofdata_to_platdata(struct udevice *dev) static int atmel_hlcdc_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); uc_plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT * (1 << LCD_MAX_LOG2_BPP) / 8; @@ -561,8 +561,8 @@ U_BOOT_DRIVER(atmel_hlcdfb) = { .of_match = atmel_hlcdc_ids, .bind = atmel_hlcdc_bind, .probe = atmel_hlcdc_probe, - .ofdata_to_platdata = atmel_hlcdc_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct atmel_hlcdc_priv), + .of_to_plat = atmel_hlcdc_of_to_plat, + .priv_auto = sizeof(struct atmel_hlcdc_priv), }; #endif diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index ae8ec26..f87c022 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c @@ -245,7 +245,7 @@ ulong calc_fbsize(void) #ifdef CONFIG_DM_VIDEO static int atmel_fb_lcd_probe(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct atmel_fb_priv *priv = dev_get_priv(dev); struct display_timing *timing = &priv->timing; @@ -267,9 +267,9 @@ static int atmel_fb_lcd_probe(struct udevice *dev) return 0; } -static int atmel_fb_ofdata_to_platdata(struct udevice *dev) +static int atmel_fb_of_to_plat(struct udevice *dev) { - struct atmel_lcd_platdata *plat = dev_get_platdata(dev); + struct atmel_lcd_plat *plat = dev_get_plat(dev); struct atmel_fb_priv *priv = dev_get_priv(dev); struct display_timing *timing = &priv->timing; const void *blob = gd->fdt_blob; @@ -285,7 +285,7 @@ static int atmel_fb_ofdata_to_platdata(struct udevice *dev) static int atmel_fb_lcd_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); uc_plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT * (1 << VIDEO_BPP16) / 8; @@ -304,9 +304,9 @@ U_BOOT_DRIVER(atmel_fb) = { .id = UCLASS_VIDEO, .of_match = atmel_fb_lcd_ids, .bind = atmel_fb_lcd_bind, - .ofdata_to_platdata = atmel_fb_ofdata_to_platdata, + .of_to_plat = atmel_fb_of_to_plat, .probe = atmel_fb_lcd_probe, - .platdata_auto_alloc_size = sizeof(struct atmel_lcd_platdata), - .priv_auto_alloc_size = sizeof(struct atmel_fb_priv), + .plat_auto = sizeof(struct atmel_lcd_plat), + .priv_auto = sizeof(struct atmel_fb_priv), }; #endif diff --git a/drivers/video/backlight_gpio.c b/drivers/video/backlight_gpio.c index 433d097..eea824a 100644 --- a/drivers/video/backlight_gpio.c +++ b/drivers/video/backlight_gpio.c @@ -24,7 +24,7 @@ static int gpio_backlight_enable(struct udevice *dev) return 0; } -static int gpio_backlight_ofdata_to_platdata(struct udevice *dev) +static int gpio_backlight_of_to_plat(struct udevice *dev) { struct gpio_backlight_priv *priv = dev_get_priv(dev); int ret; @@ -66,7 +66,7 @@ U_BOOT_DRIVER(gpio_backlight) = { .id = UCLASS_PANEL_BACKLIGHT, .of_match = gpio_backlight_ids, .ops = &gpio_backlight_ops, - .ofdata_to_platdata = gpio_backlight_ofdata_to_platdata, + .of_to_plat = gpio_backlight_of_to_plat, .probe = gpio_backlight_probe, - .priv_auto_alloc_size = sizeof(struct gpio_backlight_priv), + .priv_auto = sizeof(struct gpio_backlight_priv), }; diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c index 0888cb0..9326999 100644 --- a/drivers/video/bcm2835.c +++ b/drivers/video/bcm2835.c @@ -13,7 +13,7 @@ static int bcm2835_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); int ret; int w, h, pitch; diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c index 1c5270f..93fa25f 100644 --- a/drivers/video/bridge/anx6345.c +++ b/drivers/video/bridge/anx6345.c @@ -74,7 +74,7 @@ static int anx6345_read(struct udevice *dev, unsigned int addr_off, static int anx6345_write_r0(struct udevice *dev, unsigned char reg_addr, unsigned char value) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); return anx6345_write(dev, chip->chip_addr, reg_addr, value); } @@ -82,7 +82,7 @@ static int anx6345_write_r0(struct udevice *dev, unsigned char reg_addr, static int anx6345_read_r0(struct udevice *dev, unsigned char reg_addr, unsigned char *value) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); return anx6345_read(dev, chip->chip_addr, reg_addr, value); } @@ -90,7 +90,7 @@ static int anx6345_read_r0(struct udevice *dev, unsigned char reg_addr, static int anx6345_write_r1(struct udevice *dev, unsigned char reg_addr, unsigned char value) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); return anx6345_write(dev, chip->chip_addr + 1, reg_addr, value); } @@ -98,7 +98,7 @@ static int anx6345_write_r1(struct udevice *dev, unsigned char reg_addr, static int anx6345_read_r1(struct udevice *dev, unsigned char reg_addr, unsigned char *value) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); return anx6345_read(dev, chip->chip_addr + 1, reg_addr, value); } @@ -421,5 +421,5 @@ U_BOOT_DRIVER(analogix_anx6345) = { .of_match = anx6345_ids, .probe = anx6345_probe, .ops = &anx6345_ops, - .priv_auto_alloc_size = sizeof(struct anx6345_priv), + .priv_auto = sizeof(struct anx6345_priv), }; diff --git a/drivers/video/bridge/ps862x.c b/drivers/video/bridge/ps862x.c index 8399c6f..76115b7 100644 --- a/drivers/video/bridge/ps862x.c +++ b/drivers/video/bridge/ps862x.c @@ -37,7 +37,7 @@ DECLARE_GLOBAL_DATA_PTR; static int ps8622_write(struct udevice *dev, unsigned addr_off, unsigned char reg_addr, unsigned char value) { - struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct dm_i2c_chip *chip = dev_get_parent_plat(dev); uint8_t buf[2]; struct i2c_msg msg; int ret; diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index 389b02c..08d38b2 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -134,6 +134,6 @@ int video_bridge_set_active(struct udevice *dev, bool active) UCLASS_DRIVER(video_bridge) = { .id = UCLASS_VIDEO_BRIDGE, .name = "video_bridge", - .per_device_auto_alloc_size = sizeof(struct video_bridge_priv), + .per_device_auto = sizeof(struct video_bridge_priv), .pre_probe = video_bridge_pre_probe, }; diff --git a/drivers/video/broadwell_igd.c b/drivers/video/broadwell_igd.c index df6a761..cba105c 100644 --- a/drivers/video/broadwell_igd.c +++ b/drivers/video/broadwell_igd.c @@ -356,7 +356,7 @@ static int gtt_poll(struct broadwell_igd_priv *priv, u32 reg, u32 mask, static void igd_setup_panel(struct udevice *dev) { - struct broadwell_igd_plat *plat = dev_get_platdata(dev); + struct broadwell_igd_plat *plat = dev_get_plat(dev); struct broadwell_igd_priv *priv = dev_get_priv(dev); u32 reg32; @@ -398,7 +398,7 @@ static void igd_setup_panel(struct udevice *dev) static int igd_cdclk_init_haswell(struct udevice *dev) { - struct broadwell_igd_plat *plat = dev_get_platdata(dev); + struct broadwell_igd_plat *plat = dev_get_plat(dev); struct broadwell_igd_priv *priv = dev_get_priv(dev); int cdclk = plat->cdclk; u16 devid; @@ -472,7 +472,7 @@ err: static int igd_cdclk_init_broadwell(struct udevice *dev) { - struct broadwell_igd_plat *plat = dev_get_platdata(dev); + struct broadwell_igd_plat *plat = dev_get_plat(dev); struct broadwell_igd_priv *priv = dev_get_priv(dev); int cdclk = plat->cdclk; u32 dpdiv, lpcll, pwctl, cdset; @@ -567,7 +567,7 @@ u8 systemagent_revision(struct udevice *bus) static int igd_pre_init(struct udevice *dev, bool is_broadwell) { - struct broadwell_igd_plat *plat = dev_get_platdata(dev); + struct broadwell_igd_plat *plat = dev_get_plat(dev); struct broadwell_igd_priv *priv = dev_get_priv(dev); u32 rp1_gfx_freq; int ret; @@ -661,7 +661,7 @@ static int broadwell_igd_int15_handler(void) static int broadwell_igd_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); bool is_broadwell; ulong fbbase; @@ -706,9 +706,9 @@ static int broadwell_igd_probe(struct udevice *dev) return 0; } -static int broadwell_igd_ofdata_to_platdata(struct udevice *dev) +static int broadwell_igd_of_to_plat(struct udevice *dev) { - struct broadwell_igd_plat *plat = dev_get_platdata(dev); + struct broadwell_igd_plat *plat = dev_get_plat(dev); struct broadwell_igd_priv *priv = dev_get_priv(dev); int node = dev_of_offset(dev); const void *blob = gd->fdt_blob; @@ -756,7 +756,7 @@ static int broadwell_igd_ofdata_to_platdata(struct udevice *dev) static int broadwell_igd_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Set the maximum supported resolution */ uc_plat->size = 2560 * 1600 * 4; @@ -778,9 +778,9 @@ U_BOOT_DRIVER(broadwell_igd) = { .id = UCLASS_VIDEO, .of_match = broadwell_igd_ids, .ops = &broadwell_igd_ops, - .ofdata_to_platdata = broadwell_igd_ofdata_to_platdata, + .of_to_plat = broadwell_igd_of_to_plat, .bind = broadwell_igd_bind, .probe = broadwell_igd_probe, - .priv_auto_alloc_size = sizeof(struct broadwell_igd_priv), - .platdata_auto_alloc_size = sizeof(struct broadwell_igd_plat), + .priv_auto = sizeof(struct broadwell_igd_priv), + .plat_auto = sizeof(struct broadwell_igd_plat), }; diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 8205413..fa11b3b 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -588,5 +588,5 @@ U_BOOT_DRIVER(vidconsole_truetype) = { .id = UCLASS_VIDEO_CONSOLE, .ops = &console_truetype_ops, .probe = console_truetype_probe, - .priv_auto_alloc_size = sizeof(struct console_tt_priv), + .priv_auto = sizeof(struct console_tt_priv), }; diff --git a/drivers/video/coreboot.c b/drivers/video/coreboot.c index c8797a0..0a5fb08 100644 --- a/drivers/video/coreboot.c +++ b/drivers/video/coreboot.c @@ -38,7 +38,7 @@ static int save_vesa_mode(struct cb_framebuffer *fb, static int coreboot_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct cb_framebuffer *fb = lib_sysinfo.framebuffer; struct vesa_mode_info *vesa = &mode_info.vesa; diff --git a/drivers/video/display-uclass.c b/drivers/video/display-uclass.c index 1a29ce5..068108e 100644 --- a/drivers/video/display-uclass.c +++ b/drivers/video/display-uclass.c @@ -31,7 +31,7 @@ int display_enable(struct udevice *dev, int panel_bpp, if (ret) return ret; - disp_uc_plat = dev_get_uclass_platdata(dev); + disp_uc_plat = dev_get_uclass_plat(dev); disp_uc_plat->in_use = true; return 0; @@ -71,7 +71,7 @@ int display_read_timing(struct udevice *dev, struct display_timing *timing) bool display_in_use(struct udevice *dev) { - struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *disp_uc_plat = dev_get_uclass_plat(dev); return disp_uc_plat->in_use; } @@ -79,5 +79,5 @@ bool display_in_use(struct udevice *dev) UCLASS_DRIVER(display) = { .id = UCLASS_DISPLAY, .name = "display", - .per_device_platdata_auto_alloc_size = sizeof(struct display_plat), + .per_device_plat_auto = sizeof(struct display_plat), }; diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c index 4055ef4..4dde648 100644 --- a/drivers/video/dw_mipi_dsi.c +++ b/drivers/video/dw_mipi_dsi.c @@ -845,7 +845,7 @@ U_BOOT_DRIVER(dw_mipi_dsi) = { .id = UCLASS_DSI_HOST, .probe = dw_mipi_dsi_probe, .ops = &dw_mipi_dsi_ops, - .priv_auto_alloc_size = sizeof(struct dw_mipi_dsi), + .priv_auto = sizeof(struct dw_mipi_dsi), }; MODULE_AUTHOR("Chris Zhong <zyw@rock-chips.com>"); diff --git a/drivers/video/efi.c b/drivers/video/efi.c index 47441a3..c248bd35 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -110,7 +110,7 @@ static int save_vesa_mode(struct vesa_mode_info *vesa) static int efi_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct vesa_mode_info *vesa = &mode_info.vesa; int ret; diff --git a/drivers/video/exynos/exynos_dp.c b/drivers/video/exynos/exynos_dp.c index 999ee1c..63b5b8e 100644 --- a/drivers/video/exynos/exynos_dp.c +++ b/drivers/video/exynos/exynos_dp.c @@ -877,7 +877,7 @@ static unsigned int exynos_dp_config_video(struct exynos_dp *regs, return ret; } -static int exynos_dp_ofdata_to_platdata(struct udevice *dev) +static int exynos_dp_of_to_plat(struct udevice *dev) { struct exynos_dp_priv *priv = dev_get_priv(dev); const void *blob = gd->fdt_blob; @@ -1080,6 +1080,6 @@ U_BOOT_DRIVER(exynos_dp) = { .id = UCLASS_DISPLAY, .of_match = exynos_dp_ids, .ops = &exynos_dp_ops, - .ofdata_to_platdata = exynos_dp_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct exynos_dp_priv), + .of_to_plat = exynos_dp_of_to_plat, + .priv_auto = sizeof(struct exynos_dp_priv), }; diff --git a/drivers/video/exynos/exynos_fb.c b/drivers/video/exynos/exynos_fb.c index 979b909..7b4459c 100644 --- a/drivers/video/exynos/exynos_fb.c +++ b/drivers/video/exynos/exynos_fb.c @@ -377,7 +377,7 @@ void exynos_fimd_disable_sysmmu(void) void exynos_fimd_lcd_init(struct udevice *dev) { struct exynos_fb_priv *priv = dev_get_priv(dev); - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct exynos_fb *reg = priv->reg; unsigned int cfg = 0, rgb_mode; unsigned int offset; @@ -479,7 +479,7 @@ unsigned long exynos_fimd_calc_fbsize(struct exynos_fb_priv *priv) return priv->vl_col * priv->vl_row * (VNBITS(priv->vl_bpix) / 8); } -int exynos_fb_ofdata_to_platdata(struct udevice *dev) +int exynos_fb_of_to_plat(struct udevice *dev) { struct exynos_fb_priv *priv = dev_get_priv(dev); unsigned int node = dev_of_offset(dev); @@ -692,7 +692,7 @@ static int exynos_fb_probe(struct udevice *dev) static int exynos_fb_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); /* This is the maximum panel size we expect to see */ plat->size = 1920 * 1080 * 2; @@ -715,6 +715,6 @@ U_BOOT_DRIVER(exynos_fb) = { .ops = &exynos_fb_ops, .bind = exynos_fb_bind, .probe = exynos_fb_probe, - .ofdata_to_platdata = exynos_fb_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct exynos_fb_priv), + .of_to_plat = exynos_fb_of_to_plat, + .priv_auto = sizeof(struct exynos_fb_priv), }; diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c index e9d05c9..4ea0f12 100644 --- a/drivers/video/fsl_dcu_fb.c +++ b/drivers/video/fsl_dcu_fb.c @@ -484,7 +484,7 @@ void *video_hw_init(void) static int fsl_dcu_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct fb_info fbinfo = { 0 }; unsigned int win_x; @@ -516,7 +516,7 @@ static int fsl_dcu_video_probe(struct udevice *dev) static int fsl_dcu_video_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); unsigned int win_x; unsigned int win_y; unsigned int depth = 0, freq = 0; diff --git a/drivers/video/ihs_video_out.c b/drivers/video/ihs_video_out.c index f02fd13..73b8f4b 100644 --- a/drivers/video/ihs_video_out.c +++ b/drivers/video/ihs_video_out.c @@ -338,5 +338,5 @@ U_BOOT_DRIVER(ihs_video_out_drv) = { .ops = &ihs_video_out_ops, .of_match = ihs_video_out_ids, .probe = ihs_video_out_probe, - .priv_auto_alloc_size = sizeof(struct ihs_video_out_priv), + .priv_auto = sizeof(struct ihs_video_out_priv), }; diff --git a/drivers/video/imx/mxc_ipuv3_fb.c b/drivers/video/imx/mxc_ipuv3_fb.c index eb93a4f..6cdbbaf 100644 --- a/drivers/video/imx/mxc_ipuv3_fb.c +++ b/drivers/video/imx/mxc_ipuv3_fb.c @@ -383,7 +383,7 @@ static int mxcfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) static int mxcfb_map_video_memory(struct fb_info *fbi) { struct mxcfb_info *mxc_fbi = (struct mxcfb_info *)fbi->par; - struct video_uc_platdata *plat = dev_get_uclass_platdata(mxc_fbi->udev); + struct video_uc_plat *plat = dev_get_uclass_plat(mxc_fbi->udev); if (fbi->fix.smem_len < fbi->var.yres_virtual * fbi->fix.line_length) { fbi->fix.smem_len = fbi->var.yres_virtual * @@ -586,7 +586,7 @@ enum { static int ipuv3_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); #if defined(CONFIG_DISPLAY) struct udevice *disp_dev; @@ -647,7 +647,7 @@ struct ipuv3_video_priv { static int ipuv3_video_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT * (1 << VIDEO_BPP32) / 8; @@ -671,6 +671,6 @@ U_BOOT_DRIVER(fsl_imx6q_ipu) = { .of_match = ipuv3_video_ids, .bind = ipuv3_video_bind, .probe = ipuv3_video_probe, - .priv_auto_alloc_size = sizeof(struct ipuv3_video_priv), + .priv_auto = sizeof(struct ipuv3_video_priv), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/video/ivybridge_igd.c b/drivers/video/ivybridge_igd.c index 2587f53..e7db0cb 100644 --- a/drivers/video/ivybridge_igd.c +++ b/drivers/video/ivybridge_igd.c @@ -753,7 +753,7 @@ static int gma_func0_init(struct udevice *dev) static int bd82x6x_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); ulong fbbase; void *gtt_bar; int ret, rev; @@ -781,7 +781,7 @@ static int bd82x6x_video_probe(struct udevice *dev) static int bd82x6x_video_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Set the maximum supported resolution */ uc_plat->size = 2560 * 1600 * 4; diff --git a/drivers/video/lg4573.c b/drivers/video/lg4573.c index 45df9c1..dd87fc4 100644 --- a/drivers/video/lg4573.c +++ b/drivers/video/lg4573.c @@ -219,7 +219,7 @@ static int do_lgset(struct cmd_tbl *cmdtp, int flag, int argc, int ret; ret = uclass_get_device_by_driver(UCLASS_DISPLAY, - DM_GET_DRIVER(lg4573_lcd), &dev); + DM_DRIVER_GET(lg4573_lcd), &dev); if (ret) { printf("%s: Could not get lg4573 device\n", __func__); return ret; @@ -294,7 +294,7 @@ static const struct dm_display_ops lg4573_lcd_ops = { .enable = lg4573_lcd_enable, }; -static int lg4573_ofdata_to_platdata(struct udevice *dev) +static int lg4573_of_to_plat(struct udevice *dev) { struct lg4573_lcd_priv *priv = dev_get_priv(dev); int ret; @@ -323,9 +323,9 @@ U_BOOT_DRIVER(lg4573_lcd) = { .name = "lg4573", .id = UCLASS_DISPLAY, .ops = &lg4573_lcd_ops, - .ofdata_to_platdata = lg4573_ofdata_to_platdata, + .of_to_plat = lg4573_of_to_plat, .of_match = lg4573_ids, .bind = lg4573_bind, .probe = lg4573_probe, - .priv_auto_alloc_size = sizeof(struct lg4573_lcd_priv), + .priv_auto = sizeof(struct lg4573_lcd_priv), }; diff --git a/drivers/video/logicore_dp_tx.c b/drivers/video/logicore_dp_tx.c index 9bc4bbb..624084d 100644 --- a/drivers/video/logicore_dp_tx.c +++ b/drivers/video/logicore_dp_tx.c @@ -2292,6 +2292,6 @@ U_BOOT_DRIVER(logicore_dp_tx) = { .id = UCLASS_DISPLAY, .of_match = logicore_dp_tx_ids, .probe = logicore_dp_tx_probe, - .priv_auto_alloc_size = sizeof(struct dp_tx), + .priv_auto = sizeof(struct dp_tx), .ops = &logicore_dp_tx_ops, }; diff --git a/drivers/video/mali_dp.c b/drivers/video/mali_dp.c index 1e6da0e..dc4f542 100644 --- a/drivers/video/mali_dp.c +++ b/drivers/video/mali_dp.c @@ -260,7 +260,7 @@ static int malidp_update_timings_from_edid(struct udevice *dev, static int malidp_probe(struct udevice *dev) { struct video_priv *uc_priv = dev_get_uclass_priv(dev); - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); ofnode framebuffer = ofnode_find_subnode(dev_ofnode(dev), "framebuffer"); struct malidp_priv *priv = dev_get_priv(dev); struct display_timing timings; @@ -382,7 +382,7 @@ fail_aclk: static int malidp_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* choose max possible size: 2K x 2K, XRGB888 framebuffer */ uc_plat->size = 4 * 2048 * 2048; @@ -403,6 +403,6 @@ U_BOOT_DRIVER(mali_dp) = { .of_match = malidp_ids, .bind = malidp_bind, .probe = malidp_probe, - .priv_auto_alloc_size = sizeof(struct malidp_priv), + .priv_auto = sizeof(struct malidp_priv), .ops = &malidp_ops, }; diff --git a/drivers/video/meson/meson_dw_hdmi.c b/drivers/video/meson/meson_dw_hdmi.c index 5d74f7f..e5f2813 100644 --- a/drivers/video/meson/meson_dw_hdmi.c +++ b/drivers/video/meson/meson_dw_hdmi.c @@ -508,5 +508,5 @@ U_BOOT_DRIVER(meson_dw_hdmi) = { .of_match = meson_dw_hdmi_ids, .ops = &meson_dw_hdmi_ops, .probe = meson_dw_hdmi_probe, - .priv_auto_alloc_size = sizeof(struct meson_dw_hdmi), + .priv_auto = sizeof(struct meson_dw_hdmi), }; diff --git a/drivers/video/meson/meson_plane.c b/drivers/video/meson/meson_plane.c index b367276..e3f784e 100644 --- a/drivers/video/meson/meson_plane.c +++ b/drivers/video/meson/meson_plane.c @@ -100,7 +100,7 @@ meson_vpp_disable_interlace_vscaler_osd1(struct meson_vpu_priv *priv) void meson_vpu_setup_plane(struct udevice *dev, bool is_interlaced) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct meson_vpu_priv *priv = dev_get_priv(dev); u32 osd1_ctrl_stat; diff --git a/drivers/video/meson/meson_vpu.c b/drivers/video/meson/meson_vpu.c index 4868839..ca6933a 100644 --- a/drivers/video/meson/meson_vpu.c +++ b/drivers/video/meson/meson_vpu.c @@ -43,7 +43,7 @@ bool meson_vpu_is_compatible(struct meson_vpu_priv *priv, static int meson_vpu_setup_mode(struct udevice *dev, struct udevice *disp) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct display_timing timing; bool is_cvbs = false; @@ -138,7 +138,7 @@ static int meson_vpu_probe(struct udevice *dev) static int meson_vpu_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); plat->size = VPU_MAX_WIDTH * VPU_MAX_HEIGHT * (1 << VPU_MAX_LOG2_BPP) / 8; @@ -211,6 +211,6 @@ U_BOOT_DRIVER(meson_vpu) = { .of_match = meson_vpu_ids, .probe = meson_vpu_probe, .bind = meson_vpu_bind, - .priv_auto_alloc_size = sizeof(struct meson_vpu_priv), + .priv_auto = sizeof(struct meson_vpu_priv), .flags = DM_FLAG_PRE_RELOC | DM_FLAG_REMOVE_WITH_PD_ON, }; diff --git a/drivers/video/mvebu_lcd.c b/drivers/video/mvebu_lcd.c index f3cb2bf..d3d07e5 100644 --- a/drivers/video/mvebu_lcd.c +++ b/drivers/video/mvebu_lcd.c @@ -526,7 +526,7 @@ static void mvebu_lcd_register_init(struct mvebu_lcd_info *lcd_info, static int mvebu_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct mvebu_video_priv *priv = dev_get_priv(dev); struct mvebu_lcd_info lcd_info; @@ -575,7 +575,7 @@ static int mvebu_video_probe(struct udevice *dev) static int mvebu_video_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT * (1 << LCD_MAX_LOG2_BPP) / 8; @@ -594,5 +594,5 @@ U_BOOT_DRIVER(mvebu_video) = { .of_match = mvebu_video_ids, .bind = mvebu_video_bind, .probe = mvebu_video_probe, - .priv_auto_alloc_size = sizeof(struct mvebu_video_priv), + .priv_auto = sizeof(struct mvebu_video_priv), }; diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 6589a2a..b43732a 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -356,7 +356,7 @@ static int mxs_of_get_timings(struct udevice *dev, static int mxs_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct display_timing timings; @@ -409,7 +409,7 @@ static int mxs_video_probe(struct udevice *dev) static int mxs_video_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct display_timing timings; u32 bpp = 0; u32 bytes_pp = 0; @@ -443,7 +443,7 @@ static int mxs_video_bind(struct udevice *dev) static int mxs_video_remove(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); mxs_remove_common(plat->base); diff --git a/drivers/video/nexell_display.c b/drivers/video/nexell_display.c index 4101e09..b47bef3 100644 --- a/drivers/video/nexell_display.c +++ b/drivers/video/nexell_display.c @@ -174,7 +174,7 @@ static void nx_display_parse_dp_layer(ofnode node, struct dp_plane_info *plane) static void nx_display_parse_dp_planes(ofnode node, struct nx_display_dev *dp, - struct video_uc_platdata *plat) + struct video_uc_plat *plat) { const char *name; ofnode subnode; @@ -332,7 +332,7 @@ static int nx_display_parse_dp_lcds(ofnode node, const char *type, static int nx_display_parse_dt(struct udevice *dev, struct nx_display_dev *dp, - struct video_uc_platdata *plat) + struct video_uc_plat *plat) { const char *name, *dtype; int ret = 0; @@ -391,7 +391,7 @@ static struct nx_display_dev *nx_display_setup(void) struct nx_display_dev *dp; int i, ret; int node = 0; - struct video_uc_platdata *plat = NULL; + struct video_uc_plat *plat = NULL; struct udevice *dev; @@ -404,9 +404,9 @@ static struct nx_display_dev *nx_display_setup(void) __func__); return NULL; } - plat = dev_get_uclass_platdata(dev); + plat = dev_get_uclass_plat(dev); if (!dev) { - debug("%s(): dev_get_uclass_platdata(dev) == NULL --> return NULL\n", + debug("%s(): dev_get_uclass_plat(dev) == NULL --> return NULL\n", __func__); return NULL; } @@ -416,7 +416,7 @@ static struct nx_display_dev *nx_display_setup(void) __func__); return NULL; } - node = dev->node.of_offset; + node = dev_ofnode(dev).of_offset; if (CONFIG_IS_ENABLED(OF_CONTROL)) { ret = nx_display_parse_dt(dev, dp, plat); @@ -534,9 +534,9 @@ __weak void lcd_enable(void) static int nx_display_probe(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); - struct nx_display_platdata *plat = dev_get_platdata(dev); + struct nx_display_plat *plat = dev_get_plat(dev); static GraphicDevice *graphic_device; char addr[64]; @@ -546,7 +546,7 @@ static int nx_display_probe(struct udevice *dev) return -EINVAL; if (!uc_plat) { - debug("%s(): video_uc_platdata *plat == NULL --> return -EINVAL\n", + debug("%s(): video_uc_plat *plat == NULL --> return -EINVAL\n", __func__); return -EINVAL; } @@ -558,7 +558,7 @@ static int nx_display_probe(struct udevice *dev) } if (!plat) { - debug("%s(): nx_display_platdata *plat == NULL --> return -EINVAL\n", + debug("%s(): nx_display_plat *plat == NULL --> return -EINVAL\n", __func__); return -EINVAL; } @@ -619,7 +619,7 @@ static int nx_display_probe(struct udevice *dev) static int nx_display_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); debug("%s()\n", __func__); @@ -643,9 +643,8 @@ U_BOOT_DRIVER(nexell_display) = { .name = "nexell-display", .id = UCLASS_VIDEO, .of_match = nx_display_ids, - .platdata_auto_alloc_size = - sizeof(struct nx_display_platdata), + .plat_auto = sizeof(struct nx_display_plat), .bind = nx_display_bind, .probe = nx_display_probe, - .priv_auto_alloc_size = sizeof(struct nx_display_dev), + .priv_auto = sizeof(struct nx_display_dev), }; diff --git a/drivers/video/orisetech_otm8009a.c b/drivers/video/orisetech_otm8009a.c index 362bf6a..95738e3 100644 --- a/drivers/video/orisetech_otm8009a.c +++ b/drivers/video/orisetech_otm8009a.c @@ -79,7 +79,7 @@ static const struct display_timing default_timing = { static void otm8009a_dcs_write_buf(struct udevice *dev, const void *data, size_t len) { - struct mipi_dsi_panel_plat *plat = dev_get_platdata(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); struct mipi_dsi_device *device = plat->device; if (mipi_dsi_dcs_write_buffer(device, data, len) < 0) @@ -89,7 +89,7 @@ static void otm8009a_dcs_write_buf(struct udevice *dev, const void *data, static void otm8009a_dcs_write_buf_hs(struct udevice *dev, const void *data, size_t len) { - struct mipi_dsi_panel_plat *plat = dev_get_platdata(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); struct mipi_dsi_device *device = plat->device; /* data will be sent in dsi hs mode (ie. no lpm) */ @@ -124,7 +124,7 @@ static void otm8009a_dcs_write_buf_hs(struct udevice *dev, const void *data, static int otm8009a_init_sequence(struct udevice *dev) { - struct mipi_dsi_panel_plat *plat = dev_get_platdata(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); struct mipi_dsi_device *device = plat->device; int ret; @@ -255,7 +255,7 @@ static int otm8009a_init_sequence(struct udevice *dev) static int otm8009a_panel_enable_backlight(struct udevice *dev) { - struct mipi_dsi_panel_plat *plat = dev_get_platdata(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); struct mipi_dsi_device *device = plat->device; int ret; @@ -295,7 +295,7 @@ static int otm8009a_panel_get_display_timing(struct udevice *dev, return 0; } -static int otm8009a_panel_ofdata_to_platdata(struct udevice *dev) +static int otm8009a_panel_of_to_plat(struct udevice *dev) { struct otm8009a_panel_priv *priv = dev_get_priv(dev); int ret; @@ -323,7 +323,7 @@ static int otm8009a_panel_ofdata_to_platdata(struct udevice *dev) static int otm8009a_panel_probe(struct udevice *dev) { struct otm8009a_panel_priv *priv = dev_get_priv(dev); - struct mipi_dsi_panel_plat *plat = dev_get_platdata(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); int ret; if (IS_ENABLED(CONFIG_DM_REGULATOR) && priv->reg) { @@ -364,8 +364,8 @@ U_BOOT_DRIVER(otm8009a_panel) = { .id = UCLASS_PANEL, .of_match = otm8009a_panel_ids, .ops = &otm8009a_panel_ops, - .ofdata_to_platdata = otm8009a_panel_ofdata_to_platdata, + .of_to_plat = otm8009a_panel_of_to_plat, .probe = otm8009a_panel_probe, - .platdata_auto_alloc_size = sizeof(struct mipi_dsi_panel_plat), - .priv_auto_alloc_size = sizeof(struct otm8009a_panel_priv), + .plat_auto = sizeof(struct mipi_dsi_panel_plat), + .priv_auto = sizeof(struct otm8009a_panel_priv), }; diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c index 9519180..9e32bc4 100644 --- a/drivers/video/pwm_backlight.c +++ b/drivers/video/pwm_backlight.c @@ -84,10 +84,10 @@ static int enable_sequence(struct udevice *dev, int seq) switch (seq) { case 0: if (priv->reg) { - __maybe_unused struct dm_regulator_uclass_platdata + __maybe_unused struct dm_regulator_uclass_plat *plat; - plat = dev_get_uclass_platdata(priv->reg); + plat = dev_get_uclass_plat(priv->reg); log_debug("Enable '%s', regulator '%s'/'%s'\n", dev->name, priv->reg->name, plat->name); ret = regulator_set_enable(priv->reg, true); @@ -182,7 +182,7 @@ static int pwm_backlight_set_brightness(struct udevice *dev, int percent) return 0; } -static int pwm_backlight_ofdata_to_platdata(struct udevice *dev) +static int pwm_backlight_of_to_plat(struct udevice *dev) { struct pwm_backlight_priv *priv = dev_get_priv(dev); struct ofnode_phandle_args args; @@ -263,7 +263,7 @@ U_BOOT_DRIVER(pwm_backlight) = { .id = UCLASS_PANEL_BACKLIGHT, .of_match = pwm_backlight_ids, .ops = &pwm_backlight_ops, - .ofdata_to_platdata = pwm_backlight_ofdata_to_platdata, + .of_to_plat = pwm_backlight_of_to_plat, .probe = pwm_backlight_probe, - .priv_auto_alloc_size = sizeof(struct pwm_backlight_priv), + .priv_auto = sizeof(struct pwm_backlight_priv), }; diff --git a/drivers/video/raydium-rm68200.c b/drivers/video/raydium-rm68200.c index 3538945..373668d 100644 --- a/drivers/video/raydium-rm68200.c +++ b/drivers/video/raydium-rm68200.c @@ -92,7 +92,7 @@ static const struct display_timing default_timing = { static void rm68200_dcs_write_buf(struct udevice *dev, const void *data, size_t len) { - struct mipi_dsi_panel_plat *plat = dev_get_platdata(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); struct mipi_dsi_device *device = plat->device; int err; @@ -103,7 +103,7 @@ static void rm68200_dcs_write_buf(struct udevice *dev, const void *data, static void rm68200_dcs_write_cmd(struct udevice *dev, u8 cmd, u8 value) { - struct mipi_dsi_panel_plat *plat = dev_get_platdata(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); struct mipi_dsi_device *device = plat->device; int err; @@ -223,7 +223,7 @@ static void rm68200_init_sequence(struct udevice *dev) static int rm68200_panel_enable_backlight(struct udevice *dev) { - struct mipi_dsi_panel_plat *plat = dev_get_platdata(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); struct mipi_dsi_device *device = plat->device; struct rm68200_panel_priv *priv = dev_get_priv(dev); int ret; @@ -261,7 +261,7 @@ static int rm68200_panel_get_display_timing(struct udevice *dev, return 0; } -static int rm68200_panel_ofdata_to_platdata(struct udevice *dev) +static int rm68200_panel_of_to_plat(struct udevice *dev) { struct rm68200_panel_priv *priv = dev_get_priv(dev); int ret; @@ -296,7 +296,7 @@ static int rm68200_panel_ofdata_to_platdata(struct udevice *dev) static int rm68200_panel_probe(struct udevice *dev) { struct rm68200_panel_priv *priv = dev_get_priv(dev); - struct mipi_dsi_panel_plat *plat = dev_get_platdata(dev); + struct mipi_dsi_panel_plat *plat = dev_get_plat(dev); int ret; if (IS_ENABLED(CONFIG_DM_REGULATOR) && priv->reg) { @@ -336,8 +336,8 @@ U_BOOT_DRIVER(rm68200_panel) = { .id = UCLASS_PANEL, .of_match = rm68200_panel_ids, .ops = &rm68200_panel_ops, - .ofdata_to_platdata = rm68200_panel_ofdata_to_platdata, + .of_to_plat = rm68200_panel_of_to_plat, .probe = rm68200_panel_probe, - .platdata_auto_alloc_size = sizeof(struct mipi_dsi_panel_plat), - .priv_auto_alloc_size = sizeof(struct rm68200_panel_priv), + .plat_auto = sizeof(struct mipi_dsi_panel_plat), + .priv_auto = sizeof(struct rm68200_panel_priv), }; diff --git a/drivers/video/rockchip/rk3288_hdmi.c b/drivers/video/rockchip/rk3288_hdmi.c index f835f4d..327ae78 100644 --- a/drivers/video/rockchip/rk3288_hdmi.c +++ b/drivers/video/rockchip/rk3288_hdmi.c @@ -25,7 +25,7 @@ static int rk3288_hdmi_enable(struct udevice *dev, int panel_bpp, const struct display_timing *edid) { struct rk_hdmi_priv *priv = dev_get_priv(dev); - struct display_plat *uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *uc_plat = dev_get_uclass_plat(dev); int vop_id = uc_plat->source_id; struct rk3288_grf *grf = priv->grf; @@ -38,7 +38,7 @@ static int rk3288_hdmi_enable(struct udevice *dev, int panel_bpp, return dw_hdmi_enable(&priv->hdmi, edid); } -static int rk3288_hdmi_ofdata_to_platdata(struct udevice *dev) +static int rk3288_hdmi_of_to_plat(struct udevice *dev) { struct rk_hdmi_priv *priv = dev_get_priv(dev); struct dw_hdmi *hdmi = &priv->hdmi; @@ -53,12 +53,12 @@ static int rk3288_hdmi_ofdata_to_platdata(struct udevice *dev) hdmi->i2c_clk_high = 0x0d; hdmi->i2c_clk_low = 0x0d; - return rk_hdmi_ofdata_to_platdata(dev); + return rk_hdmi_of_to_plat(dev); } static int rk3288_clk_config(struct udevice *dev) { - struct display_plat *uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *uc_plat = dev_get_uclass_plat(dev); struct clk clk; int ret; @@ -111,7 +111,7 @@ U_BOOT_DRIVER(rk3288_hdmi_rockchip) = { .id = UCLASS_DISPLAY, .of_match = rk3288_hdmi_ids, .ops = &rk3288_hdmi_ops, - .ofdata_to_platdata = rk3288_hdmi_ofdata_to_platdata, + .of_to_plat = rk3288_hdmi_of_to_plat, .probe = rk3288_hdmi_probe, - .priv_auto_alloc_size = sizeof(struct rk_hdmi_priv), + .priv_auto = sizeof(struct rk_hdmi_priv), }; diff --git a/drivers/video/rockchip/rk3288_mipi.c b/drivers/video/rockchip/rk3288_mipi.c index 8ac0125..7e48dd8 100644 --- a/drivers/video/rockchip/rk3288_mipi.c +++ b/drivers/video/rockchip/rk3288_mipi.c @@ -31,7 +31,7 @@ static int rk_mipi_dsi_source_select(struct udevice *dev) { struct rk_mipi_priv *priv = dev_get_priv(dev); struct rk3288_grf *grf = priv->grf; - struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *disp_uc_plat = dev_get_uclass_plat(dev); /* Select the video source */ switch (disp_uc_plat->source_id) { @@ -129,7 +129,7 @@ static int rk_mipi_enable(struct udevice *dev, int panel_bpp, return 0; } -static int rk_mipi_ofdata_to_platdata(struct udevice *dev) +static int rk_mipi_of_to_plat(struct udevice *dev) { struct rk_mipi_priv *priv = dev_get_priv(dev); @@ -182,8 +182,8 @@ U_BOOT_DRIVER(rk_mipi_dsi) = { .name = "rk_mipi_dsi", .id = UCLASS_DISPLAY, .of_match = rk_mipi_dsi_ids, - .ofdata_to_platdata = rk_mipi_ofdata_to_platdata, + .of_to_plat = rk_mipi_of_to_plat, .probe = rk_mipi_probe, .ops = &rk_mipi_dsi_ops, - .priv_auto_alloc_size = sizeof(struct rk_mipi_priv), + .priv_auto = sizeof(struct rk_mipi_priv), }; diff --git a/drivers/video/rockchip/rk3288_vop.c b/drivers/video/rockchip/rk3288_vop.c index 9ec33e6..3f6ee74 100644 --- a/drivers/video/rockchip/rk3288_vop.c +++ b/drivers/video/rockchip/rk3288_vop.c @@ -105,5 +105,5 @@ U_BOOT_DRIVER(rockchip_rk3288_vop) = { .bind = rk_vop_bind, .probe = rk3288_vop_probe, .remove = rk_vop_remove, - .priv_auto_alloc_size = sizeof(struct rk_vop_priv), + .priv_auto = sizeof(struct rk_vop_priv), }; diff --git a/drivers/video/rockchip/rk3399_hdmi.c b/drivers/video/rockchip/rk3399_hdmi.c index a62be98..3041360 100644 --- a/drivers/video/rockchip/rk3399_hdmi.c +++ b/drivers/video/rockchip/rk3399_hdmi.c @@ -23,7 +23,7 @@ static int rk3399_hdmi_enable(struct udevice *dev, int panel_bpp, const struct display_timing *edid) { struct rk_hdmi_priv *priv = dev_get_priv(dev); - struct display_plat *uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *uc_plat = dev_get_uclass_plat(dev); int vop_id = uc_plat->source_id; struct rk3399_grf_regs *grf = priv->grf; @@ -34,7 +34,7 @@ static int rk3399_hdmi_enable(struct udevice *dev, int panel_bpp, return dw_hdmi_enable(&priv->hdmi, edid); } -static int rk3399_hdmi_ofdata_to_platdata(struct udevice *dev) +static int rk3399_hdmi_of_to_plat(struct udevice *dev) { struct rk_hdmi_priv *priv = dev_get_priv(dev); struct dw_hdmi *hdmi = &priv->hdmi; @@ -42,7 +42,7 @@ static int rk3399_hdmi_ofdata_to_platdata(struct udevice *dev) hdmi->i2c_clk_high = 0x7a; hdmi->i2c_clk_low = 0x8d; - return rk_hdmi_ofdata_to_platdata(dev); + return rk_hdmi_of_to_plat(dev); } static const char * const rk3399_regulator_names[] = { @@ -74,7 +74,7 @@ U_BOOT_DRIVER(rk3399_hdmi_rockchip) = { .id = UCLASS_DISPLAY, .of_match = rk3399_hdmi_ids, .ops = &rk3399_hdmi_ops, - .ofdata_to_platdata = rk3399_hdmi_ofdata_to_platdata, + .of_to_plat = rk3399_hdmi_of_to_plat, .probe = rk3399_hdmi_probe, - .priv_auto_alloc_size = sizeof(struct rk_hdmi_priv), + .priv_auto = sizeof(struct rk_hdmi_priv), }; diff --git a/drivers/video/rockchip/rk3399_mipi.c b/drivers/video/rockchip/rk3399_mipi.c index e5534c3..9173350 100644 --- a/drivers/video/rockchip/rk3399_mipi.c +++ b/drivers/video/rockchip/rk3399_mipi.c @@ -29,7 +29,7 @@ static int rk_mipi_dsi_source_select(struct udevice *dev) { struct rk_mipi_priv *priv = dev_get_priv(dev); struct rk3399_grf_regs *grf = priv->grf; - struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *disp_uc_plat = dev_get_uclass_plat(dev); /* Select the video source */ switch (disp_uc_plat->source_id) { @@ -121,7 +121,7 @@ static int rk_display_enable(struct udevice *dev, int panel_bpp, return 0; } -static int rk_mipi_ofdata_to_platdata(struct udevice *dev) +static int rk_mipi_of_to_plat(struct udevice *dev) { struct rk_mipi_priv *priv = dev_get_priv(dev); @@ -173,8 +173,8 @@ U_BOOT_DRIVER(rk_mipi_dsi) = { .name = "rk_mipi_dsi", .id = UCLASS_DISPLAY, .of_match = rk_mipi_dsi_ids, - .ofdata_to_platdata = rk_mipi_ofdata_to_platdata, + .of_to_plat = rk_mipi_of_to_plat, .probe = rk_mipi_probe, .ops = &rk_mipi_dsi_ops, - .priv_auto_alloc_size = sizeof(struct rk_mipi_priv), + .priv_auto = sizeof(struct rk_mipi_priv), }; diff --git a/drivers/video/rockchip/rk3399_vop.c b/drivers/video/rockchip/rk3399_vop.c index 55d1be0..30e81b8 100644 --- a/drivers/video/rockchip/rk3399_vop.c +++ b/drivers/video/rockchip/rk3399_vop.c @@ -99,5 +99,5 @@ U_BOOT_DRIVER(rk3399_vop) = { .ops = &rk3399_vop_ops, .bind = rk_vop_bind, .probe = rk3399_vop_probe, - .priv_auto_alloc_size = sizeof(struct rk_vop_priv), + .priv_auto = sizeof(struct rk_vop_priv), }; diff --git a/drivers/video/rockchip/rk_edp.c b/drivers/video/rockchip/rk_edp.c index c55f7a4..0be60e1 100644 --- a/drivers/video/rockchip/rk_edp.c +++ b/drivers/video/rockchip/rk_edp.c @@ -1001,7 +1001,7 @@ done: return edid_size; } -static int rk_edp_ofdata_to_platdata(struct udevice *dev) +static int rk_edp_of_to_plat(struct udevice *dev) { struct rk_edp_priv *priv = dev_get_priv(dev); @@ -1026,7 +1026,7 @@ static int rk_edp_remove(struct udevice *dev) static int rk_edp_probe(struct udevice *dev) { - struct display_plat *uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *uc_plat = dev_get_uclass_plat(dev); struct rk_edp_priv *priv = dev_get_priv(dev); struct rk3288_edp *regs = priv->regs; struct clk clk; @@ -1099,8 +1099,8 @@ U_BOOT_DRIVER(dp_rockchip) = { .id = UCLASS_DISPLAY, .of_match = rockchip_dp_ids, .ops = &dp_rockchip_ops, - .ofdata_to_platdata = rk_edp_ofdata_to_platdata, + .of_to_plat = rk_edp_of_to_plat, .probe = rk_edp_probe, .remove = rk_edp_remove, - .priv_auto_alloc_size = sizeof(struct rk_edp_priv), + .priv_auto = sizeof(struct rk_edp_priv), }; diff --git a/drivers/video/rockchip/rk_hdmi.c b/drivers/video/rockchip/rk_hdmi.c index f27cdf8..8dcd4d5 100644 --- a/drivers/video/rockchip/rk_hdmi.c +++ b/drivers/video/rockchip/rk_hdmi.c @@ -78,7 +78,7 @@ int rk_hdmi_read_edid(struct udevice *dev, u8 *buf, int buf_size) return dw_hdmi_read_edid(&priv->hdmi, buf, buf_size); } -int rk_hdmi_ofdata_to_platdata(struct udevice *dev) +int rk_hdmi_of_to_plat(struct udevice *dev) { struct rk_hdmi_priv *priv = dev_get_priv(dev); struct dw_hdmi *hdmi = &priv->hdmi; diff --git a/drivers/video/rockchip/rk_hdmi.h b/drivers/video/rockchip/rk_hdmi.h index 5767ef1..859a0b9 100644 --- a/drivers/video/rockchip/rk_hdmi.h +++ b/drivers/video/rockchip/rk_hdmi.h @@ -52,12 +52,12 @@ int rk_hdmi_read_edid(struct udevice *dev, u8 *buf, int buf_size); void rk_hdmi_probe_regulators(struct udevice *dev, const char * const *names, int cnt); /** - * rk_hdmi_ofdata_to_platdata() - common ofdata_to_platdata implementation + * rk_hdmi_of_to_plat() - common of_to_plat implementation * * @dev: device * @return 0 if OK, -ve if something went wrong */ -int rk_hdmi_ofdata_to_platdata(struct udevice *dev); +int rk_hdmi_of_to_plat(struct udevice *dev); /** * rk_hdmi_probe() - common probe implementation diff --git a/drivers/video/rockchip/rk_lvds.c b/drivers/video/rockchip/rk_lvds.c index 04f795a..03c8257 100644 --- a/drivers/video/rockchip/rk_lvds.c +++ b/drivers/video/rockchip/rk_lvds.c @@ -53,7 +53,7 @@ int rk_lvds_enable(struct udevice *dev, int panel_bpp, const struct display_timing *edid) { struct rk_lvds_priv *priv = dev_get_priv(dev); - struct display_plat *uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *uc_plat = dev_get_uclass_plat(dev); int ret = 0; unsigned int val = 0; @@ -170,7 +170,7 @@ int rk_lvds_read_timing(struct udevice *dev, struct display_timing *timing) return 0; } -static int rk_lvds_ofdata_to_platdata(struct udevice *dev) +static int rk_lvds_of_to_plat(struct udevice *dev) { struct rk_lvds_priv *priv = dev_get_priv(dev); int ret; @@ -245,7 +245,7 @@ U_BOOT_DRIVER(lvds_rockchip) = { .id = UCLASS_DISPLAY, .of_match = rockchip_lvds_ids, .ops = &lvds_rockchip_ops, - .ofdata_to_platdata = rk_lvds_ofdata_to_platdata, + .of_to_plat = rk_lvds_of_to_plat, .probe = rk_lvds_probe, - .priv_auto_alloc_size = sizeof(struct rk_lvds_priv), + .priv_auto = sizeof(struct rk_lvds_priv), }; diff --git a/drivers/video/rockchip/rk_mipi.c b/drivers/video/rockchip/rk_mipi.c index d125a5b..159201a 100644 --- a/drivers/video/rockchip/rk_mipi.c +++ b/drivers/video/rockchip/rk_mipi.c @@ -119,7 +119,7 @@ int rk_mipi_dsi_enable(struct udevice *dev, rk_mipi_dsi_write(regs, VID_PKT_SIZE, 0x4b0); /* Set dpi color coding depth 24 bit */ - timing_node = ofnode_find_subnode(dev->node, "display-timings"); + timing_node = ofnode_find_subnode(dev_ofnode(dev), "display-timings"); node = ofnode_first_subnode(timing_node); val = ofnode_read_u32_default(node, "bits-per-pixel", -1); diff --git a/drivers/video/rockchip/rk_vop.c b/drivers/video/rockchip/rk_vop.c index 6475b3e..fcb393b 100644 --- a/drivers/video/rockchip/rk_vop.c +++ b/drivers/video/rockchip/rk_vop.c @@ -283,7 +283,7 @@ static int rk_display_init(struct udevice *dev, ulong fbbase, ofnode ep_node) break; }; - disp_uc_plat = dev_get_uclass_platdata(disp); + disp_uc_plat = dev_get_uclass_plat(disp); debug("Found device '%s', disp_uc_priv=%p\n", disp->name, disp_uc_plat); if (display_in_use(disp)) { debug(" - device in use\n"); @@ -364,7 +364,7 @@ void rk_vop_probe_regulators(struct udevice *dev, int rk_vop_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct rk_vop_priv *priv = dev_get_priv(dev); int ret = 0; ofnode port, node; @@ -406,7 +406,7 @@ int rk_vop_probe(struct udevice *dev) int rk_vop_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); plat->size = 4 * (CONFIG_VIDEO_ROCKCHIP_MAX_XRES * CONFIG_VIDEO_ROCKCHIP_MAX_YRES); diff --git a/drivers/video/sandbox_dsi_host.c b/drivers/video/sandbox_dsi_host.c index cd644ec..c84a27e 100644 --- a/drivers/video/sandbox_dsi_host.c +++ b/drivers/video/sandbox_dsi_host.c @@ -86,5 +86,5 @@ U_BOOT_DRIVER(sandbox_dsi_host) = { .id = UCLASS_DSI_HOST, .of_match = sandbox_dsi_host_ids, .ops = &sandbox_dsi_host_ops, - .priv_auto_alloc_size = sizeof(struct sandbox_dsi_host_priv), + .priv_auto = sizeof(struct sandbox_dsi_host_priv), }; diff --git a/drivers/video/sandbox_osd.c b/drivers/video/sandbox_osd.c index 7e72232..2a854d3 100644 --- a/drivers/video/sandbox_osd.c +++ b/drivers/video/sandbox_osd.c @@ -158,5 +158,5 @@ U_BOOT_DRIVER(sandbox_osd_drv) = { .ops = &sandbox_osd_ops, .of_match = sandbox_osd_ids, .probe = sandbox_osd_probe, - .priv_auto_alloc_size = sizeof(struct sandbox_osd_priv), + .priv_auto = sizeof(struct sandbox_osd_priv), }; diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c index d806f35..12edf9c 100644 --- a/drivers/video/sandbox_sdl.c +++ b/drivers/video/sandbox_sdl.c @@ -23,8 +23,8 @@ enum { static int sandbox_sdl_probe(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); - struct sandbox_sdl_plat *plat = dev_get_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); + struct sandbox_sdl_plat *plat = dev_get_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct sandbox_state *state = state_get_current(); int ret; @@ -49,8 +49,8 @@ static int sandbox_sdl_probe(struct udevice *dev) static int sandbox_sdl_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); - struct sandbox_sdl_plat *plat = dev_get_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); + struct sandbox_sdl_plat *plat = dev_get_plat(dev); int ret = 0; plat->xres = dev_read_u32_default(dev, "xres", LCD_MAX_WIDTH); @@ -78,5 +78,5 @@ U_BOOT_DRIVER(sandbox_lcd_sdl) = { .of_match = sandbox_sdl_ids, .bind = sandbox_sdl_bind, .probe = sandbox_sdl_probe, - .platdata_auto_alloc_size = sizeof(struct sandbox_sdl_plat), + .plat_auto = sizeof(struct sandbox_sdl_plat), }; diff --git a/drivers/video/seps525.c b/drivers/video/seps525.c new file mode 100644 index 0000000..369e5e6 --- /dev/null +++ b/drivers/video/seps525.c @@ -0,0 +1,327 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * FB driver for the WiseChip Semiconductor Inc. (UG-6028GDEBF02) display + * using the SEPS525 (Syncoam) LCD Controller + * + * Copyright (C) 2020 Xilinx Inc. + */ + +#include <common.h> +#include <command.h> +#include <cpu_func.h> +#include <dm.h> +#include <errno.h> +#include <spi.h> +#include <video.h> +#include <asm/gpio.h> +#include <dm/device_compat.h> +#include <linux/delay.h> + +#define WIDTH 160 +#define HEIGHT 128 + +#define SEPS525_INDEX 0x00 +#define SEPS525_STATUS_RD 0x01 +#define SEPS525_OSC_CTL 0x02 +#define SEPS525_IREF 0x80 +#define SEPS525_CLOCK_DIV 0x03 +#define SEPS525_REDUCE_CURRENT 0x04 +#define SEPS525_SOFT_RST 0x05 +#define SEPS525_DISP_ONOFF 0x06 +#define SEPS525_PRECHARGE_TIME_R 0x08 +#define SEPS525_PRECHARGE_TIME_G 0x09 +#define SEPS525_PRECHARGE_TIME_B 0x0A +#define SEPS525_PRECHARGE_CURRENT_R 0x0B +#define SEPS525_PRECHARGE_CURRENT_G 0x0C +#define SEPS525_PRECHARGE_CURRENT_B 0x0D +#define SEPS525_DRIVING_CURRENT_R 0x10 +#define SEPS525_DRIVING_CURRENT_G 0x11 +#define SEPS525_DRIVING_CURRENT_B 0x12 +#define SEPS525_DISPLAYMODE_SET 0x13 +#define SEPS525_RGBIF 0x14 +#define SEPS525_RGB_POL 0x15 +#define SEPS525_MEMORY_WRITEMODE 0x16 +#define SEPS525_MX1_ADDR 0x17 +#define SEPS525_MX2_ADDR 0x18 +#define SEPS525_MY1_ADDR 0x19 +#define SEPS525_MY2_ADDR 0x1A +#define SEPS525_MEMORY_ACCESS_POINTER_X 0x20 +#define SEPS525_MEMORY_ACCESS_POINTER_Y 0x21 +#define SEPS525_DDRAM_DATA_ACCESS_PORT 0x22 +#define SEPS525_GRAY_SCALE_TABLE_INDEX 0x50 +#define SEPS525_GRAY_SCALE_TABLE_DATA 0x51 +#define SEPS525_DUTY 0x28 +#define SEPS525_DSL 0x29 +#define SEPS525_D1_DDRAM_FAC 0x2E +#define SEPS525_D1_DDRAM_FAR 0x2F +#define SEPS525_D2_DDRAM_SAC 0x31 +#define SEPS525_D2_DDRAM_SAR 0x32 +#define SEPS525_SCR1_FX1 0x33 +#define SEPS525_SCR1_FX2 0x34 +#define SEPS525_SCR1_FY1 0x35 +#define SEPS525_SCR1_FY2 0x36 +#define SEPS525_SCR2_SX1 0x37 +#define SEPS525_SCR2_SX2 0x38 +#define SEPS525_SCR2_SY1 0x39 +#define SEPS525_SCR2_SY2 0x3A +#define SEPS525_SCREEN_SAVER_CONTEROL 0x3B +#define SEPS525_SS_SLEEP_TIMER 0x3C +#define SEPS525_SCREEN_SAVER_MODE 0x3D +#define SEPS525_SS_SCR1_FU 0x3E +#define SEPS525_SS_SCR1_MXY 0x3F +#define SEPS525_SS_SCR2_FU 0x40 +#define SEPS525_SS_SCR2_MXY 0x41 +#define SEPS525_MOVING_DIRECTION 0x42 +#define SEPS525_SS_SCR2_SX1 0x47 +#define SEPS525_SS_SCR2_SX2 0x48 +#define SEPS525_SS_SCR2_SY1 0x49 +#define SEPS525_SS_SCR2_SY2 0x4A + +/* SEPS525_DISPLAYMODE_SET */ +#define MODE_SWAP_BGR BIT(7) +#define MODE_SM BIT(6) +#define MODE_RD BIT(5) +#define MODE_CD BIT(4) + +/** + * struct seps525_priv - Private structure + * @reset_gpio: Reset gpio pin + * @dc_gpio: Data/command control gpio pin + * @dev: Device uclass for video_ops + */ +struct seps525_priv { + struct gpio_desc reset_gpio; + struct gpio_desc dc_gpio; + struct udevice *dev; +}; + +static int seps525_spi_write_cmd(struct udevice *dev, u32 reg) +{ + struct seps525_priv *priv = dev_get_priv(dev); + u8 buf8 = reg; + int ret; + + ret = dm_gpio_set_value(&priv->dc_gpio, 0); + if (ret) { + dev_dbg(dev, "Failed to handle dc\n"); + return ret; + } + + ret = dm_spi_xfer(dev, 8, &buf8, NULL, SPI_XFER_BEGIN | SPI_XFER_END); + if (ret) + dev_dbg(dev, "Failed to write command\n"); + + return ret; +} + +static int seps525_spi_write_data(struct udevice *dev, u32 val) +{ + struct seps525_priv *priv = dev_get_priv(dev); + u8 buf8 = val; + int ret; + + ret = dm_gpio_set_value(&priv->dc_gpio, 1); + if (ret) { + dev_dbg(dev, "Failed to handle dc\n"); + return ret; + } + + ret = dm_spi_xfer(dev, 8, &buf8, NULL, SPI_XFER_BEGIN | SPI_XFER_END); + if (ret) + dev_dbg(dev, "Failed to write data\n"); + + return ret; +} + +static void seps525_spi_write(struct udevice *dev, u32 reg, u32 val) +{ + (void)seps525_spi_write_cmd(dev, reg); + (void)seps525_spi_write_data(dev, val); +} + +static int seps525_display_init(struct udevice *dev) +{ + /* Disable Oscillator Power Down */ + seps525_spi_write(dev, SEPS525_REDUCE_CURRENT, 0x03); + mdelay(5); + + /* Set Normal Driving Current */ + seps525_spi_write(dev, SEPS525_REDUCE_CURRENT, 0x00); + mdelay(5); + + seps525_spi_write(dev, SEPS525_SCREEN_SAVER_CONTEROL, 0x00); + /* Set EXPORT1 Pin at Internal Clock */ + seps525_spi_write(dev, SEPS525_OSC_CTL, 0x01); + /* Set Clock as 120 Frames/Sec */ + seps525_spi_write(dev, SEPS525_CLOCK_DIV, 0x90); + /* Set Reference Voltage Controlled by External Resister */ + seps525_spi_write(dev, SEPS525_IREF, 0x01); + + /* precharge time R G B */ + seps525_spi_write(dev, SEPS525_PRECHARGE_TIME_R, 0x04); + seps525_spi_write(dev, SEPS525_PRECHARGE_TIME_G, 0x05); + seps525_spi_write(dev, SEPS525_PRECHARGE_TIME_B, 0x05); + + /* precharge current R G B (uA) */ + seps525_spi_write(dev, SEPS525_PRECHARGE_CURRENT_R, 0x9D); + seps525_spi_write(dev, SEPS525_PRECHARGE_CURRENT_G, 0x8C); + seps525_spi_write(dev, SEPS525_PRECHARGE_CURRENT_B, 0x57); + + /* driving current R G B (uA) */ + seps525_spi_write(dev, SEPS525_DRIVING_CURRENT_R, 0x56); + seps525_spi_write(dev, SEPS525_DRIVING_CURRENT_G, 0x4D); + seps525_spi_write(dev, SEPS525_DRIVING_CURRENT_B, 0x46); + /* Set Color Sequence */ + seps525_spi_write(dev, SEPS525_DISPLAYMODE_SET, 0x00); + /* Set MCU Interface Mode */ + seps525_spi_write(dev, SEPS525_RGBIF, 0x01); + /* Set Memory Write Mode */ + seps525_spi_write(dev, SEPS525_MEMORY_WRITEMODE, 0x66); + /* 1/128 Duty (0x0F~0x7F) */ + seps525_spi_write(dev, SEPS525_DUTY, 0x7F); + /* Set Mapping RAM Display Start Line (0x00~0x7F) */ + seps525_spi_write(dev, SEPS525_DSL, 0x00); + /* Display On (0x00/0x01) */ + seps525_spi_write(dev, SEPS525_DISP_ONOFF, 0x01); + /* Set All Internal Register Value as Normal Mode */ + seps525_spi_write(dev, SEPS525_SOFT_RST, 0x00); + /* Set RGB Interface Polarity as Active Low */ + seps525_spi_write(dev, SEPS525_RGB_POL, 0x00); + + /* Enable access for data */ + (void)seps525_spi_write_cmd(dev, SEPS525_DDRAM_DATA_ACCESS_PORT); + + return 0; +} + +static int seps525_spi_startup(struct udevice *dev) +{ + struct seps525_priv *priv = dev_get_priv(dev); + int ret; + + ret = dm_gpio_set_value(&priv->reset_gpio, 1); + if (ret) + return ret; + + ret = dm_gpio_set_value(&priv->reset_gpio, 0); + if (ret) + return ret; + + ret = dm_spi_claim_bus(dev); + if (ret) { + dev_err(dev, "Failed to claim SPI bus: %d\n", ret); + return ret; + } + + ret = seps525_display_init(dev); + if (ret) + return ret; + + dm_spi_release_bus(dev); + + return 0; +} + +static int seps525_sync(struct udevice *vid) +{ + struct video_priv *uc_priv = dev_get_uclass_priv(vid); + struct seps525_priv *priv = dev_get_priv(vid); + struct udevice *dev = priv->dev; + int i, ret; + u8 data1, data2; + u8 *start = uc_priv->fb; + + ret = dm_spi_claim_bus(dev); + if (ret) { + dev_err(dev, "Failed to claim SPI bus: %d\n", ret); + return ret; + } + + /* start position X,Y */ + seps525_spi_write(dev, SEPS525_MEMORY_ACCESS_POINTER_X, 0); + seps525_spi_write(dev, SEPS525_MEMORY_ACCESS_POINTER_Y, 0); + + /* Enable access for data */ + (void)seps525_spi_write_cmd(dev, SEPS525_DDRAM_DATA_ACCESS_PORT); + + for (i = 0; i < (uc_priv->xsize * uc_priv->ysize); i++) { + data2 = *start++; + data1 = *start++; + (void)seps525_spi_write_data(dev, data1); + (void)seps525_spi_write_data(dev, data2); + } + + dm_spi_release_bus(dev); + + return 0; +} + +static int seps525_probe(struct udevice *dev) +{ + struct video_priv *uc_priv = dev_get_uclass_priv(dev); + struct seps525_priv *priv = dev_get_priv(dev); + u32 buswidth; + int ret; + + buswidth = dev_read_u32_default(dev, "buswidth", 0); + if (buswidth != 8) { + dev_err(dev, "Only 8bit buswidth is supported now"); + return -EINVAL; + } + + ret = gpio_request_by_name(dev, "reset-gpios", 0, + &priv->reset_gpio, GPIOD_IS_OUT); + if (ret) { + dev_err(dev, "missing reset GPIO\n"); + return ret; + } + + ret = gpio_request_by_name(dev, "dc-gpios", 0, + &priv->dc_gpio, GPIOD_IS_OUT); + if (ret) { + dev_err(dev, "missing dc GPIO\n"); + return ret; + } + + uc_priv->bpix = VIDEO_BPP16; + uc_priv->xsize = WIDTH; + uc_priv->ysize = HEIGHT; + uc_priv->rot = 0; + + priv->dev = dev; + + ret = seps525_spi_startup(dev); + if (ret) + return ret; + + return 0; +} + +static int seps525_bind(struct udevice *dev) +{ + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + + plat->size = WIDTH * HEIGHT * 16; + + return 0; +} + +static const struct video_ops seps525_ops = { + .video_sync = seps525_sync, +}; + +static const struct udevice_id seps525_ids[] = { + { .compatible = "syncoam,seps525" }, + { } +}; + +U_BOOT_DRIVER(seps525_video) = { + .name = "seps525_video", + .id = UCLASS_VIDEO, + .of_match = seps525_ids, + .ops = &seps525_ops, + .platdata_auto_alloc_size = sizeof(struct video_uc_platdata), + .bind = seps525_bind, + .probe = seps525_probe, + .priv_auto_alloc_size = sizeof(struct seps525_priv), +}; diff --git a/drivers/video/simple_panel.c b/drivers/video/simple_panel.c index 6c624c3..59e17f8 100644 --- a/drivers/video/simple_panel.c +++ b/drivers/video/simple_panel.c @@ -48,7 +48,7 @@ static int simple_panel_set_backlight(struct udevice *dev, int percent) return 0; } -static int simple_panel_ofdata_to_platdata(struct udevice *dev) +static int simple_panel_of_to_plat(struct udevice *dev) { struct simple_panel_priv *priv = dev_get_priv(dev); int ret; @@ -116,7 +116,7 @@ U_BOOT_DRIVER(simple_panel) = { .id = UCLASS_PANEL, .of_match = simple_panel_ids, .ops = &simple_panel_ops, - .ofdata_to_platdata = simple_panel_ofdata_to_platdata, + .of_to_plat = simple_panel_of_to_plat, .probe = simple_panel_probe, - .priv_auto_alloc_size = sizeof(struct simple_panel_priv), + .priv_auto = sizeof(struct simple_panel_priv), }; diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c index 0c5b40c..b5fb6f6 100644 --- a/drivers/video/simplefb.c +++ b/drivers/video/simplefb.c @@ -12,7 +12,7 @@ static int simple_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); const void *blob = gd->fdt_blob; const int node = dev_of_offset(dev); diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c index 9d5abac..266623b 100644 --- a/drivers/video/stm32/stm32_dsi.c +++ b/drivers/video/stm32/stm32_dsi.c @@ -351,7 +351,7 @@ static int stm32_dsi_attach(struct udevice *dev) return ret; } - mplat = dev_get_platdata(priv->panel); + mplat = dev_get_plat(priv->panel); mplat->device = &priv->device; device->lanes = mplat->lanes; device->format = mplat->format; @@ -512,5 +512,5 @@ U_BOOT_DRIVER(stm32_dsi) = { .bind = stm32_dsi_bind, .probe = stm32_dsi_probe, .ops = &stm32_dsi_ops, - .priv_auto_alloc_size = sizeof(struct stm32_dsi_priv), + .priv_auto = sizeof(struct stm32_dsi_priv), }; diff --git a/drivers/video/stm32/stm32_ltdc.c b/drivers/video/stm32/stm32_ltdc.c index 7fff735..dc10b8c 100644 --- a/drivers/video/stm32/stm32_ltdc.c +++ b/drivers/video/stm32/stm32_ltdc.c @@ -329,7 +329,7 @@ static void stm32_ltdc_set_layer1(struct stm32_ltdc_priv *priv, ulong fb_addr) static int stm32_ltdc_probe(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct stm32_ltdc_priv *priv = dev_get_priv(dev); struct udevice *bridge = NULL; @@ -452,7 +452,7 @@ static int stm32_ltdc_probe(struct udevice *dev) static int stm32_ltdc_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); uc_plat->size = CONFIG_VIDEO_STM32_MAX_XRES * CONFIG_VIDEO_STM32_MAX_YRES * @@ -473,5 +473,5 @@ U_BOOT_DRIVER(stm32_ltdc) = { .of_match = stm32_ltdc_ids, .probe = stm32_ltdc_probe, .bind = stm32_ltdc_bind, - .priv_auto_alloc_size = sizeof(struct stm32_ltdc_priv), + .priv_auto = sizeof(struct stm32_ltdc_priv), }; diff --git a/drivers/video/sunxi/sunxi_de2.c b/drivers/video/sunxi/sunxi_de2.c index b657e16..a3e21aa 100644 --- a/drivers/video/sunxi/sunxi_de2.c +++ b/drivers/video/sunxi/sunxi_de2.c @@ -189,7 +189,7 @@ static int sunxi_de2_init(struct udevice *dev, ulong fbbase, struct display_plat *disp_uc_plat; int ret; - disp_uc_plat = dev_get_uclass_platdata(disp); + disp_uc_plat = dev_get_uclass_plat(disp); debug("Using device '%s', disp_uc_priv=%p\n", disp->name, disp_uc_plat); if (display_in_use(disp)) { debug(" - device in use\n"); @@ -237,7 +237,7 @@ static int sunxi_de2_init(struct udevice *dev, ulong fbbase, static int sunxi_de2_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct udevice *disp; int ret; @@ -299,7 +299,7 @@ static int sunxi_de2_probe(struct udevice *dev) static int sunxi_de2_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT * (1 << LCD_MAX_LOG2_BPP) / 8; @@ -319,7 +319,7 @@ U_BOOT_DRIVER(sunxi_de2) = { .flags = DM_FLAG_PRE_RELOC, }; -U_BOOT_DEVICE(sunxi_de2) = { +U_BOOT_DRVINFO(sunxi_de2) = { .name = "sunxi_de2" }; @@ -331,7 +331,7 @@ int sunxi_simplefb_setup(void *blob) { struct udevice *de2, *hdmi, *lcd; struct video_priv *de2_priv; - struct video_uc_platdata *de2_plat; + struct video_uc_plat *de2_plat; int mux; int offset, ret; u64 start, size; @@ -383,7 +383,7 @@ int sunxi_simplefb_setup(void *blob) } de2_priv = dev_get_uclass_priv(de2); - de2_plat = dev_get_uclass_platdata(de2); + de2_plat = dev_get_uclass_plat(de2); offset = sunxi_simplefb_fdt_match(blob, pipeline); if (offset < 0) { diff --git a/drivers/video/sunxi/sunxi_dw_hdmi.c b/drivers/video/sunxi/sunxi_dw_hdmi.c index 01d4b7a..0b8cefc 100644 --- a/drivers/video/sunxi/sunxi_dw_hdmi.c +++ b/drivers/video/sunxi/sunxi_dw_hdmi.c @@ -340,7 +340,7 @@ static int sunxi_dw_hdmi_enable(struct udevice *dev, int panel_bpp, static int sunxi_dw_hdmi_probe(struct udevice *dev) { - struct display_plat *uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *uc_plat = dev_get_uclass_plat(dev); struct sunxi_dw_hdmi_priv *priv = dev_get_priv(dev); struct sunxi_ccm_reg * const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; @@ -395,9 +395,9 @@ U_BOOT_DRIVER(sunxi_dw_hdmi) = { .id = UCLASS_DISPLAY, .ops = &sunxi_dw_hdmi_ops, .probe = sunxi_dw_hdmi_probe, - .priv_auto_alloc_size = sizeof(struct sunxi_dw_hdmi_priv), + .priv_auto = sizeof(struct sunxi_dw_hdmi_priv), }; -U_BOOT_DEVICE(sunxi_dw_hdmi) = { +U_BOOT_DRVINFO(sunxi_dw_hdmi) = { .name = "sunxi_dw_hdmi" }; diff --git a/drivers/video/sunxi/sunxi_lcd.c b/drivers/video/sunxi/sunxi_lcd.c index 49bf083..635edf6 100644 --- a/drivers/video/sunxi/sunxi_lcd.c +++ b/drivers/video/sunxi/sunxi_lcd.c @@ -142,11 +142,11 @@ U_BOOT_DRIVER(sunxi_lcd) = { .id = UCLASS_DISPLAY, .ops = &sunxi_lcd_ops, .probe = sunxi_lcd_probe, - .priv_auto_alloc_size = sizeof(struct sunxi_lcd_priv), + .priv_auto = sizeof(struct sunxi_lcd_priv), }; #ifdef CONFIG_MACH_SUN50I -U_BOOT_DEVICE(sunxi_lcd) = { +U_BOOT_DRVINFO(sunxi_lcd) = { .name = "sunxi_lcd" }; #endif diff --git a/drivers/video/tda19988.c b/drivers/video/tda19988.c index 191cda3..2448743 100644 --- a/drivers/video/tda19988.c +++ b/drivers/video/tda19988.c @@ -651,5 +651,5 @@ U_BOOT_DRIVER(tda19988) = { .of_match = tda19988_ids, .ops = &tda19988_ops, .probe = tda19988_probe, - .priv_auto_alloc_size = sizeof(struct tda19988_priv), + .priv_auto = sizeof(struct tda19988_priv), }; diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c index 827ea13..08b006b 100644 --- a/drivers/video/tegra.c +++ b/drivers/video/tegra.c @@ -299,7 +299,7 @@ static int tegra_display_probe(const void *blob, struct tegra_lcd_priv *priv, static int tegra_lcd_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); struct tegra_lcd_priv *priv = dev_get_priv(dev); const void *blob = gd->fdt_blob; @@ -336,7 +336,7 @@ static int tegra_lcd_probe(struct udevice *dev) return 0; } -static int tegra_lcd_ofdata_to_platdata(struct udevice *dev) +static int tegra_lcd_of_to_plat(struct udevice *dev) { struct tegra_lcd_priv *priv = dev_get_priv(dev); const void *blob = gd->fdt_blob; @@ -393,7 +393,7 @@ static int tegra_lcd_ofdata_to_platdata(struct udevice *dev) static int tegra_lcd_bind(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); int rgb; @@ -423,6 +423,6 @@ U_BOOT_DRIVER(tegra_lcd) = { .ops = &tegra_lcd_ops, .bind = tegra_lcd_bind, .probe = tegra_lcd_probe, - .ofdata_to_platdata = tegra_lcd_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct tegra_lcd_priv), + .of_to_plat = tegra_lcd_of_to_plat, + .priv_auto = sizeof(struct tegra_lcd_priv), }; diff --git a/drivers/video/tegra124/display.c b/drivers/video/tegra124/display.c index 6c27932..f642b3b 100644 --- a/drivers/video/tegra124/display.c +++ b/drivers/video/tegra124/display.c @@ -351,7 +351,7 @@ static int display_init(struct udevice *dev, void *lcdbase, return ret; } - disp_uc_plat = dev_get_uclass_platdata(dp_dev); + disp_uc_plat = dev_get_uclass_plat(dp_dev); debug("Found device '%s', disp_uc_priv=%p\n", dp_dev->name, disp_uc_plat); disp_uc_plat->src_dev = dev; @@ -465,7 +465,7 @@ static int tegra124_lcd_init(struct udevice *dev, void *lcdbase, static int tegra124_lcd_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); ulong start; int ret; @@ -482,7 +482,7 @@ static int tegra124_lcd_probe(struct udevice *dev) static int tegra124_lcd_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); uc_plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT * (1 << VIDEO_BPP16) / 8; diff --git a/drivers/video/tegra124/dp.c b/drivers/video/tegra124/dp.c index 59758eb..8f5116f 100644 --- a/drivers/video/tegra124/dp.c +++ b/drivers/video/tegra124/dp.c @@ -1566,9 +1566,9 @@ error_enable: return 0; } -static int tegra_dp_ofdata_to_platdata(struct udevice *dev) +static int tegra_dp_of_to_plat(struct udevice *dev) { - struct tegra_dp_plat *plat = dev_get_platdata(dev); + struct tegra_dp_plat *plat = dev_get_plat(dev); plat->base = dev_read_addr(dev); @@ -1594,9 +1594,9 @@ static const struct dm_display_ops dp_tegra_ops = { static int dp_tegra_probe(struct udevice *dev) { - struct tegra_dp_plat *plat = dev_get_platdata(dev); + struct tegra_dp_plat *plat = dev_get_plat(dev); struct tegra_dp_priv *priv = dev_get_priv(dev); - struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev); + struct display_plat *disp_uc_plat = dev_get_uclass_plat(dev); priv->regs = (struct dpaux_ctlr *)plat->base; priv->enabled = false; @@ -1616,9 +1616,9 @@ U_BOOT_DRIVER(dp_tegra) = { .name = "dpaux_tegra", .id = UCLASS_DISPLAY, .of_match = tegra_dp_ids, - .ofdata_to_platdata = tegra_dp_ofdata_to_platdata, + .of_to_plat = tegra_dp_of_to_plat, .probe = dp_tegra_probe, .ops = &dp_tegra_ops, - .priv_auto_alloc_size = sizeof(struct tegra_dp_priv), - .platdata_auto_alloc_size = sizeof(struct tegra_dp_plat), + .priv_auto = sizeof(struct tegra_dp_priv), + .plat_auto = sizeof(struct tegra_dp_plat), }; diff --git a/drivers/video/tegra124/sor.c b/drivers/video/tegra124/sor.c index 49f33c1..95976ee 100644 --- a/drivers/video/tegra124/sor.c +++ b/drivers/video/tegra124/sor.c @@ -1042,7 +1042,7 @@ static int tegra_sor_set_backlight(struct udevice *dev, int percent) return 0; } -static int tegra_sor_ofdata_to_platdata(struct udevice *dev) +static int tegra_sor_of_to_plat(struct udevice *dev) { struct tegra_dc_sor_data *priv = dev_get_priv(dev); int ret; @@ -1077,7 +1077,7 @@ U_BOOT_DRIVER(sor_tegra) = { .name = "sor_tegra", .id = UCLASS_VIDEO_BRIDGE, .of_match = tegra_sor_ids, - .ofdata_to_platdata = tegra_sor_ofdata_to_platdata, + .of_to_plat = tegra_sor_of_to_plat, .ops = &tegra_sor_ops, - .priv_auto_alloc_size = sizeof(struct tegra_dc_sor_data), + .priv_auto = sizeof(struct tegra_dc_sor_data), }; diff --git a/drivers/video/vesa.c b/drivers/video/vesa.c index 9656326..869e546 100644 --- a/drivers/video/vesa.c +++ b/drivers/video/vesa.c @@ -13,7 +13,7 @@ static int vesa_video_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); ulong fbbase; int ret; @@ -31,7 +31,7 @@ static int vesa_video_probe(struct udevice *dev) static int vesa_video_bind(struct udevice *dev) { - struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); /* Set the maximum supported resolution */ uc_plat->size = 2560 * 1600 * 4; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 3a07f36..81b65f5 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -89,9 +89,7 @@ static int vidconsole_back(struct udevice *dev) if (priv->ycur < 0) priv->ycur = 0; } - video_sync(dev->parent, false); - - return 0; + return video_sync(dev->parent, false); } /* Move to a newline, scrolling the display if necessary */ @@ -101,7 +99,7 @@ static void vidconsole_newline(struct udevice *dev) struct udevice *vid_dev = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); const int rows = CONFIG_CONSOLE_SCROLL_LINES; - int i; + int i, ret; priv->xcur_frac = priv->xstart_frac; priv->ycur += priv->y_charsize; @@ -116,7 +114,12 @@ static void vidconsole_newline(struct udevice *dev) } priv->last_ch = 0; - video_sync(dev->parent, false); + ret = video_sync(dev->parent, false); + if (ret) { +#ifdef DEBUG + console_puts_select_stderr(true, "[vc err: video_sync]"); +#endif + } } static const struct vid_rgb colors[VID_COLOR_COUNT] = { @@ -348,8 +351,15 @@ static void vidconsole_escape_char(struct udevice *dev, char ch) parsenum(priv->escape_buf + 1, &mode); if (mode == 2) { + int ret; + video_clear(dev->parent); - video_sync(dev->parent, false); + ret = video_sync(dev->parent, false); + if (ret) { +#ifdef DEBUG + console_puts_select_stderr(true, "[vc err: video_sync]"); +#endif + } priv->ycur = 0; priv->xcur_frac = priv->xstart_frac; } else { @@ -565,7 +575,12 @@ static void vidconsole_putc(struct stdio_dev *sdev, const char ch) console_puts_select_stderr(true, "[vc err: putc]"); #endif } - video_sync(dev->parent, false); + ret = video_sync(dev->parent, false); + if (ret) { +#ifdef DEBUG + console_puts_select_stderr(true, "[vc err: video_sync]"); +#endif + } } static void vidconsole_puts(struct stdio_dev *sdev, const char *s) @@ -582,7 +597,12 @@ static void vidconsole_puts(struct stdio_dev *sdev, const char *s) console_puts_select_stderr(true, str); #endif } - video_sync(dev->parent, false); + ret = video_sync(dev->parent, false); + if (ret) { +#ifdef DEBUG + console_puts_select_stderr(true, "[vc err: video_sync]"); +#endif + } } /* Set up the number of rows and colours (rotated drivers override this) */ @@ -606,9 +626,9 @@ static int vidconsole_post_probe(struct udevice *dev) if (!priv->tab_width_frac) priv->tab_width_frac = VID_TO_POS(priv->x_charsize) * 8; - if (dev->seq) { + if (dev_seq(dev)) { snprintf(sdev->name, sizeof(sdev->name), "vidconsole%d", - dev->seq); + dev_seq(dev)); } else { strcpy(sdev->name, "vidconsole"); } @@ -626,7 +646,7 @@ UCLASS_DRIVER(vidconsole) = { .name = "vidconsole0", .pre_probe = vidconsole_pre_probe, .post_probe = vidconsole_post_probe, - .per_device_auto_alloc_size = sizeof(struct vidconsole_priv), + .per_device_auto = sizeof(struct vidconsole_priv), }; #ifdef CONFIG_VIDEO_COPY @@ -691,9 +711,7 @@ static int do_video_puts(struct cmd_tbl *cmdtp, int flag, int argc, for (s = argv[1]; *s; s++) vidconsole_put_char(dev, *s); - video_sync(dev->parent, false); - - return 0; + return video_sync(dev->parent, false); } U_BOOT_CMD( diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 650891e..a1d5275 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -15,6 +15,7 @@ #include <video_console.h> #include <asm/cache.h> #include <dm/lists.h> +#include <dm/device_compat.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> #ifdef CONFIG_SANDBOX @@ -25,7 +26,7 @@ * Theory of operation: * * Before relocation each device is bound. The driver for each device must - * set the @align and @size values in struct video_uc_platdata. This + * set the @align and @size values in struct video_uc_plat. This * information represents the requires size and alignment of the frame buffer * for the device. The values can be an over-estimate but cannot be too * small. The actual values will be suppled (in the same manner) by the bind() @@ -68,7 +69,7 @@ void video_set_flush_dcache(struct udevice *dev, bool flush) static ulong alloc_fb(struct udevice *dev, ulong *addrp) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); ulong base, align, size; if (!plat->size) @@ -142,7 +143,7 @@ int video_clear(struct udevice *dev) if (ret) return ret; - return 0; + return video_sync(dev, false); } void video_set_default_colors(struct udevice *dev, bool invert) @@ -172,8 +173,17 @@ void video_set_default_colors(struct udevice *dev, bool invert) } /* Flush video activity to the caches */ -void video_sync(struct udevice *vid, bool force) +int video_sync(struct udevice *vid, bool force) { + struct video_ops *ops = video_get_ops(vid); + int ret; + + if (ops && ops->video_sync) { + ret = ops->video_sync(vid); + if (ret) + return ret; + } + /* * flush_dcache_range() is declared in common.h but it seems that some * architectures do not actually implement it. Is there a way to find @@ -196,17 +206,22 @@ void video_sync(struct udevice *vid, bool force) last_sync = get_timer(0); } #endif + return 0; } void video_sync_all(void) { struct udevice *dev; + int ret; for (uclass_find_first_device(UCLASS_VIDEO, &dev); dev; uclass_find_next_device(&dev)) { - if (device_active(dev)) - video_sync(dev, true); + if (device_active(dev)) { + ret = video_sync(dev, true); + if (ret) + dev_dbg(dev, "Video sync failed\n"); + } } } @@ -301,7 +316,7 @@ static int video_pre_remove(struct udevice *dev) /* Set up the display ready for use */ static int video_post_probe(struct udevice *dev) { - struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *priv = dev_get_uclass_priv(dev); char name[30], drv[15], *str; const char *drv_name = drv; @@ -378,7 +393,7 @@ static int video_post_bind(struct udevice *dev) return 0; /* Set up the video pointer, if this is the first device */ - uc_priv = dev->uclass->priv; + uc_priv = uclass_get_priv(dev->uclass); if (!uc_priv->video_ptr) uc_priv->video_ptr = gd->video_top; @@ -408,7 +423,7 @@ UCLASS_DRIVER(video) = { .pre_probe = video_pre_probe, .post_probe = video_post_probe, .pre_remove = video_pre_remove, - .priv_auto_alloc_size = sizeof(struct video_uc_priv), - .per_device_auto_alloc_size = sizeof(struct video_priv), - .per_device_platdata_auto_alloc_size = sizeof(struct video_uc_platdata), + .priv_auto = sizeof(struct video_uc_priv), + .per_device_auto = sizeof(struct video_priv), + .per_device_plat_auto = sizeof(struct video_uc_plat), }; diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 5a4d12c..66de223 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -379,8 +379,5 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, if (ret) return log_ret(ret); - video_sync(dev, false); - - return 0; + return video_sync(dev, false); } - diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c index 2636cbe..cf2cfae 100644 --- a/drivers/virtio/virtio-uclass.c +++ b/drivers/virtio/virtio-uclass.c @@ -240,7 +240,7 @@ static int virtio_uclass_post_probe(struct udevice *udev) } snprintf(dev_name, sizeof(dev_name), "%s#%d", - virtio_drv_name[uc_priv->device], udev->seq); + virtio_drv_name[uc_priv->device], dev_seq(udev)); str = strdup(dev_name); if (!str) return -ENOMEM; @@ -369,5 +369,5 @@ UCLASS_DRIVER(virtio) = { .child_post_bind = virtio_uclass_child_post_bind, .child_pre_probe = virtio_uclass_child_pre_probe, .child_post_probe = virtio_uclass_child_post_probe, - .per_device_auto_alloc_size = sizeof(struct virtio_dev_priv), + .per_device_auto = sizeof(struct virtio_dev_priv), }; diff --git a/drivers/virtio/virtio_blk.c b/drivers/virtio/virtio_blk.c index 1799f5c..3ff74f4 100644 --- a/drivers/virtio/virtio_blk.c +++ b/drivers/virtio/virtio_blk.c @@ -72,7 +72,7 @@ static ulong virtio_blk_write(struct udevice *dev, lbaint_t start, static int virtio_blk_bind(struct udevice *dev) { struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(dev->parent); - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); int devnum; desc->if_type = IF_TYPE_VIRTIO; @@ -106,7 +106,7 @@ static int virtio_blk_bind(struct udevice *dev) static int virtio_blk_probe(struct udevice *dev) { struct virtio_blk_priv *priv = dev_get_priv(dev); - struct blk_desc *desc = dev_get_uclass_platdata(dev); + struct blk_desc *desc = dev_get_uclass_plat(dev); u64 cap; int ret; @@ -134,6 +134,6 @@ U_BOOT_DRIVER(virtio_blk) = { .bind = virtio_blk_bind, .probe = virtio_blk_probe, .remove = virtio_reset, - .priv_auto_alloc_size = sizeof(struct virtio_blk_priv), + .priv_auto = sizeof(struct virtio_blk_priv), .flags = DM_FLAG_ACTIVE_DMA, }; diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index b951ea3..78c15c8 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -334,7 +334,7 @@ static int virtio_mmio_notify(struct udevice *udev, struct virtqueue *vq) return 0; } -static int virtio_mmio_ofdata_to_platdata(struct udevice *udev) +static int virtio_mmio_of_to_plat(struct udevice *udev) { struct virtio_mmio_priv *priv = dev_get_priv(udev); @@ -411,6 +411,6 @@ U_BOOT_DRIVER(virtio_mmio) = { .of_match = virtio_mmio_ids, .ops = &virtio_mmio_ops, .probe = virtio_mmio_probe, - .ofdata_to_platdata = virtio_mmio_ofdata_to_platdata, - .priv_auto_alloc_size = sizeof(struct virtio_mmio_priv), + .of_to_plat = virtio_mmio_of_to_plat, + .priv_auto = sizeof(struct virtio_mmio_priv), }; diff --git a/drivers/virtio/virtio_net.c b/drivers/virtio/virtio_net.c index 0dbbd78..1794f73 100644 --- a/drivers/virtio/virtio_net.c +++ b/drivers/virtio/virtio_net.c @@ -145,7 +145,7 @@ static void virtio_net_stop(struct udevice *dev) static int virtio_net_write_hwaddr(struct udevice *dev) { struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(dev->parent); - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); int i; /* @@ -166,7 +166,7 @@ static int virtio_net_write_hwaddr(struct udevice *dev) static int virtio_net_read_rom_hwaddr(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_pdata *pdata = dev_get_plat(dev); if (!pdata) return -ENOSYS; @@ -233,7 +233,7 @@ U_BOOT_DRIVER(virtio_net) = { .probe = virtio_net_probe, .remove = virtio_reset, .ops = &virtio_net_ops, - .priv_auto_alloc_size = sizeof(struct virtio_net_priv), - .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .priv_auto = sizeof(struct virtio_net_priv), + .plat_auto = sizeof(struct eth_pdata), .flags = DM_FLAG_ACTIVE_DMA, }; diff --git a/drivers/virtio/virtio_pci_legacy.c b/drivers/virtio/virtio_pci_legacy.c index fa7f242..03fa5cb 100644 --- a/drivers/virtio/virtio_pci_legacy.c +++ b/drivers/virtio/virtio_pci_legacy.c @@ -292,7 +292,7 @@ static int virtio_pci_bind(struct udevice *udev) static int virtio_pci_probe(struct udevice *udev) { - struct pci_child_platdata *pplat = dev_get_parent_platdata(udev); + struct pci_child_plat *pplat = dev_get_parent_plat(udev); struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev); struct virtio_pci_priv *priv = dev_get_priv(udev); u16 subvendor, subdevice; @@ -350,7 +350,7 @@ U_BOOT_DRIVER(virtio_pci_legacy) = { .ops = &virtio_pci_ops, .bind = virtio_pci_bind, .probe = virtio_pci_probe, - .priv_auto_alloc_size = sizeof(struct virtio_pci_priv), + .priv_auto = sizeof(struct virtio_pci_priv), }; static struct pci_device_id virtio_pci_supported[] = { diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index 2e5bbad..dfbbf8a 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -456,7 +456,7 @@ static int virtio_pci_bind(struct udevice *udev) static int virtio_pci_probe(struct udevice *udev) { - struct pci_child_platdata *pplat = dev_get_parent_platdata(udev); + struct pci_child_plat *pplat = dev_get_parent_plat(udev); struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev); struct virtio_pci_priv *priv = dev_get_priv(udev); u16 subvendor; @@ -539,7 +539,7 @@ U_BOOT_DRIVER(virtio_pci_modern) = { .ops = &virtio_pci_ops, .bind = virtio_pci_bind, .probe = virtio_pci_probe, - .priv_auto_alloc_size = sizeof(struct virtio_pci_priv), + .priv_auto = sizeof(struct virtio_pci_priv), }; static struct pci_device_id virtio_pci_supported[] = { diff --git a/drivers/virtio/virtio_rng.c b/drivers/virtio/virtio_rng.c index fc3e19c..9314c0a 100644 --- a/drivers/virtio/virtio_rng.c +++ b/drivers/virtio/virtio_rng.c @@ -84,6 +84,6 @@ U_BOOT_DRIVER(virtio_rng) = { .probe = virtio_rng_probe, .remove = virtio_reset, .ops = &virtio_rng_ops, - .priv_auto_alloc_size = sizeof(struct virtio_rng_priv), + .priv_auto = sizeof(struct virtio_rng_priv), .flags = DM_FLAG_ACTIVE_DMA, }; diff --git a/drivers/virtio/virtio_sandbox.c b/drivers/virtio/virtio_sandbox.c index 2a2abb9..aafb7be 100644 --- a/drivers/virtio/virtio_sandbox.c +++ b/drivers/virtio/virtio_sandbox.c @@ -204,7 +204,7 @@ U_BOOT_DRIVER(virtio_sandbox1) = { .ops = &virtio_sandbox1_ops, .probe = virtio_sandbox_probe, .child_post_remove = virtio_sandbox_child_post_remove, - .priv_auto_alloc_size = sizeof(struct virtio_sandbox_priv), + .priv_auto = sizeof(struct virtio_sandbox_priv), }; /* this one without notify op */ @@ -231,5 +231,5 @@ U_BOOT_DRIVER(virtio_sandbox2) = { .of_match = virtio_sandbox2_ids, .ops = &virtio_sandbox2_ops, .probe = virtio_sandbox_probe, - .priv_auto_alloc_size = sizeof(struct virtio_sandbox_priv), + .priv_auto = sizeof(struct virtio_sandbox_priv), }; diff --git a/drivers/w1-eeprom/ds24xxx.c b/drivers/w1-eeprom/ds24xxx.c index 0967acc..d12fd57 100644 --- a/drivers/w1-eeprom/ds24xxx.c +++ b/drivers/w1-eeprom/ds24xxx.c @@ -31,7 +31,7 @@ static int ds24xxx_probe(struct udevice *dev) { struct w1_device *w1; - w1 = dev_get_parent_platdata(dev); + w1 = dev_get_parent_plat(dev); w1->id = 0; return 0; } diff --git a/drivers/w1-eeprom/ds2502.c b/drivers/w1-eeprom/ds2502.c index 19ee4b1..b3d68d7 100644 --- a/drivers/w1-eeprom/ds2502.c +++ b/drivers/w1-eeprom/ds2502.c @@ -222,7 +222,7 @@ static int ds2502_probe(struct udevice *dev) { struct w1_device *w1; - w1 = dev_get_parent_platdata(dev); + w1 = dev_get_parent_plat(dev); w1->id = 0; return 0; } diff --git a/drivers/w1-eeprom/w1-eeprom-uclass.c b/drivers/w1-eeprom/w1-eeprom-uclass.c index d515b4c..97a9d43 100644 --- a/drivers/w1-eeprom/w1-eeprom-uclass.c +++ b/drivers/w1-eeprom/w1-eeprom-uclass.c @@ -53,7 +53,7 @@ int w1_eeprom_register_new_device(u64 id) if (dev_get_driver_data(dev) == family) { struct w1_device *w1; - w1 = dev_get_parent_platdata(dev); + w1 = dev_get_parent_plat(dev); if (w1->id) /* device already in use */ continue; w1->id = id; @@ -70,7 +70,7 @@ int w1_eeprom_register_new_device(u64 id) int w1_eeprom_get_id(struct udevice *dev, u64 *id) { - struct w1_device *w1 = dev_get_parent_platdata(dev); + struct w1_device *w1 = dev_get_parent_plat(dev); if (!w1) return -ENODEV; diff --git a/drivers/w1/mxc_w1.c b/drivers/w1/mxc_w1.c index 8e6372f..3637feb 100644 --- a/drivers/w1/mxc_w1.c +++ b/drivers/w1/mxc_w1.c @@ -79,7 +79,7 @@ static u8 mxc_w1_touch_bit(struct mxc_w1_pdata *pdata, u8 bit) static u8 mxc_w1_read_byte(struct udevice *dev) { - struct mxc_w1_pdata *pdata = dev_get_platdata(dev); + struct mxc_w1_pdata *pdata = dev_get_plat(dev); struct mxc_w1_regs *regs = pdata->regs; u16 status; @@ -106,7 +106,7 @@ static u8 mxc_w1_read_byte(struct udevice *dev) static void mxc_w1_write_byte(struct udevice *dev, u8 byte) { - struct mxc_w1_pdata *pdata = dev_get_platdata(dev); + struct mxc_w1_pdata *pdata = dev_get_plat(dev); struct mxc_w1_regs *regs = pdata->regs; u16 status; @@ -130,7 +130,7 @@ static void mxc_w1_write_byte(struct udevice *dev, u8 byte) static bool mxc_w1_reset(struct udevice *dev) { - struct mxc_w1_pdata *pdata = dev_get_platdata(dev); + struct mxc_w1_pdata *pdata = dev_get_plat(dev); u16 reg_val; writew(MXC_W1_CONTROL_RPP, &pdata->regs->control); @@ -144,7 +144,7 @@ static bool mxc_w1_reset(struct udevice *dev) static u8 mxc_w1_triplet(struct udevice *dev, bool bdir) { - struct mxc_w1_pdata *pdata = dev_get_platdata(dev); + struct mxc_w1_pdata *pdata = dev_get_plat(dev); u8 id_bit = mxc_w1_touch_bit(pdata, 1); u8 comp_bit = mxc_w1_touch_bit(pdata, 1); u8 retval; @@ -166,9 +166,9 @@ static u8 mxc_w1_triplet(struct udevice *dev, bool bdir) return retval; } -static int mxc_w1_ofdata_to_platdata(struct udevice *dev) +static int mxc_w1_of_to_plat(struct udevice *dev) { - struct mxc_w1_pdata *pdata = dev_get_platdata(dev); + struct mxc_w1_pdata *pdata = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); @@ -182,7 +182,7 @@ static int mxc_w1_ofdata_to_platdata(struct udevice *dev) static int mxc_w1_probe(struct udevice *dev) { - struct mxc_w1_pdata *pdata = dev_get_platdata(dev); + struct mxc_w1_pdata *pdata = dev_get_plat(dev); unsigned int clkrate = mxc_get_clock(MXC_IPG_PERCLK); unsigned int clkdiv; @@ -228,8 +228,8 @@ U_BOOT_DRIVER(mxc_w1_drv) = { .id = UCLASS_W1, .name = "mxc_w1_drv", .of_match = mxc_w1_id, - .ofdata_to_platdata = mxc_w1_ofdata_to_platdata, + .of_to_plat = mxc_w1_of_to_plat, .ops = &mxc_w1_ops, - .platdata_auto_alloc_size = sizeof(struct mxc_w1_pdata), + .plat_auto = sizeof(struct mxc_w1_pdata), .probe = mxc_w1_probe, }; diff --git a/drivers/w1/w1-gpio.c b/drivers/w1/w1-gpio.c index 45ad47a..3b0ead6 100644 --- a/drivers/w1/w1-gpio.c +++ b/drivers/w1/w1-gpio.c @@ -33,7 +33,7 @@ struct w1_gpio_pdata { static bool w1_gpio_read_bit(struct udevice *dev) { - struct w1_gpio_pdata *pdata = dev_get_platdata(dev); + struct w1_gpio_pdata *pdata = dev_get_plat(dev); int val; dm_gpio_set_dir_flags(&pdata->gpio, GPIOD_IS_OUT); @@ -63,7 +63,7 @@ static u8 w1_gpio_read_byte(struct udevice *dev) static void w1_gpio_write_bit(struct udevice *dev, bool bit) { - struct w1_gpio_pdata *pdata = dev_get_platdata(dev); + struct w1_gpio_pdata *pdata = dev_get_plat(dev); dm_gpio_set_dir_flags(&pdata->gpio, GPIOD_IS_OUT); @@ -84,7 +84,7 @@ static void w1_gpio_write_byte(struct udevice *dev, u8 byte) static bool w1_gpio_reset(struct udevice *dev) { - struct w1_gpio_pdata *pdata = dev_get_platdata(dev); + struct w1_gpio_pdata *pdata = dev_get_plat(dev); int val; /* initiate the reset pulse. first we must pull the bus to low */ @@ -151,9 +151,9 @@ static const struct w1_ops w1_gpio_ops = { .write_byte = w1_gpio_write_byte, }; -static int w1_gpio_ofdata_to_platdata(struct udevice *dev) +static int w1_gpio_of_to_plat(struct udevice *dev) { - struct w1_gpio_pdata *pdata = dev_get_platdata(dev); + struct w1_gpio_pdata *pdata = dev_get_plat(dev); int ret; ret = gpio_request_by_name(dev, "gpios", 0, &pdata->gpio, 0); @@ -172,7 +172,7 @@ U_BOOT_DRIVER(w1_gpio_drv) = { .id = UCLASS_W1, .name = "w1_gpio_drv", .of_match = w1_gpio_id, - .ofdata_to_platdata = w1_gpio_ofdata_to_platdata, + .of_to_plat = w1_gpio_of_to_plat, .ops = &w1_gpio_ops, - .platdata_auto_alloc_size = sizeof(struct w1_gpio_pdata), + .plat_auto = sizeof(struct w1_gpio_pdata), }; diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c index 9478c93..8bc6cb1 100644 --- a/drivers/w1/w1-uclass.c +++ b/drivers/w1/w1-uclass.c @@ -130,14 +130,14 @@ int w1_get_bus(int busnum, struct udevice **busp) u8 w1_get_device_family(struct udevice *dev) { - struct w1_device *w1 = dev_get_parent_platdata(dev); + struct w1_device *w1 = dev_get_parent_plat(dev); return w1->id & 0xff; } int w1_reset_select(struct udevice *dev) { - struct w1_device *w1 = dev_get_parent_platdata(dev); + struct w1_device *w1 = dev_get_parent_plat(dev); struct udevice *bus = dev_get_parent(dev); const struct w1_ops *ops = device_get_ops(bus); int i; @@ -230,10 +230,10 @@ UCLASS_DRIVER(w1) = { .name = "w1", .id = UCLASS_W1, .flags = DM_UC_FLAG_SEQ_ALIAS, - .per_device_auto_alloc_size = sizeof(struct w1_bus), + .per_device_auto = sizeof(struct w1_bus), .post_probe = w1_post_probe, #if CONFIG_IS_ENABLED(OF_CONTROL) .post_bind = dm_scan_fdt_dev, #endif - .per_child_platdata_auto_alloc_size = sizeof(struct w1_device), + .per_child_plat_auto = sizeof(struct w1_device), }; diff --git a/drivers/watchdog/armada-37xx-wdt.c b/drivers/watchdog/armada-37xx-wdt.c index 5da8e56..dd97a17 100644 --- a/drivers/watchdog/armada-37xx-wdt.c +++ b/drivers/watchdog/armada-37xx-wdt.c @@ -196,6 +196,6 @@ U_BOOT_DRIVER(a37xx_wdt) = { .id = UCLASS_WDT, .of_match = a37xx_wdt_ids, .probe = a37xx_wdt_probe, - .priv_auto_alloc_size = sizeof(struct a37xx_wdt), + .priv_auto = sizeof(struct a37xx_wdt), .ops = &a37xx_wdt_ops, }; diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c index 9b83d2a..f7b5a1a 100644 --- a/drivers/watchdog/ast_wdt.c +++ b/drivers/watchdog/ast_wdt.c @@ -86,7 +86,7 @@ static int ast_wdt_expire_now(struct udevice *dev, ulong flags) return ast_wdt_stop(dev); } -static int ast_wdt_ofdata_to_platdata(struct udevice *dev) +static int ast_wdt_of_to_plat(struct udevice *dev) { struct ast_wdt_priv *priv = dev_get_priv(dev); @@ -113,7 +113,7 @@ static const struct udevice_id ast_wdt_ids[] = { static int ast_wdt_probe(struct udevice *dev) { - debug("%s() wdt%u\n", __func__, dev->seq); + debug("%s() wdt%u\n", __func__, dev_seq(dev)); ast_wdt_stop(dev); return 0; @@ -124,7 +124,7 @@ U_BOOT_DRIVER(ast_wdt) = { .id = UCLASS_WDT, .of_match = ast_wdt_ids, .probe = ast_wdt_probe, - .priv_auto_alloc_size = sizeof(struct ast_wdt_priv), - .ofdata_to_platdata = ast_wdt_ofdata_to_platdata, + .priv_auto = sizeof(struct ast_wdt_priv), + .of_to_plat = ast_wdt_of_to_plat, .ops = &ast_wdt_ops, }; diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index 33f5c35..9e0d89b 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c @@ -108,7 +108,7 @@ static int at91_wdt_probe(struct udevice *dev) if (!priv->regs) return -EINVAL; - debug("%s: Probing wdt%u\n", __func__, dev->seq); + debug("%s: Probing wdt%u\n", __func__, dev_seq(dev)); return 0; } @@ -117,7 +117,7 @@ U_BOOT_DRIVER(atmel_at91sam9260_wdt) = { .name = "atmel_at91sam9260_wdt", .id = UCLASS_WDT, .of_match = at91_wdt_ids, - .priv_auto_alloc_size = sizeof(struct at91_wdt_priv), + .priv_auto = sizeof(struct at91_wdt_priv), .ops = &at91_wdt_ops, .probe = at91_wdt_probe, }; diff --git a/drivers/watchdog/bcm6345_wdt.c b/drivers/watchdog/bcm6345_wdt.c index ee77f49..677b134 100644 --- a/drivers/watchdog/bcm6345_wdt.c +++ b/drivers/watchdog/bcm6345_wdt.c @@ -112,6 +112,6 @@ U_BOOT_DRIVER(wdt_bcm6345) = { .id = UCLASS_WDT, .of_match = bcm6345_wdt_ids, .ops = &bcm6345_wdt_ops, - .priv_auto_alloc_size = sizeof(struct bcm6345_wdt_priv), + .priv_auto = sizeof(struct bcm6345_wdt_priv), .probe = bcm6345_wdt_probe, }; diff --git a/drivers/watchdog/cdns_wdt.c b/drivers/watchdog/cdns_wdt.c index 2abd552..966d010 100644 --- a/drivers/watchdog/cdns_wdt.c +++ b/drivers/watchdog/cdns_wdt.c @@ -223,12 +223,12 @@ static int cdns_wdt_stop(struct udevice *dev) */ static int cdns_wdt_probe(struct udevice *dev) { - debug("%s: Probing wdt%u\n", __func__, dev->seq); + debug("%s: Probing wdt%u\n", __func__, dev_seq(dev)); return 0; } -static int cdns_wdt_ofdata_to_platdata(struct udevice *dev) +static int cdns_wdt_of_to_plat(struct udevice *dev) { struct cdns_wdt_priv *priv = dev_get_priv(dev); @@ -260,7 +260,7 @@ U_BOOT_DRIVER(cdns_wdt) = { .id = UCLASS_WDT, .of_match = cdns_wdt_ids, .probe = cdns_wdt_probe, - .priv_auto_alloc_size = sizeof(struct cdns_wdt_priv), - .ofdata_to_platdata = cdns_wdt_ofdata_to_platdata, + .priv_auto = sizeof(struct cdns_wdt_priv), + .of_to_plat = cdns_wdt_of_to_plat, .ops = &cdns_wdt_ops, }; diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c index 7caa6c5..c020324 100644 --- a/drivers/watchdog/designware_wdt.c +++ b/drivers/watchdog/designware_wdt.c @@ -168,7 +168,7 @@ U_BOOT_DRIVER(designware_wdt) = { .name = "designware_wdt", .id = UCLASS_WDT, .of_match = designware_wdt_ids, - .priv_auto_alloc_size = sizeof(struct designware_wdt_priv), + .priv_auto = sizeof(struct designware_wdt_priv), .probe = designware_wdt_probe, .ops = &designware_wdt_ops, .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c index b90c2da..5e0a096 100644 --- a/drivers/watchdog/imx_watchdog.c +++ b/drivers/watchdog/imx_watchdog.c @@ -169,7 +169,7 @@ U_BOOT_DRIVER(imx_wdt) = { .of_match = imx_wdt_ids, .probe = imx_wdt_probe, .ops = &imx_wdt_ops, - .priv_auto_alloc_size = sizeof(struct imx_wdt_priv), + .priv_auto = sizeof(struct imx_wdt_priv), .flags = DM_FLAG_PRE_RELOC, }; #endif diff --git a/drivers/watchdog/mt7621_wdt.c b/drivers/watchdog/mt7621_wdt.c index 1cd8866..8b5ed28 100644 --- a/drivers/watchdog/mt7621_wdt.c +++ b/drivers/watchdog/mt7621_wdt.c @@ -98,6 +98,6 @@ U_BOOT_DRIVER(mt762x_wdt) = { .id = UCLASS_WDT, .of_match = mt762x_wdt_ids, .probe = mt762x_wdt_probe, - .priv_auto_alloc_size = sizeof(struct mt762x_wdt), + .priv_auto = sizeof(struct mt762x_wdt), .ops = &mt762x_wdt_ops, }; diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c index a636cff..b098b2e 100644 --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c @@ -152,7 +152,7 @@ U_BOOT_DRIVER(mtk_wdt) = { .name = "mtk_wdt", .id = UCLASS_WDT, .of_match = mtk_wdt_ids, - .priv_auto_alloc_size = sizeof(struct mtk_wdt_priv), + .priv_auto = sizeof(struct mtk_wdt_priv), .probe = mtk_wdt_probe, .ops = &mtk_wdt_ops, .flags = DM_FLAG_PRE_RELOC, diff --git a/drivers/watchdog/octeontx_wdt.c b/drivers/watchdog/octeontx_wdt.c index 88708dc..5f586ef 100644 --- a/drivers/watchdog/octeontx_wdt.c +++ b/drivers/watchdog/octeontx_wdt.c @@ -137,7 +137,7 @@ U_BOOT_DRIVER(wdt_octeontx) = { .id = UCLASS_WDT, .of_match = octeontx_wdt_ids, .ops = &octeontx_wdt_ops, - .priv_auto_alloc_size = sizeof(struct octeontx_wdt), + .priv_auto = sizeof(struct octeontx_wdt), .probe = octeontx_wdt_probe, .remove = octeontx_wdt_remove, .flags = DM_FLAG_OS_PREPARE, diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 9059a4c..ca2bc7c 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -242,7 +242,7 @@ static int omap3_wdt_probe(struct udevice *dev) return -EINVAL; priv->wdt_trgr_pattern = 0x1234; - debug("%s: Probing wdt%u\n", __func__, dev->seq); + debug("%s: Probing wdt%u\n", __func__, dev_seq(dev)); return 0; } @@ -263,6 +263,6 @@ U_BOOT_DRIVER(omap3_wdt) = { .of_match = omap3_wdt_ids, .ops = &omap3_wdt_ops, .probe = omap3_wdt_probe, - .priv_auto_alloc_size = sizeof(struct omap3_wdt_priv), + .priv_auto = sizeof(struct omap3_wdt_priv), }; #endif /* !CONFIG_IS_ENABLED(WDT) */ diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index d33e2ac..167af90 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c @@ -133,7 +133,7 @@ static inline bool save_reg_from_ofdata(struct udevice *dev, int index, return true; } -static int orion_wdt_ofdata_to_platdata(struct udevice *dev) +static int orion_wdt_of_to_plat(struct udevice *dev) { struct orion_wdt_priv *priv = dev_get_priv(dev); @@ -158,7 +158,7 @@ static int orion_wdt_probe(struct udevice *dev) struct orion_wdt_priv *priv = dev_get_priv(dev); int ret; - debug("%s: Probing wdt%u\n", __func__, dev->seq); + debug("%s: Probing wdt%u\n", __func__, dev_seq(dev)); orion_wdt_stop(dev); ret = clk_get_by_name(dev, "fixed", &priv->clk); @@ -186,7 +186,7 @@ U_BOOT_DRIVER(orion_wdt) = { .id = UCLASS_WDT, .of_match = orion_wdt_ids, .probe = orion_wdt_probe, - .priv_auto_alloc_size = sizeof(struct orion_wdt_priv), - .ofdata_to_platdata = orion_wdt_ofdata_to_platdata, + .priv_auto = sizeof(struct orion_wdt_priv), + .of_to_plat = orion_wdt_of_to_plat, .ops = &orion_wdt_ops, }; diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c index ebe29c7..f64a39f 100644 --- a/drivers/watchdog/rti_wdt.c +++ b/drivers/watchdog/rti_wdt.c @@ -118,6 +118,6 @@ U_BOOT_DRIVER(rti_wdt) = { .of_match = rti_wdt_ids, .ops = &rti_wdt_ops, .probe = rti_wdt_probe, - .priv_auto_alloc_size = sizeof(struct rti_wdt_priv), + .priv_auto = sizeof(struct rti_wdt_priv), .flags = DM_FLAG_REMOVE_WITH_PD_ON, }; diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c index 96285c1..b7cb199 100644 --- a/drivers/watchdog/sbsa_gwdt.c +++ b/drivers/watchdog/sbsa_gwdt.c @@ -88,12 +88,12 @@ static int sbsa_gwdt_expire_now(struct udevice *dev, ulong flags) static int sbsa_gwdt_probe(struct udevice *dev) { - debug("%s: Probing wdt%u (sbsa-gwdt)\n", __func__, dev->seq); + debug("%s: Probing wdt%u (sbsa-gwdt)\n", __func__, dev_seq(dev)); return 0; } -static int sbsa_gwdt_ofdata_to_platdata(struct udevice *dev) +static int sbsa_gwdt_of_to_plat(struct udevice *dev) { struct sbsa_gwdt_priv *priv = dev_get_priv(dev); @@ -125,7 +125,7 @@ U_BOOT_DRIVER(sbsa_gwdt) = { .id = UCLASS_WDT, .of_match = sbsa_gwdt_ids, .probe = sbsa_gwdt_probe, - .priv_auto_alloc_size = sizeof(struct sbsa_gwdt_priv), - .ofdata_to_platdata = sbsa_gwdt_ofdata_to_platdata, + .priv_auto = sizeof(struct sbsa_gwdt_priv), + .of_to_plat = sbsa_gwdt_of_to_plat, .ops = &sbsa_gwdt_ops, }; diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index 23fef21..291aad7 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c @@ -105,12 +105,12 @@ static int sp805_wdt_expire_now(struct udevice *dev, ulong flags) static int sp805_wdt_probe(struct udevice *dev) { - debug("%s: Probing wdt%u (sp805-wdt)\n", __func__, dev->seq); + debug("%s: Probing wdt%u (sp805-wdt)\n", __func__, dev_seq(dev)); return 0; } -static int sp805_wdt_ofdata_to_platdata(struct udevice *dev) +static int sp805_wdt_of_to_plat(struct udevice *dev) { struct sp805_wdt_priv *priv = dev_get_priv(dev); struct clk clk; @@ -142,7 +142,7 @@ U_BOOT_DRIVER(sp805_wdt) = { .id = UCLASS_WDT, .of_match = sp805_wdt_ids, .probe = sp805_wdt_probe, - .priv_auto_alloc_size = sizeof(struct sp805_wdt_priv), - .ofdata_to_platdata = sp805_wdt_ofdata_to_platdata, + .priv_auto = sizeof(struct sp805_wdt_priv), + .of_to_plat = sp805_wdt_of_to_plat, .ops = &sp805_wdt_ops, }; diff --git a/drivers/watchdog/stm32mp_wdt.c b/drivers/watchdog/stm32mp_wdt.c index f673fce..53586fd 100644 --- a/drivers/watchdog/stm32mp_wdt.c +++ b/drivers/watchdog/stm32mp_wdt.c @@ -131,7 +131,7 @@ U_BOOT_DRIVER(stm32mp_wdt) = { .name = "stm32mp-wdt", .id = UCLASS_WDT, .of_match = stm32mp_wdt_match, - .priv_auto_alloc_size = sizeof(struct stm32mp_wdt_priv), + .priv_auto = sizeof(struct stm32mp_wdt_priv), .probe = stm32mp_wdt_probe, .ops = &stm32mp_wdt_ops, }; diff --git a/drivers/watchdog/tangier_wdt.c b/drivers/watchdog/tangier_wdt.c index 358a9b9..bdc6559 100644 --- a/drivers/watchdog/tangier_wdt.c +++ b/drivers/watchdog/tangier_wdt.c @@ -80,7 +80,7 @@ static const struct udevice_id tangier_wdt_ids[] = { static int tangier_wdt_probe(struct udevice *dev) { - debug("%s: Probing wdt%u\n", __func__, dev->seq); + debug("%s: Probing wdt%u\n", __func__, dev_seq(dev)); return 0; } diff --git a/drivers/watchdog/xilinx_tb_wdt.c b/drivers/watchdog/xilinx_tb_wdt.c index ea4311c..1687a45 100644 --- a/drivers/watchdog/xilinx_tb_wdt.c +++ b/drivers/watchdog/xilinx_tb_wdt.c @@ -26,7 +26,7 @@ struct watchdog_regs { u32 tbr; /* 0x8 */ }; -struct xlnx_wdt_platdata { +struct xlnx_wdt_plat { bool enable_once; struct watchdog_regs *regs; }; @@ -34,16 +34,16 @@ struct xlnx_wdt_platdata { static int xlnx_wdt_reset(struct udevice *dev) { u32 reg; - struct xlnx_wdt_platdata *platdata = dev_get_platdata(dev); + struct xlnx_wdt_plat *plat = dev_get_plat(dev); debug("%s ", __func__); /* Read the current contents of TCSR0 */ - reg = readl(&platdata->regs->twcsr0); + reg = readl(&plat->regs->twcsr0); /* Clear the watchdog WDS bit */ if (reg & (XWT_CSR0_EWDT1_MASK | XWT_CSRX_EWDT2_MASK)) - writel(reg | XWT_CSR0_WDS_MASK, &platdata->regs->twcsr0); + writel(reg | XWT_CSR0_WDS_MASK, &plat->regs->twcsr0); return 0; } @@ -51,18 +51,18 @@ static int xlnx_wdt_reset(struct udevice *dev) static int xlnx_wdt_stop(struct udevice *dev) { u32 reg; - struct xlnx_wdt_platdata *platdata = dev_get_platdata(dev); + struct xlnx_wdt_plat *plat = dev_get_plat(dev); - if (platdata->enable_once) { + if (plat->enable_once) { debug("Can't stop Xilinx watchdog.\n"); return -EBUSY; } /* Read the current contents of TCSR0 */ - reg = readl(&platdata->regs->twcsr0); + reg = readl(&plat->regs->twcsr0); - writel(reg & ~XWT_CSR0_EWDT1_MASK, &platdata->regs->twcsr0); - writel(~XWT_CSRX_EWDT2_MASK, &platdata->regs->twcsr1); + writel(reg & ~XWT_CSR0_EWDT1_MASK, &plat->regs->twcsr0); + writel(~XWT_CSRX_EWDT2_MASK, &plat->regs->twcsr1); debug("Watchdog disabled!\n"); @@ -71,37 +71,37 @@ static int xlnx_wdt_stop(struct udevice *dev) static int xlnx_wdt_start(struct udevice *dev, u64 timeout, ulong flags) { - struct xlnx_wdt_platdata *platdata = dev_get_platdata(dev); + struct xlnx_wdt_plat *plat = dev_get_plat(dev); debug("%s:\n", __func__); writel((XWT_CSR0_WRS_MASK | XWT_CSR0_WDS_MASK | XWT_CSR0_EWDT1_MASK), - &platdata->regs->twcsr0); + &plat->regs->twcsr0); - writel(XWT_CSRX_EWDT2_MASK, &platdata->regs->twcsr1); + writel(XWT_CSRX_EWDT2_MASK, &plat->regs->twcsr1); return 0; } static int xlnx_wdt_probe(struct udevice *dev) { - debug("%s: Probing wdt%u\n", __func__, dev->seq); + debug("%s: Probing wdt%u\n", __func__, dev_seq(dev)); return 0; } -static int xlnx_wdt_ofdata_to_platdata(struct udevice *dev) +static int xlnx_wdt_of_to_plat(struct udevice *dev) { - struct xlnx_wdt_platdata *platdata = dev_get_platdata(dev); + struct xlnx_wdt_plat *plat = dev_get_plat(dev); - platdata->regs = (struct watchdog_regs *)dev_read_addr(dev); - if (IS_ERR(platdata->regs)) - return PTR_ERR(platdata->regs); + plat->regs = (struct watchdog_regs *)dev_read_addr(dev); + if (IS_ERR(plat->regs)) + return PTR_ERR(plat->regs); - platdata->enable_once = dev_read_u32_default(dev, - "xlnx,wdt-enable-once", 0); + plat->enable_once = dev_read_u32_default(dev, "xlnx,wdt-enable-once", + 0); - debug("%s: wdt-enable-once %d\n", __func__, platdata->enable_once); + debug("%s: wdt-enable-once %d\n", __func__, plat->enable_once); return 0; } @@ -123,7 +123,7 @@ U_BOOT_DRIVER(xlnx_wdt) = { .id = UCLASS_WDT, .of_match = xlnx_wdt_ids, .probe = xlnx_wdt_probe, - .platdata_auto_alloc_size = sizeof(struct xlnx_wdt_platdata), - .ofdata_to_platdata = xlnx_wdt_ofdata_to_platdata, + .plat_auto = sizeof(struct xlnx_wdt_plat), + .of_to_plat = xlnx_wdt_of_to_plat, .ops = &xlnx_wdt_ops, }; diff --git a/drivers/watchdog/xilinx_wwdt.c b/drivers/watchdog/xilinx_wwdt.c index d8a585a..9137d87 100644 --- a/drivers/watchdog/xilinx_wwdt.c +++ b/drivers/watchdog/xilinx_wwdt.c @@ -36,7 +36,7 @@ struct xlnx_wwdt_priv { struct clk clk; }; -struct xlnx_wwdt_platdata { +struct xlnx_wwdt_plat { bool enable_once; }; @@ -125,10 +125,10 @@ static int xlnx_wwdt_start(struct udevice *dev, u64 timeout, ulong flags) static int xlnx_wwdt_probe(struct udevice *dev) { int ret; - struct xlnx_wwdt_platdata *platdata = dev_get_platdata(dev); + struct xlnx_wwdt_plat *plat = dev_get_plat(dev); struct xlnx_wwdt_priv *wdt = dev_get_priv(dev); - dev_dbg(dev, "%s: Probing wdt%u\n", __func__, dev->seq); + dev_dbg(dev, "%s: Probing wdt%u\n", __func__, dev_seq(dev)); ret = regmap_init_mem(dev_ofnode(dev), &wdt->regs); if (ret) { @@ -136,7 +136,7 @@ static int xlnx_wwdt_probe(struct udevice *dev) return ret; } - wdt->enable_once = platdata->enable_once; + wdt->enable_once = plat->enable_once; ret = clk_get_by_index(dev, 0, &wdt->clk); if (ret < 0) @@ -145,13 +145,13 @@ static int xlnx_wwdt_probe(struct udevice *dev) return ret; } -static int xlnx_wwdt_ofdata_to_platdata(struct udevice *dev) +static int xlnx_wwdt_of_to_plat(struct udevice *dev) { - struct xlnx_wwdt_platdata *platdata = dev_get_platdata(dev); + struct xlnx_wwdt_plat *plat = dev_get_plat(dev); - platdata->enable_once = dev_read_u32_default(dev, - "xlnx,wdt-enable-once", 0); - dev_dbg(dev, "wdt-enable-once %d\n", platdata->enable_once); + plat->enable_once = dev_read_u32_default(dev, "xlnx,wdt-enable-once", + 0); + dev_dbg(dev, "wdt-enable-once %d\n", plat->enable_once); return 0; } @@ -172,8 +172,8 @@ U_BOOT_DRIVER(xlnx_wwdt) = { .id = UCLASS_WDT, .of_match = xlnx_wwdt_ids, .probe = xlnx_wwdt_probe, - .priv_auto_alloc_size = sizeof(struct xlnx_wwdt_priv), - .platdata_auto_alloc_size = sizeof(struct xlnx_wwdt_platdata), - .ofdata_to_platdata = xlnx_wwdt_ofdata_to_platdata, + .priv_auto = sizeof(struct xlnx_wwdt_priv), + .plat_auto = sizeof(struct xlnx_wwdt_plat), + .of_to_plat = xlnx_wwdt_of_to_plat, .ops = &xlnx_wwdt_ops, }; diff --git a/drivers/xen/pvblock.c b/drivers/xen/pvblock.c index 1b3325b..6455dfd 100644 --- a/drivers/xen/pvblock.c +++ b/drivers/xen/pvblock.c @@ -70,7 +70,7 @@ struct blkfront_dev { u8 *bounce_buffer; }; -struct blkfront_platdata { +struct blkfront_plat { unsigned int devid; }; @@ -600,7 +600,7 @@ static ulong pvblock_iop(struct udevice *udev, lbaint_t blknr, lbaint_t blkcnt, void *buffer, int write) { struct blkfront_dev *blk_dev = dev_get_priv(udev); - struct blk_desc *desc = dev_get_uclass_platdata(udev); + struct blk_desc *desc = dev_get_uclass_plat(udev); struct blkfront_aiocb aiocb; lbaint_t blocks_todo; bool unaligned; @@ -658,7 +658,7 @@ ulong pvblock_blk_write(struct udevice *udev, lbaint_t blknr, lbaint_t blkcnt, static int pvblock_blk_bind(struct udevice *udev) { - struct blk_desc *desc = dev_get_uclass_platdata(udev); + struct blk_desc *desc = dev_get_uclass_plat(udev); int devnum; desc->if_type = IF_TYPE_PVBLOCK; @@ -685,12 +685,12 @@ static int pvblock_blk_bind(struct udevice *udev) static int pvblock_blk_probe(struct udevice *udev) { struct blkfront_dev *blk_dev = dev_get_priv(udev); - struct blkfront_platdata *platdata = dev_get_platdata(udev); - struct blk_desc *desc = dev_get_uclass_platdata(udev); + struct blkfront_plat *plat = dev_get_plat(udev); + struct blk_desc *desc = dev_get_uclass_plat(udev); int ret, devid; - devid = platdata->devid; - free(platdata); + devid = plat->devid; + free(plat); ret = init_blkfront(devid, blk_dev); if (ret < 0) @@ -723,7 +723,7 @@ U_BOOT_DRIVER(pvblock_blk) = { .bind = pvblock_blk_bind, .probe = pvblock_blk_probe, .remove = pvblock_blk_remove, - .priv_auto_alloc_size = sizeof(struct blkfront_dev), + .priv_auto = sizeof(struct blkfront_dev), .flags = DM_FLAG_OS_PREPARE, }; @@ -737,27 +737,27 @@ static int on_new_vbd(struct udevice *parent, unsigned int devid) { struct driver_info info; struct udevice *udev; - struct blkfront_platdata *platdata; + struct blkfront_plat *plat; int ret; debug("New " DRV_NAME_BLK ", device ID %d\n", devid); - platdata = malloc(sizeof(struct blkfront_platdata)); - if (!platdata) { + plat = malloc(sizeof(struct blkfront_plat)); + if (!plat) { printf("Failed to allocate platform data\n"); return -ENOMEM; } - platdata->devid = devid; + plat->devid = devid; info.name = DRV_NAME_BLK; - info.platdata = platdata; + info.plat = plat; ret = device_bind_by_name(parent, false, &info, &udev); if (ret < 0) { printf("Failed to bind " DRV_NAME_BLK " to device with ID %d, ret: %d\n", devid, ret); - free(platdata); + free(plat); } return ret; } @@ -802,7 +802,7 @@ static void print_pvblock_devices(void) class_name = uclass_get_name(UCLASS_PVBLOCK); for (blk_first_device(IF_TYPE_PVBLOCK, &udev); udev; blk_next_device(&udev), first = false) { - struct blk_desc *desc = dev_get_uclass_platdata(udev); + struct blk_desc *desc = dev_get_uclass_plat(udev); if (!first) puts(", "); |