1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/*****************************************************************************
Copyright(c) 2013 FCI Inc. All Rights Reserved
File name : fci_hpi.c
Description : source of internal hpi driver
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
History :
----------------------------------------------------------------------
*******************************************************************************/
#include <linux/slab.h>
#include "fci_types.h"
#include "fci_hal.h"
#include "fc8300_regs.h" /* deprecated */
static DEFINE_MUTEX(fci_hpi_lock);
s32 fci_hpi_init(HANDLE handle, DEVICEID devid, s32 speed, s32 slaveaddr)
{
return BBM_OK;
}
s32 fci_hpi_read(HANDLE handle, DEVICEID devid,
u8 chip, u8 addr, u8 alen, u8 *data, u8 len)
{
s32 res;
mutex_lock(&fci_hpi_lock);
res = bbm_bulk_read(handle, devid, 0x0f00 | addr, data, len);
mutex_unlock(&fci_hpi_lock);
return res;
}
s32 fci_hpi_write(HANDLE handle, DEVICEID devid,
u8 chip, u8 addr, u8 alen, u8 *data, u8 len)
{
#if !defined(BBM_I2C_SPI) && !defined(BBM_I2C_TSIF) && defined(BBM_ES) /* ONLY ES SPI */
s32 i;
mutex_lock(&fci_hpi_lock);
for (i = 0; i < len; i++, data++)
bbm_word_write(handle, devid, 0x0f00 | addr,
(*data << 8) | *data);
mutex_unlock(&fci_hpi_lock);
#else
s32 i;
mutex_lock(&fci_hpi_lock);
for (i = 0; i < len; i++, data++)
bbm_write(handle, devid, 0x0f00 | addr, *data);
mutex_unlock(&fci_hpi_lock);
#endif
return BBM_OK;
}
s32 fci_hpi_deinit(HANDLE handle, DEVICEID devid)
{
return BBM_OK;
}
|