OMAP3: use a single board file for IGEP devices
PATCH 1/2 OMAP3: use a single board file for IGEP devices
Even when the IGEPv2 board and the IGEP Computer-on-Module are different from a form factor point of view, they are very similar in the fact that share many components and how they are wired.
So, it is possible (and better) to have a single board file for both devices and just use the CONFIG_MACH_TYPE to make a differentiation between both boards when needed.
This change avoids duplication by removing 298 lines of code and makes future maintenance easier.
--- board/isee/igep0020/Makefile | 43 --------- board/isee/igep0020/igep0020.c | 177 -------------------------------------- board/isee/igep0020/igep0020.h | 151 -------------------------------- board/isee/igep0030/Makefile | 43 --------- board/isee/igep0030/igep0030.c | 118 ------------------------- board/isee/igep0030/igep0030.h | 151 -------------------------------- board/isee/igep00x0/Makefile | 43 +++++++++ board/isee/igep00x0/igep00x0.c | 186 ++++++++++++++++++++++++++++++++++++++++ board/isee/igep00x0/igep00x0.h | 165 +++++++++++++++++++++++++++++++++++ boards.cfg | 8 +- 10 files changed, 398 insertions(+), 687 deletions(-) delete mode 100644 board/isee/igep0020/Makefile delete mode 100644 board/isee/igep0020/igep0020.c delete mode 100644 board/isee/igep0020/igep0020.h delete mode 100644 board/isee/igep0030/Makefile delete mode 100644 board/isee/igep0030/igep0030.c delete mode 100644 board/isee/igep0030/igep0030.h create mode 100644 board/isee/igep00x0/Makefile create mode 100644 board/isee/igep00x0/igep00x0.c create mode 100644 board/isee/igep00x0/igep00x0.h
board/isee/igep0020/Makefile deleted +0 -43
@@ -1,43 +0,0 @@ -# -# (C) Copyright 2000, 2001, 2002 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA -# - -include $(TOPDIR)/config.mk - -LIB = $(obj)lib$(BOARD).o - -COBJS := igep0020.o - -SRCS := $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) - -$(LIB): $(obj).depend $(OBJS) - $(call cmd_link_o_target, $(OBJS)) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -#########################################################################
board/isee/igep0020/igep0020.c deleted +0 -177
177 lines not on this page · raw message
board/isee/igep0020/igep0020.h deleted +0 -151
151 lines not on this page · raw message
board/isee/igep0030/Makefile deleted +0 -43
43 lines not on this page · raw message
board/isee/igep0030/igep0030.c deleted +0 -118
118 lines not on this page · raw message
board/isee/igep0030/igep0030.h deleted +0 -151
151 lines not on this page · raw message
board/isee/igep00x0/Makefile new file +43 -0
43 lines not on this page · raw message
board/isee/igep00x0/igep00x0.c new file +186 -0
186 lines not on this page · raw message
board/isee/igep00x0/igep00x0.h new file +165 -0
165 lines not on this page · raw message
boards.cfg +4 -4
@@ -253,10 +253,10 @@ cm_t35 arm armv7 cm_t35 - omap3_overo arm armv7 overo - omap3 omap3_pandora arm armv7 pandora - omap3 dig297 arm armv7 dig297 comelit omap3 -igep0020 arm armv7 igep0020 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_ONENAND -igep0020_nand arm armv7 igep0020 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_NAND -igep0030 arm armv7 igep0030 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_ONENAND -igep0030_nand arm armv7 igep0030 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_NAND +igep0020 arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_ONENAND +igep0020_nand arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_NAND +igep0030 arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_ONENAND +igep0030_nand arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_NAND am3517_evm arm armv7 am3517evm logicpd omap3 mt_ventoux arm armv7 mt_ventoux teejet omap3 omap3_zoom1 arm armv7 zoom1 logicpd omap3
Signature · 1 line
1.7.7.6
PATCH v4 2/2 OMAP3: igep00x0: add boot status GPIO LED
This patch adds an GPIO LED boot status for IGEP boards.
The GPIO LED used is the red LED0 while the Linux kernel uses the green LED0 as the boot status.
By using different GPIO LEDs, the user can know in which step of the boot process the board currently is.
---
Changes since v3:
- Avoid code duplication but having a single show_boot_progress() function as suggested by Wolfgang Denk.
Changes since v2:
- Use show_boot_progress() instead implementing yet another boot status signalling as suggested by Wolfgang Denk.
Changes since v1:
- Don't set gd->bd->bi_arch_number since is done in arch/arm/lib/board.c
- Use CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020 instead of check bi_arch_number as suggested by Igor Grinberg.
board/isee/igep00x0/igep00x0.c | 15 +++++++++++++++ board/isee/igep00x0/igep00x0.h | 8 ++++++++ include/configs/igep00x0.h | 3 +++ 3 files changed, 26 insertions(+), 0 deletions(-)
board/isee/igep00x0/igep00x0.c +15 -0
@@ -62,6 +62,21 @@ int board_init(void)return 0 ; } +#if defined(CONFIG_SHOW_BOOT_PROGRESS ) && !defined(CONFIG_SPL_BUILD ) +void show_boot_progress (int val) +{ +if (val <0 ) { +/* something went wrong */ +return ; + } + +if (!gpio_request (IGEP00X0_GPIO_LED ,"" )) { +gpio_direction_output (IGEP00X0_GPIO_LED ,0 ); +gpio_set_value (IGEP00X0_GPIO_LED ,1 ); + } +} +#endif +#ifdef CONFIG_SPL_BUILD /* * Routine: omap_rev_string
board/isee/igep00x0/igep00x0.h +8 -0
@@ -23,6 +23,14 @@#ifndef _IGEP00X0_H_#define _IGEP00X0_H_ +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) +#define IGEP00X0_GPIO_LED 27 +#endif + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0030 ) +#define IGEP00X0_GPIO_LED 16 +#endif +const omap3_sysinfo sysinfo = {DDR_STACKED , #if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020)
include/configs/igep00x0.h +3 -0
@@ -82,6 +82,9 @@#define CONFIG_OMAP_HSMMC 1#define CONFIG_DOS_PARTITION 1 +/* define to enable boot progress via leds */ +#define CONFIG_SHOW_BOOT_PROGRESS +/* USB */ #define CONFIG_MUSB_UDC 1#define CONFIG_USB_OMAP3 1
Signature · 1 line
1.7.7.6
PATCH v4 2/2 OMAP3: igep00x0: add boot status GPIO LED
Quoted 38 lines · Javier Martinez Canillas
This patch adds an GPIO LED boot status for IGEP boards.
The GPIO LED used is the red LED0 while the Linux kernel uses the green LED0 as the boot status.
By using different GPIO LEDs, the user can know in which step of the boot process the board currently is.
Signed-off-by Javier Martinez Canillas <[email protected]>---
Changes since v3:
- Avoid code duplication but having a singleshow_boot_progress()function as suggested by Wolfgang Denk.Changes since v2:
- Useshow_boot_progress()instead implementing yet another boot status signalling as suggested by Wolfgang Denk.Changes since v1:
- Don't setgd->bd->bi_arch_numbersince is done inarch/arm/lib/board.c
- UseCONFIG_MACH_TYPE==MACH_TYPE_IGEP0020instead of checkbi_arch_numberas suggested by Igor Grinberg.board/isee/igep00x0/igep00x0.c | 15 +++++++++++++++ board/isee/igep00x0/igep00x0.h | 8 ++++++++ include/configs/igep00x0.h | 3 +++ 3 files changed, 26 insertions(+), 0 deletions(-)board/isee/igep00x0/igep00x0.c +1
-0@@ -62,6 +62,21 @@ int board_init(void)return 0 ; } +#if defined(CONFIG_SHOW_BOOT_PROGRESS ) && !defined(CONFIG_SPL_BUILD )
board/isee/igep00x0/igep00x0.c int board_init(void) · line 75
Quoted 10 lines
board/isee/igep00x0/igep00x0.c +10
-0+void show_boot_progress (int val) +{ +if (val <0 ) { +/* something went wrong */ +return ; + } + +if (!gpio_request (IGEP00X0_GPIO_LED ,"" )) { +gpio_direction_output (IGEP00X0_GPIO_LED ,0 ); +gpio_set_value (IGEP00X0_GPIO_LED ,1 );
gpio_direction_output() also sets the value. Why do you need to call gpio_set_value() afterwards? Also, you don't have any delay in between, so it does not look like a "blink"...
Quoted 40 lines
board/isee/igep00x0/igep00x0.c +4
-0+ } +} +#endif +#ifdef CONFIG_SPL_BUILD /* * Routine: omap_rev_string board/isee/igep00x0/igep00x0.h +8
-0@@ -23,6 +23,14 @@#ifndef _IGEP00X0_H_#define _IGEP00X0_H_ +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) +#define IGEP00X0_GPIO_LED 27 +#endif + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0030 ) +#define IGEP00X0_GPIO_LED 16 +#endif +const omap3_sysinfo sysinfo = {DDR_STACKED , #if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020)include/configs/igep00x0.h +3
-0@@ -82,6 +82,9 @@#define CONFIG_OMAP_HSMMC 1#define CONFIG_DOS_PARTITION 1 +/* define to enable boot progress via leds */ +#define CONFIG_SHOW_BOOT_PROGRESS +/* USB */ #define CONFIG_MUSB_UDC 1#define CONFIG_USB_OMAP3 1
Signature · 2 lines
Regards, Igor.
PATCH v4 2/2 OMAP3: igep00x0: add boot status GPIO LED
Quoted 37 lines · Javier Martinez Canillas
Quoted 37 lines
This patch adds an GPIO LED boot status for IGEP boards.
The GPIO LED used is the red LED0 while the Linux kernel uses the green LED0 as the boot status.
By using different GPIO LEDs, the user can know in which step of the boot process the board currently is.
Signed-off-by Javier Martinez Canillas <[email protected]>---
Changes since v3:
- Avoid code duplication but having a singleshow_boot_progress()function as suggested by Wolfgang Denk.Changes since v2:
- Useshow_boot_progress()instead implementing yet another boot status signalling as suggested by Wolfgang Denk.Changes since v1:
- Don't setgd->bd->bi_arch_numbersince is done inarch/arm/lib/board.c
- UseCONFIG_MACH_TYPE==MACH_TYPE_IGEP0020instead of checkbi_arch_numberas suggested by Igor Grinberg.board/isee/igep00x0/igep00x0.c | 15 +++++++++++++++ board/isee/igep00x0/igep00x0.h | 8 ++++++++ include/configs/igep00x0.h | 3 +++ 3 files changed, 26 insertions(+), 0 deletions(-)board/isee/igep00x0/igep00x0.c +0
-0@@ -62,6 +62,21 @@ int board_init(void)return 0 ; }
Quoted 17 lines
board/isee/igep00x0/igep00x0.c int board_init(void) · line 75
Quoted 11 lines
board/isee/igep00x0/igep00x0.c +11
-0+#if defined(CONFIG_SHOW_BOOT_PROGRESS ) && !defined(CONFIG_SPL_BUILD ) +void show_boot_progress (int val) +{ +if (val <0 ) { +/* something went wrong */ +return ; + } + +if (!gpio_request (IGEP00X0_GPIO_LED ,"" )) { +gpio_direction_output (IGEP00X0_GPIO_LED ,0 ); +gpio_set_value (IGEP00X0_GPIO_LED ,1 );
gpio_direction_output()also sets the value. Why do you need to callgpio_set_value()afterwards? Also, you don't have any delay in between, so it does not look like a "blink"...
Hi Igor,
Yes, it's not meant to blink, but keep the led on I just didn't know that it also sets the value.
Will send a new version with gpio_direction_output(IGEP00X0_GPIO_LED,
1) and remove gpio_set_value().
Quoted 34 lines
Quoted 34 lines
board/isee/igep00x0/igep00x0.c +4
-0+ } +} +#endif +#ifdef CONFIG_SPL_BUILD /* * Routine: omap_rev_string board/isee/igep00x0/igep00x0.h +8
-0@@ -23,6 +23,14 @@#ifndef _IGEP00X0_H_#define _IGEP00X0_H_ +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) +#define IGEP00X0_GPIO_LED 27 +#endif + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0030 ) +#define IGEP00X0_GPIO_LED 16 +#endif +const omap3_sysinfo sysinfo = {DDR_STACKED , #if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020)include/configs/igep00x0.h +0
-0@@ -82,6 +82,9 @@#define CONFIG_OMAP_HSMMC 1#define CONFIG_DOS_PARTITION 1
Quoted 7 lines
include/configs/igep00x0.h line 90
Quoted 6 lines
include/configs/igep00x0.h +3
-0+/* define to enable boot progress via leds */ +#define CONFIG_SHOW_BOOT_PROGRESS +/* USB */ #define CONFIG_MUSB_UDC 1#define CONFIG_USB_OMAP3 1
Thanks a lot and best regards,
Javier
PATCH 1/2 OMAP3: use a single board file for IGEP devices
In reply to Javier Martinez CanillasHi Javier,
Quoted 8 lines · Javier Martinez Canillas
Even when the IGEPv2 board and the IGEP Computer-on-Module are different from a form factor point of view, they are very similar in the fact that share many components and how they are wired.
So, it is possible (and better) to have a single board file for both devices and just use the
CONFIG_MACH_TYPEto make a differentiation between both boards when needed.
I'm wondering... isn't there a way to distinguish between the boards in runtime?
Because if there is, you could even use the same binary. This is what we do on cm-t3530/cm-t3730 and is very maintainable, avoids code duplication, and avoids multiple ifdeffery.
Quoted 26 lines
This change avoids duplication by removing 298 lines of code and makes future maintenance easier.
Signed-off-by Javier Martinez Canillas <[email protected]>--- board/isee/igep0020/Makefile | 43 --------- board/isee/igep0020/igep0020.c | 177 -------------------------------------- board/isee/igep0020/igep0020.h | 151 -------------------------------- board/isee/igep0030/Makefile | 43 --------- board/isee/igep0030/igep0030.c | 118 ------------------------- board/isee/igep0030/igep0030.h | 151 -------------------------------- board/isee/igep00x0/Makefile | 43 +++++++++ board/isee/igep00x0/igep00x0.c | 186 ++++++++++++++++++++++++++++++++++++++++ board/isee/igep00x0/igep00x0.h | 165 +++++++++++++++++++++++++++++++++++ boards.cfg | 8 +- 10 files changed, 398 insertions(+), 687 deletions(-) delete mode 100644 board/isee/igep0020/Makefile delete mode 100644 board/isee/igep0020/igep0020.c delete mode 100644 board/isee/igep0020/igep0020.h delete mode 100644 board/isee/igep0030/Makefile delete mode 100644 board/isee/igep0030/igep0030.c delete mode 100644 board/isee/igep0030/igep0030.h create mode 100644 board/isee/igep00x0/Makefile create mode 100644 board/isee/igep00x0/igep00x0.c create mode 100644 board/isee/igep00x0/igep00x0.h
[...]
Quoted 5 lines
board/isee/igep00x0/igep00x0.c new file +0
-0
[...]
board/isee/igep00x0/igep00x0.c line 29
Quoted 7 lines
board/isee/igep00x0/igep00x0.c new file +7
-0+#include <common.h> +#include <twl4030.h> +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) +#include <netdev.h> +#include <asm/gpio.h> +#include <asm/arch/omap_gpmc.h> +#endif
Is there a problem including three above files for igep0030? If not, then it will be better to remove the if.
board/isee/igep00x0/igep00x0.c line 40
Quoted 11 lines
board/isee/igep00x0/igep00x0.c new file +11
-0+#include <asm/io.h> +#include <asm/arch/mem.h> +#include <asm/arch/mmc_host_def.h> +#include <asm/arch/mux.h> +#include <asm/arch/sys_proto.h> +#include <asm/mach-types.h> +#include "igep00x0.h" + +DECLARE_GLOBAL_DATA_PTR ; + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) && defined(CONFIG_CMD_NET )
Does the igep0030 uses CONFIG_CMD_NET?
If it does not, then you can just disable CONFIG_CMD_NET for igep0030 and here (and other net related places) just use
#ifdef CONFIG_CMD_NET
Quoted 10 lines
board/isee/igep00x0/igep00x0.c new file +10
-0+/* GPMC definitions for LAN9221 chips */ +static const u32 gpmc_lan_config[] = { +NET_LAN9221_GPMC_CONFIG1 , +NET_LAN9221_GPMC_CONFIG2 , +NET_LAN9221_GPMC_CONFIG3 , +NET_LAN9221_GPMC_CONFIG4 , +NET_LAN9221_GPMC_CONFIG5 , +NET_LAN9221_GPMC_CONFIG6 , +}; +#endif
[...]
Quoted 21 lines
board/isee/igep00x0/igep00x0.c new file +21
-0+#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) && defined(CONFIG_CMD_NET ) +/* +* Routine: setup_net_chip +* Description: Setting up the configuration GPMC registers specific to the +* Ethernet hardware. +*/ +static void setup_net_chip (void ) +{ +struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE ; + +enable_gpmc_cs_config (gpmc_lan_config, &gpmc_cfg->cs[5 ],0x2C000000 , +GPMC_SIZE_16M ); + +/* Enable off mode for NWE in PADCONF_GPMC_NWE register */ +writew (readw (&ctrl_base->gpmc_nwe) |0x0E00 , &ctrl_base->gpmc_nwe); +/* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */ +writew (readw (&ctrl_base->gpmc_noe) |0x0E00 , &ctrl_base->gpmc_noe); +/* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */ +writew (readw (&ctrl_base->gpmc_nadv_ale) |0x0E00 , + &ctrl_base->gpmc_nadv_ale); +
board/isee/igep00x0/igep00x0.c line 135
Quoted 10 lines
board/isee/igep00x0/igep00x0.c new file +10
-0+/* Make GPIO 64 as output pin and send a magic pulse through it */ +if (!gpio_request (64 ,"" )) { +gpio_direction_output (64 ,0 ); +gpio_set_value (64 ,1 ); +udelay (1 ); +gpio_set_value (64 ,0 ); +udelay (1 ); +gpio_set_value (64 ,1 ); + } +}
having here:
#else
static inline void setup_net_chip(void) {}
or equivalent will remove the need to place the call inside the ifdef below.
Quoted 1 line
+#endif
[...]
Quoted 6 lines
board/isee/igep00x0/igep00x0.c new file +6
-0+/* +* Routine: misc_init_r +* Description: Configure board specific parts +*/ +int misc_init_r (void ) +{
board/isee/igep00x0/igep00x0.c line 161
Quoted 10 lines
board/isee/igep00x0/igep00x0.c new file +10
-0+twl4030_power_init (); + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) && defined(CONFIG_CMD_NET ) +MUX_IGEP0020 (); +setup_net_chip (); +#endif + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0030 ) +MUX_IGEP0030 (); +#endif
Why do you need to setup the board specific muxes in misc_init_r()? Why not do this in set_muxconf_regs() along with the common muxes.
Quoted 16 lines
board/isee/igep00x0/igep00x0.c new file +16
-0+ +dieid_num_r (); + +return 0 ; +} + +/* +* Routine: set_muxconf_regs +* Description: Setting up the configuration Mux registers specific to the +* hardware. Many pins need to be moved from protect to primary +* mode. +*/ +void set_muxconf_regs (void ) +{ +MUX_DEFAULT (); +}
[...]
Quoted 5 lines
board/isee/igep00x0/igep00x0.h new file +0
-0
[...]
Quoted 8 lines
board/isee/igep00x0/igep00x0.h new file +8
-0+const omap3_sysinfo sysinfo = { +DDR_STACKED , +#if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020) +"OMAP3 IGEP v2 board" , +#endif +#if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030) +"OMAP3 IGEP COM Module" , +#endif
board/isee/igep00x0/igep00x0.h line 43
Quoted 10 lines
board/isee/igep00x0/igep00x0.h new file +10
-0+#if defined(CONFIG_ENV_IS_IN_ONENAND ) +"ONENAND" , +#else + "NAND", +#endif +}; + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) && defined(CONFIG_CMD_NET ) +static void setup_net_chip (void ); +#endif
Why do you need this declaration?
Quoted 13 lines
board/isee/igep00x0/igep00x0.h new file +13
-0+ +/* +* IEN - Input Enable +* IDIS - Input Disable +* PTD - Pull type Down +* PTU - Pull type Up +* DIS - Pull type selection is inactive +* EN - Pull type selection is active +* M0 - Mode 0 +* The commented string gives the final mux configuration for that pin +*/ +#define MUX_DEFAULT ()\ + MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0))/* SDRC_D0 */ \
[...]
Quoted 29 lines
board/isee/igep00x0/igep00x0.h new file +10
-0+ MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | EN | M0)) /* SDRC_CKE1 */ +#endif + +#define MUX_IGEP0020 () \ + MUX_VAL(CP(GPMC_WAIT2), (IEN | PTU | DIS | M4))/* GPIO_64-ETH_NRST */ \ + +#define MUX_IGEP0030 () \ + MUX_VAL(CP(UART1_TX), (IDIS | PTD | DIS | M0))/* UART1_TX */ \ +MUX_VAL (CP (UART1_RX ), (IEN |PTD |DIS |M0 ))/* UART1_RX */ \ +boards.cfg +4
-4@@ -253,10 +253,10 @@ cm_t35 arm armv7 cm_t35 - omap3_overo arm armv7 overo - omap3 omap3_pandora arm armv7 pandora - omap3 dig297 arm armv7 dig297 comelit omap3 -igep0020 arm armv7 igep0020 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_ONENAND -igep0020_nand arm armv7 igep0020 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_NAND -igep0030 arm armv7 igep0030 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_ONENAND -igep0030_nand arm armv7 igep0030 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_NAND +igep0020 arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_ONENAND +igep0020_nand arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_NAND +igep0030 arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_ONENAND +igep0030_nand arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_NAND am3517_evm arm armv7 am3517evm logicpd omap3 mt_ventoux arm armv7 mt_ventoux teejet omap3 omap3_zoom1 arm armv7 zoom1 logicpd omap3
Signature · 2 lines
Regards, Igor.
PATCH 1/2 OMAP3: use a single board file for IGEP devices
Quoted 2 lines · Igor Grinberg
Hi Javier,
Hi Igor,
Thanks a lot for your feedback.
Quoted 10 lines · Javier Martinez Canillas
Quoted 8 lines
Even when the IGEPv2 board and the IGEP Computer-on-Module are different from a form factor point of view, they are very similar in the fact that share many components and how they are wired.
So, it is possible (and better) to have a single board file for both devices and just use the
CONFIG_MACH_TYPEto make a differentiation between both boards when needed.
Quoted 6 lines
I'm wondering... isn't there a way to distinguish between the boards in runtime?
Because if there is, you could even use the same binary. This is what we do on cm-t3530/cm-t3730 and is very maintainable, avoids code duplication, and avoids multiple ifdeffery.
Sadly there isn't.
It would have been great to have a way to distinguish between the two boards but it seems the IGEP hardware designers decided this was not necessary.
Quoted 37 lines
Quoted 26 lines
This change avoids duplication by removing 298 lines of code and makes future maintenance easier.
Signed-off-by Javier Martinez Canillas <[email protected]>--- board/isee/igep0020/Makefile | 43 --------- board/isee/igep0020/igep0020.c | 177 -------------------------------------- board/isee/igep0020/igep0020.h | 151 -------------------------------- board/isee/igep0030/Makefile | 43 --------- board/isee/igep0030/igep0030.c | 118 ------------------------- board/isee/igep0030/igep0030.h | 151 -------------------------------- board/isee/igep00x0/Makefile | 43 +++++++++ board/isee/igep00x0/igep00x0.c | 186 ++++++++++++++++++++++++++++++++++++++++ board/isee/igep00x0/igep00x0.h | 165 +++++++++++++++++++++++++++++++++++ boards.cfg | 8 +- 10 files changed, 398 insertions(+), 687 deletions(-) delete mode 100644 board/isee/igep0020/Makefile delete mode 100644 board/isee/igep0020/igep0020.c delete mode 100644 board/isee/igep0020/igep0020.h delete mode 100644 board/isee/igep0030/Makefile delete mode 100644 board/isee/igep0030/igep0030.c delete mode 100644 board/isee/igep0030/igep0030.h create mode 100644 board/isee/igep00x0/Makefile create mode 100644 board/isee/igep00x0/igep00x0.c create mode 100644 board/isee/igep00x0/igep00x0.h[...]
Quoted 5 lines
board/isee/igep00x0/igep00x0.c new file +0
-0[...]
Quoted 11 lines
board/isee/igep00x0/igep00x0.c line 29
Quoted 7 lines
board/isee/igep00x0/igep00x0.c new file +7
-0+#include <common.h> +#include <twl4030.h> +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) +#include <netdev.h> +#include <asm/gpio.h> +#include <asm/arch/omap_gpmc.h> +#endif Is there a problem including three above files for igep0030? If not, then it will be better to remove the if.
Ok, will do.
Quoted 8 lines
Quoted 8 lines
board/isee/igep00x0/igep00x0.c new file +8
-0+#include <asm/io.h> +#include <asm/arch/mem.h> +#include <asm/arch/mmc_host_def.h> +#include <asm/arch/mux.h> +#include <asm/arch/sys_proto.h> +#include <asm/mach-types.h> +#include "igep00x0.h" +
Quoted 9 lines
board/isee/igep00x0/igep00x0.c line 40
Quoted 3 lines
board/isee/igep00x0/igep00x0.c new file +3
-0+DECLARE_GLOBAL_DATA_PTR ; + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) && defined(CONFIG_CMD_NET )Does the igep0030 uses
CONFIG_CMD_NET?
If it does not, then you can just disableCONFIG_CMD_NETfor igep0030 and here (and other net related places) just use
#ifdefCONFIG_CMD_NET
Ok, will simplify this too.
Quoted 67 lines
Quoted 10 lines
board/isee/igep00x0/igep00x0.c new file +10
-0+/* GPMC definitions for LAN9221 chips */ +static const u32 gpmc_lan_config[] = { +NET_LAN9221_GPMC_CONFIG1 , +NET_LAN9221_GPMC_CONFIG2 , +NET_LAN9221_GPMC_CONFIG3 , +NET_LAN9221_GPMC_CONFIG4 , +NET_LAN9221_GPMC_CONFIG5 , +NET_LAN9221_GPMC_CONFIG6 , +}; +#endif [...]
Quoted 21 lines
board/isee/igep00x0/igep00x0.c new file +21
-0+#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) && defined(CONFIG_CMD_NET ) +/* +* Routine: setup_net_chip +* Description: Setting up the configuration GPMC registers specific to the +* Ethernet hardware. +*/ +static void setup_net_chip (void ) +{ +struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE ; + +enable_gpmc_cs_config (gpmc_lan_config, &gpmc_cfg->cs[5 ],0x2C000000 , +GPMC_SIZE_16M ); + +/* Enable off mode for NWE in PADCONF_GPMC_NWE register */ +writew (readw (&ctrl_base->gpmc_nwe) |0x0E00 , &ctrl_base->gpmc_nwe); +/* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */ +writew (readw (&ctrl_base->gpmc_noe) |0x0E00 , &ctrl_base->gpmc_noe); +/* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */ +writew (readw (&ctrl_base->gpmc_nadv_ale) |0x0E00 , + &ctrl_base->gpmc_nadv_ale); +board/isee/igep00x0/igep00x0.c line 135
Quoted 10 lines
board/isee/igep00x0/igep00x0.c new file +10
-0+/* Make GPIO 64 as output pin and send a magic pulse through it */ +if (!gpio_request (64 ,"" )) { +gpio_direction_output (64 ,0 ); +gpio_set_value (64 ,1 ); +udelay (1 ); +gpio_set_value (64 ,0 ); +udelay (1 ); +gpio_set_value (64 ,1 ); + } +}having here:
#else
static inline voidsetup_net_chip(void){}or equivalent will remove the need to place the call inside the ifdef below.
Quoted 1 line
+#endif
[...]
Quoted 11 lines
board/isee/igep00x0/igep00x0.c new file +11
-0+/* +* Routine: misc_init_r +* Description: Configure board specific parts +*/ +int misc_init_r (void ) +{ +twl4030_power_init (); + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) && defined(CONFIG_CMD_NET ) +MUX_IGEP0020 (); +setup_net_chip ();
Quoted 9 lines
board/isee/igep00x0/igep00x0.c line 161
Quoted 5 lines
board/isee/igep00x0/igep00x0.c new file +5
-0+#endif + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0030 ) +MUX_IGEP0030 (); +#endif Why do you need to setup the board specific muxes in
misc_init_r()? Why not do this inset_muxconf_regs()along with the common muxes.
Perfect, will change that.
Quoted 39 lines
Quoted 16 lines
board/isee/igep00x0/igep00x0.c new file +16
-0+ +dieid_num_r (); + +return 0 ; +} + +/* +* Routine: set_muxconf_regs +* Description: Setting up the configuration Mux registers specific to the +* hardware. Many pins need to be moved from protect to primary +* mode. +*/ +void set_muxconf_regs (void ) +{ +MUX_DEFAULT (); +}[...]
Quoted 5 lines
board/isee/igep00x0/igep00x0.h new file +0
-0[...]
Quoted 12 lines
board/isee/igep00x0/igep00x0.h new file +12
-0+const omap3_sysinfo sysinfo = { +DDR_STACKED , +#if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020) +"OMAP3 IGEP v2 board" , +#endif +#if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030) +"OMAP3 IGEP COM Module" , +#endif +#if defined(CONFIG_ENV_IS_IN_ONENAND) +"ONENAND" , +#else + "NAND",
Quoted 9 lines
board/isee/igep00x0/igep00x0.h line 43
Quoted 6 lines
board/isee/igep00x0/igep00x0.h new file +6
-0+#endif +}; + +#if (CONFIG_MACH_TYPE ==MACH_TYPE_IGEP0020 ) && defined(CONFIG_CMD_NET ) +static void setup_net_chip (void ); +#endif Why do you need this declaration?
It was necessary because I didn't include an:
#else
static inline void setup_net_chip(void) {}as you suggested, but with that change it won't be necessary to use ifdeffery anymore.
Quoted 41 lines
Quoted 13 lines
board/isee/igep00x0/igep00x0.h new file +13
-0+ +/* +* IEN - Input Enable +* IDIS - Input Disable +* PTD - Pull type Down +* PTU - Pull type Up +* DIS - Pull type selection is inactive +* EN - Pull type selection is active +* M0 - Mode 0 +* The commented string gives the final mux configuration for that pin +*/ +#define MUX_DEFAULT ()\ + MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0))/* SDRC_D0 */ \[...]
Quoted 25 lines
board/isee/igep00x0/igep00x0.h new file +10
-0+ MUX_VAL(CP(SDRC_CKE1), (IDIS | PTU | EN | M0)) /* SDRC_CKE1 */ +#endif + +#define MUX_IGEP0020 () \ + MUX_VAL(CP(GPMC_WAIT2), (IEN | PTU | DIS | M4))/* GPIO_64-ETH_NRST */ \ + +#define MUX_IGEP0030 () \ + MUX_VAL(CP(UART1_TX), (IDIS | PTD | DIS | M0))/* UART1_TX */ \ +MUX_VAL (CP (UART1_RX ), (IEN |PTD |DIS |M0 ))/* UART1_RX */ \ +boards.cfg +3
-4@@ -253,10 +253,10 @@ cm_t35 arm armv7 cm_t35 - omap3_overo arm armv7 overo - omap3 omap3_pandora arm armv7 pandora - omap3 dig297 arm armv7 dig297 comelit omap3 -igep0020 arm armv7 igep0020 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_ONENAND -igep0020_nand arm armv7 igep0020 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_NAND -igep0030 arm armv7 igep0030 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_ONENAND -igep0030_nand arm armv7 igep0030 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_NAND +igep0020 arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_ONENAND +igep0020_nand arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_NAND +igep0030 arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_ONENAND
Quoted 8 lines
boards.cfg cm_t35 arm armv7 cm_t35 - · line 262
Quoted 4 lines
boards.cfg +1
-0+igep0030_nand arm armv7 igep00x0 isee omap3 igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_NAND am3517_evm arm armv7 am3517evm logicpd omap3 mt_ventoux arm armv7 mt_ventoux teejet omap3 omap3_zoom1 arm armv7 zoom1 logicpd omap3--
Regards,
Igor.
Thanks a lot for your suggestions and best regards, Javier