Silicon Valley company has received millions in donations from Tesla chief’s foundation