wl1251_spi.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * This file is part of wl1251
  3. *
  4. * Copyright (c) 1998-2007 Texas Instruments Incorporated
  5. * Copyright (C) 2008 Nokia Corporation
  6. *
  7. * Contact: Kalle Valo <kalle.valo@nokia.com>
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * version 2 as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  21. * 02110-1301 USA
  22. *
  23. */
  24. #ifndef __WL1251_SPI_H__
  25. #define __WL1251_SPI_H__
  26. #include "wl1251_cmd.h"
  27. #include "wl1251_acx.h"
  28. #include "reg.h"
  29. #define HW_ACCESS_MEMORY_MAX_RANGE 0x1FFC0
  30. #define HW_ACCESS_PART0_SIZE_ADDR 0x1FFC0
  31. #define HW_ACCESS_PART0_START_ADDR 0x1FFC4
  32. #define HW_ACCESS_PART1_SIZE_ADDR 0x1FFC8
  33. #define HW_ACCESS_PART1_START_ADDR 0x1FFCC
  34. #define HW_ACCESS_REGISTER_SIZE 4
  35. #define HW_ACCESS_PRAM_MAX_RANGE 0x3c000
  36. #define WSPI_CMD_READ 0x40000000
  37. #define WSPI_CMD_WRITE 0x00000000
  38. #define WSPI_CMD_FIXED 0x20000000
  39. #define WSPI_CMD_BYTE_LENGTH 0x1FFE0000
  40. #define WSPI_CMD_BYTE_LENGTH_OFFSET 17
  41. #define WSPI_CMD_BYTE_ADDR 0x0001FFFF
  42. #define WSPI_INIT_CMD_CRC_LEN 5
  43. #define WSPI_INIT_CMD_START 0x00
  44. #define WSPI_INIT_CMD_TX 0x40
  45. /* the extra bypass bit is sampled by the TNET as '1' */
  46. #define WSPI_INIT_CMD_BYPASS_BIT 0x80
  47. #define WSPI_INIT_CMD_FIXEDBUSY_LEN 0x07
  48. #define WSPI_INIT_CMD_EN_FIXEDBUSY 0x80
  49. #define WSPI_INIT_CMD_DIS_FIXEDBUSY 0x00
  50. #define WSPI_INIT_CMD_IOD 0x40
  51. #define WSPI_INIT_CMD_IP 0x20
  52. #define WSPI_INIT_CMD_CS 0x10
  53. #define WSPI_INIT_CMD_WS 0x08
  54. #define WSPI_INIT_CMD_WSPI 0x01
  55. #define WSPI_INIT_CMD_END 0x01
  56. #define WSPI_INIT_CMD_LEN 8
  57. #define HW_ACCESS_WSPI_FIXED_BUSY_LEN \
  58. ((WL1251_BUSY_WORD_LEN - 4) / sizeof(u32))
  59. #define HW_ACCESS_WSPI_INIT_CMD_MASK 0
  60. /* INIT and RESET words */
  61. void wl1251_spi_reset(struct wl1251 *wl);
  62. void wl1251_spi_init(struct wl1251 *wl);
  63. int wl1251_set_partition(struct wl1251 *wl,
  64. u32 part_start, u32 part_size,
  65. u32 reg_start, u32 reg_size);
  66. #endif /* __WL1251_SPI_H__ */