dm: Use access methods for dev/uclass private data
Most drivers use these access methods but a few do not. Update them.
In some cases the access is not permitted, so mark those with a FIXME tag
for the maintainer to check.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 928ad13..eb75132 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -44,8 +44,10 @@
}
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;
}
diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c
index 12d81a7..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)
@@ -32,7 +33,8 @@
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;
diff --git a/drivers/clk/rockchip/clk_px30.c b/drivers/clk/rockchip/clk_px30.c
index 355362d..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>
@@ -1458,7 +1459,7 @@
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)
diff --git a/drivers/clk/rockchip/clk_rk3036.c b/drivers/clk/rockchip/clk_rk3036.c
index 07ef613..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>
@@ -353,7 +354,7 @@
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)
diff --git a/drivers/clk/rockchip/clk_rk3128.c b/drivers/clk/rockchip/clk_rk3128.c
index 9349e14..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>
@@ -581,7 +582,7 @@
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;
diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c
index 48bfe09..1b62d8d 100644
--- a/drivers/clk/rockchip/clk_rk3188.c
+++ b/drivers/clk/rockchip/clk_rk3188.c
@@ -593,7 +593,7 @@
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)
diff --git a/drivers/clk/rockchip/clk_rk322x.c b/drivers/clk/rockchip/clk_rk322x.c
index c2f5fc0..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>
@@ -510,7 +511,7 @@
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)
diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c
index e87fdfc..6226d55 100644
--- a/drivers/clk/rockchip/clk_rk3288.c
+++ b/drivers/clk/rockchip/clk_rk3288.c
@@ -1018,7 +1018,7 @@
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)
diff --git a/drivers/clk/rockchip/clk_rk3308.c b/drivers/clk/rockchip/clk_rk3308.c
index 3058951..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>
@@ -1045,7 +1046,7 @@
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)
diff --git a/drivers/clk/rockchip/clk_rk3328.c b/drivers/clk/rockchip/clk_rk3328.c
index e2df712..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>
@@ -823,7 +824,7 @@
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)
diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c
index 9267cac..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>
@@ -621,7 +622,7 @@
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)
diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c
index 68d5dbb..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>
@@ -1425,7 +1426,7 @@
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)
diff --git a/drivers/clk/rockchip/clk_rv1108.c b/drivers/clk/rockchip/clk_rv1108.c
index 62bcf5a..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>
@@ -697,7 +698,7 @@
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)
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 289220b..8c12169 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -89,15 +89,15 @@
return log_msg_ret("child unbind", ret);
if (dev->flags & DM_FLAG_ALLOC_PDATA) {
- free(dev->plat);
- dev->plat = NULL;
+ free(dev_get_plat(dev));
+ dev_set_plat(dev, NULL);
}
if (dev->flags & DM_FLAG_ALLOC_UCLASS_PDATA) {
- free(dev->uclass_plat);
+ free(dev_get_uclass_plat(dev));
dev->uclass_plat = NULL;
}
if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) {
- free(dev->parent_plat);
+ free(dev_get_parent_plat(dev));
dev->parent_plat = NULL;
}
ret = uclass_unbind_device(dev);
@@ -125,12 +125,12 @@
int size;
if (dev->driver->priv_auto) {
- free(dev->priv);
- dev->priv = NULL;
+ free(dev_get_priv(dev));
+ dev_set_priv(dev, NULL);
}
size = dev->uclass->uc_drv->per_device_auto;
if (size) {
- free(dev->uclass_priv);
+ free(dev_get_uclass_priv(dev));
dev->uclass_priv = NULL;
}
if (dev->parent) {
@@ -140,7 +140,7 @@
per_child_auto;
}
if (size) {
- free(dev->parent_priv);
+ free(dev_get_parent_priv(dev));
dev->parent_priv = NULL;
}
}
diff --git a/drivers/ddr/altera/sdram_agilex.c b/drivers/ddr/altera/sdram_agilex.c
index 868bf14..a4ceb36 100644
--- a/drivers/ddr/altera/sdram_agilex.c
+++ b/drivers/ddr/altera/sdram_agilex.c
@@ -25,7 +25,7 @@
int sdram_mmr_init_full(struct udevice *dev)
{
- struct altera_sdram_plat *plat = dev->plat;
+ 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 3ffe057..8d3ce49 100644
--- a/drivers/ddr/altera/sdram_gen5.c
+++ b/drivers/ddr/altera/sdram_gen5.c
@@ -565,7 +565,7 @@
static int altera_gen5_sdram_of_to_plat(struct udevice *dev)
{
- struct altera_gen5_sdram_plat *plat = dev->plat;
+ 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 @@
{
int ret;
unsigned long sdram_size;
- struct altera_gen5_sdram_plat *plat = dev->plat;
+ 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;
diff --git a/drivers/ddr/altera/sdram_s10.c b/drivers/ddr/altera/sdram_s10.c
index 984dc32..03a270f 100644
--- a/drivers/ddr/altera/sdram_s10.c
+++ b/drivers/ddr/altera/sdram_s10.c
@@ -70,7 +70,7 @@
*/
int sdram_mmr_init_full(struct udevice *dev)
{
- struct altera_sdram_plat *plat = dev->plat;
+ 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 7e77c7b..5aba655 100644
--- a/drivers/ddr/altera/sdram_soc64.c
+++ b/drivers/ddr/altera/sdram_soc64.c
@@ -232,7 +232,7 @@
static int altera_sdram_of_to_plat(struct udevice *dev)
{
- struct altera_sdram_plat *plat = dev->plat;
+ struct altera_sdram_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
addr = dev_read_addr_index(dev, 0);
diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
index acd77b6..e6e9194 100644
--- a/drivers/gpio/dwapb_gpio.c
+++ b/drivers/gpio/dwapb_gpio.c
@@ -141,7 +141,7 @@
static int gpio_dwapb_probe(struct udevice *dev)
{
struct gpio_dev_priv *priv = dev_get_uclass_priv(dev);
- struct gpio_dwapb_plat *plat = dev->plat;
+ struct gpio_dwapb_plat *plat = dev_get_plat(dev);
if (!plat) {
/* Reset on parent device only */
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 65b18ce..952c111 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -1165,7 +1165,7 @@
if (!dev)
return -1;
- uc_priv = dev->uclass_priv;
+ uc_priv = dev_get_uclass_priv(dev);
return uc_priv->gpio_base + desc->offset;
}
diff --git a/drivers/gpio/hi6220_gpio.c b/drivers/gpio/hi6220_gpio.c
index f5e5fc6..04f8d90 100644
--- a/drivers/gpio/hi6220_gpio.c
+++ b/drivers/gpio/hi6220_gpio.c
@@ -67,7 +67,7 @@
{
struct gpio_bank *bank = dev_get_priv(dev);
struct hikey_gpio_plat *plat = dev_get_plat(dev);
- struct gpio_dev_priv *uc_priv = dev->uclass_priv;
+ struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
char name[18], *str;
sprintf(name, "GPIO%d_", plat->bank_index);
diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c
index 17edd40..a5a290a 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 {
@@ -151,7 +152,7 @@
static int imx_rgpio2p_bind(struct udevice *dev)
{
- struct imx_rgpio2p_plat *plat = dev->plat;
+ struct imx_rgpio2p_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
/*
@@ -184,7 +185,7 @@
plat->regs = (struct gpio_regs *)addr;
plat->bank_index = dev_seq(dev);
- dev->plat = plat;
+ dev_set_plat(dev, plat);
return 0;
}
diff --git a/drivers/gpio/lpc32xx_gpio.c b/drivers/gpio/lpc32xx_gpio.c
index ffaec32..de66c76 100644
--- a/drivers/gpio/lpc32xx_gpio.c
+++ b/drivers/gpio/lpc32xx_gpio.c
@@ -295,7 +295,7 @@
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 */
diff --git a/drivers/gpio/mt7621_gpio.c b/drivers/gpio/mt7621_gpio.c
index 65b4cbf..43bb4df 100644
--- a/drivers/gpio/mt7621_gpio.c
+++ b/drivers/gpio/mt7621_gpio.c
@@ -130,7 +130,7 @@
*/
static int gpio_mediatek_bind(struct udevice *parent)
{
- struct mediatek_gpio_plat *plat = parent->plat;
+ struct mediatek_gpio_plat *plat = dev_get_plat(parent);
ofnode node;
int bank = 0;
int ret;
diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c
index 5ad65e4..fd5e0ea 100644
--- a/drivers/gpio/mxs_gpio.c
+++ b/drivers/gpio/mxs_gpio.c
@@ -264,7 +264,7 @@
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
static int mxs_of_to_plat(struct udevice *dev)
{
- struct mxs_gpio_plat *plat = dev->plat;
+ struct mxs_gpio_plat *plat = dev_get_plat(dev);
struct fdtdec_phandle_args args;
int node = dev_of_offset(dev);
int ret;
diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index 400c6ca..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>
@@ -328,7 +329,7 @@
plat->base = base_addr;
plat->port_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL);
- dev->plat = plat;
+ dev_set_plat(dev, plat);
return 0;
}
diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 9de9541..796fe3e 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -286,8 +286,8 @@
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_plat *plat = dev->plat;
+ 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_bind(struct udevice *parent)
{
- struct exynos_gpio_plat *plat = parent->plat;
+ struct exynos_gpio_plat *plat = dev_get_plat(parent);
struct s5p_gpio_bank *bank, *base;
const void *blob = gd->fdt_blob;
int node;
diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
index 2708838..489271b 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>
@@ -297,14 +298,15 @@
/* 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;
}
diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
index 75494c7..7633422 100644
--- a/drivers/gpio/sunxi_gpio.c
+++ b/drivers/gpio/sunxi_gpio.c
@@ -285,7 +285,7 @@
{
struct sunxi_gpio_soc_data *soc_data =
(struct sunxi_gpio_soc_data *)dev_get_driver_data(parent);
- struct sunxi_gpio_plat *plat = parent->plat;
+ struct sunxi_gpio_plat *plat = dev_get_plat(parent);
struct sunxi_gpio_reg *ctlr;
int bank, ret;
diff --git a/drivers/gpio/tegra186_gpio.c b/drivers/gpio/tegra186_gpio.c
index cd1fb65..82dcaf9 100644
--- a/drivers/gpio/tegra186_gpio.c
+++ b/drivers/gpio/tegra186_gpio.c
@@ -34,7 +34,7 @@
static uint32_t *tegra186_gpio_reg(struct udevice *dev, uint32_t reg,
uint32_t gpio)
{
- struct tegra186_gpio_plat *plat = dev->plat;
+ 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 int tegra186_gpio_bind(struct udevice *parent)
{
- struct tegra186_gpio_plat *parent_plat = parent->plat;
+ 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;
@@ -201,7 +201,7 @@
static int tegra186_gpio_probe(struct udevice *dev)
{
- struct tegra186_gpio_plat *plat = dev->plat;
+ 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 c489796..5d3af8a 100644
--- a/drivers/gpio/tegra_gpio.c
+++ b/drivers/gpio/tegra_gpio.c
@@ -291,8 +291,8 @@
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_plat *plat = dev->plat;
+ 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_bind(struct udevice *parent)
{
- struct tegra_gpio_plat *plat = parent->plat;
+ struct tegra_gpio_plat *plat = dev_get_plat(parent);
struct gpio_ctlr *ctlr;
int bank_count;
int bank;
diff --git a/drivers/misc/altera_sysid.c b/drivers/misc/altera_sysid.c
index 057b431..878df12 100644
--- a/drivers/misc/altera_sysid.c
+++ b/drivers/misc/altera_sysid.c
@@ -59,7 +59,7 @@
static int altera_sysid_read(struct udevice *dev,
int offset, void *buf, int size)
{
- struct altera_sysid_plat *plat = dev->plat;
+ struct altera_sysid_plat *plat = dev_get_plat(dev);
struct altera_sysid_regs *const regs = plat->regs;
u32 *sysid = buf;
diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c
index cb7229a..64186b9 100644
--- a/drivers/misc/cros_ec_sandbox.c
+++ b/drivers/misc/cros_ec_sandbox.c
@@ -522,8 +522,8 @@
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;
diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
index 5ed8ab6..f460b1a 100644
--- a/drivers/misc/fs_loader.c
+++ b/drivers/misc/fs_loader.c
@@ -161,7 +161,7 @@
else
ret = -ENODEV;
} else {
- ret = select_fs_dev(dev->plat);
+ ret = select_fs_dev(dev_get_plat(dev));
}
if (ret)
@@ -228,7 +228,7 @@
if (ofnode_valid(fs_loader_node)) {
struct device_plat *plat;
- plat = dev->plat;
+ plat = dev_get_plat(dev);
if (!ofnode_read_u32_array(fs_loader_node,
"phandlepart",
phandlepart, 2)) {
@@ -250,7 +250,7 @@
{
#if CONFIG_IS_ENABLED(DM) && CONFIG_IS_ENABLED(BLK)
int ret;
- struct device_plat *plat = dev->plat;
+ struct device_plat *plat = dev_get_plat(dev);
if (plat->phandlepart.phandle) {
ofnode node = ofnode_get_by_phandle(plat->phandlepart.phandle);
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 @@
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/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index fe406fe..b2d1b4f 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -421,7 +421,7 @@
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;
@@ -508,7 +508,7 @@
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))
@@ -525,7 +525,7 @@
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);
diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
index 143818d..b3fb559 100644
--- a/drivers/mmc/mxsmmc.c
+++ b/drivers/mmc/mxsmmc.c
@@ -668,7 +668,7 @@
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
static int mxsmmc_of_to_plat(struct udevice *bus)
{
- struct mxsmmc_plat *plat = bus->plat;
+ struct mxsmmc_plat *plat = dev_get_plat(bus);
u32 prop[2];
int ret;
diff --git a/drivers/mmc/octeontx_hsmmc.c b/drivers/mmc/octeontx_hsmmc.c
index 5552342..57d107a 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>
@@ -3841,7 +3842,7 @@
}
slot = &host->slots[bus_id];
- dev->priv = slot;
+ dev_set_priv(dev, slot);
slot->host = host;
slot->bus_id = bus_id;
slot->dev = dev;
@@ -3852,16 +3853,21 @@
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;
@@ -3878,6 +3884,7 @@
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,
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 @@
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/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c
index 65615f1..07aebd9 100644
--- a/drivers/net/eth-phy-uclass.c
+++ b/drivers/net/eth-phy-uclass.c
@@ -54,7 +54,7 @@
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 @@
* 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
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index 02ccf1e..a10f87e 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -547,7 +547,11 @@
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 @@
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 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 @@
#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);
@@ -1004,7 +1018,7 @@
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;
diff --git a/drivers/net/fsl_mcdmafec.c b/drivers/net/fsl_mcdmafec.c
index 0196462..c36d40c 100644
--- a/drivers/net/fsl_mcdmafec.c
+++ b/drivers/net/fsl_mcdmafec.c
@@ -79,7 +79,7 @@
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 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_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_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];
@@ -496,7 +496,7 @@
*/
static int mcdmafec_probe(struct udevice *dev)
{
- struct fec_info_dma *info = dev->priv;
+ 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;
diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index 4fa7136..cb343b4 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -125,7 +125,7 @@
#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 @@
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 @@
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_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 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);
@@ -519,7 +519,7 @@
static int mcffec_probe(struct udevice *dev)
{
struct eth_pdata *pdata = dev_get_plat(dev);
- struct fec_info_s *info = dev->priv;
+ struct fec_info_s *info = dev_get_priv(dev);
int node = dev_of_offset(dev);
int retval, fec_idx;
const u32 *val;
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 @@
/* 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 @@
/* 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/pfe_eth/pfe_eth.c b/drivers/net/pfe_eth/pfe_eth.c
index 3d14571..0c27a66 100644
--- a/drivers/net/pfe_eth/pfe_eth.c
+++ b/drivers/net/pfe_eth/pfe_eth.c
@@ -157,7 +157,7 @@
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;
diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c
index 7c6ae3c..17ad88e 100644
--- a/drivers/net/sunxi_emac.c
+++ b/drivers/net/sunxi_emac.c
@@ -537,7 +537,7 @@
{
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)
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 2271eb8..2d12473 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -131,11 +131,17 @@
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 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 @@
#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_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 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 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_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);
@@ -865,7 +889,7 @@
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);
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 5c76887..6b44753 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -457,7 +457,7 @@
{
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;
diff --git a/drivers/pci/pci-emul-uclass.c b/drivers/pci/pci-emul-uclass.c
index 756d8ad..a0b8afb 100644
--- a/drivers/pci/pci-emul-uclass.c
+++ b/drivers/pci/pci-emul-uclass.c
@@ -82,7 +82,7 @@
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_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);
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 914217d..37a2338 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -524,7 +524,7 @@
int pci_auto_config_devices(struct udevice *bus)
{
- struct pci_controller *hose = bus->uclass_priv;
+ struct pci_controller *hose = dev_get_uclass_priv(bus);
struct pci_child_plat *pplat;
unsigned int sub_bus;
struct udevice *dev;
@@ -1007,7 +1007,7 @@
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
@@ -1109,7 +1109,7 @@
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);
}
@@ -1118,7 +1118,7 @@
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);
}
diff --git a/drivers/pinctrl/pinctrl-qe-io.c b/drivers/pinctrl/pinctrl-qe-io.c
index 690e5c7..e129ab2 100644
--- a/drivers/pinctrl/pinctrl-qe-io.c
+++ b/drivers/pinctrl/pinctrl-qe-io.c
@@ -122,7 +122,7 @@
#else
static int qe_io_of_to_plat(struct udevice *dev)
{
- struct qe_io_plat *plat = dev->plat;
+ struct qe_io_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
addr = dev_read_addr(dev);
@@ -143,7 +143,7 @@
*/
static int par_io_of_config_node(struct udevice *dev, ofnode pio)
{
- struct qe_io_plat *plat = dev->plat;
+ struct qe_io_plat *plat = dev_get_plat(dev);
qepio83xx_t *par_io = plat->base;
const unsigned int *pio_map;
int pio_map_len;
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 25d646a..20c3c82 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -47,7 +47,7 @@
const struct single_fdt_pin_cfg *pins,
int size)
{
- struct single_pdata *pdata = dev->plat;
+ 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 @@
const struct single_fdt_bits_cfg *pins,
int size)
{
- struct single_pdata *pdata = dev->plat;
+ 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;
@@ -153,7 +153,7 @@
fdt_addr_t addr;
u32 of_reg[2];
int res;
- struct single_pdata *pdata = dev->plat;
+ struct single_pdata *pdata = dev_get_plat(dev);
pdata->width =
dev_read_u32_default(dev, "pinctrl-single,register-width", 0);
diff --git a/drivers/power/regulator/da9063.c b/drivers/power/regulator/da9063.c
index 32be59e..8df1abc 100644
--- a/drivers/power/regulator/da9063.c
+++ b/drivers/power/regulator/da9063.c
@@ -135,7 +135,7 @@
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_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_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_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 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_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 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_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_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_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;
@@ -310,7 +310,7 @@
static int da9063_ldo_probe(struct udevice *dev)
{
struct dm_regulator_uclass_plat *uc_pdata;
- struct da9063_priv *priv = dev->priv;
+ struct da9063_priv *priv = dev_get_priv(dev);
/* LDOs are named numerically in DT so can directly index */
if (dev->driver_data < 1 ||
@@ -329,7 +329,7 @@
static int da9063_buck_probe(struct udevice *dev)
{
struct dm_regulator_uclass_plat *uc_pdata;
- struct da9063_priv *priv = dev->priv;
+ struct da9063_priv *priv = dev_get_priv(dev);
int i;
/* Bucks have names rather than numbers so need to match with DT */
diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c
index c3df156..6f0d0a5 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>
@@ -208,7 +209,7 @@
}
uc_pdata->type = REGULATOR_TYPE_OTHER;
- dev->priv = (void *)*p;
+ dev_set_priv(dev, (void *)*p);
return 0;
}
diff --git a/drivers/remoteproc/rproc-uclass.c b/drivers/remoteproc/rproc-uclass.c
index ccc910e..773b811 100644
--- a/drivers/remoteproc/rproc-uclass.c
+++ b/drivers/remoteproc/rproc-uclass.c
@@ -115,7 +115,7 @@
/* See if we need to populate via fdt */
- if (!dev->plat) {
+ 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 @@
#endif
} else {
- struct dm_rproc_uclass_pdata *pdata = dev->plat;
+ struct dm_rproc_uclass_pdata *pdata = dev_get_plat(dev);
debug("'%s': using legacy data\n", dev->name);
if (pdata->name)
diff --git a/drivers/reset/reset-mediatek.c b/drivers/reset/reset-mediatek.c
index b97a21f..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 @@
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;
}
diff --git a/drivers/reset/reset-rockchip.c b/drivers/reset/reset-rockchip.c
index e5e9918..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 @@
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;
}
diff --git a/drivers/reset/reset-sifive.c b/drivers/reset/reset-sifive.c
index f6110d8..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 @@
}
priv = malloc(sizeof(struct sifive_reset_priv));
priv->nr_reset = count;
- rst_dev->priv = priv;
+ dev_set_priv(rst_dev, priv);
return 0;
}
diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c
index 1db321c..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 @@
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;
}
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index 0d3ccd8..4435fcf 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -37,7 +37,7 @@
static int altera_jtaguart_putc(struct udevice *dev, const char ch)
{
- struct altera_jtaguart_plat *plat = dev->plat;
+ 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_pending(struct udevice *dev, bool input)
{
- struct altera_jtaguart_plat *plat = dev->plat;
+ 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_getc(struct udevice *dev)
{
- struct altera_jtaguart_plat *plat = dev->plat;
+ 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_probe(struct udevice *dev)
{
#ifdef CONFIG_ALTERA_JTAG_UART_BYPASS
- struct altera_jtaguart_plat *plat = dev->plat;
+ 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 */
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index a3efa1e..b18be6e 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -32,7 +32,7 @@
static int altera_uart_setbrg(struct udevice *dev, int baudrate)
{
- struct altera_uart_plat *plat = dev->plat;
+ 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_putc(struct udevice *dev, const char ch)
{
- struct altera_uart_plat *plat = dev->plat;
+ 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_pending(struct udevice *dev, bool input)
{
- struct altera_uart_plat *plat = dev->plat;
+ 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_getc(struct udevice *dev)
{
- struct altera_uart_plat *plat = dev->plat;
+ struct altera_uart_plat *plat = dev_get_plat(dev);
struct altera_uart_regs *const regs = plat->regs;
if (!(readl(®s->status) & ALTERA_UART_RRDY))
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index 7eabf76..7edec23 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -262,7 +262,7 @@
static int atmel_serial_probe(struct udevice *dev)
{
- struct atmel_serial_plat *plat = dev->plat;
+ 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)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 17808fb..508c134 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -498,7 +498,7 @@
int ns16550_serial_probe(struct udevice *dev)
{
- struct ns16550_plat *plat = dev->plat;
+ 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;
@@ -535,7 +535,7 @@
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
int ns16550_serial_of_to_plat(struct udevice *dev)
{
- struct ns16550_plat *plat = dev->plat;
+ struct ns16550_plat *plat = dev_get_plat(dev);
const u32 port_type = dev_get_driver_data(dev);
fdt_addr_t addr;
struct clk clk;
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index c7d5390..a05c564 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -72,7 +72,7 @@
static int sandbox_serial_remove(struct udevice *dev)
{
- struct sandbox_serial_plat *plat = dev->plat;
+ struct sandbox_serial_plat *plat = dev_get_plat(dev);
if (plat->colour != -1)
output_ansi_reset();
@@ -83,7 +83,7 @@
static int sandbox_serial_putc(struct udevice *dev, const char ch)
{
struct sandbox_serial_priv *priv = dev_get_priv(dev);
- struct sandbox_serial_plat *plat = dev->plat;
+ 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 &&
@@ -203,7 +203,7 @@
static int sandbox_serial_of_to_plat(struct udevice *dev)
{
- struct sandbox_serial_plat *plat = dev->plat;
+ struct sandbox_serial_plat *plat = dev_get_plat(dev);
const char *colour;
int i;
diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c
index 022e377..445eacc 100644
--- a/drivers/serial/serial_arc.c
+++ b/drivers/serial/serial_arc.c
@@ -37,7 +37,7 @@
static int arc_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct arc_serial_plat *plat = dev->plat;
+ 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_putc(struct udevice *dev, const char c)
{
- struct arc_serial_plat *plat = dev->plat;
+ 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_pending(struct udevice *dev, bool input)
{
- struct arc_serial_plat *plat = dev->plat;
+ 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_getc(struct udevice *dev)
{
- struct arc_serial_plat *plat = dev->plat;
+ struct arc_serial_plat *plat = dev_get_plat(dev);
struct arc_serial_regs *const regs = plat->reg;
while (!arc_serial_tstc(regs))
diff --git a/drivers/serial/serial_linflexuart.c b/drivers/serial/serial_linflexuart.c
index ced0057..c3714e1 100644
--- a/drivers/serial/serial_linflexuart.c
+++ b/drivers/serial/serial_linflexuart.c
@@ -168,7 +168,7 @@
static int linflex_serial_probe(struct udevice *dev)
{
- struct linflex_serial_plat *plat = dev->plat;
+ 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;
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 5beb5f2..a35e5be 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -138,7 +138,7 @@
static bool is_lpuart32(struct udevice *dev)
{
- struct lpuart_serial_plat *plat = dev->plat;
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
return plat->flags & LPUART_FLAG_REGMAP_32BIT_REG;
}
@@ -445,7 +445,7 @@
static int lpuart_serial_getc(struct udevice *dev)
{
- struct lpuart_serial_plat *plat = dev->plat;
+ 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_putc(struct udevice *dev, const char c)
{
- struct lpuart_serial_plat *plat = dev->plat;
+ 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_pending(struct udevice *dev, bool input)
{
- struct lpuart_serial_plat *plat = dev->plat;
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
struct lpuart_fsl *reg = plat->reg;
struct lpuart_fsl_reg32 *reg32 = plat->reg;
u32 stat;
@@ -513,7 +513,7 @@
static int lpuart_serial_of_to_plat(struct udevice *dev)
{
- struct lpuart_serial_plat *plat = dev->plat;
+ 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;
diff --git a/drivers/serial/serial_mcf.c b/drivers/serial/serial_mcf.c
index 4ba6dc3..e6e21b2 100644
--- a/drivers/serial/serial_mcf.c
+++ b/drivers/serial/serial_mcf.c
@@ -83,7 +83,7 @@
static int coldfire_serial_probe(struct udevice *dev)
{
- struct coldfire_serial_plat *plat = dev->plat;
+ struct coldfire_serial_plat *plat = dev_get_plat(dev);
plat->port = dev_seq(dev);
@@ -93,7 +93,7 @@
static int coldfire_serial_putc(struct udevice *dev, const char ch)
{
- struct coldfire_serial_plat *plat = dev->plat;
+ 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_getc(struct udevice *dev)
{
- struct coldfire_serial_plat *plat = dev->plat;
+ 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 @@
int coldfire_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct coldfire_serial_plat *plat = dev->plat;
+ 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 @@
static int coldfire_serial_pending(struct udevice *dev, bool input)
{
- struct coldfire_serial_plat *plat = dev->plat;
+ struct coldfire_serial_plat *plat = dev_get_plat(dev);
uart_t *uart = (uart_t *)(plat->base);
if (input)
diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c
index 40d9bfe..d69ec22 100644
--- a/drivers/serial/serial_meson.c
+++ b/drivers/serial/serial_meson.c
@@ -57,7 +57,7 @@
static int meson_serial_probe(struct udevice *dev)
{
- struct meson_serial_plat *plat = dev->plat;
+ 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 void meson_serial_rx_error(struct udevice *dev)
{
- struct meson_serial_plat *plat = dev->plat;
+ 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 int meson_serial_getc(struct udevice *dev)
{
- struct meson_serial_plat *plat = dev->plat;
+ 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_putc(struct udevice *dev, const char ch)
{
- struct meson_serial_plat *plat = dev->plat;
+ 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_pending(struct udevice *dev, bool input)
{
- struct meson_serial_plat *plat = dev->plat;
+ struct meson_serial_plat *plat = dev_get_plat(dev);
struct meson_uart *const uart = plat->reg;
uint32_t status = readl(&uart->status);
@@ -138,7 +138,7 @@
static int meson_serial_of_to_plat(struct udevice *dev)
{
- struct meson_serial_plat *plat = dev->plat;
+ struct meson_serial_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
addr = dev_read_addr(dev);
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 2603fa8..e5795da 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -264,7 +264,7 @@
int mxc_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct mxc_serial_plat *plat = dev->plat;
+ 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 @@
static int mxc_serial_probe(struct udevice *dev)
{
- struct mxc_serial_plat *plat = dev->plat;
+ 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_getc(struct udevice *dev)
{
- struct mxc_serial_plat *plat = dev->plat;
+ 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_putc(struct udevice *dev, const char ch)
{
- struct mxc_serial_plat *plat = dev->plat;
+ 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_pending(struct udevice *dev, bool input)
{
- struct mxc_serial_plat *plat = dev->plat;
+ struct mxc_serial_plat *plat = dev_get_plat(dev);
struct mxc_uart *const uart = plat->reg;
uint32_t sr2 = readl(&uart->sr2);
@@ -327,7 +327,7 @@
#if CONFIG_IS_ENABLED(OF_CONTROL)
static int mxc_serial_of_to_plat(struct udevice *dev)
{
- struct mxc_serial_plat *plat = dev->plat;
+ struct mxc_serial_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
addr = dev_read_addr(dev);
diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c
index c235215..2b23ece 100644
--- a/drivers/serial/serial_omap.c
+++ b/drivers/serial/serial_omap.c
@@ -101,7 +101,7 @@
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
static int omap_serial_of_to_plat(struct udevice *dev)
{
- struct ns16550_plat *plat = dev->plat;
+ struct ns16550_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
struct clk clk;
int err;
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index d82f3b9..669841e 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -268,7 +268,7 @@
#ifdef CONFIG_DM_SERIAL
static int pxa_serial_probe(struct udevice *dev)
{
- struct pxa_serial_plat *plat = dev->plat;
+ 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_putc(struct udevice *dev, const char ch)
{
- struct pxa_serial_plat *plat = dev->plat;
+ 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_getc(struct udevice *dev)
{
- struct pxa_serial_plat *plat = dev->plat;
+ 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 @@
int pxa_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct pxa_serial_plat *plat = dev->plat;
+ 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 @@
static int pxa_serial_pending(struct udevice *dev, bool input)
{
- struct pxa_serial_plat *plat = dev->plat;
+ 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 036c072..97d4086 100644
--- a/drivers/serial/serial_rockchip.c
+++ b/drivers/serial/serial_rockchip.c
@@ -10,6 +10,7 @@
#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_plat {
@@ -34,7 +35,7 @@
plat->plat.reg_shift = plat->dtplat.reg_shift;
plat->plat.clock = plat->dtplat.clock_frequency;
plat->plat.fcr = UART_FCR_DEFVAL;
- dev->plat = &plat->plat;
+ dev_set_plat(dev, &plat->plat);
return ns16550_serial_probe(dev);
}
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 120df83..0eac0d5 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -88,7 +88,7 @@
#ifndef CONFIG_SPL_BUILD
int s5p_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct s5p_serial_plat *plat = dev->plat;
+ struct s5p_serial_plat *plat = dev_get_plat(dev);
struct s5p_uart *const uart = plat->reg;
u32 uclk;
@@ -111,7 +111,7 @@
static int s5p_serial_probe(struct udevice *dev)
{
- struct s5p_serial_plat *plat = dev->plat;
+ 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 s5p_serial_getc(struct udevice *dev)
{
- struct s5p_serial_plat *plat = dev->plat;
+ 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_putc(struct udevice *dev, const char ch)
{
- struct s5p_serial_plat *plat = dev->plat;
+ 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_pending(struct udevice *dev, bool input)
{
- struct s5p_serial_plat *plat = dev->plat;
+ struct s5p_serial_plat *plat = dev_get_plat(dev);
struct s5p_uart *const uart = plat->reg;
uint32_t ufstat = readl(&uart->ufstat);
@@ -178,7 +178,7 @@
static int s5p_serial_of_to_plat(struct udevice *dev)
{
- struct s5p_serial_plat *plat = dev->plat;
+ struct s5p_serial_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
addr = dev_read_addr(dev);
diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index b746501..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_plat *plat = bus->plat;
+ 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 cadence_spi_set_speed(struct udevice *bus, uint hz)
{
- struct cadence_spi_plat *plat = bus->plat;
+ 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_probe(struct udevice *bus)
{
- struct cadence_spi_plat *plat = bus->plat;
+ 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_set_mode(struct udevice *bus, uint mode)
{
- struct cadence_spi_plat *plat = bus->plat;
+ struct cadence_spi_plat *plat = dev_get_plat(bus);
struct cadence_spi_priv *priv = dev_get_priv(bus);
/* Disable QSPI */
@@ -235,7 +235,7 @@
const struct spi_mem_op *op)
{
struct udevice *bus = spi->dev->parent;
- struct cadence_spi_plat *plat = bus->plat;
+ 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;
@@ -284,7 +284,7 @@
static int cadence_spi_of_to_plat(struct udevice *bus)
{
- struct cadence_spi_plat *plat = bus->plat;
+ struct cadence_spi_plat *plat = dev_get_plat(bus);
ofnode subnode;
plat->regbase = (void *)devfdt_get_addr_index(bus, 0);
diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
index 8adff63..298f350 100644
--- a/drivers/spi/cf_spi.c
+++ b/drivers/spi/cf_spi.c
@@ -387,7 +387,7 @@
static int coldfire_dspi_of_to_plat(struct udevice *bus)
{
fdt_addr_t addr;
- struct coldfire_spi_plat *plat = bus->plat;
+ struct coldfire_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
int *ctar, len;
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index ea088eb..53a791e 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -383,7 +383,7 @@
static int davinci_spi_probe(struct udevice *bus)
{
struct davinci_spi_slave *ds = dev_get_priv(bus);
- struct davinci_spi_plat *plat = bus->plat;
+ struct davinci_spi_plat *plat = dev_get_plat(bus);
ds->regs = plat->regs;
ds->num_cs = plat->num_cs;
@@ -393,7 +393,7 @@
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
static int davinci_ofdata_to_platadata(struct udevice *bus)
{
- struct davinci_spi_plat *plat = bus->plat;
+ struct davinci_spi_plat *plat = dev_get_plat(bus);
fdt_addr_t addr;
addr = dev_read_addr(bus);
diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 4fa4585..5ede00d 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -155,7 +155,7 @@
static int dw_spi_of_to_plat(struct udevice *bus)
{
- struct dw_spi_plat *plat = bus->plat;
+ struct dw_spi_plat *plat = dev_get_plat(bus);
plat->regs = dev_read_addr_ptr(bus);
@@ -478,7 +478,7 @@
static int dw_spi_set_speed(struct udevice *bus, uint speed)
{
- struct dw_spi_plat *plat = bus->plat;
+ struct dw_spi_plat *plat = dev_get_plat(bus);
struct dw_spi_priv *priv = dev_get_priv(bus);
u16 clk_div;
diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
index e4d2bad..30b1a77 100644
--- a/drivers/spi/exynos_spi.c
+++ b/drivers/spi/exynos_spi.c
@@ -253,7 +253,7 @@
static int exynos_spi_of_to_plat(struct udevice *bus)
{
- struct exynos_spi_plat *plat = bus->plat;
+ struct exynos_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -368,7 +368,7 @@
static int exynos_spi_set_speed(struct udevice *bus, uint speed)
{
- struct exynos_spi_plat *plat = bus->plat;
+ struct exynos_spi_plat *plat = dev_get_plat(bus);
struct exynos_spi_priv *priv = dev_get_priv(bus);
int ret;
diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c
index ddf4a9e..b8c0216 100644
--- a/drivers/spi/fsl_dspi.c
+++ b/drivers/spi/fsl_dspi.c
@@ -486,7 +486,7 @@
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();
@@ -576,7 +576,7 @@
static int fsl_dspi_of_to_plat(struct udevice *bus)
{
fdt_addr_t addr;
- struct fsl_dspi_plat *plat = bus->plat;
+ struct fsl_dspi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
index e9e7ffd..abc28e3 100644
--- a/drivers/spi/fsl_espi.c
+++ b/drivers/spi/fsl_espi.c
@@ -544,7 +544,7 @@
static int fsl_espi_of_to_plat(struct udevice *bus)
{
fdt_addr_t addr;
- struct fsl_espi_plat *plat = bus->plat;
+ struct fsl_espi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index fc3b844..8bc7038 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -795,7 +795,7 @@
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);
diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index 4fafe33..7f632d9 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -443,7 +443,7 @@
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
static int mxs_of_to_plat(struct udevice *bus)
{
- struct mxs_spi_plat *plat = bus->plat;
+ struct mxs_spi_plat *plat = dev_get_plat(bus);
u32 prop[2];
int ret;
diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
index 179582c..133363e 100644
--- a/drivers/spi/pl022_spi.c
+++ b/drivers/spi/pl022_spi.c
@@ -288,7 +288,7 @@
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
static int pl022_spi_of_to_plat(struct udevice *bus)
{
- struct pl022_spi_pdata *plat = bus->plat;
+ struct pl022_spi_pdata *plat = dev_get_plat(bus);
const void *fdt = gd->fdt_blob;
int node = dev_of_offset(bus);
struct clk clkdev;
diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index 44ac475..51abebb 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -135,7 +135,7 @@
static void spi_cs_activate(struct udevice *dev, uint cs)
{
struct udevice *bus = dev->parent;
- struct rockchip_spi_plat *plat = bus->plat;
+ 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_deactivate(struct udevice *dev, uint cs)
{
struct udevice *bus = dev->parent;
- struct rockchip_spi_plat *plat = bus->plat;
+ struct rockchip_spi_plat *plat = dev_get_plat(bus);
struct rockchip_spi_priv *priv = dev_get_priv(bus);
struct rockchip_spi *regs = priv->regs;
@@ -176,7 +176,7 @@
#if CONFIG_IS_ENABLED(OF_PLATDATA)
static int conv_of_plat(struct udevice *dev)
{
- struct rockchip_spi_plat *plat = dev->plat;
+ 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;
diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c
index afc98bf..3425d99 100644
--- a/drivers/spi/soft_spi.c
+++ b/drivers/spi/soft_spi.c
@@ -228,7 +228,7 @@
static int soft_spi_of_to_plat(struct udevice *dev)
{
- struct soft_spi_plat *plat = dev->plat;
+ 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_probe(struct udevice *dev)
{
struct spi_slave *slave = dev_get_parent_priv(dev);
- struct soft_spi_plat *plat = dev->plat;
+ struct soft_spi_plat *plat = dev_get_plat(dev);
int cs_flags, clk_flags;
int ret;
diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c
index e1fd82b..f0256d8 100644
--- a/drivers/spi/tegra114_spi.c
+++ b/drivers/spi/tegra114_spi.c
@@ -99,7 +99,7 @@
static int tegra114_spi_of_to_plat(struct udevice *bus)
{
- struct tegra_spi_plat *plat = bus->plat;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
plat->base = dev_read_addr(bus);
plat->periph_id = clock_decode_periph_id(bus);
@@ -352,7 +352,7 @@
static int tegra114_spi_set_speed(struct udevice *bus, uint speed)
{
- struct tegra_spi_plat *plat = bus->plat;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra114_spi_priv *priv = dev_get_priv(bus);
if (speed > plat->frequency)
diff --git a/drivers/spi/tegra20_sflash.c b/drivers/spi/tegra20_sflash.c
index d386061..4384a48 100644
--- a/drivers/spi/tegra20_sflash.c
+++ b/drivers/spi/tegra20_sflash.c
@@ -89,7 +89,7 @@
static int tegra20_sflash_of_to_plat(struct udevice *bus)
{
- struct tegra_spi_plat *plat = bus->plat;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -314,7 +314,7 @@
static int tegra20_sflash_set_speed(struct udevice *bus, uint speed)
{
- struct tegra_spi_plat *plat = bus->plat;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra20_sflash_priv *priv = dev_get_priv(bus);
if (speed > plat->frequency)
diff --git a/drivers/spi/tegra20_slink.c b/drivers/spi/tegra20_slink.c
index b99ef38..3057fe1 100644
--- a/drivers/spi/tegra20_slink.c
+++ b/drivers/spi/tegra20_slink.c
@@ -95,7 +95,7 @@
static int tegra30_spi_of_to_plat(struct udevice *bus)
{
- struct tegra_spi_plat *plat = bus->plat;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -314,7 +314,7 @@
static int tegra30_spi_set_speed(struct udevice *bus, uint speed)
{
- struct tegra_spi_plat *plat = bus->plat;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra30_spi_priv *priv = dev_get_priv(bus);
if (speed > plat->frequency)
diff --git a/drivers/spi/tegra210_qspi.c b/drivers/spi/tegra210_qspi.c
index a2a7f46..b464b9c 100644
--- a/drivers/spi/tegra210_qspi.c
+++ b/drivers/spi/tegra210_qspi.c
@@ -99,7 +99,7 @@
static int tegra210_qspi_of_to_plat(struct udevice *bus)
{
- struct tegra_spi_plat *plat = bus->plat;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
plat->base = dev_read_addr(bus);
plat->periph_id = clock_decode_periph_id(bus);
@@ -380,7 +380,7 @@
static int tegra210_qspi_set_speed(struct udevice *bus, uint speed)
{
- struct tegra_spi_plat *plat = bus->plat;
+ struct tegra_spi_plat *plat = dev_get_plat(bus);
struct tegra210_qspi_priv *priv = dev_get_priv(bus);
if (speed > plat->frequency)
diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c
index 48b8430..e47ed5b 100644
--- a/drivers/spi/uniphier_spi.c
+++ b/drivers/spi/uniphier_spi.c
@@ -113,7 +113,7 @@
static void spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct uniphier_spi_plat *plat = bus->plat;
+ 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_deactivate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct uniphier_spi_plat *plat = bus->plat;
+ 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_set_speed(struct udevice *bus, uint speed)
{
- struct uniphier_spi_plat *plat = bus->plat;
+ struct uniphier_spi_plat *plat = dev_get_plat(bus);
struct uniphier_spi_priv *priv = dev_get_priv(bus);
u32 val, ckdiv;
@@ -364,7 +364,7 @@
static int uniphier_spi_of_to_plat(struct udevice *bus)
{
- struct uniphier_spi_plat *plat = bus->plat;
+ struct uniphier_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index 2fc28b6..845f2d2 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -100,7 +100,7 @@
static int zynq_qspi_of_to_plat(struct udevice *bus)
{
- struct zynq_qspi_plat *plat = bus->plat;
+ struct zynq_qspi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -592,7 +592,7 @@
static int zynq_qspi_set_speed(struct udevice *bus, uint speed)
{
- struct zynq_qspi_plat *plat = bus->plat;
+ 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;
diff --git a/drivers/spi/zynq_spi.c b/drivers/spi/zynq_spi.c
index a6efa4a..2971e55 100644
--- a/drivers/spi/zynq_spi.c
+++ b/drivers/spi/zynq_spi.c
@@ -75,7 +75,7 @@
static int zynq_spi_of_to_plat(struct udevice *bus)
{
- struct zynq_spi_plat *plat = bus->plat;
+ struct zynq_spi_plat *plat = dev_get_plat(bus);
const void *blob = gd->fdt_blob;
int node = dev_of_offset(bus);
@@ -162,7 +162,7 @@
static void spi_cs_activate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct zynq_spi_plat *plat = bus->plat;
+ 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_deactivate(struct udevice *dev)
{
struct udevice *bus = dev->parent;
- struct zynq_spi_plat *plat = bus->plat;
+ 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;
@@ -296,7 +296,7 @@
static int zynq_spi_set_speed(struct udevice *bus, uint speed)
{
- struct zynq_spi_plat *plat = bus->plat;
+ 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;
diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index f09c507..c9e476e 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -177,7 +177,7 @@
static int zynqmp_qspi_of_to_plat(struct udevice *bus)
{
- struct zynqmp_qspi_plat *plat = bus->plat;
+ struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
debug("%s\n", __func__);
@@ -255,7 +255,7 @@
void zynqmp_qspi_set_tapdelay(struct udevice *bus, u32 baudrateval)
{
- struct zynqmp_qspi_plat *plat = bus->plat;
+ 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 @@
static int zynqmp_qspi_set_speed(struct udevice *bus, uint speed)
{
- struct zynqmp_qspi_plat *plat = bus->plat;
+ 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;
diff --git a/drivers/timer/ag101p_timer.c b/drivers/timer/ag101p_timer.c
index 1717434..27cf9b0 100644
--- a/drivers/timer/ag101p_timer.c
+++ b/drivers/timer/ag101p_timer.c
@@ -64,7 +64,7 @@
static u64 atftmr_timer_get_count(struct udevice *dev)
{
- struct atftmr_timer_plat *plat = dev->plat;
+ 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 int atftmr_timer_probe(struct udevice *dev)
{
- struct atftmr_timer_plat *plat = dev->plat;
+ struct atftmr_timer_plat *plat = dev_get_plat(dev);
struct atftmr_timer_regs *const regs = plat->regs;
u32 cr;
writel(0, ®s->t3_load);
diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c
index 7e9abee..040dc65 100644
--- a/drivers/timer/altera_timer.c
+++ b/drivers/timer/altera_timer.c
@@ -34,7 +34,7 @@
static u64 altera_timer_get_count(struct udevice *dev)
{
- struct altera_timer_plat *plat = dev->plat;
+ struct altera_timer_plat *plat = dev_get_plat(dev);
struct altera_timer_regs *const regs = plat->regs;
u32 val;
@@ -49,7 +49,7 @@
static int altera_timer_probe(struct udevice *dev)
{
- struct altera_timer_plat *plat = dev->plat;
+ struct altera_timer_plat *plat = dev_get_plat(dev);
struct altera_timer_regs *const regs = plat->regs;
writel(0, ®s->status);
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 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/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c
index 9b1daaa..2f2b8be 100644
--- a/drivers/timer/mpc83xx_timer.c
+++ b/drivers/timer/mpc83xx_timer.c
@@ -206,7 +206,7 @@
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;
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 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/timer-uclass.c b/drivers/timer/timer-uclass.c
index ab53555..8e63c17 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -40,7 +40,7 @@
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;
}
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 7830a4a..16922ff 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1860,10 +1860,18 @@
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) {
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index a2bd743..17db5eb 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -60,7 +60,7 @@
{
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 @@
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 @@
if (ret)
return ret;
- uc_priv = uc->priv;
+ uc_priv = uclass_get_priv(uc);
uclass_foreach_dev(bus, uc) {
/* init low_level USB */
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 20f6973..8883e29 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -378,7 +378,7 @@
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;