Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * linux/arch/arm/mach-pxa/capc7117.c
0004  *
0005  * Support for the Embedian CAPC-7117 Evaluation Kit
0006  * based on the Embedian MXM-8x10 Computer on Module
0007  *
0008  * Copyright (C) 2009 Embedian Inc.
0009  * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd.
0010  *
0011  * 2007-09-04: eric miao <eric.y.miao@gmail.com>
0012  *             rewrite to align with latest kernel
0013  *
0014  * 2010-01-09: Edwin Peer <epeer@tmtservices.co.za>
0015  *             Hennie van der Merwe <hvdmerwe@tmtservices.co.za>
0016  *             rework for upstream merge
0017  */
0018 
0019 #include <linux/irq.h>
0020 #include <linux/platform_device.h>
0021 #include <linux/ata_platform.h>
0022 #include <linux/serial_8250.h>
0023 #include <linux/gpio.h>
0024 #include <linux/regulator/machine.h>
0025 
0026 #include <asm/mach-types.h>
0027 #include <asm/mach/arch.h>
0028 
0029 #include "pxa320.h"
0030 #include "mxm8x10.h"
0031 
0032 #include "generic.h"
0033 
0034 /* IDE (PATA) Support */
0035 static struct pata_platform_info pata_platform_data = {
0036     .ioport_shift = 1
0037 };
0038 
0039 static struct resource capc7117_ide_resources[] = {
0040     [0] = {
0041            .start = 0x11000020,
0042            .end = 0x1100003f,
0043            .flags = IORESOURCE_MEM
0044     },
0045     [1] = {
0046            .start = 0x1100001c,
0047            .end = 0x1100001c,
0048            .flags = IORESOURCE_MEM
0049     },
0050     [2] = {
0051            .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
0052            .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
0053            .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING
0054     }
0055 };
0056 
0057 static struct platform_device capc7117_ide_device = {
0058     .name = "pata_platform",
0059     .num_resources = ARRAY_SIZE(capc7117_ide_resources),
0060     .resource = capc7117_ide_resources,
0061     .dev = {
0062         .platform_data = &pata_platform_data,
0063         .coherent_dma_mask = ~0     /* grumble */
0064     }
0065 };
0066 
0067 static void __init capc7117_ide_init(void)
0068 {
0069     platform_device_register(&capc7117_ide_device);
0070 }
0071 
0072 /* TI16C752 UART support */
0073 #define TI16C752_FLAGS      (UPF_BOOT_AUTOCONF | \
0074                     UPF_IOREMAP | \
0075                     UPF_BUGGY_UART | \
0076                     UPF_SKIP_TEST)
0077 #define TI16C752_UARTCLK    (22118400)
0078 static struct plat_serial8250_port ti16c752_platform_data[] = {
0079     [0] = {
0080            .mapbase = 0x14000000,
0081            .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO78)),
0082            .irqflags = IRQF_TRIGGER_RISING,
0083            .flags = TI16C752_FLAGS,
0084            .iotype = UPIO_MEM,
0085            .regshift = 1,
0086            .uartclk = TI16C752_UARTCLK
0087     },
0088     [1] = {
0089            .mapbase = 0x14000040,
0090            .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO79)),
0091            .irqflags = IRQF_TRIGGER_RISING,
0092            .flags = TI16C752_FLAGS,
0093            .iotype = UPIO_MEM,
0094            .regshift = 1,
0095            .uartclk = TI16C752_UARTCLK
0096     },
0097     [2] = {
0098            .mapbase = 0x14000080,
0099            .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO80)),
0100            .irqflags = IRQF_TRIGGER_RISING,
0101            .flags = TI16C752_FLAGS,
0102            .iotype = UPIO_MEM,
0103            .regshift = 1,
0104            .uartclk = TI16C752_UARTCLK
0105     },
0106     [3] = {
0107            .mapbase = 0x140000c0,
0108            .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO81)),
0109            .irqflags = IRQF_TRIGGER_RISING,
0110            .flags = TI16C752_FLAGS,
0111            .iotype = UPIO_MEM,
0112            .regshift = 1,
0113            .uartclk = TI16C752_UARTCLK
0114     },
0115     [4] = {
0116            /* end of array */
0117     }
0118 };
0119 
0120 static struct platform_device ti16c752_device = {
0121     .name = "serial8250",
0122     .id = PLAT8250_DEV_PLATFORM,
0123     .dev = {
0124         .platform_data = ti16c752_platform_data
0125     }
0126 };
0127 
0128 static void __init capc7117_uarts_init(void)
0129 {
0130     platform_device_register(&ti16c752_device);
0131 }
0132 
0133 static void __init capc7117_init(void)
0134 {
0135     /* Init CoM */
0136     mxm_8x10_barebones_init();
0137 
0138     /* Init evaluation board peripherals */
0139     mxm_8x10_ac97_init();
0140     mxm_8x10_usb_host_init();
0141     mxm_8x10_mmc_init();
0142 
0143     capc7117_uarts_init();
0144     capc7117_ide_init();
0145 
0146     regulator_has_full_constraints();
0147 }
0148 
0149 MACHINE_START(CAPC7117,
0150           "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM")
0151     .atag_offset = 0x100,
0152     .map_io = pxa3xx_map_io,
0153     .nr_irqs = PXA_NR_IRQS,
0154     .init_irq = pxa3xx_init_irq,
0155     .handle_irq = pxa3xx_handle_irq,
0156     .init_time  = pxa_timer_init,
0157     .init_machine = capc7117_init,
0158     .restart    = pxa_restart,
0159 MACHINE_END