Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
144c7494
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
144c7494
编写于
8月 20, 2010
作者:
P
Paul Mundt
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'sh/pci-express-integration'
上级
d2d5bc58
65c23f54
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
21 deletion
+36
-21
arch/sh/drivers/pci/ops-sh7786.c
arch/sh/drivers/pci/ops-sh7786.c
+18
-9
arch/sh/drivers/pci/pcie-sh7786.c
arch/sh/drivers/pci/pcie-sh7786.c
+18
-12
未找到文件。
arch/sh/drivers/pci/ops-sh7786.c
浏览文件 @
144c7494
/*
* Generic SH7786 PCI-Express operations.
*
* Copyright (C) 2009 Paul Mundt
* Copyright (C) 2009
- 2010
Paul Mundt
*
* This file is subject to the terms and conditions of the GNU General Public
* License v2. See the file "COPYING" in the main directory of this archive
...
...
@@ -25,32 +25,39 @@ static int sh7786_pcie_config_access(unsigned char access_type,
struct
pci_bus
*
bus
,
unsigned
int
devfn
,
int
where
,
u32
*
data
)
{
struct
pci_channel
*
chan
=
bus
->
sysdata
;
int
dev
,
func
;
int
dev
,
func
,
type
;
dev
=
PCI_SLOT
(
devfn
);
func
=
PCI_FUNC
(
devfn
);
type
=
!!
bus
->
parent
;
if
(
bus
->
number
>
255
||
dev
>
31
||
func
>
7
)
return
PCIBIOS_FUNC_NOT_SUPPORTED
;
if
(
devfn
)
if
(
bus
->
parent
==
NULL
&&
dev
)
return
PCIBIOS_DEVICE_NOT_FOUND
;
/* Clear errors */
pci_write_reg
(
chan
,
pci_read_reg
(
chan
,
SH4A_PCIEERRFR
),
SH4A_PCIEERRFR
);
/* Set the PIO address */
pci_write_reg
(
chan
,
(
bus
->
number
<<
24
)
|
(
dev
<<
19
)
|
(
func
<<
16
)
|
(
where
&
~
3
),
SH4A_PCIEPAR
);
/* Enable the configuration access */
pci_write_reg
(
chan
,
(
1
<<
31
),
SH4A_PCIEPCTLR
);
pci_write_reg
(
chan
,
(
1
<<
31
)
|
(
type
<<
8
),
SH4A_PCIEPCTLR
);
/* Check for errors */
if
(
pci_read_reg
(
chan
,
SH4A_PCIEERRFR
)
&
0x10
)
return
PCIBIOS_DEVICE_NOT_FOUND
;
/* Check for master and target aborts */
if
(
pci_read_reg
(
chan
,
SH4A_PCIEPCICONF1
)
&
((
1
<<
29
)
|
(
1
<<
28
)))
return
PCIBIOS_DEVICE_NOT_FOUND
;
if
(
access_type
==
PCI_ACCESS_READ
)
*
data
=
pci_read_reg
(
chan
,
SH4A_PCIEPDR
);
else
pci_write_reg
(
chan
,
*
data
,
SH4A_PCIEPDR
);
/* Check for master and target aborts */
if
(
pci_read_reg
(
chan
,
SH4A_PCIEPCICONF1
)
&
((
1
<<
29
)
|
(
1
<<
28
)))
return
PCIBIOS_DEVICE_NOT_FOUND
;
return
PCIBIOS_SUCCESSFUL
;
}
...
...
@@ -69,8 +76,10 @@ static int sh7786_pcie_read(struct pci_bus *bus, unsigned int devfn,
spin_lock_irqsave
(
&
sh7786_pcie_lock
,
flags
);
ret
=
sh7786_pcie_config_access
(
PCI_ACCESS_READ
,
bus
,
devfn
,
where
,
&
data
);
if
(
ret
!=
PCIBIOS_SUCCESSFUL
)
if
(
ret
!=
PCIBIOS_SUCCESSFUL
)
{
*
val
=
0xffffffff
;
goto
out
;
}
if
(
size
==
1
)
*
val
=
(
data
>>
((
where
&
3
)
<<
3
))
&
0xff
;
...
...
arch/sh/drivers/pci/pcie-sh7786.c
浏览文件 @
144c7494
...
...
@@ -148,16 +148,11 @@ static int pci_wait_for_irq(struct pci_channel *chan, unsigned int mask)
static
void
phy_write_reg
(
struct
pci_channel
*
chan
,
unsigned
int
addr
,
unsigned
int
lane
,
unsigned
int
data
)
{
unsigned
long
phyaddr
,
ctrl
;
unsigned
long
phyaddr
;
phyaddr
=
(
1
<<
BITS_CMD
)
+
((
lane
&
0xf
)
<<
BITS_LANE
)
+
((
addr
&
0xff
)
<<
BITS_ADR
);
/* Enable clock */
ctrl
=
pci_read_reg
(
chan
,
SH4A_PCIEPHYCTLR
);
ctrl
|=
(
1
<<
BITS_CKE
);
pci_write_reg
(
chan
,
ctrl
,
SH4A_PCIEPHYCTLR
);
/* Set write data */
pci_write_reg
(
chan
,
data
,
SH4A_PCIEPHYDOUTR
);
pci_write_reg
(
chan
,
phyaddr
,
SH4A_PCIEPHYADRR
);
...
...
@@ -165,20 +160,22 @@ static void phy_write_reg(struct pci_channel *chan, unsigned int addr,
phy_wait_for_ack
(
chan
);
/* Clear command */
pci_write_reg
(
chan
,
0
,
SH4A_PCIEPHYDOUTR
);
pci_write_reg
(
chan
,
0
,
SH4A_PCIEPHYADRR
);
phy_wait_for_ack
(
chan
);
/* Disable clock */
ctrl
=
pci_read_reg
(
chan
,
SH4A_PCIEPHYCTLR
);
ctrl
&=
~
(
1
<<
BITS_CKE
);
pci_write_reg
(
chan
,
ctrl
,
SH4A_PCIEPHYCTLR
);
}
static
int
phy_init
(
struct
pci_channel
*
chan
)
{
unsigned
long
ctrl
;
unsigned
int
timeout
=
100
;
/* Enable clock */
ctrl
=
pci_read_reg
(
chan
,
SH4A_PCIEPHYCTLR
);
ctrl
|=
(
1
<<
BITS_CKE
);
pci_write_reg
(
chan
,
ctrl
,
SH4A_PCIEPHYCTLR
);
/* Initialize the phy */
phy_write_reg
(
chan
,
0x60
,
0xf
,
0x004b008b
);
phy_write_reg
(
chan
,
0x61
,
0xf
,
0x00007b41
);
...
...
@@ -187,9 +184,15 @@ static int phy_init(struct pci_channel *chan)
phy_write_reg
(
chan
,
0x66
,
0xf
,
0x00000010
);
phy_write_reg
(
chan
,
0x74
,
0xf
,
0x0007001c
);
phy_write_reg
(
chan
,
0x79
,
0xf
,
0x01fc000d
);
phy_write_reg
(
chan
,
0xb0
,
0xf
,
0x00000610
);
/* Deassert Standby */
phy_write_reg
(
chan
,
0x67
,
0xf
,
0x00000400
);
phy_write_reg
(
chan
,
0x67
,
0x1
,
0x00000400
);
/* Disable clock */
ctrl
=
pci_read_reg
(
chan
,
SH4A_PCIEPHYCTLR
);
ctrl
&=
~
(
1
<<
BITS_CKE
);
pci_write_reg
(
chan
,
ctrl
,
SH4A_PCIEPHYCTLR
);
while
(
timeout
--
)
{
if
(
pci_read_reg
(
chan
,
SH4A_PCIEPHYSR
))
...
...
@@ -287,6 +290,9 @@ static int pcie_init(struct sh7786_pcie_port *port)
__raw_writel
(
memphys
,
chan
->
reg_base
+
SH4A_PCIELAR0
);
__raw_writel
((
memsize
-
SZ_256
)
|
1
,
chan
->
reg_base
+
SH4A_PCIELAMR0
);
__raw_writel
(
memphys
,
chan
->
reg_base
+
SH4A_PCIEPCICONF4
);
__raw_writel
(
0
,
chan
->
reg_base
+
SH4A_PCIEPCICONF5
);
/* Finish initialization */
data
=
pci_read_reg
(
chan
,
SH4A_PCIETCTLR
);
data
|=
0x1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录