From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 21 May 2008 23:22:33 +0200 Subject: [U-Boot-Users] [PATCH] ARM: Add support for Lyrtech SFF-SDR board (ARM926EJS) In-Reply-To: <1211392721-18236-1-git-send-email-hugo.villeneuve@lyrtech.com> References: <1211392721-18236-1-git-send-email-hugo.villeneuve@lyrtech.com> Message-ID: <20080521212233.GA22430@game.jcrosoft.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > @@ -0,0 +1,52 @@ > +# > +# (C) Copyright 2000, 2001, 2002 > +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. > +# > +# Copyright (C) 2007 Sergey Kubushyn > +# > +# 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 := dv_board.o please use $(BOARD).o > +SOBJS := board_init.o > + > +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) > +OBJS := $(addprefix $(obj),$(COBJS)) > +SOBJS := $(addprefix $(obj),$(SOBJS)) > + > +$(LIB): $(obj).depend $(OBJS) $(SOBJS) > + $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS) > + > +clean: > + rm -f $(SOBJS) $(OBJS) > + > +distclean: clean > + rm -f $(LIB) core *.bak *~ .depend > + > +######################################################################### > + * ---------------------------------------------------------------------------- > + */ > + > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +extern void timer_init(void); > +extern int eth_hw_init(void); > +extern phy_t phy; > + > + > +/* Works on Always On power domain only (no PD argument) */ > +void lpsc_on(unsigned int id) > +{ > + dv_reg_p mdstat, mdctl; ^^^^^^^ please use space instead of tab > + > + if (id >= DAVINCI_LPSC_GEM) > + return; /* Don't work on DSP Power Domain */ > + > + mdstat = REG_P(PSC_MDSTAT_BASE + (id * 4)); > + mdctl = REG_P(PSC_MDCTL_BASE + (id * 4)); > + > + while (REG(PSC_PTSTAT) & 0x01); > + > + if ((*mdstat & 0x1f) == 0x03) > + return; /* Already on and enabled */ > + > + *mdctl |= 0x03; > + > + /* Special treatment for some modules as for sprue14 p.7.4.2 */ > + if ((id == DAVINCI_LPSC_VPSSSLV) || > + (id == DAVINCI_LPSC_EMAC) || > + (id == DAVINCI_LPSC_EMAC_WRAPPER) || > + (id == DAVINCI_LPSC_MDIO) || > + (id == DAVINCI_LPSC_USB) || > + (id == DAVINCI_LPSC_ATA) || > + (id == DAVINCI_LPSC_VLYNQ) || > + (id == DAVINCI_LPSC_UHPI) || > + (id == DAVINCI_LPSC_DDR_EMIF) || > + (id == DAVINCI_LPSC_AEMIF) || > + (id == DAVINCI_LPSC_MMC_SD) || > + (id == DAVINCI_LPSC_MEMSTICK) || > + (id == DAVINCI_LPSC_McBSP) || > + (id == DAVINCI_LPSC_GPIO)) > + * mdctl |= 0x200; Please use switch instead of this long if > + > + REG(PSC_PTCMD) = 0x01; > + > + while (REG(PSC_PTSTAT) & 0x03); > + while ((*mdstat & 0x1f) != 0x03); /* Probably an overkill... */ > +} > + > +void dsp_on(void) > +{ > + int i; please use spacr > + > + if (REG(PSC_PDSTAT1) & 0x1f) > + return; /* Already on */ > + > + REG(PSC_GBLCTL) |= 0x01; > + REG(PSC_PDCTL1) |= 0x01; > + REG(PSC_PDCTL1) &= ~0x100; > + REG(PSC_MDCTL_BASE + (DAVINCI_LPSC_GEM * 4)) |= 0x03; > + REG(PSC_MDCTL_BASE + (DAVINCI_LPSC_GEM * 4)) &= 0xfffffeff; > + REG(PSC_MDCTL_BASE + (DAVINCI_LPSC_IMCOP * 4)) |= 0x03; > + REG(PSC_MDCTL_BASE + (DAVINCI_LPSC_IMCOP * 4)) &= 0xfffffeff; > + REG(PSC_PTCMD) = 0x02; > + > + for (i = 0; i < 100; i++) { > + if (REG(PSC_EPCPR) & 0x02) > + break; > + } > + > + REG(PSC_CHP_SHRTSW) = 0x01; > + REG(PSC_PDCTL1) |= 0x100; > + REG(PSC_EPCCR) = 0x02; > + > + for (i = 0; i < 100; i++) { > + if (!(REG(PSC_PTSTAT) & 0x02)) > + break; > + } > + > + REG(PSC_GBLCTL) &= ~0x1f; > +} > + > + please remove empty ligne > +int board_init(void) > + timer_init(); > + > + return(0); > +} > + > +int misc_init_r(void) > +{ > + u_int8_t tmp[20], buf[10]; > + int i = 0; > + int clk = 0; please use space > + > + clk = ((REG(PLL2_PLLM) + 1) * 27) / ((REG(PLL2_DIV2) & 0x1f) + 1); > + > + printf("ARM Clock: %dMHz\n", ((REG(PLL1_PLLM) + 1) * 27) / 2); > + printf("DDR Clock: %dMHz\n", (clk / 2)); > +/*==============================*/ > +#undef CONFIG_USE_IRQ /* No IRQ/FIQ in U-Boot */ > +#define CONFIG_MISC_INIT_R > +#undef CONFIG_BOOTDELAY > +#define CONFIG_BOOTFILE "uImage" /* Boot file name */ > +#define CFG_PROMPT "U-Boot > " /* Monitor Command Prompt */ > +#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */ > +/* Print buffer size */ > +#define CFG_PBSIZE (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16) > +#define CFG_MAXARGS 16 /* max number of command args */ > +#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ > +#define CFG_LOAD_ADDR 0x80700000 /* Default Linux kernel > + * load address. */ > +#define CONFIG_VERSION_VARIABLE > +#define CONFIG_AUTO_COMPLETE /* Won't work with hush so far, > + * may be later */ > +#define CFG_HUSH_PARSER > +#define CFG_PROMPT_HUSH_PS2 "> " > +#define CONFIG_CMDLINE_EDITING > +#define CFG_LONGHELP > +#define CONFIG_CRC32_VERIFY > +#define CONFIG_MX_CYCLIC > +/* > + * Define this to load an Integrity kernel. > + * > +#define CONFIG_CMD_ELF > + */ If no need please remove > + > +/*===================*/ > +/* Linux Information */ > +#define LINUX_BOOT_PARAM_ADDR 0x80000100 > +#define CONFIG_CMDLINE_TAG > +#define CONFIG_SETUP_MEMORY_TAGS > +#define CONFIG_BOOTARGS \ > + "mem=56M console=ttyS0,115200n8 root=/dev/hda1 rw noinitrd ip=dhcp" > +#define CONFIG_BOOTCOMMAND "setenv setboot setenv bootargs \\$(bootargs) video=dm64xxfb:output=\\$(videostd);run setboot" please split it too long > + > +/*=================*/ > +/* U-Boot commands */ > +/*=================*/ > +#include > +#define CONFIG_CMD_ASKENV > +#define CONFIG_CMD_DHCP > +#define CONFIG_CMD_DIAG > +#define CONFIG_CMD_I2C > +#define CONFIG_CMD_MII > +#define CONFIG_CMD_PING > +#define CONFIG_CMD_SAVES > +#define CONFIG_CMD_NAND > +#define CONFIG_CMD_EEPROM > +#undef CONFIG_CMD_BDI > +#undef CONFIG_CMD_FPGA > +#undef CONFIG_CMD_SETGETDCR > +#undef CONFIG_CMD_FLASH > +#undef CONFIG_CMD_IMLS > +/*=======================*/ > +/* KGDB support (if any) */ > +/*=======================*/ > +#ifdef CONFIG_CMD_KGDB > +#define CONFIG_KGDB_BAUDRATE 115200 /* speed to run kgdb serial port */ > +#define CONFIG_KGDB_SER_INDEX 1 /* which serial port to use */ > +#endif Best Regards, J.