Add initial support for Bluegiga APX4 CoM and development kit.

Signed-off-by: Veli-Pekka Peltola <veli-pekka.pelt...@bluegiga.com>
Cc: Stefano Babic <sba...@denx.de>
---
 board/bluegiga/apx4devkit/Makefile     |   45 +++++++
 board/bluegiga/apx4devkit/apx4devkit.c |  204 ++++++++++++++++++++++++++++++++
 boards.cfg                             |    1 +
 include/configs/apx4devkit.h           |  176 +++++++++++++++++++++++++++
 4 files changed, 426 insertions(+), 0 deletions(-)
 create mode 100644 board/bluegiga/apx4devkit/Makefile
 create mode 100644 board/bluegiga/apx4devkit/apx4devkit.c
 create mode 100644 include/configs/apx4devkit.h

diff --git a/board/bluegiga/apx4devkit/Makefile 
b/board/bluegiga/apx4devkit/Makefile
new file mode 100644
index 0000000..4fec2f0
--- /dev/null
+++ b/board/bluegiga/apx4devkit/Makefile
@@ -0,0 +1,45 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@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  := apx4devkit.o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):        $(obj).depend $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+all:   $(ALL)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/bluegiga/apx4devkit/apx4devkit.c 
b/board/bluegiga/apx4devkit/apx4devkit.c
new file mode 100644
index 0000000..ef9e039
--- /dev/null
+++ b/board/bluegiga/apx4devkit/apx4devkit.c
@@ -0,0 +1,204 @@
+/*
+ * Bluegiga APX4 development kit
+ *
+ * Copyright (C) 2011 Veli-Pekka Peltola <veli-pekka.pelt...@bluegiga.com>
+ *
+ * Based on m28evk.c and spl_boot.c:
+ * Copyright (C) 2011 Marek Vasut <marek.va...@gmail.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.
+ *
+ * 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 <asm/gpio.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/iomux-mx28.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+#include <linux/mii.h>
+#include <miiphy.h>
+#include <netdev.h>
+#include <errno.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define MUX_CONFIG_GENERIC     (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP)
+#define MUX_CONFIG_GPMI        (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_NOPULL)
+#define MUX_CONFIG_GPMI_12MA   (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL)
+
+const iomux_cfg_t iomux_setup[] = {
+       /* GPMI NAND */
+       MX28_PAD_GPMI_D00__GPMI_D0 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D01__GPMI_D1 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D02__GPMI_D2 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D03__GPMI_D3 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D04__GPMI_D4 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D05__GPMI_D5 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D06__GPMI_D6 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_D07__GPMI_D7 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_ALE__GPMI_ALE | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_CLE__GPMI_CLE | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_CE0N__GPMI_CE0N | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_RDY0__GPMI_READY0 | MUX_CONFIG_GPMI,
+       MX28_PAD_GPMI_RDN__GPMI_RDN | MUX_CONFIG_GPMI_12MA,
+       MX28_PAD_GPMI_WRN__GPMI_WRN | MUX_CONFIG_GPMI_12MA,
+       MX28_PAD_GPMI_RESETN__GPMI_RESETN | MUX_CONFIG_GPMI_12MA,
+
+       /* MMC0 */
+       MX28_PAD_SSP0_DATA0__SSP0_D0 | MUX_CONFIG_GENERIC,
+       MX28_PAD_SSP0_DATA1__SSP0_D1 | MUX_CONFIG_GENERIC,
+       MX28_PAD_SSP0_DATA2__SSP0_D2 | MUX_CONFIG_GENERIC,
+       MX28_PAD_SSP0_DATA3__SSP0_D3 | MUX_CONFIG_GENERIC,
+       MX28_PAD_SSP0_DATA4__SSP0_D4 | MUX_CONFIG_GENERIC,
+       MX28_PAD_SSP0_DATA5__SSP0_D5 | MUX_CONFIG_GENERIC,
+       MX28_PAD_SSP0_DATA6__SSP0_D6 | MUX_CONFIG_GENERIC,
+       MX28_PAD_SSP0_DATA7__SSP0_D7 | MUX_CONFIG_GENERIC,
+       MX28_PAD_SSP0_CMD__SSP0_CMD | MUX_CONFIG_GENERIC,
+       MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT |
+               (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_NOPULL),
+       MX28_PAD_SSP0_SCK__SSP0_SCK |
+               (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL),
+
+       /* FEC Ethernet */
+       MX28_PAD_ENET0_MDC__ENET0_MDC | MUX_CONFIG_GENERIC,
+       MX28_PAD_ENET0_MDIO__ENET0_MDIO | MUX_CONFIG_GENERIC,
+       MX28_PAD_ENET0_RX_EN__ENET0_RX_EN | MUX_CONFIG_GENERIC,
+       MX28_PAD_ENET0_TX_EN__ENET0_TX_EN | MUX_CONFIG_GENERIC,
+       MX28_PAD_ENET0_RXD0__ENET0_RXD0 | MUX_CONFIG_GENERIC,
+       MX28_PAD_ENET0_RXD1__ENET0_RXD1 | MUX_CONFIG_GENERIC,
+       MX28_PAD_ENET0_TXD0__ENET0_TXD0 | MUX_CONFIG_GENERIC,
+       MX28_PAD_ENET0_TXD1__ENET0_TXD1 | MUX_CONFIG_GENERIC,
+       MX28_PAD_ENET_CLK__CLKCTRL_ENET | MUX_CONFIG_GENERIC,
+};
+
+/*
+ * Functions
+ */
+int board_early_init_f(void)
+{
+       /* Setup only pads needed by U-Boot that are not initialized before */
+       mxs_iomux_setup_multiple_pads(iomux_setup, ARRAY_SIZE(iomux_setup));
+       /* IO0 clock at 480MHz */
+       mx28_set_ioclk(MXC_IOCLK0, 480000);
+       /* IO1 clock at 480MHz */
+       mx28_set_ioclk(MXC_IOCLK1, 480000);
+       /* SSP0 clock at 96MHz */
+       mx28_set_sspclk(MXC_SSPCLK0, 96000, 0);
+
+       return 0;
+}
+
+int board_init(void)
+{
+       /* Address of boot parameters */
+       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+       return 0;
+}
+
+int dram_init(void)
+{
+       /* dram_init must store complete ramsize in gd->ram_size */
+       gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
+
+       return 0;
+}
+
+#ifdef CONFIG_CMD_MMC
+int board_mmc_init(bd_t *bis)
+{
+       return mxsmmc_initialize(bis, 0, NULL);
+}
+#endif
+
+#ifdef CONFIG_CMD_NET
+
+#define MII_PHY_CTRL2  0x1f
+
+int fecmxc_mii_postcall(int phy)
+{
+       miiphy_write("FEC", 0, MII_PHY_CTRL2, 0x8180);
+       return 0;
+}
+
+int board_eth_init(bd_t *bis)
+{
+       int ret;
+       struct eth_device *dev;
+
+       ret = cpu_eth_init(bis);
+
+       ret = fecmxc_initialize(bis);
+       if (ret) {
+               printf("FEC MXS: Unable to init FEC\n");
+               return ret;
+       }
+
+       dev = eth_get_dev_by_name("FEC");
+       if (!dev) {
+               printf("FEC MXS: Unable to get FEC device entry\n");
+               return -EINVAL;
+       }
+
+       ret = fecmxc_register_mii_postcall(dev, fecmxc_mii_postcall);
+       if (ret) {
+               printf("FEC MXS: Unable to register FEC MII postcall\n");
+               return ret;
+       }
+
+       return ret;
+}
+
+void imx_get_mac_from_fuse(char *mac)
+{
+       memset(mac, 0, 6);
+}
+#endif
+
+#ifdef CONFIG_SERIAL_TAG
+#define MXS_OCOTP_MAX_TIMEOUT  1000000
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+       struct mx28_ocotp_regs *ocotp_regs =
+               (struct mx28_ocotp_regs *)MXS_OCOTP_BASE;
+
+       serialnr->high = 0;
+       serialnr->low = 0;
+
+       writel(OCOTP_CTRL_RD_BANK_OPEN, &ocotp_regs->hw_ocotp_ctrl_set);
+
+       if (mx28_wait_mask_clr(&ocotp_regs->hw_ocotp_ctrl_reg, OCOTP_CTRL_BUSY,
+                               MXS_OCOTP_MAX_TIMEOUT)) {
+               printf("MXS: Can't get serial number from OCOTP\n");
+               return;
+       }
+
+       serialnr->low = readl(&ocotp_regs->hw_ocotp_cust3);
+}
+#endif
+
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void)
+{
+       if (getenv("revision#") != NULL)
+               return simple_strtoul(getenv("revision#"), NULL, 10);
+       return 0;
+}
+#endif
diff --git a/boards.cfg b/boards.cfg
index 1e5b3e0..214e22f 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -159,6 +159,7 @@ tx25                         arm         arm926ejs   tx25   
             karo
 zmx25                        arm         arm926ejs   zmx25               
