Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
		-DAP_FIRMWARE=\"atmel/wilc1000_ap_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

wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
+2 −6
Original line number Diff line number Diff line
@@ -163,9 +163,7 @@ static int sdio_clear_int(struct wilc *wilc)
 ********************************************/
static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
{
#ifdef BIG_ENDIAN
	data = BYTE_SWAP(data);
#endif
	data = cpu_to_le32(data);

	if ((addr >= 0xf0) && (addr <= 0xff)) {
		sdio_cmd52_t cmd;
@@ -330,9 +328,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
		}
	}

#ifdef BIG_ENDIAN
	*data = BYTE_SWAP(*data);
#endif
	*data = cpu_to_le32(*data);

	return 1;

+4 −12
Original line number Diff line number Diff line
@@ -529,9 +529,7 @@ static int spi_internal_write(struct wilc *wilc, u32 adr, u32 dat)
{
	int result;

#ifdef BIG_ENDIAN
	dat = BYTE_SWAP(dat);
#endif
	dat = cpu_to_le32(dat);
	result = spi_cmd_complete(wilc, CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4,
				  0);
	if (result != N_OK) {
@@ -552,9 +550,7 @@ static int spi_internal_read(struct wilc *wilc, u32 adr, u32 *data)
		return 0;
	}

#ifdef BIG_ENDIAN
	*data = BYTE_SWAP(*data);
#endif
	*data = cpu_to_le32(*data);

	return 1;
}
@@ -571,9 +567,7 @@ static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, u32 data)
	u8 cmd = CMD_SINGLE_WRITE;
	u8 clockless = 0;

#ifdef BIG_ENDIAN
	data = BYTE_SWAP(data);
#endif
	data = cpu_to_le32(data);
	if (addr < 0x30) {
		/* Clockless register*/
		cmd = CMD_INTERNAL_WRITE;
@@ -635,9 +629,7 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data)
		return 0;
	}

#ifdef BIG_ENDIAN
	*data = BYTE_SWAP(*data);
#endif
	*data = cpu_to_le32(*data);

	return 1;
}
+6 −16
Original line number Diff line number Diff line
@@ -759,9 +759,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
					vmm_table[i] |= BIT(10);
					PRINT_D(TX_DBG, "VMMTable entry changed for CFG packet = %d\n", vmm_table[i]);
				}
#ifdef BIG_ENDIAN
				vmm_table[i] = BYTE_SWAP(vmm_table[i]);
#endif
				vmm_table[i] = cpu_to_le32(vmm_table[i]);

				i++;
				sum += vmm_sz;
@@ -886,9 +884,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
			if (tqe && (vmm_table[i] != 0)) {
				u32 header, buffer_offset;

#ifdef BIG_ENDIAN
				vmm_table[i] = BYTE_SWAP(vmm_table[i]);
#endif
				vmm_table[i] = cpu_to_le32(vmm_table[i]);
				vmm_sz = (vmm_table[i] & 0x3ff);
				vmm_sz *= 4;
				header = (tqe->type << 31) |
@@ -899,9 +895,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
				else
					header &= ~BIT(30);

#ifdef BIG_ENDIAN
				header = BYTE_SWAP(header);
#endif
				header = cpu_to_le32(header);
				memcpy(&txb[offset], &header, 4);
				if (tqe->type == WILC_CFG_PKT) {
					buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET;
@@ -993,9 +987,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)

			PRINT_D(RX_DBG, "In the 2nd do-while\n");
			memcpy(&header, &buffer[offset], 4);
#ifdef BIG_ENDIAN
			header = BYTE_SWAP(header);
#endif
			header = cpu_to_le32(header);
			PRINT_D(RX_DBG, "Header = %04x - Offset = %d\n",
				header, offset);

@@ -1194,10 +1186,8 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_
	do {
		memcpy(&addr, &buffer[offset], 4);
		memcpy(&size, &buffer[offset + 4], 4);
#ifdef BIG_ENDIAN
		addr = BYTE_SWAP(addr);
		size = BYTE_SWAP(size);
#endif
		addr = cpu_to_le32(addr);
		size = cpu_to_le32(size);
		acquire_bus(wilc, ACQUIRE_ONLY);
		offset += 8;
		while (((int)size) && (offset < buffer_size)) {
+0 −11
Original line number Diff line number Diff line
@@ -35,17 +35,6 @@
#define ETH_CONFIG_PKT_HDR_OFFSET	(ETH_ETHERNET_HDR_OFFSET + \
					 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
Loading