Module Name:    src
Committed By:   jmcneill
Date:           Sat Aug  8 10:51:40 UTC 2015

Modified Files:
        src/sys/arch/arm/amlogic: amlogic_board.c

Log Message:
don't rely on u-boot to setup CARD and BOOT pins


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/amlogic/amlogic_board.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/amlogic/amlogic_board.c
diff -u src/sys/arch/arm/amlogic/amlogic_board.c:1.13 src/sys/arch/arm/amlogic/amlogic_board.c:1.14
--- src/sys/arch/arm/amlogic/amlogic_board.c:1.13	Tue Aug  4 01:23:07 2015
+++ src/sys/arch/arm/amlogic/amlogic_board.c	Sat Aug  8 10:51:40 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_board.c,v 1.13 2015/08/04 01:23:07 jmcneill Exp $ */
+/* $NetBSD: amlogic_board.c,v 1.14 2015/08/08 10:51:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca>
@@ -29,7 +29,7 @@
 #include "opt_amlogic.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amlogic_board.c,v 1.13 2015/08/04 01:23:07 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amlogic_board.c,v 1.14 2015/08/08 10:51:40 jmcneill Exp $");
 
 #define	_ARM32_BUS_DMA_PRIVATE
 #include <sys/param.h>
@@ -235,6 +235,11 @@ amlogic_sdhc_select_port(int port)
 {
 	switch (port) {
 	case AMLOGIC_SDHC_PORT_B:
+		/* Set CARD 0-5 to input */
+		CBUS_SET_CLEAR(PAD_PULL_UP_2_REG, 0x03f00000, 0);
+		CBUS_SET_CLEAR(PAD_PULL_UP_EN_2_REG, 0x03f00000, 0);
+		CBUS_SET_CLEAR(PREG_PAD_GPIO0_EN_N_REG, 0x0fc00000, 0);
+
 		/* CARD -> SDHC pin mux settings */
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_5_REG, 0, 0x00007c00);
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_4_REG, 0, 0x7c000000);
@@ -248,6 +253,11 @@ amlogic_sdhc_select_port(int port)
 		CBUS_SET_CLEAR(PREG_PAD_GPIO5_EN_N_REG, 0, 0x80000000);
 		break;
 	case AMLOGIC_SDHC_PORT_C:
+		/* Set BOOT 0-8,10 to input */
+		CBUS_SET_CLEAR(PAD_PULL_UP_2_REG, 0x000005ff, 0);
+		CBUS_SET_CLEAR(PAD_PULL_UP_EN_2_REG, 0x000005ff, 0);
+		CBUS_SET_CLEAR(PREG_PAD_GPIO3_EN_N_REG, 0x000005ff, 0);
+
 		/* BOOT -> SDHC pin mux settings */
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_2_REG, 0, 0x04c000f0);
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_5_REG, 0, 0x00007c00);
@@ -348,6 +358,11 @@ amlogic_sdio_select_port(int port)
 {
 	switch (port) {
 	case AMLOGIC_SDIO_PORT_B:
+		/* Set CARD 0-5 to input */
+		CBUS_SET_CLEAR(PAD_PULL_UP_2_REG, 0x03f00000, 0);
+		CBUS_SET_CLEAR(PAD_PULL_UP_EN_2_REG, 0x03f00000, 0);
+		CBUS_SET_CLEAR(PREG_PAD_GPIO0_EN_N_REG, 0x0fc00000, 0);
+
 		/* CARD -> SDIO pin mux settings */
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_6_REG, 0, 0x3f000000);
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_8_REG, 0, 0x0000063f);
@@ -360,6 +375,13 @@ amlogic_sdio_select_port(int port)
 		CBUS_SET_CLEAR(PREG_PAD_GPIO5_EN_N_REG, 0, 0x80000000);
 		break;
 	case AMLOGIC_SDIO_PORT_C:
+		delay(100);
+
+		/* Set BOOT 0-8,10 to input */
+		CBUS_SET_CLEAR(PAD_PULL_UP_2_REG, 0x0000050f, 0);
+		CBUS_SET_CLEAR(PAD_PULL_UP_EN_2_REG, 0x0000050f, 0);
+		CBUS_SET_CLEAR(PREG_PAD_GPIO3_EN_N_REG, 0x0000050f, 0);
+
 		/* BOOT -> SDIO pin mux settings */
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_2_REG, 0, 0x06c2fc00);
 		CBUS_SET_CLEAR(PERIPHS_PIN_MUX_8_REG, 0, 0x0000003f);

Reply via email to