[linux-yocto] [PATCH 04/30] arm: rapidio updates
Bruce Ashfield
bruce.ashfield at windriver.com
Tue Apr 22 14:01:38 PDT 2014
On 14-04-17 10:36 PM, Charlie Paul wrote:
> From: Paul Butler <paul.butler at windriver.com>
Again. We need a summary here. What are we doing ? Enabling what
features in the rapid io implementation ? Enabling it for a specific
board ?
Bruce
>
> Signed-off-by: Paul Butler <paul.butler at windriver.com>
> ---
> arch/arm/Kconfig | 18 +++++++++
> arch/arm/boot/dts/axm55xx.dts | 16 ++++++++
> arch/arm/include/asm/axxia-rio.h | 82 ++++++++++++++++++++++++++++++++++++++
> arch/arm/include/asm/rio.h | 33 +++++++++++++++
> arch/arm/mach-axxia/Makefile | 1 +
> arch/arm/mach-axxia/clock.c | 5 +++
> arch/arm/mach-axxia/rapidio.c | 44 ++++++++++++++++++++
> 7 files changed, 199 insertions(+)
> create mode 100644 arch/arm/include/asm/axxia-rio.h
> create mode 100644 arch/arm/include/asm/rio.h
> create mode 100644 arch/arm/mach-axxia/rapidio.c
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index c796752..e7f2815 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -345,6 +345,7 @@ config ARCH_AXXIA
> select PCI
> select PCI_DOMAINS if PCI
> select ARCH_SUPPORTS_MSI if PCI
> + select HAS_RAPIDIO if (!PREEMPT_RTB)
> help
> This enables support for the LSI Axxia boards.
>
> @@ -2359,3 +2360,20 @@ source "security/Kconfig"
> source "crypto/Kconfig"
>
> source "lib/Kconfig"
> +
> +menu "RapidIO management options"
> +
> +config HAS_RAPIDIO
> + bool
> + default n
> +
> +config RAPIDIO
> + bool "RapidIO support"
> + depends on HAS_RAPIDIO || PCI
> + help
> + If you say Y here, the kernel will include drivers and
> + infrastructure code to support RapidIO interconnect devices.
> +
> +source "drivers/rapidio/Kconfig"
> +
> +endmenu
> diff --git a/arch/arm/boot/dts/axm55xx.dts b/arch/arm/boot/dts/axm55xx.dts
> index aac791d..7ecb177 100644
> --- a/arch/arm/boot/dts/axm55xx.dts
> +++ b/arch/arm/boot/dts/axm55xx.dts
> @@ -35,6 +35,7 @@
> serial0 = &axxia_serial0;
> timer = &axxia_timers;
> ethernet0 = &axxia_femac0;
> + rapidio0 = &rio0;
> };
>
> cpus {
> @@ -423,6 +424,21 @@
> reg = <0x20 0x10098000 0 0x3000>;
> interrupts = <0 45 4>;
> };
> +
> + rio0: rapidio {
> + index = <0>;
> + status = "disabled";
> + #address-cells = <2>;
> + #size-cells = <2>;
> + compatible = "axxia,rapidio-delta";
> + device_type = "rapidio";
> + reg = <0x0020 0x20142000 0x0 0x1000>; /* SRIO Conf 0 region */
> + ranges = <0x0 0x0 0x0031 0x00000000 0x0 0x40000000>;
> + linkdown-reset = <0x0200 0x100 0x0020 0x10000000 0x0 0x000010000>;
> + interrupts = <0 89 4>;
> + outb-dmes = <2 0x00000003 1 0x00000000>;
> + };
> +
> };
>
> /*
> diff --git a/arch/arm/include/asm/axxia-rio.h b/arch/arm/include/asm/axxia-rio.h
> new file mode 100644
> index 0000000..f244c85
> --- /dev/null
> +++ b/arch/arm/include/asm/axxia-rio.h
> @@ -0,0 +1,82 @@
> +/*
> + * RapidIO support for LSI Axxia parts
> + *
> + */
> +#ifndef __ASM_AXXIA_RIO_H__
> +#define __ASM_AXXIA_RIO_H__
> +
> +/* Constants, Macros, etc. */
> +
> +#define AXXIA_RIO_SMALL_SYSTEM
> +
> +#define AXXIA_RIO_SYSMEM_BARRIER()
> +
> +#define AXXIA_RIO_DISABLE_MACHINE_CHECK()
> +#define AXXIA_RIO_ENABLE_MACHINE_CHECK()
> +#define AXXIA_RIO_IF_MACHINE_CHECK(mcsr) (mcsr = 0)
> +
> +#define IN_SRIO8(a, v, ec) {v = inb((long unsigned int)a); ec = 0;}
> +#define IN_SRIO16(a, v, ec) {v = inw((long unsigned int)a); ec = 0;}
> +#define IN_SRIO32(a, v, ec) {v = inl((long unsigned int)a); ec = 0;}
> +
> +#define OUT_SRIO8(a, v) outb_p(v, (long unsigned int) a)
> +#define OUT_SRIO16(a, v) outw_p(v, (long unsigned int) a)
> +#define OUT_SRIO32(a, v) outl_p(v, (long unsigned int) a)
> +
> +#define _SWAP32(x) ((((x) & 0x000000FF) << 24) | (((x) & 0x0000FF00) << 8) | (((x) & 0x00FF0000) >> 8) | (((x) & 0xFF000000) >> 24))
> +#define CORRECT_GRIO(a) _SWAP32(a)
> +#define CORRECT_RAB(a) (a)
> +
> +/* ACP RIO board-specific stuff */
> +
> +extern int axxia_rio_apio_enable(struct rio_mport *mport, u32 mask, u32 bits);
> +extern int axxia_rio_apio_disable(struct rio_mport *mport);
> +extern int axxia_rio_rpio_enable(struct rio_mport *mport, u32 mask, u32 bits);
> +extern int axxia_rio_rpio_disable(struct rio_mport *mport);
> +
> +extern int axxia_rapidio_board_init(void);
> +
> +
> +/*****************************/
> +/* ACP RIO operational stuff */
> +/*****************************/
> +
> +/**
> + * CNTLZW - Count leading zeros word
> + * @val: value from which count number of leading zeros
> + *
> + * Return: number of zeros
> + */
> +static inline u32 CNTLZW(u32 val)
> +{
> + int n = 0;
> + if (val == 0)
> + return 32;
> + if ((val & 0xFFFF0000) == 0)
> + n += 16; val = val << 16;
> + /* 1111 1111 1111 1111 0000 0000 0000 0000
> + // 16 bits from left are zero! so we omit 16 left bits */
> + if ((val & 0xFF000000) == 0)
> + n = n + 8; val = val << 8;
> + /* 8 left bits are 0 */
> + if ((val & 0xF0000000) == 0)
> + n = n + 4; val = val << 4;
> + /* 4 left bits are 0 */
> + if ((val & 0xC0000000) == 0)
> + n = n + 2, val = val << 2;
> + /* 110000....0 2 left bits are zero */
> + if ((val & 0x80000000) == 0)
> + n = n + 1, val = val << 1;
> + /* first left bit is zero */
> + return n;
> +}
> +
> +static inline unsigned long get_tb(void)
> +{
> + unsigned int value;
> + /* Read CCNT Register (cyclecount) */
> + asm volatile ("MRC p15, 0, %0, c9, c13, 0\t\n" : "=r"(value));
> + return value;
> +}
> +
> +#endif /* __ASM_AXXIA_RIO_H__ */
> diff --git a/arch/arm/include/asm/rio.h b/arch/arm/include/asm/rio.h
> new file mode 100644
> index 0000000..10da207
> --- /dev/null
> +++ b/arch/arm/include/asm/rio.h
> @@ -0,0 +1,33 @@
> +/*
> + * RapidIO architecture support
> + *
> + * Copyright 2005 MontaVista Software, Inc.
> + * Matt Porter <mporter at kernel.crashing.org>
> + *
> + * 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.
> + */
> +
> +#ifndef ASM_ARM_RIO_H
> +#define ASM_ARM_RIO_H
> +
> +#include <asm/io.h>
> +
> +extern void platform_rio_init(void);
> +
> +#if defined(CONFIG_AXXIA_RIO)
> +
> +#define rio_in_8(src, dst) ({ insb((long unsigned int)src, dst, 8); 0; })
> +#define rio_in_be16(src, dst) ({ insw((long unsigned int)src, dst, 16); 0; })
> +#define rio_in_be32(src, dst) ({ insl((long unsigned int)src, dst, 32); 0; })
> +
> +#define out_8(dst, val) outb_p(val, (long unsigned int)(dst))
> +#define out_be16(dst, val) outw_p(val, (long unsigned int)(dst))
> +
> +#endif
> +
> +#define iosync()
> +
> +#endif
> diff --git a/arch/arm/mach-axxia/Makefile b/arch/arm/mach-axxia/Makefile
> index 0459a1f..2e9ddf7 100644
> --- a/arch/arm/mach-axxia/Makefile
> +++ b/arch/arm/mach-axxia/Makefile
> @@ -9,6 +9,7 @@ obj-y += timers.o
> obj-y += pci.o
> obj-y += ddr_retention.o
> obj-$(CONFIG_I2C) += i2c.o
> +obj-$(CONFIG_AXXIA_RIO) += rapidio.o
> obj-$(CONFIG_SMP) += platsmp.o headsmp.o
> obj-$(CONFIG_ARCH_AXXIA_GIC) += axxia-gic.o
> obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
> diff --git a/arch/arm/mach-axxia/clock.c b/arch/arm/mach-axxia/clock.c
> index 49ca80b..4232277 100644
> --- a/arch/arm/mach-axxia/clock.c
> +++ b/arch/arm/mach-axxia/clock.c
> @@ -64,6 +64,11 @@ axxia_init_clocks(void)
> clk_register_clkdev(clk, NULL, "2010082000.uart");
> /* PL011 UART3 */
> clk_register_clkdev(clk, NULL, "2010083000.uart");
> + /* I2C */
> + clk_register_clkdev(clk, NULL, "2010084000.i2c");
> + clk_register_clkdev(clk, NULL, "2010085000.i2c");
> + clk_register_clkdev(clk, NULL, "2010086000.i2c");
> + clk_register_clkdev(clk, NULL, "2010087000.i2c");
> /* PL022 SSP */
> clk_register_clkdev(clk, NULL, "ssp");
>
> diff --git a/arch/arm/mach-axxia/rapidio.c b/arch/arm/mach-axxia/rapidio.c
> new file mode 100644
> index 0000000..a9da46b
> --- /dev/null
> +++ b/arch/arm/mach-axxia/rapidio.c
> @@ -0,0 +1,44 @@
> +/*
> + * linux/arch/arm/mach-axxia/rapidio.c
> + *
> + * Helper module for board specific RAPIDIO bus registration
> + *
> + * Copyright (C) 2013 LSI Corporation.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * 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 St, Fifth Floor, Boston, MA
> + * 02110-1301 USA
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/platform_device.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +#include <linux/slab.h>
> +#include <linux/err.h>
> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +
> +
> +/**
> + * axxia_rapidio_board_init -
> + * Perform board-specific initialization to support use of RapidIO busses
> + *
> + * Returns 0 on success or an error code.
> + */
> +int
> +axxia_rapidio_board_init(void)
> +{
> + return 0;
> +}
>
More information about the linux-yocto
mailing list