mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-22 20:58:22 +00:00
i2c: sun6i_p2wi: Add support for DM clocks and resets
Currently, clock/reset setup for this device is handled by a platform-specific function and is intermixed with non-DM pinctrl setup. Use the devicetree to get clocks/resets, which disentagles it from the pinctrl setup in preparation for moving to DM_PINCTRL. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
parent
48457f7ab0
commit
07c411346c
1 changed files with 12 additions and 0 deletions
|
@ -14,10 +14,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <axp_pmic.h>
|
#include <axp_pmic.h>
|
||||||
|
#include <clk.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <i2c.h>
|
#include <i2c.h>
|
||||||
|
#include <reset.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/arch/cpu.h>
|
#include <asm/arch/cpu.h>
|
||||||
|
@ -180,9 +182,19 @@ static int sun6i_p2wi_probe_chip(struct udevice *bus, uint chip_addr,
|
||||||
static int sun6i_p2wi_probe(struct udevice *bus)
|
static int sun6i_p2wi_probe(struct udevice *bus)
|
||||||
{
|
{
|
||||||
struct sun6i_p2wi_priv *priv = dev_get_priv(bus);
|
struct sun6i_p2wi_priv *priv = dev_get_priv(bus);
|
||||||
|
struct reset_ctl *reset;
|
||||||
|
struct clk *clk;
|
||||||
|
|
||||||
priv->base = dev_read_addr_ptr(bus);
|
priv->base = dev_read_addr_ptr(bus);
|
||||||
|
|
||||||
|
reset = devm_reset_control_get(bus, NULL);
|
||||||
|
if (!IS_ERR(reset))
|
||||||
|
reset_deassert(reset);
|
||||||
|
|
||||||
|
clk = devm_clk_get(bus, NULL);
|
||||||
|
if (!IS_ERR(clk))
|
||||||
|
clk_enable(clk);
|
||||||
|
|
||||||
sun6i_p2wi_init(priv->base);
|
sun6i_p2wi_init(priv->base);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue