Commit 9e6627ac authored by Glen Lee's avatar Glen Lee Committed by Greg Kroah-Hartman

staging: wilc1000: use kernel define byte order macros

This patch removes define BIG_ENDIAN and use kernel define byte order macros
instead of swap itself. Remove unused BYTE_SWAP macro and __CHECK_ENDIAN__
in Makefile also.
Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b719302d
...@@ -4,7 +4,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ ...@@ -4,7 +4,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \ -DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
-DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\" -DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS
#ccflags-y += -DTCP_ACK_FILTER #ccflags-y += -DTCP_ACK_FILTER
wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
......
...@@ -163,9 +163,7 @@ static int sdio_clear_int(struct wilc *wilc) ...@@ -163,9 +163,7 @@ static int sdio_clear_int(struct wilc *wilc)
********************************************/ ********************************************/
static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
{ {
#ifdef BIG_ENDIAN data = cpu_to_le32(data);
data = BYTE_SWAP(data);
#endif
if ((addr >= 0xf0) && (addr <= 0xff)) { if ((addr >= 0xf0) && (addr <= 0xff)) {
sdio_cmd52_t cmd; sdio_cmd52_t cmd;
...@@ -330,9 +328,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) ...@@ -330,9 +328,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
} }
} }
#ifdef BIG_ENDIAN *data = cpu_to_le32(*data);
*data = BYTE_SWAP(*data);
#endif
return 1; return 1;
......
...@@ -529,9 +529,7 @@ static int spi_internal_write(struct wilc *wilc, u32 adr, u32 dat) ...@@ -529,9 +529,7 @@ static int spi_internal_write(struct wilc *wilc, u32 adr, u32 dat)
{ {
int result; int result;
#ifdef BIG_ENDIAN dat = cpu_to_le32(dat);
dat = BYTE_SWAP(dat);
#endif
result = spi_cmd_complete(wilc, CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4, result = spi_cmd_complete(wilc, CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4,
0); 0);
if (result != N_OK) { if (result != N_OK) {
...@@ -552,9 +550,7 @@ static int spi_internal_read(struct wilc *wilc, u32 adr, u32 *data) ...@@ -552,9 +550,7 @@ static int spi_internal_read(struct wilc *wilc, u32 adr, u32 *data)
return 0; return 0;
} }
#ifdef BIG_ENDIAN *data = cpu_to_le32(*data);
*data = BYTE_SWAP(*data);
#endif
return 1; return 1;
} }
...@@ -571,9 +567,7 @@ static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, u32 data) ...@@ -571,9 +567,7 @@ static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, u32 data)
u8 cmd = CMD_SINGLE_WRITE; u8 cmd = CMD_SINGLE_WRITE;
u8 clockless = 0; u8 clockless = 0;
#ifdef BIG_ENDIAN data = cpu_to_le32(data);
data = BYTE_SWAP(data);
#endif
if (addr < 0x30) { if (addr < 0x30) {
/* Clockless register*/ /* Clockless register*/
cmd = CMD_INTERNAL_WRITE; cmd = CMD_INTERNAL_WRITE;
...@@ -635,9 +629,7 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data) ...@@ -635,9 +629,7 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data)
return 0; return 0;
} }
#ifdef BIG_ENDIAN *data = cpu_to_le32(*data);
*data = BYTE_SWAP(*data);
#endif
return 1; return 1;
} }
......
...@@ -759,9 +759,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -759,9 +759,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
vmm_table[i] |= BIT(10); vmm_table[i] |= BIT(10);
PRINT_D(TX_DBG, "VMMTable entry changed for CFG packet = %d\n", vmm_table[i]); PRINT_D(TX_DBG, "VMMTable entry changed for CFG packet = %d\n", vmm_table[i]);
} }
#ifdef BIG_ENDIAN vmm_table[i] = cpu_to_le32(vmm_table[i]);
vmm_table[i] = BYTE_SWAP(vmm_table[i]);
#endif
i++; i++;
sum += vmm_sz; sum += vmm_sz;
...@@ -886,9 +884,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -886,9 +884,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
if (tqe && (vmm_table[i] != 0)) { if (tqe && (vmm_table[i] != 0)) {
u32 header, buffer_offset; u32 header, buffer_offset;
#ifdef BIG_ENDIAN vmm_table[i] = cpu_to_le32(vmm_table[i]);
vmm_table[i] = BYTE_SWAP(vmm_table[i]);
#endif
vmm_sz = (vmm_table[i] & 0x3ff); vmm_sz = (vmm_table[i] & 0x3ff);
vmm_sz *= 4; vmm_sz *= 4;
header = (tqe->type << 31) | header = (tqe->type << 31) |
...@@ -899,9 +895,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -899,9 +895,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
else else
header &= ~BIT(30); header &= ~BIT(30);
#ifdef BIG_ENDIAN header = cpu_to_le32(header);
header = BYTE_SWAP(header);
#endif
memcpy(&txb[offset], &header, 4); memcpy(&txb[offset], &header, 4);
if (tqe->type == WILC_CFG_PKT) { if (tqe->type == WILC_CFG_PKT) {
buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET; buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET;
...@@ -993,9 +987,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) ...@@ -993,9 +987,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
PRINT_D(RX_DBG, "In the 2nd do-while\n"); PRINT_D(RX_DBG, "In the 2nd do-while\n");
memcpy(&header, &buffer[offset], 4); memcpy(&header, &buffer[offset], 4);
#ifdef BIG_ENDIAN header = cpu_to_le32(header);
header = BYTE_SWAP(header);
#endif
PRINT_D(RX_DBG, "Header = %04x - Offset = %d\n", PRINT_D(RX_DBG, "Header = %04x - Offset = %d\n",
header, offset); header, offset);
...@@ -1194,10 +1186,8 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_ ...@@ -1194,10 +1186,8 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_
do { do {
memcpy(&addr, &buffer[offset], 4); memcpy(&addr, &buffer[offset], 4);
memcpy(&size, &buffer[offset + 4], 4); memcpy(&size, &buffer[offset + 4], 4);
#ifdef BIG_ENDIAN addr = cpu_to_le32(addr);
addr = BYTE_SWAP(addr); size = cpu_to_le32(size);
size = BYTE_SWAP(size);
#endif
acquire_bus(wilc, ACQUIRE_ONLY); acquire_bus(wilc, ACQUIRE_ONLY);
offset += 8; offset += 8;
while (((int)size) && (offset < buffer_size)) { while (((int)size) && (offset < buffer_size)) {
......
...@@ -35,17 +35,6 @@ ...@@ -35,17 +35,6 @@
#define ETH_CONFIG_PKT_HDR_OFFSET (ETH_ETHERNET_HDR_OFFSET + \ #define ETH_CONFIG_PKT_HDR_OFFSET (ETH_ETHERNET_HDR_OFFSET + \
ETH_CONFIG_PKT_HDR_LEN) ETH_CONFIG_PKT_HDR_LEN)
/********************************************
*
* Endian Conversion
*
********************************************/
#define BYTE_SWAP(val) (((val & 0x000000FF) << 24) + \
((val & 0x0000FF00) << 8) + \
((val & 0x00FF0000) >> 8) + \
((val & 0xFF000000) >> 24))
/******************************************** /********************************************
* *
* Register Defines * Register Defines
......
...@@ -275,9 +275,7 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) ...@@ -275,9 +275,7 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size)
while (size > 0) { while (size > 0) {
i = 0; i = 0;
wid = info[0] | (info[1] << 8); wid = info[0] | (info[1] << 8);
#ifdef BIG_ENDIAN wid = cpu_to_le32(wid);
wid = BYTE_SWAP(wid);
#endif
PRINT_INFO(GENERIC_DBG, "Processing response for %d seq %d\n", wid, seq++); PRINT_INFO(GENERIC_DBG, "Processing response for %d seq %d\n", wid, seq++);
switch ((wid >> 12) & 0x7) { switch ((wid >> 12) & 0x7) {
case WID_CHAR: case WID_CHAR:
...@@ -300,11 +298,7 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) ...@@ -300,11 +298,7 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size)
break; break;
if (g_cfg_hword[i].id == wid) { if (g_cfg_hword[i].id == wid) {
#ifdef BIG_ENDIAN g_cfg_hword[i].val = cpu_to_le16(info[3] | (info[4] << 8));
g_cfg_hword[i].val = (info[3] << 8) | (info[4]);
#else
g_cfg_hword[i].val = info[3] | (info[4] << 8);
#endif
break; break;
} }
i++; i++;
...@@ -318,11 +312,7 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) ...@@ -318,11 +312,7 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size)
break; break;
if (g_cfg_word[i].id == wid) { if (g_cfg_word[i].id == wid) {
#ifdef BIG_ENDIAN g_cfg_word[i].val = cpu_to_le32(info[3] | (info[4] << 8) | (info[5] << 16) | (info[6] << 24));
g_cfg_word[i].val = (info[3] << 24) | (info[4] << 16) | (info[5] << 8) | (info[6]);
#else
g_cfg_word[i].val = info[3] | (info[4] << 8) | (info[5] << 16) | (info[6] << 24);
#endif
break; break;
} }
i++; i++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment