Skip to content

Commit

Permalink
UDOO Neo support
Browse files Browse the repository at this point in the history
  • Loading branch information
fmntf committed Oct 6, 2016
1 parent b47af43 commit 877b711
Show file tree
Hide file tree
Showing 16 changed files with 1,704 additions and 27 deletions.
5 changes: 5 additions & 0 deletions arch/arm/cpu/armv7/mx6/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ config TARGET_UDOO_QUAD_DUAL
bool "UDOO Quad/Dual"
select SUPPORT_SPL

config TARGET_UDOO_NEO
bool "UDOO Neo"
select SUPPORT_SPL

config TARGET_WANDBOARD
bool "wandboard"
select SUPPORT_SPL
Expand Down Expand Up @@ -231,6 +235,7 @@ source "board/technexion/pico-imx6ul/Kconfig"
source "board/tbs/tbs2910/Kconfig"
source "board/tqc/tqma6/Kconfig"
source "board/udoo/quad_dual/Kconfig"
source "board/udoo/neo/Kconfig"
source "board/wandboard/Kconfig"
source "board/warp/Kconfig"

Expand Down
7 changes: 7 additions & 0 deletions board/udoo/common/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# (C) Copyright 2015 UDOO Team
#
# SPDX-License-Identifier: GPL-2.0+
#

obj- := __dummy__.o
obj-y := trim.o
34 changes: 34 additions & 0 deletions board/udoo/common/trim.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) UDOO Team
*
* Author: Francesco Montefoschi <francesco.monte@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/

#include <common.h>

int isspace(char c)
{
return (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\12');
}

char *trim(char *str)
{
char *end;

// Trim leading space
while(isspace(*str)) str++;

if(*str == 0) // All spaces?
return str;

// Trim trailing space
end = str + strlen(str) - 1;
while(end > str && isspace(*end)) end--;

// Write new null terminator
*(end+1) = 0;

return str;
}
10 changes: 10 additions & 0 deletions board/udoo/common/trim.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (C) UDOO Team
*
* Author: Francesco Montefoschi <francesco.monte@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/

int isspace(char c);
char *trim(char *str);
12 changes: 12 additions & 0 deletions board/udoo/neo/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if TARGET_UDOO_NEO

config SYS_VENDOR
default "udoo"

config SYS_BOARD
default "neo"

config SYS_CONFIG_NAME
default "udoo_neo"

endif
6 changes: 6 additions & 0 deletions board/udoo/neo/MAINTAINERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UDOO NEO BOARD
M: Francesco Montefoschi <francesco.montefoschi@udoo.org>
S: Maintained
F: board/udoo/neo/
F: include/configs/udoo_neo.h
F: configs/udoo_neo_defconfig
7 changes: 7 additions & 0 deletions board/udoo/neo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# (C) Copyright 2015 UDOO Team
#
# SPDX-License-Identifier: GPL-2.0+
#

obj-y := neo.o detectboard.o
obj-$(CONFIG_SPL_BUILD) += spl.o
62 changes: 62 additions & 0 deletions board/udoo/neo/detectboard.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (C) UDOO Team
*
* Author: Francesco Montefoschi <francesco.monte@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/

#include <asm/arch/mx6-pins.h>
#include <asm/gpio.h>
#include <asm/imx-common/iomux-v3.h>
#include "detectboard.h"

#define DIO_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST)
#define DIO_PAD_CFG (MUX_PAD_CTRL(DIO_PAD_CTRL) | MUX_MODE_SION)


#define GPIO_R184 IMX_GPIO_NR(4, 13)
#define GPIO_R185 IMX_GPIO_NR(4, 0)
iomux_v3_cfg_t const board_recognition_pads[] = {
MX6_PAD_NAND_READY_B__GPIO4_IO_13 | DIO_PAD_CFG, // Connected to R184
MX6_PAD_NAND_ALE__GPIO4_IO_0 | DIO_PAD_CFG, // Connected to R185
};

/**
* Detects the board model by checking the R184 and R185 resistors.
* A mounted resistor (0Ohm) connects the GPIO to ground, so the
* GPIO value will be 0.
*
* FULL - Eth, WiFi, motion sensors, 1GB RAM -> R184 not mounted - R185 mounted
* EXTENDED - NO Eth, WiFi, motion sensors, 1GB RAM -> R184 not mounted - R185 not mounted
* BASE - Eth, NO WiFi, NO motion sensors, 512MB RAM -> R184 mounted - R185 mounted
* BASE KS - NO Eth, WiFi, NO motion sensors, 512MB RAM -> R184 mounted - R185 not mounted
*/
int detect_board(void)
{
imx_iomux_v3_setup_multiple_pads(board_recognition_pads,
ARRAY_SIZE(board_recognition_pads));

gpio_direction_input(GPIO_R184);
gpio_direction_input(GPIO_R185);

int r184 = gpio_get_value(GPIO_R184);
int r185 = gpio_get_value(GPIO_R185);

if (r184 == 0 && r185 == 0) {
return UDOO_NEO_TYPE_BASIC;
}
if (r184 == 0 && r185 == 1) {
return UDOO_NEO_TYPE_BASIC_KS;
}
if (r184 == 1 && r185 == 0) {
return UDOO_NEO_TYPE_FULL;
}
if (r184 == 1 && r185 == 1) {
return UDOO_NEO_TYPE_EXTENDED;
}

return UDOO_NEO_TYPE_FULL;
}
14 changes: 14 additions & 0 deletions board/udoo/neo/detectboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (C) UDOO Team
*
* Author: Francesco Montefoschi <francesco.monte@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/

#define UDOO_NEO_TYPE_BASIC 1
#define UDOO_NEO_TYPE_BASIC_KS 2
#define UDOO_NEO_TYPE_EXTENDED 3
#define UDOO_NEO_TYPE_FULL 4

int detect_board(void);
Loading

3 comments on commit 877b711

@graugans
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the M4 loading handled through the device tree now?

@fmntf
Copy link
Owner Author

@fmntf fmntf commented on 877b711 Nov 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Device tree disables some devices (on A9) so that can be assigned to M4. U-Boot does not load the M4 firmware anymore, we have found that loading it after Linux booted is more stable.

@graugans
Copy link

@graugans graugans commented on 877b711 Nov 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for clarification

Please sign in to comment.