Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755435Ab1CHPHY (ORCPT ); Tue, 8 Mar 2011 10:07:24 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:48378 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755367Ab1CHPHS (ORCPT ); Tue, 8 Mar 2011 10:07:18 -0500 From: Jamie Iles To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Jamie Iles Subject: [PATCHv6 3/5] picoxcell: common SoC peripheral support Date: Tue, 8 Mar 2011 15:06:55 +0000 Message-Id: <1299596817-19879-4-git-send-email-jamie@jamieiles.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1299596817-19879-1-git-send-email-jamie@jamieiles.com> References: <1299596817-19879-1-git-send-email-jamie@jamieiles.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4414 Lines: 163 Add the devices common to all picoXcell variants (UART and PMU). Other peripherals such as DMA, SPI, fuses and EMAC will be added later with driver support. v3: - move device registration to an arch_initcall - mark common_devices with __initdata v2: - split the UARTs into two separate platform devices and use PLAT8250_* as the IDs Signed-off-by: Jamie Iles --- arch/arm/mach-picoxcell/Makefile | 3 +- arch/arm/mach-picoxcell/devices.c | 122 +++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-picoxcell/devices.c diff --git a/arch/arm/mach-picoxcell/Makefile b/arch/arm/mach-picoxcell/Makefile index 493ec0e..3cace37 100644 --- a/arch/arm/mach-picoxcell/Makefile +++ b/arch/arm/mach-picoxcell/Makefile @@ -1,2 +1,3 @@ obj-y := picoxcell_core.o io.o axi2cfg.o \ - time.o + time.o \ + devices.o diff --git a/arch/arm/mach-picoxcell/devices.c b/arch/arm/mach-picoxcell/devices.c new file mode 100644 index 0000000..884ecb5 --- /dev/null +++ b/arch/arm/mach-picoxcell/devices.c @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2010 Picochip Ltd., Jamie Iles + * + * 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. + * + * All enquiries to support@picochip.com + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "picoxcell_core.h" +#include "soc.h" + +#define UART_USR_REG_OFFSET 0x7C +static struct plat_serial8250_port serial1_platform_data[] = { + { + .membase = IO_ADDRESS(PICOXCELL_UART1_BASE), + .mapbase = PICOXCELL_UART1_BASE, + .irq = IRQ_UART1, + .flags = UPF_BOOT_AUTOCONF, + .iotype = UPIO_DWAPB32, + .regshift = 2, + .uartclk = PICOXCELL_BASE_BAUD, + .private_data = (void *)(PHYS_TO_IO(PICOXCELL_UART1_BASE + + UART_USR_REG_OFFSET)), + }, + {}, +}; + +static struct resource serial1_resources[] = { + { + .start = PICOXCELL_UART1_BASE, + .end = PICOXCELL_UART1_BASE + 0xFFFF, + .flags = IORESOURCE_MEM, + }, + { + .start = IRQ_UART1, + .end = IRQ_UART2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device serial1_device = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM1, + .dev.platform_data = serial1_platform_data, + .resource = serial1_resources, + .num_resources = ARRAY_SIZE(serial1_resources), +}; + +static struct plat_serial8250_port serial2_platform_data[] = { + { + .membase = IO_ADDRESS(PICOXCELL_UART2_BASE), + .mapbase = PICOXCELL_UART2_BASE, + .irq = IRQ_UART2, + .flags = UPF_BOOT_AUTOCONF, + .iotype = UPIO_DWAPB32, + .regshift = 2, + .uartclk = PICOXCELL_BASE_BAUD, + .private_data = (void *)(PHYS_TO_IO(PICOXCELL_UART2_BASE + + UART_USR_REG_OFFSET)), + }, + {}, +}; + +static struct resource serial2_resources[] = { + { + .start = PICOXCELL_UART2_BASE, + .end = PICOXCELL_UART2_BASE + 0xFFFF, + .flags = IORESOURCE_MEM, + }, + { + .start = IRQ_UART2, + .end = IRQ_UART2, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device serial2_device = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM2, + .dev.platform_data = serial2_platform_data, + .resource = serial2_resources, + .num_resources = ARRAY_SIZE(serial2_resources), +}; + +static struct resource pmu_resource = { + .start = IRQ_NPMUIRQ, + .end = IRQ_NPMUIRQ, + .flags = IORESOURCE_IRQ, +}; + +static struct platform_device pmu_device = { + .name = "arm-pmu", + .id = ARM_PMU_DEVICE_CPU, + .num_resources = 1, + .resource = &pmu_resource, +}; + +static struct platform_device *common_devices[] __initdata = { + &serial1_device, + &serial2_device, + &pmu_device, +}; + +static int __init picoxcell_add_devices(void) +{ + platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); + + return 0; +} +arch_initcall(picoxcell_add_devices); -- 1.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/