kumquat-buildroot/target/device/Atmel/arch-arm/u-boot/2009.01/u-boot-2009.01-011-spimux.patch
2009-01-23 19:41:42 +00:00

94 lines
2.8 KiB
Diff

diff -urN u-boot-2009.01-0rig//common/cmd_mux.c u-boot-2009.01/common/cmd_mux.c
--- u-boot-2009.01-0rig//common/cmd_mux.c 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-2009.01/common/cmd_mux.c 2009-01-04 00:17:19.000000000 +0100
@@ -0,0 +1,78 @@
+/*
+ * (C) Copyright 2008
+ * Ulf Samuelsson <ulf.samuelsson@atmel.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#if (defined(CONFIG_AT91RM9200DK) || defined(CONFIG_AT91RM9200EK) || defined(CONFIG_AT91RM9200DF))
+
+#include <asm/arch/AT91RM9200.h>
+#include <dataflash.h>
+#include <at45.h>
+
+
+static int mmc_nspi (const char *s)
+{
+ if (strcmp(s, "mmc") == 0) {
+ return (1);
+ } else if (strcmp(s, "spi") == 0) {
+ return (0);
+ }
+ return (-1);
+}
+
+int do_mux ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ switch (argc) {
+ case 2: /* on / off */
+ switch (mmc_nspi(argv[1])) {
+#if 0 /* prevented by varargs handling; FALLTROUGH is harmless, too */
+ default: printf ("Usage:\n%s\n", cmdtp->usage);
+ return;
+#endif
+ case 0: AT91F_SelectSPI ();
+ break;
+ case 1: AT91F_SelectMMC ();
+ break;
+ }
+ /* FALL TROUGH */
+ case 1: /* get status */
+ printf ("Mux is configured to be %s\n",
+ AT91F_GetMuxStatus() ? "MMC" : "SPI");
+ return 0;
+ default:
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+ return 0;
+}
+
+
+U_BOOT_CMD(
+ mux, 2, 1, do_mux,
+ "mux\t- enable or disable MMC or SPI\n",
+ "[mmc, spi]\n"
+ " - enable or disable MMC or SPI\n"
+);
+
+#endif /* CONFIG_CMD_MUX */
+
diff -urN u-boot-2009.01-0rig//common/Makefile u-boot-2009.01/common/Makefile
--- u-boot-2009.01-0rig//common/Makefile 2009-01-04 00:10:28.000000000 +0100
+++ u-boot-2009.01/common/Makefile 2009-01-04 00:20:39.000000000 +0100
@@ -112,6 +112,7 @@
COBJS-$(CONFIG_CMD_MISC) += cmd_misc.o
COBJS-$(CONFIG_CMD_MMC) += cmd_mmc.o
COBJS-$(CONFIG_MP) += cmd_mp.o
+COBJS-$(CONFIG_CMD_AT91_SPIMUX) += cmd_mux.o
COBJS-y += cmd_nand.o
COBJS-$(CONFIG_CMD_NET) += cmd_net.o
COBJS-$(CONFIG_CMD_ONENAND) += cmd_onenand.o