Hou Zhiqiang | 762161b | 2016-12-09 16:08:57 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Freescale Semiconductor, Inc. |
| 3 | * Hou Zhiqiang <Zhiqiang.Hou@freescale.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <errno.h> |
| 10 | #include <i2c.h> |
| 11 | #include <power/pmic.h> |
| 12 | #include <power/mc34vr500_pmic.h> |
| 13 | |
| 14 | int power_mc34vr500_init(unsigned char bus) |
| 15 | { |
| 16 | static const char name[] = "MC34VR500"; |
| 17 | struct pmic *p = pmic_alloc(); |
| 18 | |
| 19 | if (!p) { |
| 20 | printf("%s: POWER allocation error!\n", __func__); |
| 21 | return -ENOMEM; |
| 22 | } |
| 23 | |
| 24 | p->name = name; |
| 25 | p->interface = PMIC_I2C; |
| 26 | p->number_of_regs = MC34VR500_NUM_OF_REGS; |
| 27 | p->hw.i2c.addr = MC34VR500_I2C_ADDR; |
| 28 | p->hw.i2c.tx_num = 1; |
| 29 | p->bus = bus; |
| 30 | |
| 31 | return 0; |
| 32 | } |