Index: uspace/drv/bus/usb/ar9271/ar9271.c
===================================================================
--- uspace/drv/bus/usb/ar9271/ar9271.c	(revision 56c0930934f3eb8763355d11f38eb65b6896d53e)
+++ uspace/drv/bus/usb/ar9271/ar9271.c	(revision 4cb0148f513840557c24fabe8b6c9b7fe5b13ef0)
@@ -165,5 +165,5 @@
 		htc_read_data_message(ar9271->htc_device, buffer, buffer_size,
 			NULL);
-		usb_log_info("RC is %d.\n", rc);
+		usb_log_info("XXXXXXXXXXXXXXXXXXXXXXXXXXXX RC is %d.\n", rc);
 		
 		/* TODO: Process RX message */
@@ -179,8 +179,24 @@
 	while(true) {
 		uint32_t result;
+		wmi_reg_read(ar9271->htc_device, 0x7828, &result);
+		usb_log_info("0x7828: %x\n", result);
+		wmi_reg_read(ar9271->htc_device, 0x782C, &result);
+		usb_log_info("0x782C: %x\n", result);
+		wmi_reg_read(ar9271->htc_device, 0x8048, &result);
+		usb_log_info("Diag reg.: %x\n", result);
+		wmi_reg_read(ar9271->htc_device, 0x8088, &result);
+		usb_log_info("Successful RTS count: %x\n", result);
+		wmi_reg_read(ar9271->htc_device, 0x808C, &result);
+		usb_log_info("Failed RTS count: %x\n", result);
+		wmi_reg_read(ar9271->htc_device, 0x8090, &result);
+		usb_log_info("Failed ACK count: %x\n", result);
+		wmi_reg_read(ar9271->htc_device, 0x8094, &result);
+		usb_log_info("Failed FCS count: %x\n", result);
 		wmi_reg_read(ar9271->htc_device, 0x80F0, &result);
 		usb_log_info("RX count: %x\n", result);
 		wmi_reg_read(ar9271->htc_device, 0x8098, &result);
 		usb_log_info("Beacon count: %x\n", result);
+		wmi_reg_read(ar9271->htc_device, 0x812C, &result);
+		usb_log_info("PHY errors: %x\n", result);
 		sleep(1);
 	}
Index: uspace/drv/bus/usb/ar9271/ar9271.h
===================================================================
--- uspace/drv/bus/usb/ar9271/ar9271.h	(revision 56c0930934f3eb8763355d11f38eb65b6896d53e)
+++ uspace/drv/bus/usb/ar9271/ar9271.h	(revision 4cb0148f513840557c24fabe8b6c9b7fe5b13ef0)
@@ -109,10 +109,12 @@
 	AR9271_RX_FILTER_PROBEREQ = 0x00000080,
 	AR9271_RX_FILTER_MYBEACON = 0x00000200,
+	AR9271_MULTICAST_FILTER1 = 0x8040,
+	AR9271_MULTICAST_FILTER2 = 0x8044,	
 		
 	/* Physical layer registers */
-	AR9271_PHY_BASE = 0x9800,
 	AR9271_PHY_ACTIVE = 0x981C,
 	AR9271_ADC_CONTROL = 0x982C,
 	AR9271_AGC_CONTROL = 0x9860,
+	AR9271_PHY_SYNTH_CONTROL = 0x9874, 
 	AR9271_PHY_MODE = 0xA200,
 	AR9271_PHY_CCK_TX_CTRL = 0xA204,
@@ -121,5 +123,8 @@
 	AR9271_ADC_CONTROL_OFF_PWDADC = 0x00008000,
 	AR9271_AGC_CONTROL_CALIB = 0x00000001,
+	AR9271_AGC_CONTROL_NF_CALIB = 0x00000002,
+	AR9271_AGC_CONTROL_NF_CALIB_EN = 0x00008000, 
 	AR9271_AGC_CONTROL_TX_CALIB = 0x00010000,
+	AR9271_AGC_CONTROL_NF_NOT_UPDATE = 0x00020000,
 	AR9271_PHY_MODE_2G = 0x02,
 	AR9271_PHY_MODE_DYNAMIC = 0x04,
