
On 15:30 Fri 31 Oct , Juergen Schoew wrote:
Hi U-Boot mailling list,
This patchset adds a new ARM board with the NXP PNX8181 cpu to u-boot. The PNX8181 is an ARM926ej with an internal DSP and a baseband processor (used for DECT). The chip also features dual ethernet, digital to analog interface, spi, i2c and other SOC peripherals.
From here The patch is against u-boot commit 055b12f2ffd7c34eea7e983a0588b24f2e69e0e3 (Date: Sun Oct 19 21:54:30 2008 +0200) but should apply to newer commits as well, because the code is mostly seperated.
If you have any comments please email to me.
Is is possible to include that patch in the new version of u-boot?
Regards
Jürgen Schöw
-- Dipl.-Ing. Jürgen Schöw, emlix GmbH, http://www.emlix.com, mailto:js@emlix.com Fon +49 551 30664-0, Fax -11, Bahnhofsallee 1b, 37081 Göttingen, Germany Geschäftsführung: Dr. Uwe Kracke, Dr. Cord Seele, Ust-IdNr.: DE 205 198 055 Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
emlix - your embedded linux partner
to here is supposed to be after ---
Signed-off-by: Jürgen Schöw js@emlix.com Signed-off-by: Sebastian Hess sh@emlix.com Signed-off-by: Matthias Mwenzel nxp@mazzoo.de Signed-off-by: Dirk Hörner dirk.hoerner@dspg.com Signed-off-by: Andreas Weißel andreas.weissel@dspg.com
and sob before
first a question who build this board?
Diffstat: MAKEALL | 1 + Makefile | 7 + board/firetux/Makefile | 62 +++ board/firetux/config.mk | 45 ++ board/firetux/ethernet.c | 970 +++++++++++++++++++++++++++++++++++++++++ board/firetux/ethernet.h | 234 ++++++++++ board/firetux/firetux.c | 554 +++++++++++++++++++++++ board/firetux/firetux.h | 118 +++++ board/firetux/lowlevel_init.S | 413 ++++++++++++++++++ board/firetux/memsetup.S | 366 ++++++++++++++++ board/firetux/nand.c | 74 ++++ board/firetux/relocate.S | 246 +++++++++++ board/firetux/u-boot.lds | 57 +++ drivers/i2c/Makefile | 1 + drivers/i2c/pnx8181_i2c.c | 302 +++++++++++++ include/configs/firetux.h | 455 +++++++++++++++++++ net/bootp.c | 11 + net/eth.c | 7 + 18 files changed, 3923 insertions(+), 0 deletions(-)
diff --git a/MAKEALL b/MAKEALL index 9ccb9ac..0ba8e4d 100755 --- a/MAKEALL +++ b/MAKEALL @@ -480,6 +480,7 @@ LIST_ARM9=" \ cp926ejs \ cp946es \ cp966 \
- firetux \ lpd7a400 \ mx1ads \ mx1fs2 \
diff --git a/Makefile b/Makefile index 9a132f7..8c3b076 100644 --- a/Makefile +++ b/Makefile @@ -2683,6 +2683,13 @@ voiceblue_config: unconfig @$(MKCONFIG) $(@:_config=) arm arm925t voiceblue
######################################################################### +## NXP PNX8181 "firetux" +#########################################################################
+firetux_config:unconfig
- @$(MKCONFIG) $(@:_config=) arm arm926ejs firetux # manufacturer SOC
^^^^^^^^^^^^^^^^^^ please remove
+######################################################################### ## S3C44B0 Systems #########################################################################
diff --git a/board/firetux/Makefile b/board/firetux/Makefile new file mode 100644 index 0000000..a643a5e --- /dev/null +++ b/board/firetux/Makefile @@ -0,0 +1,62 @@ +# firetux makefile +# +# (C) Copyright 2007-2008, emlix GmbH, Germany +# Juergen Schoew js@emlix.com +# +# (C) Copyright 2008, DSPG Technologies GmbH, Germany +# (C) Copyright 2007, NXP Semiconductors Germany GmbH +# Matthias Wenzel, nxp@mazzoo.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).a
+COBJS := firetux.o ethernet.o +SOBJS := lowlevel_init.o memsetup.o relocate.o
+#ifdef CONFIG_CMD_NAND +COBJS += nand.o +#endif
please use COBJS-$(CONFIG_CMD_NAND)
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS))
+all: $(LIB)
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
- $(AR) $(ARFLAGS) $@ $(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/firetux/config.mk b/board/firetux/config.mk new file mode 100644 index 0000000..bcdd671 --- /dev/null +++ b/board/firetux/config.mk @@ -0,0 +1,45 @@ +# firetux compiler config +# +# (C) Copyright 2007-2008, emlix GmbH, Germany +# Juergen Schoew js@emlix.com +# +# (C) Copyright 2008, DSPG Technologies GmbH, Germany +# (C) Copyright 2007, NXP Semiconductors Germany GmbH +# Matthias Wenzel, nxp@mazzoo.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 +#
+# +# image should be loaded at 0x01000000 +#
+# SDRAM +TEXT_BASE = 0x20780000 +# mobile pSRAM +#TEXT_BASE = 0x90700000
could you use a condition
+PLATFORM_CPPFLAGS += -fPIC -fPIE -fno-jump-tables # -msingle-pic-base
+ifneq ($(OBJTREE),$(SRCTREE)) +# We are building u-boot in a separate directory, use generated +# .lds script from OBJTREE directory. +LDSCRIPT := $(OBJTREE)/board/$(BOARDDIR)/u-boot.lds +endif diff --git a/board/firetux/ethernet.c b/board/firetux/ethernet.c
please move to drivers/net/
new file mode 100644 index 0000000..866d578 --- /dev/null +++ b/board/firetux/ethernet.c @@ -0,0 +1,970 @@ +/*
- pnx8181 ethernet driver (ip3912)
- (C) Copyright 2007-2008, emlix GmbH, Germany
- Juergen Schoew js@emlix.com
- (C) Copyright 2008, DSPG Technologies GmbH, Germany
- (C) Copyright 2007, NXP Semiconductors Germany GmbH
- Matthias Wenzel, nxp@mazzoo.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 <common.h> +#include <net.h> +#include <malloc.h>
+#include "ethernet.h" +#include <miiphy.h>
+extern unsigned int boardrevision; +uint16_t ETN1_MADR_PHY_ADDR, ETN2_MADR_PHY_ADDR;
please do not use uppercase for var name
+int firetux_miiphy_initialize(bd_t *bis); +int mii_discover_phy(void); +int mii_negotiate_phy(void);
+#define ALIGN8 static __attribute__ ((aligned(8))) +#define ALIGN4 static __attribute__ ((aligned(4)))
why static? it should be strange to assume it's static when we read the code
please use tab instead of space
+#define PNX8181_SCON_SYSPAD0 0xc2204034 +#define PNX8181_SCON_SYSPAD4 0xc2204044 +#define PNX8181_SCON_SYSMUX0 0xc220400c +#define PNX8181_GPIOA_PINS 0xc2104000 +#define PNX8181_GPIOA_OR 0xc2104004 +#define PNX8181_GPIOA_DR 0xc2104008
+/* globals */ +/* ETN1 rx */ +ALIGN8 rx_descriptor_t etn1_rxdescriptor[ETN_RX_DESCRIPTOR_NUMBER]; +ALIGN8 rx_status_t etn1_rxstatus [ETN_RX_DESCRIPTOR_NUMBER];
+/* ETN1 tx */ +ALIGN8 tx_descriptor_t etn1_txdescriptor[ETN_TX_DESCRIPTOR_NUMBER]; +ALIGN4 tx_status_t etn1_txstatus [ETN_TX_DESCRIPTOR_NUMBER];
+/* ETN2 rx */ +ALIGN8 rx_descriptor_t etn2_rxdescriptor[ETN_RX_DESCRIPTOR_NUMBER]; +ALIGN8 rx_status_t etn2_rxstatus [ETN_RX_DESCRIPTOR_NUMBER];
+/* ETN2 tx */ +ALIGN8 tx_descriptor_t etn2_txdescriptor[ETN_TX_DESCRIPTOR_NUMBER]; +ALIGN4 tx_status_t etn2_txstatus [ETN_TX_DESCRIPTOR_NUMBER];
+/* which interface to be currently work on */ +/* default can be set by environment variable ethact */ +static int firetux_eth = 0;
+/* in the code we use the following descriptors which are either */ +/* set to the etn1 or the etn2 descriptors, depending on ethact */ +ALIGN8 rx_descriptor_t *etn_rxdescriptor = etn1_rxdescriptor; +ALIGN8 rx_status_t *etn_rxstatus = etn1_rxstatus; +ALIGN8 tx_descriptor_t *etn_txdescriptor = etn1_txdescriptor; +ALIGN8 tx_status_t *etn_txstatus = etn1_txstatus;
+/* also the base address is switched for etn1 and etn2, */ +/* except for the MII registers etn1_m* which are only available */ +/* on etn1 */
please use this style of comment /* * */
+uint32_t etn_base = ETN1; +/* we first try Vega Platform III-a settings */ +uint16_t firetux_phy_addr = 0x0100;
is it not better to do all of this init in an init function?
and why not use a struct to save all parameter?
+static void firetux_set_ethact(int act, int hardwarerevision) +{
- switch (hardwarerevision) {
- /* EZ_MCP, Vega_pnx8181_basestation Platform III-a */
- case 1:
- case 2:
ETN1_MADR_PHY_ADDR = 0x00000100;
ETN2_MADR_PHY_ADDR = 0x00000200;
please use macro instead
break;
- /* Vega_pnx8181_basestation Platform III-b, III-c */
- case 3:
- case 4:
- default:
ETN1_MADR_PHY_ADDR = 0x00001E00;
ETN2_MADR_PHY_ADDR = 0x00001D00;
break;
- }
- if (act) {
etn_rxdescriptor = etn2_rxdescriptor;
etn_rxstatus = etn2_rxstatus;
etn_txdescriptor = etn2_txdescriptor;
etn_txstatus = etn2_txstatus;
etn_base = ETN2;
firetux_phy_addr = (uint16_t) ETN2_MADR_PHY_ADDR;
- } else {
etn_rxdescriptor = etn1_rxdescriptor;
etn_rxstatus = etn1_rxstatus;
etn_txdescriptor = etn1_txdescriptor;
etn_txstatus = etn1_txstatus;
etn_base = ETN1;
firetux_phy_addr = (uint16_t) ETN1_MADR_PHY_ADDR;
- }
+}
+static void firetux_reset_phy(int hardwareversion) +{
- switch (hardwareversion) {
- case 1:
- case 2:
- case 3:
please use readx and writex it will be better to create a gpiolib support
/* set GPIOa12 direction to output */
*(vu_long *)(PNX8181_GPIOA_DR) = (((*(vu_long *)
(PNX8181_GPIOA_DR)) & 0xffffefff) | 0x00001000);
/* ETH_RESET_N */
*(vu_long *)(PNX8181_GPIOA_OR) = ((*(vu_long *)
(PNX8181_GPIOA_OR)) & 0xffffefff);
udelay(256000);
*(vu_long *)(PNX8181_GPIOA_OR) = (((*(vu_long *)
(PNX8181_GPIOA_OR)) & 0xffffefff) | 0x00001000);
udelay(100000);
why 100ms of delay?
break;
- case 4:
*(vu_long *) (PNX8181_SCON_SYSPAD4) = (((*(vu_long *)
(PNX8181_SCON_SYSPAD4)) & 0xf7f5755f) | 0x080a8aa0);
*(vu_long *) (PNX8181_SCON_SYSMUX0) = ((*(vu_long *)
(PNX8181_SCON_SYSMUX0)) & 0xffffff3f);
/* set GPIOa3 direction to output */
*(vu_long *) (PNX8181_GPIOA_DR) = (((*(vu_long *)
(PNX8181_GPIOA_DR)) & 0xfffffff7) | 0x00000008);
/* ETH_RESET_N */
*(vu_long *) (PNX8181_GPIOA_OR) = ((*(vu_long *)
(PNX8181_GPIOA_OR)) & 0xfffffff7);
udelay(256000);
why 256ms of delay?
*(vu_long *) (PNX8181_GPIOA_OR) = (((*(vu_long *)
(PNX8181_GPIOA_OR)) & 0xfffffff7) | 0x00000008);
udelay(100000);
why 100ms of delay?
break;
- default:
puts("Unknown Board, can't reset network phy\n");
break;
- }
+}
+static int firetux_eth_init_clocks(void) +{
- /* first things first, release the RSTEXT signal,
* which keeps the PHYs in reset */
- *(vu_long *) (WDRU + WDRUCON) |= 0x0001;
- /* init ETN clocks */
- /* set ETNREFCLK to internal CGU clock, assuming a 13.824MHz crystal */
- /* for other xtals see NXP's validation tests,
* lib/tools/source/swift_tools.c */
- *(vu_long *) CGU_PER2CON = (15<<9) | (62<<3) | 3;
please ad space between "<<"
- /* turn on PLL */
- *(vu_long *) CGU_PER2CON |= 0x00010000;
- /* wait for PLL lock */
- while (!(*(vu_long *) CGU_PER2CON & 0x00020000));
- /* ungate ETN clocks */
- *(vu_long *) CGU_PER2CON |= 0x00802000;
- return 0;
+}
+static int firetux_eth_init_rxdescriptor(void) +{
- *(vu_long *) (etn_base + ETN_RXDESCRIPTOR) = (vu_long) etn_rxdescriptor;
- *(vu_long *) (etn_base + ETN_RXSTATUS) = (vu_long) etn_rxstatus;
- *(vu_long *) (etn_base + ETN_RXCONSUMEINDEX) = 0x00000000;
- *(vu_long *) (etn_base + ETN_RXDESCRIPTORNUMBER) =
ETN_RX_DESCRIPTOR_NUMBER - 1;
- /* allocate rx-buffers, but only once, we're called multiple times! */
- static void *rxbuf = 0;
- if (!rxbuf)
rxbuf = malloc(MAX_ETH_FRAME_SIZE * ETN_RX_DESCRIPTOR_NUMBER);
- if (!rxbuf) {
puts("ERROR: couldn't allocate rx buffers!\n");
return -1;
- }
- int i;
please declare var at begining
- for (i = 0; i < ETN_RX_DESCRIPTOR_NUMBER; i++) {
etn_rxdescriptor[i].packet = rxbuf + i * MAX_ETH_FRAME_SIZE;
etn_rxdescriptor[i].control =
MAX_ETH_FRAME_SIZE - sizeof(vu_long);
etn_rxstatus[i].info = 0;
etn_rxstatus[i].hashCRC = 0;
- }
- return 0;
+}
+static int firetux_eth_init_txdescriptor(void) +{
- *(vu_long *) (etn_base + ETN_TXDESCRIPTOR) =
(vu_long) etn_txdescriptor;
- *(vu_long *) (etn_base + ETN_TXSTATUS) = (vu_long) etn_txstatus;
- *(vu_long *) (etn_base + ETN_TXPRODUCEINDEX) = 0x00000000;
- *(vu_long *) (etn_base + ETN_TXDESCRIPTORNUMBER) =
ETN_TX_DESCRIPTOR_NUMBER - 1;
- int i;
- for (i = 0; i < ETN_TX_DESCRIPTOR_NUMBER; i++) {
etn_txdescriptor[i].packet = 0;
etn_txdescriptor[i].control = 0;
etn_txstatus[i].info = 0;
- }
- return 0;
+}
+static void PHY_write(uint16_t a, uint16_t d)
please no uppercase in function name
+{
- uint32_t status;
- int i = 0;
- a &= 0x001f; /* 5 bit PHY register address */
- *(vu_long *) (ETN1 + ETN_MADR) = firetux_phy_addr | a;
- *(vu_long *) (ETN1 + ETN_MWTD) = d;
- /* poll for done */
- while ((status = *(vu_long *) (ETN1 + ETN_MIND)) && i < 1000000)
i++;
- if (status) {
printf("ERROR: PHY_write(%d) = 0x%x [eth=%d, phy_addr=%x]\n",
a, status, firetux_eth, firetux_phy_addr);
- } else {
+#ifdef ET_DEBUG
printf("### PHY_write(%2.d, 0x%4.4x) success after %d cycles "
"[eth=%d, phy_addr=%x]\n", a, d, i, firetux_eth,
firetux_phy_addr);
please use debug()
+#endif
- }
+}
+static uint16_t PHY_read(uint16_t a) +{
- uint32_t status;
- int i = 0;
- a &= 0x001f; /* 5 bit PHY register address */
- *(vu_long *) (ETN1 + ETN_MADR) = firetux_phy_addr | a;
- *(vu_long *) (ETN1 + ETN_MCMD) = 0x00000001;
- /* poll for done */
- while ((status = ((*(vu_long *)
(ETN1 + ETN_MIND))) & 0x7) && i < 1000000)
i++;
- uint16_t d = *(vu_long *) (ETN1 + ETN_MRDD);
please declare var at the beggening
- if (status) {
printf("ERROR: PHY_read(%d) = 0x%x after %d cycles [eth=%d, "
"phy_addr=%x]\n", a, status, i, firetux_eth,
firetux_phy_addr);
- } else {
+#ifdef ET_DEBUG
printf("### PHY_read(%2.d)=0x%4.4x success after %d cycles "
"[eth=%d, phy_addr=%x]\n", a, d, i, firetux_eth,
firetux_phy_addr);
+#endif
- }
- *(vu_long *) (ETN1 + ETN_MCMD) = 0x00000000;
- return d;
+}
Their is too much fix to do to.
Please fix first.
Best Regards, J.