Initially you can only build farms on grassland, plains, floodplain or tundra that is directly adjacent to fresh water (a river or lake). When you invent civil service you can build farms adjacent to each other, as long as the chain starts at fresh water. (N.B. While you can farm riverside tundra, you can never build farms on tundra which is not adjacent to fresh water).
With biology you can build farms on any flat land except snow, desert, and non-riverside tundra. It's still worth ensuring the farms are irrigated at this stage, by having the chain connect to fresh water, as they then generate two extra food instead of one once you have biology.