@@ -166,4 +171,317 @@
 	htc_device_t *htc_device;
 } ar9271_t;
+
+/**
+ * AR9271 init values for 2GHz mode operation.
+ * 
+ * Including settings of noise floor limits.
+ * 
+ * Taken from Linux sources.
+ */
+static const uint32_t ar9271_2g_mode_array[][2] = {
+	{0x00001030, 0x00000160},
+	{0x00001070, 0x0000018c},
+	{0x000010b0, 0x00003e38},
+	{0x000010f0, 0x00000000},
+	{0x00008014, 0x08400b00},
+	{0x0000801c, 0x12e0002b},
+	{0x00008318, 0x00003440},
+	{0x00009804, 0x00000300},
+	{0x00009820, 0x02020200},
+	{0x00009824, 0x01000e0e},
+	{0x00009828, 0x3a020001},
+	{0x00009834, 0x00000e0e},
+	{0x00009838, 0x00000007},
+	{0x00009840, 0x206a012e},
+	{0x00009844, 0x03721620},
+	{0x00009848, 0x00001053},
+	{0x0000a848, 0x00001053},
+	{0x00009850, 0x6d4000e2},
+	{0x00009858, 0x7ec84d2e},
+	{0x0000985c, 0x3137605e},
+	{0x00009860, 0x00058d18},
+	{0x00009864, 0x0001ce00},
+	{0x00009868, 0x5ac640d0},
+	{0x0000986c, 0x06903881},
+	{0x00009910, 0x30002310},
+	{0x00009914, 0x00000898},
+	{0x00009918, 0x0000000b},
+	{0x00009924, 0xd00a800d},
+	{0x00009944, 0xffbc1020},
+	{0x00009960, 0x00000000},
+	{0x00009964, 0x00000000},
+	{0x000099b8, 0x0000421c},
+	{0x000099bc, 0x00000c00},
+	{0x000099c0, 0x05eea6d4},
+	{0x000099c4, 0x06336f77},
+	{0x000099c8, 0x6af6532f},
+	{0x000099cc, 0x08f186c8},
+	{0x000099d0, 0x00046384},
+	{0x000099d4, 0x00000000},
+	{0x000099d8, 0x00000000},
+	{0x00009a00, 0x00058084},
+	{0x00009a04, 0x00058088},
+	{0x00009a08, 0x0005808c},
+	{0x00009a0c, 0x00058100},
+	{0x00009a10, 0x00058104},
+	{0x00009a14, 0x00058108},
+	{0x00009a18, 0x0005810c},
+	{0x00009a1c, 0x00058110},
+	{0x00009a20, 0x00058114},
+	{0x00009a24, 0x00058180},
+	{0x00009a28, 0x00058184},
+	{0x00009a2c, 0x00058188},
+	{0x00009a30, 0x0005818c},
+	{0x00009a34, 0x00058190},
+	{0x00009a38, 0x00058194},
+	{0x00009a3c, 0x000581a0},
+	{0x00009a40, 0x0005820c},
+	{0x00009a44, 0x000581a8},
+	{0x00009a48, 0x00058284},
+	{0x00009a4c, 0x00058288},
+	{0x00009a50, 0x00058224},
+	{0x00009a54, 0x00058290},
+	{0x00009a58, 0x00058300},
+	{0x00009a5c, 0x00058304},
+	{0x00009a60, 0x00058308},
+	{0x00009a64, 0x0005830c},
+	{0x00009a68, 0x00058380},
+	{0x00009a6c, 0x00058384},
+	{0x00009a70, 0x00068700},
+	{0x00009a74, 0x00068704},
+	{0x00009a78, 0x00068708},
+	{0x00009a7c, 0x0006870c},
+	{0x00009a80, 0x00068780},
+	{0x00009a84, 0x00068784},
+	{0x00009a88, 0x00078b00},
+	{0x00009a8c, 0x00078b04},
+	{0x00009a90, 0x00078b08},
+	{0x00009a94, 0x00078b0c},
+	{0x00009a98, 0x00078b80},
+	{0x00009a9c, 0x00078b84},
+	{0x00009aa0, 0x00078b88},
+	{0x00009aa4, 0x00078b8c},
+	{0x00009aa8, 0x00078b90},
+	{0x00009aac, 0x000caf80},
+	{0x00009ab0, 0x000caf84},
+	{0x00009ab4, 0x000caf88},
+	{0x00009ab8, 0x000caf8c},
+	{0x00009abc, 0x000caf90},
+	{0x00009ac0, 0x000db30c},
+	{0x00009ac4, 0x000db310},
+	{0x00009ac8, 0x000db384},
+	{0x00009acc, 0x000db388},
+	{0x00009ad0, 0x000db324},
+	{0x00009ad4, 0x000eb704},
+	{0x00009ad8, 0x000eb6a4},
+	{0x00009adc, 0x000eb6a8},
+	{0x00009ae0, 0x000eb710},
+	{0x00009ae4, 0x000eb714},
+	{0x00009ae8, 0x000eb720},
+	{0x00009aec, 0x000eb724},
+	{0x00009af0, 0x000eb728},
+	{0x00009af4, 0x000eb72c},
+	{0x00009af8, 0x000eb7a0},
+	{0x00009afc, 0x000eb7a4},
+	{0x00009b00, 0x000eb7a8},
+	{0x00009b04, 0x000eb7b0},
+	{0x00009b08, 0x000eb7b4},
+	{0x00009b0c, 0x000eb7b8},
+	{0x00009b10, 0x000eb7a5},
+	{0x00009b14, 0x000eb7a9},
+	{0x00009b18, 0x000eb7ad},
+	{0x00009b1c, 0x000eb7b1},
+	{0x00009b20, 0x000eb7b5},
+	{0x00009b24, 0x000eb7b9},
+	{0x00009b28, 0x000eb7c5},
+	{0x00009b2c, 0x000eb7c9},
+	{0x00009b30, 0x000eb7d1},
+	{0x00009b34, 0x000eb7d5},
+	{0x00009b38, 0x000eb7d9},
+	{0x00009b3c, 0x000eb7c6},
+	{0x00009b40, 0x000eb7ca},
+	{0x00009b44, 0x000eb7ce},
+	{0x00009b48, 0x000eb7d2},
+	{0x00009b4c, 0x000eb7d6},
+	{0x00009b50, 0x000eb7c3},
+	{0x00009b54, 0x000eb7c7},
+	{0x00009b58, 0x000eb7cb},
+	{0x00009b5c, 0x000eb7cf},
+	{0x00009b60, 0x000eb7d7},
+	{0x00009b64, 0x000eb7db},
+	{0x00009b68, 0x000eb7db},
+	{0x00009b6c, 0x000eb7db},
+	{0x00009b70, 0x000eb7db},
+	{0x00009b74, 0x000eb7db},
+	{0x00009b78, 0x000eb7db},
+	{0x00009b7c, 0x000eb7db},
+	{0x00009b80, 0x000eb7db},
+	{0x00009b84, 0x000eb7db},
+	{0x00009b88, 0x000eb7db},
+	{0x00009b8c, 0x000eb7db},
+	{0x00009b90, 0x000eb7db},
+	{0x00009b94, 0x000eb7db},
+	{0x00009b98, 0x000eb7db},
+	{0x00009b9c, 0x000eb7db},
+	{0x00009ba0, 0x000eb7db},
+	{0x00009ba4, 0x000eb7db},
+	{0x00009ba8, 0x000eb7db},
+	{0x00009bac, 0x000eb7db},
+	{0x00009bb0, 0x000eb7db},
+	{0x00009bb4, 0x000eb7db},
+	{0x00009bb8, 0x000eb7db},
+	{0x00009bbc, 0x000eb7db},
+	{0x00009bc0, 0x000eb7db},
+	{0x00009bc4, 0x000eb7db},
+	{0x00009bc8, 0x000eb7db},
+	{0x00009bcc, 0x000eb7db},
+	{0x00009bd0, 0x000eb7db},
+	{0x00009bd4, 0x000eb7db},
+	{0x00009bd8, 0x000eb7db},
+	{0x00009bdc, 0x000eb7db},
+	{0x00009be0, 0x000eb7db},
+	{0x00009be4, 0x000eb7db},
+	{0x00009be8, 0x000eb7db},
+	{0x00009bec, 0x000eb7db},
+	{0x00009bf0, 0x000eb7db},
+	{0x00009bf4, 0x000eb7db},
+	{0x00009bf8, 0x000eb7db},
+	{0x00009bfc, 0x000eb7db},
+	{0x0000aa00, 0x00058084},
+	{0x0000aa04, 0x00058088},
+	{0x0000aa08, 0x0005808c},
+	{0x0000aa0c, 0x00058100},
+	{0x0000aa10, 0x00058104},
+	{0x0000aa14, 0x00058108},
+	{0x0000aa18, 0x0005810c},
+	{0x0000aa1c, 0x00058110},
+	{0x0000aa20, 0x00058114},
+	{0x0000aa24, 0x00058180},
+	{0x0000aa28, 0x00058184},
+	{0x0000aa2c, 0x00058188},
+	{0x0000aa30, 0x0005818c},
+	{0x0000aa34, 0x00058190},
+	{0x0000aa38, 0x00058194},
+	{0x0000aa3c, 0x000581a0},
+	{0x0000aa40, 0x0005820c},
+	{0x0000aa44, 0x000581a8},
+	{0x0000aa48, 0x00058284},
+	{0x0000aa4c, 0x00058288},
+	{0x0000aa50, 0x00058224},
+	{0x0000aa54, 0x00058290},
+	{0x0000aa58, 0x00058300},
+	{0x0000aa5c, 0x00058304},
+	{0x0000aa60, 0x00058308},
+	{0x0000aa64, 0x0005830c},
+	{0x0000aa68, 0x00058380},
+	{0x0000aa6c, 0x00058384},
+	{0x0000aa70, 0x00068700},
+	{0x0000aa74, 0x00068704},
+	{0x0000aa78, 0x00068708},
+	{0x0000aa7c, 0x0006870c},
+	{0x0000aa80, 0x00068780},
+	{0x0000aa84, 0x00068784},
+	{0x0000aa88, 0x00078b00},
+	{0x0000aa8c, 0x00078b04},
+	{0x0000aa90, 0x00078b08},
+	{0x0000aa94, 0x00078b0c},
+	{0x0000aa98, 0x00078b80},
+	{0x0000aa9c, 0x00078b84},
+	{0x0000aaa0, 0x00078b88},
+	{0x0000aaa4, 0x00078b8c},
+	{0x0000aaa8, 0x00078b90},
+	{0x0000aaac, 0x000caf80},
+	{0x0000aab0, 0x000caf84},
+	{0x0000aab4, 0x000caf88},
+	{0x0000aab8, 0x000caf8c},
+	{0x0000aabc, 0x000caf90},
+	{0x0000aac0, 0x000db30c},
+	{0x0000aac4, 0x000db310},
+	{0x0000aac8, 0x000db384},
+	{0x0000aacc, 0x000db388},
+	{0x0000aad0, 0x000db324},
+	{0x0000aad4, 0x000eb704},
+	{0x0000aad8, 0x000eb6a4},
+	{0x0000aadc, 0x000eb6a8},
+	{0x0000aae0, 0x000eb710},
+	{0x0000aae4, 0x000eb714},
+	{0x0000aae8, 0x000eb720},
+	{0x0000aaec, 0x000eb724},
+	{0x0000aaf0, 0x000eb728},
+	{0x0000aaf4, 0x000eb72c},
+	{0x0000aaf8, 0x000eb7a0},
+	{0x0000aafc, 0x000eb7a4},
+	{0x0000ab00, 0x000eb7a8},
+	{0x0000ab04, 0x000eb7b0},
+	{0x0000ab08, 0x000eb7b4},
+	{0x0000ab0c, 0x000eb7b8},
+	{0x0000ab10, 0x000eb7a5},
+	{0x0000ab14, 0x000eb7a9},
+	{0x0000ab18, 0x000eb7ad},
+	{0x0000ab1c, 0x000eb7b1},
+	{0x0000ab20, 0x000eb7b5},
+	{0x0000ab24, 0x000eb7b9},
+	{0x0000ab28, 0x000eb7c5},
+	{0x0000ab2c, 0x000eb7c9},
+	{0x0000ab30, 0x000eb7d1},
+	{0x0000ab34, 0x000eb7d5},
+	{0x0000ab38, 0x000eb7d9},
+	{0x0000ab3c, 0x000eb7c6},
+	{0x0000ab40, 0x000eb7ca},
+	{0x0000ab44, 0x000eb7ce},
+	{0x0000ab48, 0x000eb7d2},
+	{0x0000ab4c, 0x000eb7d6},
+	{0x0000ab50, 0x000eb7c3},
+	{0x0000ab54, 0x000eb7c7},
+	{0x0000ab58, 0x000eb7cb},
+	{0x0000ab5c, 0x000eb7cf},
+	{0x0000ab60, 0x000eb7d7},
+	{0x0000ab64, 0x000eb7db},
+	{0x0000ab68, 0x000eb7db},
+	{0x0000ab6c, 0x000eb7db},
+	{0x0000ab70, 0x000eb7db},
+	{0x0000ab74, 0x000eb7db},
+	{0x0000ab78, 0x000eb7db},
+	{0x0000ab7c, 0x000eb7db},
+	{0x0000ab80, 0x000eb7db},
+	{0x0000ab84, 0x000eb7db},
+	{0x0000ab88, 0x000eb7db},
+	{0x0000ab8c, 0x000eb7db},
+	{0x0000ab90, 0x000eb7db},
+	{0x0000ab94, 0x000eb7db},
+	{0x0000ab98, 0x000eb7db},
+	{0x0000ab9c, 0x000eb7db},
+	{0x0000aba0, 0x000eb7db},
+	{0x0000aba4, 0x000eb7db},
+	{0x0000aba8, 0x000eb7db},
+	{0x0000abac, 0x000eb7db},
+	{0x0000abb0, 0x000eb7db},
+	{0x0000abb4, 0x000eb7db},
+	{0x0000abb8, 0x000eb7db},
+	{0x0000abbc, 0x000eb7db},
+	{0x0000abc0, 0x000eb7db},
+	{0x0000abc4, 0x000eb7db},
+	{0x0000abc8, 0x000eb7db},
+	{0x0000abcc, 0x000eb7db},
+	{0x0000abd0, 0x000eb7db},
+	{0x0000abd4, 0x000eb7db},
+	{0x0000abd8, 0x000eb7db},
+	{0x0000abdc, 0x000eb7db},
+	{0x0000abe0, 0x000eb7db},
+	{0x0000abe4, 0x000eb7db},
+	{0x0000abe8, 0x000eb7db},
+	{0x0000abec, 0x000eb7db},
+	{0x0000abf0, 0x000eb7db},
+	{0x0000abf4, 0x000eb7db},
+	{0x0000abf8, 0x000eb7db},
+	{0x0000abfc, 0x000eb7db},
+	{0x0000a204, 0x00000004},
+	{0x0000a20c, 0x0001f000},
+	{0x0000b20c, 0x0001f000},
+	{0x0000a21c, 0x1883800a},
+	{0x0000a230, 0x00000108},
+	{0x0000a250, 0x0004a000},
+	{0x0000a358, 0x7999aa0e}
+};
 
 /**
@@ -362,6 +680,32 @@
 	{0x0000833c, 0x00000000},
 	{0x00008340, 0x00010380},
-	{0x00008344, 0x00581043},
+	{0x00008344, 0x00581003},/*< note: disabled ADHOC_MCAST_KEYID feature */
 	{0x00007010, 0x00000030},
