18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci// 38c2ecf20Sopenharmony_ci// Copyright 2007 Simtec Electronics 48c2ecf20Sopenharmony_ci// http://www.simtec.co.uk/products/EB2410ITX/ 58c2ecf20Sopenharmony_ci// http://armlinux.simtec.co.uk/ 68c2ecf20Sopenharmony_ci// Ben Dooks <ben@simtec.co.uk> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/kernel.h> 98c2ecf20Sopenharmony_ci#include <linux/types.h> 108c2ecf20Sopenharmony_ci#include <linux/init.h> 118c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 148c2ecf20Sopenharmony_ci#include <linux/ata_platform.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 198c2ecf20Sopenharmony_ci#include <asm/mach/map.h> 208c2ecf20Sopenharmony_ci#include <asm/mach/irq.h> 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#include "map.h" 238c2ecf20Sopenharmony_ci#include <mach/irqs.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#include "bast.h" 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* IDE ports */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistatic struct pata_platform_info bast_ide_platdata = { 308c2ecf20Sopenharmony_ci .ioport_shift = 5, 318c2ecf20Sopenharmony_ci}; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistatic struct resource bast_ide0_resource[] = { 348c2ecf20Sopenharmony_ci [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRI, 8 * 0x20), 358c2ecf20Sopenharmony_ci [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20), 0x20), 368c2ecf20Sopenharmony_ci [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE0), 378c2ecf20Sopenharmony_ci}; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_cistatic struct platform_device bast_device_ide0 = { 408c2ecf20Sopenharmony_ci .name = "pata_platform", 418c2ecf20Sopenharmony_ci .id = 0, 428c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(bast_ide0_resource), 438c2ecf20Sopenharmony_ci .resource = bast_ide0_resource, 448c2ecf20Sopenharmony_ci .dev = { 458c2ecf20Sopenharmony_ci .platform_data = &bast_ide_platdata, 468c2ecf20Sopenharmony_ci .coherent_dma_mask = ~0, 478c2ecf20Sopenharmony_ci } 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci}; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cistatic struct resource bast_ide1_resource[] = { 528c2ecf20Sopenharmony_ci [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESEC, 8 * 0x20), 538c2ecf20Sopenharmony_ci [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), 0x20), 548c2ecf20Sopenharmony_ci [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE1), 558c2ecf20Sopenharmony_ci}; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_cistatic struct platform_device bast_device_ide1 = { 588c2ecf20Sopenharmony_ci .name = "pata_platform", 598c2ecf20Sopenharmony_ci .id = 1, 608c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(bast_ide1_resource), 618c2ecf20Sopenharmony_ci .resource = bast_ide1_resource, 628c2ecf20Sopenharmony_ci .dev = { 638c2ecf20Sopenharmony_ci .platform_data = &bast_ide_platdata, 648c2ecf20Sopenharmony_ci .coherent_dma_mask = ~0, 658c2ecf20Sopenharmony_ci } 668c2ecf20Sopenharmony_ci}; 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_cistatic struct platform_device *bast_ide_devices[] __initdata = { 698c2ecf20Sopenharmony_ci &bast_device_ide0, 708c2ecf20Sopenharmony_ci &bast_device_ide1, 718c2ecf20Sopenharmony_ci}; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cistatic __init int bast_ide_init(void) 748c2ecf20Sopenharmony_ci{ 758c2ecf20Sopenharmony_ci if (machine_is_bast() || machine_is_vr1000()) 768c2ecf20Sopenharmony_ci return platform_add_devices(bast_ide_devices, 778c2ecf20Sopenharmony_ci ARRAY_SIZE(bast_ide_devices)); 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci return 0; 808c2ecf20Sopenharmony_ci} 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_cifs_initcall(bast_ide_init); 83