Convert CONFIG_SYS_NONCACHED_MEMORY to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NONCACHED_MEMORY

To do this we introduce CONFIG_SYS_HAS_NONCACHED_MEMORY as a bool to
gate if we are going to have noncached_... functions available and then
continue to use CONFIG_SYS_NONCACHED_MEMORY to store the size of said
cache. We make this new option depend on both the architectures which
implement support and the drivers which make use of it.

Cc: Tom Warren <twarren@nvidia.com>
Cc: Mingming lee <mingming.lee@mediatek.com>
Cc: "Ying-Chun Liu (PaulLiu)" <paul.liu@linaro.org>
Cc: Alban Bedel <alban.bedel@avionic-design.de>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Allen Martin <amartin@nvidia.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/arch/Kconfig b/arch/Kconfig
index e3a456a..ae39716 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -438,6 +438,30 @@
 	  normal CP15 init (such as enabling the instruction cache) is still
 	  performed.
 
+config SYS_HAS_NONCACHED_MEMORY
+	bool "Enable reserving a non-cached memory area for drivers"
+	depends on (ARM || MIPS) && (RTL8169 || MEDIATEK_ETH)
+	help
+	  This is useful for drivers that would otherwise require a lot of
+	  explicit cache maintenance. For some drivers it's also impossible to
+	  properly maintain the cache. For example if the regions that need to
+	  be flushed are not a multiple of the cache-line size, *and* padding
+	  cannot be allocated between the regions to align them (i.e.  if the
+	  HW requires a contiguous array of regions, and the size of each
+	  region is not cache-aligned), then a flush of one region may result
+	  in overwriting data that hardware has written to another region in
+	  the same cache-line. This can happen for example in network drivers
+	  where descriptors for buffers are typically smaller than the CPU
+	  cache-line (e.g.  16 bytes vs. 32 or 64 bytes).
+
+config SYS_NONCACHED_MEMORY
+	hex "Size in bytes of the non-cached memory area"
+	depends on SYS_HAS_NONCACHED_MEMORY
+	default 0x100000
+	help
+	  Size of non-cached memory area. This area of memory will be typically
+	  located right below the malloc() area and mapped uncached in the MMU.
+
 source "arch/arc/Kconfig"
 source "arch/arm/Kconfig"
 source "arch/m68k/Kconfig"