^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * linux/arch/arm/mach-pxa/capc7117.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Support for the Embedian CAPC-7117 Evaluation Kit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * based on the Embedian MXM-8x10 Computer on Module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Copyright (C) 2009 Embedian Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * 2007-09-04: eric miao <eric.y.miao@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * rewrite to align with latest kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * 2010-01-09: Edwin Peer <epeer@tmtservices.co.za>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * Hennie van der Merwe <hvdmerwe@tmtservices.co.za>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * rework for upstream merge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/ata_platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/serial_8250.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/regulator/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include "pxa320.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include "mxm8x10.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* IDE (PATA) Support */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) static struct pata_platform_info pata_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) .ioport_shift = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static struct resource capc7117_ide_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .start = 0x11000020,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) .end = 0x1100003f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) .flags = IORESOURCE_MEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) .start = 0x1100001c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) .end = 0x1100001c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) .flags = IORESOURCE_MEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) [2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static struct platform_device capc7117_ide_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .name = "pata_platform",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .num_resources = ARRAY_SIZE(capc7117_ide_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) .resource = capc7117_ide_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) .platform_data = &pata_platform_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) .coherent_dma_mask = ~0 /* grumble */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static void __init capc7117_ide_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) platform_device_register(&capc7117_ide_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /* TI16C752 UART support */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define TI16C752_FLAGS (UPF_BOOT_AUTOCONF | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) UPF_IOREMAP | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) UPF_BUGGY_UART | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) UPF_SKIP_TEST)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define TI16C752_UARTCLK (22118400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) static struct plat_serial8250_port ti16c752_platform_data[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) .mapbase = 0x14000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO78)),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) .irqflags = IRQF_TRIGGER_RISING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) .flags = TI16C752_FLAGS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) .iotype = UPIO_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) .regshift = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) .uartclk = TI16C752_UARTCLK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) .mapbase = 0x14000040,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO79)),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) .irqflags = IRQF_TRIGGER_RISING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) .flags = TI16C752_FLAGS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) .iotype = UPIO_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) .regshift = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) .uartclk = TI16C752_UARTCLK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) [2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) .mapbase = 0x14000080,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO80)),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) .irqflags = IRQF_TRIGGER_RISING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) .flags = TI16C752_FLAGS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) .iotype = UPIO_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) .regshift = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) .uartclk = TI16C752_UARTCLK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) [3] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) .mapbase = 0x140000c0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO81)),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) .irqflags = IRQF_TRIGGER_RISING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) .flags = TI16C752_FLAGS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) .iotype = UPIO_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) .regshift = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) .uartclk = TI16C752_UARTCLK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) [4] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /* end of array */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) static struct platform_device ti16c752_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) .name = "serial8250",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) .id = PLAT8250_DEV_PLATFORM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) .platform_data = ti16c752_platform_data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) static void __init capc7117_uarts_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) platform_device_register(&ti16c752_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) static void __init capc7117_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /* Init CoM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) mxm_8x10_barebones_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /* Init evaluation board peripherals */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) mxm_8x10_ac97_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) mxm_8x10_usb_host_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) mxm_8x10_mmc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) capc7117_uarts_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) capc7117_ide_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) regulator_has_full_constraints();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) MACHINE_START(CAPC7117,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) .atag_offset = 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) .map_io = pxa3xx_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) .nr_irqs = PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) .init_irq = pxa3xx_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) .handle_irq = pxa3xx_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) .init_time = pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) .init_machine = capc7117_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) .restart = pxa_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) MACHINE_END