summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2009-12-26 00:09:00 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2009-12-26 00:09:00 +0000
commit371e7aa5210d6b18e4eb9c7ebc5e2b63690db07a (patch)
tree54a3b4076fa02db304649f5240d41a42279f655e /target
parenteb15b88af2269dc7a72b1d8c3f49538a8d2286c1 (diff)
downloadmtk-20170518-371e7aa5210d6b18e4eb9c7ebc5e2b63690db07a.zip
mtk-20170518-371e7aa5210d6b18e4eb9c7ebc5e2b63690db07a.tar.gz
mtk-20170518-371e7aa5210d6b18e4eb9c7ebc5e2b63690db07a.tar.bz2
work on pci.
This is from ticket #6374 Michael Richter thanks for your patch. SVN-Revision: 18933
Diffstat (limited to 'target')
-rw-r--r--target/linux/amazon/files/arch/mips/amazon/pci.c57
-rw-r--r--target/linux/amazon/patches-2.6.30/230-fix_pci.patch20
2 files changed, 25 insertions, 52 deletions
diff --git a/target/linux/amazon/files/arch/mips/amazon/pci.c b/target/linux/amazon/files/arch/mips/amazon/pci.c
index ab305a9..a5596c8 100644
--- a/target/linux/amazon/files/arch/mips/amazon/pci.c
+++ b/target/linux/amazon/files/arch/mips/amazon/pci.c
@@ -95,7 +95,7 @@ static int amazon_pci_config_access(unsigned char access_type,
/* Amazon support slot from 0 to 15 */
/* devfn 0 & 0x20 is itself */
- if ((bus != 0) || (devfn == 0) || (devfn == 0x20))
+ if ((bus->number != 0) || (devfn == 0) || (devfn == 0x20))
return 1;
pci_addr=AMAZON_PCI_CFG_BASE |
@@ -124,49 +124,42 @@ static int amazon_pci_config_access(unsigned char access_type,
static int amazon_pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
{
u32 data = 0;
- int ret = PCIBIOS_SUCCESSFUL;
- if (amazon_pci_config_access(PCI_ACCESS_READ, bus, devfn, where, &data)) {
- data = ~0;
- ret = -1;
- }
+ if (amazon_pci_config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
+ return PCIBIOS_DEVICE_NOT_FOUND;
- switch (size) {
- case 1:
- *((u8 *) val) = (data >> ((where & 3) << 3)) & 0xff;
- break;
- case 2:
- *((u16 *) val) = (data >> ((where & 3) << 3)) & 0xffff;
- break;
- case 4:
- *val = data;
- break;
- default:
- return -1;
- }
+ if (size == 1)
+ *val = (data >> ((where & 3) << 3)) & 0xff;
+ else if (size == 2)
+ *val = (data >> ((where & 3) << 3)) & 0xffff;
+ else
+ *val = data;
- return ret;
+ return PCIBIOS_SUCCESSFUL;
}
static int amazon_pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
{
- if (size != 4) {
- u32 data;
+ u32 data = 0;
+ if (size == 4)
+ {
+ data = val;
+ } else {
if (amazon_pci_config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
- return -1;
+ return PCIBIOS_DEVICE_NOT_FOUND;
if (size == 1)
- val = (data & ~(0xff << ((where & 3) << 3))) | (val << ((where & 3) << 3));
+ data = (data & ~(0xff << ((where & 3) << 3))) |
+ (val << ((where & 3) << 3));
else if (size == 2)
- val = (data & ~(0xffff << ((where & 3) << 3))) | (val << ((where & 3) << 3));
- else
- return -1;
+ data = (data & ~(0xffff << ((where & 3) << 3))) |
+ (val << ((where & 3) << 3));
}
- if (amazon_pci_config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val))
- return -1;
+ if (amazon_pci_config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
+ return PCIBIOS_DEVICE_NOT_FOUND;
return PCIBIOS_SUCCESSFUL;
}
@@ -182,7 +175,7 @@ static struct pci_controller amazon_pci_controller = {
.io_resource = &pci_io_resource
};
-int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
+int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{
switch (slot) {
case 13:
@@ -240,7 +233,7 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
return 0;
}
-int amazon_pci_init(void)
+int __init amazon_pci_init(void)
{
u32 temp_buffer;
@@ -286,7 +279,7 @@ int amazon_pci_init(void)
//use 8 dw burse length
AMAZON_PCI_REG32(FPI_BURST_LENGTH) = 0x303;
- set_io_port_base(ioremap(AMAZON_PCI_IO_BASE, AMAZON_PCI_IO_SIZE));
+ amazon_pci_controller.io_map_base = (unsigned long)ioremap(AMAZON_PCI_IO_BASE, AMAZON_PCI_IO_SIZE);
register_pci_controller(&amazon_pci_controller);
return 0;
}
diff --git a/target/linux/amazon/patches-2.6.30/230-fix_pci.patch b/target/linux/amazon/patches-2.6.30/230-fix_pci.patch
deleted file mode 100644
index 84d88dd..0000000
--- a/target/linux/amazon/patches-2.6.30/230-fix_pci.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/arch/mips/amazon/pci.c
-+++ b/arch/mips/amazon/pci.c
-@@ -182,7 +182,7 @@ static struct pci_controller amazon_pci_
- .io_resource = &pci_io_resource
- };
-
--int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
-+int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
- {
- switch (slot) {
- case 13:
-@@ -240,7 +240,7 @@ int pcibios_plat_dev_init(struct pci_dev
- return 0;
- }
-
--int amazon_pci_init(void)
-+int __init amazon_pci_init(void)
- {
- u32 temp_buffer;
-