[Armadeus-commitlog] SF.net SVN: armadeus:[1219] trunk
Brought to you by:
sszy
|
From: <ar...@us...> - 2009-04-14 14:47:40
|
Revision: 1219
http://armadeus.svn.sourceforge.net/armadeus/?rev=1219&view=rev
Author: artemys
Date: 2009-04-14 14:47:39 +0000 (Tue, 14 Apr 2009)
Log Message:
-----------
[LINUX] Makes Wishbone examples drivers works with APF27
Modified Paths:
--------------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/281-apf27-armadeus-add_apf27.c.patch
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/291-apf27-add_debug_support_with_UART1.patch
trunk/target/linux/modules/fpga/wishbone_example/wb_button/board_buttons.c
trunk/target/linux/modules/fpga/wishbone_example/wb_irq_mngr/main.c
trunk/target/linux/modules/fpga/wishbone_example/wb_irq_mngr/test.c
trunk/target/linux/modules/fpga/wishbone_example/wb_led/board_leds.c
Added Paths:
-----------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/322-apf27-armadeus-add_mach_fpga_h.patch
Modified: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/281-apf27-armadeus-add_apf27.c.patch
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/281-apf27-armadeus-add_apf27.c.patch 2009-04-14 12:42:17 UTC (rev 1218)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/281-apf27-armadeus-add_apf27.c.patch 2009-04-14 14:47:39 UTC (rev 1219)
@@ -4,8 +4,8 @@
Index: linux-2.6.27.13/arch/arm/mach-mx2/apf27.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.27.13/arch/arm/mach-mx2/apf27.c 2009-04-08 15:48:50.000000000 +0200
-@@ -0,0 +1,1513 @@
++++ linux-2.6.27.13/arch/arm/mach-mx2/apf27.c 2009-04-14 16:09:10.000000000 +0200
+@@ -0,0 +1,1530 @@
+ /*
+ * apf27.c
+ *
@@ -78,6 +78,8 @@
+#if defined(CONFIG_CPU_FREQ_IMX27) || defined(CONFIG_CPU_FREQ_IMX27_MODULE)
+#include "cpufreq_imx.h"
+#endif
++#include <mach/board-apf27.h>
++#include <asm/mach/map.h>
+#include "devices.h"
+#include "crm_regs.h"
+
@@ -1509,12 +1511,27 @@
+ .init = apf27_timer_init,
+};
+
++static struct map_desc apf27_io_desc[] __initdata = {
++ {
++ .virtual = CS5_BASE_ADDR_VIRT,
++ .pfn = __phys_to_pfn(CS5_BASE_ADDR),
++ .length = CS5_SIZE,
++ .type = MT_DEVICE,
++ },
++};
++
++void __init apf27_map_io(void)
++{
++ mxc_map_io();
++ iotable_init(apf27_io_desc, ARRAY_SIZE(apf27_io_desc));
++}
++
+MACHINE_START(APF27, "Armadeus APF27")
+ /* Maintainer: Julien Boibessot <jul...@ar...> */
+ .phys_io = AIPI_BASE_ADDR,
+ .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
+ .boot_params = PHYS_OFFSET + 0x100,
-+ .map_io = mxc_map_io,
++ .map_io = apf27_map_io,
+ .init_irq = mxc_init_irq,
+ .init_machine = apf27_init,
+ .timer = &apf27_timer,
Modified: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/291-apf27-add_debug_support_with_UART1.patch
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/291-apf27-add_debug_support_with_UART1.patch 2009-04-14 12:42:17 UTC (rev 1218)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/291-apf27-add_debug_support_with_UART1.patch 2009-04-14 14:47:39 UTC (rev 1219)
@@ -1,8 +1,10 @@
---- linux-2.6.27.2ref/arch/arm/plat-mxc/include/mach/board-apf27.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.27.2/arch/arm/plat-mxc/include/mach/board-apf27.h 2008-11-19 18:32:11.000000000 +0100
-@@ -0,0 +1,28 @@
+Index: linux-2.6.27.13/arch/arm/plat-mxc/include/mach/board-apf27.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.27.13/arch/arm/plat-mxc/include/mach/board-apf27.h 2009-04-14 14:48:16.000000000 +0200
+@@ -0,0 +1,43 @@
+/*
-+ * Copyright (C) 2008 Juergen Beisert (ke...@pe...)
++ * Copyright (C) 2008 Armadeus Systems
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
@@ -22,15 +24,32 @@
+#ifndef __ASM_ARCH_MXC_BOARD_APF27_H__
+#define __ASM_ARCH_MXC_BOARD_APF27_H__
+
++
++#include <mach/iomux-mx1-mx2.h>
++
+/* mandatory for CONFIG_LL_DEBUG */
-+
+#define MXC_LL_UART_PADDR UART1_BASE_ADDR
+#define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR)
+
++/* CS5 */
++#define CS5_BASE_ADDR_VIRT 0xF4300000
++#define CS5_SIZE SZ_1M
+
-+#endif /* __ASM_ARCH_MXC_BOARD_PCM038_H__ */
---- linux-2.6.27.2ref/arch/arm/plat-mxc/include/mach/debug-macro.S 2008-10-10 00:13:53.000000000 +0200
-+++ linux-2.6.27.2/arch/arm/plat-mxc/include/mach/debug-macro.S 2008-11-19 18:27:56.000000000 +0100
++/* FPGA addresses */
++#define APF27_FPGA_VIRT (CS5_BASE_ADDR_VIRT)
++#define APF27_FPGA_PHYS (CS5_BASE_ADDR)
++#define APF27_FPGA_IRQ (IRQ_GPIOF(12))
++
++#define ARMADEUS_FPGA_BASE_ADDR_VIRT (APF27_FPGA_VIRT)
++#define ARMADEUS_FPGA_BASE_ADDR_PHYS (APF27_FPGA_PHYS)
++#define ARMADEUS_FPGA_IRQ (APF27_FPGA_IRQ)
++
++
++#endif /* __ASM_ARCH_MXC_BOARD_APF27_H__ */
+Index: linux-2.6.27.13/arch/arm/plat-mxc/include/mach/debug-macro.S
+===================================================================
+--- linux-2.6.27.13.orig/arch/arm/plat-mxc/include/mach/debug-macro.S 2008-10-10 00:13:53.000000000 +0200
++++ linux-2.6.27.13/arch/arm/plat-mxc/include/mach/debug-macro.S 2009-04-14 13:56:06.000000000 +0200
@@ -28,6 +28,9 @@
#ifdef CONFIG_MACH_PCM038
#include <mach/board-pcm038.h>
Added: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/322-apf27-armadeus-add_mach_fpga_h.patch
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/322-apf27-armadeus-add_mach_fpga_h.patch (rev 0)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.27.13/322-apf27-armadeus-add_mach_fpga_h.patch 2009-04-14 14:47:39 UTC (rev 1219)
@@ -0,0 +1,42 @@
+Index: linux-2.6.27.13/arch/arm/plat-mxc/include/mach/fpga.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.27.13/arch/arm/plat-mxc/include/mach/fpga.h 2009-04-14 16:30:36.000000000 +0200
+@@ -0,0 +1,37 @@
++/*
++ * Copyright (C) 2009 Armadeus Systems
++ *
++ * 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 __ASM_ARCH_ARMADEUS_FPGA_H__
++#define __ASM_ARCH_ARMADEUS_FPGA_H__
++
++
++#ifdef CONFIG_MACH_APF27
++#include <mach/board-apf27.h>
++#else
++/* To complete when MX1 platform merged */
++#endif
++
++/* FPGA interrupts number */
++#ifdef CONFIG_MACH_APF27
++#define IRQ_FPGA_START (IRQ_GPIOF(32) + 1)
++#endif
++#define IRQ_FPGA(x) (IRQ_FPGA_START + x)
++
++
++#endif /* __ASM_ARCH_ARMADEUS_FPGA_H__ */
++
Modified: trunk/target/linux/modules/fpga/wishbone_example/wb_button/board_buttons.c
===================================================================
--- trunk/target/linux/modules/fpga/wishbone_example/wb_button/board_buttons.c 2009-04-14 12:42:17 UTC (rev 1218)
+++ trunk/target/linux/modules/fpga/wishbone_example/wb_button/board_buttons.c 2009-04-14 14:47:39 UTC (rev 1219)
@@ -1,9 +1,8 @@
/*
- ***********************************************************************
+ * Specific button driver for generic button driver
*
* (c) Copyright 2008 Armadeus project
* Fabien Marteau <fab...@ar...>
- * Specific button driver for generic button driver
*
* 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
@@ -18,7 +17,6 @@
* 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/version.h>
@@ -26,33 +24,32 @@
#include <linux/config.h>
#endif
-/* form module/drivers */
#include <linux/init.h>
#include <linux/module.h>
-
-/* for platform device */
#include <linux/platform_device.h>
+#include <mach/hardware.h>
+#ifdef CONFIG_MACH_APF27 /* To remove when MX1 platform merged */
+#include <mach/fpga.h>
+#endif
#include "button.h"
#define BUTTON0_IRQ IRQ_FPGA(0)
-static struct plat_button_port plat_button0_data={
+static struct plat_button_port plat_button0_data = {
.name = "BUTTON0",
- .interrupt_number=BUTTON0_IRQ,
- .num=0,
- .membase = (void *)(ARMADEUS_FPGA_BASE_ADDR_VIRT +
- 0xc),
- .idnum=3,
- .idoffset=0x00 * (16 /8)
+ .interrupt_number = BUTTON0_IRQ,
+ .num = 0,
+ .membase = (void *)(ARMADEUS_FPGA_BASE_ADDR_VIRT + 0xc),
+ .idnum = 3,
+ .idoffset = 0x00 * (16 / 8)
};
-
-static struct platform_device plat_button0_device={
+static struct platform_device plat_button0_device = {
.name = "button",
- .id=0,
- .dev={
+ .id = 0,
+ .dev = {
.platform_data = &plat_button0_data
},
};
@@ -60,17 +57,12 @@
static int __init board_button_init(void)
{
- int ret = -1;
- ret = platform_device_register(&plat_button0_device);
- if(ret<0)return ret;
-
- return ret;
+ return platform_device_register(&plat_button0_device);
}
static void __exit board_button_exit(void)
{
platform_device_unregister(&plat_button0_device);
-
}
module_init(board_button_init);
Modified: trunk/target/linux/modules/fpga/wishbone_example/wb_irq_mngr/main.c
===================================================================
--- trunk/target/linux/modules/fpga/wishbone_example/wb_irq_mngr/main.c 2009-04-14 12:42:17 UTC (rev 1218)
+++ trunk/target/linux/modules/fpga/wishbone_example/wb_irq_mngr/main.c 2009-04-14 14:47:39 UTC (rev 1219)
@@ -37,10 +37,17 @@
# include <mach/irqs.h>
#endif
#include <asm/irq.h>
-#include <asm/io.h> // readb() & Co
+#include <asm/io.h> /* readb() & Co */
#include <asm/mach/irq.h>
+#ifdef CONFIG_MACH_APF27
+#include <mach/fpga.h> /* To remove when MX1 platform merged */
+#else
+#define VA_GPIO_BASE IO_ADDRESS(IMX_GPIO_BASE)
+#define MXC_ISR(x) (0x34 + ((x) << 8))
+#endif
+
#if 0
#define DEBUG_FPGA_IRQ(fmt,args...) printk(KERN_DEBUG "IRQ_MNGR: " fmt,##args)
#else
@@ -54,8 +61,8 @@
#define NB_IT (16)
-#define FPGA_IMR (APF9328_FPGA_VIRT + IRQ_MNGR_BASE + 0x00) /* Interrupt Mask Register */
-#define FPGA_ISR (APF9328_FPGA_VIRT + IRQ_MNGR_BASE + 0x02) /* Interrupt Status Register */
+#define FPGA_IMR (ARMADEUS_FPGA_BASE_ADDR_VIRT + IRQ_MNGR_BASE + 0x00) /* Interrupt Mask Register */
+#define FPGA_ISR (ARMADEUS_FPGA_BASE_ADDR_VIRT + IRQ_MNGR_BASE + 0x02) /* Interrupt Status Register */
static int
@@ -73,9 +80,11 @@
DEBUG_FPGA_IRQ("%s: irq %d ack:0x%x\n", __FUNCTION__, irq, shadow);
writew( shadow, FPGA_ISR );
- /* if last IT ack GPIO global IRQ */
- if( readw(FPGA_ISR) == 0 )
- ISR(IRQ_TO_REG(APF9328_FPGA_IRQ)) = 1 << (APF9328_FPGA_IRQ - IRQ_GPIOA(0));
+ /* if last IT, ack GPIO global IRQ */
+ if( readw(FPGA_ISR) == 0 ) {
+ __raw_writel(1 << (ARMADEUS_FPGA_IRQ & 0x1f),
+ VA_GPIO_BASE + MXC_ISR(IRQ_TO_REG(ARMADEUS_FPGA_IRQ)));
+ }
}
static void
@@ -139,21 +148,19 @@
static int __init ocore_irq_mng_init(void)
{
unsigned int irq;
- u16 data;
- int result=0;
+ u16 data;
+ int result=0;
DEBUG_FPGA_IRQ("Initializing FPGA IRQs\n");
- /**************************/
- /* check if ID is correct */
- /**************************/
- data = ioread16(APF9328_FPGA_VIRT+IRQ_MNGR_BASE+ID_OFFSET);
- if(data != ID)
- {
- result = -1;
- printk(KERN_WARNING "For irq_mngr id:%d doesn't match with id read %d,\n is device present ?\n",ID,data);
- goto error_id;
- }
+ /* check if ID is correct */
+ data = ioread16(ARMADEUS_FPGA_BASE_ADDR_VIRT + IRQ_MNGR_BASE + ID_OFFSET);
+ if (data != ID) {
+ result = -1;
+ printk(KERN_WARNING "For irq_mngr id:%d doesn't match with id"
+ "read %d,\n is device present ?\n", ID, data);
+ goto error_id;
+ }
/* Mask all interrupts initially */
writew(0, FPGA_IMR);
@@ -162,13 +169,13 @@
set_irq_chip_and_handler( irq, &imx_fpga_chip, handle_edge_irq );
set_irq_flags(irq, IRQF_VALID);
}
- set_irq_chained_handler(APF9328_FPGA_IRQ, imx_fpga_demux_handler);
+ set_irq_chained_handler(ARMADEUS_FPGA_IRQ, imx_fpga_demux_handler);
DEBUG_FPGA_IRQ("IRQs initialized\n");
return 0;
error_id:
- return result;
+ return result;
}
static void __exit ocore_irq_mng_exit(void)
@@ -179,7 +186,7 @@
set_irq_handler(irq,NULL);
set_irq_flags(irq, 0);
}
- set_irq_chained_handler(APF9328_FPGA_IRQ, NULL);
+ set_irq_chained_handler(ARMADEUS_FPGA_IRQ, NULL);
DEBUG_FPGA_IRQ("%s\n", __FUNCTION__);
}
@@ -190,3 +197,4 @@
MODULE_AUTHOR("Julien Boibessot, <jul...@ar...>");
MODULE_DESCRIPTION("Armadeus OpenCore IRQ manager");
MODULE_LICENSE("GPL");
+
Modified: trunk/target/linux/modules/fpga/wishbone_example/wb_irq_mngr/test.c
===================================================================
--- trunk/target/linux/modules/fpga/wishbone_example/wb_irq_mngr/test.c 2009-04-14 12:42:17 UTC (rev 1218)
+++ trunk/target/linux/modules/fpga/wishbone_example/wb_irq_mngr/test.c 2009-04-14 14:47:39 UTC (rev 1219)
@@ -29,10 +29,13 @@
#include <linux/module.h>
#include <linux/interrupt.h>
#include <asm/irq.h>
+#ifdef CONFIG_MACH_APF27
+#include <mach/fpga.h> /* To remove when MX1 platform merged*/
+#endif
/* Module's parameters: */
-static int interrupt=IRQ_FPGA(3);
+static int interrupt = IRQ_FPGA(3);
module_param(interrupt, int, 0000);
MODULE_PARM_DESC(interrupt, "IT to request");
@@ -53,13 +56,14 @@
int result;
/* IRQ registering */
- if( (result=request_irq( interrupt, (irq_handler_t)fpga_interrupt, /*IRQF_SHARED*/0, "ocore_irq_test", &data)) < 0 )
- {
+ if ((result = request_irq(interrupt, (irq_handler_t)fpga_interrupt,
+ /*IRQF_SHARED*/0, "ocore_irq_test", &data)) < 0) {
printk(KERN_ERR "Can't request IRQ n°%d\n", interrupt);
goto error;
}
- printk(KERN_INFO DRIVER_NAME " inserted (IRQ %d reserved), be sure to have correspondig IP loaded in the FPGA !\n", interrupt);
+ printk(KERN_INFO DRIVER_NAME " inserted (IRQ %d reserved), be sure to "
+ "have correspondig IP loaded in the FPGA !\n", interrupt);
return 0;
error:
@@ -79,3 +83,4 @@
MODULE_AUTHOR("Julien Boibessot, <jul...@ar...>");
MODULE_DESCRIPTION("OpenCore IRQ manager IP's test driver");
MODULE_LICENSE("GPL");
+
Modified: trunk/target/linux/modules/fpga/wishbone_example/wb_led/board_leds.c
===================================================================
--- trunk/target/linux/modules/fpga/wishbone_example/wb_led/board_leds.c 2009-04-14 12:42:17 UTC (rev 1218)
+++ trunk/target/linux/modules/fpga/wishbone_example/wb_led/board_leds.c 2009-04-14 14:47:39 UTC (rev 1219)
@@ -1,9 +1,8 @@
/*
- ***********************************************************************
+ * Specific led driver for generic led driver
*
* (c) Copyright 2008 Armadeus project
* Fabien Marteau <fab...@ar...>
- * Specific led driver for generic led driver
*
* 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
@@ -18,7 +17,6 @@
* 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/version.h>
@@ -26,21 +24,21 @@
#include <linux/config.h>
#endif
-/* form module/drivers */
#include <linux/init.h>
#include <linux/module.h>
-
-/* for platform device */
#include <linux/platform_device.h>
-
+#ifdef CONFIG_MACH_APF27 /* to be removed when MX1 platform merged */
+#include <mach/fpga.h>
+#endif
#include"led.h"
+
static struct plat_led_port plat_led0_data = {
.name = "LED0",
- .num=0,
+ .num = 0,
.membase = (void *)(ARMADEUS_FPGA_BASE_ADDR_VIRT + 0x8),
- .idnum=2,
- .idoffset=0x01 * (16 /8)
+ .idnum = 2,
+ .idoffset = 0x01 * (16 / 8),
};
@@ -50,28 +48,23 @@
static struct platform_device plat_led0_device = {
.name = "led",
- .id=0,
- .dev={
+ .id = 0,
+ .dev = {
.release = plat_led_release,
- .platform_data=&plat_led0_data},
+ .platform_data=&plat_led0_data
+ },
};
static int __init sled_init(void)
{
- int ret=-1;
- ret = platform_device_register(&plat_led0_device);
- if(ret<0)return ret;
-
- PDEBUG("*led inserted*\n");
- return ret;
+ return platform_device_register(&plat_led0_device);
}
static void __exit sled_exit(void)
{
printk(KERN_WARNING "deleting board_leds\n");
platform_device_unregister(&plat_led0_device);
-
}
module_init(sled_init);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|