From 01903a883f21b27f853f465649df2bc74864ab47 Mon Sep 17 00:00:00 2001 From: Graeme Gregory Date: Mon, 2 Apr 2007 12:00:33 +0100 Subject: [PATCH] --- yaml --- r: 54038 b: refs/heads/master c: ef08574729bcf65bbd1f0c9ad9b9baa9bbd7a830 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/arm/kernel/ecard.c | 31 +- trunk/arch/arm/kernel/ecard.h | 56 -- trunk/arch/arm/mach-rpc/riscpc.c | 35 - trunk/drivers/ata/Kconfig | 10 +- trunk/drivers/ata/Makefile | 1 - trunk/drivers/ata/pata_icside.c | 686 ------------------ .../include/asm-arm/arch-s3c2410/regs-ac97.h | 56 +- trunk/include/asm-arm/ecard.h | 52 +- 9 files changed, 117 insertions(+), 812 deletions(-) delete mode 100644 trunk/arch/arm/kernel/ecard.h delete mode 100644 trunk/drivers/ata/pata_icside.c diff --git a/[refs] b/[refs] index 1133b9d09b2f..4f667f827f37 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5559bca8e66f968192a5416d953c88cc3389cb22 +refs/heads/master: ef08574729bcf65bbd1f0c9ad9b9baa9bbd7a830 diff --git a/trunk/arch/arm/kernel/ecard.c b/trunk/arch/arm/kernel/ecard.c index bdbd7da99286..f1c0fb974177 100644 --- a/trunk/arch/arm/kernel/ecard.c +++ b/trunk/arch/arm/kernel/ecard.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -51,8 +50,6 @@ #include #include -#include "ecard.h" - #ifndef CONFIG_ARCH_RPC #define HAVE_EXPMASK #endif @@ -126,7 +123,7 @@ static void ecard_task_reset(struct ecard_request *req) res = ec->slot_no == 8 ? &ec->resource[ECARD_RES_MEMC] - : ec->easi + : ec->type == ECARD_EASI ? &ec->resource[ECARD_RES_EASI] : &ec->resource[ECARD_RES_IOCSYNC]; @@ -181,7 +178,7 @@ static void ecard_task_readbytes(struct ecard_request *req) index += 1; } } else { - unsigned long base = (ec->easi + unsigned long base = (ec->type == ECARD_EASI ? &ec->resource[ECARD_RES_EASI] : &ec->resource[ECARD_RES_IOCSYNC])->start; void __iomem *pbase = (void __iomem *)base; @@ -266,6 +263,8 @@ static int ecard_init_mm(void) static int ecard_task(void * unused) { + daemonize("kecardd"); + /* * Allocate a mm. We're not a lazy-TLB kernel task since we need * to set page table entries where the user space would be. Note @@ -728,7 +727,7 @@ static int ecard_prints(char *buffer, ecard_t *ec) char *start = buffer; buffer += sprintf(buffer, " %d: %s ", ec->slot_no, - ec->easi ? "EASI" : " "); + ec->type == ECARD_EASI ? "EASI" : " "); if (ec->cid.id == 0) { struct in_chunk_dir incd; @@ -815,7 +814,7 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot) } ec->slot_no = slot; - ec->easi = type == ECARD_EASI; + ec->type = type; ec->irq = NO_IRQ; ec->fiq = NO_IRQ; ec->dma = NO_DMA; @@ -826,7 +825,6 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot) ec->dev.bus = &ecard_bus_type; ec->dev.dma_mask = &ec->dma_mask; ec->dma_mask = (u64)0xffffffff; - ec->dev.coherent_dma_mask = ec->dma_mask; if (slot < 4) { ec_set_resource(ec, ECARD_RES_MEMC, @@ -909,7 +907,7 @@ static ssize_t ecard_show_device(struct device *dev, struct device_attribute *at static ssize_t ecard_show_type(struct device *dev, struct device_attribute *attr, char *buf) { struct expansion_card *ec = ECARD_DEV(dev); - return sprintf(buf, "%s\n", ec->easi ? "EASI" : "IOC"); + return sprintf(buf, "%s\n", ec->type == ECARD_EASI ? "EASI" : "IOC"); } static struct device_attribute ecard_dev_attrs[] = { @@ -1060,14 +1058,13 @@ ecard_probe(int slot, card_type_t type) */ static int __init ecard_init(void) { - struct task_struct *task; - int slot, irqhw; - - task = kthread_run(ecard_task, NULL, "kecardd"); - if (IS_ERR(task)) { - printk(KERN_ERR "Ecard: unable to create kernel thread: %ld\n", - PTR_ERR(task)); - return PTR_ERR(task); + int slot, irqhw, ret; + + ret = kernel_thread(ecard_task, NULL, CLONE_KERNEL); + if (ret < 0) { + printk(KERN_ERR "Ecard: unable to create kernel thread: %d\n", + ret); + return ret; } printk("Probing expansion cards\n"); diff --git a/trunk/arch/arm/kernel/ecard.h b/trunk/arch/arm/kernel/ecard.h deleted file mode 100644 index d7c2dacf935d..000000000000 --- a/trunk/arch/arm/kernel/ecard.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * ecard.h - * - * Copyright 2007 Russell King - * - * 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. - */ - -/* Definitions internal to ecard.c - for it's use only!! - * - * External expansion card header as read from the card - */ -struct ex_ecid { - unsigned char r_irq:1; - unsigned char r_zero:1; - unsigned char r_fiq:1; - unsigned char r_id:4; - unsigned char r_a:1; - - unsigned char r_cd:1; - unsigned char r_is:1; - unsigned char r_w:2; - unsigned char r_r1:4; - - unsigned char r_r2:8; - - unsigned char r_prod[2]; - - unsigned char r_manu[2]; - - unsigned char r_country; - - unsigned char r_fiqmask; - unsigned char r_fiqoff[3]; - - unsigned char r_irqmask; - unsigned char r_irqoff[3]; -}; - -/* - * Chunk directory entry as read from the card - */ -struct ex_chunk_dir { - unsigned char r_id; - unsigned char r_len[3]; - unsigned long r_start; - union { - char string[256]; - char data[1]; - } d; -#define c_id(x) ((x)->r_id) -#define c_len(x) ((x)->r_len[0]|((x)->r_len[1]<<8)|((x)->r_len[2]<<16)) -#define c_start(x) ((x)->r_start) -}; diff --git a/trunk/arch/arm/mach-rpc/riscpc.c b/trunk/arch/arm/mach-rpc/riscpc.c index 570cf937e73b..208a2b5dba1b 100644 --- a/trunk/arch/arm/mach-rpc/riscpc.c +++ b/trunk/arch/arm/mach-rpc/riscpc.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -160,45 +159,11 @@ static struct platform_device serial_device = { }, }; -static struct pata_platform_info pata_platform_data = { - .ioport_shift = 2, -}; - -static struct resource pata_resources[] = { - [0] = { - .start = 0x030107c0, - .end = 0x030107df, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = 0x03010fd8, - .end = 0x03010fdb, - .flags = IORESOURCE_MEM, - }, - [2] = { - .start = IRQ_HARDDISK, - .end = IRQ_HARDDISK, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device pata_device = { - .name = "pata_platform", - .id = -1, - .num_resources = ARRAY_SIZE(pata_resources), - .resource = pata_resources, - .dev = { - .platform_data = &pata_platform_data, - .coherent_dma_mask = ~0, /* grumble */ - }, -}; - static struct platform_device *devs[] __initdata = { &iomd_device, &kbd_device, &serial_device, &acornfb_device, - &pata_device, }; static int __init rpc_init(void) diff --git a/trunk/drivers/ata/Kconfig b/trunk/drivers/ata/Kconfig index 77846dd0a4fa..7bdbe5a914d0 100644 --- a/trunk/drivers/ata/Kconfig +++ b/trunk/drivers/ata/Kconfig @@ -545,21 +545,13 @@ config PATA_WINBOND_VLB config PATA_PLATFORM tristate "Generic platform device PATA support" - depends on EMBEDDED || ARCH_RPC + depends on EMBEDDED help This option enables support for generic directly connected ATA devices commonly found on embedded systems. If unsure, say N. -config PATA_ICSIDE - tristate "Acorn ICS PATA support" - depends on ARM && ARCH_ACORN - help - On Acorn systems, say Y here if you wish to use the ICS PATA - interface card. This is not required for ICS partition support. - If you are unsure, say N to this. - config PATA_IXP4XX_CF tristate "IXP4XX Compact Flash support" depends on ARCH_IXP4XX diff --git a/trunk/drivers/ata/Makefile b/trunk/drivers/ata/Makefile index cc8798b1a54f..13d7397e0008 100644 --- a/trunk/drivers/ata/Makefile +++ b/trunk/drivers/ata/Makefile @@ -61,7 +61,6 @@ obj-$(CONFIG_PATA_TRIFLEX) += pata_triflex.o obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o obj-$(CONFIG_PATA_SCC) += pata_scc.o obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o -obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o # Should be last but one libata driver obj-$(CONFIG_ATA_GENERIC) += ata_generic.o # Should be last libata driver diff --git a/trunk/drivers/ata/pata_icside.c b/trunk/drivers/ata/pata_icside.c deleted file mode 100644 index dbc8ee2adcf0..000000000000 --- a/trunk/drivers/ata/pata_icside.c +++ /dev/null @@ -1,686 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define DRV_NAME "pata_icside" - -#define ICS_IDENT_OFFSET 0x2280 - -#define ICS_ARCIN_V5_INTRSTAT 0x0000 -#define ICS_ARCIN_V5_INTROFFSET 0x0004 - -#define ICS_ARCIN_V6_INTROFFSET_1 0x2200 -#define ICS_ARCIN_V6_INTRSTAT_1 0x2290 -#define ICS_ARCIN_V6_INTROFFSET_2 0x3200 -#define ICS_ARCIN_V6_INTRSTAT_2 0x3290 - -struct portinfo { - unsigned int dataoffset; - unsigned int ctrloffset; - unsigned int stepping; -}; - -static const struct portinfo pata_icside_portinfo_v5 = { - .dataoffset = 0x2800, - .ctrloffset = 0x2b80, - .stepping = 6, -}; - -static const struct portinfo pata_icside_portinfo_v6_1 = { - .dataoffset = 0x2000, - .ctrloffset = 0x2380, - .stepping = 6, -}; - -static const struct portinfo pata_icside_portinfo_v6_2 = { - .dataoffset = 0x3000, - .ctrloffset = 0x3380, - .stepping = 6, -}; - -#define PATA_ICSIDE_MAX_SG 128 - -struct pata_icside_state { - void __iomem *irq_port; - void __iomem *ioc_base; - unsigned int type; - unsigned int dma; - struct { - u8 port_sel; - u8 disabled; - unsigned int speed[ATA_MAX_DEVICES]; - } port[2]; - struct scatterlist sg[PATA_ICSIDE_MAX_SG]; -}; - -#define ICS_TYPE_A3IN 0 -#define ICS_TYPE_A3USER 1 -#define ICS_TYPE_V6 3 -#define ICS_TYPE_V5 15 -#define ICS_TYPE_NOTYPE ((unsigned int)-1) - -/* ---------------- Version 5 PCB Support Functions --------------------- */ -/* Prototype: pata_icside_irqenable_arcin_v5 (struct expansion_card *ec, int irqnr) - * Purpose : enable interrupts from card - */ -static void pata_icside_irqenable_arcin_v5 (struct expansion_card *ec, int irqnr) -{ - struct pata_icside_state *state = ec->irq_data; - - writeb(0, state->irq_port + ICS_ARCIN_V5_INTROFFSET); -} - -/* Prototype: pata_icside_irqdisable_arcin_v5 (struct expansion_card *ec, int irqnr) - * Purpose : disable interrupts from card - */ -static void pata_icside_irqdisable_arcin_v5 (struct expansion_card *ec, int irqnr) -{ - struct pata_icside_state *state = ec->irq_data; - - readb(state->irq_port + ICS_ARCIN_V5_INTROFFSET); -} - -static const expansioncard_ops_t pata_icside_ops_arcin_v5 = { - .irqenable = pata_icside_irqenable_arcin_v5, - .irqdisable = pata_icside_irqdisable_arcin_v5, -}; - - -/* ---------------- Version 6 PCB Support Functions --------------------- */ -/* Prototype: pata_icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr) - * Purpose : enable interrupts from card - */ -static void pata_icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr) -{ - struct pata_icside_state *state = ec->irq_data; - void __iomem *base = state->irq_port; - - if (!state->port[0].disabled) - writeb(0, base + ICS_ARCIN_V6_INTROFFSET_1); - if (!state->port[1].disabled) - writeb(0, base + ICS_ARCIN_V6_INTROFFSET_2); -} - -/* Prototype: pata_icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr) - * Purpose : disable interrupts from card - */ -static void pata_icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr) -{ - struct pata_icside_state *state = ec->irq_data; - - readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1); - readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2); -} - -/* Prototype: pata_icside_irqprobe(struct expansion_card *ec) - * Purpose : detect an active interrupt from card - */ -static int pata_icside_irqpending_arcin_v6(struct expansion_card *ec) -{ - struct pata_icside_state *state = ec->irq_data; - - return readb(state->irq_port + ICS_ARCIN_V6_INTRSTAT_1) & 1 || - readb(state->irq_port + ICS_ARCIN_V6_INTRSTAT_2) & 1; -} - -static const expansioncard_ops_t pata_icside_ops_arcin_v6 = { - .irqenable = pata_icside_irqenable_arcin_v6, - .irqdisable = pata_icside_irqdisable_arcin_v6, - .irqpending = pata_icside_irqpending_arcin_v6, -}; - - -/* - * SG-DMA support. - * - * Similar to the BM-DMA, but we use the RiscPCs IOMD DMA controllers. - * There is only one DMA controller per card, which means that only - * one drive can be accessed at one time. NOTE! We do not enforce that - * here, but we rely on the main IDE driver spotting that both - * interfaces use the same IRQ, which should guarantee this. - */ - -/* - * Configure the IOMD to give the appropriate timings for the transfer - * mode being requested. We take the advice of the ATA standards, and - * calculate the cycle time based on the transfer mode, and the EIDE - * MW DMA specs that the drive provides in the IDENTIFY command. - * - * We have the following IOMD DMA modes to choose from: - * - * Type Active Recovery Cycle - * A 250 (250) 312 (550) 562 (800) - * B 187 (200) 250 (550) 437 (750) - * C 125 (125) 125 (375) 250 (500) - * D 62 (50) 125 (375) 187 (425) - * - * (figures in brackets are actual measured timings on DIOR/DIOW) - * - * However, we also need to take care of the read/write active and - * recovery timings: - * - * Read Write - * Mode Active -- Recovery -- Cycle IOMD type - * MW0 215 50 215 480 A - * MW1 80 50 50 150 C - * MW2 70 25 25 120 C - */ -static void pata_icside_set_dmamode(struct ata_port *ap, struct ata_device *adev) -{ - struct pata_icside_state *state = ap->host->private_data; - struct ata_timing t; - unsigned int cycle; - char iomd_type; - - /* - * DMA is based on a 16MHz clock - */ - if (ata_timing_compute(adev, adev->dma_mode, &t, 1000, 1)) - return; - - /* - * Choose the IOMD cycle timing which ensure that the interface - * satisfies the measured active, recovery and cycle times. - */ - if (t.active <= 50 && t.recover <= 375 && t.cycle <= 425) - iomd_type = 'D', cycle = 187; - else if (t.active <= 125 && t.recover <= 375 && t.cycle <= 500) - iomd_type = 'C', cycle = 250; - else if (t.active <= 200 && t.recover <= 550 && t.cycle <= 750) - iomd_type = 'B', cycle = 437; - else - iomd_type = 'A', cycle = 562; - - ata_dev_printk(adev, KERN_INFO, "timings: act %dns rec %dns cyc %dns (%c)\n", - t.active, t.recover, t.cycle, iomd_type); - - state->port[ap->port_no].speed[adev->devno] = cycle; -} - -static void pata_icside_bmdma_setup(struct ata_queued_cmd *qc) -{ - struct ata_port *ap = qc->ap; - struct pata_icside_state *state = ap->host->private_data; - struct scatterlist *sg, *rsg = state->sg; - unsigned int write = qc->tf.flags & ATA_TFLAG_WRITE; - - /* - * We are simplex; BUG if we try to fiddle with DMA - * while it's active. - */ - BUG_ON(dma_channel_active(state->dma)); - - /* - * Copy ATAs scattered sg list into a contiguous array of sg - */ - ata_for_each_sg(sg, qc) { - memcpy(rsg, sg, sizeof(*sg)); - rsg++; - } - - /* - * Route the DMA signals to the correct interface - */ - writeb(state->port[ap->port_no].port_sel, state->ioc_base); - - set_dma_speed(state->dma, state->port[ap->port_no].speed[qc->dev->devno]); - set_dma_sg(state->dma, state->sg, rsg - state->sg); - set_dma_mode(state->dma, write ? DMA_MODE_WRITE : DMA_MODE_READ); - - /* issue r/w command */ - ap->ops->exec_command(ap, &qc->tf); -} - -static void pata_icside_bmdma_start(struct ata_queued_cmd *qc) -{ - struct ata_port *ap = qc->ap; - struct pata_icside_state *state = ap->host->private_data; - - BUG_ON(dma_channel_active(state->dma)); - enable_dma(state->dma); -} - -static void pata_icside_bmdma_stop(struct ata_queued_cmd *qc) -{ - struct ata_port *ap = qc->ap; - struct pata_icside_state *state = ap->host->private_data; - - disable_dma(state->dma); - - /* see ata_bmdma_stop */ - ata_altstatus(ap); -} - -static u8 pata_icside_bmdma_status(struct ata_port *ap) -{ - struct pata_icside_state *state = ap->host->private_data; - void __iomem *irq_port; - - irq_port = state->irq_port + (ap->port_no ? ICS_ARCIN_V6_INTRSTAT_2 : - ICS_ARCIN_V6_INTRSTAT_1); - - return readb(irq_port) & 1 ? ATA_DMA_INTR : 0; -} - -static int icside_dma_init(struct ata_probe_ent *ae, struct expansion_card *ec) -{ - struct pata_icside_state *state = ae->private_data; - int i; - - for (i = 0; i < ATA_MAX_DEVICES; i++) { - state->port[0].speed[i] = 480; - state->port[1].speed[i] = 480; - } - - if (ec->dma != NO_DMA && !request_dma(ec->dma, DRV_NAME)) { - state->dma = ec->dma; - ae->mwdma_mask = 0x07; /* MW0..2 */ - } - - return 0; -} - - -static int pata_icside_port_start(struct ata_port *ap) -{ - /* No PRD to alloc */ - return ata_pad_alloc(ap, ap->dev); -} - -static struct scsi_host_template pata_icside_sht = { - .module = THIS_MODULE, - .name = DRV_NAME, - .ioctl = ata_scsi_ioctl, - .queuecommand = ata_scsi_queuecmd, - .can_queue = ATA_DEF_QUEUE, - .this_id = ATA_SHT_THIS_ID, - .sg_tablesize = PATA_ICSIDE_MAX_SG, - .cmd_per_lun = ATA_SHT_CMD_PER_LUN, - .emulated = ATA_SHT_EMULATED, - .use_clustering = ATA_SHT_USE_CLUSTERING, - .proc_name = DRV_NAME, - .dma_boundary = ~0, /* no dma boundaries */ - .slave_configure = ata_scsi_slave_config, - .slave_destroy = ata_scsi_slave_destroy, - .bios_param = ata_std_bios_param, -}; - -/* wish this was exported from libata-core */ -static void ata_dummy_noret(struct ata_port *port) -{ -} - -/* - * We need to shut down unused ports to prevent spurious interrupts. - * FIXME: the libata core doesn't call this function for PATA interfaces. - */ -static void pata_icside_port_disable(struct ata_port *ap) -{ - struct pata_icside_state *state = ap->host->private_data; - - ata_port_printk(ap, KERN_ERR, "disabling icside port\n"); - - ata_port_disable(ap); - - state->port[ap->port_no].disabled = 1; - - if (state->type == ICS_TYPE_V6) { - /* - * Disable interrupts from this port, otherwise we - * receive spurious interrupts from the floating - * interrupt line. - */ - void __iomem *irq_port = state->irq_port + - (ap->port_no ? ICS_ARCIN_V6_INTROFFSET_2 : ICS_ARCIN_V6_INTROFFSET_1); - readb(irq_port); - } -} - -static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq) -{ - unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; - u8 status; - - status = ata_busy_wait(ap, bits, 1000); - if (status & bits) - if (ata_msg_err(ap)) - printk(KERN_ERR "abnormal status 0x%X\n", status); - - if (ata_msg_intr(ap)) - printk(KERN_INFO "%s: irq ack: drv_stat 0x%X\n", - __FUNCTION__, status); - - return status; -} - -static struct ata_port_operations pata_icside_port_ops = { - .port_disable = pata_icside_port_disable, - - .set_dmamode = pata_icside_set_dmamode, - - .tf_load = ata_tf_load, - .tf_read = ata_tf_read, - .exec_command = ata_exec_command, - .check_status = ata_check_status, - .dev_select = ata_std_dev_select, - - .bmdma_setup = pata_icside_bmdma_setup, - .bmdma_start = pata_icside_bmdma_start, - - .data_xfer = ata_data_xfer_noirq, - - /* no need to build any PRD tables for DMA */ - .qc_prep = ata_noop_qc_prep, - .qc_issue = ata_qc_issue_prot, - - .freeze = ata_bmdma_freeze, - .thaw = ata_bmdma_thaw, - .error_handler = ata_bmdma_error_handler, - .post_internal_cmd = pata_icside_bmdma_stop, - - .irq_handler = ata_interrupt, - .irq_clear = ata_dummy_noret, - .irq_on = ata_irq_on, - .irq_ack = pata_icside_irq_ack, - - .port_start = pata_icside_port_start, - - .bmdma_stop = pata_icside_bmdma_stop, - .bmdma_status = pata_icside_bmdma_status, -}; - -static void -pata_icside_add_port(struct ata_probe_ent *ae, void __iomem *base, - const struct portinfo *info) -{ - struct ata_ioports *ioaddr = &ae->port[ae->n_ports++]; - void __iomem *cmd = base + info->dataoffset; - - ioaddr->cmd_addr = cmd; - ioaddr->data_addr = cmd + (ATA_REG_DATA << info->stepping); - ioaddr->error_addr = cmd + (ATA_REG_ERR << info->stepping); - ioaddr->feature_addr = cmd + (ATA_REG_FEATURE << info->stepping); - ioaddr->nsect_addr = cmd + (ATA_REG_NSECT << info->stepping); - ioaddr->lbal_addr = cmd + (ATA_REG_LBAL << info->stepping); - ioaddr->lbam_addr = cmd + (ATA_REG_LBAM << info->stepping); - ioaddr->lbah_addr = cmd + (ATA_REG_LBAH << info->stepping); - ioaddr->device_addr = cmd + (ATA_REG_DEVICE << info->stepping); - ioaddr->status_addr = cmd + (ATA_REG_STATUS << info->stepping); - ioaddr->command_addr = cmd + (ATA_REG_CMD << info->stepping); - - ioaddr->ctl_addr = base + info->ctrloffset; - ioaddr->altstatus_addr = ioaddr->ctl_addr; -} - -static int __init -pata_icside_register_v5(struct ata_probe_ent *ae, struct expansion_card *ec) -{ - struct pata_icside_state *state = ae->private_data; - void __iomem *base; - - base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), - ecard_resource_len(ec, ECARD_RES_MEMC)); - if (!base) - return -ENOMEM; - - state->irq_port = base; - - ec->irqaddr = base + ICS_ARCIN_V5_INTRSTAT; - ec->irqmask = 1; - ec->irq_data = state; - ec->ops = &pata_icside_ops_arcin_v5; - - /* - * Be on the safe side - disable interrupts - */ - ec->ops->irqdisable(ec, ec->irq); - - pata_icside_add_port(ae, base, &pata_icside_portinfo_v5); - - return 0; -} - -static int __init -pata_icside_register_v6(struct ata_probe_ent *ae, struct expansion_card *ec) -{ - struct pata_icside_state *state = ae->private_data; - void __iomem *ioc_base, *easi_base; - unsigned int sel = 0; - int ret; - - ioc_base = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), - ecard_resource_len(ec, ECARD_RES_IOCFAST)); - if (!ioc_base) { - ret = -ENOMEM; - goto out; - } - - easi_base = ioc_base; - - if (ecard_resource_flags(ec, ECARD_RES_EASI)) { - easi_base = ioremap(ecard_resource_start(ec, ECARD_RES_EASI), - ecard_resource_len(ec, ECARD_RES_EASI)); - if (!easi_base) { - ret = -ENOMEM; - goto unmap_slot; - } - - /* - * Enable access to the EASI region. - */ - sel = 1 << 5; - } - - writeb(sel, ioc_base); - - ec->irq_data = state; - ec->ops = &pata_icside_ops_arcin_v6; - - state->irq_port = easi_base; - state->ioc_base = ioc_base; - state->port[0].port_sel = sel; - state->port[1].port_sel = sel | 1; - - /* - * Be on the safe side - disable interrupts - */ - ec->ops->irqdisable(ec, ec->irq); - - /* - * Find and register the interfaces. - */ - pata_icside_add_port(ae, easi_base, &pata_icside_portinfo_v6_1); - pata_icside_add_port(ae, easi_base, &pata_icside_portinfo_v6_2); - - /* - * FIXME: work around libata's aversion to calling port_disable. - * This permanently disables interrupts on port 0 - bad luck if - * you have a drive on that port. - */ - state->port[0].disabled = 1; - - return icside_dma_init(ae, ec); - - unmap_slot: - iounmap(ioc_base); - out: - return ret; -} - -static int __devinit -pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id) -{ - struct pata_icside_state *state; - struct ata_probe_ent ae; - void __iomem *idmem; - int ret; - - ret = ecard_request_resources(ec); - if (ret) - goto out; - - state = kzalloc(sizeof(struct pata_icside_state), GFP_KERNEL); - if (!state) { - ret = -ENOMEM; - goto release; - } - - state->type = ICS_TYPE_NOTYPE; - state->dma = NO_DMA; - - idmem = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), - ecard_resource_len(ec, ECARD_RES_IOCFAST)); - if (idmem) { - unsigned int type; - - type = readb(idmem + ICS_IDENT_OFFSET) & 1; - type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1; - type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2; - type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3; - iounmap(idmem); - - state->type = type; - } - - memset(&ae, 0, sizeof(ae)); - INIT_LIST_HEAD(&ae.node); - ae.dev = &ec->dev; - ae.port_ops = &pata_icside_port_ops; - ae.sht = &pata_icside_sht; - ae.pio_mask = 0x1f; - ae.irq = ec->irq; - ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; - ae._host_flags = ATA_HOST_SIMPLEX; - ae.private_data = state; - - switch (state->type) { - case ICS_TYPE_A3IN: - dev_warn(&ec->dev, "A3IN unsupported\n"); - ret = -ENODEV; - break; - - case ICS_TYPE_A3USER: - dev_warn(&ec->dev, "A3USER unsupported\n"); - ret = -ENODEV; - break; - - case ICS_TYPE_V5: - ret = pata_icside_register_v5(&ae, ec); - break; - - case ICS_TYPE_V6: - ret = pata_icside_register_v6(&ae, ec); - break; - - default: - dev_warn(&ec->dev, "unknown interface type\n"); - ret = -ENODEV; - break; - } - - if (ret == 0) - ret = ata_device_add(&ae) == 0 ? -ENODEV : 0; - - if (ret == 0) - goto out; - - kfree(state); - release: - ecard_release_resources(ec); - out: - return ret; -} - -static void pata_icside_shutdown(struct expansion_card *ec) -{ - struct ata_host *host = ecard_get_drvdata(ec); - unsigned long flags; - - /* - * Disable interrupts from this card. We need to do - * this before disabling EASI since we may be accessing - * this register via that region. - */ - local_irq_save(flags); - if (ec->ops) - ec->ops->irqdisable(ec, ec->irq); - local_irq_restore(flags); - - /* - * Reset the ROM pointer so that we can read the ROM - * after a soft reboot. This also disables access to - * the IDE taskfile via the EASI region. - */ - if (host) { - struct pata_icside_state *state = host->private_data; - if (state->ioc_base) - writeb(0, state->ioc_base); - } -} - -static void __devexit pata_icside_remove(struct expansion_card *ec) -{ - struct ata_host *host = ecard_get_drvdata(ec); - struct pata_icside_state *state = host->private_data; - - ata_host_detach(host); - - pata_icside_shutdown(ec); - - /* - * don't NULL out the drvdata - devres/libata wants it - * to free the ata_host structure. - */ - ec->ops = NULL; - ec->irq_data = NULL; - - if (state->dma != NO_DMA) - free_dma(state->dma); - if (state->ioc_base) - iounmap(state->ioc_base); - if (state->ioc_base != state->irq_port) - iounmap(state->irq_port); - - kfree(state); - ecard_release_resources(ec); -} - -static const struct ecard_id pata_icside_ids[] = { - { MANU_ICS, PROD_ICS_IDE }, - { MANU_ICS2, PROD_ICS2_IDE }, - { 0xffff, 0xffff } -}; - -static struct ecard_driver pata_icside_driver = { - .probe = pata_icside_probe, - .remove = __devexit_p(pata_icside_remove), - .shutdown = pata_icside_shutdown, - .id_table = pata_icside_ids, - .drv = { - .name = DRV_NAME, - }, -}; - -static int __init pata_icside_init(void) -{ - return ecard_register_driver(&pata_icside_driver); -} - -static void __exit pata_icside_exit(void) -{ - ecard_remove_driver(&pata_icside_driver); -} - -MODULE_AUTHOR("Russell King "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("ICS PATA driver"); - -module_init(pata_icside_init); -module_exit(pata_icside_exit); diff --git a/trunk/include/asm-arm/arch-s3c2410/regs-ac97.h b/trunk/include/asm-arm/arch-s3c2410/regs-ac97.h index bdd6a4f93d7f..b004dee6bcaf 100644 --- a/trunk/include/asm-arm/arch-s3c2410/regs-ac97.h +++ b/trunk/include/asm-arm/arch-s3c2410/regs-ac97.h @@ -13,11 +13,55 @@ #ifndef __ASM_ARCH_REGS_AC97_H #define __ASM_ARCH_REGS_AC97_H __FILE__ -#define S3C_AC97_GLBCTRL (0x00) -#define S3C_AC97_GLBSTAT (0x04) -#define S3C_AC97_CODEC_CMD (0x08) -#define S3C_AC97_PCM_ADDR (0x10) -#define S3C_AC97_PCM_DATA (0x18) -#define S3C_AC97_MIC_DATA (0x1C) +#define S3C_AC97_GLBCTRL (0x00) + +#define S3C_AC97_GLBCTRL_CODECREADYIE (1<<22) +#define S3C_AC97_GLBCTRL_PCMOUTURIE (1<<21) +#define S3C_AC97_GLBCTRL_PCMINORIE (1<<20) +#define S3C_AC97_GLBCTRL_MICINORIE (1<<19) +#define S3C_AC97_GLBCTRL_PCMOUTTIE (1<<18) +#define S3C_AC97_GLBCTRL_PCMINTIE (1<<17) +#define S3C_AC97_GLBCTRL_MICINTIE (1<<16) +#define S3C_AC97_GLBCTRL_PCMOUTTM_OFF (0<<12) +#define S3C_AC97_GLBCTRL_PCMOUTTM_PIO (1<<12) +#define S3C_AC97_GLBCTRL_PCMOUTTM_DMA (2<<12) +#define S3C_AC97_GLBCTRL_PCMOUTTM_MASK (3<<12) +#define S3C_AC97_GLBCTRL_PCMINTM_OFF (0<<10) +#define S3C_AC97_GLBCTRL_PCMINTM_PIO (1<<10) +#define S3C_AC97_GLBCTRL_PCMINTM_DMA (2<<10) +#define S3C_AC97_GLBCTRL_PCMINTM_MASK (3<<10) +#define S3C_AC97_GLBCTRL_MICINTM_OFF (0<<8) +#define S3C_AC97_GLBCTRL_MICINTM_PIO (1<<8) +#define S3C_AC97_GLBCTRL_MICINTM_DMA (2<<8) +#define S3C_AC97_GLBCTRL_MICINTM_MASK (3<<8) +#define S3C_AC97_GLBCTRL_TRANSFERDATAENABLE (1<<3) +#define S3C_AC97_GLBCTRL_ACLINKON (1<<2) +#define S3C_AC97_GLBCTRL_WARMRESET (1<<1) +#define S3C_AC97_GLBCTRL_COLDRESET (1<<0) + +#define S3C_AC97_GLBSTAT (0x04) + +#define S3C_AC97_GLBSTAT_CODECREADY (1<<22) +#define S3C_AC97_GLBSTAT_PCMOUTUR (1<<21) +#define S3C_AC97_GLBSTAT_PCMINORI (1<<20) +#define S3C_AC97_GLBSTAT_MICINORI (1<<19) +#define S3C_AC97_GLBSTAT_PCMOUTTI (1<<18) +#define S3C_AC97_GLBSTAT_PCMINTI (1<<17) +#define S3C_AC97_GLBSTAT_MICINTI (1<<16) +#define S3C_AC97_GLBSTAT_MAINSTATE_IDLE (0<<0) +#define S3C_AC97_GLBSTAT_MAINSTATE_INIT (1<<0) +#define S3C_AC97_GLBSTAT_MAINSTATE_READY (2<<0) +#define S3C_AC97_GLBSTAT_MAINSTATE_ACTIVE (3<<0) +#define S3C_AC97_GLBSTAT_MAINSTATE_LP (4<<0) +#define S3C_AC97_GLBSTAT_MAINSTATE_WARM (5<<0) + +#define S3C_AC97_CODEC_CMD (0x08) + +#define S3C_AC97_CODEC_CMD_READ (1<<23) + +#define S3C_AC97_STAT (0x0c) +#define S3C_AC97_PCM_ADDR (0x10) +#define S3C_AC97_PCM_DATA (0x18) +#define S3C_AC97_MIC_DATA (0x1C) #endif /* __ASM_ARCH_REGS_AC97_H */ diff --git a/trunk/include/asm-arm/ecard.h b/trunk/include/asm-arm/ecard.h index 3a6d3eb27622..a0ae2b954d29 100644 --- a/trunk/include/asm-arm/ecard.h +++ b/trunk/include/asm-arm/ecard.h @@ -160,7 +160,6 @@ struct expansion_card { unsigned char irqmask; /* IRQ mask */ unsigned char fiqmask; /* FIQ mask */ unsigned char claimed; /* Card claimed? */ - unsigned char easi; /* EASI card */ void *irq_data; /* Data for use for IRQ by card */ void *fiq_data; /* Data for use for FIQ by card */ @@ -170,6 +169,7 @@ struct expansion_card { CONST unsigned int dma; /* DMA number (for request_dma) */ CONST unsigned int irq; /* IRQ number (for request_irq) */ CONST unsigned int fiq; /* FIQ number (for request_irq) */ + CONST card_type_t type; /* Type of card */ CONST struct in_ecid cid; /* Card Identification */ /* Private internal data */ @@ -224,6 +224,56 @@ ecard_address(struct expansion_card *ec, card_type_t type, card_speed_t speed) extern int ecard_request_resources(struct expansion_card *ec); extern void ecard_release_resources(struct expansion_card *ec); +#ifdef ECARD_C +/* Definitions internal to ecard.c - for it's use only!! + * + * External expansion card header as read from the card + */ +struct ex_ecid { + unsigned char r_irq:1; + unsigned char r_zero:1; + unsigned char r_fiq:1; + unsigned char r_id:4; + unsigned char r_a:1; + + unsigned char r_cd:1; + unsigned char r_is:1; + unsigned char r_w:2; + unsigned char r_r1:4; + + unsigned char r_r2:8; + + unsigned char r_prod[2]; + + unsigned char r_manu[2]; + + unsigned char r_country; + + unsigned char r_fiqmask; + unsigned char r_fiqoff[3]; + + unsigned char r_irqmask; + unsigned char r_irqoff[3]; +}; + +/* + * Chunk directory entry as read from the card + */ +struct ex_chunk_dir { + unsigned char r_id; + unsigned char r_len[3]; + unsigned long r_start; + union { + char string[256]; + char data[1]; + } d; +#define c_id(x) ((x)->r_id) +#define c_len(x) ((x)->r_len[0]|((x)->r_len[1]<<8)|((x)->r_len[2]<<16)) +#define c_start(x) ((x)->r_start) +}; + +#endif + extern struct bus_type ecard_bus_type; #define ECARD_DEV(_d) container_of((_d), struct expansion_card, dev)