Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
b57f1895
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b57f1895
编写于
9月 17, 2018
作者:
T
Tom Rini
浏览文件
操作
浏览文件
下载
差异文件
Merge
git://git.denx.de/u-boot-x86
上级
40e44c8b
6321da52
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
293 addition
and
3 deletion
+293
-3
arch/x86/cpu/tangier/Makefile
arch/x86/cpu/tangier/Makefile
+1
-1
arch/x86/cpu/tangier/pinmux.c
arch/x86/cpu/tangier/pinmux.c
+194
-0
arch/x86/dts/edison.dts
arch/x86/dts/edison.dts
+22
-0
arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
+10
-0
arch/x86/include/asm/scu.h
arch/x86/include/asm/scu.h
+4
-0
arch/x86/lib/scu.c
arch/x86/lib/scu.c
+62
-0
include/configs/x86-common.h
include/configs/x86-common.h
+0
-2
未找到文件。
arch/x86/cpu/tangier/Makefile
浏览文件 @
b57f1895
...
...
@@ -2,5 +2,5 @@
#
# Copyright (c) 2017 Intel Corporation
obj-y
+=
car.o tangier.o sdram.o sysreset.o
obj-y
+=
car.o tangier.o sdram.o sysreset.o
pinmux.o
obj-$(CONFIG_GENERATE_ACPI_TABLE)
+=
acpi.o
arch/x86/cpu/tangier/pinmux.c
0 → 100644
浏览文件 @
b57f1895
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2018 Emlid Limited
*/
#include <common.h>
#include <dm.h>
#include <dm/pinctrl.h>
#include <dm/read.h>
#include <regmap.h>
#include <syscon.h>
#include <asm/cpu.h>
#include <asm/scu.h>
#include <linux/io.h>
#define BUFCFG_OFFSET 0x100
#define MRFLD_FAMILY_LEN 0x400
/* These are taken from Linux kernel */
#define MRFLD_PINMODE_MASK 0x07
#define pin_to_bufno(f, p) ((p) - (f)->pin_base)
struct
mrfld_family
{
unsigned
int
family_number
;
unsigned
int
pin_base
;
size_t
npins
;
void
__iomem
*
regs
;
};
#define MRFLD_FAMILY(b, s, e) \
{ \
.family_number = (b), \
.pin_base = (s), \
.npins = (e) - (s) + 1, \
}
/* Now we only support I2C family of pins */
static
struct
mrfld_family
mrfld_families
[]
=
{
MRFLD_FAMILY
(
7
,
101
,
114
),
};
struct
mrfld_pinctrl
{
const
struct
mrfld_family
*
families
;
size_t
nfamilies
;
};
static
const
struct
mrfld_family
*
mrfld_get_family
(
struct
mrfld_pinctrl
*
mp
,
unsigned
int
pin
)
{
const
struct
mrfld_family
*
family
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
mp
->
nfamilies
;
i
++
)
{
family
=
&
mp
->
families
[
i
];
if
(
pin
>=
family
->
pin_base
&&
pin
<
family
->
pin_base
+
family
->
npins
)
return
family
;
}
pr_err
(
"failed to find family for pin %u
\n
"
,
pin
);
return
NULL
;
}
static
void
__iomem
*
mrfld_get_bufcfg
(
struct
mrfld_pinctrl
*
pinctrl
,
unsigned
int
pin
)
{
const
struct
mrfld_family
*
family
;
unsigned
int
bufno
;
family
=
mrfld_get_family
(
pinctrl
,
pin
);
if
(
!
family
)
return
NULL
;
bufno
=
pin_to_bufno
(
family
,
pin
);
return
family
->
regs
+
BUFCFG_OFFSET
+
bufno
*
4
;
}
static
void
mrfld_setup_families
(
void
*
base_addr
,
struct
mrfld_family
*
families
,
unsigned
int
nfam
)
{
for
(
int
i
=
0
;
i
<
nfam
;
i
++
)
{
struct
mrfld_family
*
family
=
&
families
[
i
];
family
->
regs
=
base_addr
+
family
->
family_number
*
MRFLD_FAMILY_LEN
;
}
}
static
int
mrfld_pinconfig_protected
(
unsigned
int
pin
,
u32
mask
,
u32
bits
)
{
struct
mrfld_pinctrl
*
pinctrl
;
struct
udevice
*
dev
;
void
__iomem
*
bufcfg
;
u32
v
,
value
;
int
ret
;
ret
=
syscon_get_by_driver_data
(
X86_SYSCON_PINCONF
,
&
dev
);
if
(
ret
)
return
ret
;
pinctrl
=
dev_get_priv
(
dev
);
bufcfg
=
mrfld_get_bufcfg
(
pinctrl
,
pin
);
if
(
!
bufcfg
)
return
-
EINVAL
;
value
=
readl
(
bufcfg
);
v
=
(
value
&
~
mask
)
|
(
bits
&
mask
);
debug
(
"scu: v: 0x%x p: 0x%x bits: %d, mask: %d bufcfg: 0x%p
\n
"
,
v
,
(
u32
)
bufcfg
,
bits
,
mask
,
bufcfg
);
ret
=
scu_ipc_raw_command
(
IPCMSG_INDIRECT_WRITE
,
0
,
&
v
,
4
,
NULL
,
0
,
(
u32
)
bufcfg
,
0
);
if
(
ret
)
pr_err
(
"Failed to set mode via SCU for pin %u (%d)
\n
"
,
pin
,
ret
);
return
ret
;
}
static
int
mrfld_pinctrl_cfg_pin
(
ofnode
pin_node
)
{
bool
is_protected
;
int
pad_offset
;
int
mode
;
u32
mask
;
int
ret
;
/* For now we only support just protected Family of pins */
is_protected
=
ofnode_read_bool
(
pin_node
,
"protected"
);
if
(
!
is_protected
)
return
-
ENOTSUPP
;
pad_offset
=
ofnode_read_s32_default
(
pin_node
,
"pad-offset"
,
-
1
);
if
(
pad_offset
==
-
1
)
return
-
EINVAL
;
mode
=
ofnode_read_s32_default
(
pin_node
,
"mode-func"
,
-
1
);
if
(
mode
==
-
1
)
return
-
EINVAL
;
mask
=
MRFLD_PINMODE_MASK
;
/* We don't support modes not in range 0..7 */
if
(
mode
&
~
mask
)
return
-
ENOTSUPP
;
ret
=
mrfld_pinconfig_protected
(
pad_offset
,
mask
,
mode
);
return
ret
;
}
static
int
tangier_pinctrl_probe
(
struct
udevice
*
dev
)
{
void
*
base_addr
=
syscon_get_first_range
(
X86_SYSCON_PINCONF
);
struct
mrfld_pinctrl
*
pinctrl
=
dev_get_priv
(
dev
);
ofnode
pin_node
;
int
ret
;
mrfld_setup_families
(
base_addr
,
mrfld_families
,
ARRAY_SIZE
(
mrfld_families
));
pinctrl
->
families
=
mrfld_families
;
pinctrl
->
nfamilies
=
ARRAY_SIZE
(
mrfld_families
);
ofnode_for_each_subnode
(
pin_node
,
dev_ofnode
(
dev
))
{
ret
=
mrfld_pinctrl_cfg_pin
(
pin_node
);
if
(
ret
)
{
pr_err
(
"%s: invalid configuration for the pin %ld
\n
"
,
__func__
,
pin_node
.
of_offset
);
}
}
return
0
;
}
static
const
struct
udevice_id
tangier_pinctrl_match
[]
=
{
{
.
compatible
=
"intel,pinctrl-tangier"
,
.
data
=
X86_SYSCON_PINCONF
},
{
/* sentinel */
}
};
U_BOOT_DRIVER
(
tangier_pinctrl
)
=
{
.
name
=
"tangier_pinctrl"
,
.
id
=
UCLASS_SYSCON
,
.
of_match
=
tangier_pinctrl_match
,
.
probe
=
tangier_pinctrl_probe
,
.
priv_auto_alloc_size
=
sizeof
(
struct
mrfld_pinctrl
),
};
arch/x86/dts/edison.dts
浏览文件 @
b57f1895
...
...
@@ -90,4 +90,26 @@
compatible = "intel,reset-tangier";
u-boot,dm-pre-reloc;
};
pinctrl {
compatible = "intel,pinctrl-tangier";
reg = <0xff0c0000 0x8000>;
/*
* Initial configuration came from the firmware.
* Which quite likely has been used in the phones, where I2C #8,
* that is not part of Atom peripheral, is in use.
* Thus we need to override the leftover.
*/
i2c6_scl@0 {
pad-offset = <111>;
mode-func = <1>;
protected;
};
i2c6_sda@0 {
pad-offset = <112>;
mode-func = <1>;
protected;
};
};
};
arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
浏览文件 @
b57f1895
...
...
@@ -221,6 +221,16 @@ Device (PCI0)
}
}
Device (I2C6)
{
Name (_ADR, 0x00090001)
Method (_STA, 0, NotSerialized)
{
Return (STA_VISIBLE)
}
}
Device (GPIO)
{
Name (_ADR, 0x000c0000)
...
...
arch/x86/include/asm/scu.h
浏览文件 @
b57f1895
...
...
@@ -6,6 +6,8 @@
#define _X86_ASM_SCU_IPC_H_
/* IPC defines the following message types */
#define IPCMSG_INDIRECT_READ 0x02
#define IPCMSG_INDIRECT_WRITE 0x05
#define IPCMSG_WARM_RESET 0xf0
#define IPCMSG_COLD_RESET 0xf1
#define IPCMSG_SOFT_RESET 0xf2
...
...
@@ -23,5 +25,7 @@ struct ipc_ifwi_version {
/* Issue commands to the SCU with or without data */
int
scu_ipc_simple_command
(
u32
cmd
,
u32
sub
);
int
scu_ipc_command
(
u32
cmd
,
u32
sub
,
u32
*
in
,
int
inlen
,
u32
*
out
,
int
outlen
);
int
scu_ipc_raw_command
(
u32
cmd
,
u32
sub
,
u32
*
in
,
int
inlen
,
u32
*
out
,
int
outlen
,
u32
dptr
,
u32
sptr
);
#endif
/* _X86_ASM_SCU_IPC_H_ */
arch/x86/lib/scu.c
浏览文件 @
b57f1895
...
...
@@ -101,6 +101,57 @@ static int scu_ipc_cmd(struct ipc_regs *regs, u32 cmd, u32 sub,
return
err
;
}
/**
* scu_ipc_raw_command() - IPC command with data and pointers
* @cmd: IPC command code
* @sub: IPC command sub type
* @in: input data of this IPC command
* @inlen: input data length in dwords
* @out: output data of this IPC command
* @outlen: output data length in dwords
* @dptr: data writing to SPTR register
* @sptr: data writing to DPTR register
*
* Send an IPC command to SCU with input/output data and source/dest pointers.
*
* Return: an IPC error code or 0 on success.
*/
int
scu_ipc_raw_command
(
u32
cmd
,
u32
sub
,
u32
*
in
,
int
inlen
,
u32
*
out
,
int
outlen
,
u32
dptr
,
u32
sptr
)
{
int
inbuflen
=
DIV_ROUND_UP
(
inlen
,
4
);
struct
udevice
*
dev
;
struct
scu
*
scu
;
int
ret
;
ret
=
syscon_get_by_driver_data
(
X86_SYSCON_SCU
,
&
dev
);
if
(
ret
)
return
ret
;
scu
=
dev_get_priv
(
dev
);
/* Up to 16 bytes */
if
(
inbuflen
>
4
)
return
-
EINVAL
;
writel
(
dptr
,
&
scu
->
regs
->
dptr
);
writel
(
sptr
,
&
scu
->
regs
->
sptr
);
/*
* SRAM controller doesn't support 8-bit writes, it only
* supports 32-bit writes, so we have to copy input data into
* the temporary buffer, and SCU FW will use the inlen to
* determine the actual input data length in the temporary
* buffer.
*/
u32
inbuf
[
4
]
=
{
0
};
memcpy
(
inbuf
,
in
,
inlen
);
return
scu_ipc_cmd
(
scu
->
regs
,
cmd
,
sub
,
inbuf
,
inlen
,
out
,
outlen
);
}
/**
* scu_ipc_simple_command() - send a simple command
* @cmd: command
...
...
@@ -129,6 +180,17 @@ int scu_ipc_simple_command(u32 cmd, u32 sub)
return
scu_ipc_check_status
(
scu
->
regs
);
}
/**
* scu_ipc_command - command with data
* @cmd: command
* @sub: sub type
* @in: input data
* @inlen: input length in dwords
* @out: output data
* @outlen: output length in dwords
*
* Issue a command to the SCU which involves data transfers.
*/
int
scu_ipc_command
(
u32
cmd
,
u32
sub
,
u32
*
in
,
int
inlen
,
u32
*
out
,
int
outlen
)
{
struct
scu
*
scu
;
...
...
include/configs/x86-common.h
浏览文件 @
b57f1895
...
...
@@ -47,8 +47,6 @@
/*-----------------------------------------------------------------------
* Serial Configuration
*/
#define CONFIG_SYS_BAUDRATE_TABLE {300, 600, 1200, 2400, 4800, \
9600, 19200, 38400, 115200}
#define CONFIG_SYS_NS16550_PORT_MAPPED
/*-----------------------------------------------------------------------
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录