nmhw21: update V2.0 gpio
This commit is contained in:
parent
a962411cbf
commit
7fda5662f3
|
|
@ -48,13 +48,14 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
/*
|
||||
* CPU GPIOs
|
||||
*
|
||||
* (J18) GPIO0_16: ETH_SW_RST~ (V2.0)
|
||||
* (K15) GPIO0_17: CTRL.INT~
|
||||
* (T10) GPIO0_23: CAN_TERM1~
|
||||
* (T10) GPIO0_23: CAN_TERM1~ (V1.0)
|
||||
* (T17) GPIO0_30: LED0.RD
|
||||
*
|
||||
* (T12) GPIO1_12: SIM_SW
|
||||
* (V13) GPIO1_14: GNSS_RST~
|
||||
* (U13) GPIO1_15: CAN_TERM0~
|
||||
* (U13) GPIO1_15: CAN_TERM0~ (V1.0)
|
||||
* (R14) GPIO1_20: BT_EN
|
||||
* (V15) GPIO1_21: GSM_PWR_EN
|
||||
* (U15) GPIO1_22: LED1.RD
|
||||
|
|
@ -64,6 +65,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
* (V17) GPIO1_27: WLAN_IRQ
|
||||
* (U18) GPIO1_28: LED0.GN
|
||||
*
|
||||
* (U3) GPIO2_16: SIM_PRES~ (V2.0)
|
||||
* (R6) GPIO2_25: RST_ETH~
|
||||
*
|
||||
* (J17) GPIO3_4: GNSS_EXTINT
|
||||
|
|
@ -87,6 +89,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
#define GPIO_BT_EN GPIO_TO_PIN(1, 20)
|
||||
#define GPIO_RST_GNSS GPIO_TO_PIN(1, 14)
|
||||
|
||||
#define GPIO_RST_ETH_SW_N GPIO_TO_PIN(0, 16)
|
||||
#define GPIO_RST_ETH_N GPIO_TO_PIN(2, 25)
|
||||
#define GPIO_RST_USB_HUB_N GPIO_TO_PIN(3, 21)
|
||||
|
||||
|
|
@ -100,6 +103,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
#define CAN1_TERM_N GPIO_TO_PIN(0, 23)
|
||||
|
||||
#define GPIO_SIM_SEL GPIO_TO_PIN(1, 12)
|
||||
#define GPIO_SIM_PRES_N GPIO_TO_PIN(2, 16)
|
||||
|
||||
|
||||
|
||||
|
|
@ -246,46 +250,6 @@ static int _bd_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void init_indicator_leds(void)
|
||||
{
|
||||
int old_bus;
|
||||
|
||||
old_bus = i2c_get_bus_num();
|
||||
i2c_set_bus_num(CONFIG_SYS_I2C_PCA953X_BUS);
|
||||
|
||||
/* Set all IOs as output */
|
||||
(void)pca953x_set_dir(CONFIG_SYS_I2C_PCA953X_ADDR, IOEXT_LEDS_ALL_MASK, PCA953X_DIR_OUT);
|
||||
|
||||
/* Set all LEDs off */
|
||||
(void)pca953x_set_val(CONFIG_SYS_I2C_PCA953X_ADDR, IOEXT_LEDS_ALL_MASK, IOEXT_LEDS_ALL_MASK);
|
||||
|
||||
i2c_set_bus_num(old_bus);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void set_indicator(unsigned led, int red, int green)
|
||||
{
|
||||
int old_bus;
|
||||
uint led_red_mask = 0x1U << (2*led);
|
||||
uint led_green_mask = 0x2U << (2*led);
|
||||
uint led_val = 0;
|
||||
|
||||
old_bus = i2c_get_bus_num();
|
||||
i2c_set_bus_num(CONFIG_SYS_I2C_PCA953X_BUS);
|
||||
if (!red)
|
||||
led_val |= led_red_mask;
|
||||
|
||||
if (!green)
|
||||
led_val |= led_green_mask;
|
||||
|
||||
(void)pca953x_set_val(CONFIG_SYS_I2C_PCA953X_ADDR, led_red_mask | led_green_mask, led_val);
|
||||
|
||||
i2c_set_bus_num(old_bus);
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool is_jtag_boot(uint32_t address)
|
||||
{
|
||||
char* jtag_token = (char*)address;
|
||||
|
|
@ -439,8 +403,7 @@ void am33xx_spl_board_init(void)
|
|||
init_pmic_spl();
|
||||
|
||||
init_leds();
|
||||
set_status_led(1, 1); /* Orange */ /* TODO: -> Broken #2 use indicator led instead */
|
||||
set_indicator_led(1, 1); /* Orange */
|
||||
set_status_led(1, 1); /* Orange */
|
||||
|
||||
/* Set MPU Frequency to what we detected now that voltages are set */
|
||||
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
||||
|
|
@ -496,6 +459,7 @@ void sdram_init(void)
|
|||
static void init_ethernet(void)
|
||||
{
|
||||
REQUEST_AND_CLEAR_GPIO(GPIO_RST_ETH_N);
|
||||
REQUEST_AND_CLEAR_GPIO(GPIO_RST_ETH_SW_N);
|
||||
/* Minimum Reset Pulse = 5us (switch), 20us (TJA1100), 100us (SMSC8720) */
|
||||
mdelay(1);
|
||||
gpio_set_value(GPIO_RST_ETH_N, 1);
|
||||
|
|
@ -523,10 +487,6 @@ static void init_ethernet_switch(void)
|
|||
/* 1ms delay after init before first SPI acces */
|
||||
mdelay(1);
|
||||
|
||||
// TODO. What for???
|
||||
/* Read device Id */
|
||||
/* val = sja1105_read_reg(SJA_REG_DEVICE_ID); */
|
||||
|
||||
sja1105_configure_firmware();
|
||||
|
||||
/* Configure clocks */
|
||||
|
|
@ -585,6 +545,14 @@ static void init_sim_mux(void)
|
|||
* Switch onboard SIM to onboard modem (Mux = 1)
|
||||
*/
|
||||
REQUEST_AND_SET_GPIO(GPIO_SIM_SEL);
|
||||
|
||||
/*
|
||||
* Inform modem that SIM is installed
|
||||
* - uBlox TOBY-L2 Datasheet UBX-13004573 - R24
|
||||
* - uBlox TOBY-L2-MPCI-L2_SysIntegrManual_(UBX-13004618) - R26
|
||||
* 1.8.2 SIM detection interface
|
||||
*/
|
||||
REQUEST_AND_CLEAR_GPIO(GPIO_SIM_PRES_N);
|
||||
}
|
||||
|
||||
static void init_gsm(void)
|
||||
|
|
@ -652,16 +620,17 @@ int board_init(void)
|
|||
init_i2c();
|
||||
|
||||
da9063_init(CONFIG_PMIC_I2C_BUS);
|
||||
ui_i2c_init(CONFIG_UI_I2C_BUS);
|
||||
|
||||
/* UI detection */
|
||||
REQUEST_AND_SET_GPIO(GPIO_RST_UI_N);
|
||||
ui_init(CONFIG_UI_I2C_BUS);
|
||||
|
||||
/* Let user know we're starting */
|
||||
init_leds();
|
||||
/* FIXME: LEDs broken, use indicator led of #2 */
|
||||
set_status_led(1, 1); /* Orange */
|
||||
set_indicator_led(0, 0); /* Off */
|
||||
set_status_led(0, 0); /* Off */
|
||||
set_indicator_led(1, 1); /* Orange */
|
||||
ui_set_top_led(1, 1);
|
||||
ui_set_bottom_led(0, 0);
|
||||
|
||||
printf("OSC: %lu MHz\n", get_osclk()/1000000);
|
||||
|
||||
|
|
@ -870,6 +839,8 @@ static void check_reset_button(void)
|
|||
int board_late_init(void)
|
||||
{
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
int ui_ver = -1;
|
||||
|
||||
if (read_eeprom() < 0) {
|
||||
puts("Could not get board ID.\n");
|
||||
}
|
||||
|
|
@ -883,20 +854,15 @@ int board_late_init(void)
|
|||
REQUEST_AND_CLEAR_GPIO(GPIO_WLAN_EN);
|
||||
REQUEST_AND_CLEAR_GPIO(GPIO_BT_EN);
|
||||
|
||||
REQUEST_AND_SET_GPIO(CAN0_TERM_N);
|
||||
REQUEST_AND_SET_GPIO(CAN0_TERM_N); /* Unused on V2.0 */
|
||||
REQUEST_AND_SET_GPIO(CAN1_TERM_N);
|
||||
|
||||
|
||||
/* UI configuration and detection */
|
||||
REQUEST_AND_SET_GPIO(GPIO_RST_UI_N);
|
||||
int ui_version = detect_ui();
|
||||
if ( ui_version == 2 )
|
||||
printf("UI: V2.0\n");
|
||||
else if ( ui_version == 1 )
|
||||
printf("UI: V1.0\n");
|
||||
else
|
||||
printf("UI: n/a\n");
|
||||
|
||||
ui_ver = ui_version();
|
||||
switch (ui_ver) {
|
||||
case 1: puts("UI: V1.0\n"); break;
|
||||
case 2: puts("UI: V2.0\n"); break;
|
||||
default: puts("UI: N/A\n"); break;
|
||||
}
|
||||
|
||||
/* FIXME: Problem switch reset lines of switch and PHY
|
||||
* Clocks for PHY are only present once switch is configured
|
||||
|
|
@ -924,9 +890,8 @@ int board_late_init(void)
|
|||
check_reset_button();
|
||||
*/
|
||||
|
||||
/* TODO: LEDs broken, use indicator led of #2 */
|
||||
set_status_led(0, 1); /* Green */
|
||||
set_indicator_led(0, 1); /* Green */
|
||||
ui_set_top_led(0, 1);
|
||||
|
||||
/*
|
||||
check_fct();
|
||||
|
|
@ -1071,15 +1036,16 @@ static void ft_hw_version(void *blob)
|
|||
if (node_offset != -1) {
|
||||
fdt_setprop_string(blob, node_offset, "nm,carrierboard,version", hw_version);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ft_led(void *blob)
|
||||
{
|
||||
int ui_hw_version = ui_version();
|
||||
|
||||
if (ui_hw_version > 0) {
|
||||
int node_offset;
|
||||
int ui_version = detect_ui();
|
||||
if ( ui_version >= 1){
|
||||
|
||||
/* TODO: UI LEDs are different from V1 to V2 */
|
||||
node_offset = fdt_path_offset(blob, "/leds/led@4/");
|
||||
if (node_offset != -1) {
|
||||
fdt_setprop_string(blob, node_offset, "status", "okay");
|
||||
|
|
@ -1097,13 +1063,13 @@ static void ft_led(void *blob)
|
|||
fdt_setprop_string(blob, node_offset, "status", "okay");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
ft_hw_version(blob);
|
||||
ft_led(blob);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,13 +23,14 @@
|
|||
|
||||
static struct module_pin_mux gpio_pin_mux[] = {
|
||||
/*
|
||||
* (J18) GPIO0_16: ETH_SW_RST~ (V2.0)
|
||||
* (K15) GPIO0_17: CTRL.INT~
|
||||
* (T10) GPIO0_23: CAN_TERM1~
|
||||
* (T10) GPIO0_23: CAN_TERM1~ (V1.0)
|
||||
* (T17) GPIO0_30: LED0.RD
|
||||
*
|
||||
* (T12) GPIO1_12: SIM_SW
|
||||
* (V13) GPIO1_14: GNSS_RST~
|
||||
* (U13) GPIO1_15: CAN_TERM0~
|
||||
* (U13) GPIO1_15: CAN_TERM0~ (V1.0)
|
||||
* (R14) GPIO1_20: BT_EN
|
||||
* (V15) GPIO1_21: GSM_PWR_EN
|
||||
* (U15) GPIO1_22: LED1.RD
|
||||
|
|
@ -39,6 +40,7 @@ static struct module_pin_mux gpio_pin_mux[] = {
|
|||
* (V17) GPIO1_27: WLAN_IRQ
|
||||
* (U18) GPIO1_28: LED0.GN
|
||||
*
|
||||
* (U3) GPIO2_16: SIM_PRES~ (V2.0)
|
||||
* (R6) GPIO2_25: RST_ETH~
|
||||
*
|
||||
* (J17) GPIO3_4: GNSS_EXTINT
|
||||
|
|
@ -49,6 +51,7 @@ static struct module_pin_mux gpio_pin_mux[] = {
|
|||
*/
|
||||
|
||||
/* Bank 0 */
|
||||
{OFFSET(mii1_txd3), (MODE(7) | PULLUDDIS)}, /* (J18) GPIO0_16: ETH_SW_RST~ (V2.0) */
|
||||
{OFFSET(mii1_txd2), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (K15) GPIO0_17: CTRL.INT~ */
|
||||
{OFFSET(gpmc_ad9), (MODE(7) | PULLUDDIS)}, /* (T10) GPIO0_23: CAN_TERM1~ */
|
||||
{OFFSET(gpmc_wait0), (MODE(7) | PULLUDDIS)}, /* (T17) GPIO0_30: LED0.RD */
|
||||
|
|
@ -70,6 +73,7 @@ static struct module_pin_mux gpio_pin_mux[] = {
|
|||
/* TODO: What about all the unused GPMC pins ? */
|
||||
|
||||
/* Bank 2 */
|
||||
{OFFSET(lcd_data10), (MODE(7) | PULLUDDIS)}, /* (U3) GPIO2_16: SIM_PRES~ */
|
||||
{OFFSET(lcd_ac_bias_en), (MODE(7) | PULLUDDIS)}, /* (R6) GPIO2_25: RST_ETH~ */
|
||||
|
||||
#if 0
|
||||
|
|
@ -217,7 +221,6 @@ static struct module_pin_mux unused_pin_mux[] = {
|
|||
/* SYSBOOT6, 7, 10, 11: Not used pulldown active, receiver disabled */
|
||||
{OFFSET(lcd_data6), (MODE(7) | PULLUDEN | PULLDOWN_EN)},
|
||||
{OFFSET(lcd_data7), (MODE(7) | PULLUDEN | PULLDOWN_EN)},
|
||||
{OFFSET(lcd_data10), (MODE(7) | PULLUDEN | PULLDOWN_EN)},
|
||||
{OFFSET(lcd_data11), (MODE(7) | PULLUDEN | PULLDOWN_EN)},
|
||||
|
||||
/* TODO: GPMCA1..3, A6..8 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue