Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
3444f5ec
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3444f5ec
编写于
4月 20, 2009
作者:
P
Paul Mundt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sh: pci: Tidy up the dreamcast PCI support.
Signed-off-by:
N
Paul Mundt
<
lethal@linux-sh.org
>
上级
0db38cea
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
119 addition
and
89 deletion
+119
-89
arch/sh/drivers/pci/Makefile
arch/sh/drivers/pci/Makefile
+2
-1
arch/sh/drivers/pci/ops-dreamcast.c
arch/sh/drivers/pci/ops-dreamcast.c
+10
-88
arch/sh/drivers/pci/pci-dreamcast.c
arch/sh/drivers/pci/pci-dreamcast.c
+105
-0
arch/sh/include/mach-dreamcast/mach/pci.h
arch/sh/include/mach-dreamcast/mach/pci.h
+2
-0
未找到文件。
arch/sh/drivers/pci/Makefile
浏览文件 @
3444f5ec
...
...
@@ -12,7 +12,8 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7780) += pci-sh7780.o ops-sh4.o
obj-$(CONFIG_CPU_SUBTYPE_SH7785)
+=
pci-sh7780.o ops-sh4.o
obj-$(CONFIG_CPU_SH5)
+=
pci-sh5.o ops-sh5.o
obj-$(CONFIG_SH_DREAMCAST)
+=
ops-dreamcast.o fixups-dreamcast.o
obj-$(CONFIG_SH_DREAMCAST)
+=
ops-dreamcast.o fixups-dreamcast.o
\
pci-dreamcast.o
obj-$(CONFIG_SH_SECUREEDGE5410)
+=
ops-snapgear.o
obj-$(CONFIG_SH_RTS7751R2D)
+=
ops-rts7751r2d.o fixups-rts7751r2d.o
obj-$(CONFIG_SH_SH03)
+=
ops-sh03.o fixups-sh03.o
...
...
arch/sh/drivers/pci/ops-dreamcast.c
浏览文件 @
3444f5ec
/*
* arch/sh/drivers/pci/ops-dreamcast.c
*
* PCI operations for the Sega Dreamcast
*
* Copyright (C) 2001, 2002 M. R. Brown
* Copyright (C) 2002, 2003 Paul Mundt
*
* This file originally bore the message (with enclosed-$):
* Id: pci.c,v 1.3 2003/05/04 19:29:46 lethal Exp
* Dreamcast PCI: Supports SEGA Broadband Adaptor only.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
...
...
@@ -23,25 +17,10 @@
#include <linux/irq.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <mach/pci.h>
static
struct
resource
gapspci_io_resource
=
{
.
name
=
"GAPSPCI IO"
,
.
start
=
GAPSPCI_BBA_CONFIG
,
.
end
=
GAPSPCI_BBA_CONFIG
+
GAPSPCI_BBA_CONFIG_SIZE
-
1
,
.
flags
=
IORESOURCE_IO
,
};
static
struct
resource
gapspci_mem_resource
=
{
.
name
=
"GAPSPCI mem"
,
.
start
=
GAPSPCI_DMA_BASE
,
.
end
=
GAPSPCI_DMA_BASE
+
GAPSPCI_DMA_SIZE
-
1
,
.
flags
=
IORESOURCE_MEM
,
};
/*
* The !gapspci_config_access case really shouldn't happen, ever, unless
* someone implicitly messes around with the last devfn value.. otherwise we
...
...
@@ -76,10 +55,10 @@ static int gapspci_read(struct pci_bus *bus, unsigned int devfn, int where, int
return
PCIBIOS_DEVICE_NOT_FOUND
;
switch
(
size
)
{
case
1
:
*
val
=
inb
(
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
2
:
*
val
=
inw
(
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
4
:
*
val
=
inl
(
GAPSPCI_BBA_CONFIG
+
where
);
break
;
}
case
1
:
*
val
=
inb
(
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
2
:
*
val
=
inw
(
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
4
:
*
val
=
inl
(
GAPSPCI_BBA_CONFIG
+
where
);
break
;
}
return
PCIBIOS_SUCCESSFUL
;
}
...
...
@@ -90,72 +69,15 @@ static int gapspci_write(struct pci_bus *bus, unsigned int devfn, int where, int
return
PCIBIOS_DEVICE_NOT_FOUND
;
switch
(
size
)
{
case
1
:
outb
((
u8
)
val
,
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
2
:
outw
((
u16
)
val
,
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
4
:
outl
((
u32
)
val
,
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
1
:
outb
((
u8
)
val
,
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
2
:
outw
((
u16
)
val
,
GAPSPCI_BBA_CONFIG
+
where
);
break
;
case
4
:
outl
((
u32
)
val
,
GAPSPCI_BBA_CONFIG
+
where
);
break
;
}
return
PCIBIOS_SUCCESSFUL
;
}
st
atic
st
ruct
pci_ops
gapspci_pci_ops
=
{
struct
pci_ops
gapspci_pci_ops
=
{
.
read
=
gapspci_read
,
.
write
=
gapspci_write
,
};
/*
* gapspci init
*/
static
int
__init
gapspci_init
(
struct
pci_channel
*
chan
)
{
char
idbuf
[
16
];
int
i
;
/*
* FIXME: All of this wants documenting to some degree,
* even some basic register definitions would be nice.
*
* I haven't seen anything this ugly since.. maple.
*/
for
(
i
=
0
;
i
<
16
;
i
++
)
idbuf
[
i
]
=
inb
(
GAPSPCI_REGS
+
i
);
if
(
strncmp
(
idbuf
,
"GAPSPCI_BRIDGE_2"
,
16
))
return
-
ENODEV
;
outl
(
0x5a14a501
,
GAPSPCI_REGS
+
0x18
);
for
(
i
=
0
;
i
<
1000000
;
i
++
)
;
if
(
inl
(
GAPSPCI_REGS
+
0x18
)
!=
1
)
return
-
EINVAL
;
outl
(
0x01000000
,
GAPSPCI_REGS
+
0x20
);
outl
(
0x01000000
,
GAPSPCI_REGS
+
0x24
);
outl
(
GAPSPCI_DMA_BASE
,
GAPSPCI_REGS
+
0x28
);
outl
(
GAPSPCI_DMA_BASE
+
GAPSPCI_DMA_SIZE
,
GAPSPCI_REGS
+
0x2c
);
outl
(
1
,
GAPSPCI_REGS
+
0x14
);
outl
(
1
,
GAPSPCI_REGS
+
0x34
);
/* Setting Broadband Adapter */
outw
(
0xf900
,
GAPSPCI_BBA_CONFIG
+
0x06
);
outl
(
0x00000000
,
GAPSPCI_BBA_CONFIG
+
0x30
);
outb
(
0x00
,
GAPSPCI_BBA_CONFIG
+
0x3c
);
outb
(
0xf0
,
GAPSPCI_BBA_CONFIG
+
0x0d
);
outw
(
0x0006
,
GAPSPCI_BBA_CONFIG
+
0x04
);
outl
(
0x00002001
,
GAPSPCI_BBA_CONFIG
+
0x10
);
outl
(
0x01000000
,
GAPSPCI_BBA_CONFIG
+
0x14
);
return
0
;
}
struct
pci_channel
board_pci_channels
[]
=
{
{
gapspci_init
,
&
gapspci_pci_ops
,
&
gapspci_io_resource
,
&
gapspci_mem_resource
,
0
,
1
},
{
0
,
}
};
arch/sh/drivers/pci/pci-dreamcast.c
0 → 100644
浏览文件 @
3444f5ec
/*
* PCI support for the Sega Dreamcast
*
* Copyright (C) 2001, 2002 M. R. Brown
* Copyright (C) 2002, 2003 Paul Mundt
*
* This file originally bore the message (with enclosed-$):
* Id: pci.c,v 1.3 2003/05/04 19:29:46 lethal Exp
* Dreamcast PCI: Supports SEGA Broadband Adaptor only.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <mach/pci.h>
static
struct
resource
gapspci_io_resource
=
{
.
name
=
"GAPSPCI IO"
,
.
start
=
GAPSPCI_BBA_CONFIG
,
.
end
=
GAPSPCI_BBA_CONFIG
+
GAPSPCI_BBA_CONFIG_SIZE
-
1
,
.
flags
=
IORESOURCE_IO
,
};
static
struct
resource
gapspci_mem_resource
=
{
.
name
=
"GAPSPCI mem"
,
.
start
=
GAPSPCI_DMA_BASE
,
.
end
=
GAPSPCI_DMA_BASE
+
GAPSPCI_DMA_SIZE
-
1
,
.
flags
=
IORESOURCE_MEM
,
};
/*
* gapspci init
*/
static
int
__init
gapspci_init
(
struct
pci_channel
*
chan
)
{
char
idbuf
[
16
];
int
i
;
/*
* FIXME: All of this wants documenting to some degree,
* even some basic register definitions would be nice.
*
* I haven't seen anything this ugly since.. maple.
*/
for
(
i
=
0
;
i
<
16
;
i
++
)
idbuf
[
i
]
=
inb
(
GAPSPCI_REGS
+
i
);
if
(
strncmp
(
idbuf
,
"GAPSPCI_BRIDGE_2"
,
16
))
return
-
ENODEV
;
outl
(
0x5a14a501
,
GAPSPCI_REGS
+
0x18
);
for
(
i
=
0
;
i
<
1000000
;
i
++
)
cpu_relax
();
if
(
inl
(
GAPSPCI_REGS
+
0x18
)
!=
1
)
return
-
EINVAL
;
outl
(
0x01000000
,
GAPSPCI_REGS
+
0x20
);
outl
(
0x01000000
,
GAPSPCI_REGS
+
0x24
);
outl
(
GAPSPCI_DMA_BASE
,
GAPSPCI_REGS
+
0x28
);
outl
(
GAPSPCI_DMA_BASE
+
GAPSPCI_DMA_SIZE
,
GAPSPCI_REGS
+
0x2c
);
outl
(
1
,
GAPSPCI_REGS
+
0x14
);
outl
(
1
,
GAPSPCI_REGS
+
0x34
);
/* Setting Broadband Adapter */
outw
(
0xf900
,
GAPSPCI_BBA_CONFIG
+
0x06
);
outl
(
0x00000000
,
GAPSPCI_BBA_CONFIG
+
0x30
);
outb
(
0x00
,
GAPSPCI_BBA_CONFIG
+
0x3c
);
outb
(
0xf0
,
GAPSPCI_BBA_CONFIG
+
0x0d
);
outw
(
0x0006
,
GAPSPCI_BBA_CONFIG
+
0x04
);
outl
(
0x00002001
,
GAPSPCI_BBA_CONFIG
+
0x10
);
outl
(
0x01000000
,
GAPSPCI_BBA_CONFIG
+
0x14
);
return
0
;
}
struct
pci_channel
board_pci_channels
[]
=
{
{
.
init
=
gapspci_init
,
.
pci_ops
=
&
gapspci_pci_ops
,
.
io_resource
=
&
gapspci_io_resource
,
.
mem_resource
=
&
gapspci_mem_resource
,
.
first_devfn
=
0
,
.
last_devfn
=
1
,
},
{
.
init
=
NULL
,
}
};
arch/sh/include/mach-dreamcast/mach/pci.h
浏览文件 @
3444f5ec
...
...
@@ -21,5 +21,7 @@
#define GAPSPCI_IRQ HW_EVENT_EXTERNAL
extern
struct
pci_ops
gapspci_pci_ops
;
#endif
/* __ASM_SH_DREAMCAST_PCI_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录