diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/ckb-3352/fs/etc/init.d/S40network buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/ckb-3352/fs/etc/init.d/S40network
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/ckb-3352/fs/etc/init.d/S40network	2014-12-17 23:26:24.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/ckb-3352/fs/etc/init.d/S40network	2015-06-08 19:04:07.622251025 +0900
***************
*** 54,60 ****
  	fi
  
  	/sbin/ifup -a
- 	/sbin/ifdown -a; /sbin/ifup -a # retry
          ;;
  
    stop)
--- 54,59 ----
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/ckb-3352/patches/linux-3.2.1-003-cmj100-wlanrst.patch buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/ckb-3352/patches/linux-3.2.1-003-cmj100-wlanrst.patch
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/ckb-3352/patches/linux-3.2.1-003-cmj100-wlanrst.patch	1970-01-01 09:00:00.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/ckb-3352/patches/linux-3.2.1-003-cmj100-wlanrst.patch	2015-06-08 19:00:11.462076000 +0900
***************
*** 0 ****
--- 1,54 ----
+ diff -crN linux-3.2.1/arch/arm/mach-ckb_3352/board-ckb-3352.c linux-3.2.1_patched/arch/arm/mach-ckb_3352/board-ckb-3352.c
+ *** linux-3.2.1/arch/arm/mach-ckb_3352/board-ckb-3352.c	2015-06-08 11:04:47.122214623 +0900
+ --- linux-3.2.1_patched/arch/arm/mach-ckb_3352/board-ckb-3352.c	2015-06-08 18:59:59.146621569 +0900
+ ***************
+ *** 118,123 ****
+ --- 118,124 ----
+   #ifdef CONFIG_SUPPORT_CMJ100
+   #define CKB_WLAN_EN				GPIO_TO_PIN(0, 30)
+   #define CKB_WLAN_IRQ			GPIO_TO_PIN(0, 31)
+ + #define CKB_WLAN_RST			GPIO_TO_PIN(1, 27)
+   #endif
+   
+   #define CKB_LED1_PIN			GPIO_TO_PIN(0, 19)
+ ***************
+ *** 290,297 ****
+   	{"gpmc_ben1.mmc2_dat3", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
+   	{"gpmc_csn3.mmc2_cmd", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
+   	{"gpmc_clk.mmc2_clk", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
+ ! 	{"gpmc_wait0.gpio0_30", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
+ ! 	{"gpmc_wpn.gpio0_31", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
+   	{NULL, 0},
+   };
+   
+ --- 291,298 ----
+   	{"gpmc_ben1.mmc2_dat3", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
+   	{"gpmc_csn3.mmc2_cmd", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
+   	{"gpmc_clk.mmc2_clk", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
+ ! 	{"gpmc_wait0.gpio0_30", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},		/* WLAN_EN */
+ ! 	{"gpmc_wpn.gpio0_31", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},			/* WLAN_IRQ */
+   	{NULL, 0},
+   };
+   
+ ***************
+ *** 308,315 ****
+ --- 309,327 ----
+   {
+   	struct device *dev;
+   	struct omap_mmc_platform_data *pdata;
+ + 	u32 rev;
+   
+ + 	rev = omap_rev();
+   	setup_pin_mux(cmj100_wl_pins);
+ + 
+ + 	/* setup pin MUX for WLAN_RST */
+ + 	if(rev != AM335X_REV_ES1_0) {
+ + 		omap_mux_init_signal("gpmc_a11.gpio1_27", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT); /* WLAN_RST */
+ + 		if (gpio_request(CKB_WLAN_RST, "wl_rst") ||
+ + 			gpio_direction_output(CKB_WLAN_RST, 1))
+ + 			pr_warning("Error initializing the wl_rst GPIO %d\n",
+ + 					CKB_WLAN_RST);
+ + 	}
+   	
+   	if (gpio_request(CKB_WLAN_EN, "wl_en") ||
+   			gpio_direction_output(CKB_WLAN_EN, 0))
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/boot.c buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/boot.c
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/boot.c	2014-05-12 14:14:24.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/boot.c	2015-06-08 19:08:48.217332000 +0900
***************
*** 182,188 ****
  
  	memcpy(&partition, &part_table[PART_DOWN], sizeof(partition));
  	partition.mem.start = dest;
! 	wl1271_set_partition(wl, &partition);
  
  	/* 10.1 set partition limit and chunk num */
  	chunk_num = 0;
--- 182,190 ----
  
  	memcpy(&partition, &part_table[PART_DOWN], sizeof(partition));
  	partition.mem.start = dest;
! 	if(wl1271_set_partition(wl, &partition)) {
! 		return -ENODEV;
! 	}
  
  	/* 10.1 set partition limit and chunk num */
  	chunk_num = 0;
***************
*** 196,202 ****
  			partition_limit = chunk_num * CHUNK_SIZE +
  				part_table[PART_DOWN].mem.size;
  			partition.mem.start = addr;
! 			wl1271_set_partition(wl, &partition);
  		}
  
  		/* 10.3 upload the chunk */
--- 198,206 ----
  			partition_limit = chunk_num * CHUNK_SIZE +
  				part_table[PART_DOWN].mem.size;
  			partition.mem.start = addr;
! 			if(wl1271_set_partition(wl, &partition)) {
! 				return -ENODEV;
! 			}
  		}
  
  		/* 10.3 upload the chunk */
***************
*** 362,368 ****
  	nvs_len -= nvs_ptr - (u8 *)wl->nvs;
  
  	/* Now we must set the partition correctly */
! 	wl1271_set_partition(wl, &part_table[PART_WORK]);
  
  	/* Copy the NVS tables to a new block to ensure alignment */
  	nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL);
--- 366,374 ----
  	nvs_len -= nvs_ptr - (u8 *)wl->nvs;
  
  	/* Now we must set the partition correctly */
! 	if(wl1271_set_partition(wl, &part_table[PART_WORK])) {
! 		return -ENODEV;
! 	}
  
  	/* Copy the NVS tables to a new block to ensure alignment */
  	nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL);
***************
*** 471,477 ****
  	wl->event_box_addr = wl1271_read32(wl, REG_EVENT_MAILBOX_PTR);
  
  	/* set the working partition to its "running" mode offset */
! 	wl1271_set_partition(wl, &part_table[PART_WORK]);
  
  	wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x",
  		     wl->cmd_box_addr, wl->event_box_addr);
--- 477,485 ----
  	wl->event_box_addr = wl1271_read32(wl, REG_EVENT_MAILBOX_PTR);
  
  	/* set the working partition to its "running" mode offset */
! 	if(wl1271_set_partition(wl, &part_table[PART_WORK])) {
! 		return -ENODEV;
! 	}
  
  	wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x",
  		     wl->cmd_box_addr, wl->event_box_addr);
***************
*** 606,612 ****
  	wl1271_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL);
  	udelay(500);
  
