static int bcm6345_gpio_probe(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct bcm6345_gpio_priv *priv = dev_get_priv(dev); priv->reg_dirout = dev_remap_addr_index(dev, 0); if (!priv->reg_dirout) return -EINVAL; priv->reg_data = dev_remap_addr_index(dev, 1); if (!priv->reg_data) return -EINVAL; uc_priv->gpio_count = dev_read_u32_default(dev, "ngpios", 32); uc_priv->bank_name = dev->name; return 0; }
static int meson_dw_hdmi_probe(struct udevice *dev) { struct meson_dw_hdmi *priv = dev_get_priv(dev); struct reset_ctl_bulk resets; struct clk_bulk clocks; struct udevice *supply; int ret; priv->dev = dev; priv->hdmi.ioaddr = (ulong)dev_remap_addr_index(dev, 0); if (!priv->hdmi.ioaddr) return -EINVAL; priv->hhi_base = dev_remap_addr_index(dev, 1); if (!priv->hhi_base) return -EINVAL; priv->hdmi.hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; priv->hdmi.hdmi_data.enc_in_bus_format = MEDIA_BUS_FMT_YUV8_1X24; priv->hdmi.phy_set = meson_dw_hdmi_phy_init; priv->hdmi.write_reg = dw_hdmi_dwc_write; priv->hdmi.read_reg = dw_hdmi_dwc_read; priv->hdmi.i2c_clk_high = 0x67; priv->hdmi.i2c_clk_low = 0x78; ret = device_get_supply_regulator(dev, "hdmi-supply", &supply); if (ret) return ret; ret = regulator_set_enable(supply, true); if (ret) return ret; ret = reset_get_bulk(dev, &resets); if (ret) return ret; ret = clk_get_bulk(dev, &clocks); if (ret) return ret; ret = clk_enable_bulk(&clocks); if (ret) return ret; /* Enable clocks */ dw_hdmi_hhi_update_bits(priv, HHI_HDMI_CLK_CNTL, 0xffff, 0x100); /* Bring HDMITX MEM output of power down */ dw_hdmi_hhi_update_bits(priv, HHI_MEM_PD_REG0, 0xff << 8, 0); /* Reset HDMITX APB & TX & PHY: cycle needed for EDID */ ret = reset_deassert_bulk(&resets); if (ret) return ret; ret = reset_assert_bulk(&resets); if (ret) return ret; ret = reset_deassert_bulk(&resets); if (ret) return ret; /* Enable APB3 fail on error */ writel_bits(BIT(15), BIT(15), priv->hdmi.ioaddr + HDMITX_TOP_CTRL_REG); writel_bits(BIT(15), BIT(15), priv->hdmi.ioaddr + HDMITX_DWC_CTRL_REG); /* Bring out of reset */ dw_hdmi_top_write(&priv->hdmi, HDMITX_TOP_SW_RESET, 0); mdelay(20); dw_hdmi_top_write(&priv->hdmi, HDMITX_TOP_CLK_CNTL, 0xff); dw_hdmi_init(&priv->hdmi); dw_hdmi_phy_init(&priv->hdmi); /* wait for connector */ ret = meson_dw_hdmi_wait_hpd(&priv->hdmi); if (ret) debug("hdmi can not get hpd signal\n"); return ret; }
void *dev_remap_addr(struct udevice *dev) { return dev_remap_addr_index(dev, 0); }