Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/arch/arm/mach-footbridge/isa.c
0004  *
0005  *  Copyright (C) 2004 Russell King.
0006  */
0007 #include <linux/init.h>
0008 #include <linux/serial_8250.h>
0009 
0010 #include <asm/irq.h>
0011 #include <asm/hardware/dec21285.h>
0012 
0013 #include "common.h"
0014 
0015 static struct resource rtc_resources[] = {
0016     [0] = {
0017         .start  = 0x70,
0018         .end    = 0x73,
0019         .flags  = IORESOURCE_IO,
0020     },
0021     [1] = {
0022         .start  = IRQ_ISA_RTC_ALARM,
0023         .end    = IRQ_ISA_RTC_ALARM,
0024         .flags  = IORESOURCE_IRQ,
0025     }
0026 };
0027 
0028 static struct platform_device rtc_device = {
0029     .name       = "rtc_cmos",
0030     .id     = -1,
0031     .resource   = rtc_resources,
0032     .num_resources  = ARRAY_SIZE(rtc_resources),
0033 };
0034 
0035 static struct resource serial_resources[] = {
0036     [0] = {
0037         .start  = 0x3f8,
0038         .end    = 0x3ff,
0039         .flags  = IORESOURCE_IO,
0040     },
0041     [1] = {
0042         .start  = 0x2f8,
0043         .end    = 0x2ff,
0044         .flags  = IORESOURCE_IO,
0045     },
0046 };
0047 
0048 static struct plat_serial8250_port serial_platform_data[] = {
0049     {
0050         .iobase     = 0x3f8,
0051         .irq        = IRQ_ISA_UART,
0052         .uartclk    = 1843200,
0053         .regshift   = 0,
0054         .iotype     = UPIO_PORT,
0055         .flags      = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
0056     },
0057     {
0058         .iobase     = 0x2f8,
0059         .irq        = IRQ_ISA_UART2,
0060         .uartclk    = 1843200,
0061         .regshift   = 0,
0062         .iotype     = UPIO_PORT,
0063         .flags      = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
0064     },
0065     { },
0066 };
0067 
0068 static struct platform_device serial_device = {
0069     .name           = "serial8250",
0070     .id         = PLAT8250_DEV_PLATFORM,
0071     .dev            = {
0072         .platform_data  = serial_platform_data,
0073     },
0074     .resource       = serial_resources,
0075     .num_resources      = ARRAY_SIZE(serial_resources),
0076 };
0077 
0078 static int __init footbridge_isa_init(void)
0079 {
0080     int err = 0;
0081 
0082     if (!footbridge_cfn_mode())
0083         return 0;
0084 
0085     /* Personal server doesn't have RTC */
0086     if (!machine_is_personal_server()) {
0087         isa_rtc_init();
0088         err = platform_device_register(&rtc_device);
0089         if (err)
0090             printk(KERN_ERR "Unable to register RTC device: %d\n", err);
0091     }
0092     err = platform_device_register(&serial_device);
0093     if (err)
0094         printk(KERN_ERR "Unable to register serial device: %d\n", err);
0095     return 0;
0096 }
0097 
0098 arch_initcall(footbridge_isa_init);