! 	wl1271_set_partition(wl, &part_table[PART_DRPW]);
  
  	/* Read-modify-write DRPW_SCRATCH_START register (see next state)
  	   to be used by DRPw FW. The RTRIM value will be added by the FW
--- 614,622 ----
  	wl1271_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL);
  	udelay(500);
  
! 	if(wl1271_set_partition(wl, &part_table[PART_DRPW])) {
! 		return -ENODEV;
! 	}
  
  	/* Read-modify-write DRPW_SCRATCH_START register (see next state)
  	   to be used by DRPw FW. The RTRIM value will be added by the FW
***************
*** 621,627 ****
  	
  	wl1271_write32(wl, DRPW_SCRATCH_START, clk);
  
! 	wl1271_set_partition(wl, &part_table[PART_WORK]);
  
  	/* Disable interrupts */
  	wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
--- 631,639 ----
  	
  	wl1271_write32(wl, DRPW_SCRATCH_START, clk);
  
! 	if(wl1271_set_partition(wl, &part_table[PART_WORK])) {
! 		return -ENODEV;
! 	}
  
  	/* Disable interrupts */
  	wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
***************
*** 688,694 ****
  	return ret;
  }
  
! void cmj100_set_work_partition(struct wl1271 *wl)
  {
! 	wl1271_set_partition(wl, &part_table[PART_WORK]);
  }
