[U-Boot] [PATCH v2 2/3] MX31: Add basic support for Freescale i.MX31 PDK board.

Magnus Lilja
2009-05-10T19:32:40Z

2009/5/9 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
>> +++ b/board/freescale/mx31pdk/lowlevel_init.S
>> @@ -0,0 +1,30 @@
>> +/*
>> + * (C) Copyright 2008 Magnus Lilja <lilja.magnus@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
>> + */
>> +
>> +/*
>> + * This is just to keep the linker happy.
>> + */
>> +
>> +.globl lowlevel_init
>> +
>> +lowlevel_init:
>> + ? ? mov ? ? pc, lr
> why do you need it?

start.S:cpu_init_crit needs it and I haven't defined SKIP_LOWLEVEL.
Might be possible to define SKIP_LOWLEVEL_INIT and get rid of the
above line.

>> diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
>> new file mode 100644
>> index 0000000..9eed979
>> --- /dev/null
>> +++ b/board/freescale/mx31pdk/mx31pdk.c
>> @@ -0,0 +1,76 @@
>> +/*
>> + *
>> + * (C) Copyright 2008 Magnus Lilja <lilja.magnus@gmail.com>
>> + *
>> + * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.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 <asm/arch/mx31.h>
>> +#include <asm/arch/mx31-regs.h>
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +int dram_init(void)
>> +{
>> + ? ? gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
>> + ? ? gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
>> +
>> + ? ? return 0;
>> +}
>> +
>> +int board_init(void)
>> +{
>> + ? ? /* CS5: CPLD incl. network controller */
>> + ? ? __REG(CSCR_U(5)) = 0x0000d843;
>> + ? ? __REG(CSCR_L(5)) = 0x22252521;
>> + ? ? __REG(CSCR_A(5)) = 0x22220a00;
>> +
>> + ? ? /* setup pins for UART1 */
>> + ? ? mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX);
>> + ? ? mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX);
>> + ? ? mx31_gpio_mux(MUX_RTS1__UART1_RTS_B);
>> + ? ? mx31_gpio_mux(MUX_CTS1__UART1_CTS_B);
> I think it's time to create common device init functions
> as done for davinci or at91

I think I prefer the at91 way of doing this, I can create
cpu/arm1136/mx31/serial.c and spi.c.

>> +
>> + ? ? /* SPI2 */
>> + ? ? mx31_gpio_mux(MUX_CSPI2_SS2__CSPI2_SS2_B);
>> + ? ? mx31_gpio_mux(MUX_CSPI2_SCLK__CSPI2_CLK);
>> + ? ? mx31_gpio_mux(MUX_CSPI2_SPI_RDY__CSPI2_DATAREADY_B);
>> + ? ? mx31_gpio_mux(MUX_CSPI2_MOSI__CSPI2_MOSI);
>> + ? ? mx31_gpio_mux(MUX_CSPI2_MISO__CSPI2_MISO);
>> + ? ? mx31_gpio_mux(MUX_CSPI2_SS0__CSPI2_SS0_B);
>> + ? ? mx31_gpio_mux(MUX_CSPI2_SS1__CSPI2_SS1_B);
> ditto
>> +
>> + ? ? /* start SPI2 clock */
>> + ? ? __REG(CCM_CGR2) = __REG(CCM_CGR2) | (3 << 4);
>> +
>> + ? ? gd->bd->bi_arch_number = MACH_TYPE_MX31_3DS; /* board id for linux */
>> + ? ? gd->bd->bi_boot_params = 0x80000100; /* adress of boot parameters */
> please use this style
>
> RAM_BASE + 0x100
> as other arm board
>> +
>> + ? ? return 0;
>> +}
>> +
>> diff --git a/board/freescale/mx31pdk/u-boot.lds b/board/freescale/mx31pdk/u-boot.lds
>> new file mode 100644
>> index 0000000..e96509a
>> --- /dev/null
>> +++ b/board/freescale/mx31pdk/u-boot.lds
> I've send a patch that unify all arm lds so this one is not anymore needed

I'll try it. Are you planning other major changes that will affect
these patches in the near future?

>> @@ -0,0 +1,59 @@
>> +/*
>> + * 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_H
>> +#define __CONFIG_H
>> +
>> +#include <asm/arch/mx31-regs.h>
> why?

So we can use symbolic names for Ethernet base address, SDRAM base
address. I.e. instead of writing e.g. 0xB6000000 we can write
CS5_BASE. I can switch to hard coded numerical values and get rid of
the #include if requested.

>> +/***********************************************************
>> + * Command definition
>> + ***********************************************************/
>> +
>> +#include <config_cmd_default.h>
>> +
>> +#define CONFIG_CMD_MII
>> +#define CONFIG_CMD_PING
>> +#define CONFIG_CMD_SPI
>> +#define CONFIG_CMD_DATE
>> +
>> +/* Disabled due to compilation errors in cmd_bootm.c (IMLS seems to require
>> + * that CFG_NO_FLASH is undefined).
>> + */
> please remove the comment

The comment was added since Wolfgang asked why IMLS was disabled when
I posted a similar set of patches last year, so I'm going to keep the
comment.

>> +#undef CONFIG_CMD_IMLS

Thanks, Magnus