From: Hugo Villeneuve <[EMAIL PROTECTED]>

ARM DaVinci: Add support for the Lyrtech SFFSDR board

The Lyrtech SFFSDR (Small form Factor Software Defined Radio) board is built 
around a TI DM6446 and a Xilinx Virtex-4 FPGA

Signed-off-by: Hugo Villeneuve <[EMAIL PROTECTED]>
---
 arch/arm/mach-davinci/Kconfig        |    8 ++
 arch/arm/mach-davinci/Makefile       |    1 +
 arch/arm/mach-davinci/board-sffsdr.c |  225 ++++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index fd3f8bd..8c13092 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -18,6 +18,14 @@ config MACH_DAVINCI_EVM
          Configure this option to specify the whether the board used
          for development is a DaVinci EVM
 
+config MACH_DAVINCI_SFFSDR
+       bool "Lyrtech SFFSDR"
+       default n
+       depends on ARCH_DAVINCI644x
+       help
+         Say Y here to select the Lyrtech Small Form Factor
+         Software Defined Radio (SFFSDR) board.
+
 config DAVINCI_MCBSP
        bool
         prompt "DaVinci McBSP Driver" if SOUND_DAVINCI=n
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 945ee80..28232c4 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -9,4 +9,5 @@ obj-y                   := time.o irq.o clock.o serial.o io.o 
id.o psc.o \
 
 # Board specific
 obj-$(CONFIG_MACH_DAVINCI_EVM)         += board-evm.o
+obj-$(CONFIG_MACH_DAVINCI_SFFSDR)      += board-sffsdr.o
 obj-$(CONFIG_DAVINCI_MCBSP)            += mcbsp.o