+	{0x00007034, 0x00000002},
+	{0x00007038, 0x000004c2},
+	{0x00007800, 0x00140000},
+	{0x00007804, 0x0e4548d8},
+	{0x00007808, 0x54214514},
+	{0x0000780c, 0x02025820},
+	{0x00007810, 0x71c0d388},
+	{0x00007814, 0x924934a8},
+	{0x0000781c, 0x00000000},
+	{0x00007828, 0x66964300},
+	{0x0000782c, 0x8db6d961},
+	{0x00007830, 0x8db6d96c},
+	{0x00007834, 0x6140008b},
+	{0x0000783c, 0x72ee0a72},
+	{0x00007840, 0xbbfffffc},
+	{0x00007844, 0x000c0db6},
+	{0x00007848, 0x6db6246f},
+	{0x0000784c, 0x6d9b66db},
+	{0x00007850, 0x6d8c6dba},
+	{0x00007854, 0x00040000},
+	{0x00007858, 0xdb003012},
+	{0x0000785c, 0x04924914},
+	{0x00007860, 0x21084210},
+	{0x00007864, 0xf7d7ffde},
+	{0x00007868, 0xc2034080},
+	{0x00007870, 0x10142c00},
 	{0x00009808, 0x00000000},
 	{0x0000980c, 0xafe68e30},
