| Bob Copeland | 0764de6 | 2009-08-07 13:32:56 +0300 | [diff] [blame] | 1 | /* | 
 | 2 |  * This file is part of wl12xx | 
 | 3 |  * | 
 | 4 |  * Copyright (C) 2008 Nokia Corporation | 
 | 5 |  * | 
 | 6 |  * This program is free software; you can redistribute it and/or | 
 | 7 |  * modify it under the terms of the GNU General Public License | 
 | 8 |  * version 2 as published by the Free Software Foundation. | 
 | 9 |  * | 
 | 10 |  * This program is distributed in the hope that it will be useful, but | 
 | 11 |  * WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 12 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
 | 13 |  * General Public License for more details. | 
 | 14 |  * | 
 | 15 |  * You should have received a copy of the GNU General Public License | 
 | 16 |  * along with this program; if not, write to the Free Software | 
 | 17 |  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | 
 | 18 |  * 02110-1301 USA | 
 | 19 |  * | 
 | 20 |  */ | 
 | 21 | #ifndef __WL1251_IO_H__ | 
 | 22 | #define __WL1251_IO_H__ | 
 | 23 |  | 
 | 24 | #include "wl1251.h" | 
| Bob Copeland | 0764de6 | 2009-08-07 13:32:56 +0300 | [diff] [blame] | 25 |  | 
| Bob Copeland | 0d77e14 | 2009-08-07 13:33:18 +0300 | [diff] [blame] | 26 | #define HW_ACCESS_MEMORY_MAX_RANGE		0x1FFC0 | 
 | 27 |  | 
 | 28 | #define HW_ACCESS_PART0_SIZE_ADDR           0x1FFC0 | 
 | 29 | #define HW_ACCESS_PART0_START_ADDR          0x1FFC4 | 
 | 30 | #define HW_ACCESS_PART1_SIZE_ADDR           0x1FFC8 | 
 | 31 | #define HW_ACCESS_PART1_START_ADDR          0x1FFCC | 
 | 32 |  | 
 | 33 | #define HW_ACCESS_REGISTER_SIZE             4 | 
 | 34 |  | 
 | 35 | #define HW_ACCESS_PRAM_MAX_RANGE		0x3c000 | 
 | 36 |  | 
| Bob Copeland | 0764de6 | 2009-08-07 13:32:56 +0300 | [diff] [blame] | 37 | static inline u32 wl1251_read32(struct wl1251 *wl, int addr) | 
 | 38 | { | 
 | 39 | 	u32 response; | 
 | 40 |  | 
| Bob Copeland | 08d9f57 | 2009-08-07 13:33:11 +0300 | [diff] [blame] | 41 | 	wl->if_ops->read(wl, addr, &response, sizeof(u32)); | 
| Bob Copeland | 0764de6 | 2009-08-07 13:32:56 +0300 | [diff] [blame] | 42 |  | 
 | 43 | 	return response; | 
 | 44 | } | 
 | 45 |  | 
 | 46 | static inline void wl1251_write32(struct wl1251 *wl, int addr, u32 val) | 
 | 47 | { | 
| Bob Copeland | 08d9f57 | 2009-08-07 13:33:11 +0300 | [diff] [blame] | 48 | 	wl->if_ops->write(wl, addr, &val, sizeof(u32)); | 
| Bob Copeland | 0764de6 | 2009-08-07 13:32:56 +0300 | [diff] [blame] | 49 | } | 
 | 50 |  | 
| Grazvydas Ignotas | 3f9e750 | 2010-03-11 17:44:57 +0200 | [diff] [blame] | 51 | static inline u32 wl1251_read_elp(struct wl1251 *wl, int addr) | 
 | 52 | { | 
 | 53 | 	u32 response; | 
 | 54 |  | 
 | 55 | 	if (wl->if_ops->read_elp) | 
 | 56 | 		wl->if_ops->read_elp(wl, addr, &response); | 
 | 57 | 	else | 
 | 58 | 		wl->if_ops->read(wl, addr, &response, sizeof(u32)); | 
 | 59 |  | 
 | 60 | 	return response; | 
 | 61 | } | 
 | 62 |  | 
 | 63 | static inline void wl1251_write_elp(struct wl1251 *wl, int addr, u32 val) | 
 | 64 | { | 
 | 65 | 	if (wl->if_ops->write_elp) | 
 | 66 | 		wl->if_ops->write_elp(wl, addr, val); | 
 | 67 | 	else | 
 | 68 | 		wl->if_ops->write(wl, addr, &val, sizeof(u32)); | 
 | 69 | } | 
 | 70 |  | 
| Bob Copeland | 0764de6 | 2009-08-07 13:32:56 +0300 | [diff] [blame] | 71 | /* Memory target IO, address is translated to partition 0 */ | 
 | 72 | void wl1251_mem_read(struct wl1251 *wl, int addr, void *buf, size_t len); | 
 | 73 | void wl1251_mem_write(struct wl1251 *wl, int addr, void *buf, size_t len); | 
 | 74 | u32 wl1251_mem_read32(struct wl1251 *wl, int addr); | 
 | 75 | void wl1251_mem_write32(struct wl1251 *wl, int addr, u32 val); | 
 | 76 | /* Registers IO */ | 
 | 77 | u32 wl1251_reg_read32(struct wl1251 *wl, int addr); | 
 | 78 | void wl1251_reg_write32(struct wl1251 *wl, int addr, u32 val); | 
 | 79 |  | 
| Bob Copeland | 0d77e14 | 2009-08-07 13:33:18 +0300 | [diff] [blame] | 80 | void wl1251_set_partition(struct wl1251 *wl, | 
 | 81 | 			  u32 part_start, u32 part_size, | 
 | 82 | 			  u32 reg_start,  u32 reg_size); | 
 | 83 |  | 
| Bob Copeland | 0764de6 | 2009-08-07 13:32:56 +0300 | [diff] [blame] | 84 | #endif |