Versatile memory controller