1/*
2 * Copyright (c) 2012, ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, CAB F.78, Universitaetstr 6, CH-8092 Zurich.
8 */
9#ifndef __TI_TWL6030_H__
10#define __TI_TWL6030_H__
11
12#include <barrelfish/barrelfish.h>
13#include <errors/errno.h>
14#include <if/cm2_defs.h>
15
16// I2C Host controller id
17#define I2C_HC 0
18
19//#define TWL_SERIVCE_DEBUG 1
20
21#if defined(TWL_SERIVCE_DEBUG) || defined(MMCHS_SERVICE_DEBUG) || defined(GLOBAL_DEBUG)
22#define TWL_DEBUG(x...) printf(x)
23#else
24#define TWL_DEBUG(x...) ((void)0)
25#endif
26
27uint8_t _ti_twl6030_id1_read_8(void *d, size_t off);
28void _ti_twl6030_id1_write_8(void *d, size_t off, uint8_t regval);
29#define ti_twl6030_id1_read_8(dev, off) _ti_twl6030_id1_read_8(dev, off)
30#define ti_twl6030_id1_write_8(dev, off, regval) _ti_twl6030_id1_write_8(dev, off, regval)
31#include <dev/ti_twl6030_dev.h>
32
33struct twl6030_driver_state {
34    size_t level;
35    struct capref cap;
36    ti_twl6030_t twl;
37    struct cm2_binding* cm2_binding;
38};
39
40void ti_twl6030_init(struct twl6030_driver_state*);
41errval_t ti_twl6030_set_vmmc_vsel(ti_twl6030_t twl, int millis);
42void ti_twl6030_vmmc_pr(ti_twl6030_t twl);
43void ti_twl6030_vmmc_on(ti_twl6030_t twl);
44void ti_twl6030_vmmc_off(ti_twl6030_t twl);
45
46/* service.c */
47void twl6030_init_service(struct twl6030_driver_state* st, iref_t* iref);
48
49
50#endif // __TI_TWL6030_H__
51