treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / net / wireless / ti / wl1251 / io.h
blob1e54da401774d525a84539096a93bf8fa2179c24
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * This file is part of wl12xx
5 * Copyright (C) 2008 Nokia Corporation
6 */
7 #ifndef __WL1251_IO_H__
8 #define __WL1251_IO_H__
10 #include "wl1251.h"
12 #define HW_ACCESS_MEMORY_MAX_RANGE 0x1FFC0
14 #define HW_ACCESS_PART0_SIZE_ADDR 0x1FFC0
15 #define HW_ACCESS_PART0_START_ADDR 0x1FFC4
16 #define HW_ACCESS_PART1_SIZE_ADDR 0x1FFC8
17 #define HW_ACCESS_PART1_START_ADDR 0x1FFCC
19 #define HW_ACCESS_REGISTER_SIZE 4
21 #define HW_ACCESS_PRAM_MAX_RANGE 0x3c000
23 static inline u32 wl1251_read32(struct wl1251 *wl, int addr)
25 wl->if_ops->read(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32));
27 return le32_to_cpu(wl->buffer_32);
30 static inline void wl1251_write32(struct wl1251 *wl, int addr, u32 val)
32 wl->buffer_32 = cpu_to_le32(val);
33 wl->if_ops->write(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32));
36 static inline u32 wl1251_read_elp(struct wl1251 *wl, int addr)
38 u32 response;
40 if (wl->if_ops->read_elp)
41 wl->if_ops->read_elp(wl, addr, &response);
42 else
43 wl->if_ops->read(wl, addr, &response, sizeof(u32));
45 return response;
48 static inline void wl1251_write_elp(struct wl1251 *wl, int addr, u32 val)
50 if (wl->if_ops->write_elp)
51 wl->if_ops->write_elp(wl, addr, val);
52 else
53 wl->if_ops->write(wl, addr, &val, sizeof(u32));
56 /* Memory target IO, address is translated to partition 0 */
57 void wl1251_mem_read(struct wl1251 *wl, int addr, void *buf, size_t len);
58 void wl1251_mem_write(struct wl1251 *wl, int addr, void *buf, size_t len);
59 u32 wl1251_mem_read32(struct wl1251 *wl, int addr);
60 void wl1251_mem_write32(struct wl1251 *wl, int addr, u32 val);
61 /* Registers IO */
62 u32 wl1251_reg_read32(struct wl1251 *wl, int addr);
63 void wl1251_reg_write32(struct wl1251 *wl, int addr, u32 val);
65 void wl1251_set_partition(struct wl1251 *wl,
66 u32 part_start, u32 part_size,
67 u32 reg_start, u32 reg_size);
69 #endif