Preparing the salt cod: Three days prior to cooking, soak the pieces of salt cod in a large pan with cold water. Cover the pan tightly with aluminum foil and place in the refrigerator for three days to rehydrate the fish and remove the salt. Be sure to flip the pieces of fish occasionally and replace the water every 8 hours. Immediately before cooking, rinse the cod with cold water and pat dry to remove any excess salt. Cut the salt cod into cubes about 2 inches long.
Pre-heat the oven to 355 degrees. Heat 2 tablespoons of olive oil in a large skillet over medium heat. Add the onions, a small ladle of water (about 2 ounces), and a pinch of salt. Once the onions are transparent, add the white wine and wait for it to evaporate. Next, add the tomatoes, garlic, parsley, and red pepper flakes and cook for 5 minutes. Add salt and pepper to taste. Remove the garlic and reserve 2 tablespoons of sauce then place the rest in a baking dish.
Meanwhile, in another pan heat the remaining olive oil and sauté the potato slices for 4 minutes. Then, add the potatoes to the baking dish with the tomatoes and stir.
Place the salt cod in the baking dish on top of the layer of potatoes and tomatoes and top with the reserved sauce. Cover and bake for 20 minutes at 355 degrees. Serve immediately.