OpenCores
URL https://opencores.org/ocsvn/test_project/test_project/trunk

Subversion Repositories test_project

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 80 to Rev 81
    Reverse comparison

Rev 80 → Rev 81

/test_project/trunk/linux_sd_driver/fs/partitions/msdos.c
420,7 → 420,7
unsigned char *data;
struct partition *p;
int slot;
 
data = read_dev_sector(bdev, 0, &sect);
if (!data)
return -1;
434,7 → 434,7
printk( " [AIX]");
return 0;
}
 
/*
* Now that the 55aa signature is present, this is probably
* either the boot sector of a FAT filesystem or a DOS-type
441,8 → 441,11
* partition table. Reject this in case the boot indicator
* is not 0 or 0x80.
*/
p = (struct partition *) (data + 0x1be);
for (slot = 1; slot <= 4; slot++, p++) {
if (p->boot_ind != 0 && p->boot_ind != 0x80) {
put_dev_sector(sect);
return 0;
460,7 → 463,7
}
#endif
p = (struct partition *) (data + 0x1be);
 
/*
* Look for partitions in two passes:
* First find the primary and DOS-type extended partitions.
468,12 → 471,15
*/
 
state->next = 5;
for (slot = 1 ; slot <= 4 ; slot++, p++) {
 
for (slot = 1 ; slot <= 4 ; slot++, p++) {
u32 start = START_SECT(p)*sector_size;
u32 size = NR_SECTS(p)*sector_size;
if (!size)
if (!size)
continue;
if (is_extended_partition(p)) {
/* prevent someone doing mkfs or mkswap on an
extended partition, but leave room for LILO */
put_partition(state, slot, start, size == 1 ? 1 : 2);
481,7 → 487,9
parse_extended(state, bdev, start, size);
printk(" >");
continue;
}
printk( "I");
put_partition(state, slot, start, size);
if (SYS_IND(p) == LINUX_RAID_PARTITION)
state->parts[slot].flags = 1;
491,25 → 499,22
printk("[EZD]");
}
 
printk("\n");
 
/* second pass - output for each on a separate line */
p = (struct partition *) (0x1be + data);
for (slot = 1 ; slot <= 4 ; slot++, p++) {
unsigned char id = SYS_IND(p);
int n;
 
int n;
if (!NR_SECTS(p))
continue;
 
continue;
for (n = 0; subtypes[n].parse && id != subtypes[n].id; n++)
;
 
if (!subtypes[n].parse)
continue;
subtypes[n].parse(state, bdev, START_SECT(p)*sector_size,
NR_SECTS(p)*sector_size, slot);
}
}
put_dev_sector(sect);
return 1;
}
/test_project/trunk/linux_sd_driver/arch/or32/support/initrd-fb-03.ext2 Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/test_project/trunk/linux_sd_driver/.config
1,7 → 1,7
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.24
# Wed Jul 1 08:09:07 2009
# Mon Jul 20 15:10:58 2009
#
CONFIG_MMU=y
CONFIG_ZONE_DMA=y
26,8 → 26,6
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
# CONFIG_TASKSTATS is not set
# CONFIG_AUDIT is not set
CONFIG_IKCONFIG=y
# CONFIG_IKCONFIG_PROC is not set
CONFIG_LOG_BUF_SHIFT=14
34,7 → 32,7
# CONFIG_CGROUPS is not set
# CONFIG_FAIR_GROUP_SCHED is not set
# CONFIG_SYSFS_DEPRECATED is not set
# CONFIG_RELAY is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_SYSCTL=y
45,7 → 43,7
CONFIG_PRINTK=y
CONFIG_BUG=y
# CONFIG_ELF_CORE is not set
CONFIG_BASE_FULL=y
# CONFIG_BASE_FULL is not set
CONFIG_FUTEX=y
CONFIG_ANON_INODES=y
CONFIG_EPOLL=y
59,11 → 57,11
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_TINY_SHMEM=y
CONFIG_BASE_SMALL=0
CONFIG_BASE_SMALL=1
# CONFIG_MODULES is not set
CONFIG_BLOCK=y
# CONFIG_LBD is not set
# CONFIG_BLK_DEV_IO_TRACE is not set
CONFIG_LBD=y
CONFIG_BLK_DEV_IO_TRACE=y
# CONFIG_LSF is not set
 
#
73,11 → 71,11
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
CONFIG_DEFAULT_AS=y
# CONFIG_DEFAULT_AS is not set
# CONFIG_DEFAULT_DEADLINE is not set
# CONFIG_DEFAULT_CFQ is not set
CONFIG_DEFAULT_CFQ=y
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="anticipatory"
CONFIG_DEFAULT_IOSCHED="cfq"
CONFIG_OR32=y
 
#
153,69 → 151,9
#
# Networking
#
CONFIG_NET=y
# CONFIG_NET is not set
 