diff --git a/arch/arm/mach-davinci/board-sffsdr.c 
b/arch/arm/mach-davinci/board-sffsdr.c
new file mode 100644
index 0000000..d02890f
--- /dev/null
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -0,0 +1,225 @@
+/*
+ * Lyrtech SFFSDR board support.
+ *
+ * Copyright (C) 2008 Philip Balister, OpenSDR <[EMAIL PROTECTED]>
+ * Copyright (C) 2008 Lyrtech <www.lyrtech.com>
+ *
+ * Based on DV-EVM platform, original copyright follows:
+ *
+ * Copyright (C) 2007 MontaVista Software, Inc.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/dma-mapping.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <linux/i2c/at24.h>
+#include <linux/etherdevice.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
+
+#include <asm/setup.h>
+#include <asm/io.h>
+#include <asm/mach-types.h>
+#include <mach/hardware.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/flash.h>
+
+#include <mach/common.h>
+#include <mach/board.h>
+#include <mach/emac.h>
+#include <mach/i2c.h>
+
+/* other misc. init functions */
+void __init davinci_psc_init(void);
+void __init davinci_irq_init(void);
+void __init davinci_map_common_io(void);
+void __init davinci_init_common_hw(void);
+
+#if defined(CONFIG_MTD_NAND_DAVINCI)
+struct mtd_partition davinci_sffsdr_nandflash_partition[] = {
+       /* U-Boot Environment: Block 0
+        * UBL:                Block 1
+        * U-Boot:             Blocks 6-7 (256 kb)
+        * Integrity Kernel:   Blocks 8-31 (3 Mb)
+        * Integrity Data:     Blocks 100-END
+        */
+       {
+               .name           = "Linux Kernel",
+               .offset         = 32 * SZ_128K,
+               .size           = 16 * SZ_128K, /* 2 Mb */
+               .mask_flags     = MTD_WRITEABLE, /* Force read-only */
+       },
+       {
+               .name           = "Linux ROOT",
+               .offset         = MTDPART_OFS_APPEND,
+               .size           = 256 * SZ_128K, /* 32 Mb */
+               .mask_flags     = 0, /* R/W */
+       },
+};
+
+static struct flash_platform_data davinci_sffsdr_nandflash_data = {
+       .parts          = davinci_sffsdr_nandflash_partition,
+       .nr_parts       = ARRAY_SIZE(davinci_sffsdr_nandflash_partition),
+};
+
+static struct resource davinci_sffsdr_nandflash_resource = {
+       .start          = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE,
+       .end            = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,
+       .flags          = IORESOURCE_MEM,
+};
+
+static struct platform_device davinci_sffsdr_nandflash_device = {
+       .name           = "davinci_nand", /* Name of driver */
+       .id             = 0,
+       .dev            = {
+               .platform_data  = &davinci_sffsdr_nandflash_data,
+       },
+       .num_resources  = 1,
+       .resource       = &davinci_sffsdr_nandflash_resource,
+};
+#endif
+
+#if defined(CONFIG_TI_DAVINCI_EMAC)
+/* Get Ethernet address from kernel boot params */
+static u8 davinci_sffsdr_mac_addr[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+#endif /* CONFIG_TI_DAVINCI_EMAC) */
+
+static struct at24_platform_data eeprom_info = {
+       .byte_len       = (64*1024) / 8,
+       .page_size      = 32,
+       .flags          = AT24_FLAG_ADDR16,
+};
+
+static struct i2c_board_info __initdata i2c_info[] =  {
+       {
+               I2C_BOARD_INFO("24LC64", 0x50),
+               .platform_data  = &eeprom_info,
+       },
+       /* Other I2C devices:
+        * MSP430,  addr 0x23
+        * PCA9543, addr 0x70 (setup done by U-Boot)
+        * ADS7828, addr 0x48 (ADC for voltage monitoring.)
+        */
+};
+
+/* The msp430 uses a slow bitbanged I2C implementation (ergo 20 KHz),
+ * which requires 100 usec of idle bus after i2c writes sent to it.
+ */
+static struct davinci_i2c_platform_data i2c_pdata = {
+       .bus_freq       = 20 /* kHz */,
+       .bus_delay      = 100 /* usec */,
+};
+
+static void __init sffsdr_init_i2c(void)
+{
+       davinci_init_i2c(&i2c_pdata);
+       i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
+}
+
+static struct platform_device *davinci_sffsdr_devices[] __initdata = {
+#if defined(CONFIG_MTD_NAND_DAVINCI)
+       &davinci_sffsdr_nandflash_device,
+#endif
+};
+
+static struct davinci_uart_config davinci_sffsdr_uart_config __initdata = {
+       .enabled_uarts = (1 << 0),
+};
+
+static struct davinci_board_config_kernel davinci_sffsdr_config[] __initdata = 
{
+       { DAVINCI_TAG_UART, &davinci_sffsdr_uart_config },
+};
+
+static void __init
+davinci_sffsdr_map_io(void)
+{
+       davinci_map_common_io();
+}
+
+static __init void davinci_sffsdr_init(void)
+{
+       davinci_psc_init();
+       platform_add_devices(davinci_sffsdr_devices,
+                            ARRAY_SIZE(davinci_sffsdr_devices));
+       sffsdr_init_i2c();
+       davinci_board_config = davinci_sffsdr_config;
+       davinci_board_config_size = ARRAY_SIZE(davinci_sffsdr_config);
+       davinci_serial_init();
+
+#if defined(CONFIG_TI_DAVINCI_EMAC)
+       davinci_init_emac(davinci_sffsdr_mac_addr);
+#endif /* CONFIG_TI_DAVINCI_EMAC) */
+
+#if defined(CONFIG_USB_MUSB_HDRC)
+       /* The SFFSDR supports only peripheral mode. */
+       setup_usb(0, 0);
+#endif  /* CONFIG_USB_SUPPORT */
+}
+
+#if defined(CONFIG_TI_DAVINCI_EMAC)
+
+/* Conversion of a MAC address from a string (AA:BB:CC:DD:EE:FF)
+ * to a 6 bytes array. */
+int davinci_sffsdr_convert_macaddr(char *mac_addr_str, u8 *mac_addr_array)
+{
+       int i;
+
+       if (mac_addr_str == NULL)
+               return -EFAULT;
+
+       for (i = 0; i < 6; i++)
+               mac_addr_array[i] = simple_strtol(&mac_addr_str[i*3],
+                                                 (char **)NULL, 16);
+
+       return 0;
+}
+
+static int davinci_cpmac_eth_setup(char *str)
+{
+       /* The first char passed from the bootloader is '=', so ignore it */
+       davinci_sffsdr_convert_macaddr(&str[1], davinci_sffsdr_mac_addr);
+
+       return 1;
+}
+
+__setup("eth", davinci_cpmac_eth_setup);
+#endif /* CONFIG_TI_DAVINCI_EMAC) */
+
+static __init void davinci_sffsdr_irq_init(void)
+{
+       davinci_init_common_hw();
+       davinci_irq_init();
+}
+
+MACHINE_START(SFFSDR, "Lyrtech SFFSDR")
+       /* Maintainer: Hugo Villeneuve [EMAIL PROTECTED] */
+       .phys_io      = IO_PHYS,
+       .io_pg_offst  = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
+       .boot_params  = (DAVINCI_DDR_BASE + 0x100),
+       .map_io       = davinci_sffsdr_map_io,
+       .init_irq     = davinci_sffsdr_irq_init,
+       .timer        = &davinci_timer,
+       .init_machine = davinci_sffsdr_init,
+MACHINE_END

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to