* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
@ 2011-09-02 14:02 Fabio Estevam
2011-09-02 14:02 ` [U-Boot] [PATCH v3 2/2] MX25: Add initial support for MX25PDK Fabio Estevam
2011-09-05 10:43 ` [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file Stefano Babic
0 siblings, 2 replies; 13+ messages in thread
From: Fabio Estevam @ 2011-09-02 14:02 UTC (permalink / raw)
To: u-boot
Avoid the usage of extern in C file as pointed out by checkpatch.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v2:
- Place the extern in the MX25 imx-regs.h instead of inside the MX27 imx-regs.h
Changes since v1:
- No changes
arch/arm/include/asm/arch-mx25/imx-regs.h | 1 +
board/karo/tx25/tx25.c | 1 -
2 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h b/arch/arm/include/asm/arch-mx25/imx-regs.h
index 9e30f7c..7e34050 100644
--- a/arch/arm/include/asm/arch-mx25/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx25/imx-regs.h
@@ -37,6 +37,7 @@
#ifdef CONFIG_FEC_MXC
extern void mx25_fec_init_pins(void);
extern void imx_get_mac_from_fuse(unsigned char *mac);
+extern void mx25_uart1_init_pins(void);
#endif
/* Clock Control Module (CCM) registers */
diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
index 25b99e8..2787715 100644
--- a/board/karo/tx25/tx25.c
+++ b/board/karo/tx25/tx25.c
@@ -141,7 +141,6 @@ void tx25_fec_init(void)
int board_init()
{
#ifdef CONFIG_MXC_UART
- extern void mx25_uart1_init_pins(void);
mx25_uart1_init_pins();
#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 2/2] MX25: Add initial support for MX25PDK
2011-09-02 14:02 [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file Fabio Estevam
@ 2011-09-02 14:02 ` Fabio Estevam
2011-09-05 10:43 ` [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file Stefano Babic
1 sibling, 0 replies; 13+ messages in thread
From: Fabio Estevam @ 2011-09-02 14:02 UTC (permalink / raw)
To: u-boot
Add the initial support for MX25PDK booting from SD card via internal boot.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v2:
- No changes
Changes since v1:
- Keep mx25pdk entry to boards.cfg sorted
- Removed unused defines in mx25pdk.h
- Do not use the whole RAM space for memory test
MAINTAINERS | 1 +
board/freescale/mx25pdk/Makefile | 49 ++++++++++++++
board/freescale/mx25pdk/imximage.cfg | 73 +++++++++++++++++++++
board/freescale/mx25pdk/lowlevel_init.S | 21 ++++++
board/freescale/mx25pdk/mx25pdk.c | 62 ++++++++++++++++++
boards.cfg | 1 +
include/configs/mx25pdk.h | 106 +++++++++++++++++++++++++++++++
7 files changed, 313 insertions(+), 0 deletions(-)
create mode 100644 board/freescale/mx25pdk/Makefile
create mode 100644 board/freescale/mx25pdk/imximage.cfg
create mode 100644 board/freescale/mx25pdk/lowlevel_init.S
create mode 100644 board/freescale/mx25pdk/mx25pdk.c
create mode 100644 include/configs/mx25pdk.h
diff --git a/MAINTAINERS b/MAINTAINERS
index f895e9a..7f07b60 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -645,6 +645,7 @@ Kristoffer Ericson <kristoffer.ericson@gmail.com>
Fabio Estevam <fabio.estevam@freescale.com>
+ mx25pdk i.MX25
mx31pdk i.MX31
mx53ard i.MX53
mx53smd i.MX53
diff --git a/board/freescale/mx25pdk/Makefile b/board/freescale/mx25pdk/Makefile
new file mode 100644
index 0000000..4d45ae3
--- /dev/null
+++ b/board/freescale/mx25pdk/Makefile
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# 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 := mx25pdk.o
+SOBJS := lowlevel_init.o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
+ $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+ rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+ rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/freescale/mx25pdk/imximage.cfg b/board/freescale/mx25pdk/imximage.cfg
new file mode 100644
index 0000000..f7af7ff
--- /dev/null
+++ b/board/freescale/mx25pdk/imximage.cfg
@@ -0,0 +1,73 @@
+#
+# (C) Copyright 2009
+# Stefano Babic DENX Software Engineering sbabic 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.
+#
+# Refer docs/README.imxmage for more details about how-to configure
+# and create imximage boot image
+#
+# The syntax is taken as close as possible with the kwbimage
+
+# Boot Device : one of
+# spi, sd (the board has no nand neither onenand)
+
+BOOT_FROM sd
+
+# Device Configuration Data (DCD)
+#
+# Each entry must have the format:
+# Addr-type Address Value
+#
+# where:
+# Addr-type register length (1,2 or 4 bytes)
+# Address absolute address of the register
+# value value to be stored in the register
+
+# EIM config-CS5 init -- CPLD
+DATA 4 0xB8002050 0x0000D843
+DATA 4 0xB8002054 0x22252521
+DATA 4 0xB8002058 0x22220A00
+
+# DDR2 init
+DATA 4 0xB8001004 0x0076E83A
+DATA 4 0xB8001010 0x00000204
+DATA 4 0xB8001000 0x92210000
+DATA 4 0x80000f00 0x12344321
+DATA 4 0xB8001000 0xB2210000
+DATA 1 0x82000000 0xda
+DATA 1 0x83000000 0xda
+DATA 1 0x81000400 0xda
+DATA 1 0x80000333 0xda
+
+DATA 4 0xB8001000 0x92210000
+DATA 1 0x80000400 0x12345678
+
+DATA 4 0xB8001000 0xA2210000
+DATA 4 0x80000000 0x87654321
+DATA 4 0x80000000 0x87654321
+
+DATA 4 0xB8001000 0xB2210000
+DATA 1 0x80000233 0xda
+DATA 1 0x81000780 0xda
+DATA 1 0x81000400 0xda
+DATA 4 0xB8001000 0x82216080
+DATA 4 0x43FAC454 0x00001000
+
+DATA 4 0x53F80008 0x20034000
+
+# Enable the clocks
+DATA 4 0x53f8000c 0x1fffffff
+DATA 4 0x53f80010 0xffffffff
+DATA 4 0x53f80014 0xfdfff
diff --git a/board/freescale/mx25pdk/lowlevel_init.S b/board/freescale/mx25pdk/lowlevel_init.S
new file mode 100644
index 0000000..6e6810f
--- /dev/null
+++ b/board/freescale/mx25pdk/lowlevel_init.S
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2011 Freescale Semiconductor
+ *
+ * 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.
+ */
+
+.globl lowlevel_init
+lowlevel_init:
+
+ mov pc, lr
diff --git a/board/freescale/mx25pdk/mx25pdk.c b/board/freescale/mx25pdk/mx25pdk.c
new file mode 100644
index 0000000..bb27824
--- /dev/null
+++ b/board/freescale/mx25pdk/mx25pdk.c
@@ -0,0 +1,62 @@
+/*
+ * (C) Copyright 2011 Freescale Semiconductor, Inc.
+ *
+ * Author: Fabio Estevam <fabio.estevam@freescale.com>
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/imx25-pinmux.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+ /* dram_init must store complete ramsize in gd->ram_size */
+ gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
+ PHYS_SDRAM_1_SIZE);
+ return 0;
+}
+
+void dram_init_banksize(void)
+{
+ gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+ gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+}
+
+int board_early_init_f(void)
+{
+ mx25_uart1_init_pins();
+
+ return 0;
+}
+
+int board_init(void)
+{
+ gd->bd->bi_arch_number = MACH_TYPE_MX25_3DS;
+ /* address of boot parameters */
+ gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+ return 0;
+}
+
+int checkboard(void)
+{
+ puts("Board: MX25PDK\n");
+
+ return 0;
+}
diff --git a/boards.cfg b/boards.cfg
index c31114d..17452e4 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -162,6 +162,7 @@ rd6281a arm arm926ejs - Marvell
sheevaplug arm arm926ejs - Marvell kirkwood
dockstar arm arm926ejs - Seagate kirkwood
jadecpu arm arm926ejs jadecpu syteco mb86r0x
+mx25pdk arm arm926ejs mx25pdk freescale mx25 mx25pdk:IMX_CONFIG=board/freescale/mx25pdk/imximage.cfg
zmx25 arm arm926ejs zmx25 syteco mx25
imx27lite arm arm926ejs imx27lite logicpd mx27
magnesium arm arm926ejs imx27lite logicpd mx27
diff --git a/include/configs/mx25pdk.h b/include/configs/mx25pdk.h
new file mode 100644
index 0000000..fc80a71
--- /dev/null
+++ b/include/configs/mx25pdk.h
@@ -0,0 +1,106 @@
+/*
+ * (C) Copyright 2011 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/* High Level Configuration Options */
+
+#define CONFIG_MX25_CLK32 32768 /* OSC32K frequency */
+#define CONFIG_SYS_HZ 1000
+#define CONFIG_SYS_TEXT_BASE 0x81200000
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
+
+/* Physical Memory Map */
+
+#define CONFIG_NR_DRAM_BANKS 1
+#define PHYS_SDRAM_1 0x80000000
+#define PHYS_SDRAM_1_SIZE (64 * 1024 * 1024)
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000 - \
+ GENERATED_GBL_DATA_SIZE)
+
+/* Memory Test */
+#define CONFIG_SYS_MEMTEST_START (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE/2)
+#define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE)
+
+/* Stack sizes */
+#define CONFIG_STACKSIZE (128 * 1024) /* regular stack */
+
+/* Serial Info */
+#define CONFIG_MXC_UART
+#define CONFIG_SYS_MX25_UART1
+#define CONFIG_CONS_INDEX 1 /* use UART0 for console */
+#define CONFIG_BAUDRATE 115200 /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
+
+/* No NOR flash present */
+#define CONFIG_ENV_OFFSET (6 * 64 * 1024)
+#define CONFIG_ENV_SIZE (8 * 1024)
+#define CONFIG_ENV_IS_NOWHERE
+
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_SYS_64BIT_VSPRINTF
+
+/* U-Boot general configuration */
+#define CONFIG_SYS_PROMPT "MX25PDK U-Boot > "
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
+/* Print buffer sz */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
+ sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_LONGHELP
+
+/* U-Boot commands */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_CACHE
+
+/* Ethernet */
+#define CONFIG_FEC_MXC
+#define CONFIG_FEC_MXC_PHYADDR 0x1f
+#define CONFIG_MII
+#define CONFIG_CMD_NET
+#define CONFIG_NET_MULTI
+#define CONFIG_ENV_OVERWRITE
+
+#define CONFIG_BOOTDELAY 3
+
+#define CONFIG_LOADADDR 0x81000000 /* loadaddr env var */
+#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "script=boot.scr\0" \
+ "uimage=uImage\0" \
+ "netargs=setenv bootargs console=ttymxc0,${baudrate} " \
+ "root=/dev/nfs " \
+ "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+ "bootcmd=run netargs; dhcp ${uimage}; bootm\0" \
+
+#endif /* __CONFIG_H */
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-02 14:02 [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file Fabio Estevam
2011-09-02 14:02 ` [U-Boot] [PATCH v3 2/2] MX25: Add initial support for MX25PDK Fabio Estevam
@ 2011-09-05 10:43 ` Stefano Babic
2011-09-05 11:37 ` Fabio Estevam
1 sibling, 1 reply; 13+ messages in thread
From: Stefano Babic @ 2011-09-05 10:43 UTC (permalink / raw)
To: u-boot
On 09/02/2011 04:02 PM, Fabio Estevam wrote:
> Avoid the usage of extern in C file as pointed out by checkpatch.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Hi Fabio,
> diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h b/arch/arm/include/asm/arch-mx25/imx-regs.h
> index 9e30f7c..7e34050 100644
> --- a/arch/arm/include/asm/arch-mx25/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx25/imx-regs.h
> @@ -37,6 +37,7 @@
> #ifdef CONFIG_FEC_MXC
> extern void mx25_fec_init_pins(void);
> extern void imx_get_mac_from_fuse(unsigned char *mac);
> +extern void mx25_uart1_init_pins(void);
As i can see, in the imx-regs.h for the different processors there is
(as the name says) only definitions and structures for the internal
registers of each processor. No function prototypes.
What about to move the prototype ? For MX5/MX35 there is a sys_proto.h
(as it is done for other SOCs), in this case, well, it seems too much to
add a file for a single line. However, we could move it in clock.h and
creating a sys_proto.h if the number of exported functions will increase.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 10:43 ` [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file Stefano Babic
@ 2011-09-05 11:37 ` Fabio Estevam
2011-09-05 13:05 ` Marek Vasut
0 siblings, 1 reply; 13+ messages in thread
From: Fabio Estevam @ 2011-09-05 11:37 UTC (permalink / raw)
To: u-boot
On Mon, Sep 5, 2011 at 7:43 AM, Stefano Babic <sbabic@denx.de> wrote:
...
> What about to move the prototype ? For MX5/MX35 there is a sys_proto.h
> (as it is done for other SOCs), in this case, well, it seems too much to
> add a file for a single line. However, we could move it in clock.h and
> creating a sys_proto.h if the number of exported functions will increase.
Ok, I can create a sys_proto.h for MX25 and put the following extern?s there:
extern void mx25_fec_init_pins(void);
extern void imx_get_mac_from_fuse(unsigned char *mac);
extern void mx25_uart1_init_pins(void);
Regards,
Fabio Estevam
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 11:37 ` Fabio Estevam
@ 2011-09-05 13:05 ` Marek Vasut
2011-09-05 13:15 ` Fabio Estevam
0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2011-09-05 13:05 UTC (permalink / raw)
To: u-boot
On Monday, September 05, 2011 01:37:17 PM Fabio Estevam wrote:
> On Mon, Sep 5, 2011 at 7:43 AM, Stefano Babic <sbabic@denx.de> wrote:
> ...
>
> > What about to move the prototype ? For MX5/MX35 there is a sys_proto.h
> > (as it is done for other SOCs), in this case, well, it seems too much to
> > add a file for a single line. However, we could move it in clock.h and
> > creating a sys_proto.h if the number of exported functions will increase.
>
> Ok, I can create a sys_proto.h for MX25 and put the following extern?s
> there:
>
> extern void mx25_fec_init_pins(void);
> extern void imx_get_mac_from_fuse(unsigned char *mac);
> extern void mx25_uart1_init_pins(void);
Ok, this might be a stupid one, but ...
why use externs in header files ?
>
> Regards,
>
> Fabio Estevam
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 13:05 ` Marek Vasut
@ 2011-09-05 13:15 ` Fabio Estevam
2011-09-05 15:05 ` Marek Vasut
0 siblings, 1 reply; 13+ messages in thread
From: Fabio Estevam @ 2011-09-05 13:15 UTC (permalink / raw)
To: u-boot
On Mon, Sep 5, 2011 at 10:05 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
...
>> extern void mx25_fec_init_pins(void);
>> extern void imx_get_mac_from_fuse(unsigned char *mac);
>> extern void mx25_uart1_init_pins(void);
>
> Ok, this might be a stupid one, but ...
>
> why use externs in header files ?
This will make checkpatch happy :-)
Regards,
Fabio Estevam
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 13:15 ` Fabio Estevam
@ 2011-09-05 15:05 ` Marek Vasut
2011-09-05 15:38 ` Fabio Estevam
0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2011-09-05 15:05 UTC (permalink / raw)
To: u-boot
On Monday, September 05, 2011 03:15:44 PM Fabio Estevam wrote:
> On Mon, Sep 5, 2011 at 10:05 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> ...
>
> >> extern void mx25_fec_init_pins(void);
> >> extern void imx_get_mac_from_fuse(unsigned char *mac);
> >> extern void mx25_uart1_init_pins(void);
> >
> > Ok, this might be a stupid one, but ...
> >
> > why use externs in header files ?
>
> This will make checkpatch happy :-)
>
I'm not quite sure I understand ... ?
> Regards,
>
> Fabio Estevam
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 15:05 ` Marek Vasut
@ 2011-09-05 15:38 ` Fabio Estevam
2011-09-05 15:40 ` Marek Vasut
0 siblings, 1 reply; 13+ messages in thread
From: Fabio Estevam @ 2011-09-05 15:38 UTC (permalink / raw)
To: u-boot
On Mon, Sep 5, 2011 at 12:05 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> On Monday, September 05, 2011 03:15:44 PM Fabio Estevam wrote:
>> On Mon, Sep 5, 2011 at 10:05 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
>> ...
>>
>> >> extern void mx25_fec_init_pins(void);
>> >> extern void imx_get_mac_from_fuse(unsigned char *mac);
>> >> extern void mx25_uart1_init_pins(void);
>> >
>> > Ok, this might be a stupid one, but ...
>> >
>> > why use externs in header files ?
>>
>> This will make checkpatch happy :-)
>>
> I'm not quite sure I understand ... ?
./scripts/checkpatch.pl -F u-boot/board/karo/tx25/tx25.c
....
WARNING: externs should be avoided in .c files
#144: FILE: home/fabio/denx/u-boot/board/karo/tx25/tx25.c:144:
+ extern void mx25_uart1_init_pins(void);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 15:38 ` Fabio Estevam
@ 2011-09-05 15:40 ` Marek Vasut
2011-09-05 15:48 ` Fabio Estevam
0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2011-09-05 15:40 UTC (permalink / raw)
To: u-boot
On Monday, September 05, 2011 05:38:26 PM Fabio Estevam wrote:
> On Mon, Sep 5, 2011 at 12:05 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> > On Monday, September 05, 2011 03:15:44 PM Fabio Estevam wrote:
> >> On Mon, Sep 5, 2011 at 10:05 AM, Marek Vasut <marek.vasut@gmail.com>
> >> wrote: ...
> >>
> >> >> extern void mx25_fec_init_pins(void);
> >> >> extern void imx_get_mac_from_fuse(unsigned char *mac);
> >> >> extern void mx25_uart1_init_pins(void);
> >> >
> >> > Ok, this might be a stupid one, but ...
> >> >
> >> > why use externs in header files ?
> >>
> >> This will make checkpatch happy :-)
> >
> > I'm not quite sure I understand ... ?
>
> ./scripts/checkpatch.pl -F u-boot/board/karo/tx25/tx25.c
> ....
> WARNING: externs should be avoided in .c files
> #144: FILE: home/fabio/denx/u-boot/board/karo/tx25/tx25.c:144:
> + extern void mx25_uart1_init_pins(void);
But you're using extern in _header_ (.h) file ... so ... why ?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 15:40 ` Marek Vasut
@ 2011-09-05 15:48 ` Fabio Estevam
2011-09-05 16:02 ` Wolfgang Denk
2011-09-05 16:49 ` Stefano Babic
0 siblings, 2 replies; 13+ messages in thread
From: Fabio Estevam @ 2011-09-05 15:48 UTC (permalink / raw)
To: u-boot
On Mon, Sep 5, 2011 at 12:40 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
...
>> ./scripts/checkpatch.pl -F u-boot/board/karo/tx25/tx25.c
>> ....
>> WARNING: externs should be avoided in .c files
>> #144: FILE: home/fabio/denx/u-boot/board/karo/tx25/tx25.c:144:
>> + ? ? extern void mx25_uart1_init_pins(void);
>
> But you're using extern in _header_ (.h) file ... so ... why ?
>
My patch removes the extern from the C file and put it on a header
file with other extern's.
The checkpatch warning I showed happens with the original file, and
not after my patch is applied.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 15:48 ` Fabio Estevam
@ 2011-09-05 16:02 ` Wolfgang Denk
2011-09-05 16:12 ` Marek Vasut
2011-09-05 16:49 ` Stefano Babic
1 sibling, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2011-09-05 16:02 UTC (permalink / raw)
To: u-boot
Dear Fabio Estevam,
In message <CAOMZO5A1v5jUkXTF9nKnZh8VNewzkoMB1tMmE9cRJCJDp+y2ug@mail.gmail.com> you wrote:
>
> > But you're using extern in _header_ (.h) file ... so ... why ?
> >
>
> My patch removes the extern from the C file and put it on a header
> file with other extern's.
What Marek probably wants to tell yet (in a bit a complicated way) is
that you should omit the "extern" in the prototype declaration. Just
remove all "extern" from the header file.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
One essential to success is that you desire be an all-obsessing one,
your thoughts and aims be co-ordinated, and your energy be concentra-
ted and applied without letup.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 16:02 ` Wolfgang Denk
@ 2011-09-05 16:12 ` Marek Vasut
0 siblings, 0 replies; 13+ messages in thread
From: Marek Vasut @ 2011-09-05 16:12 UTC (permalink / raw)
To: u-boot
On Monday, September 05, 2011 06:02:21 PM Wolfgang Denk wrote:
> Dear Fabio Estevam,
>
> In message
<CAOMZO5A1v5jUkXTF9nKnZh8VNewzkoMB1tMmE9cRJCJDp+y2ug@mail.gmail.com> you wrote:
> > > But you're using extern in _header_ (.h) file ... so ... why ?
> >
> > My patch removes the extern from the C file and put it on a header
> > file with other extern's.
>
> What Marek probably wants to tell yet (in a bit a complicated way) is
> that you should omit the "extern" in the prototype declaration. Just
> remove all "extern" from the header file.
No, I was asking if there's some special reason for this or it's plain wrong. I
see the later's the case.
Thanks, cheers!
>
> Best regards,
>
> Wolfgang Denk
^ permalink raw reply [flat|nested] 13+ messages in thread
* [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file
2011-09-05 15:48 ` Fabio Estevam
2011-09-05 16:02 ` Wolfgang Denk
@ 2011-09-05 16:49 ` Stefano Babic
1 sibling, 0 replies; 13+ messages in thread
From: Stefano Babic @ 2011-09-05 16:49 UTC (permalink / raw)
To: u-boot
On 09/05/2011 05:48 PM, Fabio Estevam wrote:
> On Mon, Sep 5, 2011 at 12:40 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> ...
>
Hi Fabio,
>>> ./scripts/checkpatch.pl -F u-boot/board/karo/tx25/tx25.c
>>> ....
>>> WARNING: externs should be avoided in .c files
>>> #144: FILE: home/fabio/denx/u-boot/board/karo/tx25/tx25.c:144:
>>> + extern void mx25_uart1_init_pins(void);
>>
>> But you're using extern in _header_ (.h) file ... so ... why ?
>>
>
> My patch removes the extern from the C file and put it on a header
> file with other extern's.
>
> The checkpatch warning I showed happens with the original file, and
> not after my patch is applied.
>
I think checkpatch warnings because the original file has already some
extern. In the most of u-boot code we do not mark the prototypes with
extern.
I made this simple test - I create a new file (from sys_proto.h) and I
run checkpatch on it:
+#ifndef _SYS_PROTO_H_
+#define _SYS_PROTO_H_
+
+u32 get_cpu_rev(void);
+#define is_soc_rev(rev) ((get_cpu_rev() & 0xFF) - rev)
+void sdelay(unsigned long);
+void set_chipselect_size(int const);
+#endif
--
checpatch reports neither errors nor warnings:
checkpatch.pl --no-tree 0001-tmp.patch
total: 0 errors, 0 warnings, 31 lines checked
I think you can try moving the prototypes in sys_proto.h, and run
checkpatch on it without extern. I expect to see no warnings at all.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-09-05 16:49 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-02 14:02 [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file Fabio Estevam
2011-09-02 14:02 ` [U-Boot] [PATCH v3 2/2] MX25: Add initial support for MX25PDK Fabio Estevam
2011-09-05 10:43 ` [U-Boot] [PATCH v3 1/2] MX25: tx25: Avoid the usage of extern in C file Stefano Babic
2011-09-05 11:37 ` Fabio Estevam
2011-09-05 13:05 ` Marek Vasut
2011-09-05 13:15 ` Fabio Estevam
2011-09-05 15:05 ` Marek Vasut
2011-09-05 15:38 ` Fabio Estevam
2011-09-05 15:40 ` Marek Vasut
2011-09-05 15:48 ` Fabio Estevam
2011-09-05 16:02 ` Wolfgang Denk
2011-09-05 16:12 ` Marek Vasut
2011-09-05 16:49 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox