[Xperia Z Original Android Development] DooMLoRD:
ok so examining your dmesg...

<4>[ 4149.051971] wlan: module is from the staging directory, the quality is unknown, you have been warned.
<6>[ 4149.066558] wlan: loading driver v3.2.6.007a
<3>[ 4149.071594] wlan: [30261:E :HDD] hdd_apply_cfg_ini: Reg Parameter gEmptyScanRefreshPeriod < allowed Minimum [0 < 1000]. Enforcing Default= 0
<3>[ 4149.086120] wlan: [30261:E :VOS] INFO: NV binary file version=1 Driver default NV version=1, continue...
<3>[ 4149.086120]
<6>[ 4149.086425] DefaultCountry is US
<6>[ 4149.093048] wlan: Invalid MAC addresses in NV, autogenerated 00:0a:f5:00:00:2c
<6>[ 4149.216949] wlan: WCNSS WLAN version 1.4.1.2
<6>[ 4149.217102] wlan: WCNSS software version AAAAAANAZW134005
<6>[ 4149.217224] wlan: WCNSS hardware version WCN v2.0 RadioPhy vIris_TSMC_2.0 with 48MHz XO
<6>[ 4149.264953] wlan: driver loaded
<6>[ 4149.306396] ADDRCONF(NETDEV_UP): p2p0: link is not ready
<3>[ 4149.306518] wlan: [30278:E :SME] PMC: STA not associated with an AP with single active session. BMPS cannot be entered
<6>[ 4149.701995] ADDRCONF(NETDEV_UP): wlan0: link is not ready
<3>[ 4149.702178] wlan: [30278:E :SME] PMC: STA not associated with an AP with single active session. BMPS cannot be entered

the above is exactly similar to what i get...

<4>[ 773.878540] wlan: module is from the staging directory, the quality is unknown, you have been warned.
<6>[ 773.903808] wlan: loading driver v3.2.6.007a
<3>[ 773.908294] wlan: [13714:E :HDD] hdd_apply_cfg_ini: Reg Parameter gEmptyScanRefreshPeriod < allowed Minimum [0 < 1000]. Enforcing Default= 0
<3>[ 773.920776] wlan: [13714:E :VOS] INFO: NV binary file version=1 Driver default NV version=1, continue...
<3>[ 773.920776]
<6>[ 773.921234] DefaultCountry is US
<6>[ 773.925323] wlan: Invalid MAC addresses in NV, autogenerated 00:0a:f5:00:00:2c
<6>[ 774.049774] wlan: WCNSS WLAN version 1.4.1.2
<6>[ 774.050292] wlan: WCNSS software version AAAAAANAZW134005
<6>[ 774.050506] wlan: WCNSS hardware version WCN v2.0 RadioPhy vIris_TSMC_2.0 with 48MHz XO
<6>[ 774.092987] wlan: driver loaded
<6>[ 774.175659] ADDRCONF(NETDEV_UP): p2p0: link is not ready
<3>[ 774.175781] wlan: [13779:E :SME] PMC: STA not associated with an AP with single active session. BMPS cannot be entered
<6>[ 774.700347] ADDRCONF(NETDEV_UP): wlan0: link is not ready
<3>[ 774.700469] wlan: [13779:E :SME] PMC: STA not associated with an AP with single active session. BMPS cannot be entered

interesting part is (on my device):

<3>[ 776.895233] wlan: [13753:E :PE ] wlan_cfgGetInt: 323: Not valid cfg id 1
<6>[ 776.904724] wlan: connected to 00:3a:99:a9:33:39
<6>[ 776.904846] wlan(1) 00:3a:99:a9:33:39 Standalone
[B][I]<6>[ 776.905273] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready[/I][/B]
<3>[ 777.027648] wlan: [13779:F :HDD] wlan_hdd_cfg80211_set_pmksa: Adding a new cache entry 0.
<3>[ 777.027740] wlan: [13779:F :HDD] wlan_hdd_cfg80211_set_pmksa: Calling csrRoamSetPMKIDCache with 1 cache entries.
<3>[ 777.035858] wlan: [13779:E :SME] sme_FTUpdateKey: Unhandled state=0
<3>[ 777.036682] wlan: [13779:E :SME] sme_FTUpdateKey: Unhandled state=0

<6>[ 776.905273] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

now i have a feeling that some module on ur device is not loading properly (cfg80211 specifically)...

e.g.:

this is the live module list on my device when wifi is off!

shell@android:/ $ lsmod
lsmod
cfg80211 116973 0 - Live 0x00000000
hid_sony 2254 0 - Live 0x00000000
exfat_fs 16329 0 - Live 0x00000000
exfat_core 72601 1 exfat_fs, Live 0x00000000
shell@android:/ $ uname -a
uname -a
Linux localhost 3.4.0-DooMKernel #16 SMP PREEMPT Fri Sep 13 05:23:06 IST 2013 armv7l GNU/Linux
shell@android:/ $

this is the live module list on my device when wifi is on!

shell@android:/ $ lsmod
lsmod
wlan 2601298 0 - Live 0x00000000 (C)
cfg80211 116973 1 wlan, Live 0x00000000
hid_sony 2254 0 - Live 0x00000000
exfat_fs 16329 0 - Live 0x00000000
exfat_core 72601 1 exfat_fs, Live 0x00000000
shell@android:/ $ uname -a
uname -a
Linux localhost 3.4.0-DooMKernel #16 SMP PREEMPT Fri Sep 13 05:23:06 IST 2013 armv7l GNU/Linux
shell@android:/ $

can u check the live modules before and after you activate wifi? do this for both when you do it the first time (fresh boot) and when you do it again in same boot...