fci_hpi.c 1.8 KB

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