Home equity loan interest

I turned my primary home into a rental property mid year. Before it was a rental I took a home equity loan out on it and used that money for the purchase of our second home. Am I allowed to deduct the interest from the home equity loan along with the primary mortgage interest from the rental income?