syteco         mx25
 imx27lite                    arm         arm926ejs   imx27lite           
logicpd        mx27
 magnesium                    arm         arm926ejs   imx27lite           
logicpd        mx27
+apx4devkit                   arm         arm926ejs   -                   
bluegiga       mx28
 m28evk                       arm         arm926ejs   -                   denx  
         mx28
 nhk8815                      arm         arm926ejs   nhk8815             st    
         nomadik
 nhk8815_onenand              arm         arm926ejs   nhk8815             st    
         nomadik       nhk8815:BOOT_ONENAND
diff --git a/include/configs/apx4devkit.h b/include/configs/apx4devkit.h
new file mode 100644
index 0000000..9f731b7
--- /dev/null
+++ b/include/configs/apx4devkit.h
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2011 Veli-Pekka Peltola <veli-pekka.pelt...@bluegiga.com>
+ *
+ * Based on m28evk.h:
+ * Copyright (C) 2011 Marek Vasut <marek.va...@gmail.com>
+ *
+ * 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
+ */
+#ifndef __CONFIG_APX4DEVKIT_H__
+#define __CONFIG_APX4DEVKIT_H__
+
+#include <asm/arch/regs-base.h>
+
+/* SoC configuration */
+#define CONFIG_MX28                            /* i.MX28 SoC */
+#define CONFIG_MXS_GPIO                        /* GPIO control */
+#define CONFIG_SYS_HZ          1000            /* Ticks per second */
+
+/* Define APX4DEVKIT machine type by hand until mach-types gets updated */
+#define MACH_TYPE_APX4DEVKIT   3712
+#define CONFIG_MACH_TYPE       MACH_TYPE_APX4DEVKIT
+
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_SYS_ICACHE_OFF
+#define CONFIG_SYS_DCACHE_OFF
+#define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_ARCH_CPU_INIT
+
+/* U-Boot Commands */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_NAND
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_USB
+
+/* Memory configuration */
+#define CONFIG_NR_DRAM_BANKS           1               /* 1 bank of DRAM */
+#define PHYS_SDRAM_1                   0x40000000      /* Base address */
+#define PHYS_SDRAM_1_SIZE              0x04000000      /* 64 MB */
+#define CONFIG_STACKSIZE               0x00010000      /* 128 KB stack */
+#define CONFIG_SYS_MALLOC_LEN          0x00400000      /* 4 MB for malloc */
+#define CONFIG_SYS_GBL_DATA_SIZE       128             /* Initial data */
+#define CONFIG_SYS_MEMTEST_START       0x40000000      /* Memtest start adr */
+#define CONFIG_SYS_MEMTEST_END         0x40400000      /* 4 MB RAM test */
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_SP_ADDR        0x00002000
+#define CONFIG_SYS_TEXT_BASE           0x40000100
+
+/* U-Boot general configuration */
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_SYS_PROMPT      "=> "
+#define CONFIG_SYS_CBSIZE      1024            /* Console I/O buffer size */
+#define CONFIG_SYS_PBSIZE      \
+       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+                                               /* Print buffer size */
+#define CONFIG_SYS_MAXARGS     32              /* Max number of command args */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+                                               /* Boot argument buffer size */
+#define CONFIG_VERSION_VARIABLE                /* U-BOOT version */
+#define CONFIG_AUTO_COMPLETE                   /* Command auto complete */
+#define CONFIG_CMDLINE_EDITING                 /* Command history etc. */
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
+
+/* Serial Port */
+#define CONFIG_PL011_SERIAL
+#define CONFIG_PL011_CLOCK             24000000
+#define CONFIG_PL01x_PORTS             { (void *)MXS_UARTDBG_BASE }
+#define CONFIG_CONS_INDEX              0
+#define CONFIG_BAUDRATE                115200  /* Default baud rate */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
+
+/* MMC */
+#ifdef CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MXS_MMC
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#endif
+
+/* NAND */
+#define CONFIG_NAND_MXS
+#define CONFIG_APBH_DMA
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_BASE           0x60000000
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define NAND_MAX_CHIPS                 1
+
+/* Environment is in NAND */
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_SECT_SIZE           (128 * 1024)
+#define CONFIG_ENV_SIZE                (128 * 1024)
+#define CONFIG_ENV_SIZE_REDUND         CONFIG_ENV_SIZE
+#define CONFIG_ENV_OFFSET              0x120000
+#define CONFIG_ENV_OFFSET_REDUND       \
+               (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
+
+#define CONFIG_CMD_UBI
+#define CONFIG_CMD_UBIFS
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_RBTREE
+#define CONFIG_LZO
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
+#define MTDIDS_DEFAULT         "nand0=gpmi-nand"
+#define MTDPARTS_DEFAULT                       \
+       "mtdparts=gpmi-nand:"                   \
+               "128k(bootstrap),"              \
+               "1m(boot),"                     \
+               "256k(env),"                    \
+               "-(root)\0"
+
+/* Ethernet (FEC) */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_FEC_MXC
+#define CONFIG_FEC_MXC_PHYADDR 0
+#define IMX_FEC_BASE           MXS_ENET0_BASE
+#define CONFIG_MII
+#define CONFIG_FEC_XCV_TYPE    RMII
+#endif
+
+/* USB */
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MXS
+#define CONFIG_EHCI_MXS_PORT   1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#endif
+
+/* Linux */
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_SERIAL_TAG
+#define CONFIG_REVISION_TAG
+#define CONFIG_BOOTDELAY               1
+#define CONFIG_BOOTFILE                "uImage-apx4devkit.bin"
+#define CONFIG_BOOTARGS                \
+       "console=tty0 console=ttyAMA0,115200 lpj=1130496"
+#define CONFIG_BOOTCOMMAND             "run bootcmd_mmc"
+#define CONFIG_LOADADDR                0x42000000
+#define CONFIG_SYS_LOAD_ADDR           CONFIG_LOADADDR
+#define CONFIG_EXTRA_ENV_SETTINGS      \
+       "mtdparts=" MTDPARTS_DEFAULT \
+       "bootcmd_nand=" \
+               "ubi part root 2048 && " \
+               "ubifsmount rootfs && ubifsload ${loadaddr} boot/kernel && " \
+               "set bootargs ${bootargs} ${mtdparts} ubi.mtd=3 " \
+               "root=ubi0:rootfs rootfstype=ubifs && bootm\0" \
+       "bootcmd_mmc=" \
+               "mmc rescan && " \
+               "ext2load mmc 0:2 ${loadaddr} boot/kernel && " \
+               "set bootargs ${bootargs} ${mtdparts} root=/dev/mmcblk0p2 " \
+               "rootwait && bootm\0"
+
+#endif /* __CONFIG_APX4DEVKIT_H__ */
-- 
1.7.5.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to