--- 700,706 ----
  	return ret;
  }
  
! int cmj100_set_work_partition(struct wl1271 *wl)
  {
! 	return wl1271_set_partition(wl, &part_table[PART_WORK]);
  }
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/boot.h buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/boot.h
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/boot.h	2014-05-12 14:09:11.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/boot.h	2015-06-08 19:08:16.895541000 +0900
***************
*** 27,33 ****
  #include "cmj100.h"
  
  int wl1271_boot(struct wl1271 *wl);
! void cmj100_set_work_partition(struct wl1271 *wl);
  int wl1271_load_firmware(struct wl1271 *wl);
  
  #define WL1271_NO_SUBBANDS 8
--- 27,33 ----
  #include "cmj100.h"
  
  int wl1271_boot(struct wl1271 *wl);
! int cmj100_set_work_partition(struct wl1271 *wl);
  int wl1271_load_firmware(struct wl1271 *wl);
  
  #define WL1271_NO_SUBBANDS 8
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/cmj100.h buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/cmj100.h
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/cmj100.h	2014-05-12 14:09:27.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/cmj100.h	2015-06-08 19:04:07.622251025 +0900
***************
*** 299,305 ****
  struct wl1271_if_operations {
  	void (*read)(struct wl1271 *wl, int addr, void *buf, size_t len,
  		     bool fixed);
! 	void (*write)(struct wl1271 *wl, int addr, void *buf, size_t len,
  		     bool fixed);
  	void (*reset)(struct wl1271 *wl);
  	void (*init)(struct wl1271 *wl);
--- 299,305 ----
  struct wl1271_if_operations {
  	void (*read)(struct wl1271 *wl, int addr, void *buf, size_t len,
  		     bool fixed);
! 	int (*write)(struct wl1271 *wl, int addr, void *buf, size_t len,
  		     bool fixed);
  	void (*reset)(struct wl1271 *wl);
  	void (*init)(struct wl1271 *wl);
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/io.c buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/io.c
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/io.c	2014-05-12 10:50:20.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/io.c	2015-06-08 19:04:07.622251025 +0900
***************
*** 100,105 ****
--- 100,106 ----
  int wl1271_set_partition(struct wl1271 *wl,
  			 struct wl1271_partition_set *p)
  {
+ 	int ret = 0;
  	/* copy partition info */
  	memcpy(&wl->part, p, sizeof(*p));
  
***************
*** 113,127 ****
  		     p->mem3.start, p->mem3.size);
  
  	/* write partition info to the chipset */
! 	wl1271_raw_write32(wl, HW_PART0_START_ADDR, p->mem.start);
! 	wl1271_raw_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size);
! 	wl1271_raw_write32(wl, HW_PART1_START_ADDR, p->reg.start);
! 	wl1271_raw_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size);
! 	wl1271_raw_write32(wl, HW_PART2_START_ADDR, p->mem2.start);
! 	wl1271_raw_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size);
! 	wl1271_raw_write32(wl, HW_PART3_START_ADDR, p->mem3.start);
  
! 	return 0;
  }
  EXPORT_SYMBOL_GPL(wl1271_set_partition);
  
--- 114,147 ----
  		     p->mem3.start, p->mem3.size);
  
  	/* write partition info to the chipset */
! 	ret = wl1271_raw_write32(wl, HW_PART0_START_ADDR, p->mem.start);
! 	if (ret < 0)
! 		goto out;
! 	
! 	ret = wl1271_raw_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size);
! 	if (ret < 0)
! 		goto out;
! 
! 	ret = wl1271_raw_write32(wl, HW_PART1_START_ADDR, p->reg.start);
! 	if (ret < 0)
! 		goto out;
! 	
! 	ret = wl1271_raw_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size);
! 	if (ret < 0)
! 		goto out;
! 
! 	ret = wl1271_raw_write32(wl, HW_PART2_START_ADDR, p->mem2.start);
! 	if (ret < 0)
! 		goto out;
! 	
! 	ret = wl1271_raw_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size);
! 	if (ret < 0)
! 		goto out;
  
