Preheat oven to 375 degrees F. and oil a 9 inch square baking pan.
Combine the dried mushrooms and 1 cup of boiling water. Soak for 20 minutes. Take out the mushrooms, squeezing out the excess moisture into the bowl. Keep the soaking liquid for later use in the dish. Cut off and throw away the stems. Chop the tops and hold for later.
Prepare the corn kernels if using fresh corn and hold for later.
Boil a large pan of water; salt after coming to a boil and add the sweet potatoes. Cook about 12 minutes until soft. Drain and add 2 tablespoons of butter; mash. Stir in the scallions; season with salt and pepper. Hold for use later.
Melt 1 tablespoon butter in large skillet over medium heat. Add the portobellos and onion and saute; stir frequently until fully cooked (about 8 minutes.) Add the garlic, cardamom, nutmeg and cinnamon and saute for another minute. Add the flour; stir to coat vegetables. Slowly add the reserved mushroom liquid, leave any sediment in the bowl; add one cup of water and stir constantly. Simmer and cook until thickened, 2 to 3 minutes. Add the corn and cook for another minute. Take off heat and stir in the dried mushrooms and walnuts. Season with salt and pepper.
Place the mushroom mixture to the prepared dish and spread evenly. Top with the sweet potatoes, smoothing the top. Bake until bubbly and browned on top, about 25 minutes. Serve immediately. Can be made up to 2 days ahead, up to point of baking, and refrigerated, but add about 5-10 minutes to baking time.