Apple agrees to pay Ericsson a portion of its iPhone revenue in patent deal