#
# Networking options
#
CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set
CONFIG_UNIX=y
CONFIG_XFRM=y
# CONFIG_XFRM_USER is not set
CONFIG_NET_KEY=y
CONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
# CONFIG_IP_ADVANCED_ROUTER is not set
CONFIG_IP_FIB_HASH=y
# CONFIG_IP_PNP is not set
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set
# CONFIG_SYN_COOKIES is not set
CONFIG_INET_AH=y
CONFIG_INET_ESP=y
CONFIG_INET_IPCOMP=y
CONFIG_INET_XFRM_TUNNEL=y
CONFIG_INET_TUNNEL=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_LRO is not set
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_TCP_CONG_ADVANCED is not set
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_IPV6 is not set
# CONFIG_INET6_XFRM_TUNNEL is not set
# CONFIG_INET6_TUNNEL is not set
# CONFIG_NETWORK_SECMARK is not set
# CONFIG_NETFILTER is not set
# CONFIG_BRIDGE is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
# CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_NET_SCHED is not set
 
#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
 
#
# Wireless
#
# CONFIG_CFG80211 is not set
# CONFIG_WIRELESS_EXT is not set
# CONFIG_IEEE80211 is not set
# CONFIG_RFKILL is not set
 
#
# Device Drivers
#
 
224,10 → 162,7
#
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
# CONFIG_DEBUG_DRIVER is not set
# CONFIG_DEBUG_DEVRES is not set
# CONFIG_SYS_HYPERVISOR is not set
# CONFIG_CONNECTOR is not set
# CONFIG_MTD is not set
# CONFIG_PARPORT is not set
CONFIG_BLK_DEV=y
234,13 → 169,11
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
# CONFIG_BLK_DEV_NBD is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=8192
CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
# CONFIG_MISC_DEVICES is not set
# CONFIG_IDE is not set
 
253,28 → 186,6
# CONFIG_SCSI_NETLINK is not set
# CONFIG_ATA is not set
# CONFIG_MD is not set
CONFIG_NETDEVICES=y
# CONFIG_NETDEVICES_MULTIQUEUE is not set
CONFIG_DUMMY=y
# CONFIG_BONDING is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# CONFIG_VETH is not set
# CONFIG_NET_ETHERNET is not set
# CONFIG_NETDEV_1000 is not set
# CONFIG_NETDEV_10000 is not set
 
#
# Wireless LAN
#
# CONFIG_WLAN_PRE80211 is not set
# CONFIG_WLAN_80211 is not set
# CONFIG_WAN is not set
# CONFIG_PPP is not set
# CONFIG_SLIP is not set
# CONFIG_NETPOLL is not set
# CONFIG_NET_POLL_CONTROLLER is not set
# CONFIG_ISDN is not set
# CONFIG_PHONE is not set
 
#
371,7 → 282,6
# Multimedia devices
#
# CONFIG_VIDEO_DEV is not set
# CONFIG_DVB_CORE is not set
# CONFIG_DAB is not set
 
#
418,8 → 328,13
CONFIG_MMC_OCORES=y
# CONFIG_NEW_LEDS is not set
# CONFIG_RTC_CLASS is not set
CONFIG_DMADEVICES=y
 
#
# DMA Devices
#
 
#
# Userspace I/O
#
# CONFIG_UIO is not set
433,18 → 348,12
# CONFIG_EXT3_FS is not set
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
CONFIG_FS_POSIX_ACL=y
# CONFIG_FS_POSIX_ACL is not set
# CONFIG_XFS_FS is not set
# CONFIG_OCFS2_FS is not set
# CONFIG_MINIX_FS is not set
# CONFIG_ROMFS_FS is not set
# CONFIG_INOTIFY is not set
CONFIG_QUOTA=y
# CONFIG_QUOTA_NETLINK_INTERFACE is not set
# CONFIG_PRINT_QUOTA_WARNING is not set
# CONFIG_QFMT_V1 is not set
# CONFIG_QFMT_V2 is not set
CONFIG_QUOTACTL=y
# CONFIG_QUOTA is not set
CONFIG_DNOTIFY=y
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
459,8 → 368,10
#
# DOS/FAT/NT Filesystems
#
# CONFIG_MSDOS_FS is not set
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
# CONFIG_VFAT_FS is not set
CONFIG_FAT_DEFAULT_CODEPAGE=437
# CONFIG_NTFS_FS is not set
 
#
484,32 → 395,28
# CONFIG_QNX4FS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
# CONFIG_NFS_DIRECTIO is not set
CONFIG_NFSD=y
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_TCP=y
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_EXPORTFS=y
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
# CONFIG_SMB_FS is not set
# CONFIG_CIFS is not set
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
 
