[U-Boot] RFC [PATCH 4/5 v5] dreamplug: initial board support.
Jason
u-boot at lakedaemon.net
Thu Jul 28 04:02:33 CEST 2011
On Wed, Jul 27, 2011 at 11:38:55AM -0700, Prafulla Wadaskar wrote:
>
>
> > -----Original Message-----
> > From: Jason Cooper [mailto:u-boot at lakedaemon.net]
> > Sent: Wednesday, July 27, 2011 2:49 AM
> > To: clint at debian.org; wd at denx.de; Prafulla Wadaskar
> > Cc: u-boot at lists.denx.de; Prabhanjan Sarnaik; Ashish Karkare; Siddarth
> > Gore; bdale at gag.com; Jason Cooper
> > Subject: RFC [PATCH 4/5 v5] dreamplug: initial board support.
> >
> > Copied wholeheartedly from board/Marvell/guruplug and modified to add
> > support
> > for SPI NOR flash.
> >
> > Also, the following features are used:
> > - Use the Marvell Integrated RTC.
> > - display Marvell CPU/L2/etc speeds if requested.
> >
> > Note: this still uses MACH_TYPE_GURUPLUG until MACH_TYPE_DREAMPLUG is
> > accepted
> > into mainline Linux. The source from Globalscale did the same.
> >
> > Signed-off-by: Jason Cooper <u-boot at lakedaemon.net>
> > ---
>
> There is no change log for all previous versions.
> Please put them here.
> Ref: http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions
%$#%@#. I knew I forgot something. Here it is:
Changes from v1 to v2:
- resorted series to move 'make all' support last.
Changes from v2 to v3:
- Use MACH_TYPE_GURUPLUG for now until dreamplug support is in
Linux.
- Update MAINTAINERS.
- Collapse into one patch.
Changes from v3 to v4:
- update copyright info as recommended by Prafulla Wadaskar.
- maintain proper order in boards.cfg, MAINTAINERS, etc.
- label MPP's
- change back to MACH_TYPE_DREAMPLUG. This patch is just RFC
until the Dreamplug is supported in Linux (and MACH_TYPE_
added).
Changes from v4 to v5:
- Complete rewrite due to receiving u-boot source indirectly
from Global Scale Tech.
- Added driver for integrated RTC. (thx GST!)
- Added support for displaying CPU frequencies at boot. (thx
GST!)
- Adjust USB timeout to handle dreamplug EHCI chipset.
- Cleaned up MPP registers based on Global Scale code. (thx
GST!)
- broke out MACH_TYPE_DREAMPLUG changes since it's going to be a
while until the Linux arm tree gets sorted and accepts new
boards again. Since all Dreamplugs currently on the market
set r1 to MACH_TYPE_GURUPLUG, this allows the board to be
added to u-boot while waiting for Linux mainline. Once it's
in Linux mainline, then the last patch can be integrated to use
MACH_TYPE_DREAMPLUG.
> > MAINTAINERS | 4 +
> > MAKEALL | 1 +
> > board/Marvell/dreamplug/Makefile | 54 +++++++++++
> > board/Marvell/dreamplug/dreamplug.c | 157
> > ++++++++++++++++++++++++++++++++
> > board/Marvell/dreamplug/dreamplug.h | 42 +++++++++
> > board/Marvell/dreamplug/kwbimage.cfg | 163
> > ++++++++++++++++++++++++++++++++++
> > boards.cfg | 1 +
> > include/configs/dreamplug.h | 138
> > ++++++++++++++++++++++++++++
> > 8 files changed, 560 insertions(+), 0 deletions(-)
> > create mode 100644 board/Marvell/dreamplug/Makefile
> > create mode 100644 board/Marvell/dreamplug/dreamplug.c
> > create mode 100644 board/Marvell/dreamplug/dreamplug.h
> > create mode 100644 board/Marvell/dreamplug/kwbimage.cfg
> > create mode 100644 include/configs/dreamplug.h
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 2bba7b4..9affbea 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -70,6 +70,10 @@ Conn Clark <clark at esteem.com>
> >
> > ESTEEM192E MPC8xx
> >
> > +Jason Cooper <u-boot at lakedaemon.net>
> > +
> > + dreamplug ARM926EJS (Kirkwood SoC)
> > +
> > Joe D'Abbraccio <ljd015 at freescale.com>
> >
> > MPC837xERDB MPC837x
> > diff --git a/MAKEALL b/MAKEALL
> > index 51db13e..55a122f 100755
> > --- a/MAKEALL
> > +++ b/MAKEALL
> > @@ -335,6 +335,7 @@ LIST_ARM9=" \
> > cp966 \
> > da830evm \
> > da850evm \
> > + dreamplug \
> > edb9301 \
> > edb9302 \
> > edb9302a \
> > diff --git a/board/Marvell/dreamplug/Makefile
> > b/board/Marvell/dreamplug/Makefile
> > new file mode 100644
> > index 0000000..9ee5406
> > --- /dev/null
> > +++ b/board/Marvell/dreamplug/Makefile
> > @@ -0,0 +1,54 @@
> > +#
> > +# (C) Copyright 2011
> > +# Jason Cooper <u-boot at lakedaemon.net>
> > +#
> > +# Based on work by:
> > +# Marvell Semiconductor <www.marvell.com>
> > +# Written-by: Siddarth Gore <gores at marvell.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., 51 Franklin Street, Fifth Floor, Boston,
> > +# MA 02110-1301 USA
> > +#
> > +
> > +include $(TOPDIR)/config.mk
> > +
> > +LIB = $(obj)lib$(BOARD).o
> > +
> > +COBJS := dreamplug.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/Marvell/dreamplug/dreamplug.c
> > b/board/Marvell/dreamplug/dreamplug.c
> > new file mode 100644
> > index 0000000..cdc094a
> > --- /dev/null
> > +++ b/board/Marvell/dreamplug/dreamplug.c
> > @@ -0,0 +1,157 @@
> > +/*
> > + * (C) Copyright 2011
> > + * Jason Cooper <u-boot at lakedaemon.net>
> > + *
> > + * Based on work by:
> > + * Marvell Semiconductor <www.marvell.com>
> > + * Written-by: Siddarth Gore <gores at marvell.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., 51 Franklin Street, Fifth Floor, Boston,
> > + * MA 02110-1301 USA
> > + */
> > +
> > +#include <common.h>
> > +#include <miiphy.h>
> > +#include <asm/arch/kirkwood.h>
> > +#include <asm/arch/mpp.h>
> > +#include "dreamplug.h"
> > +
> > +DECLARE_GLOBAL_DATA_PTR;
> > +
> > +int board_early_init_f(void)
> > +{
> > + /*
> > + * default gpio configuration
> > + * There are maximum 64 gpios controlled through 2 sets of registers
> > + * the below configuration configures mainly initial LED status
> > + */
> > + kw_config_gpio(DREAMPLUG_OE_VAL_LOW,
> > + DREAMPLUG_OE_VAL_HIGH,
> > + DREAMPLUG_OE_LOW, DREAMPLUG_OE_HIGH);
> > +
> > + /* Multi-Purpose Pins Functionality configuration */
> > + u32 kwmpp_config[] = {
> > + MPP0_SPI_SCn, /* SPI Flash */
> > + MPP1_SPI_MOSI,
> > + MPP2_SPI_SCK,
> > + MPP3_SPI_MISO,
> > + MPP4_NF_IO6,
> > + MPP5_NF_IO7,
> > + MPP6_SYSRST_OUTn,
> > + MPP7_GPO,
> > + MPP8_TW_SDA,
> > + MPP9_TW_SCK,
> > + MPP10_UART0_TXD, /* Serial */
> > + MPP11_UART0_RXD,
> > + MPP12_SD_CLK, /* SDIO Slot */
> > + MPP13_SD_CMD,
> > + MPP14_SD_D0,
> > + MPP15_SD_D1,
> > + MPP16_SD_D2,
> > + MPP17_SD_D3,
> > + MPP18_NF_IO0,
> > + MPP19_NF_IO1,
> > + MPP20_GE1_0, /* Gigabit Ethernet */
> > + MPP21_GE1_1,
> > + MPP22_GE1_2,
> > + MPP23_GE1_3,
> > + MPP24_GE1_4,
> > + MPP25_GE1_5,
> > + MPP26_GE1_6,
> > + MPP27_GE1_7,
> > + MPP28_GE1_8,
> > + MPP29_GE1_9,
> > + MPP30_GE1_10,
> > + MPP31_GE1_11,
> > + MPP32_GE1_12,
> > + MPP33_GE1_13,
> > + MPP34_GE1_14,
> > + MPP35_GE1_15,
> > + MPP36_GPIO,
> > + MPP37_GPIO,
> > + MPP38_GPIO,
> > + MPP39_GPIO,
> > + MPP40_TDM_SPI_SCK,
> > + MPP41_TDM_SPI_MISO,
> > + MPP42_TDM_SPI_MOSI,
> > + MPP43_GPIO,
> > + MPP44_GPIO,
> > + MPP45_GPIO,
> > + MPP46_GPIO, /* Wifi AP LED */
> > + MPP47_GPIO,
> > + MPP48_GPIO, /* Wifi LED */
>
> It is better if you can comment about rest other GPIOSs with their
> assigned functionality.
I filled in what I was comfortable labeling, anything else would be a
guess on my part. This is a standard kirkwood configuration except for
pins 0-3 and the LEDS (46,48). Should I add a comment to the same effect?
> > + MPP49_GPIO,
> > + 0
> > + };
> > + kirkwood_mpp_conf(kwmpp_config);
> > + return 0;
> > +}
> > +
> > +int board_init(void)
> > +{
> > + /*
> > + * arch number of board
> > + * XXX: change to MACH_TYPE_DREAMPLUG once in Linux mainline.
> > + */
> > + gd->bd->bi_arch_number = MACH_TYPE_GURUPLUG;
>
> I think this board should have some delta to guruplug? I think you
> should have different machine ID here.
See added changelog and patch 5 in the series.
> BTW: what is delta w.r.to guruplug?
Just 2MB SPI flash instead of 512MB NAND flash. It grabs the
kernel/initrd from an internal microSD card attached via USB, instead
of NAND flash. OS is on the same microSD card.
The dreamplug kernel shipped with the device doesn't even see the SPI
flash. I think it may be the exact same as the guruplug kernel,
although I haven't done a rigorous check. It's built for
MACH_TYPE_GURUPLUG, though.
It has some bells and whistles, like audio in/out, SPDIF out. Nothing
else really relevant to u-boot.
> > +
> > + /* adress of boot parameters */
> > + gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
> > +
> > + return 0;
> > +}
> > +
> > +#ifdef CONFIG_RESET_PHY_R
> > +void mv_phy_88e1121_init(char *name)
> > +{
> > + u16 reg;
> > + u16 devadr;
> > +
> > + if (miiphy_set_current_dev(name))
> > + return;
> > +
> > + /* command to read PHY dev address */
> > + if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
> > + printf("Err..%s could not read PHY dev address\n",
> > + __FUNCTION__);
> > + return;
> > + }
> > +
> > + /*
> > + * Enable RGMII delay on Tx and Rx for CPU port
> > + * Ref: sec 4.7.2 of chip datasheet
> > + */
> > + miiphy_write(name, devadr, MV88E1121_PGADR_REG, 2);
> > + miiphy_read(name, devadr, MV88E1121_MAC_CTRL2_REG, ®);
> > + reg |= (MV88E1121_RGMII_RXTM_CTRL | MV88E1121_RGMII_TXTM_CTRL);
> > + miiphy_write(name, devadr, MV88E1121_MAC_CTRL2_REG, reg);
> > + miiphy_write(name, devadr, MV88E1121_PGADR_REG, 0);
> > +
> > + /* reset the phy */
> > + miiphy_reset(name, devadr);
> > +
> > + printf("88E1116 Initialized on %s\n", name);
>
> Function name and print info are mismatching.
Gah! good catch. I just copied that printf over from the GST source
code. I'll fix it up.
> > +}
> > +
> > +void reset_phy(void)
> > +{
> > + /* configure and initialize both PHY's */
> > + mv_phy_88e1121_init("egiga0");
> > + mv_phy_88e1121_init("egiga1");
> > +}
> > +#endif /* CONFIG_RESET_PHY_R */
> > diff --git a/board/Marvell/dreamplug/dreamplug.h
> > b/board/Marvell/dreamplug/dreamplug.h
> > new file mode 100644
> > index 0000000..21bf644
> > --- /dev/null
> > +++ b/board/Marvell/dreamplug/dreamplug.h
> > @@ -0,0 +1,42 @@
> > +/*
> > + * (C) Copyright 2011
> > + * Jason Cooper <u-boot at lakedaemon.net>
> > + *
> > + * Based on work by:
> > + * Marvell Semiconductor <www.marvell.com>
> > + * Written-by: Siddarth Gore <gores at marvell.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., 51 Franklin Street, Fifth Floor, Boston,
> > + * MA 02110-1301 USA
> > + */
> > +
> > +#ifndef __DREAMPLUG_H
> > +#define __DREAMPLUG_H
> > +
> > +#define DREAMPLUG_OE_LOW (~(0))
> > +#define DREAMPLUG_OE_HIGH (~(0))
> > +#define DREAMPLUG_OE_VAL_LOW 0
> > +#define DREAMPLUG_OE_VAL_HIGH (0xf << 16) /* 4 LED Pins high */
> > +
> > +/* PHY related */
> > +#define MV88E1121_MAC_CTRL2_REG 21
> > +#define MV88E1121_PGADR_REG 22
> > +#define MV88E1121_RGMII_TXTM_CTRL (1 << 4)
> > +#define MV88E1121_RGMII_RXTM_CTRL (1 << 5)
> > +
> > +#endif /* __DREAMPLUG_H */
> > diff --git a/board/Marvell/dreamplug/kwbimage.cfg
> > b/board/Marvell/dreamplug/kwbimage.cfg
>
> I hope this is not same as guruplug (since you are using same machine-id)?
Very similar, see above.
thx,
Jason.
More information about the U-Boot
mailing list