Now that I've have time to read the whole of Bob Gates' memoir, Duty, I think some of the earlier reporting was misleading. Oft-quoted was the passage where Gates thinks to himself that Obama didn't believe in his own Afghanistan policy and distrusted his generals. Also in the book are several times when Gates admits that it looked as if the military was "jamming" the President or otherwise trying to force the president to accept their preferred policies. He denies that was the intent, but acknowledges that such an interpretation was possible.
Especially during the Afghanistan policy review in 2009, regional U.S. commanders and some of the JCS made troop requests or other public comments that embarrassed the White House. Gates blames much of this on "the notion that modern military leaders should also be 'strategic communicators.'"
Seemingly caught in the middle, Gates says one of his major tasks was to help manage the civil-military relationship "to ensure that the president listens to professional military advice that he may not want to hear, and that senior officers offer their best and most candid advice and obey loyally, especially when they are overruled." I think that's the right position for a SecDef and Gates did a reasonable, though not always successful, job of it.
On the other hand, the Obama people -- from Gates and other evidence -- were too ready to distrust the military [as Rumsfeld was in 2001 because the leaders had been chosen by the previous administration] and too slow to develop good working partnerships with them.