Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
08d4f0c8
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
08d4f0c8
编写于
3月 01, 2014
作者:
J
Jason Cooper
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'shesselba/for-mvebu/pinctrl-dove' into mvebu/pinctrl
上级
55387764
6da67cab
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
202 addition
and
113 deletion
+202
-113
Documentation/devicetree/bindings/arm/marvell,dove.txt
Documentation/devicetree/bindings/arm/marvell,dove.txt
+22
-0
Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt
...evicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt
+1
-0
Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt
...devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt
+1
-0
Documentation/devicetree/bindings/pinctrl/marvell,dove-pinctrl.txt
...tion/devicetree/bindings/pinctrl/marvell,dove-pinctrl.txt
+1
-0
Documentation/devicetree/bindings/pinctrl/marvell,kirkwood-pinctrl.txt
.../devicetree/bindings/pinctrl/marvell,kirkwood-pinctrl.txt
+1
-0
Documentation/devicetree/bindings/pinctrl/marvell,mvebu-pinctrl.txt
...ion/devicetree/bindings/pinctrl/marvell,mvebu-pinctrl.txt
+1
-1
drivers/pinctrl/mvebu/Kconfig
drivers/pinctrl/mvebu/Kconfig
+1
-0
drivers/pinctrl/mvebu/pinctrl-dove.c
drivers/pinctrl/mvebu/pinctrl-dove.c
+174
-112
未找到文件。
Documentation/devicetree/bindings/arm/marvell,dove.txt
0 → 100644
浏览文件 @
08d4f0c8
Marvell Dove Platforms Device Tree Bindings
-----------------------------------------------
Boards with a Marvell Dove SoC shall have the following properties:
Required root node property:
- compatible: must contain "marvell,dove";
* Global Configuration registers
Global Configuration registers of Dove SoC are shared by a syscon node.
Required properties:
- compatible: must contain "marvell,dove-global-config" and "syscon".
- reg: base address and size of the Global Configuration registers.
Example:
gconf: global-config@e802c {
compatible = "marvell,dove-global-config", "syscon";
reg = <0xe802c 0x14>;
};
Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt
浏览文件 @
08d4f0c8
...
...
@@ -5,6 +5,7 @@ part and usage.
Required properties:
- compatible: "marvell,88f6710-pinctrl"
- reg: register specifier of MPP registers
Available mpp pins/groups and functions:
Note: brackets (x) are not part of the mpp name for marvell,function and given
...
...
Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt
浏览文件 @
08d4f0c8
...
...
@@ -6,6 +6,7 @@ part and usage.
Required properties:
- compatible: "marvell,mv78230-pinctrl", "marvell,mv78260-pinctrl",
"marvell,mv78460-pinctrl"
- reg: register specifier of MPP registers
This driver supports all Armada XP variants, i.e. mv78230, mv78260, and mv78460.
...
...
Documentation/devicetree/bindings/pinctrl/marvell,dove-pinctrl.txt
浏览文件 @
08d4f0c8
...
...
@@ -6,6 +6,7 @@ part and usage.
Required properties:
- compatible: "marvell,dove-pinctrl"
- clocks: (optional) phandle of pdma clock
- reg: register specifiers of MPP, MPP4, and PMU MPP registers
Available mpp pins/groups and functions:
Note: brackets (x) are not part of the mpp name for marvell,function and given
...
...
Documentation/devicetree/bindings/pinctrl/marvell,kirkwood-pinctrl.txt
浏览文件 @
08d4f0c8
...
...
@@ -8,6 +8,7 @@ Required properties:
"marvell,88f6190-pinctrl", "marvell,88f6192-pinctrl",
"marvell,88f6281-pinctrl", "marvell,88f6282-pinctrl"
"marvell,98dx4122-pinctrl"
- reg: register specifier of MPP registers
This driver supports all kirkwood variants, i.e. 88f6180, 88f619x, and 88f628x.
It also support the 88f6281-based variant in the 98dx412x Bobcat SoCs.
...
...
Documentation/devicetree/bindings/pinctrl/marvell,mvebu-pinctrl.txt
浏览文件 @
08d4f0c8
...
...
@@ -37,7 +37,7 @@ uart1: serial@12100 {
pinctrl: pinctrl@d0200 {
compatible = "marvell,dove-pinctrl";
reg = <0xd0200 0x
20
>;
reg = <0xd0200 0x
14>, <0xd0440 0x04>, <0xd802c 0x08
>;
pmx_uart1_sw: pmx-uart1-sw {
marvell,pins = "mpp_uart1";
...
...
drivers/pinctrl/mvebu/Kconfig
浏览文件 @
08d4f0c8
...
...
@@ -8,6 +8,7 @@ config PINCTRL_MVEBU
config PINCTRL_DOVE
bool
select PINCTRL_MVEBU
select MFD_SYSCON
config PINCTRL_KIRKWOOD
bool
...
...
drivers/pinctrl/mvebu/pinctrl-dove.c
浏览文件 @
08d4f0c8
...
...
@@ -18,40 +18,53 @@
#include <linux/clk.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/mfd/syscon.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/regmap.h>
#include "pinctrl-mvebu.h"
#define DOVE_SB_REGS_VIRT_BASE IOMEM(0xfde00000)
#define DOVE_MPP_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0200)
#define DOVE_PMU_MPP_GENERAL_CTRL (DOVE_MPP_VIRT_BASE + 0x10)
#define DOVE_AU0_AC97_SEL BIT(16)
#define DOVE_PMU_SIGNAL_SELECT_0 (DOVE_SB_REGS_VIRT_BASE + 0xd802C)
#define DOVE_PMU_SIGNAL_SELECT_1 (DOVE_SB_REGS_VIRT_BASE + 0xd8030)
#define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C)
#define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C)
#define DOVE_TWSI_ENABLE_OPTION1 BIT(7)
#define DOVE_GLOBAL_CONFIG_2 (DOVE_SB_REGS_VIRT_BASE + 0xe8030)
#define DOVE_TWSI_ENABLE_OPTION2 BIT(20)
#define DOVE_TWSI_ENABLE_OPTION3 BIT(21)
#define DOVE_TWSI_OPTION3_GPIO BIT(22)
#define DOVE_SSP_CTRL_STATUS_1 (DOVE_SB_REGS_VIRT_BASE + 0xe8034)
#define DOVE_SSP_ON_AU1 BIT(0)
#define DOVE_MPP_GENERAL_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xe803c)
#define DOVE_AU1_SPDIFO_GPIO_EN BIT(1)
#define DOVE_NAND_GPIO_EN BIT(0)
#define DOVE_GPIO_LO_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0400)
#define DOVE_MPP_CTRL4_VIRT_BASE (DOVE_GPIO_LO_VIRT_BASE + 0x40)
#define DOVE_SPI_GPIO_SEL BIT(5)
#define DOVE_UART1_GPIO_SEL BIT(4)
#define DOVE_AU1_GPIO_SEL BIT(3)
#define DOVE_CAM_GPIO_SEL BIT(2)
#define DOVE_SD1_GPIO_SEL BIT(1)
#define DOVE_SD0_GPIO_SEL BIT(0)
/* Internal registers can be configured at any 1 MiB aligned address */
#define INT_REGS_MASK ~(SZ_1M - 1)
#define MPP4_REGS_OFFS 0xd0440
#define PMU_REGS_OFFS 0xd802c
#define GC_REGS_OFFS 0xe802c
/* MPP Base registers */
#define PMU_MPP_GENERAL_CTRL 0x10
#define AU0_AC97_SEL BIT(16)
/* MPP Control 4 register */
#define SPI_GPIO_SEL BIT(5)
#define UART1_GPIO_SEL BIT(4)
#define AU1_GPIO_SEL BIT(3)
#define CAM_GPIO_SEL BIT(2)
#define SD1_GPIO_SEL BIT(1)
#define SD0_GPIO_SEL BIT(0)
/* PMU Signal Select registers */
#define PMU_SIGNAL_SELECT_0 0x00
#define PMU_SIGNAL_SELECT_1 0x04
/* Global Config regmap registers */
#define GLOBAL_CONFIG_1 0x00
#define TWSI_ENABLE_OPTION1 BIT(7)
#define GLOBAL_CONFIG_2 0x04
#define TWSI_ENABLE_OPTION2 BIT(20)
#define TWSI_ENABLE_OPTION3 BIT(21)
#define TWSI_OPTION3_GPIO BIT(22)
#define SSP_CTRL_STATUS_1 0x08
#define SSP_ON_AU1 BIT(0)
#define MPP_GENERAL_CONFIG 0x10
#define AU1_SPDIFO_GPIO_EN BIT(1)
#define NAND_GPIO_EN BIT(0)
#define CONFIG_PMU BIT(4)
static
void
__iomem
*
mpp_base
;
static
void
__iomem
*
mpp4_base
;
static
void
__iomem
*
pmu_base
;
static
struct
regmap
*
gconfmap
;
static
int
dove_mpp_ctrl_get
(
unsigned
pid
,
unsigned
long
*
config
)
{
...
...
@@ -67,13 +80,13 @@ static int dove_pmu_mpp_ctrl_get(unsigned pid, unsigned long *config)
{
unsigned
off
=
(
pid
/
MVEBU_MPPS_PER_REG
)
*
MVEBU_MPP_BITS
;
unsigned
shift
=
(
pid
%
MVEBU_MPPS_PER_REG
)
*
MVEBU_MPP_BITS
;
unsigned
long
pmu
=
readl
(
DOVE_
PMU_MPP_GENERAL_CTRL
);
unsigned
long
pmu
=
readl
(
mpp_base
+
PMU_MPP_GENERAL_CTRL
);
unsigned
long
func
;
if
((
pmu
&
BIT
(
pid
))
==
0
)
return
default_mpp_ctrl_get
(
mpp_base
,
pid
,
config
);
func
=
readl
(
DOVE_
PMU_SIGNAL_SELECT_0
+
off
);
func
=
readl
(
pmu_base
+
PMU_SIGNAL_SELECT_0
+
off
);
*
config
=
(
func
>>
shift
)
&
MVEBU_MPP_MASK
;
*
config
|=
CONFIG_PMU
;
...
...
@@ -84,43 +97,43 @@ static int dove_pmu_mpp_ctrl_set(unsigned pid, unsigned long config)
{
unsigned
off
=
(
pid
/
MVEBU_MPPS_PER_REG
)
*
MVEBU_MPP_BITS
;
unsigned
shift
=
(
pid
%
MVEBU_MPPS_PER_REG
)
*
MVEBU_MPP_BITS
;
unsigned
long
pmu
=
readl
(
DOVE_
PMU_MPP_GENERAL_CTRL
);
unsigned
long
pmu
=
readl
(
mpp_base
+
PMU_MPP_GENERAL_CTRL
);
unsigned
long
func
;
if
((
config
&
CONFIG_PMU
)
==
0
)
{
writel
(
pmu
&
~
BIT
(
pid
),
DOVE_
PMU_MPP_GENERAL_CTRL
);
writel
(
pmu
&
~
BIT
(
pid
),
mpp_base
+
PMU_MPP_GENERAL_CTRL
);
return
default_mpp_ctrl_set
(
mpp_base
,
pid
,
config
);
}
writel
(
pmu
|
BIT
(
pid
),
DOVE_
PMU_MPP_GENERAL_CTRL
);
func
=
readl
(
DOVE_
PMU_SIGNAL_SELECT_0
+
off
);
writel
(
pmu
|
BIT
(
pid
),
mpp_base
+
PMU_MPP_GENERAL_CTRL
);
func
=
readl
(
pmu_base
+
PMU_SIGNAL_SELECT_0
+
off
);
func
&=
~
(
MVEBU_MPP_MASK
<<
shift
);
func
|=
(
config
&
MVEBU_MPP_MASK
)
<<
shift
;
writel
(
func
,
DOVE_
PMU_SIGNAL_SELECT_0
+
off
);
writel
(
func
,
pmu_base
+
PMU_SIGNAL_SELECT_0
+
off
);
return
0
;
}
static
int
dove_mpp4_ctrl_get
(
unsigned
pid
,
unsigned
long
*
config
)
{
unsigned
long
mpp4
=
readl
(
DOVE_MPP_CTRL4_VIRT_BASE
);
unsigned
long
mpp4
=
readl
(
mpp4_base
);
unsigned
long
mask
;
switch
(
pid
)
{
case
24
:
/* mpp_camera */
mask
=
DOVE_
CAM_GPIO_SEL
;
mask
=
CAM_GPIO_SEL
;
break
;
case
40
:
/* mpp_sdio0 */
mask
=
DOVE_
SD0_GPIO_SEL
;
mask
=
SD0_GPIO_SEL
;
break
;
case
46
:
/* mpp_sdio1 */
mask
=
DOVE_
SD1_GPIO_SEL
;
mask
=
SD1_GPIO_SEL
;
break
;
case
58
:
/* mpp_spi0 */
mask
=
DOVE_
SPI_GPIO_SEL
;
mask
=
SPI_GPIO_SEL
;
break
;
case
62
:
/* mpp_uart1 */
mask
=
DOVE_
UART1_GPIO_SEL
;
mask
=
UART1_GPIO_SEL
;
break
;
default:
return
-
EINVAL
;
...
...
@@ -133,24 +146,24 @@ static int dove_mpp4_ctrl_get(unsigned pid, unsigned long *config)
static
int
dove_mpp4_ctrl_set
(
unsigned
pid
,
unsigned
long
config
)
{
unsigned
long
mpp4
=
readl
(
DOVE_MPP_CTRL4_VIRT_BASE
);
unsigned
long
mpp4
=
readl
(
mpp4_base
);
unsigned
long
mask
;
switch
(
pid
)
{
case
24
:
/* mpp_camera */
mask
=
DOVE_
CAM_GPIO_SEL
;
mask
=
CAM_GPIO_SEL
;
break
;
case
40
:
/* mpp_sdio0 */
mask
=
DOVE_
SD0_GPIO_SEL
;
mask
=
SD0_GPIO_SEL
;
break
;
case
46
:
/* mpp_sdio1 */
mask
=
DOVE_
SD1_GPIO_SEL
;
mask
=
SD1_GPIO_SEL
;
break
;
case
58
:
/* mpp_spi0 */
mask
=
DOVE_
SPI_GPIO_SEL
;
mask
=
SPI_GPIO_SEL
;
break
;
case
62
:
/* mpp_uart1 */
mask
=
DOVE_
UART1_GPIO_SEL
;
mask
=
UART1_GPIO_SEL
;
break
;
default:
return
-
EINVAL
;
...
...
@@ -160,69 +173,69 @@ static int dove_mpp4_ctrl_set(unsigned pid, unsigned long config)
if
(
config
)
mpp4
|=
mask
;
writel
(
mpp4
,
DOVE_MPP_CTRL4_VIRT_BASE
);
writel
(
mpp4
,
mpp4_base
);
return
0
;
}
static
int
dove_nand_ctrl_get
(
unsigned
pid
,
unsigned
long
*
config
)
{
unsigned
long
gmpp
=
readl
(
DOVE_MPP_GENERAL_VIRT_BASE
)
;
unsigned
int
gmpp
;
*
config
=
((
gmpp
&
DOVE_NAND_GPIO_EN
)
!=
0
);
regmap_read
(
gconfmap
,
MPP_GENERAL_CONFIG
,
&
gmpp
);
*
config
=
((
gmpp
&
NAND_GPIO_EN
)
!=
0
);
return
0
;
}
static
int
dove_nand_ctrl_set
(
unsigned
pid
,
unsigned
long
config
)
{
unsigned
long
gmpp
=
readl
(
DOVE_MPP_GENERAL_VIRT_BASE
);
gmpp
&=
~
DOVE_NAND_GPIO_EN
;
if
(
config
)
gmpp
|=
DOVE_NAND_GPIO_EN
;
writel
(
gmpp
,
DOVE_MPP_GENERAL_VIRT_BASE
);
regmap_update_bits
(
gconfmap
,
MPP_GENERAL_CONFIG
,
NAND_GPIO_EN
,
(
config
)
?
NAND_GPIO_EN
:
0
);
return
0
;
}
static
int
dove_audio0_ctrl_get
(
unsigned
pid
,
unsigned
long
*
config
)
{
unsigned
long
pmu
=
readl
(
DOVE_
PMU_MPP_GENERAL_CTRL
);
unsigned
long
pmu
=
readl
(
mpp_base
+
PMU_MPP_GENERAL_CTRL
);
*
config
=
((
pmu
&
DOVE_
AU0_AC97_SEL
)
!=
0
);
*
config
=
((
pmu
&
AU0_AC97_SEL
)
!=
0
);
return
0
;
}
static
int
dove_audio0_ctrl_set
(
unsigned
pid
,
unsigned
long
config
)
{
unsigned
long
pmu
=
readl
(
DOVE_
PMU_MPP_GENERAL_CTRL
);
unsigned
long
pmu
=
readl
(
mpp_base
+
PMU_MPP_GENERAL_CTRL
);
pmu
&=
~
DOVE_
AU0_AC97_SEL
;
pmu
&=
~
AU0_AC97_SEL
;
if
(
config
)
pmu
|=
DOVE_
AU0_AC97_SEL
;
writel
(
pmu
,
DOVE_
PMU_MPP_GENERAL_CTRL
);
pmu
|=
AU0_AC97_SEL
;
writel
(
pmu
,
mpp_base
+
PMU_MPP_GENERAL_CTRL
);
return
0
;
}
static
int
dove_audio1_ctrl_get
(
unsigned
pid
,
unsigned
long
*
config
)
{
unsigned
long
mpp4
=
readl
(
DOVE_MPP_CTRL4_VIRT_BASE
);
unsigned
long
sspc1
=
readl
(
DOVE_SSP_CTRL_STATUS_1
);
unsigned
long
gmpp
=
readl
(
DOVE_MPP_GENERAL_VIRT_BASE
);
unsigned
long
gcfg2
=
readl
(
DOVE_GLOBAL_CONFIG_2
);
unsigned
int
mpp4
=
readl
(
mpp4_base
);
unsigned
int
sspc1
;
unsigned
int
gmpp
;
unsigned
int
gcfg2
;
regmap_read
(
gconfmap
,
SSP_CTRL_STATUS_1
,
&
sspc1
);
regmap_read
(
gconfmap
,
MPP_GENERAL_CONFIG
,
&
gmpp
);
regmap_read
(
gconfmap
,
GLOBAL_CONFIG_2
,
&
gcfg2
);
*
config
=
0
;
if
(
mpp4
&
DOVE_
AU1_GPIO_SEL
)
if
(
mpp4
&
AU1_GPIO_SEL
)
*
config
|=
BIT
(
3
);
if
(
sspc1
&
DOVE_
SSP_ON_AU1
)
if
(
sspc1
&
SSP_ON_AU1
)
*
config
|=
BIT
(
2
);
if
(
gmpp
&
DOVE_
AU1_SPDIFO_GPIO_EN
)
if
(
gmpp
&
AU1_SPDIFO_GPIO_EN
)
*
config
|=
BIT
(
1
);
if
(
gcfg2
&
DOVE_
TWSI_OPTION3_GPIO
)
if
(
gcfg2
&
TWSI_OPTION3_GPIO
)
*
config
|=
BIT
(
0
);
/* SSP/TWSI only if I2S1 not set*/
...
...
@@ -236,32 +249,22 @@ static int dove_audio1_ctrl_get(unsigned pid, unsigned long *config)
static
int
dove_audio1_ctrl_set
(
unsigned
pid
,
unsigned
long
config
)
{
unsigned
long
mpp4
=
readl
(
DOVE_MPP_CTRL4_VIRT_BASE
);
unsigned
long
sspc1
=
readl
(
DOVE_SSP_CTRL_STATUS_1
);
unsigned
long
gmpp
=
readl
(
DOVE_MPP_GENERAL_VIRT_BASE
);
unsigned
long
gcfg2
=
readl
(
DOVE_GLOBAL_CONFIG_2
);
unsigned
int
mpp4
=
readl
(
mpp4_base
);
/*
* clear all audio1 related bits before configure
*/
gcfg2
&=
~
DOVE_TWSI_OPTION3_GPIO
;
gmpp
&=
~
DOVE_AU1_SPDIFO_GPIO_EN
;
sspc1
&=
~
DOVE_SSP_ON_AU1
;
mpp4
&=
~
DOVE_AU1_GPIO_SEL
;
if
(
config
&
BIT
(
0
))
gcfg2
|=
DOVE_TWSI_OPTION3_GPIO
;
if
(
config
&
BIT
(
1
))
gmpp
|=
DOVE_AU1_SPDIFO_GPIO_EN
;
if
(
config
&
BIT
(
2
))
sspc1
|=
DOVE_SSP_ON_AU1
;
mpp4
&=
~
AU1_GPIO_SEL
;
if
(
config
&
BIT
(
3
))
mpp4
|=
DOVE_AU1_GPIO_SEL
;
writel
(
mpp4
,
DOVE_MPP_CTRL4_VIRT_BASE
);
writel
(
sspc1
,
DOVE_SSP_CTRL_STATUS_1
);
writel
(
gmpp
,
DOVE_MPP_GENERAL_VIRT_BASE
);
writel
(
gcfg2
,
DOVE_GLOBAL_CONFIG_2
);
mpp4
|=
AU1_GPIO_SEL
;
writel
(
mpp4
,
mpp4_base
);
regmap_update_bits
(
gconfmap
,
SSP_CTRL_STATUS_1
,
SSP_ON_AU1
,
(
config
&
BIT
(
2
))
?
SSP_ON_AU1
:
0
);
regmap_update_bits
(
gconfmap
,
MPP_GENERAL_CONFIG
,
AU1_SPDIFO_GPIO_EN
,
(
config
&
BIT
(
1
))
?
AU1_SPDIFO_GPIO_EN
:
0
);
regmap_update_bits
(
gconfmap
,
GLOBAL_CONFIG_2
,
TWSI_OPTION3_GPIO
,
(
config
&
BIT
(
0
))
?
TWSI_OPTION3_GPIO
:
0
);
return
0
;
}
...
...
@@ -307,15 +310,18 @@ static int dove_audio1_ctrl_gpio_dir(unsigned pid, bool input)
static
int
dove_twsi_ctrl_get
(
unsigned
pid
,
unsigned
long
*
config
)
{
unsigned
long
gcfg1
=
readl
(
DOVE_GLOBAL_CONFIG_1
);
unsigned
long
gcfg2
=
readl
(
DOVE_GLOBAL_CONFIG_2
);
unsigned
int
gcfg1
;
unsigned
int
gcfg2
;
regmap_read
(
gconfmap
,
GLOBAL_CONFIG_1
,
&
gcfg1
);
regmap_read
(
gconfmap
,
GLOBAL_CONFIG_2
,
&
gcfg2
);
*
config
=
0
;
if
(
gcfg1
&
DOVE_
TWSI_ENABLE_OPTION1
)
if
(
gcfg1
&
TWSI_ENABLE_OPTION1
)
*
config
=
1
;
else
if
(
gcfg2
&
DOVE_
TWSI_ENABLE_OPTION2
)
else
if
(
gcfg2
&
TWSI_ENABLE_OPTION2
)
*
config
=
2
;
else
if
(
gcfg2
&
DOVE_
TWSI_ENABLE_OPTION3
)
else
if
(
gcfg2
&
TWSI_ENABLE_OPTION3
)
*
config
=
3
;
return
0
;
...
...
@@ -323,26 +329,27 @@ static int dove_twsi_ctrl_get(unsigned pid, unsigned long *config)
static
int
dove_twsi_ctrl_set
(
unsigned
pid
,
unsigned
long
config
)
{
unsigned
long
gcfg1
=
readl
(
DOVE_GLOBAL_CONFIG_1
);
unsigned
long
gcfg2
=
readl
(
DOVE_GLOBAL_CONFIG_2
);
gcfg1
&=
~
DOVE_TWSI_ENABLE_OPTION1
;
gcfg2
&=
~
(
DOVE_TWSI_ENABLE_OPTION2
|
DOVE_TWSI_ENABLE_OPTION3
);
unsigned
int
gcfg1
=
0
;
unsigned
int
gcfg2
=
0
;
switch
(
config
)
{
case
1
:
gcfg1
|=
DOVE_
TWSI_ENABLE_OPTION1
;
gcfg1
=
TWSI_ENABLE_OPTION1
;
break
;
case
2
:
gcfg2
|=
DOVE_
TWSI_ENABLE_OPTION2
;
gcfg2
=
TWSI_ENABLE_OPTION2
;
break
;
case
3
:
gcfg2
|=
DOVE_
TWSI_ENABLE_OPTION3
;
gcfg2
=
TWSI_ENABLE_OPTION3
;
break
;
}
writel
(
gcfg1
,
DOVE_GLOBAL_CONFIG_1
);
writel
(
gcfg2
,
DOVE_GLOBAL_CONFIG_2
);
regmap_update_bits
(
gconfmap
,
GLOBAL_CONFIG_1
,
TWSI_ENABLE_OPTION1
,
gcfg1
);
regmap_update_bits
(
gconfmap
,
GLOBAL_CONFIG_2
,
TWSI_ENABLE_OPTION2
|
TWSI_ENABLE_OPTION3
,
gcfg2
);
return
0
;
}
...
...
@@ -749,9 +756,17 @@ static struct of_device_id dove_pinctrl_of_match[] = {
{
}
};
static
struct
regmap_config
gc_regmap_config
=
{
.
reg_bits
=
32
,
.
val_bits
=
32
,
.
reg_stride
=
4
,
.
max_register
=
5
,
};
static
int
dove_pinctrl_probe
(
struct
platform_device
*
pdev
)
{
struct
resource
*
res
;
struct
resource
*
res
,
*
mpp_res
;
struct
resource
fb_res
;
const
struct
of_device_id
*
match
=
of_match_device
(
dove_pinctrl_of_match
,
&
pdev
->
dev
);
pdev
->
dev
.
platform_data
=
(
void
*
)
match
->
data
;
...
...
@@ -767,11 +782,58 @@ static int dove_pinctrl_probe(struct platform_device *pdev)
}
clk_prepare_enable
(
clk
);
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
mpp_base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
res
);
mpp_
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
mpp_base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
mpp_
res
);
if
(
IS_ERR
(
mpp_base
))
return
PTR_ERR
(
mpp_base
);
/* prepare fallback resource */
memcpy
(
&
fb_res
,
mpp_res
,
sizeof
(
struct
resource
));
fb_res
.
start
=
0
;
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
1
);
if
(
!
res
)
{
dev_warn
(
&
pdev
->
dev
,
"falling back to hardcoded MPP4 resource
\n
"
);
adjust_resource
(
&
fb_res
,
(
mpp_res
->
start
&
INT_REGS_MASK
)
+
MPP4_REGS_OFFS
,
0x4
);
res
=
&
fb_res
;
}
mpp4_base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
res
);
if
(
IS_ERR
(
mpp4_base
))
return
PTR_ERR
(
mpp4_base
);
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
2
);
if
(
!
res
)
{
dev_warn
(
&
pdev
->
dev
,
"falling back to hardcoded PMU resource
\n
"
);
adjust_resource
(
&
fb_res
,
(
mpp_res
->
start
&
INT_REGS_MASK
)
+
PMU_REGS_OFFS
,
0x8
);
res
=
&
fb_res
;
}
pmu_base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
res
);
if
(
IS_ERR
(
pmu_base
))
return
PTR_ERR
(
pmu_base
);
gconfmap
=
syscon_regmap_lookup_by_compatible
(
"marvell,dove-global-config"
);
if
(
IS_ERR
(
gconfmap
))
{
void
__iomem
*
gc_base
;
dev_warn
(
&
pdev
->
dev
,
"falling back to hardcoded global registers
\n
"
);
adjust_resource
(
&
fb_res
,
(
mpp_res
->
start
&
INT_REGS_MASK
)
+
GC_REGS_OFFS
,
0x14
);
gc_base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
&
fb_res
);
if
(
IS_ERR
(
gc_base
))
return
PTR_ERR
(
gc_base
);
gconfmap
=
devm_regmap_init_mmio
(
&
pdev
->
dev
,
gc_base
,
&
gc_regmap_config
);
if
(
IS_ERR
(
gconfmap
))
return
PTR_ERR
(
gconfmap
);
}
/* Warn on any missing DT resource */
WARN
(
fb_res
.
start
,
FW_BUG
"Missing pinctrl regs in DTB. Please update your firmware.
\n
"
);
return
mvebu_pinctrl_probe
(
pdev
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录