1.1 --- a/stage1/board.c Tue Jul 11 18:45:08 2017 +0200
1.2 +++ b/stage1/board.c Wed Jul 12 15:46:53 2017 +0200
1.3 @@ -31,6 +31,7 @@
1.4 #include "memory.h"
1.5 #include "sdram.h"
1.6 #include "cpm.h"
1.7 +#include "gpio.h"
1.8 #include "usb_boot_defines.h"
1.9
1.10 /* These arguments are initialised by usbboot and are defined in...
1.11 @@ -66,21 +67,70 @@
1.12
1.13 void gpio_init()
1.14 {
1.15 + void *gpio_port_base;
1.16 +
1.17 #ifdef CONFIG_CPU_JZ4730
1.18 /*
1.19 * Initialize SDRAM pins
1.20 */
1.21 - __gpio_as_emc();
1.22 +
1.23 + /* gpio_as_emc */
1.24 +
1.25 + gpio_port_base = jz4740_gpio_get_port((void *) GPIO_BASE, GPIO_PORT_EMC);
1.26 +
1.27 + jz4740_gpio_ctrl_update(gpio_port_base, GPIO_GPALR, 0xC0000000, 0x40000000);
1.28 + jz4740_gpio_ctrl_update(gpio_port_base, GPIO_GPAUR, 0x0000FFFF, 0x00005555);
1.29 #else
1.30 /*
1.31 - * Initialize NAND Flash Pins
1.32 - */
1.33 - __gpio_as_nand();
1.34 + Initialize NAND Flash Pins (gpio_as_nand)
1.35 + CS1#, CLE, ALE, FRE#, FWE#, FRB#, RDWE#/BUFD#
1.36 + */
1.37 +
1.38 + gpio_port_base = jz4740_gpio_get_port((void *) GPIO_BASE, 1);
1.39 +
1.40 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXFUNS, 0x02018000);
1.41 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXSELC, 0x02018000);
1.42 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXPES, 0x02018000);
1.43 +
1.44 + gpio_port_base = jz4740_gpio_get_port((void *) GPIO_BASE, 2);
1.45 +
1.46 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXFUNS, 0x30000000);
1.47 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXSELC, 0x30000000);
1.48 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXPES, 0x30000000);
1.49 +
1.50 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXFUNC, 0x40000000);
1.51 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXSELC, 0x40000000);
1.52 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXDIRC, 0x40000000);
1.53 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXPES, 0x40000000);
1.54 +
1.55 + gpio_port_base = jz4740_gpio_get_port((void *) GPIO_BASE, 1);
1.56 +
1.57 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXFUNS, 0x00400000);
1.58 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXSELC, 0x00400000);
1.59
1.60 /*
1.61 - * Initialize SDRAM pins
1.62 - */
1.63 - __gpio_as_sdram_16bit_4720();
1.64 + Initialize SDRAM pins (gpio_as_sdram_16bit_4720)
1.65 + D0 ~ D15, A0 ~ A16, DCS#, RAS#, CAS#, CKE#,
1.66 + RDWE#, CKO#, WE0#, WE1#
1.67 + */
1.68 +
1.69 + gpio_port_base = jz4740_gpio_get_port((void *) GPIO_BASE, 0);
1.70 +
1.71 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXFUNS, 0x5442bfaa);
1.72 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXSELC, 0x5442bfaa);
1.73 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXPES, 0x5442bfaa);
1.74 +
1.75 + gpio_port_base = jz4740_gpio_get_port((void *) GPIO_BASE, 1);
1.76 +
1.77 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXFUNS, 0x81f9ffff);
1.78 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXSELC, 0x81f9ffff);
1.79 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXPES, 0x81f9ffff);
1.80 +
1.81 + gpio_port_base = jz4740_gpio_get_port((void *) GPIO_BASE, 2);
1.82 +
1.83 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXFUNS, 0x01000000);
1.84 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXSELC, 0x01000000);
1.85 + jz4740_gpio_ctrl_set(gpio_port_base, GPIO_PXPES, 0x01000000);
1.86 #endif
1.87 }
1.88