Index: uspace/drv/bus/usb/ar9271/hw.c
===================================================================
--- uspace/drv/bus/usb/ar9271/hw.c	(revision 56c0930934f3eb8763355d11f38eb65b6896d53e)
+++ uspace/drv/bus/usb/ar9271/hw.c	(revision 4cb0148f513840557c24fabe8b6c9b7fe5b13ef0)
@@ -342,16 +342,4 @@
 }
 
-static uint32_t hw_reverse_bits(uint32_t value, uint32_t count)
-{
-	uint32_t ret_val = 0;
-	
-	for(size_t i = 0; i < count; i++) {
-		ret_val = (ret_val << 1) | (value & 1);
-		value >>= 1;
-	}
-	
-	return ret_val;
-}
-
 static int hw_set_freq(ar9271_t *ar9271, uint16_t freq)
 {
@@ -372,10 +360,11 @@
 	
 	/* Some magic here. */
-	uint32_t channel = hw_reverse_bits(
-		(((((freq - 672) * 2 - 3040) / 10) << 2) & 0xFF), 8);
-	uint32_t to_write = (channel << 8) | 33;
-	
-	wmi_reg_write(ar9271->htc_device, AR9271_PHY_BASE + (0x37 << 2),
-		to_write);
+	uint32_t synth_ctl;
+	wmi_reg_read(ar9271->htc_device, AR9271_PHY_SYNTH_CONTROL, &synth_ctl);
+	synth_ctl &= 0xC0000000;
+	uint32_t channel_select = (freq * 0x10000) / 15;
+	synth_ctl = synth_ctl | (1 << 29) | (1 << 28) | channel_select;
+	
+	wmi_reg_write(ar9271->htc_device, AR9271_PHY_SYNTH_CONTROL, synth_ctl);
 	
 	ar9271->ieee80211_dev->current_freq = freq;
@@ -397,6 +386,5 @@
 	
 	filter_bits |= AR9271_RX_FILTER_UNI | AR9271_RX_FILTER_MULTI | 
-		AR9271_RX_FILTER_BROAD | AR9271_RX_FILTER_BEACON | 
-		AR9271_RX_FILTER_MYBEACON | AR9271_RX_FILTER_PROMISCUOUS;
+		AR9271_RX_FILTER_BROAD | AR9271_RX_FILTER_PROMISCUOUS;
 	
 	rc = wmi_reg_write(ar9271->htc_device, AR9271_RX_FILTER, filter_bits);
@@ -423,4 +411,7 @@
 		return EINVAL;
 	}
