mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-24 08:01:08 +02:00
add proper ebu locking to ifxmips
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11597 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
6ddec82f97
commit
22c1090f91
@ -43,6 +43,9 @@
|
||||
static unsigned int chiprev;
|
||||
static struct platform_device *ifxmips_devs[MAX_IFXMIPS_DEVS];
|
||||
|
||||
spinlock_t ebu_lock = SPIN_LOCK_UNLOCKED;
|
||||
EXPORT_SYMBOL_GPL(ebu_lock);
|
||||
|
||||
static struct platform_device
|
||||
ifxmips_led[] =
|
||||
{
|
||||
@ -79,24 +82,6 @@ ifxmips_wdt[] =
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device
|
||||
ifxmips_asc0[] =
|
||||
{
|
||||
{
|
||||
.id = 0,
|
||||
.name = "ifxmips_asc",
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device
|
||||
ifxmips_asc1[] =
|
||||
{
|
||||
{
|
||||
.id = 1,
|
||||
.name = "ifxmips_asc",
|
||||
},
|
||||
};
|
||||
|
||||
static struct physmap_flash_data
|
||||
ifxmips_mtd_data = {
|
||||
.width = 2,
|
||||
@ -173,8 +158,6 @@ ifxmips_init_devices(void)
|
||||
ifxmips_devs[dev++] = ifxmips_mii;
|
||||
ifxmips_devs[dev++] = ifxmips_mtd;
|
||||
ifxmips_devs[dev++] = ifxmips_wdt;
|
||||
//ifxmips_devs[dev++] = ifxmips_asc0;
|
||||
ifxmips_devs[dev++] = ifxmips_asc1;
|
||||
#ifdef CONFIG_GPIO_DEVICE
|
||||
ifxmips_devs[dev++] = ifxmips_gpio_dev;
|
||||
#endif
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <asm/ifxmips/ifxmips_irq.h>
|
||||
#include <asm/addrspace.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <asm/ifxmips/ifxmips_ebu.h>
|
||||
|
||||
#define IFXMIPS_PCI_CFG_BUSNUM_SHF 16
|
||||
#define IFXMIPS_PCI_CFG_DEVNUM_SHF 11
|
||||
@ -33,7 +34,7 @@ ifxmips_pci_config_access(unsigned char access_type,
|
||||
|| ((devfn & 0xf8) == 0) || ((devfn & 0xf8) == 0x68))
|
||||
return 1;
|
||||
|
||||
local_irq_save(flags);
|
||||
spin_lock_irqsave(&ebu_lock, flags);
|
||||
|
||||
cfg_base = ifxmips_pci_mapped_cfg;
|
||||
cfg_base |= (bus->number << IFXMIPS_PCI_CFG_BUSNUM_SHF) | (devfn <<
|
||||
@ -64,7 +65,7 @@ ifxmips_pci_config_access(unsigned char access_type,
|
||||
cfg_base = (ifxmips_pci_mapped_cfg | (0x68 << IFXMIPS_PCI_CFG_FUNNUM_SHF)) + 4;
|
||||
ifxmips_w32(temp, ((u32*)cfg_base));
|
||||
|
||||
local_irq_restore(flags);
|
||||
spin_unlock_irqrestore(&ebu_lock, flags);
|
||||
|
||||
if (((*data) == 0xffffffff) && (access_type == PCI_ACCESS_READ))
|
||||
return 1;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/cfi.h>
|
||||
#include <asm/ifxmips/ifxmips.h>
|
||||
#include <asm/ifxmips/ifxmips_ebu.h>
|
||||
#include <linux/magic.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
@ -41,19 +42,23 @@ ifxmips_map = {
|
||||
static map_word
|
||||
ifxmips_read16(struct map_info * map, unsigned long adr)
|
||||
{
|
||||
unsigned long flags;
|
||||
map_word temp;
|
||||
|
||||
spin_lock_irqsave(&ebu_lock, flags);
|
||||
adr ^= 2;
|
||||
temp.x[0] = *((__u16 *) (map->virt + adr));
|
||||
|
||||
spin_unlock_irqrestore(&ebu_lock, flags);
|
||||
return temp;
|
||||
}
|
||||
|
||||
static void
|
||||
ifxmips_write16(struct map_info *map, map_word d, unsigned long adr)
|
||||
{
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&ebu_lock, flags);
|
||||
adr ^= 2;
|
||||
*((__u16 *) (map->virt + adr)) = d.x[0];
|
||||
spin_unlock_irqrestore(&ebu_lock, flags);
|
||||
}
|
||||
|
||||
void
|
||||
@ -61,12 +66,14 @@ ifxmips_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t le
|
||||
{
|
||||
unsigned char *p;
|
||||
unsigned char *to_8;
|
||||
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&ebu_lock, flags);
|
||||
from = (unsigned long)(from + map->virt);
|
||||
p = (unsigned char*) from;
|
||||
to_8 = (unsigned char*) to;
|
||||
while(len--)
|
||||
*to_8++ = *p++;
|
||||
spin_unlock_irqrestore(&ebu_lock, flags);
|
||||
}
|
||||
|
||||
void
|
||||
@ -74,12 +81,14 @@ ifxmips_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_
|
||||
{
|
||||
unsigned char *p = (unsigned char*)from;
|
||||
unsigned char *to_8;
|
||||
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&ebu_lock, flags);
|
||||
to += (unsigned long) map->virt;
|
||||
to_8 = (unsigned char*)to;
|
||||
while(len--){
|
||||
*p++ = *to_8++;
|
||||
}
|
||||
spin_unlock_irqrestore(&ebu_lock, flags);
|
||||
}
|
||||
|
||||
static struct mtd_partition
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (C) 2007 John Crispin <blogic@openwrt.org>
|
||||
*/
|
||||
#ifndef _IFXMIPS_EBU_H__
|
||||
#define _IFXMIPS_EBU_H__
|
||||
|
||||
extern spinlock_t ebu_lock;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user