#
# Partition Types
#
# CONFIG_PARTITION_ADVANCED is not set
CONFIG_PARTITION_ADVANCED=y
# CONFIG_ACORN_PARTITION is not set
# CONFIG_OSF_PARTITION is not set
CONFIG_AMIGA_PARTITION=y
# CONFIG_ATARI_PARTITION is not set
# CONFIG_MAC_PARTITION is not set
CONFIG_MSDOS_PARTITION=y
# CONFIG_BSD_DISKLABEL is not set
# CONFIG_MINIX_SUBPARTITION is not set
# CONFIG_SOLARIS_X86_PARTITION is not set
# CONFIG_UNIXWARE_DISKLABEL is not set
# CONFIG_LDM_PARTITION is not set
# CONFIG_SGI_PARTITION is not set
# CONFIG_ULTRIX_PARTITION is not set
CONFIG_SUN_PARTITION=y
# CONFIG_KARMA_PARTITION is not set
# CONFIG_EFI_PARTITION is not set
# CONFIG_SYSV68_PARTITION is not set
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
# CONFIG_NLS_CODEPAGE_437 is not set
613,31 → 520,12
#
# Kernel hacking
#
# CONFIG_PRINTK_TIME is not set
CONFIG_PRINTK_TIME=y
# CONFIG_ENABLE_WARN_DEPRECATED is not set
# CONFIG_ENABLE_MUST_CHECK is not set
CONFIG_MAGIC_SYSRQ=y
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_DEBUG_FS is not set
CONFIG_DEBUG_FS=y
# CONFIG_HEADERS_CHECK is not set
CONFIG_DEBUG_KERNEL=y
CONFIG_DETECT_SOFTLOCKUP=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_SCHEDSTATS is not set
# CONFIG_TIMER_STATS is not set
# CONFIG_DEBUG_SLAB is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_RT_MUTEX_TESTER is not set
# CONFIG_DEBUG_SPINLOCK is not set
# CONFIG_DEBUG_MUTEXES is not set
# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_LIST is not set
# CONFIG_DEBUG_SG is not set
# CONFIG_FORCED_INLINING is not set
# CONFIG_BOOT_PRINTK_DELAY is not set
# CONFIG_FAULT_INJECTION is not set
# CONFIG_DEBUG_KERNEL is not set
# CONFIG_SAMPLES is not set
/test_project/trunk/linux_sd_driver/include/linux/dma-mapping.h
4,6 → 4,9
#include <linux/device.h>
#include <linux/err.h>
 
 
#include <linux/scatterlist.h>
 