+	
+	wmi_reg_write(ar9271->htc_device, AR9271_MULTICAST_FILTER1, ~0);
+	wmi_reg_write(ar9271->htc_device, AR9271_MULTICAST_FILTER2, ~0);
 	
 	return EOK;
@@ -447,10 +438,34 @@
 	pll = (0x5 << 10) & 0x00003C00;
 	pll |= (0x2 << 14) & 0x0000C000; /**< 0x2 ~ quarter rate (0x1 half) */
-	pll |= 0x58 & 0x000003FF;
+	pll |= 0x2C & 0x000003FF;
 	
 	return wmi_reg_write(ar9271->htc_device, AR9271_RTC_PLL_CONTROL, pll);
 }
 
-static int hw_calibrate(ar9271_t *ar9271)
+static int hw_set_init_values(ar9271_t *ar9271)
+{
+	uint32_t reg_offset, reg_value;
+	
+	int size = 
+		sizeof(ar9271_2g_mode_array) / 	sizeof(ar9271_2g_mode_array[0]);
+	
+	for(int i = 0; i < size; i++) {
+		reg_offset = ar9271_2g_mode_array[i][0];
+		reg_value = ar9271_2g_mode_array[i][1];
+		wmi_reg_write(ar9271->htc_device, reg_offset, reg_value);
+	}
+	
+	size = sizeof(ar9271_init_array) / sizeof(ar9271_init_array[0]);
+	
+	for(int i = 0; i < size; i++) {
+		reg_offset = ar9271_init_array[i][0];
+		reg_value = ar9271_init_array[i][1];
+		wmi_reg_write(ar9271->htc_device, reg_offset, reg_value);
+	}
+	
+	return EOK;
+}
+
+static int hw_calibration(ar9271_t *ar9271)
 {
 	wmi_reg_set_bit(ar9271->htc_device, AR9271_CARRIER_LEAK_CONTROL,
@@ -482,13 +497,14 @@
 }
 
-static int hw_set_init_values(ar9271_t *ar9271)
-{
-	int size = sizeof(ar9271_init_array) / sizeof(ar9271_init_array[0]);
-	
-	for(int i = 0; i < size; i++) {
-		uint32_t reg_offset = ar9271_init_array[i][0];
-		uint32_t reg_value = ar9271_init_array[i][1];
-		wmi_reg_write(ar9271->htc_device, reg_offset, reg_value);
-	}
+static int hw_noise_floor_calibration(ar9271_t *ar9271)
+{
+	wmi_reg_set_bit(ar9271->htc_device, AR9271_AGC_CONTROL, 
+		AR9271_AGC_CONTROL_NF_CALIB_EN);
+	
+	wmi_reg_clear_bit(ar9271->htc_device, AR9271_AGC_CONTROL, 
+		AR9271_AGC_CONTROL_NF_NOT_UPDATE);
+	
+	wmi_reg_set_bit(ar9271->htc_device, AR9271_AGC_CONTROL, 
+		AR9271_AGC_CONTROL_NF_CALIB);
 	
 	return EOK;
@@ -554,12 +570,10 @@
 	
 	/* Set physical layer mode. */
-	rc = wmi_reg_write(ar9271->htc_device, AR9271_PHY_MODE,
-		AR9271_PHY_MODE_DYNAMIC | AR9271_PHY_MODE_2G);
+	rc = wmi_reg_write(ar9271->htc_device, AR9271_PHY_MODE, 
+		AR9271_PHY_MODE_DYNAMIC);
 	if(rc != EOK) {
 		usb_log_error("Failed to set physical layer mode.\n");
 		return rc;
 	}
-	
-	/* TODO: Init EEPROM here. */
 	
 	/* Set device operating mode. */
@@ -571,5 +585,5 @@
 	
 	/* Set channel frequency. */
-	rc = hw_set_freq(ar9271, IEEE80211_FIRST_FREQ);
+	rc = hw_set_freq(ar9271, 2437);
 	if(rc != EOK) {
 		usb_log_error("Failed to set channel.\n");
@@ -591,6 +605,4 @@
 	/* TODO: Maybe resetting TX queues will be necessary afterwards here. */
 	
-	/* TODO: Setting RX, TX timeouts and others may be necessary here. */
-	
 	/* Activate physical layer. */
 	rc = hw_activate_phy(ar9271);
@@ -601,7 +613,13 @@
 	
 	/* Calibration. */
-	rc = hw_calibrate(ar9271);
+	rc = hw_calibration(ar9271);
 	if(rc != EOK) {
 		usb_log_error("Failed to calibrate device.\n");
+		return rc;
+	}
+	
+	rc = hw_noise_floor_calibration(ar9271);
+	if(rc != EOK) {
+		usb_log_error("Failed to calibrate noise floor.\n");
 		return rc;
 	}