! 	ret	= wl1271_raw_write32(wl, HW_PART3_START_ADDR, p->mem3.start);
! 
! out:
! 	return ret;
  }
  EXPORT_SYMBOL_GPL(wl1271_set_partition);
  
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/io.h buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/io.h
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/io.h	2012-01-13 04:42:45.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/io.h	2015-06-08 19:04:07.627208355 +0900
***************
*** 58,67 ****
  
  
  /* Raw target IO, address is not translated */
! static inline void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf,
  				    size_t len, bool fixed)
  {
! 	wl->if_ops->write(wl, addr, buf, len, fixed);
  }
  
  static inline void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf,
--- 58,67 ----
  
  
  /* Raw target IO, address is not translated */
! static inline int wl1271_raw_write(struct wl1271 *wl, int addr, void *buf,
  				    size_t len, bool fixed)
  {
! 	return wl->if_ops->write(wl, addr, buf, len, fixed);
  }
  
  static inline void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf,
***************
*** 78,87 ****
  	return le32_to_cpu(wl->buffer_32);
  }
  
! static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val)
  {
  	wl->buffer_32 = cpu_to_le32(val);
! 	wl1271_raw_write(wl, addr, &wl->buffer_32,
  			     sizeof(wl->buffer_32), false);
  }
  
--- 78,87 ----
  	return le32_to_cpu(wl->buffer_32);
  }
  
! static inline int wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val)
  {
  	wl->buffer_32 = cpu_to_le32(val);
! 	return wl1271_raw_write(wl, addr, &wl->buffer_32,
  			     sizeof(wl->buffer_32), false);
  }
  
***************
*** 119,132 ****
  	wl1271_raw_read(wl, physical, buf, len, fixed);
  }
  
! static inline void wl1271_write(struct wl1271 *wl, int addr, void *buf,
  				size_t len, bool fixed)
  {
  	int physical;
  
  	physical = wl1271_translate_addr(wl, addr);
  
! 	wl1271_raw_write(wl, physical, buf, len, fixed);
  }
  
  static inline void wl1271_read_hwaddr(struct wl1271 *wl, int hwaddr,
--- 119,132 ----
  	wl1271_raw_read(wl, physical, buf, len, fixed);
  }
  
! static inline int wl1271_write(struct wl1271 *wl, int addr, void *buf,
  				size_t len, bool fixed)
  {
  	int physical;
  
  	physical = wl1271_translate_addr(wl, addr);
  
! 	return wl1271_raw_write(wl, physical, buf, len, fixed);
  }
  
  static inline void wl1271_read_hwaddr(struct wl1271 *wl, int hwaddr,
***************
*** 148,156 ****
  	return wl1271_raw_read32(wl, wl1271_translate_addr(wl, addr));
  }
  
! static inline void wl1271_write32(struct wl1271 *wl, int addr, u32 val)
  {
! 	wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val);
  }
  
  static inline void wl1271_power_off(struct wl1271 *wl)
--- 148,156 ----
  	return wl1271_raw_read32(wl, wl1271_translate_addr(wl, addr));
  }
  
! static inline int wl1271_write32(struct wl1271 *wl, int addr, u32 val)
  {
! 	return wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val);
  }
  
  static inline void wl1271_power_off(struct wl1271 *wl)
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/main.c buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/main.c
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/main.c	2014-05-12 14:31:30.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/main.c	2015-06-08 19:04:07.630206423 +0900
***************
*** 1286,1292 ****
  	memset(&partition, 0, sizeof(partition));
  	partition.reg.start = REGISTERS_BASE;
  	partition.reg.size = REGISTERS_DOWN_SIZE;
! 	wl1271_set_partition(wl, &partition);
  
  	/* ELP module wake up */
  	wl1271_fw_wakeup(wl);
