am57xx-idk LCD and am571x-idk 6 port ethernet pinmux
Subsystems (4)
v4 cover am57xx-idk LCD and am571x-idk 6 port ethernet pinmux
Hi,
This series contains
- Support am571x-idk LCD vs 6 port ethernet pinmux configuration.
- AM57xx-idk LCD detection support.
- K2G: pick up PRUSS ethernet MAC addresses from board EEPROM.
Build tests:
https://travis-ci.org/rogerq/u-boot/builds/210547470
Changelog:
v4:
- added patch 10 to prevent overrding ethernet address environment
- rebased to todays master
v3:
- moved EEPROM options to board/ti/common/Kconfig.
- Don't explicitly set EEPROM CONFIG addresses in defconfig if board is using the default addresses.
v2:
- avoid using __maybe_unused.
- moved EEPROM address configuration to Kconfig.
- LCD detection patch no longer update device tree.
cheers,
-roger
Franklin S Cooper Jr (1):
ti_armv7_keystone2: Define scratch space in SRAM
Lokesh Vutla (1):
ti: common: board_detect: Rename EEPROM scratch start macro
Nishanth Menon (1):
board: ti: am57xx-idk: Auto detect LCD Panel
Roger Quadros (7):
ARM: OMAP5+: GPIO: Add GPIO_TO_PIN() macro
ti: common: board_detect: commodify ethaddr environment setting code
board: ti: am571x-idk: Support 6 port Ethernet or 4 port Ethernet with
LCD
board: ti: am571x-idk: Update pinmux for ICSS2 Ethernet
ARM: Use Kconfig for board EEPROM's I2C bus and chip address
ARM: k2g: setup PRU ethernet MAC addresses
net: don't override ethernet address environment
arch/arm/include/asm/arch-omap5/gpio.h | 4 + arch/arm/include/asm/omap_common.h | 8 +- arch/arm/mach-keystone/Kconfig | 2 + board/ti/am57xx/board.c | 102 ++++++++++++++++++++ board/ti/am57xx/mux_data.h | 166 ++++++++++++++++++++------------- board/ti/common/Kconfig | 20 +++- board/ti/common/board_detect.c | 57 +++++++++++ board/ti/common/board_detect.h | 14 ++- board/ti/ks2_evm/Kconfig | 2 + board/ti/ks2_evm/board_k2g.c | 19 ++++ include/configs/am57xx_evm.h | 4 - include/configs/dra7xx_evm.h | 4 - include/configs/ti_armv7_keystone2.h | 7 ++ net/eth_common.c | 3 + 14 files changed, 331 insertions(+), 81 deletions(-)
Signature · 1 line
2.7.4
PATCH v4 1/10 ARM: OMAP5+: GPIO: Add GPIO_TO_PIN() macro
GPIO_TO_PIN(bank, bank_gpio) returns the GPIO index from the GPIO bank number and bank's GPIO offset number.
--- arch/arm/include/asm/arch-omap5/gpio.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/include/asm/arch-omap5/gpio.h +4 -0
@@ -34,4 +34,8 @@#define OMAP54XX_GPIO7_BASE 0x48051000#define OMAP54XX_GPIO8_BASE 0x48053000 + +/* Get the GPIO index from the given bank number and bank gpio */ +#define GPIO_TO_PIN (bank, bank_gpio) (32 * (bank - 1) + (bank_gpio)) +#endif /* _GPIO_OMAP5_H */
Signature · 1 line
2.7.4
PATCH v4 1/10 ARM: OMAP5+: GPIO: Add GPIO_TO_PIN() macro
Quoted 6 lines · Roger Quadros
GPIO_TO_PIN(bank, bank_gpio)returns the GPIO index from the GPIO bank number and bank's GPIO offset number.Signed-off-by Roger Quadros <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Lokesh Vutla <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/a871d5fc/attachment.sig>
PATCH v4 2/10 ti: common: board_detect: Rename EEPROM scratch start macro
In reply to Roger QuadrosFrom: Lokesh Vutla <[email protected]>
Non OMAP platforms i.e. Keystone will also need to use the board EEPROM helpers so let's make the macro platform independent.
--- arch/arm/include/asm/omap_common.h | 8 +++++--- board/ti/common/board_detect.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/arm/include/asm/omap_common.h +5 -3
@@ -767,9 +767,11 @@ static inline u8 is_dra72x(void)#define OMAP_SRAM_SCRATCH_VCORES_PTR (SRAM_SCRATCH_SPACE_ADDR + 0x1C)#define OMAP_SRAM_SCRATCH_SYS_CTRL (SRAM_SCRATCH_SPACE_ADDR + 0x20)#define OMAP_SRAM_SCRATCH_BOOT_PARAMS (SRAM_SCRATCH_SPACE_ADDR + 0x24) -#define OMAP_SRAM_SCRATCH_BOARD_EEPROM_START (SRAM_SCRATCH_SPACE_ADDR + 0x28) -#define OMAP_SRAM_SCRATCH_BOARD_EEPROM_END (SRAM_SCRATCH_SPACE_ADDR + 0x200) -#define OMAP_SRAM_SCRATCH_SPACE_END (OMAP_SRAM_SCRATCH_BOARD_EEPROM_END) +#ifndef TI_SRAM_SCRATCH_BOARD_EEPROM_START +#define TI_SRAM_SCRATCH_BOARD_EEPROM_START (SRAM_SCRATCH_SPACE_ADDR + 0x28) +#define TI_SRAM_SCRATCH_BOARD_EEPROM_END (SRAM_SCRATCH_SPACE_ADDR + 0x200) +#endif +#define OMAP_SRAM_SCRATCH_SPACE_END (TI_SRAM_SCRATCH_BOARD_EEPROM_END)/* Boot parameters */ #define DEVICE_DATA_OFFSET 0x18
board/ti/common/board_detect.h +1 -1
@@ -98,7 +98,7 @@ struct ti_common_eeprom { };#define TI_EEPROM_DATA ((struct ti_common_eeprom *)\ - OMAP_SRAM_SCRATCH_BOARD_EEPROM_START) + TI_SRAM_SCRATCH_BOARD_EEPROM_START)/** * ti_i2c_eeprom_am_get() - Consolidated eeprom data collection for AM* TI EVMs
Signature · 1 line
2.7.4
PATCH v4 2/10 ti: common: board_detect: Rename EEPROM scratch start macro
Quoted 8 lines · Roger Quadros
From: Lokesh Vutla <[email protected]>
Non OMAP platforms i.e. Keystone will also need to use the board EEPROM helpers so let's make the macro platform independent.
Signed-off-by Roger Quadros <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/408041c5/attachment.sig>
PATCH v4 3/10 ti_armv7_keystone2: Define scratch space in SRAM
In reply to Roger QuadrosFrom: Franklin S Cooper Jr <[email protected]>
Scratch space can be used for features such as board detection. Define an area within SRAM that can be used for this purpose.
[rogerq at ti.com] Rename EEPROM macro
--- include/configs/ti_armv7_keystone2.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/configs/ti_armv7_keystone2.h +7 -0
@@ -55,6 +55,13 @@#define CONFIG_SPL_SPI_LOAD #define CONFIG_SYS_SPI_U_BOOT_OFFS CONFIG_SPL_PAD_TO +/* SRAM scratch space entries */ +#define SRAM_SCRATCH_SPACE_ADDR CONFIG_SPL_STACK + 0x8 + +#define TI_SRAM_SCRATCH_BOARD_EEPROM_START (SRAM_SCRATCH_SPACE_ADDR) +#define TI_SRAM_SCRATCH_BOARD_EEPROM_END (SRAM_SCRATCH_SPACE_ADDR + 0x200) +#define KEYSTONE_SRAM_SCRATCH_SPACE_END (TI_SRAM_SCRATCH_BOARD_EEPROM_END) +/* UART Configuration */ #define CONFIG_SYS_NS16550_MEM32 #if defined(CONFIG_SPL_BUILD ) || !defined(CONFIG_DM_SERIAL )
Signature · 1 line
2.7.4
PATCH v4 3/10 ti_armv7_keystone2: Define scratch space in SRAM
Quoted 21 lines · Roger Quadros
From: Franklin S Cooper Jr <[email protected]>
Scratch space can be used for features such as board detection. Define an area within SRAM that can be used for this purpose.
[rogerq at ti.com] Rename EEPROM macro
Signed-off-by Franklin S Cooper Jr <[email protected]>Signed-off-by Roger Quadros <[email protected]>--- include/configs/ti_armv7_keystone2.h | 7 +++++++ 1 file changed, 7 insertions(+)include/configs/ti_armv7_keystone2.h +0
-0@@ -55,6 +55,13 @@#define CONFIG_SPL_SPI_LOAD #define CONFIG_SYS_SPI_U_BOOT_OFFS CONFIG_SPL_PAD_TO
include/configs/ti_armv7_keystone2.h line 67
Quoted 10 lines
include/configs/ti_armv7_keystone2.h +7
-0+/* SRAM scratch space entries */ +#define SRAM_SCRATCH_SPACE_ADDR CONFIG_SPL_STACK + 0x8 + +#define TI_SRAM_SCRATCH_BOARD_EEPROM_START (SRAM_SCRATCH_SPACE_ADDR) +#define TI_SRAM_SCRATCH_BOARD_EEPROM_END (SRAM_SCRATCH_SPACE_ADDR + 0x200) +#define KEYSTONE_SRAM_SCRATCH_SPACE_END (TI_SRAM_SCRATCH_BOARD_EEPROM_END) +/* UART Configuration */ #define CONFIG_SYS_NS16550_MEM32 #if defined(CONFIG_SPL_BUILD ) || !defined(CONFIG_DM_SERIAL )
I think I said this in Franklin's posting of this patch as well, we need to move this to some header elsewhere rather than include/configs/, Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/3655a1ea/attachment.sig>
PATCH v4 3/10 ti_armv7_keystone2: Define scratch space in SRAM
In reply to Roger QuadrosQuoted 9 lines · Roger Quadros
From: Franklin S Cooper Jr <[email protected]>
Scratch space can be used for features such as board detection. Define an area within SRAM that can be used for this purpose.
[rogerq at ti.com] Rename EEPROM macro
Signed-off-by Franklin S Cooper Jr <[email protected]>Signed-off-by Roger Quadros <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/dfa3e070/attachment.sig>
PATCH v4 4/10 ti: common: board_detect: commodify ethaddr environment setting code
In reply to Roger QuadrosKeystone and OMAP platforms will need this to set ethernet MAC addresses from board EEPROM.
--- board/ti/common/board_detect.c | 57 ++++++++++++++++++++++++++++++++++++++++++ board/ti/common/board_detect.h | 12 +++++++++ 2 files changed, 69 insertions(+)
board/ti/common/board_detect.c +57 -0
@@ -314,3 +314,60 @@ void __maybe_unused set_board_info_env(char *name)else setenv ("board_serial" , unknown); } + +static u64 mac_to_u64 (u8 mac[6 ]) +{ +int i; +u64 addr =0 ; + +for (i =0 ; i <6 ; i++) { + addr <<=8 ; + addr |= mac[i]; + } + +return addr; +} + +static void u64_to_mac (u64 addr,u8 mac[6 ]) +{ + mac[5 ] = addr; + mac[4 ] = addr >>8 ; + mac[3 ] = addr >>16 ; + mac[2 ] = addr >>24 ; + mac[1 ] = addr >>32 ; + mac[0 ] = addr >>40 ; +} + +void board_ti_set_ethaddr (int index) +{ +uint8_t mac_addr[6 ]; +int i; +u64 mac1, mac2; +u8 mac_addr1[6 ], mac_addr2[6 ]; +int num_macs; +/* +* Export any Ethernet MAC addresses from EEPROM. +* The 2 MAC addresses in EEPROM define the address range. +*/ +board_ti_get_eth_mac_addr (0 , mac_addr1); +board_ti_get_eth_mac_addr (1 , mac_addr2); + +if (is_valid_ethaddr (mac_addr1) &&is_valid_ethaddr (mac_addr2)) { + mac1 =mac_to_u64 (mac_addr1); + mac2 =mac_to_u64 (mac_addr2); + +/* must contain an address range */ + num_macs = mac2 - mac1 +1 ; +/* <= 50 to protect against user programming error */ +if (num_macs >0 && num_macs <=50 ) { +for (i =0 ; i < num_macs; i++) { +u64_to_mac (mac1 + i, mac_addr); +if (is_valid_ethaddr (mac_addr)) { +eth_setenv_enetaddr_by_index ("eth" , + i + index, + mac_addr); + } + } + } + } +}
board/ti/common/board_detect.h +12 -0
@@ -193,4 +193,16 @@ u64 board_ti_get_emif2_size(void);*/ void set_board_info_env (char *name); +/** +* board_ti_set_ethaddr- Sets the ethaddr environment from EEPROM +* @index: The first eth<index>addr environment variable to set +* +* EEPROM should be already read before calling this function. +* The EEPROM contains 2 MAC addresses which define the MAC address +* range (i.e. first and last MAC address). +* This function sets the ethaddr environment variable for all +* the available MAC addresses starting from eth<index>addr. +*/ +void board_ti_set_ethaddr (int index); +#endif /* __BOARD_DETECT_H */
Signature · 1 line
2.7.4
PATCH v4 4/10 ti: common: board_detect: commodify ethaddr environment setting code
Hi,
Quoted 12 lines · Roger Quadros
board/ti/common/board_detect.c +12
-0+void board_ti_set_ethaddr (int index) +{ +uint8_t mac_addr[6 ]; +int i; +u64 mac1, mac2; +u8 mac_addr1[6 ], mac_addr2[6 ]; +int num_macs; +/* +* Export any Ethernet MAC addresses from EEPROM. +* The 2 MAC addresses in EEPROM define the address range. +*/ +board_ti_get_eth_mac_addr (0 , mac_addr1);
board/ti/common/board_detect.c void __maybe_unused set_board_info_env(char *name) · line 362
Quoted 10 lines
board/ti/common/board_detect.c +10
-0+board_ti_get_eth_mac_addr (1 , mac_addr2); + +if (is_valid_ethaddr (mac_addr1) &&is_valid_ethaddr (mac_addr2)) { + mac1 =mac_to_u64 (mac_addr1); + mac2 =mac_to_u64 (mac_addr2); + +/* must contain an address range */ + num_macs = mac2 - mac1 +1 ; +/* <= 50 to protect against user programming error */ +if (num_macs >0 && num_macs <=50 ) {
if user programs a range > 50, then you do nothing. How about allowing up to 50 addresses?
Something like:
if (num_macs < 0)
bail_out();
if (num_macs > 50) {
printf("Too many addresses. %d > 50\n", num_macs);
num_macs = 50;
}this also mean you can reduce indentation level for the for loop.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170313/72ee0d0d/attachment.sig>
PATCH v4 4/10 ti: common: board_detect: commodify ethaddr environment setting code
Quoted 40 lines · Felipe Balbi
Hi,
Quoted 12 lines · Roger Quadros
board/ti/common/board_detect.c +12
-0+void board_ti_set_ethaddr (int index) +{ +uint8_t mac_addr[6 ]; +int i; +u64 mac1, mac2; +u8 mac_addr1[6 ], mac_addr2[6 ]; +int num_macs; +/* +* Export any Ethernet MAC addresses from EEPROM. +* The 2 MAC addresses in EEPROM define the address range. +*/ +board_ti_get_eth_mac_addr (0 , mac_addr1);board/ti/common/board_detect.c void __maybe_unused set_board_info_env(char *name) · line 362
Quoted 10 lines
board/ti/common/board_detect.c +10
-0+board_ti_get_eth_mac_addr (1 , mac_addr2); + +if (is_valid_ethaddr (mac_addr1) &&is_valid_ethaddr (mac_addr2)) { + mac1 =mac_to_u64 (mac_addr1); + mac2 =mac_to_u64 (mac_addr2); + +/* must contain an address range */ + num_macs = mac2 - mac1 +1 ; +/* <= 50 to protect against user programming error */ +if (num_macs >0 && num_macs <=50 ) {if user programs a range > 50, then you do nothing. How about allowing up to 50 addresses?
Something like:
if (num_macs < 0) bail_out(); if (num_macs > 50) { printf("Too many addresses. %d > 50\n", num_macs); num_macs = 50; }
Quoted 2 lines
this also mean you can reduce indentation level for the for loop.
Good idea.
Signature · 2 lines
cheers, -roger
PATCH v5 4/10 ti: common: board_detect: commodify ethaddr environment setting code
In reply to Roger QuadrosKeystone and OMAP platforms will need this to set ethernet MAC addresses from board EEPROM.
---
v5:
- Set upto 50 MAC addresses if more than 50 are provided in board EEPROM.
board/ti/common/board_detect.c | 62 ++++++++++++++++++++++++++++++++++++++++++ board/ti/common/board_detect.h | 12 ++++++++ 2 files changed, 74 insertions(+)
board/ti/common/board_detect.c +62 -0
@@ -314,3 +314,65 @@ void __maybe_unused set_board_info_env(char *name)else setenv ("board_serial" , unknown); } + +static u64 mac_to_u64 (u8 mac[6 ]) +{ +int i; +u64 addr =0 ; + +for (i =0 ; i <6 ; i++) { + addr <<=8 ; + addr |= mac[i]; + } + +return addr; +} + +static void u64_to_mac (u64 addr,u8 mac[6 ]) +{ + mac[5 ] = addr; + mac[4 ] = addr >>8 ; + mac[3 ] = addr >>16 ; + mac[2 ] = addr >>24 ; + mac[1 ] = addr >>32 ; + mac[0 ] = addr >>40 ; +} + +void board_ti_set_ethaddr (int index) +{ +uint8_t mac_addr[6 ]; +int i; +u64 mac1, mac2; +u8 mac_addr1[6 ], mac_addr2[6 ]; +int num_macs; +/* +* Export any Ethernet MAC addresses from EEPROM. +* The 2 MAC addresses in EEPROM define the address range. +*/ +board_ti_get_eth_mac_addr (0 , mac_addr1); +board_ti_get_eth_mac_addr (1 , mac_addr2); + +if (is_valid_ethaddr (mac_addr1) &&is_valid_ethaddr (mac_addr2)) { + mac1 =mac_to_u64 (mac_addr1); + mac2 =mac_to_u64 (mac_addr2); + +/* must contain an address range */ + num_macs = mac2 - mac1 +1 ; +if (num_macs <=0 ) +return ; + +if (num_macs >50 ) { +printf ("%s: Too many MAC addresses: %d. Limiting to 50\n" , + __func__, num_macs); + num_macs =50 ; + } + +for (i =0 ; i < num_macs; i++) { +u64_to_mac (mac1 + i, mac_addr); +if (is_valid_ethaddr (mac_addr)) { +eth_setenv_enetaddr_by_index ("eth" , i + index, + mac_addr); + } + } + } +}
board/ti/common/board_detect.h +12 -0
@@ -193,4 +193,16 @@ u64 board_ti_get_emif2_size(void);*/ void set_board_info_env (char *name); +/** +* board_ti_set_ethaddr- Sets the ethaddr environment from EEPROM +* @index: The first eth<index>addr environment variable to set +* +* EEPROM should be already read before calling this function. +* The EEPROM contains 2 MAC addresses which define the MAC address +* range (i.e. first and last MAC address). +* This function sets the ethaddr environment variable for all +* the available MAC addresses starting from eth<index>addr. +*/ +void board_ti_set_ethaddr (int index); +#endif /* __BOARD_DETECT_H */
Signature · 1 line
2.7.4
PATCH v5 4/10 ti: common: board_detect: commodify ethaddr environment setting code
Hi,
On Tue, Mar 14, 2017 at 3:05 PM Roger Quadros <[email protected]> wrote:
+void board_ti_set_ethaddr(int index)
+{
+ uint8_t mac_addr[6]; + int i; + u64 mac1, mac2; + u8 mac_addr1[6], mac_addr2[6]; + int num_macs; + /* + * Export any Ethernet MAC addresses from EEPROM. + * The 2 MAC addresses in EEPROM define the address range. + */
+ board_ti_get_eth_mac_addr(0, mac_addr1);
+ board_ti_get_eth_mac_addr(1, mac_addr2);
+
+ if (is_valid_ethaddr(mac_addr1) && is_valid_ethaddr(mac_addr2)) {
+ mac1 = mac_to_u64(mac_addr1);
+ mac2 = mac_to_u64(mac_addr2);
+
+ /* must contain an address range */ + num_macs = mac2 - mac1 + 1; + if (num_macs <= 0)
+ return;
seems like there's still one minor improvement here:
If num_macs < 0, then it could be that mac1 and mac2 are swapped.
Perhaps test for that ?
if (num_macs == 0)
bail();
if (num_macs < 0) {
if ((mac1 - mac2 + 1) < 50) {
num_macs = mac1 - mac2 + 1;
mac1 ^= mac2;
mac2 ^= mac1;
mac1 ^= mac2;[...]
don't know how much this may help, it's a judgment call, I suppose
Signature · 1 line
balbi
PATCH v5 4/10 ti: common: board_detect: commodify ethaddr environment setting code
Hi,
Quoted 43 lines · Felipe Balbi
Hi,
On Tue, Mar 14, 2017 at 3:05 PM Roger Quadros <rogerq at ti.com <mailto:[email protected]>> wrote:
+void
board_ti_set_ethaddr(int index)
+{
+uint8_tmac_addr[6];
+ int i;
+ u64 mac1, mac2;
+ u8 mac_addr1[6], mac_addr2[6];
+ intnum_macs;
+ /*
+ * Export any Ethernet MAC addresses from EEPROM.
+ * The 2 MAC addresses in EEPROM define the address range.
+ */
+board_ti_get_eth_mac_addr(0, mac_addr1);
+board_ti_get_eth_mac_addr(1, mac_addr2);
+
+ if (is_valid_ethaddr(mac_addr1)&&is_valid_ethaddr(mac_addr2)) {
+ mac1 =mac_to_u64(mac_addr1);
+ mac2 =mac_to_u64(mac_addr2);
+
+ /* must contain an address range */
+num_macs= mac2 - mac1 + 1;
+ if (num_macs<= 0)
+ return;seems like there's still one minor improvement here:
If
num_macs< 0, then it could be that mac1 and mac2 are swapped.Perhaps test for that ?
if (
num_macs== 0)bail();if (num_macs < 0) { if ((mac1 - mac2 + 1) < 50) { num_macs = mac1 - mac2 + 1; mac1 ^= mac2; mac2 ^= mac1; mac1 ^= mac2;
Quoted 3 lines
[...]
don't know how much this may help, it's a judgment call, I suppose
We don't have any boards with swapped mac1 and mac2. We'd like to keep it that way and catch any new boards with eeprom errors early so I'd rather not have this enhancement.
Signature · 2 lines
cheers, -roger
PATCH v5 4/10 ti: common: board_detect: commodify ethaddr environment setting code
Hi,
Quoted 43 lines · Roger Quadros
Quoted 43 lines · On Tue, Mar 14, 2017 at 3:05 PM Roger Quadros <rogerq at ti.com…
+void
board_ti_set_ethaddr(int index)
+{
+uint8_tmac_addr[6];
+ int i;
+ u64 mac1, mac2;
+ u8 mac_addr1[6], mac_addr2[6];
+ intnum_macs;
+ /*
+ * Export any Ethernet MAC addresses from EEPROM.
+ * The 2 MAC addresses in EEPROM define the address range.
+ */
+board_ti_get_eth_mac_addr(0, mac_addr1);
+board_ti_get_eth_mac_addr(1, mac_addr2);
+
+ if (is_valid_ethaddr(mac_addr1)&&is_valid_ethaddr(mac_addr2)) {
+ mac1 =mac_to_u64(mac_addr1);
+ mac2 =mac_to_u64(mac_addr2);
+
+ /* must contain an address range */
+num_macs= mac2 - mac1 + 1;
+ if (num_macs<= 0)
+ return;seems like there's still one minor improvement here:
If
num_macs< 0, then it could be that mac1 and mac2 are swapped.Perhaps test for that ?
if (
num_macs== 0)bail();if (num_macs < 0) { if ((mac1 - mac2 + 1) < 50) { num_macs = mac1 - mac2 + 1; mac1 ^= mac2; mac2 ^= mac1; mac1 ^= mac2;[...]
Quoted 3 lines
Quoted 1 line
don't know how much this may help, it's a judgment call, I suppose
We don't have any boards with swapped mac1 and mac2. We'd like to
in that case, why would (mac2-mac1+1) ever be < 0?
Signature · 1 line
balbi
PATCH v5 4/10 ti: common: board_detect: commodify ethaddr environment setting code
Quoted 47 lines · Felipe Balbi
Hi,
Quoted 43 lines · Roger Quadros
Quoted 43 lines · On Tue, Mar 14, 2017 at 3:05 PM Roger Quadros <rogerq at ti.com…
+void
board_ti_set_ethaddr(int index)
+{
+uint8_tmac_addr[6];
+ int i;
+ u64 mac1, mac2;
+ u8 mac_addr1[6], mac_addr2[6];
+ intnum_macs;
+ /*
+ * Export any Ethernet MAC addresses from EEPROM.
+ * The 2 MAC addresses in EEPROM define the address range.
+ */
+board_ti_get_eth_mac_addr(0, mac_addr1);
+board_ti_get_eth_mac_addr(1, mac_addr2);
+
+ if (is_valid_ethaddr(mac_addr1)&&is_valid_ethaddr(mac_addr2)) {
+ mac1 =mac_to_u64(mac_addr1);
+ mac2 =mac_to_u64(mac_addr2);
+
+ /* must contain an address range */
+num_macs= mac2 - mac1 + 1;
+ if (num_macs<= 0)
+ return;seems like there's still one minor improvement here:
If
num_macs< 0, then it could be that mac1 and mac2 are swapped.Perhaps test for that ?
if (
num_macs== 0)bail();if (num_macs < 0) { if ((mac1 - mac2 + 1) < 50) { num_macs = mac1 - mac2 + 1; mac1 ^= mac2; mac2 ^= mac1; mac1 ^= mac2;[...]
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
don't know how much this may help, it's a judgment call, I suppose
We don't have any boards with swapped mac1 and mac2. We'd like to
in that case, why would (mac2-mac1+1) ever be < 0?
For incorrectly programmed boards in pre-production probably.
Signature · 2 lines
cheers, -roger
PATCH v5 4/10 ti: common: board_detect: commodify ethaddr environment setting code
In reply to Roger QuadrosQuoted 6 lines · Roger Quadros
Keystone and OMAP platforms will need this to set ethernet MAC addresses from board EEPROM.
Signed-off-by Roger Quadros <[email protected]>Reviewed-by Lokesh Vutla <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/aaf21d36/attachment.sig>
PATCH v4 5/10 board: ti: am571x-idk: Support 6 port Ethernet or 4 port Ethernet with LCD
In reply to Roger QuadrosThe board can support either ICSS1 Ethernet ports or LCD based on J51 jumper. Factory default is ICSS1 Ethernet ports (i.e. Jumper not populated).
Use the GPIO to detect the jumper setting and configure the pinmux accordingly. Also select the right DT blob based on the chosen configuration.
J51 absent -> ICSS1 Ethernet, no LCD on VOUT -> am571x-idk.dtb J51 present -> LCD on VOUT, no ICSS1 Ethernet -> am571x-idk-lcd-osd.dtb
At present we only support the assume it is the Legacy LCD. LCD detection mechanism needs to be added later to differentiate between legacy vs new LCD.
For ICSS1 Ethernet pins use the following convention to set the pinmux as PMT data is not yet finalized.
- If pin is output, set as PIN_OUTPUT
- If pin is input and external pull resistor present set as PIN_INPUT
- If pin is input and external pull resistor absent, set pull to same as that of the external PHY's internall pull.
- Do not use SLEW_CONTROLon any pin.
--- board/ti/am57xx/board.c | 40 +++++++++++++++++ board/ti/am57xx/mux_data.h | 104 ++++++++++++++++++++++++++++++--------------- 2 files changed, 109 insertions(+), 35 deletions(-)
board/ti/am57xx/board.c +40 -0
@@ -50,6 +50,7 @@DECLARE_GLOBAL_DATA_PTR ; +#define GPIO_ETH_LCD GPIO_TO_PIN(2, 22)/* GPIO 7_11 */ #define GPIO_DDR_VTT_EN 203
@@ -449,6 +450,21 @@ void hw_data_init(void) *ctrl = &dra7xx_ctrl; } +bool am571x_idk_needs_lcd (void ) +{ +bool needs_lcd; + +gpio_request (GPIO_ETH_LCD ,"nLCD_Detect" ); +if (gpio_get_value (GPIO_ETH_LCD )) + needs_lcd = false; +else + needs_lcd = true; + +gpio_free (GPIO_ETH_LCD ); + +return needs_lcd; +} +int board_init (void ) {gpmc_init ();
@@ -459,6 +475,8 @@ int board_init(void)int board_late_init (void ) { +char *idk_lcd; +setup_board_eeprom_env ();u8 val;
@@ -489,6 +507,17 @@ int board_late_init(void)omap_die_id_serial (); +/* TBD: Add LCD panel detection once information is available */ +if (am571x_idk_needs_lcd ()) + idk_lcd ="osd101t2045" ;/* Default to legacy LCD */ +else + idk_lcd ="no" ; +setenv ("idk_lcd" , idk_lcd); + +#if !defined(CONFIG_SPL_BUILD ) +board_ti_set_ethaddr (2 ); +#endif +return 0 ; }
@@ -551,6 +580,17 @@ void recalibrate_iodelay(void)do_set_mux32 ((*ctrl)->control_padconf_core_base, pconf, pconf_sz); } +if (board_is_am571x_idk ()) { +if (am571x_idk_needs_lcd ()) { + pconf = core_padconf_array_vout_am571x_idk; + pconf_sz =ARRAY_SIZE (core_padconf_array_vout_am571x_idk); + }else { + pconf = core_padconf_array_icss1eth_am571x_idk; + pconf_sz =ARRAY_SIZE (core_padconf_array_icss1eth_am571x_idk); + } +do_set_mux32 ((*ctrl)->control_padconf_core_base, pconf, pconf_sz); + } +/* Setup IOdelay configuration */ ret =do_set_iodelay ((*ctrl)->iodelay_config_base, iod, iod_sz); err:
board/ti/am57xx/mux_data.h +69 -35
123 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 5/10 board: ti: am571x-idk: Support 6 port Ethernet or 4 port Ethernet with LCD
Quoted 24 lines · Roger Quadros
The board can support either ICSS1 Ethernet ports or LCD based on J51 jumper. Factory default is ICSS1 Ethernet ports (i.e. Jumper not populated).
Use the GPIO to detect the jumper setting and configure the pinmux accordingly. Also select the right DT blob based on the chosen configuration.
J51 absent -> ICSS1 Ethernet, no LCD on VOUT -> am571x-idk.dtb J51 present -> LCD on VOUT, no ICSS1 Ethernet -> am571x-idk-lcd-osd.dtb
At present we only support the assume it is the Legacy LCD. LCD detection mechanism needs to be added later to differentiate between legacy vs new LCD.
For ICSS1 Ethernet pins use the following convention to set the pinmux as PMT data is not yet finalized.
- If pin is output, set as
PIN_OUTPUT
- If pin is input and external pull resistor present set asPIN_INPUT
- If pin is input and external pull resistor absent, set pull to same as that of the external PHY's internall pull.
- Do not useSLEW_CONTROLonany pin.
Quoted 4 lines
Cc Nishanth Menon <[email protected]>Signed-off-by Roger Quadros <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Lokesh Vutla <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/d1e11ec7/attachment.sig>
PATCH v4 6/10 board: ti: am571x-idk: Update pinmux for ICSS2 Ethernet
In reply to Roger QuadrosUse the same convention that was used for ICSS1 Ethernet
- If pin is output, set as PIN_OUTPUT
- If pin is input and external pull resistor present set as PIN_INPUT
- If pin is input and external pull resistor absent, set pull to same as that of the external PHY's internall pull.
--- board/ti/am57xx/mux_data.h | 62 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-)
board/ti/am57xx/mux_data.h +31 -31
@@ -586,46 +586,46 @@ const struct pad_conf_entry core_padconf_array_essential_am571x_idk[] = { {GPIO6_14, (M14 | PIN_INPUT_PULLUP)}, /* gpio6_14.gpio6_14 */ {GPIO6_15, (M14 | PIN_INPUT_PULLUP)}, /* gpio6_15.gpio6_15 */ {GPIO6_16, (M14 | PIN_INPUT_PULLDOWN)}, /* gpio6_16.gpio6_16 */ - {XREF_CLK0, (M11 | PIN_INPUT_PULLDOWN)}, /* xref_clk0.pr2_mii1_col */ - {XREF_CLK1, (M11 | PIN_INPUT_PULLDOWN)}, /* xref_clk1.pr2_mii1_crs */ + {XREF_CLK0, (M11 | PIN_INPUT)}, /* xref_clk0.pr2_mii1_col */ + {XREF_CLK1, (M11 | PIN_INPUT_PULLUP)}, /* xref_clk1.pr2_mii1_crs */ {XREF_CLK2, (M14 | PIN_INPUT_PULLDOWN)}, /* xref_clk2.gpio6_19 */ {XREF_CLK3, (M15 | PIN_INPUT_PULLDOWN)}, /* xref_clk3.Driveroff */ {MCASP1_ACLKX, (M11 | PIN_INPUT_PULLDOWN)}, /* mcasp1_aclkx.pr2_mdio_mdclk */ {MCASP1_FSX, (M11 | PIN_INPUT_SLEW)}, /* mcasp1_fsx.pr2_mdio_data */ {MCASP1_ACLKR, (M14 | PIN_INPUT_PULLUP)}, /* mcasp1_aclkr.gpio5_0 */ {MCASP1_FSR, (M14 | PIN_INPUT_PULLUP)}, /* mcasp1_fsr.gpio5_1 */ - {MCASP1_AXR0, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)}, /* mcasp1_axr0.pr2_mii0_rxer */ - {MCASP1_AXR1, (M11 | PIN_INPUT_SLEW)}, /* mcasp1_axr1.pr2_mii_mt0_clk */ + {MCASP1_AXR0, (M11 | PIN_INPUT_PULLUP)}, /* mcasp1_axr0.pr2_mii0_rxer */ + {MCASP1_AXR1, (M11 | PIN_INPUT_PULLDOWN)}, /* mcasp1_axr1.pr2_mii_mt0_clk */ {MCASP1_AXR2, (M14 | PIN_INPUT_PULLDOWN)}, /* mcasp1_axr2.gpio5_4 */ {MCASP1_AXR3, (M14 | PIN_INPUT_PULLUP)}, /* mcasp1_axr3.gpio5_5 */ {MCASP1_AXR4, (M14 | PIN_INPUT_PULLDOWN)}, /* mcasp1_axr4.gpio5_6 */ {MCASP1_AXR5, (M14 | PIN_INPUT_PULLDOWN)}, /* mcasp1_axr5.gpio5_7 */ {MCASP1_AXR6, (M14 | PIN_INPUT_PULLUP)}, /* mcasp1_axr6.gpio5_8 */ {MCASP1_AXR7, (M14 | PIN_INPUT_PULLUP)}, /* mcasp1_axr7.gpio5_9 */ - {MCASP1_AXR8, (M11 | PIN_INPUT_SLEW)}, /* mcasp1_axr8.pr2_mii0_txen */ - {MCASP1_AXR9, (M11 | PIN_INPUT_SLEW)}, /* mcasp1_axr9.pr2_mii0_txd3 */ - {MCASP1_AXR10, (M11 | PIN_INPUT_SLEW)}, /* mcasp1_axr10.pr2_mii0_txd2 */ - {MCASP1_AXR11, (M11 | PIN_INPUT_SLEW)}, /* mcasp1_axr11.pr2_mii0_txd1 */ - {MCASP1_AXR12, (M11 | PIN_INPUT_SLEW)}, /* mcasp1_axr12.pr2_mii0_txd0 */ - {MCASP1_AXR13, (M11 | PIN_INPUT_SLEW)}, /* mcasp1_axr13.pr2_mii_mr0_clk */ - {MCASP1_AXR14, (M11 | PIN_INPUT_PULLDOWN | SLEWCONTROL)}, /* mcasp1_axr14.pr2_mii0_rxdv */ - {MCASP1_AXR15, (M11 | PIN_INPUT_SLEW)}, /* mcasp1_axr15.pr2_mii0_rxd3 */ - {MCASP2_ACLKX, (M11 | PIN_INPUT_SLEW)}, /* mcasp2_aclkx.pr2_mii0_rxd2 */ - {MCASP2_FSX, (M11 | PIN_INPUT_SLEW)}, /* mcasp2_fsx.pr2_mii0_rxd1 */ + {MCASP1_AXR8, (M11 | PIN_OUTPUT)}, /* mcasp1_axr8.pr2_mii0_txen */ + {MCASP1_AXR9, (M11 | PIN_OUTPUT)}, /* mcasp1_axr9.pr2_mii0_txd3 */ + {MCASP1_AXR10, (M11 | PIN_OUTPUT)}, /* mcasp1_axr10.pr2_mii0_txd2 */ + {MCASP1_AXR11, (M11 | PIN_OUTPUT)}, /* mcasp1_axr11.pr2_mii0_txd1 */ + {MCASP1_AXR12, (M11 | PIN_OUTPUT)}, /* mcasp1_axr12.pr2_mii0_txd0 */ + {MCASP1_AXR13, (M11 | PIN_INPUT_PULLDOWN)}, /* mcasp1_axr13.pr2_mii_mr0_clk */ + {MCASP1_AXR14, (M11 | PIN_INPUT_PULLDOWN)}, /* mcasp1_axr14.pr2_mii0_rxdv */ + {MCASP1_AXR15, (M11 | PIN_INPUT)}, /* mcasp1_axr15.pr2_mii0_rxd3 */ + {MCASP2_ACLKX, (M11 | PIN_INPUT)}, /* mcasp2_aclkx.pr2_mii0_rxd2 */ + {MCASP2_FSX, (M11 | PIN_INPUT)}, /* mcasp2_fsx.pr2_mii0_rxd1 */ {MCASP2_ACLKR, (M15 | PIN_INPUT_PULLDOWN)}, /* mcasp2_aclkr.Driveroff */ {MCASP2_FSR, (M15 | PIN_INPUT_PULLDOWN)}, /* mcasp2_fsr.Driveroff */ {MCASP2_AXR0, (M15 | PIN_INPUT_PULLDOWN)}, /* mcasp2_axr0.Driveroff */ {MCASP2_AXR1, (M15 | PIN_INPUT_PULLDOWN)}, /* mcasp2_axr1.Driveroff */ - {MCASP2_AXR2, (M11 | PIN_INPUT_SLEW)}, /* mcasp2_axr2.pr2_mii0_rxd0 */ - {MCASP2_AXR3, (M11 | PIN_INPUT_PULLDOWN | SLEWCONTROL)}, /* mcasp2_axr3.pr2_mii0_rxlink */ + {MCASP2_AXR2, (M11 | PIN_INPUT)}, /* mcasp2_axr2.pr2_mii0_rxd0 */ + {MCASP2_AXR3, (M11 | PIN_INPUT)}, /* mcasp2_axr3.pr2_mii0_rxlink */ {MCASP2_AXR4, (M14 | PIN_INPUT_PULLDOWN)}, /* mcasp2_axr4.gpio1_4 */ {MCASP2_AXR5, (M14 | PIN_INPUT_PULLDOWN)}, /* mcasp2_axr5.gpio6_7 */ {MCASP2_AXR6, (M14 | PIN_INPUT_PULLDOWN)}, /* mcasp2_axr6.gpio2_29 */ {MCASP2_AXR7, (M14 | PIN_INPUT_PULLDOWN)}, /* mcasp2_axr7.gpio1_5 */ - {MCASP3_ACLKX, (M11 | PIN_INPUT_PULLDOWN)}, /* mcasp3_aclkx.pr2_mii0_crs */ - {MCASP3_FSX, (M11 | PIN_INPUT_SLEW)}, /* mcasp3_fsx.pr2_mii0_col */ - {MCASP3_AXR0, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)}, /* mcasp3_axr0.pr2_mii1_rxer */ - {MCASP3_AXR1, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)}, /* mcasp3_axr1.pr2_mii1_rxlink */ + {MCASP3_ACLKX, (M11 | PIN_INPUT_PULLUP)}, /* mcasp3_aclkx.pr2_mii0_crs */ + {MCASP3_FSX, (M11 | PIN_INPUT)}, /* mcasp3_fsx.pr2_mii0_col */ + {MCASP3_AXR0, (M11 | PIN_INPUT_PULLUP)}, /* mcasp3_axr0.pr2_mii1_rxer */ + {MCASP3_AXR1, (M11 | PIN_INPUT)}, /* mcasp3_axr1.pr2_mii1_rxlink */ {MCASP4_ACLKX, (M2 | PIN_INPUT_PULLDOWN)}, /* mcasp4_aclkx.spi3_sclk */ {MCASP4_FSX, (M2 | PIN_INPUT_PULLDOWN)}, /* mcasp4_fsx.spi3_d1 */ {MCASP4_AXR0, (M15 | PIN_INPUT_PULLDOWN)}, /* mcasp4_axr0.Driveroff */
@@ -642,18 +642,18 @@ const struct pad_conf_entry core_padconf_array_essential_am571x_idk[] = { {MMC1_DAT3, (M0 | PIN_INPUT_PULLUP)}, /* mmc1_dat3.mmc1_dat3 */ {MMC1_SDCD, (M14 | PIN_INPUT_PULLUP)}, /* mmc1_sdcd.gpio6_27 */ {MMC1_SDWP, (M0 | PIN_OUTPUT)}, /* mmc1_sdwp.mmc1_sdwp */ - {GPIO6_10, (M11 | PIN_INPUT_PULLUP)}, /* gpio6_10.pr2_mii_mt1_clk */ - {GPIO6_11, (M11 | PIN_INPUT_PULLUP)}, /* gpio6_11.pr2_mii1_txen */ - {MMC3_CLK, (M11 | PIN_INPUT_PULLUP)}, /* mmc3_clk.pr2_mii1_txd3 */ - {MMC3_CMD, (M11 | PIN_INPUT_PULLUP)}, /* mmc3_cmd.pr2_mii1_txd2 */ - {MMC3_DAT0, (M11 | PIN_INPUT_PULLUP)}, /* mmc3_dat0.pr2_mii1_txd1 */ - {MMC3_DAT1, (M11 | PIN_INPUT_PULLUP)}, /* mmc3_dat1.pr2_mii1_txd0 */ - {MMC3_DAT2, (M11 | PIN_INPUT_PULLUP)}, /* mmc3_dat2.pr2_mii_mr1_clk */ + {GPIO6_10, (M11 | PIN_INPUT_PULLDOWN)}, /* gpio6_10.pr2_mii_mt1_clk */ + {GPIO6_11, (M11 | PIN_OUTPUT)}, /* gpio6_11.pr2_mii1_txen */ + {MMC3_CLK, (M11 | PIN_OUTPUT)}, /* mmc3_clk.pr2_mii1_txd3 */ + {MMC3_CMD, (M11 | PIN_OUTPUT)}, /* mmc3_cmd.pr2_mii1_txd2 */ + {MMC3_DAT0, (M11 | PIN_OUTPUT)}, /* mmc3_dat0.pr2_mii1_txd1 */ + {MMC3_DAT1, (M11 | PIN_OUTPUT)}, /* mmc3_dat1.pr2_mii1_txd0 */ + {MMC3_DAT2, (M11 | PIN_INPUT_PULLDOWN)}, /* mmc3_dat2.pr2_mii_mr1_clk */ {MMC3_DAT3, (M11 | PIN_INPUT_PULLDOWN)}, /* mmc3_dat3.pr2_mii1_rxdv */ - {MMC3_DAT4, (M11 | PIN_INPUT_PULLDOWN)}, /* mmc3_dat4.pr2_mii1_rxd3 */ - {MMC3_DAT5, (M11 | PIN_INPUT_PULLDOWN)}, /* mmc3_dat5.pr2_mii1_rxd2 */ - {MMC3_DAT6, (M11 | PIN_INPUT_PULLDOWN)}, /* mmc3_dat6.pr2_mii1_rxd1 */ - {MMC3_DAT7, (M11 | PIN_INPUT_PULLDOWN)}, /* mmc3_dat7.pr2_mii1_rxd0 */ + {MMC3_DAT4, (M11 | PIN_INPUT)}, /* mmc3_dat4.pr2_mii1_rxd3 */ + {MMC3_DAT5, (M11 | PIN_INPUT)}, /* mmc3_dat5.pr2_mii1_rxd2 */ + {MMC3_DAT6, (M11 | PIN_INPUT)}, /* mmc3_dat6.pr2_mii1_rxd1 */ + {MMC3_DAT7, (M11 | PIN_INPUT)}, /* mmc3_dat7.pr2_mii1_rxd0 */ {SPI1_SCLK, (M14 | PIN_INPUT_PULLDOWN)}, /* spi1_sclk.gpio7_7 */ {SPI1_D1, (M14 | PIN_INPUT_PULLDOWN)}, /* spi1_d1.gpio7_8 */ {SPI1_D0, (M14 | PIN_INPUT_PULLDOWN)}, /* spi1_d0.gpio7_9 */
Signature · 1 line
2.7.4
PATCH v4 6/10 board: ti: am571x-idk: Update pinmux for ICSS2 Ethernet
Quoted 9 lines · Roger Quadros
Use the same convention that was used for ICSS1 Ethernet
- If pin is output, set asPIN_OUTPUT
- If pin is input and external pull resistor present set asPIN_INPUT
- If pin is input and external pull resistor absent, set pull to same as that of the external PHY's internall pull.Signed-off-by Roger Quadros <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Lokesh Vutla <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/f1895f27/attachment.sig>
PATCH v4 7/10 board: ti: am57xx-idk: Auto detect LCD Panel
In reply to Roger QuadrosFrom: Nishanth Menon <[email protected]>
AM571x IDK and AM572x IDK have optional LCD Kits that can be purchased. These can be one of OSD101T2045 or the newer OSD101T2587. The LCD panel itself has no registers that can be used to identify the panel, however, the touchscreen controllers on the panels are different.
Hence to ease user experience, we can use the touch screen controller's ID information to detect what kind of panel we use and select the appropriate kernel dtb for the platform configuration.
NOTE: AM572x IDK default configuration is for LCD Connectivity, however the AM571x IDK has a jumper (J51) that needs to be mounted for the IDK to operate with LCD (Vs two PRUSS ethernet port option).
Touchscreen ID information is documented in:
http://www.osddisplays.com/TI/OSD101T2587-53TS_A.1.pdf
--- board/ti/am57xx/board.c | 78 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 8 deletions(-)
board/ti/am57xx/board.c +70 -8
@@ -54,6 +54,19 @@ DECLARE_GLOBAL_DATA_PTR;/* GPIO 7_11 */ #define GPIO_DDR_VTT_EN 203 +/* Touch screen controller to identify the LCD */ +#define OSD_TS_FT_BUS_ADDRESS 0 +#define OSD_TS_FT_CHIP_ADDRESS 0x38 +#define OSD_TS_FT_REG_ID 0xA3 +/* +* Touchscreen IDs for various OSD panels +* Ref: http://www.osddisplays.com/TI/OSD101T2587-53TS_A.1.pdf +*/ +/* Used on newer osd101t2587 Panels */ +#define OSD_TS_FT_ID_5x46 0x54 +/* Used on older osd101t2045 Panels */ +#define OSD_TS_FT_ID_5606 0x08 +#define SYSINFO_BOARD_NAME_MAX_LEN 45#define TPS65903X_PRIMARY_SECONDARY_PAD2 0xFB
@@ -473,10 +486,64 @@ int board_init(void)return 0 ; } -int board_late_init (void ) +void am57x_idk_lcd_detect (void ) { -char *idk_lcd; +int r = -ENODEV ; +char *idk_lcd ="no" ; +uint8_t buf =0 ; + +/* Only valid for IDKs */ +if (board_is_x15 () ||board_is_am572x_evm ()) +return ; + +/* Only AM571x IDK has gpio control detect.. so check that */ +if (board_is_am571x_idk () && !am571x_idk_needs_lcd ()) + goto out; + + r =i2c_set_bus_num (OSD_TS_FT_BUS_ADDRESS ); +if (r) { +printf ("%s: Failed to set bus address to %d: %d\n" , + __func__,OSD_TS_FT_BUS_ADDRESS , r); + goto out; + } + r =i2c_probe (OSD_TS_FT_CHIP_ADDRESS ); +if (r) { +/* AM572x IDK has no explicit settings for optional LCD kit */ +if (board_is_am571x_idk ()) { +printf ("%s: Touch screen detect failed: %d!\n" , + __func__, r); + } + goto out; + } + +/* Read FT ID */ + r =i2c_read (OSD_TS_FT_CHIP_ADDRESS ,OSD_TS_FT_REG_ID ,1 , &buf,1 ); +if (r) { +printf ("%s: Touch screen ID read %d:0x%02x[0x%02x] failed:%d\n" , + __func__,OSD_TS_FT_BUS_ADDRESS ,OSD_TS_FT_CHIP_ADDRESS , +OSD_TS_FT_REG_ID , r); + goto out; + } + +switch (buf) { +case OSD_TS_FT_ID_5606 : + idk_lcd ="osd101t2045" ; +break ; +case OSD_TS_FT_ID_5x46: + idk_lcd ="osd101t2587" ; +break ; +default : +printf ("%s: Unidentifed Touch screen ID 0x%02x\n" , + __func__, buf); +/* we will let default be "no lcd" */ + } +out: +setenv ("idk_lcd" , idk_lcd); +return ; +} +int board_late_init (void ) +{setup_board_eeprom_env ();u8 val;
@@ -507,12 +574,7 @@ int board_late_init(void)omap_die_id_serial (); -/* TBD: Add LCD panel detection once information is available */ -if (am571x_idk_needs_lcd ()) - idk_lcd ="osd101t2045" ;/* Default to legacy LCD */ -else - idk_lcd ="no" ; -setenv ("idk_lcd" , idk_lcd); +am57x_idk_lcd_detect ();#if !defined(CONFIG_SPL_BUILD )board_ti_set_ethaddr (2 );
Signature · 1 line
2.7.4
PATCH v4 7/10 board: ti: am57xx-idk: Auto detect LCD Panel
Quoted 15 lines · Roger Quadros
From: Nishanth Menon <[email protected]>
AM571x IDK and AM572x IDK have optional LCD Kits that can be purchased. These can be one of OSD101T2045 or the newer OSD101T2587. The LCD panel itself has no registers that can be used to identify the panel, however, the touchscreen controllers on the panels are different.
Hence to ease user experience, we can use the touch screen controller's ID information to detect what kind of panel we use and select the appropriate kernel dtb for the platform configuration.
NOTE: AM572x IDK default configuration is for LCD Connectivity, however the AM571x IDK has a jumper (J51) that needs to be mounted for the IDK to operate with LCD (Vs two PRUSS ethernet port option).
Quoted 8 lines
Touchscreen ID information is documented in:
http://www.osddisplays.com/TI/OSD101T2587-53TS_A.1.pdfAcked-by Lokesh Vutla <[email protected]>Signed-off-by Nishanth Menon <[email protected]>Signed-off-by Lokesh Vutla <[email protected]>Signed-off-by Roger Quadros <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/a47b457b/attachment.sig>
PATCH v4 8/10 ARM: Use Kconfig for board EEPROM's I2C bus and chip address
In reply to Roger QuadrosIn stead of defining the board EEPROM address in the board headers let's define them in the board config files and make them configurable by Kconfig.
--- board/ti/common/Kconfig | 20 +++++++++++++++++--- board/ti/ks2_evm/Kconfig | 2 ++ include/configs/am57xx_evm.h | 4 ---- include/configs/dra7xx_evm.h | 4 ---- 4 files changed, 19 insertions(+), 11 deletions(-)
board/ti/common/Kconfig +17 -3
@@ -1,12 +1,24 @@ -config SPL_ENV_SUPPORT - default y - config TI_I2C_BOARD_DETECT bool "Support for Board detection for TI platforms" help Support for detection board information on Texas Instrument's Evaluation Boards which have I2C based EEPROM detection +config EEPROM_BUS_ADDRESS + int "Board EEPROM's I2C bus address" + range 0 8 + default 0 + +config EEPROM_CHIP_ADDRESS + hex "Board EEPROM's I2C chip address" + range 0 0xff + default 0x50 + +if ARCH_OMAP2 + +config SPL_ENV_SUPPORT + default y + config SPL_EXT_SUPPORT default y
@@ -39,3 +51,5 @@ config SPL_POWER_SUPPORT config SPL_SERIAL_SUPPORT default y + +endif
board/ti/ks2_evm/Kconfig +2 -0
@@ -49,3 +49,5 @@ config SYS_CONFIG_NAME default "k2g_evm" endif + +source "board/ti/common/Kconfig"
include/configs/am57xx_evm.h +0 -4
@@ -103,10 +103,6 @@#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ CONFIG_SYS_SCSI_MAX_LUN) -/* EEPROM */ -#define CONFIG_EEPROM_CHIP_ADDRESS 0x50 -#define CONFIG_EEPROM_BUS_ADDRESS 0 -/* * Default to using SPI for environment, etc. * 0x000000 - 0x040000 : QSPI.SPL (256KiB)
include/configs/dra7xx_evm.h +0 -4
@@ -261,8 +261,4 @@#endif #endif /* NOR support */ -/* EEPROM */ -#define CONFIG_EEPROM_CHIP_ADDRESS 0x50 -#define CONFIG_EEPROM_BUS_ADDRESS 0 -#endif /* __CONFIG_DRA7XX_EVM_H */
Signature · 1 line
2.7.4
PATCH v4 8/10 ARM: Use Kconfig for board EEPROM's I2C bus and chip address
Quoted 6 lines · Roger Quadros
In stead of defining the board EEPROM address in the board headers let's define them in the board config files and make them configurable by
Kconfig.Signed-off-by Roger Quadros <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/eb372e0c/attachment.sig>
PATCH v4 9/10 ARM: k2g: setup PRU ethernet MAC addresses
In reply to Roger QuadrosPRU ethernet MAC address range is present in the board EEPROM. Parse it and setup eth?addr environment variables.
--- arch/arm/mach-keystone/Kconfig | 2 ++ board/ti/ks2_evm/board_k2g.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+)
arch/arm/mach-keystone/Kconfig +2 -0
@@ -15,6 +15,8 @@ config TARGET_K2L_EVM config TARGET_K2G_EVM bool "TI Keystone 2 Galileo EVM" + select BOARD_LATE_INIT + select TI_I2C_BOARD_DETECT endchoice
board/ti/ks2_evm/board_k2g.c +19 -0
@@ -12,6 +12,7 @@#include <asm/arch/psc_defs.h> #include <asm/arch/mmc_host_def.h> #include "mux-k2g.h" +#include "../common/board_detect.h" #define SYS_CLK 24000000
@@ -149,6 +150,24 @@ int board_early_init_f(void) }#endif +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init (void ) +{ +#if !defined(CONFIG_SPL_BUILD ) && defined(CONFIG_TI_I2C_BOARD_DETECT ) +int rc; + + rc =ti_i2c_eeprom_am_get (CONFIG_EEPROM_BUS_ADDRESS , +CONFIG_EEPROM_CHIP_ADDRESS ); +if (rc) +printf ("ti_i2c_eeprom_init failed %d\n" , rc); + +board_ti_set_ethaddr (1 ); +#endif + +return 0 ; +} +#endif +#ifdef CONFIG_SPL_BUILD void spl_init_keystone_plls (void ) {
Signature · 1 line
2.7.4
PATCH v4 9/10 ARM: k2g: setup PRU ethernet MAC addresses
Quoted 7 lines · Roger Quadros
PRU ethernet MAC address range is present in the board EEPROM. Parse it and setup eth?addr environment variables.
Signed-off-by Roger Quadros <[email protected]>Reviewed-by Lokesh Vutla <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/28a5d046/attachment.sig>
PATCH v4 10/10 net: don't override ethernet address environment
In reply to Roger QuadrosIf the ethernet address environment is set with a valid ethernet address prevent overriding it as it is most likely set by the user and he/she doesn't want board code to automatically override it whatsoever.
--- net/eth_common.c | 3 +++ 1 file changed, 3 insertions(+)
net/eth_common.c +3 -0
@@ -34,6 +34,9 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr) {char buf[ARP_HLEN_ASCII +1 ]; +if (eth_getenv_enetaddr (name, (uchar *)buf)) +return -EEXIST ; +sprintf (buf,"%pM" , enetaddr);return setenv (name, buf);
Signature · 1 line
2.7.4
PATCH v4 10/10 net: don't override ethernet address environment
Quoted 6 lines · Roger Quadros
If the ethernet address environment is set with a valid ethernet address prevent overriding it as it is most likely set by the user and he/she doesn't want board code to automatically override it whatsoever.
Signed-off-by Roger Quadros <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/8f7c7fd7/attachment.sig>
PATCH v4 10/10 net: don't override ethernet address environment
In reply to Roger QuadrosQuoted 7 lines · Roger Quadros
If the ethernet address environment is set with a valid ethernet address prevent overriding it as it is most likely set by the user and he/she doesn't want board code to automatically override it whatsoever.
Signed-off-by Roger Quadros <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/674bc4d3/attachment.sig>
v4 cover am57xx-idk LCD and am571x-idk 6 port ethernet pinmux
In reply to Roger QuadrosQuoted 10 lines · Roger Quadros
Hi,
This series contains
- Support am571x-idk LCD vs 6 port ethernet pinmux configuration.
- AM57xx-idk LCD detection support.
- K2G: pick up PRUSS ethernet MAC addresses from board EEPROM.Build tests:
https://travis-ci.org/rogerq/u-boot/builds/210547470
Woo, thanks for pushing this through travis-ci!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/fefc9234/attachment.sig>