/* These definitions mirror those in pci.h, so they can be used
* interchangeably with their PCI_ counterparts */
enum dma_data_direction {
/test_project/trunk/linux_sd_driver/include/asm-or32/dma-mapping.h
1,8 → 1,7
#ifndef __OR32_DMA_MAPPING_H__
#define __OR32_DMA_MAPPING_H__
 
//#warning "__PHX__ DMA mapping is disabled, change & fix here to enable it"
//#include <asm-generic/dma-mapping-broken.h>
//#warning "__PHX__ DMA mapping is disabled, change & fix here to enable it"#include <asm-generic/dma-mapping-broken.h>
#include <asm/scatterlist.h>
#include <asm-generic/dma-mapping.h>
 
/test_project/trunk/linux_sd_driver/include/asm-or32/scatterlist.h
5,7 → 5,7
#ifdef CONFIG_DEBUG_SG
unsigned long sg_magic;
#endif
char * address; /* Location data is to be transferred to */
dma_addr_t address; /* Location data is to be transferred to */
unsigned int length;
 
/* The following is i386 highmem junk - not used by us */
/test_project/trunk/linux_sd_driver/block/ll_rw_blk.c
101,7 → 101,7
static void blk_queue_congestion_threshold(struct request_queue *q)
{
int nr;
 
nr = q->nr_requests - (q->nr_requests / 8) + 1;
if (nr > q->nr_requests)
nr = q->nr_requests;
625,7 → 625,8
**/
void blk_queue_max_phys_segments(struct request_queue *q,
unsigned short max_segments)
{
{
//printk("%s: set to minimum %d\n", __FUNCTION__, max_segments);
if (!max_segments) {
max_segments = 1;
printk("%s: set to minimum %d\n", __FUNCTION__, max_segments);
1924,7 → 1925,8
kmem_cache_free(requestq_cachep, q);
return NULL;
}
 
/*
* if caller didn't supply a lock, they get per-queue locking with
* our embedded lock
1943,13 → 1945,15
blk_queue_segment_boundary(q, 0xffffffff);
 
blk_queue_make_request(q, __make_request);
blk_queue_max_segment_size(q, MAX_SEGMENT_SIZE);
 
blk_queue_max_hw_segments(q, MAX_HW_SEGMENTS);
blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
 
q->sg_reserved_size = INT_MAX;
 
/*
* all done
*/
/test_project/trunk/linux_sd_driver/drivers/mmc/Kconfig
17,7 → 17,9
help
This is an option for use by developers; most people should
say N here. This enables MMC core and driver debugging.
 
 
if MMC
 
source "drivers/mmc/core/Kconfig"
/test_project/trunk/linux_sd_driver/drivers/mmc/core/Kconfig
2,6 → 2,7
# MMC core configuration
#
 
 
config MMC_UNSAFE_RESUME
bool "Allow unsafe resume (DANGEROUS)"
help
/test_project/trunk/linux_sd_driver/drivers/mmc/core/sd.c
111,7 → 111,7
e = UNSTUFF_BITS(resp, 47, 3);
m = UNSTUFF_BITS(resp, 62, 12);
csd->capacity = (1 + m) << (e + 2);
 
csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
168,17 → 168,26
 
resp[3] = card->raw_scr[1];
resp[2] = card->raw_scr[0];
 
scr_struct = UNSTUFF_BITS(resp, 60, 4);
if (scr_struct != 0) {
//#ifdef CORES_SD_V1
scr_struct = UNSTUFF_BITS(resp, 60, 4);
printk(KERN_ERR "%s: unrecognised SCR structure version %d\n",
mmc_hostname(card->host), scr_struct);
return -EINVAL;
}
mmc_hostname(card->host), scr_struct);
scr->sda_vsn = 0 ;//XXX: UNSTUFF_BITS(resp, 48, 4);UNSTUFF_BITS(resp, 56, 4);
scr->bus_widths =1<<2 ;//XXX: UNSTUFF_BITS(resp, 48, 4);
/*#else
scr_struct = UNSTUFF_BITS(resp, 60, 4);
if (scr_struct != 0) {
printk(KERN_ERR "%s: unrecognised SCR structure version %d\n",
mmc_hostname(card->host), scr_struct);
return -EINVAL;
}
#endif */
 
scr->sda_vsn = UNSTUFF_BITS(resp, 56, 4);
scr->bus_widths = UNSTUFF_BITS(resp, 48, 4);
 
return 0;
}
 
443,6 → 452,7
*/
if ((host->caps & MMC_CAP_4_BIT_DATA) &&
(card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
printk("Wide Bus\n");
err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
if (err)
goto free_card;
/test_project/trunk/linux_sd_driver/drivers/mmc/core/Makefile
6,6 → 6,8
EXTRA_CFLAGS += -DDEBUG
endif
 
 
 
obj-$(CONFIG_MMC) += mmc_core.o
mmc_core-y := core.o sysfs.o bus.o host.o \
mmc.o mmc_ops.o sd.o sd_ops.o \
/test_project/trunk/linux_sd_driver/drivers/mmc/Makefile
3,10 → 3,10
#
 
ifeq ($(CONFIG_MMC_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
EXTRA_CFLAGS += -DDEBUG
endif
 
obj-$(CONFIG_MMC) += core/
obj-$(CONFIG_MMC) += card/
obj-$(CONFIG_MMC) += host/
obj-$(CONFIG_MMC) += core/
obj-$(CONFIG_MMC) += card/
obj-$(CONFIG_MMC) += host/
 
/test_project/trunk/linux_sd_driver/drivers/mmc/host/at91_mci.c
271,7 → 271,7
pr_debug("finishing index %d\n", host->in_use_index);
 
sg = &data->sg[host->in_use_index++];
 
bytes_xfered
pr_debug("Unmapping page %08X\n", sg->dma_address);
 
dma_unmap_page(NULL, sg->dma_address, sg->length, DMA_FROM_DEVICE);
423,7 → 423,7
/* set 136 bit response for R2, 48 bit response otherwise */
if (mmc_resp_type(cmd) == MMC_RSP_R2)
cmdr |= AT91_MCI_RSPTYP_136;
else
elseblocks
cmdr |= AT91_MCI_RSPTYP_48;
}
 
/test_project/trunk/linux_sd_driver/drivers/mmc/host/mmc_ocores.c
2,6 → 2,11
*
* OpenCores MMC Controller driver
*
*
* Command 51 and Command 2 hardcoded
*
*
*
* Copyright (C) 2009 ORSoC, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
25,11 → 30,15
#include <linux/interrupt.h>
#include <linux/err.h>
#include <linux/mmc/host.h>
 
#include <linux/dma-mapping.h>
#include <linux/scatterlist.h>
#include <linux/highmem.h>
#include <asm/board.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/mmc.h>
#include <asm/system.h>
#include <linux/mmc/card.h>
#include "mmc_ocores.h"
 
#define DRIVER_NAME "mmc-ocores"
38,6 → 47,7
 
 
 
 
struct ocores_host {
struct mmc_host *mmc;
spinlock_t lock;
54,23 → 64,38
int irq_dat;
unsigned int flags;
struct tasklet_struct finish_cmd;
struct tasklet_struct finish_data;
struct {
unsigned int normal_int_status;
unsigned int error_int_status;
unsigned int data_int_status;
} registers;
int clock;
/* DMA buffer used for transmitting */
unsigned int* buffer;
dma_addr_t physical_address;
unsigned int total_length;
unsigned int dma_len;
/* Latest in the scatterlist that has been enabled for transfer, but not freed */
int in_use_index;
 
/* Latest in the scatterlist that has been enabled for transfer */
int transfer_index;
int free_tx_bd;
int free_rx_bd;
};
 
struct ocores_host *oc_host;
 
static void ocores_tasklet_finish_cmd(unsigned long param);
static void ocores_tasklet_finish_data(unsigned long param);
 
static inline void CMD_IRQ_ON(struct ocores_host *host, u32 mask)
{
u32 val = readl(host->base + SD_NOMAL_INT_SIGNAL_ENABLE);
printk(KERN_ALERT "Int mask = %08x\n", val);
u32 val = readl(host->base + SD_NOMAL_INT_SIGNAL_ENABLE);
val |= mask;
writel (val, host->base + SD_NOMAL_INT_SIGNAL_ENABLE);
printk(KERN_ALERT "Int mask = %08x\n", val);
writel (val, host->base + SD_NOMAL_INT_SIGNAL_ENABLE);
}
 
static inline void CMD_IRQ_OFF(struct ocores_host *host, u32 mask)
80,62 → 105,260
writel (val, host->base + SD_NOMAL_INT_SIGNAL_ENABLE);
}
 
static inline void DAT_IRQ_ON(struct ocores_host *host, u32 mask)
{
u32 val = readl(host->base + SD_BD_ISER);
val |= mask;
writel (val, host->base + SD_BD_ISER);
}
 
static inline void DAT_IRQ_OFF(struct ocores_host *host, u32 mask)
{
u32 val = readl(host->base + SD_BD_ISER);
val &= ~mask;
writel (val, host->base + SD_BD_ISER);
}
 
 
static void ocores_pre_dma_read(struct ocores_host *host)
{
int i,j;
int off_scal;
struct scatterlist *sg;
struct mmc_command *cmd;
struct mmc_data *data;
off_scal=512;
if (host->mmc->card!= NULL){
if (mmc_card_blockaddr(host->mmc->card))
off_scal=1;
else
off_scal=512;
}
printk("pre dma read off %d\n", off_scal);
cmd = host->cmd;
if (!cmd) {
pr_debug("no command\n");
return;
}
data = cmd->data;
if (!data) {
pr_debug("no data\n");
return;
}
/* Setup the next transfer */
pr_debug("Using transfer index %d\n", host->transfer_index);
sg = &data->sg[host->transfer_index++];
printk("Using transfer index %d, sg offset %d\n", host->transfer_index,sg->offset);
pr_debug("sg = %p\n", sg);
printk("sg = %p\n", sg);
 
host->dma_len = dma_map_sg(mmc_dev(host->mmc), sg, data->sg_len, DMA_FROM_DEVICE);
printk(KERN_ALERT "dma address = %d, sg_dma_len %d, length = %d, sg_dma_len %d\n", sg_dma_address(&data->sg[0]), sg_dma_len(&data->sg[0]), sg->length, host->dma_len);
for (i = 0; i < host->dma_len; i++) {
unsigned int length = sg_dma_len(&data->sg[i]);
if (length >= 512)
length /=512;
else
length = 1;
printk(KERN_ALERT "DMA LEN %d\n", length);
//XXX:512 SD 1.0 card only.
for (j = 0; j< length;j++) {
pr_debug("dma address = %d, length = %d\n", sg_dma_address(&data->sg[i]), sg->length);
printk(KERN_ALERT "dma address = %d, length = %d, sg_dma_len %d\n", (sg_dma_address(&data->sg[i])+512*j), length, host->dma_len);
writel((sg_dma_address(&data->sg[i])+512*j), host->base + BD_RX);
wmb();
writel(cmd->arg+off_scal*j, host->base + BD_RX);
}
}
 
DAT_IRQ_ON (host,(TRE|FIFOE|MRC|TRS));
pr_debug("pre dma read done\n");
}
static void ocores_pre_dma_write(struct ocores_host *host)
{
int i,j;
int off_scal;
struct scatterlist *sg;
struct mmc_command *cmd;
struct mmc_data *data;
off_scal=512;
if (host->mmc->card!= NULL){
if (mmc_card_blockaddr(host->mmc->card))
off_scal=1;
else
off_scal=512;
}
printk("pre dma write off %d\n", off_scal);
cmd = host->cmd;
if (!cmd) {
pr_debug("no command\n");
return;
}
data = cmd->data;
if (!data) {
pr_debug("no data\n");
return;
}
/* Setup the next transfer */
pr_debug("Using transfer index %d\n", host->transfer_index);
sg = &data->sg[host->transfer_index++];
printk("Using transfer index %d, sg offset %d\n", host->transfer_index,sg->offset);
pr_debug("sg = %p\n", sg);
printk("sg = %p\n", sg);
 
host->dma_len = dma_map_sg(mmc_dev(host->mmc), sg, data->sg_len, DMA_TO_DEVICE);
printk(KERN_ALERT "dma address = %d, sg_dma_len %d, length = %d, sg_dma_len %d\n", sg_dma_address(&data->sg[0]), sg_dma_len(&data->sg[0]), sg->length, host->dma_len);
for (i = 0; i < host->dma_len; i++) {
unsigned int length = sg_dma_len(&data->sg[i]);
if (length >= 512)
length /=512;
else
length = 1;
printk(KERN_ALERT "DMA LEN %d\n", length);
//XXX:512 SD 1.0 card only.
for (j = 0; j< length;j++) {
pr_debug("dma address = %d, length = %d\n", sg_dma_address(&data->sg[i]), sg->length);
printk(KERN_ALERT "dma address = %d, length = %d, sg_dma_len %d\n", (sg_dma_address(&data->sg[i])+512*j), length, host->dma_len);
writel((sg_dma_address(&data->sg[i])+512*j), host->base + BD_TX);
wmb();
writel(cmd->arg+off_scal*j, host->base + BD_TX);
}
}
 
DAT_IRQ_ON (host,(TRE|FIFOE|MRC|TRS));
pr_debug("pre dma read done\n");
}
 
static void ocores_start_cmd(struct ocores_host *host, struct mmc_command *cmd)
{
unsigned int cmd_arg, cmd_command=0;
 
//struct mmc_data *data = cmd->data;
struct mmc_data *data = cmd->data;
//WARN_ON(host->cmd != NULL);
host->cmd = cmd;
 
//Set up command
cmd_arg = cmd->arg;
cmd_command |= cmd->opcode << 8;
cmd_command |= host->word_cnt << 6;
//XXX:opcode == 51 not supported by hardware, hack here
if (data && ( cmd->opcode != 51)) {
if ( data->blksz & 0x3 ) {
pr_debug("Unsupported block size\n");
cmd->error = -EINVAL;
mmc_request_done(host->mmc, host->mrq);
return;
}
data->bytes_xfered = 0;
host->transfer_index = 0;
host->in_use_index = 0;
if (data->flags & MMC_DATA_READ){ //Handle a read
printk(KERN_ALERT "%s: Data read\n", __FUNCTION__);
host->buffer = NULL;
host->total_length = 0;
ocores_pre_dma_read(host); //Set up BD
}
else if (data->flags & MMC_DATA_WRITE){ //Handle write
printk(KERN_ALERT "%s: Data write\n", __FUNCTION__); //cmdr |= AT91_MCI_TRCMD_START;
/*host->buffer = dma_alloc_coherent(NULL,
host->total_length,
&host->physical_address, GFP_KERNEL); */
host->total_length = 0;
ocores_pre_dma_write(host); //Set up BD
}
if (data->flags & MMC_DATA_STREAM)
printk(KERN_ALERT "%s: MMC_DATA_STREAM\n", __FUNCTION__);
if (data->blocks > 1)
printk(KERN_ALERT "%s: data->blocks %d > 1 \n", __FUNCTION__, data->blocks);
/*
host->total_length = block_length * blocks;
host->buffer = dma_alloc_coherent(NULL,
host->total_length,
&host->physical_address, GFP_KERNEL);
 
if ( mmc_resp_type(cmd) == MMC_RSP_CRC )
cmd_command |= CRCE;
if ( mmc_resp_type(cmd) == MMC_RSP_OPCODE )
cmd_command |= CICE;
at91_mci_sg_to_dma(host, data);
 
switch (mmc_resp_type(cmd)) {
case MMC_RSP_NONE:
cmd_command |= MMCOC_RSP_NONE;
break;
case MMC_RSP_R1:
cmd_command |= MMCOC_RSP_48;
break;
case MMC_RSP_R1B:
cmd_command |= MMCOC_RSP_48;
break;
case MMC_RSP_R2:
cmd_command |= MMCOC_RSP_136;
break;
case MMC_RSP_R3:
cmd_command |= MMCOC_RSP_48;
break;
default:
printk(KERN_INFO "mmc_ocores: unhandled response type %02x\n",
mmc_resp_type(cmd));
pr_debug("Transmitting %d bytes\n", host->total_length);
 
at91_mci_write(host, ATMEL_PDC_TPR, host->physical_address);
at91_mci_write(host, ATMEL_PDC_TCR, host->total_length / 4);
ier = AT91_MCI_CMDRDY; */
}
/*If data
// if ( data->blksz & 0x3 ) {
pr_debug("Unsupported block size\n");
cmd->error = -EINVAL;
mmc_request_done(host->mmc, host->request);
return;
} */
printk(KERN_ALERT "%s: cmd_arg = %08x\n", __FUNCTION__, cmd_arg);
printk(KERN_ALERT "%s: cmd_command = %08x\n", __FUNCTION__, cmd_command);
else{
//Set up command
cmd_arg = cmd->arg;
cmd_command |= cmd->opcode << 8;
cmd_command |= host->word_cnt << 6;
 
if ( mmc_resp_type(cmd) == MMC_RSP_CRC )
cmd_command |= CRCE;
if ( mmc_resp_type(cmd) == MMC_RSP_OPCODE )
cmd_command |= CICE;
 
switch (mmc_resp_type(cmd)) {
case MMC_RSP_NONE:
cmd_command |= MMCOC_RSP_NONE;
break;
case MMC_RSP_R1:
cmd_command |= MMCOC_RSP_48;
break;
case MMC_RSP_R1B:
cmd_command |= MMCOC_RSP_48;
break;
case MMC_RSP_R2:
cmd_command |= MMCOC_RSP_136;
break;
case MMC_RSP_R3:
cmd_command |= MMCOC_RSP_48;
break;
default:
printk(KERN_INFO "mmc_ocores: unhandled response type %02x\n",
mmc_resp_type(cmd));
}
//Send Command
CMD_IRQ_ON (host,(ECC|EEI));
writel(cmd_command, host->base + SD_COMMAND);
wmb();
writel(cmd_arg, host->base + SD_ARG);
printk(KERN_ALERT "%s: cmd_arg = %08x\n", __FUNCTION__, cmd_arg);
printk(KERN_ALERT "%s: cmd_command = %08x\n", __FUNCTION__, cmd_command);
}
oc_host=host;
CMD_IRQ_ON (host,(ECC|EEI));
writel(cmd_command, host->base + SD_COMMAND);
wmb();
writel(cmd_arg, host->base + SD_ARG);
}
 
static void ocores_process_next(struct ocores_host *host)
179,8 → 402,7
 
printk(KERN_ALERT "%s: enter\n", __FUNCTION__);
 
/* if (host->pdata && host->pdata->get_ro) */
/* return host->pdata->get_ro(mmc_dev(mmc)); */
 
/* /\* Host doesn't support read only detection so assume writeable *\/ */
return 0;
}
247,9 → 469,27
return IRQ_HANDLED;
}
 
static irqreturn_t ocores_irq_dat(int irq, void *dev_id)
static irqreturn_t ocores_irq_dat(int irq, void *devid)
{
struct ocores_host *host = (struct ocores_host *) devid;
 
disable_irq(host->irq_dat);
 
printk(KERN_ALERT "%s: DAT IRQ START***** Normal In = %08x\n", __FUNCTION__, readl(host->base + SD_BD_ISR));
host->registers.data_int_status = readl(host->base + SD_BD_ISR);
writel(0,host->base + SD_BD_ISR);
tasklet_schedule(&host->finish_data);
enable_irq(host->irq_dat);
 
return IRQ_HANDLED;
 
}
 
static const struct mmc_host_ops ocores_ops = {
292,12 → 532,15
mmc->f_min = 700000; //SYS_CLK 60; 0.7 Mhz
mmc->f_max = 4166666; //SYS_CLK; 4.166 666 mhz
 
mmc->max_blk_count = 8;
mmc->max_hw_segs = mmc->max_blk_count;
mmc->max_blk_count = 8;//8; //XXX: 8
mmc->max_hw_segs = 1;
mmc->max_blk_size = MMCOC_MAX_BLOCK_SIZE;
mmc->max_seg_size = mmc->max_blk_count * mmc->max_blk_size;
//mmc->max_seg_size = mmc->max_blk_count * mmc->max_blk_size;
mmc->max_seg_size = PAGE_SIZE;
mmc->max_req_size = mmc->max_seg_size;
mmc->max_phys_segs = mmc->max_hw_segs;
mmc->max_phys_segs = 1; //BD size
 
host = mmc_priv(mmc);
307,10 → 550,20
host->mmc = mmc;
host->cmdat = 0;
host->registers.normal_int_status =0;
 
 
printk("Free FBD \n");
host->free_tx_bd=0;
host->free_rx_bd=0;
printk("Free EBD \n");
tasklet_init(&host->finish_cmd, ocores_tasklet_finish_cmd,
(unsigned long) host);
tasklet_init(&host->finish_data, ocores_tasklet_finish_data,
(unsigned long) host);
 
spin_lock_init(&host->lock);
host->res = r;
321,6 → 574,13
ret = -ENOMEM;
goto out;
}
host->free_tx_bd=readl( host->base + BD_STATUS );
host->free_tx_bd=host->free_tx_bd & 0x00ff;
printk("Free TX BD = %d\n", host->free_tx_bd);
host->free_rx_bd=readl( host->base + BD_STATUS );
host->free_rx_bd=(host->free_rx_bd & 0xff00)>>8;
printk("Free TX BD = %d\n", host->free_rx_bd);
host->pdata = pdev->dev.platform_data;
mmc->ocr_avail = host->pdata->ocr_mask;
 
367,12 → 627,13
static void ocores_tasklet_finish_cmd(unsigned long param)
{
struct ocores_host *host = (struct ocores_host *) param;
 
printk(KERN_ALERT " TASKLET RUNNS************\n");
 
printk(KERN_ALERT "%s: TASKLET RUNNS****** Normal INT = %08x\n", __FUNCTION__, host->registers.normal_int_status);
printk(KERN_ALERT "%s: TASKLET RUNNS****** Error INT = %08x\n", __FUNCTION__, host->registers.error_int_status);
 
struct mmc_data *data;
struct scatterlist *sg;
data = host->cmd->data;
sg = &data->sg[0];
printk(KERN_ALERT " CMD TASKLET RUNNS************\n");
//Check For Transmissions errors
if ((host->registers.normal_int_status & EI) == EI)
{
401,22 → 662,26
{
printk(KERN_ALERT "Long Response, Word Cnt %d, RESP * = %08x\n ",host->word_cnt,readl(host->base + SD_RESP1));
if (host->mrq->cmd->opcode == 2) {
if (host->mrq->cmd->opcode == 2) { //XXX: Hack until supported long response
host->mrq->cmd->resp[0] = readl(host->base + SD_RESP1);
host->mrq->cmd->resp[1] = 0xaaaaaaaa;
host->mrq->cmd->resp[2] = 0xbbbbbbbb;
host->mrq->cmd->resp[3] = 0;
host->mrq->cmd->resp[1] = 0x01302331;
host->mrq->cmd->resp[2] = 0x195abdef;
host->mrq->cmd->resp[3] = 0x195abdef;
mmc_request_done(host->mmc, host->mrq);
} //XXX:
else if(host->mrq->cmd->opcode == 9)
} //XXX: Hack until supported long response
else if(host->mrq->cmd->opcode == 51)
{
host->mrq->cmd->resp[0] = 0x006f0032;
host->mrq->cmd->resp[1] = 0x5b5983bf;
host->mrq->cmd->resp[2] = 0xf6dbdfff;
host->mrq->cmd->resp[3] = 0x0a4041ff;
host->mrq->cmd->resp[0] = 0x900;
host->mrq->cmd->resp[1] = 0xaaa;
host->mrq->cmd->resp[2] = 0xbbb;
host->mrq->cmd->resp[3] = 0xccc;
host->mrq->data->bytes_xfered =8;
dma_unmap_sg(mmc_dev(host->mmc), sg, data->sg_len, DMA_FROM_DEVICE);
mmc_request_done(host->mmc, host->mrq);
}
}
else {
host->word_cnt+=1;
switch(host->word_cnt-1)
450,7 → 715,75
}
}
static void ocores_tasklet_finish_data(unsigned long param)
{
struct ocores_host *host = (struct ocores_host *) param;
struct mmc_data *data;
struct scatterlist *sg;
int free_bd,i;
int *adr;
data = host->cmd->data;
sg = &data->sg[0]; //XXX:O Change to dynamic later?
printk(KERN_ALERT " DATA TASKLET RUNNS************\n");
//IF read operation
if ((host->registers.data_int_status & TRS) == TRS){
if (data->flags & MMC_DATA_READ){
free_bd=readl( host->base + BD_STATUS );
free_bd=(free_bd&0xff00)>>8;
printk(KERN_ALERT " DATA TASKLET RUNNS*** Free BD %d\n", free_bd);
if (free_bd == host->free_tx_bd) {
dma_unmap_sg(mmc_dev(host->mmc), sg, sg->length, DMA_FROM_DEVICE);
host->mrq->cmd->resp[0] = readl(host->base + SD_RESP1);
data->bytes_xfered = sg->length;
DAT_IRQ_OFF (host,(TRE|FIFOE|MRC|TRS));
mmc_request_done(host->mmc, host->mrq);
}
} else if (data->flags & MMC_DATA_WRITE){
free_bd=readl( host->base + BD_STATUS );
free_bd=(free_bd&0x00FF);
printk(KERN_ALERT " DATA TASKLET RUNNS*** Free BD %d\n", free_bd);
if (free_bd == host->free_tx_bd) {
dma_unmap_sg(mmc_dev(host->mmc), sg, sg->length, DMA_TO_DEVICE);
host->mrq->cmd->resp[0] = readl(host->base + SD_RESP1);
data->bytes_xfered = sg->length;
DAT_IRQ_OFF (host,(TRE|FIFOE|MRC|TRS));
mmc_request_done(host->mmc, host->mrq);
}
}
}
else {
sg= &data->sg[0];
writel(SD_DISABLE, host->base + SD_SOFTWARE_RST);
writel(SD_ENABLE, host->base + SD_SOFTWARE_RST);
if ((host->registers.data_int_status & MRC) == MRC)
host->data->error = -ETIMEDOUT;
if ((host->registers.data_int_status & CMDE) == CMDE)
host->data->error = -EILSEQ;
data->bytes_xfered =0;
dma_unmap_sg(mmc_dev(host->mmc), sg, data->sg_len, DMA_FROM_DEVICE);
DAT_IRQ_OFF (host,(TRE|FIFOE|MRC|TRS));
mmc_request_done(host->mmc, host->mrq);
}
 
}
static int ocores_remove(struct platform_device *pdev)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
/test_project/trunk/linux_sd_driver/drivers/mmc/host/pxamci.h
87,4 → 87,4
 
#define MMC_RXFIFO 0x0040 /* 8 bit */
 
#define MMC_TXFIFO 0x0044 /* 8 bit */
#define MMC_TXFIFO 0x0044 /* 8 bit */unsigned int dma_len;
/test_project/trunk/linux_sd_driver/drivers/mmc/host/mmc_ocores.h
47,7 → 47,8
#define SD_CAPABILITY 0x48
#define SD_CLOCK_DIVIDER 0x4c
#define BD_STATUS 0x50
#define BD_ISR 0x54
#define SD_BD_ISR 0x54
#define SD_BD_ISER 0x58
#define BD_RX 0x60
#define BD_TX 0x80
 
55,6 → 56,12
#define ECC 0x1 //Interupt on CommandComplete
#define EEI 0x8000 //Interupt on CommandError
 
//Data Interupt
#define TRE 0x10
#define CMDE 0x08
#define FIFOE 0x04
#define MRC 0x02
#define TRS 0x01
 
#define SD_ENABLE 0
#define SD_DISABLE 1
/test_project/trunk/linux_sd_driver/drivers/dma/Kconfig
4,7 → 4,7
 
menuconfig DMADEVICES
bool "DMA Engine support"
depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX
depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX ||OR32
help
DMA engines can do asynchronous data transfers without
involving the host CPU. Currently, this framework can be

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.