--- 1286,1297 ----
  	memset(&partition, 0, sizeof(partition));
  	partition.reg.start = REGISTERS_BASE;
  	partition.reg.size = REGISTERS_DOWN_SIZE;
! 	ret = wl1271_set_partition(wl, &partition);
! 	if(ret)
! 	{
! 		ret = -ENODEV;
! 		goto out;
! 	}
  
  	/* ELP module wake up */
  	wl1271_fw_wakeup(wl);
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/rx.c buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/rx.c
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/rx.c	2014-05-12 11:03:35.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/rx.c	2015-06-08 19:08:10.104152000 +0900
***************
*** 128,142 ****
--- 128,150 ----
  	/* discard corrupted packets */
  	case WL1271_RX_DESC_DRIVER_RX_Q_FAIL:
  	case WL1271_RX_DESC_DECRYPT_FAIL:
+ #if 0	/* prevent this warnings as the handle data call can only fail in memory-outage
+ 			 conditions, in that case the received frame will just
+ 			 be dropped. */
  		wl1271_warning("corrupted packet in RX with status: 0x%x",
  			       desc->status & WL1271_RX_DESC_STATUS_MASK);
+ #endif
  		return -EINVAL;
  	case WL1271_RX_DESC_SUCCESS:
  	case WL1271_RX_DESC_MIC_FAIL:
  		break;
  	default:
+ #if 0	/* prevent this warnings as the handle data call can only fail in memory-outage
+ 			 conditions, in that case the received frame will just
+ 			 be dropped. */
  		wl1271_error("invalid RX descriptor status: 0x%x",
  			     desc->status & WL1271_RX_DESC_STATUS_MASK);
+ #endif
  		return -EINVAL;
  	}
  
diff -crN buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/sdio.c buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/sdio.c
*** buildroot-2013.08.1-ckb-20150123-1/board/ckb/common/cmj100-module/linux-3.2.x/sdio.c	2014-05-12 14:11:02.000000000 +0900
--- buildroot-2013.08.1-ckb-20150123-1-cmj100-patch-20150608/board/ckb/common/cmj100-module/linux-3.2.x/sdio.c	2015-06-08 19:08:01.864681000 +0900
***************
*** 135,141 ****
  		wl1271_error("sdio read failed (%d)", ret);
  }
  
! static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
  				  size_t len, bool fixed)
  {
  	int ret;
--- 135,141 ----
  		wl1271_error("sdio read failed (%d)", ret);
  }
  
! static int wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
  				  size_t len, bool fixed)
  {
  	int ret;
***************
*** 158,163 ****
--- 158,164 ----
  
  	if (ret)
  		wl1271_error("sdio write failed (%d)", ret);
+ 	return ret;
  }
  
  static int wl1271_sdio_power_on(struct wl1271 *wl)
***************
*** 245,251 ****
  	/* copy partition info */
  	memcpy(&cur_part, &wl->part, sizeof(cur_part));
  	/* read the Mac address from the NVS address */
! 	cmj100_set_work_partition(wl);
  
  	nvs_ptr = (u8 *)nvs;
  	nvs_val = (u8 *)&val;
--- 246,255 ----
  	/* copy partition info */
  	memcpy(&cur_part, &wl->part, sizeof(cur_part));
  	/* read the Mac address from the NVS address */
! 	if(cmj100_set_work_partition(wl)) {
! 		ret = -ENODEV;
! 		goto out;
! 	}
  
  	nvs_ptr = (u8 *)nvs;
  	nvs_val = (u8 *)&val;
***************
*** 269,275 ****
      wl->mac_addr[1] = nvs_val[0];
  
  	/* restore the partition */
! 	wl1271_set_partition(wl, &cur_part);
  
  out:
  	if(ret < 0)
--- 273,281 ----
      wl->mac_addr[1] = nvs_val[0];
  
  	/* restore the partition */
! 	if(wl1271_set_partition(wl, &cur_part)) {
! 		ret = -ENODEV;
! 	}
  
  out:
  	if(ret < 0)
