diff options
author | Olof Johansson <olof@lixom.net> | 2012-10-04 23:17:25 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-10-04 23:17:25 -0400 |
commit | 54d69df5849ec2e660aa12ac75562618c10fb499 (patch) | |
tree | adbfb8bcc7cc73b83bf2b784fa331911ba03573a /drivers | |
parent | ad932bb6b549722a561fb31ac2fa50dcbcb3e36b (diff) | |
parent | 46f2007c1efadfa4071c17e75f140c47f09293de (diff) |
Merge branch 'late/kirkwood' into late/soc
Merge in the late Kirkwood branch with the OMAP late branch for upstream
submission.
Final contents described in shared tag.
Fixup remove/change conflicts in arch/arm/mach-omap2/devices.c and
drivers/spi/spi-omap2-mcspi.c.
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers')
185 files changed, 9165 insertions, 876 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig index ece958d3762e..36d3daa19a74 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -152,4 +152,6 @@ source "drivers/vme/Kconfig" | |||
152 | 152 | ||
153 | source "drivers/pwm/Kconfig" | 153 | source "drivers/pwm/Kconfig" |
154 | 154 | ||
155 | source "drivers/irqchip/Kconfig" | ||
156 | |||
155 | endmenu | 157 | endmenu |
diff --git a/drivers/Makefile b/drivers/Makefile index 5b421840c48d..8c30e73cd94c 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -5,6 +5,8 @@ | |||
5 | # Rewritten to use lists instead of if-statements. | 5 | # Rewritten to use lists instead of if-statements. |
6 | # | 6 | # |
7 | 7 | ||
8 | obj-y += irqchip/ | ||
9 | |||
8 | # GPIO must come after pinctrl as gpios may need to mux pins etc | 10 | # GPIO must come after pinctrl as gpios may need to mux pins etc |
9 | obj-y += pinctrl/ | 11 | obj-y += pinctrl/ |
10 | obj-y += gpio/ | 12 | obj-y += gpio/ |
diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c index 6ef2e3741f76..e056406d6a11 100644 --- a/drivers/ata/pata_ep93xx.c +++ b/drivers/ata/pata_ep93xx.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include <linux/dmaengine.h> | 43 | #include <linux/dmaengine.h> |
44 | #include <linux/ktime.h> | 44 | #include <linux/ktime.h> |
45 | 45 | ||
46 | #include <mach/dma.h> | 46 | #include <linux/platform_data/dma-ep93xx.h> |
47 | #include <mach/platform.h> | 47 | #include <mach/platform.h> |
48 | 48 | ||
49 | #define DRV_NAME "ep93xx-ide" | 49 | #define DRV_NAME "ep93xx-ide" |
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c index 0bb0fb7b26bc..4b8ba559fe24 100644 --- a/drivers/ata/pata_pxa.c +++ b/drivers/ata/pata_pxa.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <scsi/scsi_host.h> | 32 | #include <scsi/scsi_host.h> |
33 | 33 | ||
34 | #include <mach/pxa2xx-regs.h> | 34 | #include <mach/pxa2xx-regs.h> |
35 | #include <mach/pata_pxa.h> | 35 | #include <linux/platform_data/ata-pxa.h> |
36 | #include <mach/dma.h> | 36 | #include <mach/dma.h> |
37 | 37 | ||
38 | #define DRV_NAME "pata_pxa" | 38 | #define DRV_NAME "pata_pxa" |
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index 1b372c297195..63ffb002ec67 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | 25 | ||
26 | #include <plat/ata.h> | 26 | #include <linux/platform_data/ata-samsung_cf.h> |
27 | #include <plat/regs-ata.h> | 27 | #include <plat/regs-ata.h> |
28 | 28 | ||
29 | #define DRV_NAME "pata_samsung_cf" | 29 | #define DRV_NAME "pata_samsung_cf" |
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 7f0b5ca78516..bace9e98f75d 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig | |||
@@ -40,4 +40,17 @@ config COMMON_CLK_WM831X | |||
40 | Supports the clocking subsystem of the WM831x/2x series of | 40 | Supports the clocking subsystem of the WM831x/2x series of |
41 | PMICs from Wolfson Microlectronics. | 41 | PMICs from Wolfson Microlectronics. |
42 | 42 | ||
43 | config COMMON_CLK_VERSATILE | ||
44 | bool "Clock driver for ARM Reference designs" | ||
45 | depends on ARCH_INTEGRATOR || ARCH_REALVIEW | ||
46 | ---help--- | ||
47 | Supports clocking on ARM Reference designs Integrator/AP, | ||
48 | Integrator/CP, RealView PB1176, EB, PB11MP and PBX. | ||
49 | |||
50 | config COMMON_CLK_MAX77686 | ||
51 | tristate "Clock driver for Maxim 77686 MFD" | ||
52 | depends on MFD_MAX77686 | ||
53 | ---help--- | ||
54 | This driver supports Maxim 77686 crystal oscillator clock. | ||
55 | |||
43 | endmenu | 56 | endmenu |
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 5869ea387054..9184b5e19edf 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile | |||
@@ -3,13 +3,21 @@ obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o | |||
3 | obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \ | 3 | obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \ |
4 | clk-mux.o clk-divider.o clk-fixed-factor.o | 4 | clk-mux.o clk-divider.o clk-fixed-factor.o |
5 | # SoCs specific | 5 | # SoCs specific |
6 | obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o | ||
6 | obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o | 7 | obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o |
7 | obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o | 8 | obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o |
8 | obj-$(CONFIG_ARCH_MXS) += mxs/ | 9 | obj-$(CONFIG_ARCH_MXS) += mxs/ |
9 | obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/ | 10 | obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/ |
10 | obj-$(CONFIG_PLAT_SPEAR) += spear/ | 11 | obj-$(CONFIG_PLAT_SPEAR) += spear/ |
11 | obj-$(CONFIG_ARCH_U300) += clk-u300.o | 12 | obj-$(CONFIG_ARCH_U300) += clk-u300.o |
12 | obj-$(CONFIG_ARCH_INTEGRATOR) += versatile/ | 13 | obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/ |
14 | obj-$(CONFIG_ARCH_PRIMA2) += clk-prima2.o | ||
15 | ifeq ($(CONFIG_COMMON_CLK), y) | ||
16 | obj-$(CONFIG_ARCH_MMP) += mmp/ | ||
17 | endif | ||
18 | obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o | ||
19 | obj-$(CONFIG_ARCH_U8500) += ux500/ | ||
13 | 20 | ||
14 | # Chip specific | 21 | # Chip specific |
15 | obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o | 22 | obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o |
23 | obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o | ||
diff --git a/drivers/clk/clk-bcm2835.c b/drivers/clk/clk-bcm2835.c new file mode 100644 index 000000000000..67ad16b20b81 --- /dev/null +++ b/drivers/clk/clk-bcm2835.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Broadcom | ||
3 | * Copyright (C) 2012 Stephen Warren | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/clk-provider.h> | ||
21 | #include <linux/clkdev.h> | ||
22 | #include <linux/clk/bcm2835.h> | ||
23 | |||
24 | /* | ||
25 | * These are fixed clocks. They're probably not all root clocks and it may | ||
26 | * be possible to turn them on and off but until this is mapped out better | ||
27 | * it's the only way they can be used. | ||
28 | */ | ||
29 | void __init bcm2835_init_clocks(void) | ||
30 | { | ||
31 | struct clk *clk; | ||
32 | int ret; | ||
33 | |||
34 | clk = clk_register_fixed_rate(NULL, "sys_pclk", NULL, CLK_IS_ROOT, | ||
35 | 250000000); | ||
36 | if (!clk) | ||
37 | pr_err("sys_pclk not registered\n"); | ||
38 | |||
39 | clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT, | ||
40 | 126000000); | ||
41 | if (!clk) | ||
42 | pr_err("apb_pclk not registered\n"); | ||
43 | |||
44 | clk = clk_register_fixed_rate(NULL, "uart0_pclk", NULL, CLK_IS_ROOT, | ||
45 | 3000000); | ||
46 | if (!clk) | ||
47 | pr_err("uart0_pclk not registered\n"); | ||
48 | ret = clk_register_clkdev(clk, NULL, "20201000.uart"); | ||
49 | if (ret) | ||
50 | pr_err("uart0_pclk alias not registered\n"); | ||
51 | |||
52 | clk = clk_register_fixed_rate(NULL, "uart1_pclk", NULL, CLK_IS_ROOT, | ||
53 | 125000000); | ||
54 | if (!clk) | ||
55 | pr_err("uart1_pclk not registered\n"); | ||
56 | ret = clk_register_clkdev(clk, NULL, "20215000.uart"); | ||
57 | if (ret) | ||
58 | pr_err("uart0_pclk alias not registered\n"); | ||
59 | } | ||
diff --git a/drivers/clk/clk-ls1x.c b/drivers/clk/clk-ls1x.c new file mode 100644 index 000000000000..f20b750235f6 --- /dev/null +++ b/drivers/clk/clk-ls1x.c | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012 Zhang, Keguang <keguang.zhang@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/clkdev.h> | ||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/io.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/err.h> | ||
15 | |||
16 | #include <loongson1.h> | ||
17 | |||
18 | #define OSC 33 | ||
19 | |||
20 | static DEFINE_SPINLOCK(_lock); | ||
21 | |||
22 | static int ls1x_pll_clk_enable(struct clk_hw *hw) | ||
23 | { | ||
24 | return 0; | ||
25 | } | ||
26 | |||
27 | static void ls1x_pll_clk_disable(struct clk_hw *hw) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | static unsigned long ls1x_pll_recalc_rate(struct clk_hw *hw, | ||
32 | unsigned long parent_rate) | ||
33 | { | ||
34 | u32 pll, rate; | ||
35 | |||
36 | pll = __raw_readl(LS1X_CLK_PLL_FREQ); | ||
37 | rate = ((12 + (pll & 0x3f)) * 1000000) + | ||
38 | ((((pll >> 8) & 0x3ff) * 1000000) >> 10); | ||
39 | rate *= OSC; | ||
40 | rate >>= 1; | ||
41 | |||
42 | return rate; | ||
43 | } | ||
44 | |||
45 | static const struct clk_ops ls1x_pll_clk_ops = { | ||
46 | .enable = ls1x_pll_clk_enable, | ||
47 | .disable = ls1x_pll_clk_disable, | ||
48 | .recalc_rate = ls1x_pll_recalc_rate, | ||
49 | }; | ||
50 | |||
51 | static struct clk * __init clk_register_pll(struct device *dev, | ||
52 | const char *name, const char *parent_name, unsigned long flags) | ||
53 | { | ||
54 | struct clk_hw *hw; | ||
55 | struct clk *clk; | ||
56 | struct clk_init_data init; | ||
57 | |||
58 | /* allocate the divider */ | ||
59 | hw = kzalloc(sizeof(struct clk_hw), GFP_KERNEL); | ||
60 | if (!hw) { | ||
61 | pr_err("%s: could not allocate clk_hw\n", __func__); | ||
62 | return ERR_PTR(-ENOMEM); | ||
63 | } | ||
64 | |||
65 | init.name = name; | ||
66 | init.ops = &ls1x_pll_clk_ops; | ||
67 | init.flags = flags | CLK_IS_BASIC; | ||
68 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
69 | init.num_parents = (parent_name ? 1 : 0); | ||
70 | hw->init = &init; | ||
71 | |||
72 | /* register the clock */ | ||
73 | clk = clk_register(dev, hw); | ||
74 | |||
75 | if (IS_ERR(clk)) | ||
76 | kfree(hw); | ||
77 | |||
78 | return clk; | ||
79 | } | ||
80 | |||
81 | void __init ls1x_clk_init(void) | ||
82 | { | ||
83 | struct clk *clk; | ||
84 | |||
85 | clk = clk_register_pll(NULL, "pll_clk", NULL, CLK_IS_ROOT); | ||
86 | clk_prepare_enable(clk); | ||
87 | |||
88 | clk = clk_register_divider(NULL, "cpu_clk", "pll_clk", | ||
89 | CLK_SET_RATE_PARENT, LS1X_CLK_PLL_DIV, DIV_CPU_SHIFT, | ||
90 | DIV_CPU_WIDTH, CLK_DIVIDER_ONE_BASED, &_lock); | ||
91 | clk_prepare_enable(clk); | ||
92 | clk_register_clkdev(clk, "cpu", NULL); | ||
93 | |||
94 | clk = clk_register_divider(NULL, "dc_clk", "pll_clk", | ||
95 | CLK_SET_RATE_PARENT, LS1X_CLK_PLL_DIV, DIV_DC_SHIFT, | ||
96 | DIV_DC_WIDTH, CLK_DIVIDER_ONE_BASED, &_lock); | ||
97 | clk_prepare_enable(clk); | ||
98 | clk_register_clkdev(clk, "dc", NULL); | ||
99 | |||
100 | clk = clk_register_divider(NULL, "ahb_clk", "pll_clk", | ||
101 | CLK_SET_RATE_PARENT, LS1X_CLK_PLL_DIV, DIV_DDR_SHIFT, | ||
102 | DIV_DDR_WIDTH, CLK_DIVIDER_ONE_BASED, &_lock); | ||
103 | clk_prepare_enable(clk); | ||
104 | clk_register_clkdev(clk, "ahb", NULL); | ||
105 | clk_register_clkdev(clk, "stmmaceth", NULL); | ||
106 | |||
107 | clk = clk_register_fixed_factor(NULL, "apb_clk", "ahb_clk", 0, 1, 2); | ||
108 | clk_prepare_enable(clk); | ||
109 | clk_register_clkdev(clk, "apb", NULL); | ||
110 | clk_register_clkdev(clk, "serial8250", NULL); | ||
111 | } | ||
diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c new file mode 100644 index 000000000000..ac5f5434cb9a --- /dev/null +++ b/drivers/clk/clk-max77686.c | |||
@@ -0,0 +1,244 @@ | |||
1 | /* | ||
2 | * clk-max77686.c - Clock driver for Maxim 77686 | ||
3 | * | ||
4 | * Copyright (C) 2012 Samsung Electornics | ||
5 | * Jonghwa Lee <jonghwa3.lee@samsung.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include <linux/err.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/mfd/max77686.h> | ||
28 | #include <linux/mfd/max77686-private.h> | ||
29 | #include <linux/clk-provider.h> | ||
30 | #include <linux/mutex.h> | ||
31 | #include <linux/clkdev.h> | ||
32 | |||
33 | enum { | ||
34 | MAX77686_CLK_AP = 0, | ||
35 | MAX77686_CLK_CP, | ||
36 | MAX77686_CLK_PMIC, | ||
37 | MAX77686_CLKS_NUM, | ||
38 | }; | ||
39 | |||
40 | struct max77686_clk { | ||
41 | struct max77686_dev *iodev; | ||
42 | u32 mask; | ||
43 | struct clk_hw hw; | ||
44 | struct clk_lookup *lookup; | ||
45 | }; | ||
46 | |||
47 | static struct max77686_clk *get_max77686_clk(struct clk_hw *hw) | ||
48 | { | ||
49 | return container_of(hw, struct max77686_clk, hw); | ||
50 | } | ||
51 | |||
52 | static int max77686_clk_prepare(struct clk_hw *hw) | ||
53 | { | ||
54 | struct max77686_clk *max77686; | ||
55 | int ret; | ||
56 | |||
57 | max77686 = get_max77686_clk(hw); | ||
58 | if (!max77686) | ||
59 | return -ENOMEM; | ||
60 | |||
61 | ret = regmap_update_bits(max77686->iodev->regmap, | ||
62 | MAX77686_REG_32KHZ, max77686->mask, max77686->mask); | ||
63 | |||
64 | return ret; | ||
65 | } | ||
66 | |||
67 | static void max77686_clk_unprepare(struct clk_hw *hw) | ||
68 | { | ||
69 | struct max77686_clk *max77686; | ||
70 | |||
71 | max77686 = get_max77686_clk(hw); | ||
72 | if (!max77686) | ||
73 | return; | ||
74 | |||
75 | regmap_update_bits(max77686->iodev->regmap, | ||
76 | MAX77686_REG_32KHZ, max77686->mask, ~max77686->mask); | ||
77 | } | ||
78 | |||
79 | static int max77686_clk_is_enabled(struct clk_hw *hw) | ||
80 | { | ||
81 | struct max77686_clk *max77686; | ||
82 | int ret; | ||
83 | u32 val; | ||
84 | |||
85 | max77686 = get_max77686_clk(hw); | ||
86 | if (!max77686) | ||
87 | return -ENOMEM; | ||
88 | |||
89 | ret = regmap_read(max77686->iodev->regmap, | ||
90 | MAX77686_REG_32KHZ, &val); | ||
91 | |||
92 | if (ret < 0) | ||
93 | return -EINVAL; | ||
94 | |||
95 | return val & max77686->mask; | ||
96 | } | ||
97 | |||
98 | static struct clk_ops max77686_clk_ops = { | ||
99 | .prepare = max77686_clk_prepare, | ||
100 | .unprepare = max77686_clk_unprepare, | ||
101 | .is_enabled = max77686_clk_is_enabled, | ||
102 | }; | ||
103 | |||
104 | static struct clk_init_data max77686_clks_init[MAX77686_CLKS_NUM] = { | ||
105 | [MAX77686_CLK_AP] = { | ||
106 | .name = "32khz_ap", | ||
107 | .ops = &max77686_clk_ops, | ||
108 | .flags = CLK_IS_ROOT, | ||
109 | }, | ||
110 | [MAX77686_CLK_CP] = { | ||
111 | .name = "32khz_cp", | ||
112 | .ops = &max77686_clk_ops, | ||
113 | .flags = CLK_IS_ROOT, | ||
114 | }, | ||
115 | [MAX77686_CLK_PMIC] = { | ||
116 | .name = "32khz_pmic", | ||
117 | .ops = &max77686_clk_ops, | ||
118 | .flags = CLK_IS_ROOT, | ||
119 | }, | ||
120 | }; | ||
121 | |||
122 | static int max77686_clk_register(struct device *dev, | ||
123 | struct max77686_clk *max77686) | ||
124 | { | ||
125 | struct clk *clk; | ||
126 | struct clk_hw *hw = &max77686->hw; | ||
127 | |||
128 | clk = clk_register(dev, hw); | ||
129 | |||
130 | if (IS_ERR(clk)) | ||
131 | return -ENOMEM; | ||
132 | |||
133 | max77686->lookup = devm_kzalloc(dev, sizeof(struct clk_lookup), | ||
134 | GFP_KERNEL); | ||
135 | if (IS_ERR(max77686->lookup)) | ||
136 | return -ENOMEM; | ||
137 | |||
138 | max77686->lookup->con_id = hw->init->name; | ||
139 | max77686->lookup->clk = clk; | ||
140 | |||
141 | clkdev_add(max77686->lookup); | ||
142 | |||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static __devinit int max77686_clk_probe(struct platform_device *pdev) | ||
147 | { | ||
148 | struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); | ||
149 | struct max77686_clk **max77686_clks; | ||
150 | int i, ret; | ||
151 | |||
152 | max77686_clks = devm_kzalloc(&pdev->dev, sizeof(struct max77686_clk *) | ||
153 | * MAX77686_CLKS_NUM, GFP_KERNEL); | ||
154 | if (IS_ERR(max77686_clks)) | ||
155 | return -ENOMEM; | ||
156 | |||
157 | for (i = 0; i < MAX77686_CLKS_NUM; i++) { | ||
158 | max77686_clks[i] = devm_kzalloc(&pdev->dev, | ||
159 | sizeof(struct max77686_clk), GFP_KERNEL); | ||
160 | if (IS_ERR(max77686_clks[i])) | ||
161 | return -ENOMEM; | ||
162 | } | ||
163 | |||
164 | for (i = 0; i < MAX77686_CLKS_NUM; i++) { | ||
165 | max77686_clks[i]->iodev = iodev; | ||
166 | max77686_clks[i]->mask = 1 << i; | ||
167 | max77686_clks[i]->hw.init = &max77686_clks_init[i]; | ||
168 | |||
169 | ret = max77686_clk_register(&pdev->dev, max77686_clks[i]); | ||
170 | if (ret) { | ||
171 | switch (i) { | ||
172 | case MAX77686_CLK_AP: | ||
173 | dev_err(&pdev->dev, "Fail to register CLK_AP\n"); | ||
174 | goto err_clk_ap; | ||
175 | break; | ||
176 | case MAX77686_CLK_CP: | ||
177 | dev_err(&pdev->dev, "Fail to register CLK_CP\n"); | ||
178 | goto err_clk_cp; | ||
179 | break; | ||
180 | case MAX77686_CLK_PMIC: | ||
181 | dev_err(&pdev->dev, "Fail to register CLK_PMIC\n"); | ||
182 | goto err_clk_pmic; | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | |||
187 | platform_set_drvdata(pdev, max77686_clks); | ||
188 | |||
189 | goto out; | ||
190 | |||
191 | err_clk_pmic: | ||
192 | clkdev_drop(max77686_clks[MAX77686_CLK_CP]->lookup); | ||
193 | kfree(max77686_clks[MAX77686_CLK_CP]->hw.clk); | ||
194 | err_clk_cp: | ||
195 | clkdev_drop(max77686_clks[MAX77686_CLK_AP]->lookup); | ||
196 | kfree(max77686_clks[MAX77686_CLK_AP]->hw.clk); | ||
197 | err_clk_ap: | ||
198 | out: | ||
199 | return ret; | ||
200 | } | ||
201 | |||
202 | static int __devexit max77686_clk_remove(struct platform_device *pdev) | ||
203 | { | ||
204 | struct max77686_clk **max77686_clks = platform_get_drvdata(pdev); | ||
205 | int i; | ||
206 | |||
207 | for (i = 0; i < MAX77686_CLKS_NUM; i++) { | ||
208 | clkdev_drop(max77686_clks[i]->lookup); | ||
209 | kfree(max77686_clks[i]->hw.clk); | ||
210 | } | ||
211 | return 0; | ||
212 | } | ||
213 | |||
214 | static const struct platform_device_id max77686_clk_id[] = { | ||
215 | { "max77686-clk", 0}, | ||
216 | { }, | ||
217 | }; | ||
218 | MODULE_DEVICE_TABLE(platform, max77686_clk_id); | ||
219 | |||
220 | static struct platform_driver max77686_clk_driver = { | ||
221 | .driver = { | ||
222 | .name = "max77686-clk", | ||
223 | .owner = THIS_MODULE, | ||
224 | }, | ||
225 | .probe = max77686_clk_probe, | ||
226 | .remove = __devexit_p(max77686_clk_remove), | ||
227 | .id_table = max77686_clk_id, | ||
228 | }; | ||
229 | |||
230 | static int __init max77686_clk_init(void) | ||
231 | { | ||
232 | return platform_driver_register(&max77686_clk_driver); | ||
233 | } | ||
234 | subsys_initcall(max77686_clk_init); | ||
235 | |||
236 | static void __init max77686_clk_cleanup(void) | ||
237 | { | ||
238 | platform_driver_unregister(&max77686_clk_driver); | ||
239 | } | ||
240 | module_exit(max77686_clk_cleanup); | ||
241 | |||
242 | MODULE_DESCRIPTION("MAXIM 77686 Clock Driver"); | ||
243 | MODULE_AUTHOR("Jonghwa Lee <jonghwa3.lee@samsung.com>"); | ||
244 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/clk/clk-prima2.c b/drivers/clk/clk-prima2.c new file mode 100644 index 000000000000..517874fa6858 --- /dev/null +++ b/drivers/clk/clk-prima2.c | |||
@@ -0,0 +1,1171 @@ | |||
1 | /* | ||
2 | * Clock tree for CSR SiRFprimaII | ||
3 | * | ||
4 | * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. | ||
5 | * | ||
6 | * Licensed under GPLv2 or later. | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/bitops.h> | ||
11 | #include <linux/io.h> | ||
12 | #include <linux/clk.h> | ||
13 | #include <linux/clkdev.h> | ||
14 | #include <linux/clk-provider.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/syscore_ops.h> | ||
17 | |||
18 | #define SIRFSOC_CLKC_CLK_EN0 0x0000 | ||
19 | #define SIRFSOC_CLKC_CLK_EN1 0x0004 | ||
20 | #define SIRFSOC_CLKC_REF_CFG 0x0014 | ||
21 | #define SIRFSOC_CLKC_CPU_CFG 0x0018 | ||
22 | #define SIRFSOC_CLKC_MEM_CFG 0x001c | ||
23 | #define SIRFSOC_CLKC_SYS_CFG 0x0020 | ||
24 | #define SIRFSOC_CLKC_IO_CFG 0x0024 | ||
25 | #define SIRFSOC_CLKC_DSP_CFG 0x0028 | ||
26 | #define SIRFSOC_CLKC_GFX_CFG 0x002c | ||
27 | #define SIRFSOC_CLKC_MM_CFG 0x0030 | ||
28 | #define SIRFSOC_CLKC_LCD_CFG 0x0034 | ||
29 | #define SIRFSOC_CLKC_MMC_CFG 0x0038 | ||
30 | #define SIRFSOC_CLKC_PLL1_CFG0 0x0040 | ||
31 | #define SIRFSOC_CLKC_PLL2_CFG0 0x0044 | ||
32 | #define SIRFSOC_CLKC_PLL3_CFG0 0x0048 | ||
33 | #define SIRFSOC_CLKC_PLL1_CFG1 0x004c | ||
34 | #define SIRFSOC_CLKC_PLL2_CFG1 0x0050 | ||
35 | #define SIRFSOC_CLKC_PLL3_CFG1 0x0054 | ||
36 | #define SIRFSOC_CLKC_PLL1_CFG2 0x0058 | ||
37 | #define SIRFSOC_CLKC_PLL2_CFG2 0x005c | ||
38 | #define SIRFSOC_CLKC_PLL3_CFG2 0x0060 | ||
39 | #define SIRFSOC_USBPHY_PLL_CTRL 0x0008 | ||
40 | #define SIRFSOC_USBPHY_PLL_POWERDOWN BIT(1) | ||
41 | #define SIRFSOC_USBPHY_PLL_BYPASS BIT(2) | ||
42 | #define SIRFSOC_USBPHY_PLL_LOCK BIT(3) | ||
43 | |||
44 | static void *sirfsoc_clk_vbase, *sirfsoc_rsc_vbase; | ||
45 | |||
46 | #define KHZ 1000 | ||
47 | #define MHZ (KHZ * KHZ) | ||
48 | |||
49 | /* | ||
50 | * SiRFprimaII clock controller | ||
51 | * - 2 oscillators: osc-26MHz, rtc-32.768KHz | ||
52 | * - 3 standard configurable plls: pll1, pll2 & pll3 | ||
53 | * - 2 exclusive plls: usb phy pll and sata phy pll | ||
54 | * - 8 clock domains: cpu/cpudiv, mem/memdiv, sys/io, dsp, graphic, multimedia, | ||
55 | * display and sdphy. | ||
56 | * Each clock domain can select its own clock source from five clock sources, | ||
57 | * X_XIN, X_XINW, PLL1, PLL2 and PLL3. The domain clock is used as the source | ||
58 | * clock of the group clock. | ||
59 | * - dsp domain: gps, mf | ||
60 | * - io domain: dmac, nand, audio, uart, i2c, spi, usp, pwm, pulse | ||
61 | * - sys domain: security | ||
62 | */ | ||
63 | |||
64 | struct clk_pll { | ||
65 | struct clk_hw hw; | ||
66 | unsigned short regofs; /* register offset */ | ||
67 | }; | ||
68 | |||
69 | #define to_pllclk(_hw) container_of(_hw, struct clk_pll, hw) | ||
70 | |||
71 | struct clk_dmn { | ||
72 | struct clk_hw hw; | ||
73 | signed char enable_bit; /* enable bit: 0 ~ 63 */ | ||
74 | unsigned short regofs; /* register offset */ | ||
75 | }; | ||
76 | |||
77 | #define to_dmnclk(_hw) container_of(_hw, struct clk_dmn, hw) | ||
78 | |||
79 | struct clk_std { | ||
80 | struct clk_hw hw; | ||
81 | signed char enable_bit; /* enable bit: 0 ~ 63 */ | ||
82 | }; | ||
83 | |||
84 | #define to_stdclk(_hw) container_of(_hw, struct clk_std, hw) | ||
85 | |||
86 | static int std_clk_is_enabled(struct clk_hw *hw); | ||
87 | static int std_clk_enable(struct clk_hw *hw); | ||
88 | static void std_clk_disable(struct clk_hw *hw); | ||
89 | |||
90 | static inline unsigned long clkc_readl(unsigned reg) | ||
91 | { | ||
92 | return readl(sirfsoc_clk_vbase + reg); | ||
93 | } | ||
94 | |||
95 | static inline void clkc_writel(u32 val, unsigned reg) | ||
96 | { | ||
97 | writel(val, sirfsoc_clk_vbase + reg); | ||
98 | } | ||
99 | |||
100 | /* | ||
101 | * std pll | ||
102 | */ | ||
103 | |||
104 | static unsigned long pll_clk_recalc_rate(struct clk_hw *hw, | ||
105 | unsigned long parent_rate) | ||
106 | { | ||
107 | unsigned long fin = parent_rate; | ||
108 | struct clk_pll *clk = to_pllclk(hw); | ||
109 | u32 regcfg2 = clk->regofs + SIRFSOC_CLKC_PLL1_CFG2 - | ||
110 | SIRFSOC_CLKC_PLL1_CFG0; | ||
111 | |||
112 | if (clkc_readl(regcfg2) & BIT(2)) { | ||
113 | /* pll bypass mode */ | ||
114 | return fin; | ||
115 | } else { | ||
116 | /* fout = fin * nf / nr / od */ | ||
117 | u32 cfg0 = clkc_readl(clk->regofs); | ||
118 | u32 nf = (cfg0 & (BIT(13) - 1)) + 1; | ||
119 | u32 nr = ((cfg0 >> 13) & (BIT(6) - 1)) + 1; | ||
120 | u32 od = ((cfg0 >> 19) & (BIT(4) - 1)) + 1; | ||
121 | WARN_ON(fin % MHZ); | ||
122 | return fin / MHZ * nf / nr / od * MHZ; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | static long pll_clk_round_rate(struct clk_hw *hw, unsigned long rate, | ||
127 | unsigned long *parent_rate) | ||
128 | { | ||
129 | unsigned long fin, nf, nr, od; | ||
130 | |||
131 | /* | ||
132 | * fout = fin * nf / (nr * od); | ||
133 | * set od = 1, nr = fin/MHz, so fout = nf * MHz | ||
134 | */ | ||
135 | rate = rate - rate % MHZ; | ||
136 | |||
137 | nf = rate / MHZ; | ||
138 | if (nf > BIT(13)) | ||
139 | nf = BIT(13); | ||
140 | if (nf < 1) | ||
141 | nf = 1; | ||
142 | |||
143 | fin = *parent_rate; | ||
144 | |||
145 | nr = fin / MHZ; | ||
146 | if (nr > BIT(6)) | ||
147 | nr = BIT(6); | ||
148 | od = 1; | ||
149 | |||
150 | return fin * nf / (nr * od); | ||
151 | } | ||
152 | |||
153 | static int pll_clk_set_rate(struct clk_hw *hw, unsigned long rate, | ||
154 | unsigned long parent_rate) | ||
155 | { | ||
156 | struct clk_pll *clk = to_pllclk(hw); | ||
157 | unsigned long fin, nf, nr, od, reg; | ||
158 | |||
159 | /* | ||
160 | * fout = fin * nf / (nr * od); | ||
161 | * set od = 1, nr = fin/MHz, so fout = nf * MHz | ||
162 | */ | ||
163 | |||
164 | nf = rate / MHZ; | ||
165 | if (unlikely((rate % MHZ) || nf > BIT(13) || nf < 1)) | ||
166 | return -EINVAL; | ||
167 | |||
168 | fin = parent_rate; | ||
169 | BUG_ON(fin < MHZ); | ||
170 | |||
171 | nr = fin / MHZ; | ||
172 | BUG_ON((fin % MHZ) || nr > BIT(6)); | ||
173 | |||
174 | od = 1; | ||
175 | |||
176 | reg = (nf - 1) | ((nr - 1) << 13) | ((od - 1) << 19); | ||
177 | clkc_writel(reg, clk->regofs); | ||
178 | |||
179 | reg = clk->regofs + SIRFSOC_CLKC_PLL1_CFG1 - SIRFSOC_CLKC_PLL1_CFG0; | ||
180 | clkc_writel((nf >> 1) - 1, reg); | ||
181 | |||
182 | reg = clk->regofs + SIRFSOC_CLKC_PLL1_CFG2 - SIRFSOC_CLKC_PLL1_CFG0; | ||
183 | while (!(clkc_readl(reg) & BIT(6))) | ||
184 | cpu_relax(); | ||
185 | |||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | static struct clk_ops std_pll_ops = { | ||
190 | .recalc_rate = pll_clk_recalc_rate, | ||
191 | .round_rate = pll_clk_round_rate, | ||
192 | .set_rate = pll_clk_set_rate, | ||
193 | }; | ||
194 | |||
195 | static const char *pll_clk_parents[] = { | ||
196 | "osc", | ||
197 | }; | ||
198 | |||
199 | static struct clk_init_data clk_pll1_init = { | ||
200 | .name = "pll1", | ||
201 | .ops = &std_pll_ops, | ||
202 | .parent_names = pll_clk_parents, | ||
203 | .num_parents = ARRAY_SIZE(pll_clk_parents), | ||
204 | }; | ||
205 | |||
206 | static struct clk_init_data clk_pll2_init = { | ||
207 | .name = "pll2", | ||
208 | .ops = &std_pll_ops, | ||
209 | .parent_names = pll_clk_parents, | ||
210 | .num_parents = ARRAY_SIZE(pll_clk_parents), | ||
211 | }; | ||
212 | |||
213 | static struct clk_init_data clk_pll3_init = { | ||
214 | .name = "pll3", | ||
215 | .ops = &std_pll_ops, | ||
216 | .parent_names = pll_clk_parents, | ||
217 | .num_parents = ARRAY_SIZE(pll_clk_parents), | ||
218 | }; | ||
219 | |||
220 | static struct clk_pll clk_pll1 = { | ||
221 | .regofs = SIRFSOC_CLKC_PLL1_CFG0, | ||
222 | .hw = { | ||
223 | .init = &clk_pll1_init, | ||
224 | }, | ||
225 | }; | ||
226 | |||
227 | static struct clk_pll clk_pll2 = { | ||
228 | .regofs = SIRFSOC_CLKC_PLL2_CFG0, | ||
229 | .hw = { | ||
230 | .init = &clk_pll2_init, | ||
231 | }, | ||
232 | }; | ||
233 | |||
234 | static struct clk_pll clk_pll3 = { | ||
235 | .regofs = SIRFSOC_CLKC_PLL3_CFG0, | ||
236 | .hw = { | ||
237 | .init = &clk_pll3_init, | ||
238 | }, | ||
239 | }; | ||
240 | |||
241 | /* | ||
242 | * usb uses specified pll | ||
243 | */ | ||
244 | |||
245 | static int usb_pll_clk_enable(struct clk_hw *hw) | ||
246 | { | ||
247 | u32 reg = readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL); | ||
248 | reg &= ~(SIRFSOC_USBPHY_PLL_POWERDOWN | SIRFSOC_USBPHY_PLL_BYPASS); | ||
249 | writel(reg, sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL); | ||
250 | while (!(readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL) & | ||
251 | SIRFSOC_USBPHY_PLL_LOCK)) | ||
252 | cpu_relax(); | ||
253 | |||
254 | return 0; | ||
255 | } | ||
256 | |||
257 | static void usb_pll_clk_disable(struct clk_hw *clk) | ||
258 | { | ||
259 | u32 reg = readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL); | ||
260 | reg |= (SIRFSOC_USBPHY_PLL_POWERDOWN | SIRFSOC_USBPHY_PLL_BYPASS); | ||
261 | writel(reg, sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL); | ||
262 | } | ||
263 | |||
264 | static unsigned long usb_pll_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) | ||
265 | { | ||
266 | u32 reg = readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL); | ||
267 | return (reg & SIRFSOC_USBPHY_PLL_BYPASS) ? parent_rate : 48*MHZ; | ||
268 | } | ||
269 | |||
270 | static struct clk_ops usb_pll_ops = { | ||
271 | .enable = usb_pll_clk_enable, | ||
272 | .disable = usb_pll_clk_disable, | ||
273 | .recalc_rate = usb_pll_clk_recalc_rate, | ||
274 | }; | ||
275 | |||
276 | static struct clk_init_data clk_usb_pll_init = { | ||
277 | .name = "usb_pll", | ||
278 | .ops = &usb_pll_ops, | ||
279 | .parent_names = pll_clk_parents, | ||
280 | .num_parents = ARRAY_SIZE(pll_clk_parents), | ||
281 | }; | ||
282 | |||
283 | static struct clk_hw usb_pll_clk_hw = { | ||
284 | .init = &clk_usb_pll_init, | ||
285 | }; | ||
286 | |||
287 | /* | ||
288 | * clock domains - cpu, mem, sys/io, dsp, gfx | ||
289 | */ | ||
290 | |||
291 | static const char *dmn_clk_parents[] = { | ||
292 | "rtc", | ||
293 | "osc", | ||
294 | "pll1", | ||
295 | "pll2", | ||
296 | "pll3", | ||
297 | }; | ||
298 | |||
299 | static u8 dmn_clk_get_parent(struct clk_hw *hw) | ||
300 | { | ||
301 | struct clk_dmn *clk = to_dmnclk(hw); | ||
302 | u32 cfg = clkc_readl(clk->regofs); | ||
303 | |||
304 | /* parent of io domain can only be pll3 */ | ||
305 | if (strcmp(hw->init->name, "io") == 0) | ||
306 | return 4; | ||
307 | |||
308 | WARN_ON((cfg & (BIT(3) - 1)) > 4); | ||
309 | |||
310 | return cfg & (BIT(3) - 1); | ||
311 | } | ||
312 | |||
313 | static int dmn_clk_set_parent(struct clk_hw *hw, u8 parent) | ||
314 | { | ||
315 | struct clk_dmn *clk = to_dmnclk(hw); | ||
316 | u32 cfg = clkc_readl(clk->regofs); | ||
317 | |||
318 | /* parent of io domain can only be pll3 */ | ||
319 | if (strcmp(hw->init->name, "io") == 0) | ||
320 | return -EINVAL; | ||
321 | |||
322 | cfg &= ~(BIT(3) - 1); | ||
323 | clkc_writel(cfg | parent, clk->regofs); | ||
324 | /* BIT(3) - switching status: 1 - busy, 0 - done */ | ||
325 | while (clkc_readl(clk->regofs) & BIT(3)) | ||
326 | cpu_relax(); | ||
327 | |||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static unsigned long dmn_clk_recalc_rate(struct clk_hw *hw, | ||
332 | unsigned long parent_rate) | ||
333 | |||
334 | { | ||
335 | unsigned long fin = parent_rate; | ||
336 | struct clk_dmn *clk = to_dmnclk(hw); | ||
337 | |||
338 | u32 cfg = clkc_readl(clk->regofs); | ||
339 | |||
340 | if (cfg & BIT(24)) { | ||
341 | /* fcd bypass mode */ | ||
342 | return fin; | ||
343 | } else { | ||
344 | /* | ||
345 | * wait count: bit[19:16], hold count: bit[23:20] | ||
346 | */ | ||
347 | u32 wait = (cfg >> 16) & (BIT(4) - 1); | ||
348 | u32 hold = (cfg >> 20) & (BIT(4) - 1); | ||
349 | |||
350 | return fin / (wait + hold + 2); | ||
351 | } | ||
352 | } | ||
353 | |||
354 | static long dmn_clk_round_rate(struct clk_hw *hw, unsigned long rate, | ||
355 | unsigned long *parent_rate) | ||
356 | { | ||
357 | unsigned long fin; | ||
358 | unsigned ratio, wait, hold; | ||
359 | unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4; | ||
360 | |||
361 | fin = *parent_rate; | ||
362 | ratio = fin / rate; | ||
363 | |||
364 | if (ratio < 2) | ||
365 | ratio = 2; | ||
366 | if (ratio > BIT(bits + 1)) | ||
367 | ratio = BIT(bits + 1); | ||
368 | |||
369 | wait = (ratio >> 1) - 1; | ||
370 | hold = ratio - wait - 2; | ||
371 | |||
372 | return fin / (wait + hold + 2); | ||
373 | } | ||
374 | |||
375 | static int dmn_clk_set_rate(struct clk_hw *hw, unsigned long rate, | ||
376 | unsigned long parent_rate) | ||
377 | { | ||
378 | struct clk_dmn *clk = to_dmnclk(hw); | ||
379 | unsigned long fin; | ||
380 | unsigned ratio, wait, hold, reg; | ||
381 | unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4; | ||
382 | |||
383 | fin = parent_rate; | ||
384 | ratio = fin / rate; | ||
385 | |||
386 | if (unlikely(ratio < 2 || ratio > BIT(bits + 1))) | ||
387 | return -EINVAL; | ||
388 | |||
389 | WARN_ON(fin % rate); | ||
390 | |||
391 | wait = (ratio >> 1) - 1; | ||
392 | hold = ratio - wait - 2; | ||
393 | |||
394 | reg = clkc_readl(clk->regofs); | ||
395 | reg &= ~(((BIT(bits) - 1) << 16) | ((BIT(bits) - 1) << 20)); | ||
396 | reg |= (wait << 16) | (hold << 20) | BIT(25); | ||
397 | clkc_writel(reg, clk->regofs); | ||
398 | |||
399 | /* waiting FCD been effective */ | ||
400 | while (clkc_readl(clk->regofs) & BIT(25)) | ||
401 | cpu_relax(); | ||
402 | |||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | static struct clk_ops msi_ops = { | ||
407 | .set_rate = dmn_clk_set_rate, | ||
408 | .round_rate = dmn_clk_round_rate, | ||
409 | .recalc_rate = dmn_clk_recalc_rate, | ||
410 | .set_parent = dmn_clk_set_parent, | ||
411 | .get_parent = dmn_clk_get_parent, | ||
412 | }; | ||
413 | |||
414 | static struct clk_init_data clk_mem_init = { | ||
415 | .name = "mem", | ||
416 | .ops = &msi_ops, | ||
417 | .parent_names = dmn_clk_parents, | ||
418 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
419 | }; | ||
420 | |||
421 | static struct clk_dmn clk_mem = { | ||
422 | .regofs = SIRFSOC_CLKC_MEM_CFG, | ||
423 | .hw = { | ||
424 | .init = &clk_mem_init, | ||
425 | }, | ||
426 | }; | ||
427 | |||
428 | static struct clk_init_data clk_sys_init = { | ||
429 | .name = "sys", | ||
430 | .ops = &msi_ops, | ||
431 | .parent_names = dmn_clk_parents, | ||
432 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
433 | .flags = CLK_SET_RATE_GATE, | ||
434 | }; | ||
435 | |||
436 | static struct clk_dmn clk_sys = { | ||
437 | .regofs = SIRFSOC_CLKC_SYS_CFG, | ||
438 | .hw = { | ||
439 | .init = &clk_sys_init, | ||
440 | }, | ||
441 | }; | ||
442 | |||
443 | static struct clk_init_data clk_io_init = { | ||
444 | .name = "io", | ||
445 | .ops = &msi_ops, | ||
446 | .parent_names = dmn_clk_parents, | ||
447 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
448 | }; | ||
449 | |||
450 | static struct clk_dmn clk_io = { | ||
451 | .regofs = SIRFSOC_CLKC_IO_CFG, | ||
452 | .hw = { | ||
453 | .init = &clk_io_init, | ||
454 | }, | ||
455 | }; | ||
456 | |||
457 | static struct clk_ops cpu_ops = { | ||
458 | .set_parent = dmn_clk_set_parent, | ||
459 | .get_parent = dmn_clk_get_parent, | ||
460 | }; | ||
461 | |||
462 | static struct clk_init_data clk_cpu_init = { | ||
463 | .name = "cpu", | ||
464 | .ops = &cpu_ops, | ||
465 | .parent_names = dmn_clk_parents, | ||
466 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
467 | .flags = CLK_SET_RATE_PARENT, | ||
468 | }; | ||
469 | |||
470 | static struct clk_dmn clk_cpu = { | ||
471 | .regofs = SIRFSOC_CLKC_CPU_CFG, | ||
472 | .hw = { | ||
473 | .init = &clk_cpu_init, | ||
474 | }, | ||
475 | }; | ||
476 | |||
477 | static struct clk_ops dmn_ops = { | ||
478 | .is_enabled = std_clk_is_enabled, | ||
479 | .enable = std_clk_enable, | ||
480 | .disable = std_clk_disable, | ||
481 | .set_rate = dmn_clk_set_rate, | ||
482 | .round_rate = dmn_clk_round_rate, | ||
483 | .recalc_rate = dmn_clk_recalc_rate, | ||
484 | .set_parent = dmn_clk_set_parent, | ||
485 | .get_parent = dmn_clk_get_parent, | ||
486 | }; | ||
487 | |||
488 | /* dsp, gfx, mm, lcd and vpp domain */ | ||
489 | |||
490 | static struct clk_init_data clk_dsp_init = { | ||
491 | .name = "dsp", | ||
492 | .ops = &dmn_ops, | ||
493 | .parent_names = dmn_clk_parents, | ||
494 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
495 | }; | ||
496 | |||
497 | static struct clk_dmn clk_dsp = { | ||
498 | .regofs = SIRFSOC_CLKC_DSP_CFG, | ||
499 | .enable_bit = 0, | ||
500 | .hw = { | ||
501 | .init = &clk_dsp_init, | ||
502 | }, | ||
503 | }; | ||
504 | |||
505 | static struct clk_init_data clk_gfx_init = { | ||
506 | .name = "gfx", | ||
507 | .ops = &dmn_ops, | ||
508 | .parent_names = dmn_clk_parents, | ||
509 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
510 | }; | ||
511 | |||
512 | static struct clk_dmn clk_gfx = { | ||
513 | .regofs = SIRFSOC_CLKC_GFX_CFG, | ||
514 | .enable_bit = 8, | ||
515 | .hw = { | ||
516 | .init = &clk_gfx_init, | ||
517 | }, | ||
518 | }; | ||
519 | |||
520 | static struct clk_init_data clk_mm_init = { | ||
521 | .name = "mm", | ||
522 | .ops = &dmn_ops, | ||
523 | .parent_names = dmn_clk_parents, | ||
524 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
525 | }; | ||
526 | |||
527 | static struct clk_dmn clk_mm = { | ||
528 | .regofs = SIRFSOC_CLKC_MM_CFG, | ||
529 | .enable_bit = 9, | ||
530 | .hw = { | ||
531 | .init = &clk_mm_init, | ||
532 | }, | ||
533 | }; | ||
534 | |||
535 | static struct clk_init_data clk_lcd_init = { | ||
536 | .name = "lcd", | ||
537 | .ops = &dmn_ops, | ||
538 | .parent_names = dmn_clk_parents, | ||
539 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
540 | }; | ||
541 | |||
542 | static struct clk_dmn clk_lcd = { | ||
543 | .regofs = SIRFSOC_CLKC_LCD_CFG, | ||
544 | .enable_bit = 10, | ||
545 | .hw = { | ||
546 | .init = &clk_lcd_init, | ||
547 | }, | ||
548 | }; | ||
549 | |||
550 | static struct clk_init_data clk_vpp_init = { | ||
551 | .name = "vpp", | ||
552 | .ops = &dmn_ops, | ||
553 | .parent_names = dmn_clk_parents, | ||
554 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
555 | }; | ||
556 | |||
557 | static struct clk_dmn clk_vpp = { | ||
558 | .regofs = SIRFSOC_CLKC_LCD_CFG, | ||
559 | .enable_bit = 11, | ||
560 | .hw = { | ||
561 | .init = &clk_vpp_init, | ||
562 | }, | ||
563 | }; | ||
564 | |||
565 | static struct clk_init_data clk_mmc01_init = { | ||
566 | .name = "mmc01", | ||
567 | .ops = &dmn_ops, | ||
568 | .parent_names = dmn_clk_parents, | ||
569 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
570 | }; | ||
571 | |||
572 | static struct clk_dmn clk_mmc01 = { | ||
573 | .regofs = SIRFSOC_CLKC_MMC_CFG, | ||
574 | .enable_bit = 59, | ||
575 | .hw = { | ||
576 | .init = &clk_mmc01_init, | ||
577 | }, | ||
578 | }; | ||
579 | |||
580 | static struct clk_init_data clk_mmc23_init = { | ||
581 | .name = "mmc23", | ||
582 | .ops = &dmn_ops, | ||
583 | .parent_names = dmn_clk_parents, | ||
584 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
585 | }; | ||
586 | |||
587 | static struct clk_dmn clk_mmc23 = { | ||
588 | .regofs = SIRFSOC_CLKC_MMC_CFG, | ||
589 | .enable_bit = 60, | ||
590 | .hw = { | ||
591 | .init = &clk_mmc23_init, | ||
592 | }, | ||
593 | }; | ||
594 | |||
595 | static struct clk_init_data clk_mmc45_init = { | ||
596 | .name = "mmc45", | ||
597 | .ops = &dmn_ops, | ||
598 | .parent_names = dmn_clk_parents, | ||
599 | .num_parents = ARRAY_SIZE(dmn_clk_parents), | ||
600 | }; | ||
601 | |||
602 | static struct clk_dmn clk_mmc45 = { | ||
603 | .regofs = SIRFSOC_CLKC_MMC_CFG, | ||
604 | .enable_bit = 61, | ||
605 | .hw = { | ||
606 | .init = &clk_mmc45_init, | ||
607 | }, | ||
608 | }; | ||
609 | |||
610 | /* | ||
611 | * peripheral controllers in io domain | ||
612 | */ | ||
613 | |||
614 | static int std_clk_is_enabled(struct clk_hw *hw) | ||
615 | { | ||
616 | u32 reg; | ||
617 | int bit; | ||
618 | struct clk_std *clk = to_stdclk(hw); | ||
619 | |||
620 | bit = clk->enable_bit % 32; | ||
621 | reg = clk->enable_bit / 32; | ||
622 | reg = SIRFSOC_CLKC_CLK_EN0 + reg * sizeof(reg); | ||
623 | |||
624 | return !!(clkc_readl(reg) & BIT(bit)); | ||
625 | } | ||
626 | |||
627 | static int std_clk_enable(struct clk_hw *hw) | ||
628 | { | ||
629 | u32 val, reg; | ||
630 | int bit; | ||
631 | struct clk_std *clk = to_stdclk(hw); | ||
632 | |||
633 | BUG_ON(clk->enable_bit < 0 || clk->enable_bit > 63); | ||
634 | |||
635 | bit = clk->enable_bit % 32; | ||
636 | reg = clk->enable_bit / 32; | ||
637 | reg = SIRFSOC_CLKC_CLK_EN0 + reg * sizeof(reg); | ||
638 | |||
639 | val = clkc_readl(reg) | BIT(bit); | ||
640 | clkc_writel(val, reg); | ||
641 | return 0; | ||
642 | } | ||
643 | |||
644 | static void std_clk_disable(struct clk_hw *hw) | ||
645 | { | ||
646 | u32 val, reg; | ||
647 | int bit; | ||
648 | struct clk_std *clk = to_stdclk(hw); | ||
649 | |||
650 | BUG_ON(clk->enable_bit < 0 || clk->enable_bit > 63); | ||
651 | |||
652 | bit = clk->enable_bit % 32; | ||
653 | reg = clk->enable_bit / 32; | ||
654 | reg = SIRFSOC_CLKC_CLK_EN0 + reg * sizeof(reg); | ||
655 | |||
656 | val = clkc_readl(reg) & ~BIT(bit); | ||
657 | clkc_writel(val, reg); | ||
658 | } | ||
659 | |||
660 | static const char *std_clk_io_parents[] = { | ||
661 | "io", | ||
662 | }; | ||
663 | |||
664 | static struct clk_ops ios_ops = { | ||
665 | .is_enabled = std_clk_is_enabled, | ||
666 | .enable = std_clk_enable, | ||
667 | .disable = std_clk_disable, | ||
668 | }; | ||
669 | |||
670 | static struct clk_init_data clk_dmac0_init = { | ||
671 | .name = "dmac0", | ||
672 | .ops = &ios_ops, | ||
673 | .parent_names = std_clk_io_parents, | ||
674 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
675 | }; | ||
676 | |||
677 | static struct clk_std clk_dmac0 = { | ||
678 | .enable_bit = 32, | ||
679 | .hw = { | ||
680 | .init = &clk_dmac0_init, | ||
681 | }, | ||
682 | }; | ||
683 | |||
684 | static struct clk_init_data clk_dmac1_init = { | ||
685 | .name = "dmac1", | ||
686 | .ops = &ios_ops, | ||
687 | .parent_names = std_clk_io_parents, | ||
688 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
689 | }; | ||
690 | |||
691 | static struct clk_std clk_dmac1 = { | ||
692 | .enable_bit = 33, | ||
693 | .hw = { | ||
694 | .init = &clk_dmac1_init, | ||
695 | }, | ||
696 | }; | ||
697 | |||
698 | static struct clk_init_data clk_nand_init = { | ||
699 | .name = "nand", | ||
700 | .ops = &ios_ops, | ||
701 | .parent_names = std_clk_io_parents, | ||
702 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
703 | }; | ||
704 | |||
705 | static struct clk_std clk_nand = { | ||
706 | .enable_bit = 34, | ||
707 | .hw = { | ||
708 | .init = &clk_nand_init, | ||
709 | }, | ||
710 | }; | ||
711 | |||
712 | static struct clk_init_data clk_audio_init = { | ||
713 | .name = "audio", | ||
714 | .ops = &ios_ops, | ||
715 | .parent_names = std_clk_io_parents, | ||
716 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
717 | }; | ||
718 | |||
719 | static struct clk_std clk_audio = { | ||
720 | .enable_bit = 35, | ||
721 | .hw = { | ||
722 | .init = &clk_audio_init, | ||
723 | }, | ||
724 | }; | ||
725 | |||
726 | static struct clk_init_data clk_uart0_init = { | ||
727 | .name = "uart0", | ||
728 | .ops = &ios_ops, | ||
729 | .parent_names = std_clk_io_parents, | ||
730 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
731 | }; | ||
732 | |||
733 | static struct clk_std clk_uart0 = { | ||
734 | .enable_bit = 36, | ||
735 | .hw = { | ||
736 | .init = &clk_uart0_init, | ||
737 | }, | ||
738 | }; | ||
739 | |||
740 | static struct clk_init_data clk_uart1_init = { | ||
741 | .name = "uart1", | ||
742 | .ops = &ios_ops, | ||
743 | .parent_names = std_clk_io_parents, | ||
744 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
745 | }; | ||
746 | |||
747 | static struct clk_std clk_uart1 = { | ||
748 | .enable_bit = 37, | ||
749 | .hw = { | ||
750 | .init = &clk_uart1_init, | ||
751 | }, | ||
752 | }; | ||
753 | |||
754 | static struct clk_init_data clk_uart2_init = { | ||
755 | .name = "uart2", | ||
756 | .ops = &ios_ops, | ||
757 | .parent_names = std_clk_io_parents, | ||
758 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
759 | }; | ||
760 | |||
761 | static struct clk_std clk_uart2 = { | ||
762 | .enable_bit = 38, | ||
763 | .hw = { | ||
764 | .init = &clk_uart2_init, | ||
765 | }, | ||
766 | }; | ||
767 | |||
768 | static struct clk_init_data clk_usp0_init = { | ||
769 | .name = "usp0", | ||
770 | .ops = &ios_ops, | ||
771 | .parent_names = std_clk_io_parents, | ||
772 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
773 | }; | ||
774 | |||
775 | static struct clk_std clk_usp0 = { | ||
776 | .enable_bit = 39, | ||
777 | .hw = { | ||
778 | .init = &clk_usp0_init, | ||
779 | }, | ||
780 | }; | ||
781 | |||
782 | static struct clk_init_data clk_usp1_init = { | ||
783 | .name = "usp1", | ||
784 | .ops = &ios_ops, | ||
785 | .parent_names = std_clk_io_parents, | ||
786 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
787 | }; | ||
788 | |||
789 | static struct clk_std clk_usp1 = { | ||
790 | .enable_bit = 40, | ||
791 | .hw = { | ||
792 | .init = &clk_usp1_init, | ||
793 | }, | ||
794 | }; | ||
795 | |||
796 | static struct clk_init_data clk_usp2_init = { | ||
797 | .name = "usp2", | ||
798 | .ops = &ios_ops, | ||
799 | .parent_names = std_clk_io_parents, | ||
800 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
801 | }; | ||
802 | |||
803 | static struct clk_std clk_usp2 = { | ||
804 | .enable_bit = 41, | ||
805 | .hw = { | ||
806 | .init = &clk_usp2_init, | ||
807 | }, | ||
808 | }; | ||
809 | |||
810 | static struct clk_init_data clk_vip_init = { | ||
811 | .name = "vip", | ||
812 | .ops = &ios_ops, | ||
813 | .parent_names = std_clk_io_parents, | ||
814 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
815 | }; | ||
816 | |||
817 | static struct clk_std clk_vip = { | ||
818 | .enable_bit = 42, | ||
819 | .hw = { | ||
820 | .init = &clk_vip_init, | ||
821 | }, | ||
822 | }; | ||
823 | |||
824 | static struct clk_init_data clk_spi0_init = { | ||
825 | .name = "spi0", | ||
826 | .ops = &ios_ops, | ||
827 | .parent_names = std_clk_io_parents, | ||
828 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
829 | }; | ||
830 | |||
831 | static struct clk_std clk_spi0 = { | ||
832 | .enable_bit = 43, | ||
833 | .hw = { | ||
834 | .init = &clk_spi0_init, | ||
835 | }, | ||
836 | }; | ||
837 | |||
838 | static struct clk_init_data clk_spi1_init = { | ||
839 | .name = "spi1", | ||
840 | .ops = &ios_ops, | ||
841 | .parent_names = std_clk_io_parents, | ||
842 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
843 | }; | ||
844 | |||
845 | static struct clk_std clk_spi1 = { | ||
846 | .enable_bit = 44, | ||
847 | .hw = { | ||
848 | .init = &clk_spi1_init, | ||
849 | }, | ||
850 | }; | ||
851 | |||
852 | static struct clk_init_data clk_tsc_init = { | ||
853 | .name = "tsc", | ||
854 | .ops = &ios_ops, | ||
855 | .parent_names = std_clk_io_parents, | ||
856 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
857 | }; | ||
858 | |||
859 | static struct clk_std clk_tsc = { | ||
860 | .enable_bit = 45, | ||
861 | .hw = { | ||
862 | .init = &clk_tsc_init, | ||
863 | }, | ||
864 | }; | ||
865 | |||
866 | static struct clk_init_data clk_i2c0_init = { | ||
867 | .name = "i2c0", | ||
868 | .ops = &ios_ops, | ||
869 | .parent_names = std_clk_io_parents, | ||
870 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
871 | }; | ||
872 | |||
873 | static struct clk_std clk_i2c0 = { | ||
874 | .enable_bit = 46, | ||
875 | .hw = { | ||
876 | .init = &clk_i2c0_init, | ||
877 | }, | ||
878 | }; | ||
879 | |||
880 | static struct clk_init_data clk_i2c1_init = { | ||
881 | .name = "i2c1", | ||
882 | .ops = &ios_ops, | ||
883 | .parent_names = std_clk_io_parents, | ||
884 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
885 | }; | ||
886 | |||
887 | static struct clk_std clk_i2c1 = { | ||
888 | .enable_bit = 47, | ||
889 | .hw = { | ||
890 | .init = &clk_i2c1_init, | ||
891 | }, | ||
892 | }; | ||
893 | |||
894 | static struct clk_init_data clk_pwmc_init = { | ||
895 | .name = "pwmc", | ||
896 | .ops = &ios_ops, | ||
897 | .parent_names = std_clk_io_parents, | ||
898 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
899 | }; | ||
900 | |||
901 | static struct clk_std clk_pwmc = { | ||
902 | .enable_bit = 48, | ||
903 | .hw = { | ||
904 | .init = &clk_pwmc_init, | ||
905 | }, | ||
906 | }; | ||
907 | |||
908 | static struct clk_init_data clk_efuse_init = { | ||
909 | .name = "efuse", | ||
910 | .ops = &ios_ops, | ||
911 | .parent_names = std_clk_io_parents, | ||
912 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
913 | }; | ||
914 | |||
915 | static struct clk_std clk_efuse = { | ||
916 | .enable_bit = 49, | ||
917 | .hw = { | ||
918 | .init = &clk_efuse_init, | ||
919 | }, | ||
920 | }; | ||
921 | |||
922 | static struct clk_init_data clk_pulse_init = { | ||
923 | .name = "pulse", | ||
924 | .ops = &ios_ops, | ||
925 | .parent_names = std_clk_io_parents, | ||
926 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
927 | }; | ||
928 | |||
929 | static struct clk_std clk_pulse = { | ||
930 | .enable_bit = 50, | ||
931 | .hw = { | ||
932 | .init = &clk_pulse_init, | ||
933 | }, | ||
934 | }; | ||
935 | |||
936 | static const char *std_clk_dsp_parents[] = { | ||
937 | "dsp", | ||
938 | }; | ||
939 | |||
940 | static struct clk_init_data clk_gps_init = { | ||
941 | .name = "gps", | ||
942 | .ops = &ios_ops, | ||
943 | .parent_names = std_clk_dsp_parents, | ||
944 | .num_parents = ARRAY_SIZE(std_clk_dsp_parents), | ||
945 | }; | ||
946 | |||
947 | static struct clk_std clk_gps = { | ||
948 | .enable_bit = 1, | ||
949 | .hw = { | ||
950 | .init = &clk_gps_init, | ||
951 | }, | ||
952 | }; | ||
953 | |||
954 | static struct clk_init_data clk_mf_init = { | ||
955 | .name = "mf", | ||
956 | .ops = &ios_ops, | ||
957 | .parent_names = std_clk_io_parents, | ||
958 | .num_parents = ARRAY_SIZE(std_clk_io_parents), | ||
959 | }; | ||
960 | |||
961 | static struct clk_std clk_mf = { | ||
962 | .enable_bit = 2, | ||
963 | .hw = { | ||
964 | .init = &clk_mf_init, | ||
965 | }, | ||
966 | }; | ||
967 | |||
968 | static const char *std_clk_sys_parents[] = { | ||
969 | "sys", | ||
970 | }; | ||
971 | |||
972 | static struct clk_init_data clk_security_init = { | ||
973 | .name = "mf", | ||
974 | .ops = &ios_ops, | ||
975 | .parent_names = std_clk_sys_parents, | ||
976 | .num_parents = ARRAY_SIZE(std_clk_sys_parents), | ||
977 | }; | ||
978 | |||
979 | static struct clk_std clk_security = { | ||
980 | .enable_bit = 19, | ||
981 | .hw = { | ||
982 | .init = &clk_security_init, | ||
983 | }, | ||
984 | }; | ||
985 | |||
986 | static const char *std_clk_usb_parents[] = { | ||
987 | "usb_pll", | ||
988 | }; | ||
989 | |||
990 | static struct clk_init_data clk_usb0_init = { | ||
991 | .name = "usb0", | ||
992 | .ops = &ios_ops, | ||
993 | .parent_names = std_clk_usb_parents, | ||
994 | .num_parents = ARRAY_SIZE(std_clk_usb_parents), | ||
995 | }; | ||
996 | |||
997 | static struct clk_std clk_usb0 = { | ||
998 | .enable_bit = 16, | ||
999 | .hw = { | ||
1000 | .init = &clk_usb0_init, | ||
1001 | }, | ||
1002 | }; | ||
1003 | |||
1004 | static struct clk_init_data clk_usb1_init = { | ||
1005 | .name = "usb1", | ||
1006 | .ops = &ios_ops, | ||
1007 | .parent_names = std_clk_usb_parents, | ||
1008 | .num_parents = ARRAY_SIZE(std_clk_usb_parents), | ||
1009 | }; | ||
1010 | |||
1011 | static struct clk_std clk_usb1 = { | ||
1012 | .enable_bit = 17, | ||
1013 | .hw = { | ||
1014 | .init = &clk_usb1_init, | ||
1015 | }, | ||
1016 | }; | ||
1017 | |||
1018 | static struct of_device_id clkc_ids[] = { | ||
1019 | { .compatible = "sirf,prima2-clkc" }, | ||
1020 | {}, | ||
1021 | }; | ||
1022 | |||
1023 | static struct of_device_id rsc_ids[] = { | ||
1024 | { .compatible = "sirf,prima2-rsc" }, | ||
1025 | {}, | ||
1026 | }; | ||
1027 | |||
1028 | void __init sirfsoc_of_clk_init(void) | ||
1029 | { | ||
1030 | struct clk *clk; | ||
1031 | struct device_node *np; | ||
1032 | |||
1033 | np = of_find_matching_node(NULL, clkc_ids); | ||
1034 | if (!np) | ||
1035 | panic("unable to find compatible clkc node in dtb\n"); | ||
1036 | |||
1037 | sirfsoc_clk_vbase = of_iomap(np, 0); | ||
1038 | if (!sirfsoc_clk_vbase) | ||
1039 | panic("unable to map clkc registers\n"); | ||
1040 | |||
1041 | of_node_put(np); | ||
1042 | |||
1043 | np = of_find_matching_node(NULL, rsc_ids); | ||
1044 | if (!np) | ||
1045 | panic("unable to find compatible rsc node in dtb\n"); | ||
1046 | |||
1047 | sirfsoc_rsc_vbase = of_iomap(np, 0); | ||
1048 | if (!sirfsoc_rsc_vbase) | ||
1049 | panic("unable to map rsc registers\n"); | ||
1050 | |||
1051 | of_node_put(np); | ||
1052 | |||
1053 | |||
1054 | /* These are always available (RTC and 26MHz OSC)*/ | ||
1055 | clk = clk_register_fixed_rate(NULL, "rtc", NULL, | ||
1056 | CLK_IS_ROOT, 32768); | ||
1057 | BUG_ON(!clk); | ||
1058 | clk = clk_register_fixed_rate(NULL, "osc", NULL, | ||
1059 | CLK_IS_ROOT, 26000000); | ||
1060 | BUG_ON(!clk); | ||
1061 | |||
1062 | clk = clk_register(NULL, &clk_pll1.hw); | ||
1063 | BUG_ON(!clk); | ||
1064 | clk = clk_register(NULL, &clk_pll2.hw); | ||
1065 | BUG_ON(!clk); | ||
1066 | clk = clk_register(NULL, &clk_pll3.hw); | ||
1067 | BUG_ON(!clk); | ||
1068 | clk = clk_register(NULL, &clk_mem.hw); | ||
1069 | BUG_ON(!clk); | ||
1070 | clk = clk_register(NULL, &clk_sys.hw); | ||
1071 | BUG_ON(!clk); | ||
1072 | clk = clk_register(NULL, &clk_security.hw); | ||
1073 | BUG_ON(!clk); | ||
1074 | clk_register_clkdev(clk, NULL, "b8030000.security"); | ||
1075 | clk = clk_register(NULL, &clk_dsp.hw); | ||
1076 | BUG_ON(!clk); | ||
1077 | clk = clk_register(NULL, &clk_gps.hw); | ||
1078 | BUG_ON(!clk); | ||
1079 | clk_register_clkdev(clk, NULL, "a8010000.gps"); | ||
1080 | clk = clk_register(NULL, &clk_mf.hw); | ||
1081 | BUG_ON(!clk); | ||
1082 | clk = clk_register(NULL, &clk_io.hw); | ||
1083 | BUG_ON(!clk); | ||
1084 | clk_register_clkdev(clk, NULL, "io"); | ||
1085 | clk = clk_register(NULL, &clk_cpu.hw); | ||
1086 | BUG_ON(!clk); | ||
1087 | clk_register_clkdev(clk, NULL, "cpu"); | ||
1088 | clk = clk_register(NULL, &clk_uart0.hw); | ||
1089 | BUG_ON(!clk); | ||
1090 | clk_register_clkdev(clk, NULL, "b0050000.uart"); | ||
1091 | clk = clk_register(NULL, &clk_uart1.hw); | ||
1092 | BUG_ON(!clk); | ||
1093 | clk_register_clkdev(clk, NULL, "b0060000.uart"); | ||
1094 | clk = clk_register(NULL, &clk_uart2.hw); | ||
1095 | BUG_ON(!clk); | ||
1096 | clk_register_clkdev(clk, NULL, "b0070000.uart"); | ||
1097 | clk = clk_register(NULL, &clk_tsc.hw); | ||
1098 | BUG_ON(!clk); | ||
1099 | clk_register_clkdev(clk, NULL, "b0110000.tsc"); | ||
1100 | clk = clk_register(NULL, &clk_i2c0.hw); | ||
1101 | BUG_ON(!clk); | ||
1102 | clk_register_clkdev(clk, NULL, "b00e0000.i2c"); | ||
1103 | clk = clk_register(NULL, &clk_i2c1.hw); | ||
1104 | BUG_ON(!clk); | ||
1105 | clk_register_clkdev(clk, NULL, "b00f0000.i2c"); | ||
1106 | clk = clk_register(NULL, &clk_spi0.hw); | ||
1107 | BUG_ON(!clk); | ||
1108 | clk_register_clkdev(clk, NULL, "b00d0000.spi"); | ||
1109 | clk = clk_register(NULL, &clk_spi1.hw); | ||
1110 | BUG_ON(!clk); | ||
1111 | clk_register_clkdev(clk, NULL, "b0170000.spi"); | ||
1112 | clk = clk_register(NULL, &clk_pwmc.hw); | ||
1113 | BUG_ON(!clk); | ||
1114 | clk_register_clkdev(clk, NULL, "b0130000.pwm"); | ||
1115 | clk = clk_register(NULL, &clk_efuse.hw); | ||
1116 | BUG_ON(!clk); | ||
1117 | clk_register_clkdev(clk, NULL, "b0140000.efusesys"); | ||
1118 | clk = clk_register(NULL, &clk_pulse.hw); | ||
1119 | BUG_ON(!clk); | ||
1120 | clk_register_clkdev(clk, NULL, "b0150000.pulsec"); | ||
1121 | clk = clk_register(NULL, &clk_dmac0.hw); | ||
1122 | BUG_ON(!clk); | ||
1123 | clk_register_clkdev(clk, NULL, "b00b0000.dma-controller"); | ||
1124 | clk = clk_register(NULL, &clk_dmac1.hw); | ||
1125 | BUG_ON(!clk); | ||
1126 | clk_register_clkdev(clk, NULL, "b0160000.dma-controller"); | ||
1127 | clk = clk_register(NULL, &clk_nand.hw); | ||
1128 | BUG_ON(!clk); | ||
1129 | clk_register_clkdev(clk, NULL, "b0030000.nand"); | ||
1130 | clk = clk_register(NULL, &clk_audio.hw); | ||
1131 | BUG_ON(!clk); | ||
1132 | clk_register_clkdev(clk, NULL, "b0040000.audio"); | ||
1133 | clk = clk_register(NULL, &clk_usp0.hw); | ||
1134 | BUG_ON(!clk); | ||
1135 | clk_register_clkdev(clk, NULL, "b0080000.usp"); | ||
1136 | clk = clk_register(NULL, &clk_usp1.hw); | ||
1137 | BUG_ON(!clk); | ||
1138 | clk_register_clkdev(clk, NULL, "b0090000.usp"); | ||
1139 | clk = clk_register(NULL, &clk_usp2.hw); | ||
1140 | BUG_ON(!clk); | ||
1141 | clk_register_clkdev(clk, NULL, "b00a0000.usp"); | ||
1142 | clk = clk_register(NULL, &clk_vip.hw); | ||
1143 | BUG_ON(!clk); | ||
1144 | clk_register_clkdev(clk, NULL, "b00c0000.vip"); | ||
1145 | clk = clk_register(NULL, &clk_gfx.hw); | ||
1146 | BUG_ON(!clk); | ||
1147 | clk_register_clkdev(clk, NULL, "98000000.graphics"); | ||
1148 | clk = clk_register(NULL, &clk_mm.hw); | ||
1149 | BUG_ON(!clk); | ||
1150 | clk_register_clkdev(clk, NULL, "a0000000.multimedia"); | ||
1151 | clk = clk_register(NULL, &clk_lcd.hw); | ||
1152 | BUG_ON(!clk); | ||
1153 | clk_register_clkdev(clk, NULL, "90010000.display"); | ||
1154 | clk = clk_register(NULL, &clk_vpp.hw); | ||
1155 | BUG_ON(!clk); | ||
1156 | clk_register_clkdev(clk, NULL, "90020000.vpp"); | ||
1157 | clk = clk_register(NULL, &clk_mmc01.hw); | ||
1158 | BUG_ON(!clk); | ||
1159 | clk = clk_register(NULL, &clk_mmc23.hw); | ||
1160 | BUG_ON(!clk); | ||
1161 | clk = clk_register(NULL, &clk_mmc45.hw); | ||
1162 | BUG_ON(!clk); | ||
1163 | clk = clk_register(NULL, &usb_pll_clk_hw); | ||
1164 | BUG_ON(!clk); | ||
1165 | clk = clk_register(NULL, &clk_usb0.hw); | ||
1166 | BUG_ON(!clk); | ||
1167 | clk_register_clkdev(clk, NULL, "b00e0000.usb"); | ||
1168 | clk = clk_register(NULL, &clk_usb1.hw); | ||
1169 | BUG_ON(!clk); | ||
1170 | clk_register_clkdev(clk, NULL, "b00f0000.usb"); | ||
1171 | } | ||
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index efdfd009c270..56e4495ebeb1 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -558,25 +558,6 @@ int clk_enable(struct clk *clk) | |||
558 | EXPORT_SYMBOL_GPL(clk_enable); | 558 | EXPORT_SYMBOL_GPL(clk_enable); |
559 | 559 | ||
560 | /** | 560 | /** |
561 | * clk_get_rate - return the rate of clk | ||
562 | * @clk: the clk whose rate is being returned | ||
563 | * | ||
564 | * Simply returns the cached rate of the clk. Does not query the hardware. If | ||
565 | * clk is NULL then returns 0. | ||
566 | */ | ||
567 | unsigned long clk_get_rate(struct clk *clk) | ||
568 | { | ||
569 | unsigned long rate; | ||
570 | |||
571 | mutex_lock(&prepare_lock); | ||
572 | rate = __clk_get_rate(clk); | ||
573 | mutex_unlock(&prepare_lock); | ||
574 | |||
575 | return rate; | ||
576 | } | ||
577 | EXPORT_SYMBOL_GPL(clk_get_rate); | ||
578 | |||
579 | /** | ||
580 | * __clk_round_rate - round the given rate for a clk | 561 | * __clk_round_rate - round the given rate for a clk |
581 | * @clk: round the rate of this clock | 562 | * @clk: round the rate of this clock |
582 | * | 563 | * |
@@ -702,6 +683,30 @@ static void __clk_recalc_rates(struct clk *clk, unsigned long msg) | |||
702 | } | 683 | } |
703 | 684 | ||
704 | /** | 685 | /** |
686 | * clk_get_rate - return the rate of clk | ||
687 | * @clk: the clk whose rate is being returned | ||
688 | * | ||
689 | * Simply returns the cached rate of the clk, unless CLK_GET_RATE_NOCACHE flag | ||
690 | * is set, which means a recalc_rate will be issued. | ||
691 | * If clk is NULL then returns 0. | ||
692 | */ | ||
693 | unsigned long clk_get_rate(struct clk *clk) | ||
694 | { | ||
695 | unsigned long rate; | ||
696 | |||
697 | mutex_lock(&prepare_lock); | ||
698 | |||
699 | if (clk && (clk->flags & CLK_GET_RATE_NOCACHE)) | ||
700 | __clk_recalc_rates(clk, 0); | ||
701 | |||
702 | rate = __clk_get_rate(clk); | ||
703 | mutex_unlock(&prepare_lock); | ||
704 | |||
705 | return rate; | ||
706 | } | ||
707 | EXPORT_SYMBOL_GPL(clk_get_rate); | ||
708 | |||
709 | /** | ||
705 | * __clk_speculate_rates | 710 | * __clk_speculate_rates |
706 | * @clk: first clk in the subtree | 711 | * @clk: first clk in the subtree |
707 | * @parent_rate: the "future" rate of clk's parent | 712 | * @parent_rate: the "future" rate of clk's parent |
@@ -1582,6 +1587,20 @@ struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, | |||
1582 | } | 1587 | } |
1583 | EXPORT_SYMBOL_GPL(of_clk_src_simple_get); | 1588 | EXPORT_SYMBOL_GPL(of_clk_src_simple_get); |
1584 | 1589 | ||
1590 | struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data) | ||
1591 | { | ||
1592 | struct clk_onecell_data *clk_data = data; | ||
1593 | unsigned int idx = clkspec->args[0]; | ||
1594 | |||
1595 | if (idx >= clk_data->clk_num) { | ||
1596 | pr_err("%s: invalid clock index %d\n", __func__, idx); | ||
1597 | return ERR_PTR(-EINVAL); | ||
1598 | } | ||
1599 | |||
1600 | return clk_data->clks[idx]; | ||
1601 | } | ||
1602 | EXPORT_SYMBOL_GPL(of_clk_src_onecell_get); | ||
1603 | |||
1585 | /** | 1604 | /** |
1586 | * of_clk_add_provider() - Register a clock provider for a node | 1605 | * of_clk_add_provider() - Register a clock provider for a node |
1587 | * @np: Device node pointer associated with clock provider | 1606 | * @np: Device node pointer associated with clock provider |
diff --git a/drivers/clk/mmp/Makefile b/drivers/clk/mmp/Makefile new file mode 100644 index 000000000000..392d78044ce3 --- /dev/null +++ b/drivers/clk/mmp/Makefile | |||
@@ -0,0 +1,9 @@ | |||
1 | # | ||
2 | # Makefile for mmp specific clk | ||
3 | # | ||
4 | |||
5 | obj-y += clk-apbc.o clk-apmu.o clk-frac.o | ||
6 | |||
7 | obj-$(CONFIG_CPU_PXA168) += clk-pxa168.o | ||
8 | obj-$(CONFIG_CPU_PXA910) += clk-pxa910.o | ||
9 | obj-$(CONFIG_CPU_MMP2) += clk-mmp2.o | ||
diff --git a/drivers/clk/mmp/clk-apbc.c b/drivers/clk/mmp/clk-apbc.c new file mode 100644 index 000000000000..d14120eaa71f --- /dev/null +++ b/drivers/clk/mmp/clk-apbc.c | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | * mmp APB clock operation source file | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * Chao Xie <xiechao.mail@gmail.com> | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public | ||
8 | * License version 2. This program is licensed "as is" without any | ||
9 | * warranty of any kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/clk.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/slab.h> | ||
18 | |||
19 | #include "clk.h" | ||
20 | |||
21 | /* Common APB clock register bit definitions */ | ||
22 | #define APBC_APBCLK (1 << 0) /* APB Bus Clock Enable */ | ||
23 | #define APBC_FNCLK (1 << 1) /* Functional Clock Enable */ | ||
24 | #define APBC_RST (1 << 2) /* Reset Generation */ | ||
25 | #define APBC_POWER (1 << 7) /* Reset Generation */ | ||
26 | |||
27 | #define to_clk_apbc(hw) container_of(hw, struct clk_apbc, hw) | ||
28 | struct clk_apbc { | ||
29 | struct clk_hw hw; | ||
30 | void __iomem *base; | ||
31 | unsigned int delay; | ||
32 | unsigned int flags; | ||
33 | spinlock_t *lock; | ||
34 | }; | ||
35 | |||
36 | static int clk_apbc_prepare(struct clk_hw *hw) | ||
37 | { | ||
38 | struct clk_apbc *apbc = to_clk_apbc(hw); | ||
39 | unsigned int data; | ||
40 | unsigned long flags = 0; | ||
41 | |||
42 | /* | ||
43 | * It may share same register as MUX clock, | ||
44 | * and it will impact FNCLK enable. Spinlock is needed | ||
45 | */ | ||
46 | if (apbc->lock) | ||
47 | spin_lock_irqsave(apbc->lock, flags); | ||
48 | |||
49 | data = readl_relaxed(apbc->base); | ||
50 | if (apbc->flags & APBC_POWER_CTRL) | ||
51 | data |= APBC_POWER; | ||
52 | data |= APBC_FNCLK; | ||
53 | writel_relaxed(data, apbc->base); | ||
54 | |||
55 | if (apbc->lock) | ||
56 | spin_unlock_irqrestore(apbc->lock, flags); | ||
57 | |||
58 | udelay(apbc->delay); | ||
59 | |||
60 | if (apbc->lock) | ||
61 | spin_lock_irqsave(apbc->lock, flags); | ||
62 | |||
63 | data = readl_relaxed(apbc->base); | ||
64 | data |= APBC_APBCLK; | ||
65 | writel_relaxed(data, apbc->base); | ||
66 | |||
67 | if (apbc->lock) | ||
68 | spin_unlock_irqrestore(apbc->lock, flags); | ||
69 | |||
70 | udelay(apbc->delay); | ||
71 | |||
72 | if (!(apbc->flags & APBC_NO_BUS_CTRL)) { | ||
73 | if (apbc->lock) | ||
74 | spin_lock_irqsave(apbc->lock, flags); | ||
75 | |||
76 | data = readl_relaxed(apbc->base); | ||
77 | data &= ~APBC_RST; | ||
78 | writel_relaxed(data, apbc->base); | ||
79 | |||
80 | if (apbc->lock) | ||
81 | spin_unlock_irqrestore(apbc->lock, flags); | ||
82 | } | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static void clk_apbc_unprepare(struct clk_hw *hw) | ||
88 | { | ||
89 | struct clk_apbc *apbc = to_clk_apbc(hw); | ||
90 | unsigned long data; | ||
91 | unsigned long flags = 0; | ||
92 | |||
93 | if (apbc->lock) | ||
94 | spin_lock_irqsave(apbc->lock, flags); | ||
95 | |||
96 | data = readl_relaxed(apbc->base); | ||
97 | if (apbc->flags & APBC_POWER_CTRL) | ||
98 | data &= ~APBC_POWER; | ||
99 | data &= ~APBC_FNCLK; | ||
100 | writel_relaxed(data, apbc->base); | ||
101 | |||
102 | if (apbc->lock) | ||
103 | spin_unlock_irqrestore(apbc->lock, flags); | ||
104 | |||
105 | udelay(10); | ||
106 | |||
107 | if (apbc->lock) | ||
108 | spin_lock_irqsave(apbc->lock, flags); | ||
109 | |||
110 | data = readl_relaxed(apbc->base); | ||
111 | data &= ~APBC_APBCLK; | ||
112 | writel_relaxed(data, apbc->base); | ||
113 | |||
114 | if (apbc->lock) | ||
115 | spin_unlock_irqrestore(apbc->lock, flags); | ||
116 | } | ||
117 | |||
118 | struct clk_ops clk_apbc_ops = { | ||
119 | .prepare = clk_apbc_prepare, | ||
120 | .unprepare = clk_apbc_unprepare, | ||
121 | }; | ||
122 | |||
123 | struct clk *mmp_clk_register_apbc(const char *name, const char *parent_name, | ||
124 | void __iomem *base, unsigned int delay, | ||
125 | unsigned int apbc_flags, spinlock_t *lock) | ||
126 | { | ||
127 | struct clk_apbc *apbc; | ||
128 | struct clk *clk; | ||
129 | struct clk_init_data init; | ||
130 | |||
131 | apbc = kzalloc(sizeof(*apbc), GFP_KERNEL); | ||
132 | if (!apbc) | ||
133 | return NULL; | ||
134 | |||
135 | init.name = name; | ||
136 | init.ops = &clk_apbc_ops; | ||
137 | init.flags = CLK_SET_RATE_PARENT; | ||
138 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
139 | init.num_parents = (parent_name ? 1 : 0); | ||
140 | |||
141 | apbc->base = base; | ||
142 | apbc->delay = delay; | ||
143 | apbc->flags = apbc_flags; | ||
144 | apbc->lock = lock; | ||
145 | apbc->hw.init = &init; | ||
146 | |||
147 | clk = clk_register(NULL, &apbc->hw); | ||
148 | if (IS_ERR(clk)) | ||
149 | kfree(apbc); | ||
150 | |||
151 | return clk; | ||
152 | } | ||
diff --git a/drivers/clk/mmp/clk-apmu.c b/drivers/clk/mmp/clk-apmu.c new file mode 100644 index 000000000000..abe182b2377f --- /dev/null +++ b/drivers/clk/mmp/clk-apmu.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * mmp AXI peripharal clock operation source file | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * Chao Xie <xiechao.mail@gmail.com> | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public | ||
8 | * License version 2. This program is licensed "as is" without any | ||
9 | * warranty of any kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/clk.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/slab.h> | ||
18 | |||
19 | #include "clk.h" | ||
20 | |||
21 | #define to_clk_apmu(clk) (container_of(clk, struct clk_apmu, clk)) | ||
22 | struct clk_apmu { | ||
23 | struct clk_hw hw; | ||
24 | void __iomem *base; | ||
25 | u32 rst_mask; | ||
26 | u32 enable_mask; | ||
27 | spinlock_t *lock; | ||
28 | }; | ||
29 | |||
30 | static int clk_apmu_enable(struct clk_hw *hw) | ||
31 | { | ||
32 | struct clk_apmu *apmu = to_clk_apmu(hw); | ||
33 | unsigned long data; | ||
34 | unsigned long flags = 0; | ||
35 | |||
36 | if (apmu->lock) | ||
37 | spin_lock_irqsave(apmu->lock, flags); | ||
38 | |||
39 | data = readl_relaxed(apmu->base) | apmu->enable_mask; | ||
40 | writel_relaxed(data, apmu->base); | ||
41 | |||
42 | if (apmu->lock) | ||
43 | spin_unlock_irqrestore(apmu->lock, flags); | ||
44 | |||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static void clk_apmu_disable(struct clk_hw *hw) | ||
49 | { | ||
50 | struct clk_apmu *apmu = to_clk_apmu(hw); | ||
51 | unsigned long data; | ||
52 | unsigned long flags = 0; | ||
53 | |||
54 | if (apmu->lock) | ||
55 | spin_lock_irqsave(apmu->lock, flags); | ||
56 | |||
57 | data = readl_relaxed(apmu->base) & ~apmu->enable_mask; | ||
58 | writel_relaxed(data, apmu->base); | ||
59 | |||
60 | if (apmu->lock) | ||
61 | spin_unlock_irqrestore(apmu->lock, flags); | ||
62 | } | ||
63 | |||
64 | struct clk_ops clk_apmu_ops = { | ||
65 | .enable = clk_apmu_enable, | ||
66 | .disable = clk_apmu_disable, | ||
67 | }; | ||
68 | |||
69 | struct clk *mmp_clk_register_apmu(const char *name, const char *parent_name, | ||
70 | void __iomem *base, u32 enable_mask, spinlock_t *lock) | ||
71 | { | ||
72 | struct clk_apmu *apmu; | ||
73 | struct clk *clk; | ||
74 | struct clk_init_data init; | ||
75 | |||
76 | apmu = kzalloc(sizeof(*apmu), GFP_KERNEL); | ||
77 | if (!apmu) | ||
78 | return NULL; | ||
79 | |||
80 | init.name = name; | ||
81 | init.ops = &clk_apmu_ops; | ||
82 | init.flags = CLK_SET_RATE_PARENT; | ||
83 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
84 | init.num_parents = (parent_name ? 1 : 0); | ||
85 | |||
86 | apmu->base = base; | ||
87 | apmu->enable_mask = enable_mask; | ||
88 | apmu->lock = lock; | ||
89 | apmu->hw.init = &init; | ||
90 | |||
91 | clk = clk_register(NULL, &apmu->hw); | ||
92 | |||
93 | if (IS_ERR(clk)) | ||
94 | kfree(apmu); | ||
95 | |||
96 | return clk; | ||
97 | } | ||
diff --git a/drivers/clk/mmp/clk-frac.c b/drivers/clk/mmp/clk-frac.c new file mode 100644 index 000000000000..80c1dd15d15c --- /dev/null +++ b/drivers/clk/mmp/clk-frac.c | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | * mmp factor clock operation source file | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * Chao Xie <xiechao.mail@gmail.com> | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public | ||
8 | * License version 2. This program is licensed "as is" without any | ||
9 | * warranty of any kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk-provider.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/err.h> | ||
16 | |||
17 | #include "clk.h" | ||
18 | /* | ||
19 | * It is M/N clock | ||
20 | * | ||
21 | * Fout from synthesizer can be given from two equations: | ||
22 | * numerator/denominator = Fin / (Fout * factor) | ||
23 | */ | ||
24 | |||
25 | #define to_clk_factor(hw) container_of(hw, struct clk_factor, hw) | ||
26 | struct clk_factor { | ||
27 | struct clk_hw hw; | ||
28 | void __iomem *base; | ||
29 | struct clk_factor_masks *masks; | ||
30 | struct clk_factor_tbl *ftbl; | ||
31 | unsigned int ftbl_cnt; | ||
32 | }; | ||
33 | |||
34 | static long clk_factor_round_rate(struct clk_hw *hw, unsigned long drate, | ||
35 | unsigned long *prate) | ||
36 | { | ||
37 | struct clk_factor *factor = to_clk_factor(hw); | ||
38 | unsigned long rate = 0, prev_rate; | ||
39 | int i; | ||
40 | |||
41 | for (i = 0; i < factor->ftbl_cnt; i++) { | ||
42 | prev_rate = rate; | ||
43 | rate = (((*prate / 10000) * factor->ftbl[i].num) / | ||
44 | (factor->ftbl[i].den * factor->masks->factor)) * 10000; | ||
45 | if (rate > drate) | ||
46 | break; | ||
47 | } | ||
48 | if (i == 0) | ||
49 | return rate; | ||
50 | else | ||
51 | return prev_rate; | ||
52 | } | ||
53 | |||
54 | static unsigned long clk_factor_recalc_rate(struct clk_hw *hw, | ||
55 | unsigned long parent_rate) | ||
56 | { | ||
57 | struct clk_factor *factor = to_clk_factor(hw); | ||
58 | struct clk_factor_masks *masks = factor->masks; | ||
59 | unsigned int val, num, den; | ||
60 | |||
61 | val = readl_relaxed(factor->base); | ||
62 | |||
63 | /* calculate numerator */ | ||
64 | num = (val >> masks->num_shift) & masks->num_mask; | ||
65 | |||
66 | /* calculate denominator */ | ||
67 | den = (val >> masks->den_shift) & masks->num_mask; | ||
68 | |||
69 | if (!den) | ||
70 | return 0; | ||
71 | |||
72 | return (((parent_rate / 10000) * den) / | ||
73 | (num * factor->masks->factor)) * 10000; | ||
74 | } | ||
75 | |||
76 | /* Configures new clock rate*/ | ||
77 | static int clk_factor_set_rate(struct clk_hw *hw, unsigned long drate, | ||
78 | unsigned long prate) | ||
79 | { | ||
80 | struct clk_factor *factor = to_clk_factor(hw); | ||
81 | struct clk_factor_masks *masks = factor->masks; | ||
82 | int i; | ||
83 | unsigned long val; | ||
84 | unsigned long prev_rate, rate = 0; | ||
85 | |||
86 | for (i = 0; i < factor->ftbl_cnt; i++) { | ||
87 | prev_rate = rate; | ||
88 | rate = (((prate / 10000) * factor->ftbl[i].num) / | ||
89 | (factor->ftbl[i].den * factor->masks->factor)) * 10000; | ||
90 | if (rate > drate) | ||
91 | break; | ||
92 | } | ||
93 | if (i > 0) | ||
94 | i--; | ||
95 | |||
96 | val = readl_relaxed(factor->base); | ||
97 | |||
98 | val &= ~(masks->num_mask << masks->num_shift); | ||
99 | val |= (factor->ftbl[i].num & masks->num_mask) << masks->num_shift; | ||
100 | |||
101 | val &= ~(masks->den_mask << masks->den_shift); | ||
102 | val |= (factor->ftbl[i].den & masks->den_mask) << masks->den_shift; | ||
103 | |||
104 | writel_relaxed(val, factor->base); | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static struct clk_ops clk_factor_ops = { | ||
110 | .recalc_rate = clk_factor_recalc_rate, | ||
111 | .round_rate = clk_factor_round_rate, | ||
112 | .set_rate = clk_factor_set_rate, | ||
113 | }; | ||
114 | |||
115 | struct clk *mmp_clk_register_factor(const char *name, const char *parent_name, | ||
116 | unsigned long flags, void __iomem *base, | ||
117 | struct clk_factor_masks *masks, struct clk_factor_tbl *ftbl, | ||
118 | unsigned int ftbl_cnt) | ||
119 | { | ||
120 | struct clk_factor *factor; | ||
121 | struct clk_init_data init; | ||
122 | struct clk *clk; | ||
123 | |||
124 | if (!masks) { | ||
125 | pr_err("%s: must pass a clk_factor_mask\n", __func__); | ||
126 | return ERR_PTR(-EINVAL); | ||
127 | } | ||
128 | |||
129 | factor = kzalloc(sizeof(*factor), GFP_KERNEL); | ||
130 | if (!factor) { | ||
131 | pr_err("%s: could not allocate factor clk\n", __func__); | ||
132 | return ERR_PTR(-ENOMEM); | ||
133 | } | ||
134 | |||
135 | /* struct clk_aux assignments */ | ||
136 | factor->base = base; | ||
137 | factor->masks = masks; | ||
138 | factor->ftbl = ftbl; | ||
139 | factor->ftbl_cnt = ftbl_cnt; | ||
140 | factor->hw.init = &init; | ||
141 | |||
142 | init.name = name; | ||
143 | init.ops = &clk_factor_ops; | ||
144 | init.flags = flags; | ||
145 | init.parent_names = &parent_name; | ||
146 | init.num_parents = 1; | ||
147 | |||
148 | clk = clk_register(NULL, &factor->hw); | ||
149 | if (IS_ERR_OR_NULL(clk)) | ||
150 | kfree(factor); | ||
151 | |||
152 | return clk; | ||
153 | } | ||
diff --git a/drivers/clk/mmp/clk-mmp2.c b/drivers/clk/mmp/clk-mmp2.c new file mode 100644 index 000000000000..ade435820c7e --- /dev/null +++ b/drivers/clk/mmp/clk-mmp2.c | |||
@@ -0,0 +1,449 @@ | |||
1 | /* | ||
2 | * mmp2 clock framework source file | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * Chao Xie <xiechao.mail@gmail.com> | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public | ||
8 | * License version 2. This program is licensed "as is" without any | ||
9 | * warranty of any kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/spinlock.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/err.h> | ||
18 | |||
19 | #include <mach/addr-map.h> | ||
20 | |||
21 | #include "clk.h" | ||
22 | |||
23 | #define APBC_RTC 0x0 | ||
24 | #define APBC_TWSI0 0x4 | ||
25 | #define APBC_TWSI1 0x8 | ||
26 | #define APBC_TWSI2 0xc | ||
27 | #define APBC_TWSI3 0x10 | ||
28 | #define APBC_TWSI4 0x7c | ||
29 | #define APBC_TWSI5 0x80 | ||
30 | #define APBC_KPC 0x18 | ||
31 | #define APBC_UART0 0x2c | ||
32 | #define APBC_UART1 0x30 | ||
33 | #define APBC_UART2 0x34 | ||
34 | #define APBC_UART3 0x88 | ||
35 | #define APBC_GPIO 0x38 | ||
36 | #define APBC_PWM0 0x3c | ||
37 | #define APBC_PWM1 0x40 | ||
38 | #define APBC_PWM2 0x44 | ||
39 | #define APBC_PWM3 0x48 | ||
40 | #define APBC_SSP0 0x50 | ||
41 | #define APBC_SSP1 0x54 | ||
42 | #define APBC_SSP2 0x58 | ||
43 | #define APBC_SSP3 0x5c | ||
44 | #define APMU_SDH0 0x54 | ||
45 | #define APMU_SDH1 0x58 | ||
46 | #define APMU_SDH2 0xe8 | ||
47 | #define APMU_SDH3 0xec | ||
48 | #define APMU_USB 0x5c | ||
49 | #define APMU_DISP0 0x4c | ||
50 | #define APMU_DISP1 0x110 | ||
51 | #define APMU_CCIC0 0x50 | ||
52 | #define APMU_CCIC1 0xf4 | ||
53 | #define MPMU_UART_PLL 0x14 | ||
54 | |||
55 | static DEFINE_SPINLOCK(clk_lock); | ||
56 | |||
57 | static struct clk_factor_masks uart_factor_masks = { | ||
58 | .factor = 2, | ||
59 | .num_mask = 0x1fff, | ||
60 | .den_mask = 0x1fff, | ||
61 | .num_shift = 16, | ||
62 | .den_shift = 0, | ||
63 | }; | ||
64 | |||
65 | static struct clk_factor_tbl uart_factor_tbl[] = { | ||
66 | {.num = 14634, .den = 2165}, /*14.745MHZ */ | ||
67 | {.num = 3521, .den = 689}, /*19.23MHZ */ | ||
68 | {.num = 9679, .den = 5728}, /*58.9824MHZ */ | ||
69 | {.num = 15850, .den = 9451}, /*59.429MHZ */ | ||
70 | }; | ||
71 | |||
72 | static const char *uart_parent[] = {"uart_pll", "vctcxo"}; | ||
73 | static const char *ssp_parent[] = {"vctcxo_4", "vctcxo_2", "vctcxo", "pll1_16"}; | ||
74 | static const char *sdh_parent[] = {"pll1_4", "pll2", "usb_pll", "pll1"}; | ||
75 | static const char *disp_parent[] = {"pll1", "pll1_16", "pll2", "vctcxo"}; | ||
76 | static const char *ccic_parent[] = {"pll1_2", "pll1_16", "vctcxo"}; | ||
77 | |||
78 | void __init mmp2_clk_init(void) | ||
79 | { | ||
80 | struct clk *clk; | ||
81 | struct clk *vctcxo; | ||
82 | void __iomem *mpmu_base; | ||
83 | void __iomem *apmu_base; | ||
84 | void __iomem *apbc_base; | ||
85 | |||
86 | mpmu_base = ioremap(APB_PHYS_BASE + 0x50000, SZ_4K); | ||
87 | if (mpmu_base == NULL) { | ||
88 | pr_err("error to ioremap MPMU base\n"); | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | apmu_base = ioremap(AXI_PHYS_BASE + 0x82800, SZ_4K); | ||
93 | if (apmu_base == NULL) { | ||
94 | pr_err("error to ioremap APMU base\n"); | ||
95 | return; | ||
96 | } | ||
97 | |||
98 | apbc_base = ioremap(APB_PHYS_BASE + 0x15000, SZ_4K); | ||
99 | if (apbc_base == NULL) { | ||
100 | pr_err("error to ioremap APBC base\n"); | ||
101 | return; | ||
102 | } | ||
103 | |||
104 | clk = clk_register_fixed_rate(NULL, "clk32", NULL, CLK_IS_ROOT, 3200); | ||
105 | clk_register_clkdev(clk, "clk32", NULL); | ||
106 | |||
107 | vctcxo = clk_register_fixed_rate(NULL, "vctcxo", NULL, CLK_IS_ROOT, | ||
108 | 26000000); | ||
109 | clk_register_clkdev(vctcxo, "vctcxo", NULL); | ||
110 | |||
111 | clk = clk_register_fixed_rate(NULL, "pll1", NULL, CLK_IS_ROOT, | ||
112 | 800000000); | ||
113 | clk_register_clkdev(clk, "pll1", NULL); | ||
114 | |||
115 | clk = clk_register_fixed_rate(NULL, "usb_pll", NULL, CLK_IS_ROOT, | ||
116 | 480000000); | ||
117 | clk_register_clkdev(clk, "usb_pll", NULL); | ||
118 | |||
119 | clk = clk_register_fixed_rate(NULL, "pll2", NULL, CLK_IS_ROOT, | ||
120 | 960000000); | ||
121 | clk_register_clkdev(clk, "pll2", NULL); | ||
122 | |||
123 | clk = clk_register_fixed_factor(NULL, "pll1_2", "pll1", | ||
124 | CLK_SET_RATE_PARENT, 1, 2); | ||
125 | clk_register_clkdev(clk, "pll1_2", NULL); | ||
126 | |||
127 | clk = clk_register_fixed_factor(NULL, "pll1_4", "pll1_2", | ||
128 | CLK_SET_RATE_PARENT, 1, 2); | ||
129 | clk_register_clkdev(clk, "pll1_4", NULL); | ||
130 | |||
131 | clk = clk_register_fixed_factor(NULL, "pll1_8", "pll1_4", | ||
132 | CLK_SET_RATE_PARENT, 1, 2); | ||
133 | clk_register_clkdev(clk, "pll1_8", NULL); | ||
134 | |||
135 | clk = clk_register_fixed_factor(NULL, "pll1_16", "pll1_8", | ||
136 | CLK_SET_RATE_PARENT, 1, 2); | ||
137 | clk_register_clkdev(clk, "pll1_16", NULL); | ||
138 | |||
139 | clk = clk_register_fixed_factor(NULL, "pll1_20", "pll1_4", | ||
140 | CLK_SET_RATE_PARENT, 1, 5); | ||
141 | clk_register_clkdev(clk, "pll1_20", NULL); | ||
142 | |||
143 | clk = clk_register_fixed_factor(NULL, "pll1_3", "pll1", | ||
144 | CLK_SET_RATE_PARENT, 1, 3); | ||
145 | clk_register_clkdev(clk, "pll1_3", NULL); | ||
146 | |||
147 | clk = clk_register_fixed_factor(NULL, "pll1_6", "pll1_3", | ||
148 | CLK_SET_RATE_PARENT, 1, 2); | ||
149 | clk_register_clkdev(clk, "pll1_6", NULL); | ||
150 | |||
151 | clk = clk_register_fixed_factor(NULL, "pll1_12", "pll1_6", | ||
152 | CLK_SET_RATE_PARENT, 1, 2); | ||
153 | clk_register_clkdev(clk, "pll1_12", NULL); | ||
154 | |||
155 | clk = clk_register_fixed_factor(NULL, "pll2_2", "pll2", | ||
156 | CLK_SET_RATE_PARENT, 1, 2); | ||
157 | clk_register_clkdev(clk, "pll2_2", NULL); | ||
158 | |||
159 | clk = clk_register_fixed_factor(NULL, "pll2_4", "pll2_2", | ||
160 | CLK_SET_RATE_PARENT, 1, 2); | ||
161 | clk_register_clkdev(clk, "pll2_4", NULL); | ||
162 | |||
163 | clk = clk_register_fixed_factor(NULL, "pll2_8", "pll2_4", | ||
164 | CLK_SET_RATE_PARENT, 1, 2); | ||
165 | clk_register_clkdev(clk, "pll2_8", NULL); | ||
166 | |||
167 | clk = clk_register_fixed_factor(NULL, "pll2_16", "pll2_8", | ||
168 | CLK_SET_RATE_PARENT, 1, 2); | ||
169 | clk_register_clkdev(clk, "pll2_16", NULL); | ||
170 | |||
171 | clk = clk_register_fixed_factor(NULL, "pll2_3", "pll2", | ||
172 | CLK_SET_RATE_PARENT, 1, 3); | ||
173 | clk_register_clkdev(clk, "pll2_3", NULL); | ||
174 | |||
175 | clk = clk_register_fixed_factor(NULL, "pll2_6", "pll2_3", | ||
176 | CLK_SET_RATE_PARENT, 1, 2); | ||
177 | clk_register_clkdev(clk, "pll2_6", NULL); | ||
178 | |||
179 | clk = clk_register_fixed_factor(NULL, "pll2_12", "pll2_6", | ||
180 | CLK_SET_RATE_PARENT, 1, 2); | ||
181 | clk_register_clkdev(clk, "pll2_12", NULL); | ||
182 | |||
183 | clk = clk_register_fixed_factor(NULL, "vctcxo_2", "vctcxo", | ||
184 | CLK_SET_RATE_PARENT, 1, 2); | ||
185 | clk_register_clkdev(clk, "vctcxo_2", NULL); | ||
186 | |||
187 | clk = clk_register_fixed_factor(NULL, "vctcxo_4", "vctcxo_2", | ||
188 | CLK_SET_RATE_PARENT, 1, 2); | ||
189 | clk_register_clkdev(clk, "vctcxo_4", NULL); | ||
190 | |||
191 | clk = mmp_clk_register_factor("uart_pll", "pll1_4", 0, | ||
192 | mpmu_base + MPMU_UART_PLL, | ||
193 | &uart_factor_masks, uart_factor_tbl, | ||
194 | ARRAY_SIZE(uart_factor_tbl)); | ||
195 | clk_set_rate(clk, 14745600); | ||
196 | clk_register_clkdev(clk, "uart_pll", NULL); | ||
197 | |||
198 | clk = mmp_clk_register_apbc("twsi0", "vctcxo", | ||
199 | apbc_base + APBC_TWSI0, 10, 0, &clk_lock); | ||
200 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.0"); | ||
201 | |||
202 | clk = mmp_clk_register_apbc("twsi1", "vctcxo", | ||
203 | apbc_base + APBC_TWSI1, 10, 0, &clk_lock); | ||
204 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.1"); | ||
205 | |||
206 | clk = mmp_clk_register_apbc("twsi2", "vctcxo", | ||
207 | apbc_base + APBC_TWSI2, 10, 0, &clk_lock); | ||
208 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.2"); | ||
209 | |||
210 | clk = mmp_clk_register_apbc("twsi3", "vctcxo", | ||
211 | apbc_base + APBC_TWSI3, 10, 0, &clk_lock); | ||
212 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.3"); | ||
213 | |||
214 | clk = mmp_clk_register_apbc("twsi4", "vctcxo", | ||
215 | apbc_base + APBC_TWSI4, 10, 0, &clk_lock); | ||
216 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.4"); | ||
217 | |||
218 | clk = mmp_clk_register_apbc("twsi5", "vctcxo", | ||
219 | apbc_base + APBC_TWSI5, 10, 0, &clk_lock); | ||
220 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.5"); | ||
221 | |||
222 | clk = mmp_clk_register_apbc("gpio", "vctcxo", | ||
223 | apbc_base + APBC_GPIO, 10, 0, &clk_lock); | ||
224 | clk_register_clkdev(clk, NULL, "pxa-gpio"); | ||
225 | |||
226 | clk = mmp_clk_register_apbc("kpc", "clk32", | ||
227 | apbc_base + APBC_KPC, 10, 0, &clk_lock); | ||
228 | clk_register_clkdev(clk, NULL, "pxa27x-keypad"); | ||
229 | |||
230 | clk = mmp_clk_register_apbc("rtc", "clk32", | ||
231 | apbc_base + APBC_RTC, 10, 0, &clk_lock); | ||
232 | clk_register_clkdev(clk, NULL, "mmp-rtc"); | ||
233 | |||
234 | clk = mmp_clk_register_apbc("pwm0", "vctcxo", | ||
235 | apbc_base + APBC_PWM0, 10, 0, &clk_lock); | ||
236 | clk_register_clkdev(clk, NULL, "mmp2-pwm.0"); | ||
237 | |||
238 | clk = mmp_clk_register_apbc("pwm1", "vctcxo", | ||
239 | apbc_base + APBC_PWM1, 10, 0, &clk_lock); | ||
240 | clk_register_clkdev(clk, NULL, "mmp2-pwm.1"); | ||
241 | |||
242 | clk = mmp_clk_register_apbc("pwm2", "vctcxo", | ||
243 | apbc_base + APBC_PWM2, 10, 0, &clk_lock); | ||
244 | clk_register_clkdev(clk, NULL, "mmp2-pwm.2"); | ||
245 | |||
246 | clk = mmp_clk_register_apbc("pwm3", "vctcxo", | ||
247 | apbc_base + APBC_PWM3, 10, 0, &clk_lock); | ||
248 | clk_register_clkdev(clk, NULL, "mmp2-pwm.3"); | ||
249 | |||
250 | clk = clk_register_mux(NULL, "uart0_mux", uart_parent, | ||
251 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
252 | apbc_base + APBC_UART0, 4, 3, 0, &clk_lock); | ||
253 | clk_set_parent(clk, vctcxo); | ||
254 | clk_register_clkdev(clk, "uart_mux.0", NULL); | ||
255 | |||
256 | clk = mmp_clk_register_apbc("uart0", "uart0_mux", | ||
257 | apbc_base + APBC_UART0, 10, 0, &clk_lock); | ||
258 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.0"); | ||
259 | |||
260 | clk = clk_register_mux(NULL, "uart1_mux", uart_parent, | ||
261 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
262 | apbc_base + APBC_UART1, 4, 3, 0, &clk_lock); | ||
263 | clk_set_parent(clk, vctcxo); | ||
264 | clk_register_clkdev(clk, "uart_mux.1", NULL); | ||
265 | |||
266 | clk = mmp_clk_register_apbc("uart1", "uart1_mux", | ||
267 | apbc_base + APBC_UART1, 10, 0, &clk_lock); | ||
268 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.1"); | ||
269 | |||
270 | clk = clk_register_mux(NULL, "uart2_mux", uart_parent, | ||
271 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
272 | apbc_base + APBC_UART2, 4, 3, 0, &clk_lock); | ||
273 | clk_set_parent(clk, vctcxo); | ||
274 | clk_register_clkdev(clk, "uart_mux.2", NULL); | ||
275 | |||
276 | clk = mmp_clk_register_apbc("uart2", "uart2_mux", | ||
277 | apbc_base + APBC_UART2, 10, 0, &clk_lock); | ||
278 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.2"); | ||
279 | |||
280 | clk = clk_register_mux(NULL, "uart3_mux", uart_parent, | ||
281 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
282 | apbc_base + APBC_UART3, 4, 3, 0, &clk_lock); | ||
283 | clk_set_parent(clk, vctcxo); | ||
284 | clk_register_clkdev(clk, "uart_mux.3", NULL); | ||
285 | |||
286 | clk = mmp_clk_register_apbc("uart3", "uart3_mux", | ||
287 | apbc_base + APBC_UART3, 10, 0, &clk_lock); | ||
288 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.3"); | ||
289 | |||
290 | clk = clk_register_mux(NULL, "ssp0_mux", ssp_parent, | ||
291 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
292 | apbc_base + APBC_SSP0, 4, 3, 0, &clk_lock); | ||
293 | clk_register_clkdev(clk, "uart_mux.0", NULL); | ||
294 | |||
295 | clk = mmp_clk_register_apbc("ssp0", "ssp0_mux", | ||
296 | apbc_base + APBC_SSP0, 10, 0, &clk_lock); | ||
297 | clk_register_clkdev(clk, NULL, "mmp-ssp.0"); | ||
298 | |||
299 | clk = clk_register_mux(NULL, "ssp1_mux", ssp_parent, | ||
300 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
301 | apbc_base + APBC_SSP1, 4, 3, 0, &clk_lock); | ||
302 | clk_register_clkdev(clk, "ssp_mux.1", NULL); | ||
303 | |||
304 | clk = mmp_clk_register_apbc("ssp1", "ssp1_mux", | ||
305 | apbc_base + APBC_SSP1, 10, 0, &clk_lock); | ||
306 | clk_register_clkdev(clk, NULL, "mmp-ssp.1"); | ||
307 | |||
308 | clk = clk_register_mux(NULL, "ssp2_mux", ssp_parent, | ||
309 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
310 | apbc_base + APBC_SSP2, 4, 3, 0, &clk_lock); | ||
311 | clk_register_clkdev(clk, "ssp_mux.2", NULL); | ||
312 | |||
313 | clk = mmp_clk_register_apbc("ssp2", "ssp2_mux", | ||
314 | apbc_base + APBC_SSP2, 10, 0, &clk_lock); | ||
315 | clk_register_clkdev(clk, NULL, "mmp-ssp.2"); | ||
316 | |||
317 | clk = clk_register_mux(NULL, "ssp3_mux", ssp_parent, | ||
318 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
319 | apbc_base + APBC_SSP3, 4, 3, 0, &clk_lock); | ||
320 | clk_register_clkdev(clk, "ssp_mux.3", NULL); | ||
321 | |||
322 | clk = mmp_clk_register_apbc("ssp3", "ssp3_mux", | ||
323 | apbc_base + APBC_SSP3, 10, 0, &clk_lock); | ||
324 | clk_register_clkdev(clk, NULL, "mmp-ssp.3"); | ||
325 | |||
326 | clk = clk_register_mux(NULL, "sdh_mux", sdh_parent, | ||
327 | ARRAY_SIZE(sdh_parent), CLK_SET_RATE_PARENT, | ||
328 | apmu_base + APMU_SDH0, 8, 2, 0, &clk_lock); | ||
329 | clk_register_clkdev(clk, "sdh_mux", NULL); | ||
330 | |||
331 | clk = clk_register_divider(NULL, "sdh_div", "sdh_mux", | ||
332 | CLK_SET_RATE_PARENT, apmu_base + APMU_SDH0, | ||
333 | 10, 4, CLK_DIVIDER_ONE_BASED, &clk_lock); | ||
334 | clk_register_clkdev(clk, "sdh_div", NULL); | ||
335 | |||
336 | clk = mmp_clk_register_apmu("sdh0", "sdh_div", apmu_base + APMU_SDH0, | ||
337 | 0x1b, &clk_lock); | ||
338 | clk_register_clkdev(clk, NULL, "sdhci-pxav3.0"); | ||
339 | |||
340 | clk = mmp_clk_register_apmu("sdh1", "sdh_div", apmu_base + APMU_SDH1, | ||
341 | 0x1b, &clk_lock); | ||
342 | clk_register_clkdev(clk, NULL, "sdhci-pxav3.1"); | ||
343 | |||
344 | clk = mmp_clk_register_apmu("sdh2", "sdh_div", apmu_base + APMU_SDH2, | ||
345 | 0x1b, &clk_lock); | ||
346 | clk_register_clkdev(clk, NULL, "sdhci-pxav3.2"); | ||
347 | |||
348 | clk = mmp_clk_register_apmu("sdh3", "sdh_div", apmu_base + APMU_SDH3, | ||
349 | 0x1b, &clk_lock); | ||
350 | clk_register_clkdev(clk, NULL, "sdhci-pxav3.3"); | ||
351 | |||
352 | clk = mmp_clk_register_apmu("usb", "usb_pll", apmu_base + APMU_USB, | ||
353 | 0x9, &clk_lock); | ||
354 | clk_register_clkdev(clk, "usb_clk", NULL); | ||
355 | |||
356 | clk = clk_register_mux(NULL, "disp0_mux", disp_parent, | ||
357 | ARRAY_SIZE(disp_parent), CLK_SET_RATE_PARENT, | ||
358 | apmu_base + APMU_DISP0, 6, 2, 0, &clk_lock); | ||
359 | clk_register_clkdev(clk, "disp_mux.0", NULL); | ||
360 | |||
361 | clk = clk_register_divider(NULL, "disp0_div", "disp0_mux", | ||
362 | CLK_SET_RATE_PARENT, apmu_base + APMU_DISP0, | ||
363 | 8, 4, CLK_DIVIDER_ONE_BASED, &clk_lock); | ||
364 | clk_register_clkdev(clk, "disp_div.0", NULL); | ||
365 | |||
366 | clk = mmp_clk_register_apmu("disp0", "disp0_div", | ||
367 | apmu_base + APMU_DISP0, 0x1b, &clk_lock); | ||
368 | clk_register_clkdev(clk, NULL, "mmp-disp.0"); | ||
369 | |||
370 | clk = clk_register_divider(NULL, "disp0_sphy_div", "disp0_mux", 0, | ||
371 | apmu_base + APMU_DISP0, 15, 5, 0, &clk_lock); | ||
372 | clk_register_clkdev(clk, "disp_sphy_div.0", NULL); | ||
373 | |||
374 | clk = mmp_clk_register_apmu("disp0_sphy", "disp0_sphy_div", | ||
375 | apmu_base + APMU_DISP0, 0x1024, &clk_lock); | ||
376 | clk_register_clkdev(clk, "disp_sphy.0", NULL); | ||
377 | |||
378 | clk = clk_register_mux(NULL, "disp1_mux", disp_parent, | ||
379 | ARRAY_SIZE(disp_parent), CLK_SET_RATE_PARENT, | ||
380 | apmu_base + APMU_DISP1, 6, 2, 0, &clk_lock); | ||
381 | clk_register_clkdev(clk, "disp_mux.1", NULL); | ||
382 | |||
383 | clk = clk_register_divider(NULL, "disp1_div", "disp1_mux", | ||
384 | CLK_SET_RATE_PARENT, apmu_base + APMU_DISP1, | ||
385 | 8, 4, CLK_DIVIDER_ONE_BASED, &clk_lock); | ||
386 | clk_register_clkdev(clk, "disp_div.1", NULL); | ||
387 | |||
388 | clk = mmp_clk_register_apmu("disp1", "disp1_div", | ||
389 | apmu_base + APMU_DISP1, 0x1b, &clk_lock); | ||
390 | clk_register_clkdev(clk, NULL, "mmp-disp.1"); | ||
391 | |||
392 | clk = mmp_clk_register_apmu("ccic_arbiter", "vctcxo", | ||
393 | apmu_base + APMU_CCIC0, 0x1800, &clk_lock); | ||
394 | clk_register_clkdev(clk, "ccic_arbiter", NULL); | ||
395 | |||
396 | clk = clk_register_mux(NULL, "ccic0_mux", ccic_parent, | ||
397 | ARRAY_SIZE(ccic_parent), CLK_SET_RATE_PARENT, | ||
398 | apmu_base + APMU_CCIC0, 6, 2, 0, &clk_lock); | ||
399 | clk_register_clkdev(clk, "ccic_mux.0", NULL); | ||
400 | |||
401 | clk = clk_register_divider(NULL, "ccic0_div", "ccic0_mux", | ||
402 | CLK_SET_RATE_PARENT, apmu_base + APMU_CCIC0, | ||
403 | 17, 4, CLK_DIVIDER_ONE_BASED, &clk_lock); | ||
404 | clk_register_clkdev(clk, "ccic_div.0", NULL); | ||
405 | |||
406 | clk = mmp_clk_register_apmu("ccic0", "ccic0_div", | ||
407 | apmu_base + APMU_CCIC0, 0x1b, &clk_lock); | ||
408 | clk_register_clkdev(clk, "fnclk", "mmp-ccic.0"); | ||
409 | |||
410 | clk = mmp_clk_register_apmu("ccic0_phy", "ccic0_div", | ||
411 | apmu_base + APMU_CCIC0, 0x24, &clk_lock); | ||
412 | clk_register_clkdev(clk, "phyclk", "mmp-ccic.0"); | ||
413 | |||
414 | clk = clk_register_divider(NULL, "ccic0_sphy_div", "ccic0_div", | ||
415 | CLK_SET_RATE_PARENT, apmu_base + APMU_CCIC0, | ||
416 | 10, 5, 0, &clk_lock); | ||
417 | clk_register_clkdev(clk, "sphyclk_div", "mmp-ccic.0"); | ||
418 | |||
419 | clk = mmp_clk_register_apmu("ccic0_sphy", "ccic0_sphy_div", | ||
420 | apmu_base + APMU_CCIC0, 0x300, &clk_lock); | ||
421 | clk_register_clkdev(clk, "sphyclk", "mmp-ccic.0"); | ||
422 | |||
423 | clk = clk_register_mux(NULL, "ccic1_mux", ccic_parent, | ||
424 | ARRAY_SIZE(ccic_parent), CLK_SET_RATE_PARENT, | ||
425 | apmu_base + APMU_CCIC1, 6, 2, 0, &clk_lock); | ||
426 | clk_register_clkdev(clk, "ccic_mux.1", NULL); | ||
427 | |||
428 | clk = clk_register_divider(NULL, "ccic1_div", "ccic1_mux", | ||
429 | CLK_SET_RATE_PARENT, apmu_base + APMU_CCIC1, | ||
430 | 16, 4, CLK_DIVIDER_ONE_BASED, &clk_lock); | ||
431 | clk_register_clkdev(clk, "ccic_div.1", NULL); | ||
432 | |||
433 | clk = mmp_clk_register_apmu("ccic1", "ccic1_div", | ||
434 | apmu_base + APMU_CCIC1, 0x1b, &clk_lock); | ||
435 | clk_register_clkdev(clk, "fnclk", "mmp-ccic.1"); | ||
436 | |||
437 | clk = mmp_clk_register_apmu("ccic1_phy", "ccic1_div", | ||
438 | apmu_base + APMU_CCIC1, 0x24, &clk_lock); | ||
439 | clk_register_clkdev(clk, "phyclk", "mmp-ccic.1"); | ||
440 | |||
441 | clk = clk_register_divider(NULL, "ccic1_sphy_div", "ccic1_div", | ||
442 | CLK_SET_RATE_PARENT, apmu_base + APMU_CCIC1, | ||
443 | 10, 5, 0, &clk_lock); | ||
444 | clk_register_clkdev(clk, "sphyclk_div", "mmp-ccic.1"); | ||
445 | |||
446 | clk = mmp_clk_register_apmu("ccic1_sphy", "ccic1_sphy_div", | ||
447 | apmu_base + APMU_CCIC1, 0x300, &clk_lock); | ||
448 | clk_register_clkdev(clk, "sphyclk", "mmp-ccic.1"); | ||
449 | } | ||
diff --git a/drivers/clk/mmp/clk-pxa168.c b/drivers/clk/mmp/clk-pxa168.c new file mode 100644 index 000000000000..e8d036c12cbf --- /dev/null +++ b/drivers/clk/mmp/clk-pxa168.c | |||
@@ -0,0 +1,346 @@ | |||
1 | /* | ||
2 | * pxa168 clock framework source file | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * Chao Xie <xiechao.mail@gmail.com> | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public | ||
8 | * License version 2. This program is licensed "as is" without any | ||
9 | * warranty of any kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/spinlock.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/err.h> | ||
18 | |||
19 | #include <mach/addr-map.h> | ||
20 | |||
21 | #include "clk.h" | ||
22 | |||
23 | #define APBC_RTC 0x28 | ||
24 | #define APBC_TWSI0 0x2c | ||
25 | #define APBC_KPC 0x30 | ||
26 | #define APBC_UART0 0x0 | ||
27 | #define APBC_UART1 0x4 | ||
28 | #define APBC_GPIO 0x8 | ||
29 | #define APBC_PWM0 0xc | ||
30 | #define APBC_PWM1 0x10 | ||
31 | #define APBC_PWM2 0x14 | ||
32 | #define APBC_PWM3 0x18 | ||
33 | #define APBC_SSP0 0x81c | ||
34 | #define APBC_SSP1 0x820 | ||
35 | #define APBC_SSP2 0x84c | ||
36 | #define APBC_SSP3 0x858 | ||
37 | #define APBC_SSP4 0x85c | ||
38 | #define APBC_TWSI1 0x6c | ||
39 | #define APBC_UART2 0x70 | ||
40 | #define APMU_SDH0 0x54 | ||
41 | #define APMU_SDH1 0x58 | ||
42 | #define APMU_USB 0x5c | ||
43 | #define APMU_DISP0 0x4c | ||
44 | #define APMU_CCIC0 0x50 | ||
45 | #define APMU_DFC 0x60 | ||
46 | #define MPMU_UART_PLL 0x14 | ||
47 | |||
48 | static DEFINE_SPINLOCK(clk_lock); | ||
49 | |||
50 | static struct clk_factor_masks uart_factor_masks = { | ||
51 | .factor = 2, | ||
52 | .num_mask = 0x1fff, | ||
53 | .den_mask = 0x1fff, | ||
54 | .num_shift = 16, | ||
55 | .den_shift = 0, | ||
56 | }; | ||
57 | |||
58 | static struct clk_factor_tbl uart_factor_tbl[] = { | ||
59 | {.num = 8125, .den = 1536}, /*14.745MHZ */ | ||
60 | }; | ||
61 | |||
62 | static const char *uart_parent[] = {"pll1_3_16", "uart_pll"}; | ||
63 | static const char *ssp_parent[] = {"pll1_96", "pll1_48", "pll1_24", "pll1_12"}; | ||
64 | static const char *sdh_parent[] = {"pll1_12", "pll1_13"}; | ||
65 | static const char *disp_parent[] = {"pll1_2", "pll1_12"}; | ||
66 | static const char *ccic_parent[] = {"pll1_2", "pll1_12"}; | ||
67 | static const char *ccic_phy_parent[] = {"pll1_6", "pll1_12"}; | ||
68 | |||
69 | void __init pxa168_clk_init(void) | ||
70 | { | ||
71 | struct clk *clk; | ||
72 | struct clk *uart_pll; | ||
73 | void __iomem *mpmu_base; | ||
74 | void __iomem *apmu_base; | ||
75 | void __iomem *apbc_base; | ||
76 | |||
77 | mpmu_base = ioremap(APB_PHYS_BASE + 0x50000, SZ_4K); | ||
78 | if (mpmu_base == NULL) { | ||
79 | pr_err("error to ioremap MPMU base\n"); | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | apmu_base = ioremap(AXI_PHYS_BASE + 0x82800, SZ_4K); | ||
84 | if (apmu_base == NULL) { | ||
85 | pr_err("error to ioremap APMU base\n"); | ||
86 | return; | ||
87 | } | ||
88 | |||
89 | apbc_base = ioremap(APB_PHYS_BASE + 0x15000, SZ_4K); | ||
90 | if (apbc_base == NULL) { | ||
91 | pr_err("error to ioremap APBC base\n"); | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | clk = clk_register_fixed_rate(NULL, "clk32", NULL, CLK_IS_ROOT, 3200); | ||
96 | clk_register_clkdev(clk, "clk32", NULL); | ||
97 | |||
98 | clk = clk_register_fixed_rate(NULL, "vctcxo", NULL, CLK_IS_ROOT, | ||
99 | 26000000); | ||
100 | clk_register_clkdev(clk, "vctcxo", NULL); | ||
101 | |||
102 | clk = clk_register_fixed_rate(NULL, "pll1", NULL, CLK_IS_ROOT, | ||
103 | 624000000); | ||
104 | clk_register_clkdev(clk, "pll1", NULL); | ||
105 | |||
106 | clk = clk_register_fixed_factor(NULL, "pll1_2", "pll1", | ||
107 | CLK_SET_RATE_PARENT, 1, 2); | ||
108 | clk_register_clkdev(clk, "pll1_2", NULL); | ||
109 | |||
110 | clk = clk_register_fixed_factor(NULL, "pll1_4", "pll1_2", | ||
111 | CLK_SET_RATE_PARENT, 1, 2); | ||
112 | clk_register_clkdev(clk, "pll1_4", NULL); | ||
113 | |||
114 | clk = clk_register_fixed_factor(NULL, "pll1_8", "pll1_4", | ||
115 | CLK_SET_RATE_PARENT, 1, 2); | ||
116 | clk_register_clkdev(clk, "pll1_8", NULL); | ||
117 | |||
118 | clk = clk_register_fixed_factor(NULL, "pll1_16", "pll1_8", | ||
119 | CLK_SET_RATE_PARENT, 1, 2); | ||
120 | clk_register_clkdev(clk, "pll1_16", NULL); | ||
121 | |||
122 | clk = clk_register_fixed_factor(NULL, "pll1_6", "pll1_2", | ||
123 | CLK_SET_RATE_PARENT, 1, 3); | ||
124 | clk_register_clkdev(clk, "pll1_6", NULL); | ||
125 | |||
126 | clk = clk_register_fixed_factor(NULL, "pll1_12", "pll1_6", | ||
127 | CLK_SET_RATE_PARENT, 1, 2); | ||
128 | clk_register_clkdev(clk, "pll1_12", NULL); | ||
129 | |||
130 | clk = clk_register_fixed_factor(NULL, "pll1_24", "pll1_12", | ||
131 | CLK_SET_RATE_PARENT, 1, 2); | ||
132 | clk_register_clkdev(clk, "pll1_24", NULL); | ||
133 | |||
134 | clk = clk_register_fixed_factor(NULL, "pll1_48", "pll1_24", | ||
135 | CLK_SET_RATE_PARENT, 1, 2); | ||
136 | clk_register_clkdev(clk, "pll1_48", NULL); | ||
137 | |||
138 | clk = clk_register_fixed_factor(NULL, "pll1_96", "pll1_48", | ||
139 | CLK_SET_RATE_PARENT, 1, 2); | ||
140 | clk_register_clkdev(clk, "pll1_96", NULL); | ||
141 | |||
142 | clk = clk_register_fixed_factor(NULL, "pll1_13", "pll1", | ||
143 | CLK_SET_RATE_PARENT, 1, 13); | ||
144 | clk_register_clkdev(clk, "pll1_13", NULL); | ||
145 | |||
146 | clk = clk_register_fixed_factor(NULL, "pll1_13_1_5", "pll1", | ||
147 | CLK_SET_RATE_PARENT, 2, 3); | ||
148 | clk_register_clkdev(clk, "pll1_13_1_5", NULL); | ||
149 | |||
150 | clk = clk_register_fixed_factor(NULL, "pll1_2_1_5", "pll1", | ||
151 | CLK_SET_RATE_PARENT, 2, 3); | ||
152 | clk_register_clkdev(clk, "pll1_2_1_5", NULL); | ||
153 | |||
154 | clk = clk_register_fixed_factor(NULL, "pll1_3_16", "pll1", | ||
155 | CLK_SET_RATE_PARENT, 3, 16); | ||
156 | clk_register_clkdev(clk, "pll1_3_16", NULL); | ||
157 | |||
158 | uart_pll = mmp_clk_register_factor("uart_pll", "pll1_4", 0, | ||
159 | mpmu_base + MPMU_UART_PLL, | ||
160 | &uart_factor_masks, uart_factor_tbl, | ||
161 | ARRAY_SIZE(uart_factor_tbl)); | ||
162 | clk_set_rate(uart_pll, 14745600); | ||
163 | clk_register_clkdev(uart_pll, "uart_pll", NULL); | ||
164 | |||
165 | clk = mmp_clk_register_apbc("twsi0", "pll1_13_1_5", | ||
166 | apbc_base + APBC_TWSI0, 10, 0, &clk_lock); | ||
167 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.0"); | ||
168 | |||
169 | clk = mmp_clk_register_apbc("twsi1", "pll1_13_1_5", | ||
170 | apbc_base + APBC_TWSI1, 10, 0, &clk_lock); | ||
171 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.1"); | ||
172 | |||
173 | clk = mmp_clk_register_apbc("gpio", "vctcxo", | ||
174 | apbc_base + APBC_GPIO, 10, 0, &clk_lock); | ||
175 | clk_register_clkdev(clk, NULL, "pxa-gpio"); | ||
176 | |||
177 | clk = mmp_clk_register_apbc("kpc", "clk32", | ||
178 | apbc_base + APBC_KPC, 10, 0, &clk_lock); | ||
179 | clk_register_clkdev(clk, NULL, "pxa27x-keypad"); | ||
180 | |||
181 | clk = mmp_clk_register_apbc("rtc", "clk32", | ||
182 | apbc_base + APBC_RTC, 10, 0, &clk_lock); | ||
183 | clk_register_clkdev(clk, NULL, "sa1100-rtc"); | ||
184 | |||
185 | clk = mmp_clk_register_apbc("pwm0", "pll1_48", | ||
186 | apbc_base + APBC_PWM0, 10, 0, &clk_lock); | ||
187 | clk_register_clkdev(clk, NULL, "pxa168-pwm.0"); | ||
188 | |||
189 | clk = mmp_clk_register_apbc("pwm1", "pll1_48", | ||
190 | apbc_base + APBC_PWM1, 10, 0, &clk_lock); | ||
191 | clk_register_clkdev(clk, NULL, "pxa168-pwm.1"); | ||
192 | |||
193 | clk = mmp_clk_register_apbc("pwm2", "pll1_48", | ||
194 | apbc_base + APBC_PWM2, 10, 0, &clk_lock); | ||
195 | clk_register_clkdev(clk, NULL, "pxa168-pwm.2"); | ||
196 | |||
197 | clk = mmp_clk_register_apbc("pwm3", "pll1_48", | ||
198 | apbc_base + APBC_PWM3, 10, 0, &clk_lock); | ||
199 | clk_register_clkdev(clk, NULL, "pxa168-pwm.3"); | ||
200 | |||
201 | clk = clk_register_mux(NULL, "uart0_mux", uart_parent, | ||
202 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
203 | apbc_base + APBC_UART0, 4, 3, 0, &clk_lock); | ||
204 | clk_set_parent(clk, uart_pll); | ||
205 | clk_register_clkdev(clk, "uart_mux.0", NULL); | ||
206 | |||
207 | clk = mmp_clk_register_apbc("uart0", "uart0_mux", | ||
208 | apbc_base + APBC_UART0, 10, 0, &clk_lock); | ||
209 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.0"); | ||
210 | |||
211 | clk = clk_register_mux(NULL, "uart1_mux", uart_parent, | ||
212 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
213 | apbc_base + APBC_UART1, 4, 3, 0, &clk_lock); | ||
214 | clk_set_parent(clk, uart_pll); | ||
215 | clk_register_clkdev(clk, "uart_mux.1", NULL); | ||
216 | |||
217 | clk = mmp_clk_register_apbc("uart1", "uart1_mux", | ||
218 | apbc_base + APBC_UART1, 10, 0, &clk_lock); | ||
219 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.1"); | ||
220 | |||
221 | clk = clk_register_mux(NULL, "uart2_mux", uart_parent, | ||
222 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
223 | apbc_base + APBC_UART2, 4, 3, 0, &clk_lock); | ||
224 | clk_set_parent(clk, uart_pll); | ||
225 | clk_register_clkdev(clk, "uart_mux.2", NULL); | ||
226 | |||
227 | clk = mmp_clk_register_apbc("uart2", "uart2_mux", | ||
228 | apbc_base + APBC_UART2, 10, 0, &clk_lock); | ||
229 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.2"); | ||
230 | |||
231 | clk = clk_register_mux(NULL, "ssp0_mux", ssp_parent, | ||
232 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
233 | apbc_base + APBC_SSP0, 4, 3, 0, &clk_lock); | ||
234 | clk_register_clkdev(clk, "uart_mux.0", NULL); | ||
235 | |||
236 | clk = mmp_clk_register_apbc("ssp0", "ssp0_mux", apbc_base + APBC_SSP0, | ||
237 | 10, 0, &clk_lock); | ||
238 | clk_register_clkdev(clk, NULL, "mmp-ssp.0"); | ||
239 | |||
240 | clk = clk_register_mux(NULL, "ssp1_mux", ssp_parent, | ||
241 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
242 | apbc_base + APBC_SSP1, 4, 3, 0, &clk_lock); | ||
243 | clk_register_clkdev(clk, "ssp_mux.1", NULL); | ||
244 | |||
245 | clk = mmp_clk_register_apbc("ssp1", "ssp1_mux", apbc_base + APBC_SSP1, | ||
246 | 10, 0, &clk_lock); | ||
247 | clk_register_clkdev(clk, NULL, "mmp-ssp.1"); | ||
248 | |||
249 | clk = clk_register_mux(NULL, "ssp2_mux", ssp_parent, | ||
250 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
251 | apbc_base + APBC_SSP2, 4, 3, 0, &clk_lock); | ||
252 | clk_register_clkdev(clk, "ssp_mux.2", NULL); | ||
253 | |||
254 | clk = mmp_clk_register_apbc("ssp2", "ssp1_mux", apbc_base + APBC_SSP2, | ||
255 | 10, 0, &clk_lock); | ||
256 | clk_register_clkdev(clk, NULL, "mmp-ssp.2"); | ||
257 | |||
258 | clk = clk_register_mux(NULL, "ssp3_mux", ssp_parent, | ||
259 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
260 | apbc_base + APBC_SSP3, 4, 3, 0, &clk_lock); | ||
261 | clk_register_clkdev(clk, "ssp_mux.3", NULL); | ||
262 | |||
263 | clk = mmp_clk_register_apbc("ssp3", "ssp1_mux", apbc_base + APBC_SSP3, | ||
264 | 10, 0, &clk_lock); | ||
265 | clk_register_clkdev(clk, NULL, "mmp-ssp.3"); | ||
266 | |||
267 | clk = clk_register_mux(NULL, "ssp4_mux", ssp_parent, | ||
268 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
269 | apbc_base + APBC_SSP4, 4, 3, 0, &clk_lock); | ||
270 | clk_register_clkdev(clk, "ssp_mux.4", NULL); | ||
271 | |||
272 | clk = mmp_clk_register_apbc("ssp4", "ssp1_mux", apbc_base + APBC_SSP4, | ||
273 | 10, 0, &clk_lock); | ||
274 | clk_register_clkdev(clk, NULL, "mmp-ssp.4"); | ||
275 | |||
276 | clk = mmp_clk_register_apmu("dfc", "pll1_4", apmu_base + APMU_DFC, | ||
277 | 0x19b, &clk_lock); | ||
278 | clk_register_clkdev(clk, NULL, "pxa3xx-nand.0"); | ||
279 | |||
280 | clk = clk_register_mux(NULL, "sdh0_mux", sdh_parent, | ||
281 | ARRAY_SIZE(sdh_parent), CLK_SET_RATE_PARENT, | ||
282 | apmu_base + APMU_SDH0, 6, 1, 0, &clk_lock); | ||
283 | clk_register_clkdev(clk, "sdh0_mux", NULL); | ||
284 | |||
285 | clk = mmp_clk_register_apmu("sdh0", "sdh_mux", apmu_base + APMU_SDH0, | ||
286 | 0x1b, &clk_lock); | ||
287 | clk_register_clkdev(clk, NULL, "sdhci-pxa.0"); | ||
288 | |||
289 | clk = clk_register_mux(NULL, "sdh1_mux", sdh_parent, | ||
290 | ARRAY_SIZE(sdh_parent), CLK_SET_RATE_PARENT, | ||
291 | apmu_base + APMU_SDH1, 6, 1, 0, &clk_lock); | ||
292 | clk_register_clkdev(clk, "sdh1_mux", NULL); | ||
293 | |||
294 | clk = mmp_clk_register_apmu("sdh1", "sdh1_mux", apmu_base + APMU_SDH1, | ||
295 | 0x1b, &clk_lock); | ||
296 | clk_register_clkdev(clk, NULL, "sdhci-pxa.1"); | ||
297 | |||
298 | clk = mmp_clk_register_apmu("usb", "usb_pll", apmu_base + APMU_USB, | ||
299 | 0x9, &clk_lock); | ||
300 | clk_register_clkdev(clk, "usb_clk", NULL); | ||
301 | |||
302 | clk = mmp_clk_register_apmu("sph", "usb_pll", apmu_base + APMU_USB, | ||
303 | 0x12, &clk_lock); | ||
304 | clk_register_clkdev(clk, "sph_clk", NULL); | ||
305 | |||
306 | clk = clk_register_mux(NULL, "disp0_mux", disp_parent, | ||
307 | ARRAY_SIZE(disp_parent), CLK_SET_RATE_PARENT, | ||
308 | apmu_base + APMU_DISP0, 6, 1, 0, &clk_lock); | ||
309 | clk_register_clkdev(clk, "disp_mux.0", NULL); | ||
310 | |||
311 | clk = mmp_clk_register_apmu("disp0", "disp0_mux", | ||
312 | apmu_base + APMU_DISP0, 0x1b, &clk_lock); | ||
313 | clk_register_clkdev(clk, "fnclk", "mmp-disp.0"); | ||
314 | |||
315 | clk = mmp_clk_register_apmu("disp0_hclk", "disp0_mux", | ||
316 | apmu_base + APMU_DISP0, 0x24, &clk_lock); | ||
317 | clk_register_clkdev(clk, "hclk", "mmp-disp.0"); | ||
318 | |||
319 | clk = clk_register_mux(NULL, "ccic0_mux", ccic_parent, | ||
320 | ARRAY_SIZE(ccic_parent), CLK_SET_RATE_PARENT, | ||
321 | apmu_base + APMU_CCIC0, 6, 1, 0, &clk_lock); | ||
322 | clk_register_clkdev(clk, "ccic_mux.0", NULL); | ||
323 | |||
324 | clk = mmp_clk_register_apmu("ccic0", "ccic0_mux", | ||
325 | apmu_base + APMU_CCIC0, 0x1b, &clk_lock); | ||
326 | clk_register_clkdev(clk, "fnclk", "mmp-ccic.0"); | ||
327 | |||
328 | clk = clk_register_mux(NULL, "ccic0_phy_mux", ccic_phy_parent, | ||
329 | ARRAY_SIZE(ccic_phy_parent), | ||
330 | CLK_SET_RATE_PARENT, apmu_base + APMU_CCIC0, | ||
331 | 7, 1, 0, &clk_lock); | ||
332 | clk_register_clkdev(clk, "ccic_phy_mux.0", NULL); | ||
333 | |||
334 | clk = mmp_clk_register_apmu("ccic0_phy", "ccic0_phy_mux", | ||
335 | apmu_base + APMU_CCIC0, 0x24, &clk_lock); | ||
336 | clk_register_clkdev(clk, "phyclk", "mmp-ccic.0"); | ||
337 | |||
338 | clk = clk_register_divider(NULL, "ccic0_sphy_div", "ccic0_mux", | ||
339 | CLK_SET_RATE_PARENT, apmu_base + APMU_CCIC0, | ||
340 | 10, 5, 0, &clk_lock); | ||
341 | clk_register_clkdev(clk, "sphyclk_div", NULL); | ||
342 | |||
343 | clk = mmp_clk_register_apmu("ccic0_sphy", "ccic0_sphy_div", | ||
344 | apmu_base + APMU_CCIC0, 0x300, &clk_lock); | ||
345 | clk_register_clkdev(clk, "sphyclk", "mmp-ccic.0"); | ||
346 | } | ||
diff --git a/drivers/clk/mmp/clk-pxa910.c b/drivers/clk/mmp/clk-pxa910.c new file mode 100644 index 000000000000..7048c31d6e7e --- /dev/null +++ b/drivers/clk/mmp/clk-pxa910.c | |||
@@ -0,0 +1,320 @@ | |||
1 | /* | ||
2 | * pxa910 clock framework source file | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * Chao Xie <xiechao.mail@gmail.com> | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public | ||
8 | * License version 2. This program is licensed "as is" without any | ||
9 | * warranty of any kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/spinlock.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/err.h> | ||
18 | |||
19 | #include <mach/addr-map.h> | ||
20 | |||
21 | #include "clk.h" | ||
22 | |||
23 | #define APBC_RTC 0x28 | ||
24 | #define APBC_TWSI0 0x2c | ||
25 | #define APBC_KPC 0x18 | ||
26 | #define APBC_UART0 0x0 | ||
27 | #define APBC_UART1 0x4 | ||
28 | #define APBC_GPIO 0x8 | ||
29 | #define APBC_PWM0 0xc | ||
30 | #define APBC_PWM1 0x10 | ||
31 | #define APBC_PWM2 0x14 | ||
32 | #define APBC_PWM3 0x18 | ||
33 | #define APBC_SSP0 0x1c | ||
34 | #define APBC_SSP1 0x20 | ||
35 | #define APBC_SSP2 0x4c | ||
36 | #define APBCP_TWSI1 0x28 | ||
37 | #define APBCP_UART2 0x1c | ||
38 | #define APMU_SDH0 0x54 | ||
39 | #define APMU_SDH1 0x58 | ||
40 | #define APMU_USB 0x5c | ||
41 | #define APMU_DISP0 0x4c | ||
42 | #define APMU_CCIC0 0x50 | ||
43 | #define APMU_DFC 0x60 | ||
44 | #define MPMU_UART_PLL 0x14 | ||
45 | |||
46 | static DEFINE_SPINLOCK(clk_lock); | ||
47 | |||
48 | static struct clk_factor_masks uart_factor_masks = { | ||
49 | .factor = 2, | ||
50 | .num_mask = 0x1fff, | ||
51 | .den_mask = 0x1fff, | ||
52 | .num_shift = 16, | ||
53 | .den_shift = 0, | ||
54 | }; | ||
55 | |||
56 | static struct clk_factor_tbl uart_factor_tbl[] = { | ||
57 | {.num = 8125, .den = 1536}, /*14.745MHZ */ | ||
58 | }; | ||
59 | |||
60 | static const char *uart_parent[] = {"pll1_3_16", "uart_pll"}; | ||
61 | static const char *ssp_parent[] = {"pll1_96", "pll1_48", "pll1_24", "pll1_12"}; | ||
62 | static const char *sdh_parent[] = {"pll1_12", "pll1_13"}; | ||
63 | static const char *disp_parent[] = {"pll1_2", "pll1_12"}; | ||
64 | static const char *ccic_parent[] = {"pll1_2", "pll1_12"}; | ||
65 | static const char *ccic_phy_parent[] = {"pll1_6", "pll1_12"}; | ||
66 | |||
67 | void __init pxa910_clk_init(void) | ||
68 | { | ||
69 | struct clk *clk; | ||
70 | struct clk *uart_pll; | ||
71 | void __iomem *mpmu_base; | ||
72 | void __iomem *apmu_base; | ||
73 | void __iomem *apbcp_base; | ||
74 | void __iomem *apbc_base; | ||
75 | |||
76 | mpmu_base = ioremap(APB_PHYS_BASE + 0x50000, SZ_4K); | ||
77 | if (mpmu_base == NULL) { | ||
78 | pr_err("error to ioremap MPMU base\n"); | ||
79 | return; | ||
80 | } | ||
81 | |||
82 | apmu_base = ioremap(AXI_PHYS_BASE + 0x82800, SZ_4K); | ||
83 | if (apmu_base == NULL) { | ||
84 | pr_err("error to ioremap APMU base\n"); | ||
85 | return; | ||
86 | } | ||
87 | |||
88 | apbcp_base = ioremap(APB_PHYS_BASE + 0x3b000, SZ_4K); | ||
89 | if (apbcp_base == NULL) { | ||
90 | pr_err("error to ioremap APBC extension base\n"); | ||
91 | return; | ||
92 | } | ||
93 | |||
94 | apbc_base = ioremap(APB_PHYS_BASE + 0x15000, SZ_4K); | ||
95 | if (apbc_base == NULL) { | ||
96 | pr_err("error to ioremap APBC base\n"); | ||
97 | return; | ||
98 | } | ||
99 | |||
100 | clk = clk_register_fixed_rate(NULL, "clk32", NULL, CLK_IS_ROOT, 3200); | ||
101 | clk_register_clkdev(clk, "clk32", NULL); | ||
102 | |||
103 | clk = clk_register_fixed_rate(NULL, "vctcxo", NULL, CLK_IS_ROOT, | ||
104 | 26000000); | ||
105 | clk_register_clkdev(clk, "vctcxo", NULL); | ||
106 | |||
107 | clk = clk_register_fixed_rate(NULL, "pll1", NULL, CLK_IS_ROOT, | ||
108 | 624000000); | ||
109 | clk_register_clkdev(clk, "pll1", NULL); | ||
110 | |||
111 | clk = clk_register_fixed_factor(NULL, "pll1_2", "pll1", | ||
112 | CLK_SET_RATE_PARENT, 1, 2); | ||
113 | clk_register_clkdev(clk, "pll1_2", NULL); | ||
114 | |||
115 | clk = clk_register_fixed_factor(NULL, "pll1_4", "pll1_2", | ||
116 | CLK_SET_RATE_PARENT, 1, 2); | ||
117 | clk_register_clkdev(clk, "pll1_4", NULL); | ||
118 | |||
119 | clk = clk_register_fixed_factor(NULL, "pll1_8", "pll1_4", | ||
120 | CLK_SET_RATE_PARENT, 1, 2); | ||
121 | clk_register_clkdev(clk, "pll1_8", NULL); | ||
122 | |||
123 | clk = clk_register_fixed_factor(NULL, "pll1_16", "pll1_8", | ||
124 | CLK_SET_RATE_PARENT, 1, 2); | ||
125 | clk_register_clkdev(clk, "pll1_16", NULL); | ||
126 | |||
127 | clk = clk_register_fixed_factor(NULL, "pll1_6", "pll1_2", | ||
128 | CLK_SET_RATE_PARENT, 1, 3); | ||
129 | clk_register_clkdev(clk, "pll1_6", NULL); | ||
130 | |||
131 | clk = clk_register_fixed_factor(NULL, "pll1_12", "pll1_6", | ||
132 | CLK_SET_RATE_PARENT, 1, 2); | ||
133 | clk_register_clkdev(clk, "pll1_12", NULL); | ||
134 | |||
135 | clk = clk_register_fixed_factor(NULL, "pll1_24", "pll1_12", | ||
136 | CLK_SET_RATE_PARENT, 1, 2); | ||
137 | clk_register_clkdev(clk, "pll1_24", NULL); | ||
138 | |||
139 | clk = clk_register_fixed_factor(NULL, "pll1_48", "pll1_24", | ||
140 | CLK_SET_RATE_PARENT, 1, 2); | ||
141 | clk_register_clkdev(clk, "pll1_48", NULL); | ||
142 | |||
143 | clk = clk_register_fixed_factor(NULL, "pll1_96", "pll1_48", | ||
144 | CLK_SET_RATE_PARENT, 1, 2); | ||
145 | clk_register_clkdev(clk, "pll1_96", NULL); | ||
146 | |||
147 | clk = clk_register_fixed_factor(NULL, "pll1_13", "pll1", | ||
148 | CLK_SET_RATE_PARENT, 1, 13); | ||
149 | clk_register_clkdev(clk, "pll1_13", NULL); | ||
150 | |||
151 | clk = clk_register_fixed_factor(NULL, "pll1_13_1_5", "pll1", | ||
152 | CLK_SET_RATE_PARENT, 2, 3); | ||
153 | clk_register_clkdev(clk, "pll1_13_1_5", NULL); | ||
154 | |||
155 | clk = clk_register_fixed_factor(NULL, "pll1_2_1_5", "pll1", | ||
156 | CLK_SET_RATE_PARENT, 2, 3); | ||
157 | clk_register_clkdev(clk, "pll1_2_1_5", NULL); | ||
158 | |||
159 | clk = clk_register_fixed_factor(NULL, "pll1_3_16", "pll1", | ||
160 | CLK_SET_RATE_PARENT, 3, 16); | ||
161 | clk_register_clkdev(clk, "pll1_3_16", NULL); | ||
162 | |||
163 | uart_pll = mmp_clk_register_factor("uart_pll", "pll1_4", 0, | ||
164 | mpmu_base + MPMU_UART_PLL, | ||
165 | &uart_factor_masks, uart_factor_tbl, | ||
166 | ARRAY_SIZE(uart_factor_tbl)); | ||
167 | clk_set_rate(uart_pll, 14745600); | ||
168 | clk_register_clkdev(uart_pll, "uart_pll", NULL); | ||
169 | |||
170 | clk = mmp_clk_register_apbc("twsi0", "pll1_13_1_5", | ||
171 | apbc_base + APBC_TWSI0, 10, 0, &clk_lock); | ||
172 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.0"); | ||
173 | |||
174 | clk = mmp_clk_register_apbc("twsi1", "pll1_13_1_5", | ||
175 | apbcp_base + APBCP_TWSI1, 10, 0, &clk_lock); | ||
176 | clk_register_clkdev(clk, NULL, "pxa2xx-i2c.1"); | ||
177 | |||
178 | clk = mmp_clk_register_apbc("gpio", "vctcxo", | ||
179 | apbc_base + APBC_GPIO, 10, 0, &clk_lock); | ||
180 | clk_register_clkdev(clk, NULL, "pxa-gpio"); | ||
181 | |||
182 | clk = mmp_clk_register_apbc("kpc", "clk32", | ||
183 | apbc_base + APBC_KPC, 10, 0, &clk_lock); | ||
184 | clk_register_clkdev(clk, NULL, "pxa27x-keypad"); | ||
185 | |||
186 | clk = mmp_clk_register_apbc("rtc", "clk32", | ||
187 | apbc_base + APBC_RTC, 10, 0, &clk_lock); | ||
188 | clk_register_clkdev(clk, NULL, "sa1100-rtc"); | ||
189 | |||
190 | clk = mmp_clk_register_apbc("pwm0", "pll1_48", | ||
191 | apbc_base + APBC_PWM0, 10, 0, &clk_lock); | ||
192 | clk_register_clkdev(clk, NULL, "pxa910-pwm.0"); | ||
193 | |||
194 | clk = mmp_clk_register_apbc("pwm1", "pll1_48", | ||
195 | apbc_base + APBC_PWM1, 10, 0, &clk_lock); | ||
196 | clk_register_clkdev(clk, NULL, "pxa910-pwm.1"); | ||
197 | |||
198 | clk = mmp_clk_register_apbc("pwm2", "pll1_48", | ||
199 | apbc_base + APBC_PWM2, 10, 0, &clk_lock); | ||
200 | clk_register_clkdev(clk, NULL, "pxa910-pwm.2"); | ||
201 | |||
202 | clk = mmp_clk_register_apbc("pwm3", "pll1_48", | ||
203 | apbc_base + APBC_PWM3, 10, 0, &clk_lock); | ||
204 | clk_register_clkdev(clk, NULL, "pxa910-pwm.3"); | ||
205 | |||
206 | clk = clk_register_mux(NULL, "uart0_mux", uart_parent, | ||
207 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
208 | apbc_base + APBC_UART0, 4, 3, 0, &clk_lock); | ||
209 | clk_set_parent(clk, uart_pll); | ||
210 | clk_register_clkdev(clk, "uart_mux.0", NULL); | ||
211 | |||
212 | clk = mmp_clk_register_apbc("uart0", "uart0_mux", | ||
213 | apbc_base + APBC_UART0, 10, 0, &clk_lock); | ||
214 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.0"); | ||
215 | |||
216 | clk = clk_register_mux(NULL, "uart1_mux", uart_parent, | ||
217 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
218 | apbc_base + APBC_UART1, 4, 3, 0, &clk_lock); | ||
219 | clk_set_parent(clk, uart_pll); | ||
220 | clk_register_clkdev(clk, "uart_mux.1", NULL); | ||
221 | |||
222 | clk = mmp_clk_register_apbc("uart1", "uart1_mux", | ||
223 | apbc_base + APBC_UART1, 10, 0, &clk_lock); | ||
224 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.1"); | ||
225 | |||
226 | clk = clk_register_mux(NULL, "uart2_mux", uart_parent, | ||
227 | ARRAY_SIZE(uart_parent), CLK_SET_RATE_PARENT, | ||
228 | apbcp_base + APBCP_UART2, 4, 3, 0, &clk_lock); | ||
229 | clk_set_parent(clk, uart_pll); | ||
230 | clk_register_clkdev(clk, "uart_mux.2", NULL); | ||
231 | |||
232 | clk = mmp_clk_register_apbc("uart2", "uart2_mux", | ||
233 | apbcp_base + APBCP_UART2, 10, 0, &clk_lock); | ||
234 | clk_register_clkdev(clk, NULL, "pxa2xx-uart.2"); | ||
235 | |||
236 | clk = clk_register_mux(NULL, "ssp0_mux", ssp_parent, | ||
237 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
238 | apbc_base + APBC_SSP0, 4, 3, 0, &clk_lock); | ||
239 | clk_register_clkdev(clk, "uart_mux.0", NULL); | ||
240 | |||
241 | clk = mmp_clk_register_apbc("ssp0", "ssp0_mux", | ||
242 | apbc_base + APBC_SSP0, 10, 0, &clk_lock); | ||
243 | clk_register_clkdev(clk, NULL, "mmp-ssp.0"); | ||
244 | |||
245 | clk = clk_register_mux(NULL, "ssp1_mux", ssp_parent, | ||
246 | ARRAY_SIZE(ssp_parent), CLK_SET_RATE_PARENT, | ||
247 | apbc_base + APBC_SSP1, 4, 3, 0, &clk_lock); | ||
248 | clk_register_clkdev(clk, "ssp_mux.1", NULL); | ||
249 | |||
250 | clk = mmp_clk_register_apbc("ssp1", "ssp1_mux", | ||
251 | apbc_base + APBC_SSP1, 10, 0, &clk_lock); | ||
252 | clk_register_clkdev(clk, NULL, "mmp-ssp.1"); | ||
253 | |||
254 | clk = mmp_clk_register_apmu("dfc", "pll1_4", | ||
255 | apmu_base + APMU_DFC, 0x19b, &clk_lock); | ||
256 | clk_register_clkdev(clk, NULL, "pxa3xx-nand.0"); | ||
257 | |||
258 | clk = clk_register_mux(NULL, "sdh0_mux", sdh_parent, | ||
259 | ARRAY_SIZE(sdh_parent), CLK_SET_RATE_PARENT, | ||
260 | apmu_base + APMU_SDH0, 6, 1, 0, &clk_lock); | ||
261 | clk_register_clkdev(clk, "sdh0_mux", NULL); | ||
262 | |||
263 | clk = mmp_clk_register_apmu("sdh0", "sdh_mux", | ||
264 | apmu_base + APMU_SDH0, 0x1b, &clk_lock); | ||
265 | clk_register_clkdev(clk, NULL, "sdhci-pxa.0"); | ||
266 | |||
267 | clk = clk_register_mux(NULL, "sdh1_mux", sdh_parent, | ||
268 | ARRAY_SIZE(sdh_parent), CLK_SET_RATE_PARENT, | ||
269 | apmu_base + APMU_SDH1, 6, 1, 0, &clk_lock); | ||
270 | clk_register_clkdev(clk, "sdh1_mux", NULL); | ||
271 | |||
272 | clk = mmp_clk_register_apmu("sdh1", "sdh1_mux", | ||
273 | apmu_base + APMU_SDH1, 0x1b, &clk_lock); | ||
274 | clk_register_clkdev(clk, NULL, "sdhci-pxa.1"); | ||
275 | |||
276 | clk = mmp_clk_register_apmu("usb", "usb_pll", | ||
277 | apmu_base + APMU_USB, 0x9, &clk_lock); | ||
278 | clk_register_clkdev(clk, "usb_clk", NULL); | ||
279 | |||
280 | clk = mmp_clk_register_apmu("sph", "usb_pll", | ||
281 | apmu_base + APMU_USB, 0x12, &clk_lock); | ||
282 | clk_register_clkdev(clk, "sph_clk", NULL); | ||
283 | |||
284 | clk = clk_register_mux(NULL, "disp0_mux", disp_parent, | ||
285 | ARRAY_SIZE(disp_parent), CLK_SET_RATE_PARENT, | ||
286 | apmu_base + APMU_DISP0, 6, 1, 0, &clk_lock); | ||
287 | clk_register_clkdev(clk, "disp_mux.0", NULL); | ||
288 | |||
289 | clk = mmp_clk_register_apmu("disp0", "disp0_mux", | ||
290 | apmu_base + APMU_DISP0, 0x1b, &clk_lock); | ||
291 | clk_register_clkdev(clk, NULL, "mmp-disp.0"); | ||
292 | |||
293 | clk = clk_register_mux(NULL, "ccic0_mux", ccic_parent, | ||
294 | ARRAY_SIZE(ccic_parent), CLK_SET_RATE_PARENT, | ||
295 | apmu_base + APMU_CCIC0, 6, 1, 0, &clk_lock); | ||
296 | clk_register_clkdev(clk, "ccic_mux.0", NULL); | ||
297 | |||
298 | clk = mmp_clk_register_apmu("ccic0", "ccic0_mux", | ||
299 | apmu_base + APMU_CCIC0, 0x1b, &clk_lock); | ||
300 | clk_register_clkdev(clk, "fnclk", "mmp-ccic.0"); | ||
301 | |||
302 | clk = clk_register_mux(NULL, "ccic0_phy_mux", ccic_phy_parent, | ||
303 | ARRAY_SIZE(ccic_phy_parent), | ||
304 | CLK_SET_RATE_PARENT, apmu_base + APMU_CCIC0, | ||
305 | 7, 1, 0, &clk_lock); | ||
306 | clk_register_clkdev(clk, "ccic_phy_mux.0", NULL); | ||
307 | |||
308 | clk = mmp_clk_register_apmu("ccic0_phy", "ccic0_phy_mux", | ||
309 | apmu_base + APMU_CCIC0, 0x24, &clk_lock); | ||
310 | clk_register_clkdev(clk, "phyclk", "mmp-ccic.0"); | ||
311 | |||
312 | clk = clk_register_divider(NULL, "ccic0_sphy_div", "ccic0_mux", | ||
313 | CLK_SET_RATE_PARENT, apmu_base + APMU_CCIC0, | ||
314 | 10, 5, 0, &clk_lock); | ||
315 | clk_register_clkdev(clk, "sphyclk_div", NULL); | ||
316 | |||
317 | clk = mmp_clk_register_apmu("ccic0_sphy", "ccic0_sphy_div", | ||
318 | apmu_base + APMU_CCIC0, 0x300, &clk_lock); | ||
319 | clk_register_clkdev(clk, "sphyclk", "mmp-ccic.0"); | ||
320 | } | ||
diff --git a/drivers/clk/mmp/clk.h b/drivers/clk/mmp/clk.h new file mode 100644 index 000000000000..ab86dd4a416a --- /dev/null +++ b/drivers/clk/mmp/clk.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef __MACH_MMP_CLK_H | ||
2 | #define __MACH_MMP_CLK_H | ||
3 | |||
4 | #include <linux/clk-provider.h> | ||
5 | #include <linux/clkdev.h> | ||
6 | |||
7 | #define APBC_NO_BUS_CTRL BIT(0) | ||
8 | #define APBC_POWER_CTRL BIT(1) | ||
9 | |||
10 | struct clk_factor_masks { | ||
11 | unsigned int factor; | ||
12 | unsigned int num_mask; | ||
13 | unsigned int den_mask; | ||
14 | unsigned int num_shift; | ||
15 | unsigned int den_shift; | ||
16 | }; | ||
17 | |||
18 | struct clk_factor_tbl { | ||
19 | unsigned int num; | ||
20 | unsigned int den; | ||
21 | }; | ||
22 | |||
23 | extern struct clk *mmp_clk_register_pll2(const char *name, | ||
24 | const char *parent_name, unsigned long flags); | ||
25 | extern struct clk *mmp_clk_register_apbc(const char *name, | ||
26 | const char *parent_name, void __iomem *base, | ||
27 | unsigned int delay, unsigned int apbc_flags, spinlock_t *lock); | ||
28 | extern struct clk *mmp_clk_register_apmu(const char *name, | ||
29 | const char *parent_name, void __iomem *base, u32 enable_mask, | ||
30 | spinlock_t *lock); | ||
31 | extern struct clk *mmp_clk_register_factor(const char *name, | ||
32 | const char *parent_name, unsigned long flags, | ||
33 | void __iomem *base, struct clk_factor_masks *masks, | ||
34 | struct clk_factor_tbl *ftbl, unsigned int ftbl_cnt); | ||
35 | #endif | ||
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c index 844043ad0fe4..9f6d15546cbe 100644 --- a/drivers/clk/mxs/clk-imx23.c +++ b/drivers/clk/mxs/clk-imx23.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/of.h> | ||
17 | #include <mach/common.h> | 18 | #include <mach/common.h> |
18 | #include <mach/mx23.h> | 19 | #include <mach/mx23.h> |
19 | #include "clk.h" | 20 | #include "clk.h" |
@@ -71,44 +72,6 @@ static void __init clk_misc_init(void) | |||
71 | __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); | 72 | __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); |
72 | } | 73 | } |
73 | 74 | ||
74 | static struct clk_lookup uart_lookups[] = { | ||
75 | { .dev_id = "duart", }, | ||
76 | { .dev_id = "mxs-auart.0", }, | ||
77 | { .dev_id = "mxs-auart.1", }, | ||
78 | { .dev_id = "8006c000.serial", }, | ||
79 | { .dev_id = "8006e000.serial", }, | ||
80 | { .dev_id = "80070000.serial", }, | ||
81 | }; | ||
82 | |||
83 | static struct clk_lookup hbus_lookups[] = { | ||
84 | { .dev_id = "imx23-dma-apbh", }, | ||
85 | { .dev_id = "80004000.dma-apbh", }, | ||
86 | }; | ||
87 | |||
88 | static struct clk_lookup xbus_lookups[] = { | ||
89 | { .dev_id = "duart", .con_id = "apb_pclk"}, | ||
90 | { .dev_id = "80070000.serial", .con_id = "apb_pclk"}, | ||
91 | { .dev_id = "imx23-dma-apbx", }, | ||
92 | { .dev_id = "80024000.dma-apbx", }, | ||
93 | }; | ||
94 | |||
95 | static struct clk_lookup ssp_lookups[] = { | ||
96 | { .dev_id = "imx23-mmc.0", }, | ||
97 | { .dev_id = "imx23-mmc.1", }, | ||
98 | { .dev_id = "80010000.ssp", }, | ||
99 | { .dev_id = "80034000.ssp", }, | ||
100 | }; | ||
101 | |||
102 | static struct clk_lookup lcdif_lookups[] = { | ||
103 | { .dev_id = "imx23-fb", }, | ||
104 | { .dev_id = "80030000.lcdif", }, | ||
105 | }; | ||
106 | |||
107 | static struct clk_lookup gpmi_lookups[] = { | ||
108 | { .dev_id = "imx23-gpmi-nand", }, | ||
109 | { .dev_id = "8000c000.gpmi-nand", }, | ||
110 | }; | ||
111 | |||
112 | static const char *sel_pll[] __initconst = { "pll", "ref_xtal", }; | 75 | static const char *sel_pll[] __initconst = { "pll", "ref_xtal", }; |
113 | static const char *sel_cpu[] __initconst = { "ref_cpu", "ref_xtal", }; | 76 | static const char *sel_cpu[] __initconst = { "ref_cpu", "ref_xtal", }; |
114 | static const char *sel_pix[] __initconst = { "ref_pix", "ref_xtal", }; | 77 | static const char *sel_pix[] __initconst = { "ref_pix", "ref_xtal", }; |
@@ -127,6 +90,7 @@ enum imx23_clk { | |||
127 | }; | 90 | }; |
128 | 91 | ||
129 | static struct clk *clks[clk_max]; | 92 | static struct clk *clks[clk_max]; |
93 | static struct clk_onecell_data clk_data; | ||
130 | 94 | ||
131 | static enum imx23_clk clks_init_on[] __initdata = { | 95 | static enum imx23_clk clks_init_on[] __initdata = { |
132 | cpu, hbus, xbus, emi, uart, | 96 | cpu, hbus, xbus, emi, uart, |
@@ -134,6 +98,7 @@ static enum imx23_clk clks_init_on[] __initdata = { | |||
134 | 98 | ||
135 | int __init mx23_clocks_init(void) | 99 | int __init mx23_clocks_init(void) |
136 | { | 100 | { |
101 | struct device_node *np; | ||
137 | int i; | 102 | int i; |
138 | 103 | ||
139 | clk_misc_init(); | 104 | clk_misc_init(); |
@@ -188,14 +153,14 @@ int __init mx23_clocks_init(void) | |||
188 | return PTR_ERR(clks[i]); | 153 | return PTR_ERR(clks[i]); |
189 | } | 154 | } |
190 | 155 | ||
156 | np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl"); | ||
157 | if (np) { | ||
158 | clk_data.clks = clks; | ||
159 | clk_data.clk_num = ARRAY_SIZE(clks); | ||
160 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
161 | } | ||
162 | |||
191 | clk_register_clkdev(clks[clk32k], NULL, "timrot"); | 163 | clk_register_clkdev(clks[clk32k], NULL, "timrot"); |
192 | clk_register_clkdev(clks[pwm], NULL, "80064000.pwm"); | ||
193 | clk_register_clkdevs(clks[hbus], hbus_lookups, ARRAY_SIZE(hbus_lookups)); | ||
194 | clk_register_clkdevs(clks[xbus], xbus_lookups, ARRAY_SIZE(xbus_lookups)); | ||
195 | clk_register_clkdevs(clks[uart], uart_lookups, ARRAY_SIZE(uart_lookups)); | ||
196 | clk_register_clkdevs(clks[ssp], ssp_lookups, ARRAY_SIZE(ssp_lookups)); | ||
197 | clk_register_clkdevs(clks[gpmi], gpmi_lookups, ARRAY_SIZE(gpmi_lookups)); | ||
198 | clk_register_clkdevs(clks[lcdif], lcdif_lookups, ARRAY_SIZE(lcdif_lookups)); | ||
199 | 164 | ||
200 | for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) | 165 | for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) |
201 | clk_prepare_enable(clks[clks_init_on[i]]); | 166 | clk_prepare_enable(clks[clks_init_on[i]]); |
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c index e3aab67b3eb7..613e76f3758e 100644 --- a/drivers/clk/mxs/clk-imx28.c +++ b/drivers/clk/mxs/clk-imx28.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/of.h> | ||
17 | #include <mach/common.h> | 18 | #include <mach/common.h> |
18 | #include <mach/mx28.h> | 19 | #include <mach/mx28.h> |
19 | #include "clk.h" | 20 | #include "clk.h" |
@@ -120,90 +121,6 @@ static void __init clk_misc_init(void) | |||
120 | writel_relaxed(val, FRAC0); | 121 | writel_relaxed(val, FRAC0); |
121 | } | 122 | } |
122 | 123 | ||
123 | static struct clk_lookup uart_lookups[] = { | ||
124 | { .dev_id = "duart", }, | ||
125 | { .dev_id = "mxs-auart.0", }, | ||
126 | { .dev_id = "mxs-auart.1", }, | ||
127 | { .dev_id = "mxs-auart.2", }, | ||
128 | { .dev_id = "mxs-auart.3", }, | ||
129 | { .dev_id = "mxs-auart.4", }, | ||
130 | { .dev_id = "8006a000.serial", }, | ||
131 | { .dev_id = "8006c000.serial", }, | ||
132 | { .dev_id = "8006e000.serial", }, | ||
133 | { .dev_id = "80070000.serial", }, | ||
134 | { .dev_id = "80072000.serial", }, | ||
135 | { .dev_id = "80074000.serial", }, | ||
136 | }; | ||
137 | |||
138 | static struct clk_lookup hbus_lookups[] = { | ||
139 | { .dev_id = "imx28-dma-apbh", }, | ||
140 | { .dev_id = "80004000.dma-apbh", }, | ||
141 | }; | ||
142 | |||
143 | static struct clk_lookup xbus_lookups[] = { | ||
144 | { .dev_id = "duart", .con_id = "apb_pclk"}, | ||
145 | { .dev_id = "80074000.serial", .con_id = "apb_pclk"}, | ||
146 | { .dev_id = "imx28-dma-apbx", }, | ||
147 | { .dev_id = "80024000.dma-apbx", }, | ||
148 | }; | ||
149 | |||
150 | static struct clk_lookup ssp0_lookups[] = { | ||
151 | { .dev_id = "imx28-mmc.0", }, | ||
152 | { .dev_id = "80010000.ssp", }, | ||
153 | }; | ||
154 | |||
155 | static struct clk_lookup ssp1_lookups[] = { | ||
156 | { .dev_id = "imx28-mmc.1", }, | ||
157 | { .dev_id = "80012000.ssp", }, | ||
158 | }; | ||
159 | |||
160 | static struct clk_lookup ssp2_lookups[] = { | ||
161 | { .dev_id = "imx28-mmc.2", }, | ||
162 | { .dev_id = "80014000.ssp", }, | ||
163 | }; | ||
164 | |||
165 | static struct clk_lookup ssp3_lookups[] = { | ||
166 | { .dev_id = "imx28-mmc.3", }, | ||
167 | { .dev_id = "80016000.ssp", }, | ||
168 | }; | ||
169 | |||
170 | static struct clk_lookup lcdif_lookups[] = { | ||
171 | { .dev_id = "imx28-fb", }, | ||
172 | { .dev_id = "80030000.lcdif", }, | ||
173 | }; | ||
174 | |||
175 | static struct clk_lookup gpmi_lookups[] = { | ||
176 | { .dev_id = "imx28-gpmi-nand", }, | ||
177 | { .dev_id = "8000c000.gpmi-nand", }, | ||
178 | }; | ||
179 | |||
180 | static struct clk_lookup fec_lookups[] = { | ||
181 | { .dev_id = "imx28-fec.0", }, | ||
182 | { .dev_id = "imx28-fec.1", }, | ||
183 | { .dev_id = "800f0000.ethernet", }, | ||
184 | { .dev_id = "800f4000.ethernet", }, | ||
185 | }; | ||
186 | |||
187 | static struct clk_lookup can0_lookups[] = { | ||
188 | { .dev_id = "flexcan.0", }, | ||
189 | { .dev_id = "80032000.can", }, | ||
190 | }; | ||
191 | |||
192 | static struct clk_lookup can1_lookups[] = { | ||
193 | { .dev_id = "flexcan.1", }, | ||
194 | { .dev_id = "80034000.can", }, | ||
195 | }; | ||
196 | |||
197 | static struct clk_lookup saif0_lookups[] = { | ||
198 | { .dev_id = "mxs-saif.0", }, | ||
199 | { .dev_id = "80042000.saif", }, | ||
200 | }; | ||
201 | |||
202 | static struct clk_lookup saif1_lookups[] = { | ||
203 | { .dev_id = "mxs-saif.1", }, | ||
204 | { .dev_id = "80046000.saif", }, | ||
205 | }; | ||
206 | |||
207 | static const char *sel_cpu[] __initconst = { "ref_cpu", "ref_xtal", }; | 124 | static const char *sel_cpu[] __initconst = { "ref_cpu", "ref_xtal", }; |
208 | static const char *sel_io0[] __initconst = { "ref_io0", "ref_xtal", }; | 125 | static const char *sel_io0[] __initconst = { "ref_io0", "ref_xtal", }; |
209 | static const char *sel_io1[] __initconst = { "ref_io1", "ref_xtal", }; | 126 | static const char *sel_io1[] __initconst = { "ref_io1", "ref_xtal", }; |
@@ -228,6 +145,7 @@ enum imx28_clk { | |||
228 | }; | 145 | }; |
229 | 146 | ||
230 | static struct clk *clks[clk_max]; | 147 | static struct clk *clks[clk_max]; |
148 | static struct clk_onecell_data clk_data; | ||
231 | 149 | ||
232 | static enum imx28_clk clks_init_on[] __initdata = { | 150 | static enum imx28_clk clks_init_on[] __initdata = { |
233 | cpu, hbus, xbus, emi, uart, | 151 | cpu, hbus, xbus, emi, uart, |
@@ -235,6 +153,7 @@ static enum imx28_clk clks_init_on[] __initdata = { | |||
235 | 153 | ||
236 | int __init mx28_clocks_init(void) | 154 | int __init mx28_clocks_init(void) |
237 | { | 155 | { |
156 | struct device_node *np; | ||
238 | int i; | 157 | int i; |
239 | 158 | ||
240 | clk_misc_init(); | 159 | clk_misc_init(); |
@@ -312,27 +231,15 @@ int __init mx28_clocks_init(void) | |||
312 | return PTR_ERR(clks[i]); | 231 | return PTR_ERR(clks[i]); |
313 | } | 232 | } |
314 | 233 | ||
234 | np = of_find_compatible_node(NULL, NULL, "fsl,imx28-clkctrl"); | ||
235 | if (np) { | ||
236 | clk_data.clks = clks; | ||
237 | clk_data.clk_num = ARRAY_SIZE(clks); | ||
238 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
239 | } | ||
240 | |||
315 | clk_register_clkdev(clks[clk32k], NULL, "timrot"); | 241 | clk_register_clkdev(clks[clk32k], NULL, "timrot"); |
316 | clk_register_clkdev(clks[enet_out], NULL, "enet_out"); | 242 | clk_register_clkdev(clks[enet_out], NULL, "enet_out"); |
317 | clk_register_clkdev(clks[pwm], NULL, "80064000.pwm"); | ||
318 | clk_register_clkdevs(clks[hbus], hbus_lookups, ARRAY_SIZE(hbus_lookups)); | ||
319 | clk_register_clkdevs(clks[xbus], xbus_lookups, ARRAY_SIZE(xbus_lookups)); | ||
320 | clk_register_clkdevs(clks[uart], uart_lookups, ARRAY_SIZE(uart_lookups)); | ||
321 | clk_register_clkdevs(clks[ssp0], ssp0_lookups, ARRAY_SIZE(ssp0_lookups)); | ||
322 | clk_register_clkdevs(clks[ssp1], ssp1_lookups, ARRAY_SIZE(ssp1_lookups)); | ||
323 | clk_register_clkdevs(clks[ssp2], ssp2_lookups, ARRAY_SIZE(ssp2_lookups)); | ||
324 | clk_register_clkdevs(clks[ssp3], ssp3_lookups, ARRAY_SIZE(ssp3_lookups)); | ||
325 | clk_register_clkdevs(clks[gpmi], gpmi_lookups, ARRAY_SIZE(gpmi_lookups)); | ||
326 | clk_register_clkdevs(clks[saif0], saif0_lookups, ARRAY_SIZE(saif0_lookups)); | ||
327 | clk_register_clkdevs(clks[saif1], saif1_lookups, ARRAY_SIZE(saif1_lookups)); | ||
328 | clk_register_clkdevs(clks[lcdif], lcdif_lookups, ARRAY_SIZE(lcdif_lookups)); | ||
329 | clk_register_clkdevs(clks[fec], fec_lookups, ARRAY_SIZE(fec_lookups)); | ||
330 | clk_register_clkdevs(clks[can0], can0_lookups, ARRAY_SIZE(can0_lookups)); | ||
331 | clk_register_clkdevs(clks[can1], can1_lookups, ARRAY_SIZE(can1_lookups)); | ||
332 | clk_register_clkdev(clks[usb0_pwr], NULL, "8007c000.usbphy"); | ||
333 | clk_register_clkdev(clks[usb1_pwr], NULL, "8007e000.usbphy"); | ||
334 | clk_register_clkdev(clks[usb0], NULL, "80080000.usb"); | ||
335 | clk_register_clkdev(clks[usb1], NULL, "80090000.usb"); | ||
336 | 243 | ||
337 | for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) | 244 | for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) |
338 | clk_prepare_enable(clks[clks_init_on[i]]); | 245 | clk_prepare_enable(clks[clks_init_on[i]]); |
diff --git a/drivers/clk/ux500/Makefile b/drivers/clk/ux500/Makefile new file mode 100644 index 000000000000..858fbfe66281 --- /dev/null +++ b/drivers/clk/ux500/Makefile | |||
@@ -0,0 +1,12 @@ | |||
1 | # | ||
2 | # Makefile for ux500 clocks | ||
3 | # | ||
4 | |||
5 | # Clock types | ||
6 | obj-y += clk-prcc.o | ||
7 | obj-y += clk-prcmu.o | ||
8 | |||
9 | # Clock definitions | ||
10 | obj-y += u8500_clk.o | ||
11 | obj-y += u9540_clk.o | ||
12 | obj-y += u8540_clk.o | ||
diff --git a/drivers/clk/ux500/clk-prcc.c b/drivers/clk/ux500/clk-prcc.c new file mode 100644 index 000000000000..7eee7f768355 --- /dev/null +++ b/drivers/clk/ux500/clk-prcc.c | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | * PRCC clock implementation for ux500 platform. | ||
3 | * | ||
4 | * Copyright (C) 2012 ST-Ericsson SA | ||
5 | * Author: Ulf Hansson <ulf.hansson@linaro.org> | ||
6 | * | ||
7 | * License terms: GNU General Public License (GPL) version 2 | ||
8 | */ | ||
9 | |||
10 | #include <linux/clk-provider.h> | ||
11 | #include <linux/clk-private.h> | ||
12 | #include <linux/slab.h> | ||
13 | #include <linux/io.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <mach/hardware.h> | ||
17 | |||
18 | #include "clk.h" | ||
19 | |||
20 | #define PRCC_PCKEN 0x000 | ||
21 | #define PRCC_PCKDIS 0x004 | ||
22 | #define PRCC_KCKEN 0x008 | ||
23 | #define PRCC_KCKDIS 0x00C | ||
24 | #define PRCC_PCKSR 0x010 | ||
25 | #define PRCC_KCKSR 0x014 | ||
26 | |||
27 | #define to_clk_prcc(_hw) container_of(_hw, struct clk_prcc, hw) | ||
28 | |||
29 | struct clk_prcc { | ||
30 | struct clk_hw hw; | ||
31 | void __iomem *base; | ||
32 | u32 cg_sel; | ||
33 | int is_enabled; | ||
34 | }; | ||
35 | |||
36 | /* PRCC clock operations. */ | ||
37 | |||
38 | static int clk_prcc_pclk_enable(struct clk_hw *hw) | ||
39 | { | ||
40 | struct clk_prcc *clk = to_clk_prcc(hw); | ||
41 | |||
42 | writel(clk->cg_sel, (clk->base + PRCC_PCKEN)); | ||
43 | while (!(readl(clk->base + PRCC_PCKSR) & clk->cg_sel)) | ||
44 | cpu_relax(); | ||
45 | |||
46 | clk->is_enabled = 1; | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | static void clk_prcc_pclk_disable(struct clk_hw *hw) | ||
51 | { | ||
52 | struct clk_prcc *clk = to_clk_prcc(hw); | ||
53 | |||
54 | writel(clk->cg_sel, (clk->base + PRCC_PCKDIS)); | ||
55 | clk->is_enabled = 0; | ||
56 | } | ||
57 | |||
58 | static int clk_prcc_kclk_enable(struct clk_hw *hw) | ||
59 | { | ||
60 | struct clk_prcc *clk = to_clk_prcc(hw); | ||
61 | |||
62 | writel(clk->cg_sel, (clk->base + PRCC_KCKEN)); | ||
63 | while (!(readl(clk->base + PRCC_KCKSR) & clk->cg_sel)) | ||
64 | cpu_relax(); | ||
65 | |||
66 | clk->is_enabled = 1; | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static void clk_prcc_kclk_disable(struct clk_hw *hw) | ||
71 | { | ||
72 | struct clk_prcc *clk = to_clk_prcc(hw); | ||
73 | |||
74 | writel(clk->cg_sel, (clk->base + PRCC_KCKDIS)); | ||
75 | clk->is_enabled = 0; | ||
76 | } | ||
77 | |||
78 | static int clk_prcc_is_enabled(struct clk_hw *hw) | ||
79 | { | ||
80 | struct clk_prcc *clk = to_clk_prcc(hw); | ||
81 | return clk->is_enabled; | ||
82 | } | ||
83 | |||
84 | static struct clk_ops clk_prcc_pclk_ops = { | ||
85 | .enable = clk_prcc_pclk_enable, | ||
86 | .disable = clk_prcc_pclk_disable, | ||
87 | .is_enabled = clk_prcc_is_enabled, | ||
88 | }; | ||
89 | |||
90 | static struct clk_ops clk_prcc_kclk_ops = { | ||
91 | .enable = clk_prcc_kclk_enable, | ||
92 | .disable = clk_prcc_kclk_disable, | ||
93 | .is_enabled = clk_prcc_is_enabled, | ||
94 | }; | ||
95 | |||
96 | static struct clk *clk_reg_prcc(const char *name, | ||
97 | const char *parent_name, | ||
98 | resource_size_t phy_base, | ||
99 | u32 cg_sel, | ||
100 | unsigned long flags, | ||
101 | struct clk_ops *clk_prcc_ops) | ||
102 | { | ||
103 | struct clk_prcc *clk; | ||
104 | struct clk_init_data clk_prcc_init; | ||
105 | struct clk *clk_reg; | ||
106 | |||
107 | if (!name) { | ||
108 | pr_err("clk_prcc: %s invalid arguments passed\n", __func__); | ||
109 | return ERR_PTR(-EINVAL); | ||
110 | } | ||
111 | |||
112 | clk = kzalloc(sizeof(struct clk_prcc), GFP_KERNEL); | ||
113 | if (!clk) { | ||
114 | pr_err("clk_prcc: %s could not allocate clk\n", __func__); | ||
115 | return ERR_PTR(-ENOMEM); | ||
116 | } | ||
117 | |||
118 | clk->base = ioremap(phy_base, SZ_4K); | ||
119 | if (!clk->base) | ||
120 | goto free_clk; | ||
121 | |||
122 | clk->cg_sel = cg_sel; | ||
123 | clk->is_enabled = 1; | ||
124 | |||
125 | clk_prcc_init.name = name; | ||
126 | clk_prcc_init.ops = clk_prcc_ops; | ||
127 | clk_prcc_init.flags = flags; | ||
128 | clk_prcc_init.parent_names = (parent_name ? &parent_name : NULL); | ||
129 | clk_prcc_init.num_parents = (parent_name ? 1 : 0); | ||
130 | clk->hw.init = &clk_prcc_init; | ||
131 | |||
132 | clk_reg = clk_register(NULL, &clk->hw); | ||
133 | if (IS_ERR_OR_NULL(clk_reg)) | ||
134 | goto unmap_clk; | ||
135 | |||
136 | return clk_reg; | ||
137 | |||
138 | unmap_clk: | ||
139 | iounmap(clk->base); | ||
140 | free_clk: | ||
141 | kfree(clk); | ||
142 | pr_err("clk_prcc: %s failed to register clk\n", __func__); | ||
143 | return ERR_PTR(-ENOMEM); | ||
144 | } | ||
145 | |||
146 | struct clk *clk_reg_prcc_pclk(const char *name, | ||
147 | const char *parent_name, | ||
148 | resource_size_t phy_base, | ||
149 | u32 cg_sel, | ||
150 | unsigned long flags) | ||
151 | { | ||
152 | return clk_reg_prcc(name, parent_name, phy_base, cg_sel, flags, | ||
153 | &clk_prcc_pclk_ops); | ||
154 | } | ||
155 | |||
156 | struct clk *clk_reg_prcc_kclk(const char *name, | ||
157 | const char *parent_name, | ||
158 | resource_size_t phy_base, | ||
159 | u32 cg_sel, | ||
160 | unsigned long flags) | ||
161 | { | ||
162 | return clk_reg_prcc(name, parent_name, phy_base, cg_sel, flags, | ||
163 | &clk_prcc_kclk_ops); | ||
164 | } | ||
diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c new file mode 100644 index 000000000000..930cdfeb47ab --- /dev/null +++ b/drivers/clk/ux500/clk-prcmu.c | |||
@@ -0,0 +1,252 @@ | |||
1 | /* | ||
2 | * PRCMU clock implementation for ux500 platform. | ||
3 | * | ||
4 | * Copyright (C) 2012 ST-Ericsson SA | ||
5 | * Author: Ulf Hansson <ulf.hansson@linaro.org> | ||
6 | * | ||
7 | * License terms: GNU General Public License (GPL) version 2 | ||
8 | */ | ||
9 | |||
10 | #include <linux/clk-provider.h> | ||
11 | #include <linux/clk-private.h> | ||
12 | #include <linux/mfd/dbx500-prcmu.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/err.h> | ||
16 | #include "clk.h" | ||
17 | |||
18 | #define to_clk_prcmu(_hw) container_of(_hw, struct clk_prcmu, hw) | ||
19 | |||
20 | struct clk_prcmu { | ||
21 | struct clk_hw hw; | ||
22 | u8 cg_sel; | ||
23 | int is_enabled; | ||
24 | }; | ||
25 | |||
26 | /* PRCMU clock operations. */ | ||
27 | |||
28 | static int clk_prcmu_prepare(struct clk_hw *hw) | ||
29 | { | ||
30 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
31 | return prcmu_request_clock(clk->cg_sel, true); | ||
32 | } | ||
33 | |||
34 | static void clk_prcmu_unprepare(struct clk_hw *hw) | ||
35 | { | ||
36 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
37 | if (prcmu_request_clock(clk->cg_sel, false)) | ||
38 | pr_err("clk_prcmu: %s failed to disable %s.\n", __func__, | ||
39 | hw->init->name); | ||
40 | } | ||
41 | |||
42 | static int clk_prcmu_enable(struct clk_hw *hw) | ||
43 | { | ||
44 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
45 | clk->is_enabled = 1; | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | static void clk_prcmu_disable(struct clk_hw *hw) | ||
50 | { | ||
51 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
52 | clk->is_enabled = 0; | ||
53 | } | ||
54 | |||
55 | static int clk_prcmu_is_enabled(struct clk_hw *hw) | ||
56 | { | ||
57 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
58 | return clk->is_enabled; | ||
59 | } | ||
60 | |||
61 | static unsigned long clk_prcmu_recalc_rate(struct clk_hw *hw, | ||
62 | unsigned long parent_rate) | ||
63 | { | ||
64 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
65 | return prcmu_clock_rate(clk->cg_sel); | ||
66 | } | ||
67 | |||
68 | static long clk_prcmu_round_rate(struct clk_hw *hw, unsigned long rate, | ||
69 | unsigned long *parent_rate) | ||
70 | { | ||
71 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
72 | return prcmu_round_clock_rate(clk->cg_sel, rate); | ||
73 | } | ||
74 | |||
75 | static int clk_prcmu_set_rate(struct clk_hw *hw, unsigned long rate, | ||
76 | unsigned long parent_rate) | ||
77 | { | ||
78 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
79 | return prcmu_set_clock_rate(clk->cg_sel, rate); | ||
80 | } | ||
81 | |||
82 | static int request_ape_opp100(bool enable) | ||
83 | { | ||
84 | static int reqs; | ||
85 | int err = 0; | ||
86 | |||
87 | if (enable) { | ||
88 | if (!reqs) | ||
89 | err = prcmu_qos_add_requirement(PRCMU_QOS_APE_OPP, | ||
90 | "clock", 100); | ||
91 | if (!err) | ||
92 | reqs++; | ||
93 | } else { | ||
94 | reqs--; | ||
95 | if (!reqs) | ||
96 | prcmu_qos_remove_requirement(PRCMU_QOS_APE_OPP, | ||
97 | "clock"); | ||
98 | } | ||
99 | return err; | ||
100 | } | ||
101 | |||
102 | static int clk_prcmu_opp_prepare(struct clk_hw *hw) | ||
103 | { | ||
104 | int err; | ||
105 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
106 | |||
107 | err = request_ape_opp100(true); | ||
108 | if (err) { | ||
109 | pr_err("clk_prcmu: %s failed to request APE OPP100 for %s.\n", | ||
110 | __func__, hw->init->name); | ||
111 | return err; | ||
112 | } | ||
113 | |||
114 | err = prcmu_request_clock(clk->cg_sel, true); | ||
115 | if (err) | ||
116 | request_ape_opp100(false); | ||
117 | |||
118 | return err; | ||
119 | } | ||
120 | |||
121 | static void clk_prcmu_opp_unprepare(struct clk_hw *hw) | ||
122 | { | ||
123 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
124 | |||
125 | if (prcmu_request_clock(clk->cg_sel, false)) | ||
126 | goto out_error; | ||
127 | if (request_ape_opp100(false)) | ||
128 | goto out_error; | ||
129 | return; | ||
130 | |||
131 | out_error: | ||
132 | pr_err("clk_prcmu: %s failed to disable %s.\n", __func__, | ||
133 | hw->init->name); | ||
134 | } | ||
135 | |||
136 | static struct clk_ops clk_prcmu_scalable_ops = { | ||
137 | .prepare = clk_prcmu_prepare, | ||
138 | .unprepare = clk_prcmu_unprepare, | ||
139 | .enable = clk_prcmu_enable, | ||
140 | .disable = clk_prcmu_disable, | ||
141 | .is_enabled = clk_prcmu_is_enabled, | ||
142 | .recalc_rate = clk_prcmu_recalc_rate, | ||
143 | .round_rate = clk_prcmu_round_rate, | ||
144 | .set_rate = clk_prcmu_set_rate, | ||
145 | }; | ||
146 | |||
147 | static struct clk_ops clk_prcmu_gate_ops = { | ||
148 | .prepare = clk_prcmu_prepare, | ||
149 | .unprepare = clk_prcmu_unprepare, | ||
150 | .enable = clk_prcmu_enable, | ||
151 | .disable = clk_prcmu_disable, | ||
152 | .is_enabled = clk_prcmu_is_enabled, | ||
153 | .recalc_rate = clk_prcmu_recalc_rate, | ||
154 | }; | ||
155 | |||
156 | static struct clk_ops clk_prcmu_rate_ops = { | ||
157 | .is_enabled = clk_prcmu_is_enabled, | ||
158 | .recalc_rate = clk_prcmu_recalc_rate, | ||
159 | }; | ||
160 | |||
161 | static struct clk_ops clk_prcmu_opp_gate_ops = { | ||
162 | .prepare = clk_prcmu_opp_prepare, | ||
163 | .unprepare = clk_prcmu_opp_unprepare, | ||
164 | .enable = clk_prcmu_enable, | ||
165 | .disable = clk_prcmu_disable, | ||
166 | .is_enabled = clk_prcmu_is_enabled, | ||
167 | .recalc_rate = clk_prcmu_recalc_rate, | ||
168 | }; | ||
169 | |||
170 | static struct clk *clk_reg_prcmu(const char *name, | ||
171 | const char *parent_name, | ||
172 | u8 cg_sel, | ||
173 | unsigned long rate, | ||
174 | unsigned long flags, | ||
175 | struct clk_ops *clk_prcmu_ops) | ||
176 | { | ||
177 | struct clk_prcmu *clk; | ||
178 | struct clk_init_data clk_prcmu_init; | ||
179 | struct clk *clk_reg; | ||
180 | |||
181 | if (!name) { | ||
182 | pr_err("clk_prcmu: %s invalid arguments passed\n", __func__); | ||
183 | return ERR_PTR(-EINVAL); | ||
184 | } | ||
185 | |||
186 | clk = kzalloc(sizeof(struct clk_prcmu), GFP_KERNEL); | ||
187 | if (!clk) { | ||
188 | pr_err("clk_prcmu: %s could not allocate clk\n", __func__); | ||
189 | return ERR_PTR(-ENOMEM); | ||
190 | } | ||
191 | |||
192 | clk->cg_sel = cg_sel; | ||
193 | clk->is_enabled = 1; | ||
194 | /* "rate" can be used for changing the initial frequency */ | ||
195 | if (rate) | ||
196 | prcmu_set_clock_rate(cg_sel, rate); | ||
197 | |||
198 | clk_prcmu_init.name = name; | ||
199 | clk_prcmu_init.ops = clk_prcmu_ops; | ||
200 | clk_prcmu_init.flags = flags; | ||
201 | clk_prcmu_init.parent_names = (parent_name ? &parent_name : NULL); | ||
202 | clk_prcmu_init.num_parents = (parent_name ? 1 : 0); | ||
203 | clk->hw.init = &clk_prcmu_init; | ||
204 | |||
205 | clk_reg = clk_register(NULL, &clk->hw); | ||
206 | if (IS_ERR_OR_NULL(clk_reg)) | ||
207 | goto free_clk; | ||
208 | |||
209 | return clk_reg; | ||
210 | |||
211 | free_clk: | ||
212 | kfree(clk); | ||
213 | pr_err("clk_prcmu: %s failed to register clk\n", __func__); | ||
214 | return ERR_PTR(-ENOMEM); | ||
215 | } | ||
216 | |||
217 | struct clk *clk_reg_prcmu_scalable(const char *name, | ||
218 | const char *parent_name, | ||
219 | u8 cg_sel, | ||
220 | unsigned long rate, | ||
221 | unsigned long flags) | ||
222 | { | ||
223 | return clk_reg_prcmu(name, parent_name, cg_sel, rate, flags, | ||
224 | &clk_prcmu_scalable_ops); | ||
225 | } | ||
226 | |||
227 | struct clk *clk_reg_prcmu_gate(const char *name, | ||
228 | const char *parent_name, | ||
229 | u8 cg_sel, | ||
230 | unsigned long flags) | ||
231 | { | ||
232 | return clk_reg_prcmu(name, parent_name, cg_sel, 0, flags, | ||
233 | &clk_prcmu_gate_ops); | ||
234 | } | ||
235 | |||
236 | struct clk *clk_reg_prcmu_rate(const char *name, | ||
237 | const char *parent_name, | ||
238 | u8 cg_sel, | ||
239 | unsigned long flags) | ||
240 | { | ||
241 | return clk_reg_prcmu(name, parent_name, cg_sel, 0, flags, | ||
242 | &clk_prcmu_rate_ops); | ||
243 | } | ||
244 | |||
245 | struct clk *clk_reg_prcmu_opp_gate(const char *name, | ||
246 | const char *parent_name, | ||
247 | u8 cg_sel, | ||
248 | unsigned long flags) | ||
249 | { | ||
250 | return clk_reg_prcmu(name, parent_name, cg_sel, 0, flags, | ||
251 | &clk_prcmu_opp_gate_ops); | ||
252 | } | ||
diff --git a/drivers/clk/ux500/clk.h b/drivers/clk/ux500/clk.h new file mode 100644 index 000000000000..836d7d16751e --- /dev/null +++ b/drivers/clk/ux500/clk.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Clocks for ux500 platforms | ||
3 | * | ||
4 | * Copyright (C) 2012 ST-Ericsson SA | ||
5 | * Author: Ulf Hansson <ulf.hansson@linaro.org> | ||
6 | * | ||
7 | * License terms: GNU General Public License (GPL) version 2 | ||
8 | */ | ||
9 | |||
10 | #ifndef __UX500_CLK_H | ||
11 | #define __UX500_CLK_H | ||
12 | |||
13 | #include <linux/clk.h> | ||
14 | |||
15 | struct clk *clk_reg_prcc_pclk(const char *name, | ||
16 | const char *parent_name, | ||
17 | unsigned int phy_base, | ||
18 | u32 cg_sel, | ||
19 | unsigned long flags); | ||
20 | |||
21 | struct clk *clk_reg_prcc_kclk(const char *name, | ||
22 | const char *parent_name, | ||
23 | unsigned int phy_base, | ||
24 | u32 cg_sel, | ||
25 | unsigned long flags); | ||
26 | |||
27 | struct clk *clk_reg_prcmu_scalable(const char *name, | ||
28 | const char *parent_name, | ||
29 | u8 cg_sel, | ||
30 | unsigned long rate, | ||
31 | unsigned long flags); | ||
32 | |||
33 | struct clk *clk_reg_prcmu_gate(const char *name, | ||
34 | const char *parent_name, | ||
35 | u8 cg_sel, | ||
36 | unsigned long flags); | ||
37 | |||
38 | struct clk *clk_reg_prcmu_rate(const char *name, | ||
39 | const char *parent_name, | ||
40 | u8 cg_sel, | ||
41 | unsigned long flags); | ||
42 | |||
43 | struct clk *clk_reg_prcmu_opp_gate(const char *name, | ||
44 | const char *parent_name, | ||
45 | u8 cg_sel, | ||
46 | unsigned long flags); | ||
47 | |||
48 | #endif /* __UX500_CLK_H */ | ||
diff --git a/drivers/clk/ux500/u8500_clk.c b/drivers/clk/ux500/u8500_clk.c new file mode 100644 index 000000000000..ca4a25ed844c --- /dev/null +++ b/drivers/clk/ux500/u8500_clk.c | |||
@@ -0,0 +1,477 @@ | |||
1 | /* | ||
2 | * Clock definitions for u8500 platform. | ||
3 | * | ||
4 | * Copyright (C) 2012 ST-Ericsson SA | ||
5 | * Author: Ulf Hansson <ulf.hansson@linaro.org> | ||
6 | * | ||
7 | * License terms: GNU General Public License (GPL) version 2 | ||
8 | */ | ||
9 | |||
10 | #include <linux/clk.h> | ||
11 | #include <linux/clkdev.h> | ||
12 | #include <linux/clk-provider.h> | ||
13 | #include <linux/mfd/dbx500-prcmu.h> | ||
14 | #include <linux/platform_data/clk-ux500.h> | ||
15 | |||
16 | #include "clk.h" | ||
17 | |||
18 | void u8500_clk_init(void) | ||
19 | { | ||
20 | struct prcmu_fw_version *fw_version; | ||
21 | const char *sgaclk_parent = NULL; | ||
22 | struct clk *clk; | ||
23 | |||
24 | /* Clock sources */ | ||
25 | clk = clk_reg_prcmu_gate("soc0_pll", NULL, PRCMU_PLLSOC0, | ||
26 | CLK_IS_ROOT|CLK_IGNORE_UNUSED); | ||
27 | clk_register_clkdev(clk, "soc0_pll", NULL); | ||
28 | |||
29 | clk = clk_reg_prcmu_gate("soc1_pll", NULL, PRCMU_PLLSOC1, | ||
30 | CLK_IS_ROOT|CLK_IGNORE_UNUSED); | ||
31 | clk_register_clkdev(clk, "soc1_pll", NULL); | ||
32 | |||
33 | clk = clk_reg_prcmu_gate("ddr_pll", NULL, PRCMU_PLLDDR, | ||
34 | CLK_IS_ROOT|CLK_IGNORE_UNUSED); | ||
35 | clk_register_clkdev(clk, "ddr_pll", NULL); | ||
36 | |||
37 | /* FIXME: Add sys, ulp and int clocks here. */ | ||
38 | |||
39 | clk = clk_register_fixed_rate(NULL, "rtc32k", "NULL", | ||
40 | CLK_IS_ROOT|CLK_IGNORE_UNUSED, | ||
41 | 32768); | ||
42 | clk_register_clkdev(clk, "clk32k", NULL); | ||
43 | clk_register_clkdev(clk, NULL, "rtc-pl031"); | ||
44 | |||
45 | /* PRCMU clocks */ | ||
46 | fw_version = prcmu_get_fw_version(); | ||
47 | if (fw_version != NULL) { | ||
48 | switch (fw_version->project) { | ||
49 | case PRCMU_FW_PROJECT_U8500_C2: | ||
50 | case PRCMU_FW_PROJECT_U8520: | ||
51 | case PRCMU_FW_PROJECT_U8420: | ||
52 | sgaclk_parent = "soc0_pll"; | ||
53 | break; | ||
54 | default: | ||
55 | break; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | if (sgaclk_parent) | ||
60 | clk = clk_reg_prcmu_gate("sgclk", sgaclk_parent, | ||
61 | PRCMU_SGACLK, 0); | ||
62 | else | ||
63 | clk = clk_reg_prcmu_gate("sgclk", NULL, | ||
64 | PRCMU_SGACLK, CLK_IS_ROOT); | ||
65 | clk_register_clkdev(clk, NULL, "mali"); | ||
66 | |||
67 | clk = clk_reg_prcmu_gate("uartclk", NULL, PRCMU_UARTCLK, CLK_IS_ROOT); | ||
68 | clk_register_clkdev(clk, NULL, "UART"); | ||
69 | |||
70 | clk = clk_reg_prcmu_gate("msp02clk", NULL, PRCMU_MSP02CLK, CLK_IS_ROOT); | ||
71 | clk_register_clkdev(clk, NULL, "MSP02"); | ||
72 | |||
73 | clk = clk_reg_prcmu_gate("msp1clk", NULL, PRCMU_MSP1CLK, CLK_IS_ROOT); | ||
74 | clk_register_clkdev(clk, NULL, "MSP1"); | ||
75 | |||
76 | clk = clk_reg_prcmu_gate("i2cclk", NULL, PRCMU_I2CCLK, CLK_IS_ROOT); | ||
77 | clk_register_clkdev(clk, NULL, "I2C"); | ||
78 | |||
79 | clk = clk_reg_prcmu_gate("slimclk", NULL, PRCMU_SLIMCLK, CLK_IS_ROOT); | ||
80 | clk_register_clkdev(clk, NULL, "slim"); | ||
81 | |||
82 | clk = clk_reg_prcmu_gate("per1clk", NULL, PRCMU_PER1CLK, CLK_IS_ROOT); | ||
83 | clk_register_clkdev(clk, NULL, "PERIPH1"); | ||
84 | |||
85 | clk = clk_reg_prcmu_gate("per2clk", NULL, PRCMU_PER2CLK, CLK_IS_ROOT); | ||
86 | clk_register_clkdev(clk, NULL, "PERIPH2"); | ||
87 | |||
88 | clk = clk_reg_prcmu_gate("per3clk", NULL, PRCMU_PER3CLK, CLK_IS_ROOT); | ||
89 | clk_register_clkdev(clk, NULL, "PERIPH3"); | ||
90 | |||
91 | clk = clk_reg_prcmu_gate("per5clk", NULL, PRCMU_PER5CLK, CLK_IS_ROOT); | ||
92 | clk_register_clkdev(clk, NULL, "PERIPH5"); | ||
93 | |||
94 | clk = clk_reg_prcmu_gate("per6clk", NULL, PRCMU_PER6CLK, CLK_IS_ROOT); | ||
95 | clk_register_clkdev(clk, NULL, "PERIPH6"); | ||
96 | |||
97 | clk = clk_reg_prcmu_gate("per7clk", NULL, PRCMU_PER7CLK, CLK_IS_ROOT); | ||
98 | clk_register_clkdev(clk, NULL, "PERIPH7"); | ||
99 | |||
100 | clk = clk_reg_prcmu_scalable("lcdclk", NULL, PRCMU_LCDCLK, 0, | ||
101 | CLK_IS_ROOT|CLK_SET_RATE_GATE); | ||
102 | clk_register_clkdev(clk, NULL, "lcd"); | ||
103 | clk_register_clkdev(clk, "lcd", "mcde"); | ||
104 | |||
105 | clk = clk_reg_prcmu_opp_gate("bmlclk", NULL, PRCMU_BMLCLK, CLK_IS_ROOT); | ||
106 | clk_register_clkdev(clk, NULL, "bml"); | ||
107 | |||
108 | clk = clk_reg_prcmu_scalable("hsitxclk", NULL, PRCMU_HSITXCLK, 0, | ||
109 | CLK_IS_ROOT|CLK_SET_RATE_GATE); | ||
110 | |||
111 | clk = clk_reg_prcmu_scalable("hsirxclk", NULL, PRCMU_HSIRXCLK, 0, | ||
112 | CLK_IS_ROOT|CLK_SET_RATE_GATE); | ||
113 | |||
114 | clk = clk_reg_prcmu_scalable("hdmiclk", NULL, PRCMU_HDMICLK, 0, | ||
115 | CLK_IS_ROOT|CLK_SET_RATE_GATE); | ||
116 | clk_register_clkdev(clk, NULL, "hdmi"); | ||
117 | clk_register_clkdev(clk, "hdmi", "mcde"); | ||
118 | |||
119 | clk = clk_reg_prcmu_gate("apeatclk", NULL, PRCMU_APEATCLK, CLK_IS_ROOT); | ||
120 | clk_register_clkdev(clk, NULL, "apeat"); | ||
121 | |||
122 | clk = clk_reg_prcmu_gate("apetraceclk", NULL, PRCMU_APETRACECLK, | ||
123 | CLK_IS_ROOT); | ||
124 | clk_register_clkdev(clk, NULL, "apetrace"); | ||
125 | |||
126 | clk = clk_reg_prcmu_gate("mcdeclk", NULL, PRCMU_MCDECLK, CLK_IS_ROOT); | ||
127 | clk_register_clkdev(clk, NULL, "mcde"); | ||
128 | clk_register_clkdev(clk, "mcde", "mcde"); | ||
129 | clk_register_clkdev(clk, "dsisys", "dsilink.0"); | ||
130 | clk_register_clkdev(clk, "dsisys", "dsilink.1"); | ||
131 | clk_register_clkdev(clk, "dsisys", "dsilink.2"); | ||
132 | |||
133 | clk = clk_reg_prcmu_opp_gate("ipi2cclk", NULL, PRCMU_IPI2CCLK, | ||
134 | CLK_IS_ROOT); | ||
135 | clk_register_clkdev(clk, NULL, "ipi2"); | ||
136 | |||
137 | clk = clk_reg_prcmu_gate("dsialtclk", NULL, PRCMU_DSIALTCLK, | ||
138 | CLK_IS_ROOT); | ||
139 | clk_register_clkdev(clk, NULL, "dsialt"); | ||
140 | |||
141 | clk = clk_reg_prcmu_gate("dmaclk", NULL, PRCMU_DMACLK, CLK_IS_ROOT); | ||
142 | clk_register_clkdev(clk, NULL, "dma40.0"); | ||
143 | |||
144 | clk = clk_reg_prcmu_gate("b2r2clk", NULL, PRCMU_B2R2CLK, CLK_IS_ROOT); | ||
145 | clk_register_clkdev(clk, NULL, "b2r2"); | ||
146 | clk_register_clkdev(clk, NULL, "b2r2_core"); | ||
147 | clk_register_clkdev(clk, NULL, "U8500-B2R2.0"); | ||
148 | |||
149 | clk = clk_reg_prcmu_scalable("tvclk", NULL, PRCMU_TVCLK, 0, | ||
150 | CLK_IS_ROOT|CLK_SET_RATE_GATE); | ||
151 | clk_register_clkdev(clk, NULL, "tv"); | ||
152 | clk_register_clkdev(clk, "tv", "mcde"); | ||
153 | |||
154 | clk = clk_reg_prcmu_gate("sspclk", NULL, PRCMU_SSPCLK, CLK_IS_ROOT); | ||
155 | clk_register_clkdev(clk, NULL, "SSP"); | ||
156 | |||
157 | clk = clk_reg_prcmu_gate("rngclk", NULL, PRCMU_RNGCLK, CLK_IS_ROOT); | ||
158 | clk_register_clkdev(clk, NULL, "rngclk"); | ||
159 | |||
160 | clk = clk_reg_prcmu_gate("uiccclk", NULL, PRCMU_UICCCLK, CLK_IS_ROOT); | ||
161 | clk_register_clkdev(clk, NULL, "uicc"); | ||
162 | |||
163 | /* | ||
164 | * FIXME: The MTU clocks might need some kind of "parent muxed join" | ||
165 | * and these have no K-clocks. For now, we ignore the missing | ||
166 | * connection to the corresponding P-clocks, p6_mtu0_clk and | ||
167 | * p6_mtu1_clk. Instead timclk is used which is the valid parent. | ||
168 | */ | ||
169 | clk = clk_reg_prcmu_gate("timclk", NULL, PRCMU_TIMCLK, CLK_IS_ROOT); | ||
170 | clk_register_clkdev(clk, NULL, "mtu0"); | ||
171 | clk_register_clkdev(clk, NULL, "mtu1"); | ||
172 | |||
173 | clk = clk_reg_prcmu_gate("sdmmcclk", NULL, PRCMU_SDMMCCLK, CLK_IS_ROOT); | ||
174 | clk_register_clkdev(clk, NULL, "sdmmc"); | ||
175 | |||
176 | |||
177 | clk = clk_reg_prcmu_scalable("dsi_pll", "hdmiclk", | ||
178 | PRCMU_PLLDSI, 0, CLK_SET_RATE_GATE); | ||
179 | clk_register_clkdev(clk, "dsihs2", "mcde"); | ||
180 | clk_register_clkdev(clk, "dsihs2", "dsilink.2"); | ||
181 | |||
182 | |||
183 | clk = clk_reg_prcmu_scalable("dsi0clk", "dsi_pll", | ||
184 | PRCMU_DSI0CLK, 0, CLK_SET_RATE_GATE); | ||
185 | clk_register_clkdev(clk, "dsihs0", "mcde"); | ||
186 | clk_register_clkdev(clk, "dsihs0", "dsilink.0"); | ||
187 | |||
188 | clk = clk_reg_prcmu_scalable("dsi1clk", "dsi_pll", | ||
189 | PRCMU_DSI1CLK, 0, CLK_SET_RATE_GATE); | ||
190 | clk_register_clkdev(clk, "dsihs1", "mcde"); | ||
191 | clk_register_clkdev(clk, "dsihs1", "dsilink.1"); | ||
192 | |||
193 | clk = clk_reg_prcmu_scalable("dsi0escclk", "tvclk", | ||
194 | PRCMU_DSI0ESCCLK, 0, CLK_SET_RATE_GATE); | ||
195 | clk_register_clkdev(clk, "dsilp0", "dsilink.0"); | ||
196 | clk_register_clkdev(clk, "dsilp0", "mcde"); | ||
197 | |||
198 | clk = clk_reg_prcmu_scalable("dsi1escclk", "tvclk", | ||
199 | PRCMU_DSI1ESCCLK, 0, CLK_SET_RATE_GATE); | ||
200 | clk_register_clkdev(clk, "dsilp1", "dsilink.1"); | ||
201 | clk_register_clkdev(clk, "dsilp1", "mcde"); | ||
202 | |||
203 | clk = clk_reg_prcmu_scalable("dsi2escclk", "tvclk", | ||
204 | PRCMU_DSI2ESCCLK, 0, CLK_SET_RATE_GATE); | ||
205 | clk_register_clkdev(clk, "dsilp2", "dsilink.2"); | ||
206 | clk_register_clkdev(clk, "dsilp2", "mcde"); | ||
207 | |||
208 | clk = clk_reg_prcmu_rate("smp_twd", NULL, PRCMU_ARMSS, | ||
209 | CLK_IS_ROOT|CLK_GET_RATE_NOCACHE| | ||
210 | CLK_IGNORE_UNUSED); | ||
211 | clk_register_clkdev(clk, NULL, "smp_twd"); | ||
212 | |||
213 | /* | ||
214 | * FIXME: Add special handled PRCMU clocks here: | ||
215 | * 1. clk_arm, use PRCMU_ARMCLK. | ||
216 | * 2. clkout0yuv, use PRCMU as parent + need regulator + pinctrl. | ||
217 | * 3. ab9540_clkout1yuv, see clkout0yuv | ||
218 | */ | ||
219 | |||
220 | /* PRCC P-clocks */ | ||
221 | clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", U8500_CLKRST1_BASE, | ||
222 | BIT(0), 0); | ||
223 | clk_register_clkdev(clk, "apb_pclk", "uart0"); | ||
224 | |||
225 | clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", U8500_CLKRST1_BASE, | ||
226 | BIT(1), 0); | ||
227 | clk_register_clkdev(clk, "apb_pclk", "uart1"); | ||
228 | |||
229 | clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", U8500_CLKRST1_BASE, | ||
230 | BIT(2), 0); | ||
231 | clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", U8500_CLKRST1_BASE, | ||
232 | BIT(3), 0); | ||
233 | clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", U8500_CLKRST1_BASE, | ||
234 | BIT(4), 0); | ||
235 | |||
236 | clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", U8500_CLKRST1_BASE, | ||
237 | BIT(5), 0); | ||
238 | clk_register_clkdev(clk, "apb_pclk", "sdi0"); | ||
239 | |||
240 | clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", U8500_CLKRST1_BASE, | ||
241 | BIT(6), 0); | ||
242 | |||
243 | clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", U8500_CLKRST1_BASE, | ||
244 | BIT(7), 0); | ||
245 | clk_register_clkdev(clk, NULL, "spi3"); | ||
246 | |||
247 | clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", U8500_CLKRST1_BASE, | ||
248 | BIT(8), 0); | ||
249 | |||
250 | clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", U8500_CLKRST1_BASE, | ||
251 | BIT(9), 0); | ||
252 | clk_register_clkdev(clk, NULL, "gpio.0"); | ||
253 | clk_register_clkdev(clk, NULL, "gpio.1"); | ||
254 | clk_register_clkdev(clk, NULL, "gpioblock0"); | ||
255 | |||
256 | clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", U8500_CLKRST1_BASE, | ||
257 | BIT(10), 0); | ||
258 | clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", U8500_CLKRST1_BASE, | ||
259 | BIT(11), 0); | ||
260 | |||
261 | clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", U8500_CLKRST2_BASE, | ||
262 | BIT(0), 0); | ||
263 | |||
264 | clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", U8500_CLKRST2_BASE, | ||
265 | BIT(1), 0); | ||
266 | clk_register_clkdev(clk, NULL, "spi2"); | ||
267 | |||
268 | clk = clk_reg_prcc_pclk("p2_pclk2", "per2clk", U8500_CLKRST2_BASE, | ||
269 | BIT(2), 0); | ||
270 | clk_register_clkdev(clk, NULL, "spi1"); | ||
271 | |||
272 | clk = clk_reg_prcc_pclk("p2_pclk3", "per2clk", U8500_CLKRST2_BASE, | ||
273 | BIT(3), 0); | ||
274 | clk_register_clkdev(clk, NULL, "pwl"); | ||
275 | |||
276 | clk = clk_reg_prcc_pclk("p2_pclk4", "per2clk", U8500_CLKRST2_BASE, | ||
277 | BIT(4), 0); | ||
278 | clk_register_clkdev(clk, "apb_pclk", "sdi4"); | ||
279 | |||
280 | clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", U8500_CLKRST2_BASE, | ||
281 | BIT(5), 0); | ||
282 | |||
283 | clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", U8500_CLKRST2_BASE, | ||
284 | BIT(6), 0); | ||
285 | clk_register_clkdev(clk, "apb_pclk", "sdi1"); | ||
286 | |||
287 | |||
288 | clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", U8500_CLKRST2_BASE, | ||
289 | BIT(7), 0); | ||
290 | clk_register_clkdev(clk, "apb_pclk", "sdi3"); | ||
291 | |||
292 | clk = clk_reg_prcc_pclk("p2_pclk8", "per2clk", U8500_CLKRST2_BASE, | ||
293 | BIT(8), 0); | ||
294 | clk_register_clkdev(clk, NULL, "spi0"); | ||
295 | |||
296 | clk = clk_reg_prcc_pclk("p2_pclk9", "per2clk", U8500_CLKRST2_BASE, | ||
297 | BIT(9), 0); | ||
298 | clk_register_clkdev(clk, "hsir_hclk", "ste_hsi.0"); | ||
299 | |||
300 | clk = clk_reg_prcc_pclk("p2_pclk10", "per2clk", U8500_CLKRST2_BASE, | ||
301 | BIT(10), 0); | ||
302 | clk_register_clkdev(clk, "hsit_hclk", "ste_hsi.0"); | ||
303 | |||
304 | clk = clk_reg_prcc_pclk("p2_pclk11", "per2clk", U8500_CLKRST2_BASE, | ||
305 | BIT(11), 0); | ||
306 | clk_register_clkdev(clk, NULL, "gpio.6"); | ||
307 | clk_register_clkdev(clk, NULL, "gpio.7"); | ||
308 | clk_register_clkdev(clk, NULL, "gpioblock1"); | ||
309 | |||
310 | clk = clk_reg_prcc_pclk("p2_pclk12", "per2clk", U8500_CLKRST2_BASE, | ||
311 | BIT(11), 0); | ||
312 | |||
313 | clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", U8500_CLKRST3_BASE, | ||
314 | BIT(0), 0); | ||
315 | clk_register_clkdev(clk, NULL, "fsmc"); | ||
316 | |||
317 | clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", U8500_CLKRST3_BASE, | ||
318 | BIT(1), 0); | ||
319 | clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", U8500_CLKRST3_BASE, | ||
320 | BIT(2), 0); | ||
321 | clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", U8500_CLKRST3_BASE, | ||
322 | BIT(3), 0); | ||
323 | |||
324 | clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", U8500_CLKRST3_BASE, | ||
325 | BIT(4), 0); | ||
326 | clk_register_clkdev(clk, "apb_pclk", "sdi2"); | ||
327 | |||
328 | clk = clk_reg_prcc_pclk("p3_pclk5", "per3clk", U8500_CLKRST3_BASE, | ||
329 | BIT(5), 0); | ||
330 | |||
331 | clk = clk_reg_prcc_pclk("p3_pclk6", "per3clk", U8500_CLKRST3_BASE, | ||
332 | BIT(6), 0); | ||
333 | clk_register_clkdev(clk, "apb_pclk", "uart2"); | ||
334 | |||
335 | clk = clk_reg_prcc_pclk("p3_pclk7", "per3clk", U8500_CLKRST3_BASE, | ||
336 | BIT(7), 0); | ||
337 | clk_register_clkdev(clk, "apb_pclk", "sdi5"); | ||
338 | |||
339 | clk = clk_reg_prcc_pclk("p3_pclk8", "per3clk", U8500_CLKRST3_BASE, | ||
340 | BIT(8), 0); | ||
341 | clk_register_clkdev(clk, NULL, "gpio.2"); | ||
342 | clk_register_clkdev(clk, NULL, "gpio.3"); | ||
343 | clk_register_clkdev(clk, NULL, "gpio.4"); | ||
344 | clk_register_clkdev(clk, NULL, "gpio.5"); | ||
345 | clk_register_clkdev(clk, NULL, "gpioblock2"); | ||
346 | |||
347 | clk = clk_reg_prcc_pclk("p5_pclk0", "per5clk", U8500_CLKRST5_BASE, | ||
348 | BIT(0), 0); | ||
349 | clk_register_clkdev(clk, "usb", "musb-ux500.0"); | ||
350 | |||
351 | clk = clk_reg_prcc_pclk("p5_pclk1", "per5clk", U8500_CLKRST5_BASE, | ||
352 | BIT(1), 0); | ||
353 | clk_register_clkdev(clk, NULL, "gpio.8"); | ||
354 | clk_register_clkdev(clk, NULL, "gpioblock3"); | ||
355 | |||
356 | clk = clk_reg_prcc_pclk("p6_pclk0", "per6clk", U8500_CLKRST6_BASE, | ||
357 | BIT(0), 0); | ||
358 | |||
359 | clk = clk_reg_prcc_pclk("p6_pclk1", "per6clk", U8500_CLKRST6_BASE, | ||
360 | BIT(1), 0); | ||
361 | clk_register_clkdev(clk, NULL, "cryp0"); | ||
362 | clk_register_clkdev(clk, NULL, "cryp1"); | ||
363 | |||
364 | clk = clk_reg_prcc_pclk("p6_pclk2", "per6clk", U8500_CLKRST6_BASE, | ||
365 | BIT(2), 0); | ||
366 | clk_register_clkdev(clk, NULL, "hash0"); | ||
367 | |||
368 | clk = clk_reg_prcc_pclk("p6_pclk3", "per6clk", U8500_CLKRST6_BASE, | ||
369 | BIT(3), 0); | ||
370 | clk_register_clkdev(clk, NULL, "pka"); | ||
371 | |||
372 | clk = clk_reg_prcc_pclk("p6_pclk4", "per6clk", U8500_CLKRST6_BASE, | ||
373 | BIT(4), 0); | ||
374 | clk_register_clkdev(clk, NULL, "hash1"); | ||
375 | |||
376 | clk = clk_reg_prcc_pclk("p6_pclk5", "per6clk", U8500_CLKRST6_BASE, | ||
377 | BIT(5), 0); | ||
378 | clk_register_clkdev(clk, NULL, "cfgreg"); | ||
379 | |||
380 | clk = clk_reg_prcc_pclk("p6_pclk6", "per6clk", U8500_CLKRST6_BASE, | ||
381 | BIT(6), 0); | ||
382 | clk = clk_reg_prcc_pclk("p6_pclk7", "per6clk", U8500_CLKRST6_BASE, | ||
383 | BIT(7), 0); | ||
384 | |||
385 | /* PRCC K-clocks | ||
386 | * | ||
387 | * FIXME: Some drivers requires PERPIH[n| to be automatically enabled | ||
388 | * by enabling just the K-clock, even if it is not a valid parent to | ||
389 | * the K-clock. Until drivers get fixed we might need some kind of | ||
390 | * "parent muxed join". | ||
391 | */ | ||
392 | |||
393 | /* Periph1 */ | ||
394 | clk = clk_reg_prcc_kclk("p1_uart0_kclk", "uartclk", | ||
395 | U8500_CLKRST1_BASE, BIT(0), CLK_SET_RATE_GATE); | ||
396 | clk_register_clkdev(clk, NULL, "uart0"); | ||
397 | |||
398 | clk = clk_reg_prcc_kclk("p1_uart1_kclk", "uartclk", | ||
399 | U8500_CLKRST1_BASE, BIT(1), CLK_SET_RATE_GATE); | ||
400 | clk_register_clkdev(clk, NULL, "uart1"); | ||
401 | |||
402 | clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk", | ||
403 | U8500_CLKRST1_BASE, BIT(2), CLK_SET_RATE_GATE); | ||
404 | clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk", | ||
405 | U8500_CLKRST1_BASE, BIT(3), CLK_SET_RATE_GATE); | ||
406 | clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk", | ||
407 | U8500_CLKRST1_BASE, BIT(4), CLK_SET_RATE_GATE); | ||
408 | |||
409 | clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk", | ||
410 | U8500_CLKRST1_BASE, BIT(5), CLK_SET_RATE_GATE); | ||
411 | clk_register_clkdev(clk, NULL, "sdi0"); | ||
412 | |||
413 | clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk", | ||
414 | U8500_CLKRST1_BASE, BIT(6), CLK_SET_RATE_GATE); | ||
415 | clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk", | ||
416 | U8500_CLKRST1_BASE, BIT(3), CLK_SET_RATE_GATE); | ||
417 | /* FIXME: Redefinition of BIT(3). */ | ||
418 | clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk", | ||
419 | U8500_CLKRST1_BASE, BIT(9), CLK_SET_RATE_GATE); | ||
420 | clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk", | ||
421 | U8500_CLKRST1_BASE, BIT(10), CLK_SET_RATE_GATE); | ||
422 | |||
423 | /* Periph2 */ | ||
424 | clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk", | ||
425 | U8500_CLKRST2_BASE, BIT(0), CLK_SET_RATE_GATE); | ||
426 | |||
427 | clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk", | ||
428 | U8500_CLKRST2_BASE, BIT(2), CLK_SET_RATE_GATE); | ||
429 | clk_register_clkdev(clk, NULL, "sdi4"); | ||
430 | |||
431 | clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk", | ||
432 | U8500_CLKRST2_BASE, BIT(3), CLK_SET_RATE_GATE); | ||
433 | |||
434 | clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk", | ||
435 | U8500_CLKRST2_BASE, BIT(4), CLK_SET_RATE_GATE); | ||
436 | clk_register_clkdev(clk, NULL, "sdi1"); | ||
437 | |||
438 | clk = clk_reg_prcc_kclk("p2_sdi3_kclk", "sdmmcclk", | ||
439 | U8500_CLKRST2_BASE, BIT(5), CLK_SET_RATE_GATE); | ||
440 | clk_register_clkdev(clk, NULL, "sdi3"); | ||
441 | |||
442 | /* Note that rate is received from parent. */ | ||
443 | clk = clk_reg_prcc_kclk("p2_ssirx_kclk", "hsirxclk", | ||
444 | U8500_CLKRST2_BASE, BIT(6), | ||
445 | CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT); | ||
446 | clk = clk_reg_prcc_kclk("p2_ssitx_kclk", "hsitxclk", | ||
447 | U8500_CLKRST2_BASE, BIT(7), | ||
448 | CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT); | ||
449 | |||
450 | /* Periph3 */ | ||
451 | clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk", | ||
452 | U8500_CLKRST3_BASE, BIT(1), CLK_SET_RATE_GATE); | ||
453 | clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk", | ||
454 | U8500_CLKRST3_BASE, BIT(2), CLK_SET_RATE_GATE); | ||
455 | clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk", | ||
456 | U8500_CLKRST3_BASE, BIT(3), CLK_SET_RATE_GATE); | ||
457 | |||
458 | clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk", | ||
459 | U8500_CLKRST3_BASE, BIT(4), CLK_SET_RATE_GATE); | ||
460 | clk_register_clkdev(clk, NULL, "sdi2"); | ||
461 | |||
462 | clk = clk_reg_prcc_kclk("p3_ske_kclk", "rtc32k", | ||
463 | U8500_CLKRST3_BASE, BIT(5), CLK_SET_RATE_GATE); | ||
464 | |||
465 | clk = clk_reg_prcc_kclk("p3_uart2_kclk", "uartclk", | ||
466 | U8500_CLKRST3_BASE, BIT(6), CLK_SET_RATE_GATE); | ||
467 | clk_register_clkdev(clk, NULL, "uart2"); | ||
468 | |||
469 | clk = clk_reg_prcc_kclk("p3_sdi5_kclk", "sdmmcclk", | ||
470 | U8500_CLKRST3_BASE, BIT(7), CLK_SET_RATE_GATE); | ||
471 | clk_register_clkdev(clk, NULL, "sdi5"); | ||
472 | |||
473 | /* Periph6 */ | ||
474 | clk = clk_reg_prcc_kclk("p3_rng_kclk", "rngclk", | ||
475 | U8500_CLKRST6_BASE, BIT(0), CLK_SET_RATE_GATE); | ||
476 | |||
477 | } | ||
diff --git a/drivers/clk/ux500/u8540_clk.c b/drivers/clk/ux500/u8540_clk.c new file mode 100644 index 000000000000..10adfd2ead21 --- /dev/null +++ b/drivers/clk/ux500/u8540_clk.c | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Clock definitions for u8540 platform. | ||
3 | * | ||
4 | * Copyright (C) 2012 ST-Ericsson SA | ||
5 | * Author: Ulf Hansson <ulf.hansson@linaro.org> | ||
6 | * | ||
7 | * License terms: GNU General Public License (GPL) version 2 | ||
8 | */ | ||
9 | |||
10 | #include <linux/clk.h> | ||
11 | #include <linux/clkdev.h> | ||
12 | #include <linux/clk-provider.h> | ||
13 | #include <linux/mfd/dbx500-prcmu.h> | ||
14 | #include <linux/platform_data/clk-ux500.h> | ||
15 | |||
16 | #include "clk.h" | ||
17 | |||
18 | void u8540_clk_init(void) | ||
19 | { | ||
20 | /* register clocks here */ | ||
21 | } | ||
diff --git a/drivers/clk/ux500/u9540_clk.c b/drivers/clk/ux500/u9540_clk.c new file mode 100644 index 000000000000..dbc0191e16c8 --- /dev/null +++ b/drivers/clk/ux500/u9540_clk.c | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Clock definitions for u9540 platform. | ||
3 | * | ||
4 | * Copyright (C) 2012 ST-Ericsson SA | ||
5 | * Author: Ulf Hansson <ulf.hansson@linaro.org> | ||
6 | * | ||
7 | * License terms: GNU General Public License (GPL) version 2 | ||
8 | */ | ||
9 | |||
10 | #include <linux/clk.h> | ||
11 | #include <linux/clkdev.h> | ||
12 | #include <linux/clk-provider.h> | ||
13 | #include <linux/mfd/dbx500-prcmu.h> | ||
14 | #include <linux/platform_data/clk-ux500.h> | ||
15 | |||
16 | #include "clk.h" | ||
17 | |||
18 | void u9540_clk_init(void) | ||
19 | { | ||
20 | /* register clocks here */ | ||
21 | } | ||
diff --git a/drivers/clk/versatile/Makefile b/drivers/clk/versatile/Makefile index 50cf6a2ee693..c0a0f6478798 100644 --- a/drivers/clk/versatile/Makefile +++ b/drivers/clk/versatile/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # Makefile for Versatile-specific clocks | 1 | # Makefile for Versatile-specific clocks |
2 | obj-$(CONFIG_ICST) += clk-icst.o | 2 | obj-$(CONFIG_ICST) += clk-icst.o |
3 | obj-$(CONFIG_ARCH_INTEGRATOR) += clk-integrator.o | 3 | obj-$(CONFIG_ARCH_INTEGRATOR) += clk-integrator.o |
4 | obj-$(CONFIG_ARCH_REALVIEW) += clk-realview.o | ||
diff --git a/drivers/clk/versatile/clk-realview.c b/drivers/clk/versatile/clk-realview.c new file mode 100644 index 000000000000..e21a99cef378 --- /dev/null +++ b/drivers/clk/versatile/clk-realview.c | |||
@@ -0,0 +1,114 @@ | |||
1 | #include <linux/clk.h> | ||
2 | #include <linux/clkdev.h> | ||
3 | #include <linux/err.h> | ||
4 | #include <linux/io.h> | ||
5 | #include <linux/clk-provider.h> | ||
6 | |||
7 | #include <mach/hardware.h> | ||
8 | #include <mach/platform.h> | ||
9 | |||
10 | #include "clk-icst.h" | ||
11 | |||
12 | /* | ||
13 | * Implementation of the ARM RealView clock trees. | ||
14 | */ | ||
15 | |||
16 | static void __iomem *sys_lock; | ||
17 | static void __iomem *sys_vcoreg; | ||
18 | |||
19 | /** | ||
20 | * realview_oscvco_get() - get ICST OSC settings for the RealView | ||
21 | */ | ||
22 | static struct icst_vco realview_oscvco_get(void) | ||
23 | { | ||
24 | u32 val; | ||
25 | struct icst_vco vco; | ||
26 | |||
27 | val = readl(sys_vcoreg); | ||
28 | vco.v = val & 0x1ff; | ||
29 | vco.r = (val >> 9) & 0x7f; | ||
30 | vco.s = (val >> 16) & 03; | ||
31 | return vco; | ||
32 | } | ||
33 | |||
34 | static void realview_oscvco_set(struct icst_vco vco) | ||
35 | { | ||
36 | u32 val; | ||
37 | |||
38 | val = readl(sys_vcoreg) & ~0x7ffff; | ||
39 | val |= vco.v | (vco.r << 9) | (vco.s << 16); | ||
40 | |||
41 | /* This magic unlocks the CM VCO so it can be controlled */ | ||
42 | writel(0xa05f, sys_lock); | ||
43 | writel(val, sys_vcoreg); | ||
44 | /* This locks the CM again */ | ||
45 | writel(0, sys_lock); | ||
46 | } | ||
47 | |||
48 | static const struct icst_params realview_oscvco_params = { | ||
49 | .ref = 24000000, | ||
50 | .vco_max = ICST307_VCO_MAX, | ||
51 | .vco_min = ICST307_VCO_MIN, | ||
52 | .vd_min = 4 + 8, | ||
53 | .vd_max = 511 + 8, | ||
54 | .rd_min = 1 + 2, | ||
55 | .rd_max = 127 + 2, | ||
56 | .s2div = icst307_s2div, | ||
57 | .idx2s = icst307_idx2s, | ||
58 | }; | ||
59 | |||
60 | static const struct clk_icst_desc __initdata realview_icst_desc = { | ||
61 | .params = &realview_oscvco_params, | ||
62 | .getvco = realview_oscvco_get, | ||
63 | .setvco = realview_oscvco_set, | ||
64 | }; | ||
65 | |||
66 | /* | ||
67 | * realview_clk_init() - set up the RealView clock tree | ||
68 | */ | ||
69 | void __init realview_clk_init(void __iomem *sysbase, bool is_pb1176) | ||
70 | { | ||
71 | struct clk *clk; | ||
72 | |||
73 | sys_lock = sysbase + REALVIEW_SYS_LOCK_OFFSET; | ||
74 | if (is_pb1176) | ||
75 | sys_vcoreg = sysbase + REALVIEW_SYS_OSC0_OFFSET; | ||
76 | else | ||
77 | sys_vcoreg = sysbase + REALVIEW_SYS_OSC4_OFFSET; | ||
78 | |||
79 | |||
80 | /* APB clock dummy */ | ||
81 | clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT, 0); | ||
82 | clk_register_clkdev(clk, "apb_pclk", NULL); | ||
83 | |||
84 | /* 24 MHz clock */ | ||
85 | clk = clk_register_fixed_rate(NULL, "clk24mhz", NULL, CLK_IS_ROOT, | ||
86 | 24000000); | ||
87 | clk_register_clkdev(clk, NULL, "dev:uart0"); | ||
88 | clk_register_clkdev(clk, NULL, "dev:uart1"); | ||
89 | clk_register_clkdev(clk, NULL, "dev:uart2"); | ||
90 | clk_register_clkdev(clk, NULL, "fpga:kmi0"); | ||
91 | clk_register_clkdev(clk, NULL, "fpga:kmi1"); | ||
92 | clk_register_clkdev(clk, NULL, "fpga:mmc0"); | ||
93 | clk_register_clkdev(clk, NULL, "dev:ssp0"); | ||
94 | if (is_pb1176) { | ||
95 | /* | ||
96 | * UART3 is on the dev chip in PB1176 | ||
97 | * UART4 only exists in PB1176 | ||
98 | */ | ||
99 | clk_register_clkdev(clk, NULL, "dev:uart3"); | ||
100 | clk_register_clkdev(clk, NULL, "dev:uart4"); | ||
101 | } else | ||
102 | clk_register_clkdev(clk, NULL, "fpga:uart3"); | ||
103 | |||
104 | |||
105 | /* 1 MHz clock */ | ||
106 | clk = clk_register_fixed_rate(NULL, "clk1mhz", NULL, CLK_IS_ROOT, | ||
107 | 1000000); | ||
108 | clk_register_clkdev(clk, NULL, "sp804"); | ||
109 | |||
110 | /* ICST VCO clock */ | ||
111 | clk = icst_clk_register(NULL, &realview_icst_desc); | ||
112 | clk_register_clkdev(clk, NULL, "dev:clcd"); | ||
113 | clk_register_clkdev(clk, NULL, "issp:clcd"); | ||
114 | } | ||
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index b65d0c56ab35..d496a55f6bb0 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile | |||
@@ -13,3 +13,4 @@ obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o | |||
13 | obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o | 13 | obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o |
14 | obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o | 14 | obj-$(CONFIG_CLKSRC_DBX500_PRCMU) += clksrc-dbx500-prcmu.o |
15 | obj-$(CONFIG_ARMADA_370_XP_TIMER) += time-armada-370-xp.o | 15 | obj-$(CONFIG_ARMADA_370_XP_TIMER) += time-armada-370-xp.o |
16 | obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o | ||
diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c new file mode 100644 index 000000000000..bc19f12c20ce --- /dev/null +++ b/drivers/clocksource/bcm2835_timer.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Simon Arlott | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | |||
19 | #include <linux/bcm2835_timer.h> | ||
20 | #include <linux/bitops.h> | ||
21 | #include <linux/clockchips.h> | ||
22 | #include <linux/clocksource.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/irqreturn.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/of_address.h> | ||
28 | #include <linux/of_irq.h> | ||
29 | #include <linux/of_platform.h> | ||
30 | #include <linux/slab.h> | ||
31 | #include <linux/string.h> | ||
32 | |||
33 | #include <asm/sched_clock.h> | ||
34 | #include <asm/irq.h> | ||
35 | |||
36 | #define REG_CONTROL 0x00 | ||
37 | #define REG_COUNTER_LO 0x04 | ||
38 | #define REG_COUNTER_HI 0x08 | ||
39 | #define REG_COMPARE(n) (0x0c + (n) * 4) | ||
40 | #define MAX_TIMER 3 | ||
41 | #define DEFAULT_TIMER 3 | ||
42 | |||
43 | struct bcm2835_timer { | ||
44 | void __iomem *control; | ||
45 | void __iomem *compare; | ||
46 | int match_mask; | ||
47 | struct clock_event_device evt; | ||
48 | struct irqaction act; | ||
49 | }; | ||
50 | |||
51 | static void __iomem *system_clock __read_mostly; | ||
52 | |||
53 | static u32 notrace bcm2835_sched_read(void) | ||
54 | { | ||
55 | return readl_relaxed(system_clock); | ||
56 | } | ||
57 | |||
58 | static void bcm2835_time_set_mode(enum clock_event_mode mode, | ||
59 | struct clock_event_device *evt_dev) | ||
60 | { | ||
61 | switch (mode) { | ||
62 | case CLOCK_EVT_MODE_ONESHOT: | ||
63 | case CLOCK_EVT_MODE_UNUSED: | ||
64 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
65 | case CLOCK_EVT_MODE_RESUME: | ||
66 | break; | ||
67 | default: | ||
68 | WARN(1, "%s: unhandled event mode %d\n", __func__, mode); | ||
69 | break; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | static int bcm2835_time_set_next_event(unsigned long event, | ||
74 | struct clock_event_device *evt_dev) | ||
75 | { | ||
76 | struct bcm2835_timer *timer = container_of(evt_dev, | ||
77 | struct bcm2835_timer, evt); | ||
78 | writel_relaxed(readl_relaxed(system_clock) + event, | ||
79 | timer->compare); | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static irqreturn_t bcm2835_time_interrupt(int irq, void *dev_id) | ||
84 | { | ||
85 | struct bcm2835_timer *timer = dev_id; | ||
86 | void (*event_handler)(struct clock_event_device *); | ||
87 | if (readl_relaxed(timer->control) & timer->match_mask) { | ||
88 | writel_relaxed(timer->match_mask, timer->control); | ||
89 | |||
90 | event_handler = ACCESS_ONCE(timer->evt.event_handler); | ||
91 | if (event_handler) | ||
92 | event_handler(&timer->evt); | ||
93 | return IRQ_HANDLED; | ||
94 | } else { | ||
95 | return IRQ_NONE; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | static struct of_device_id bcm2835_time_match[] __initconst = { | ||
100 | { .compatible = "brcm,bcm2835-system-timer" }, | ||
101 | {} | ||
102 | }; | ||
103 | |||
104 | static void __init bcm2835_time_init(void) | ||
105 | { | ||
106 | struct device_node *node; | ||
107 | void __iomem *base; | ||
108 | u32 freq; | ||
109 | int irq; | ||
110 | struct bcm2835_timer *timer; | ||
111 | |||
112 | node = of_find_matching_node(NULL, bcm2835_time_match); | ||
113 | if (!node) | ||
114 | panic("No bcm2835 timer node"); | ||
115 | |||
116 | base = of_iomap(node, 0); | ||
117 | if (!base) | ||
118 | panic("Can't remap registers"); | ||
119 | |||
120 | if (of_property_read_u32(node, "clock-frequency", &freq)) | ||
121 | panic("Can't read clock-frequency"); | ||
122 | |||
123 | system_clock = base + REG_COUNTER_LO; | ||
124 | setup_sched_clock(bcm2835_sched_read, 32, freq); | ||
125 | |||
126 | clocksource_mmio_init(base + REG_COUNTER_LO, node->name, | ||
127 | freq, 300, 32, clocksource_mmio_readl_up); | ||
128 | |||
129 | irq = irq_of_parse_and_map(node, DEFAULT_TIMER); | ||
130 | if (irq <= 0) | ||
131 | panic("Can't parse IRQ"); | ||
132 | |||
133 | timer = kzalloc(sizeof(*timer), GFP_KERNEL); | ||
134 | if (!timer) | ||
135 | panic("Can't allocate timer struct\n"); | ||
136 | |||
137 | timer->control = base + REG_CONTROL; | ||
138 | timer->compare = base + REG_COMPARE(DEFAULT_TIMER); | ||
139 | timer->match_mask = BIT(DEFAULT_TIMER); | ||
140 | timer->evt.name = node->name; | ||
141 | timer->evt.rating = 300; | ||
142 | timer->evt.features = CLOCK_EVT_FEAT_ONESHOT; | ||
143 | timer->evt.set_mode = bcm2835_time_set_mode; | ||
144 | timer->evt.set_next_event = bcm2835_time_set_next_event; | ||
145 | timer->evt.cpumask = cpumask_of(0); | ||
146 | timer->act.name = node->name; | ||
147 | timer->act.flags = IRQF_TIMER | IRQF_SHARED; | ||
148 | timer->act.dev_id = timer; | ||
149 | timer->act.handler = bcm2835_time_interrupt; | ||
150 | |||
151 | if (setup_irq(irq, &timer->act)) | ||
152 | panic("Can't set up timer IRQ\n"); | ||
153 | |||
154 | clockevents_config_and_register(&timer->evt, freq, 0xf, 0xffffffff); | ||
155 | |||
156 | pr_info("bcm2835: system timer (irq = %d)\n", irq); | ||
157 | } | ||
158 | |||
159 | struct sys_timer bcm2835_timer = { | ||
160 | .init = bcm2835_time_init, | ||
161 | }; | ||
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index 21c1a87032b7..24ccae453e79 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c | |||
@@ -19,6 +19,9 @@ | |||
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <crypto/internal/hash.h> | 20 | #include <crypto/internal/hash.h> |
21 | #include <crypto/sha.h> | 21 | #include <crypto/sha.h> |
22 | #include <linux/of.h> | ||
23 | #include <linux/of_platform.h> | ||
24 | #include <linux/of_irq.h> | ||
22 | 25 | ||
23 | #include "mv_cesa.h" | 26 | #include "mv_cesa.h" |
24 | 27 | ||
@@ -1062,7 +1065,10 @@ static int mv_probe(struct platform_device *pdev) | |||
1062 | goto err_unmap_reg; | 1065 | goto err_unmap_reg; |
1063 | } | 1066 | } |
1064 | 1067 | ||
1065 | irq = platform_get_irq(pdev, 0); | 1068 | if (pdev->dev.of_node) |
1069 | irq = irq_of_parse_and_map(pdev->dev.of_node, 0); | ||
1070 | else | ||
1071 | irq = platform_get_irq(pdev, 0); | ||
1066 | if (irq < 0 || irq == NO_IRQ) { | 1072 | if (irq < 0 || irq == NO_IRQ) { |
1067 | ret = irq; | 1073 | ret = irq; |
1068 | goto err_unmap_sram; | 1074 | goto err_unmap_sram; |
@@ -1170,12 +1176,19 @@ static int mv_remove(struct platform_device *pdev) | |||
1170 | return 0; | 1176 | return 0; |
1171 | } | 1177 | } |
1172 | 1178 | ||
1179 | static const struct of_device_id mv_cesa_of_match_table[] = { | ||
1180 | { .compatible = "marvell,orion-crypto", }, | ||
1181 | {} | ||
1182 | }; | ||
1183 | MODULE_DEVICE_TABLE(of, mv_cesa_of_match_table); | ||
1184 | |||
1173 | static struct platform_driver marvell_crypto = { | 1185 | static struct platform_driver marvell_crypto = { |
1174 | .probe = mv_probe, | 1186 | .probe = mv_probe, |
1175 | .remove = mv_remove, | 1187 | .remove = __devexit_p(mv_remove), |
1176 | .driver = { | 1188 | .driver = { |
1177 | .owner = THIS_MODULE, | 1189 | .owner = THIS_MODULE, |
1178 | .name = "mv_crypto", | 1190 | .name = "mv_crypto", |
1191 | .of_match_table = of_match_ptr(mv_cesa_of_match_table), | ||
1179 | }, | 1192 | }, |
1180 | }; | 1193 | }; |
1181 | MODULE_ALIAS("platform:mv_crypto"); | 1194 | MODULE_ALIAS("platform:mv_crypto"); |
diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index 1c307e1b840c..ef17e3871c71 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #include <plat/ste_dma40.h> | 33 | #include <plat/ste_dma40.h> |
34 | 34 | ||
35 | #include <mach/crypto-ux500.h> | 35 | #include <linux/platform_data/crypto-ux500.h> |
36 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
37 | 37 | ||
38 | #include "cryp_p.h" | 38 | #include "cryp_p.h" |
diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 08d5032cb564..08765072a2b3 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <crypto/scatterwalk.h> | 31 | #include <crypto/scatterwalk.h> |
32 | #include <crypto/algapi.h> | 32 | #include <crypto/algapi.h> |
33 | 33 | ||
34 | #include <mach/crypto-ux500.h> | 34 | #include <linux/platform_data/crypto-ux500.h> |
35 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
36 | 36 | ||
37 | #include "hash_alg.h" | 37 | #include "hash_alg.h" |
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h index 8a6c8e8b2940..116e4adffb08 100644 --- a/drivers/dma/at_hdmac_regs.h +++ b/drivers/dma/at_hdmac_regs.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #ifndef AT_HDMAC_REGS_H | 11 | #ifndef AT_HDMAC_REGS_H |
12 | #define AT_HDMAC_REGS_H | 12 | #define AT_HDMAC_REGS_H |
13 | 13 | ||
14 | #include <mach/at_hdmac.h> | 14 | #include <linux/platform_data/dma-atmel.h> |
15 | 15 | ||
16 | #define AT_DMA_MAX_NR_CHANNELS 8 | 16 | #define AT_DMA_MAX_NR_CHANNELS 8 |
17 | 17 | ||
diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index c64917ec313d..4aeaea77f72e 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | 28 | ||
29 | #include <mach/dma.h> | 29 | #include <linux/platform_data/dma-ep93xx.h> |
30 | 30 | ||
31 | #include "dmaengine.h" | 31 | #include "dmaengine.h" |
32 | 32 | ||
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 5084975d793c..b90aaec4ccc4 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | 29 | ||
30 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
31 | #include <mach/dma.h> | 31 | #include <linux/platform_data/dma-imx.h> |
32 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
33 | 33 | ||
34 | #include "dmaengine.h" | 34 | #include "dmaengine.h" |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 1dc2a4ad0026..1b781d6ac425 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -38,8 +38,8 @@ | |||
38 | #include <linux/of_device.h> | 38 | #include <linux/of_device.h> |
39 | 39 | ||
40 | #include <asm/irq.h> | 40 | #include <asm/irq.h> |
41 | #include <mach/sdma.h> | 41 | #include <linux/platform_data/dma-imx-sdma.h> |
42 | #include <mach/dma.h> | 42 | #include <linux/platform_data/dma-imx.h> |
43 | #include <mach/hardware.h> | 43 | #include <mach/hardware.h> |
44 | 44 | ||
45 | #include "dmaengine.h" | 45 | #include "dmaengine.h" |
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index 8a15cf2163dc..07fa48688ba9 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <mach/regs-icu.h> | 21 | #include <mach/regs-icu.h> |
22 | #include <mach/sram.h> | 22 | #include <linux/platform_data/dma-mmp_tdma.h> |
23 | 23 | ||
24 | #include "dmaengine.h" | 24 | #include "dmaengine.h" |
25 | 25 | ||
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 0b12e68bf79c..e362e2b80efb 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/memory.h> | 27 | #include <linux/memory.h> |
28 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
29 | #include <plat/mv_xor.h> | 29 | #include <linux/platform_data/dma-mv_xor.h> |
30 | 30 | ||
31 | #include "dmaengine.h" | 31 | #include "dmaengine.h" |
32 | #include "mv_xor.h" | 32 | #include "mv_xor.h" |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index ba7926f5c099..66a59510887f 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -150,6 +150,12 @@ config GPIO_MSM_V2 | |||
150 | Qualcomm MSM chips. Most of the pins on the MSM can be | 150 | Qualcomm MSM chips. Most of the pins on the MSM can be |
151 | selected for GPIO, and are controlled by this driver. | 151 | selected for GPIO, and are controlled by this driver. |
152 | 152 | ||
153 | config GPIO_MVEBU | ||
154 | def_bool y | ||
155 | depends on ARCH_MVEBU | ||
156 | select GPIO_GENERIC | ||
157 | select GENERIC_IRQ_CHIP | ||
158 | |||
153 | config GPIO_MXC | 159 | config GPIO_MXC |
154 | def_bool y | 160 | def_bool y |
155 | depends on ARCH_MXC | 161 | depends on ARCH_MXC |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 153caceeb053..1a33e6716e10 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -41,6 +41,7 @@ obj-$(CONFIG_GPIO_MPC8XXX) += gpio-mpc8xxx.o | |||
41 | obj-$(CONFIG_GPIO_MSIC) += gpio-msic.o | 41 | obj-$(CONFIG_GPIO_MSIC) += gpio-msic.o |
42 | obj-$(CONFIG_GPIO_MSM_V1) += gpio-msm-v1.o | 42 | obj-$(CONFIG_GPIO_MSM_V1) += gpio-msm-v1.o |
43 | obj-$(CONFIG_GPIO_MSM_V2) += gpio-msm-v2.o | 43 | obj-$(CONFIG_GPIO_MSM_V2) += gpio-msm-v2.o |
44 | obj-$(CONFIG_GPIO_MVEBU) += gpio-mvebu.o | ||
44 | obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o | 45 | obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o |
45 | obj-$(CONFIG_GPIO_MXS) += gpio-mxs.o | 46 | obj-$(CONFIG_GPIO_MXS) += gpio-mxs.o |
46 | obj-$(CONFIG_ARCH_OMAP) += gpio-omap.o | 47 | obj-$(CONFIG_ARCH_OMAP) += gpio-omap.o |
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c new file mode 100644 index 000000000000..902af437eaf2 --- /dev/null +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -0,0 +1,679 @@ | |||
1 | /* | ||
2 | * GPIO driver for Marvell SoCs | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * | ||
6 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
7 | * Andrew Lunn <andrew@lunn.ch> | ||
8 | * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | ||
9 | * | ||
10 | * This file is licensed under the terms of the GNU General Public | ||
11 | * License version 2. This program is licensed "as is" without any | ||
12 | * warranty of any kind, whether express or implied. | ||
13 | * | ||
14 | * This driver is a fairly straightforward GPIO driver for the | ||
15 | * complete family of Marvell EBU SoC platforms (Orion, Dove, | ||
16 | * Kirkwood, Discovery, Armada 370/XP). The only complexity of this | ||
17 | * driver is the different register layout that exists between the | ||
18 | * non-SMP platforms (Orion, Dove, Kirkwood, Armada 370) and the SMP | ||
19 | * platforms (MV78200 from the Discovery family and the Armada | ||
20 | * XP). Therefore, this driver handles three variants of the GPIO | ||
21 | * block: | ||
22 | * - the basic variant, called "orion-gpio", with the simplest | ||
23 | * register set. Used on Orion, Dove, Kirkwoord, Armada 370 and | ||
24 | * non-SMP Discovery systems | ||
25 | * - the mv78200 variant for MV78200 Discovery systems. This variant | ||
26 | * turns the edge mask and level mask registers into CPU0 edge | ||
27 | * mask/level mask registers, and adds CPU1 edge mask/level mask | ||
28 | * registers. | ||
29 | * - the armadaxp variant for Armada XP systems. This variant keeps | ||
30 | * the normal cause/edge mask/level mask registers when the global | ||
31 | * interrupts are used, but adds per-CPU cause/edge mask/level mask | ||
32 | * registers n a separate memory area for the per-CPU GPIO | ||
33 | * interrupts. | ||
34 | */ | ||
35 | |||
36 | #include <linux/module.h> | ||
37 | #include <linux/gpio.h> | ||
38 | #include <linux/irq.h> | ||
39 | #include <linux/slab.h> | ||
40 | #include <linux/irqdomain.h> | ||
41 | #include <linux/io.h> | ||
42 | #include <linux/of_irq.h> | ||
43 | #include <linux/of_device.h> | ||
44 | #include <linux/platform_device.h> | ||
45 | #include <linux/pinctrl/consumer.h> | ||
46 | |||
47 | /* | ||
48 | * GPIO unit register offsets. | ||
49 | */ | ||
50 | #define GPIO_OUT_OFF 0x0000 | ||
51 | #define GPIO_IO_CONF_OFF 0x0004 | ||
52 | #define GPIO_BLINK_EN_OFF 0x0008 | ||
53 | #define GPIO_IN_POL_OFF 0x000c | ||
54 | #define GPIO_DATA_IN_OFF 0x0010 | ||
55 | #define GPIO_EDGE_CAUSE_OFF 0x0014 | ||
56 | #define GPIO_EDGE_MASK_OFF 0x0018 | ||
57 | #define GPIO_LEVEL_MASK_OFF 0x001c | ||
58 | |||
59 | /* The MV78200 has per-CPU registers for edge mask and level mask */ | ||
60 | #define GPIO_EDGE_MASK_MV78200_OFF(cpu) ((cpu) ? 0x30 : 0x18) | ||
61 | #define GPIO_LEVEL_MASK_MV78200_OFF(cpu) ((cpu) ? 0x34 : 0x1C) | ||
62 | |||
63 | /* The Armada XP has per-CPU registers for interrupt cause, interrupt | ||
64 | * mask and interrupt level mask. Those are relative to the | ||
65 | * percpu_membase. */ | ||
66 | #define GPIO_EDGE_CAUSE_ARMADAXP_OFF(cpu) ((cpu) * 0x4) | ||
67 | #define GPIO_EDGE_MASK_ARMADAXP_OFF(cpu) (0x10 + (cpu) * 0x4) | ||
68 | #define GPIO_LEVEL_MASK_ARMADAXP_OFF(cpu) (0x20 + (cpu) * 0x4) | ||
69 | |||
70 | #define MVEBU_GPIO_SOC_VARIANT_ORION 0x1 | ||
71 | #define MVEBU_GPIO_SOC_VARIANT_MV78200 0x2 | ||
72 | #define MVEBU_GPIO_SOC_VARIANT_ARMADAXP 0x3 | ||
73 | |||
74 | #define MVEBU_MAX_GPIO_PER_BANK 32 | ||
75 | |||
76 | struct mvebu_gpio_chip { | ||
77 | struct gpio_chip chip; | ||
78 | spinlock_t lock; | ||
79 | void __iomem *membase; | ||
80 | void __iomem *percpu_membase; | ||
81 | unsigned int irqbase; | ||
82 | struct irq_domain *domain; | ||
83 | int soc_variant; | ||
84 | }; | ||
85 | |||
86 | /* | ||
87 | * Functions returning addresses of individual registers for a given | ||
88 | * GPIO controller. | ||
89 | */ | ||
90 | static inline void __iomem *mvebu_gpioreg_out(struct mvebu_gpio_chip *mvchip) | ||
91 | { | ||
92 | return mvchip->membase + GPIO_OUT_OFF; | ||
93 | } | ||
94 | |||
95 | static inline void __iomem *mvebu_gpioreg_io_conf(struct mvebu_gpio_chip *mvchip) | ||
96 | { | ||
97 | return mvchip->membase + GPIO_IO_CONF_OFF; | ||
98 | } | ||
99 | |||
100 | static inline void __iomem *mvebu_gpioreg_in_pol(struct mvebu_gpio_chip *mvchip) | ||
101 | { | ||
102 | return mvchip->membase + GPIO_IN_POL_OFF; | ||
103 | } | ||
104 | |||
105 | static inline void __iomem *mvebu_gpioreg_data_in(struct mvebu_gpio_chip *mvchip) | ||
106 | { | ||
107 | return mvchip->membase + GPIO_DATA_IN_OFF; | ||
108 | } | ||
109 | |||
110 | static inline void __iomem *mvebu_gpioreg_edge_cause(struct mvebu_gpio_chip *mvchip) | ||
111 | { | ||
112 | int cpu; | ||
113 | |||
114 | switch(mvchip->soc_variant) { | ||
115 | case MVEBU_GPIO_SOC_VARIANT_ORION: | ||
116 | case MVEBU_GPIO_SOC_VARIANT_MV78200: | ||
117 | return mvchip->membase + GPIO_EDGE_CAUSE_OFF; | ||
118 | case MVEBU_GPIO_SOC_VARIANT_ARMADAXP: | ||
119 | cpu = smp_processor_id(); | ||
120 | return mvchip->percpu_membase + GPIO_EDGE_CAUSE_ARMADAXP_OFF(cpu); | ||
121 | default: | ||
122 | BUG(); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | static inline void __iomem *mvebu_gpioreg_edge_mask(struct mvebu_gpio_chip *mvchip) | ||
127 | { | ||
128 | int cpu; | ||
129 | |||
130 | switch(mvchip->soc_variant) { | ||
131 | case MVEBU_GPIO_SOC_VARIANT_ORION: | ||
132 | return mvchip->membase + GPIO_EDGE_MASK_OFF; | ||
133 | case MVEBU_GPIO_SOC_VARIANT_MV78200: | ||
134 | cpu = smp_processor_id(); | ||
135 | return mvchip->membase + GPIO_EDGE_MASK_MV78200_OFF(cpu); | ||
136 | case MVEBU_GPIO_SOC_VARIANT_ARMADAXP: | ||
137 | cpu = smp_processor_id(); | ||
138 | return mvchip->percpu_membase + GPIO_EDGE_MASK_ARMADAXP_OFF(cpu); | ||
139 | default: | ||
140 | BUG(); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | static void __iomem *mvebu_gpioreg_level_mask(struct mvebu_gpio_chip *mvchip) | ||
145 | { | ||
146 | int cpu; | ||
147 | |||
148 | switch(mvchip->soc_variant) { | ||
149 | case MVEBU_GPIO_SOC_VARIANT_ORION: | ||
150 | return mvchip->membase + GPIO_LEVEL_MASK_OFF; | ||
151 | case MVEBU_GPIO_SOC_VARIANT_MV78200: | ||
152 | cpu = smp_processor_id(); | ||
153 | return mvchip->membase + GPIO_LEVEL_MASK_MV78200_OFF(cpu); | ||
154 | case MVEBU_GPIO_SOC_VARIANT_ARMADAXP: | ||
155 | cpu = smp_processor_id(); | ||
156 | return mvchip->percpu_membase + GPIO_LEVEL_MASK_ARMADAXP_OFF(cpu); | ||
157 | default: | ||
158 | BUG(); | ||
159 | } | ||
160 | } | ||
161 | |||
162 | /* | ||
163 | * Functions implementing the gpio_chip methods | ||
164 | */ | ||
165 | |||
166 | int mvebu_gpio_request(struct gpio_chip *chip, unsigned pin) | ||
167 | { | ||
168 | return pinctrl_request_gpio(chip->base + pin); | ||
169 | } | ||
170 | |||
171 | void mvebu_gpio_free(struct gpio_chip *chip, unsigned pin) | ||
172 | { | ||
173 | pinctrl_free_gpio(chip->base + pin); | ||
174 | } | ||
175 | |||
176 | static void mvebu_gpio_set(struct gpio_chip *chip, unsigned pin, int value) | ||
177 | { | ||
178 | struct mvebu_gpio_chip *mvchip = | ||
179 | container_of(chip, struct mvebu_gpio_chip, chip); | ||
180 | unsigned long flags; | ||
181 | u32 u; | ||
182 | |||
183 | spin_lock_irqsave(&mvchip->lock, flags); | ||
184 | u = readl_relaxed(mvebu_gpioreg_out(mvchip)); | ||
185 | if (value) | ||
186 | u |= 1 << pin; | ||
187 | else | ||
188 | u &= ~(1 << pin); | ||
189 | writel_relaxed(u, mvebu_gpioreg_out(mvchip)); | ||
190 | spin_unlock_irqrestore(&mvchip->lock, flags); | ||
191 | } | ||
192 | |||
193 | static int mvebu_gpio_get(struct gpio_chip *chip, unsigned pin) | ||
194 | { | ||
195 | struct mvebu_gpio_chip *mvchip = | ||
196 | container_of(chip, struct mvebu_gpio_chip, chip); | ||
197 | u32 u; | ||
198 | |||
199 | if (readl_relaxed(mvebu_gpioreg_io_conf(mvchip)) & (1 << pin)) { | ||
200 | u = readl_relaxed(mvebu_gpioreg_data_in(mvchip)) ^ | ||
201 | readl_relaxed(mvebu_gpioreg_in_pol(mvchip)); | ||
202 | } else { | ||
203 | u = readl_relaxed(mvebu_gpioreg_out(mvchip)); | ||
204 | } | ||
205 | |||
206 | return (u >> pin) & 1; | ||
207 | } | ||
208 | |||
209 | static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin) | ||
210 | { | ||
211 | struct mvebu_gpio_chip *mvchip = | ||
212 | container_of(chip, struct mvebu_gpio_chip, chip); | ||
213 | unsigned long flags; | ||
214 | int ret; | ||
215 | u32 u; | ||
216 | |||
217 | /* Check with the pinctrl driver whether this pin is usable as | ||
218 | * an input GPIO */ | ||
219 | ret = pinctrl_gpio_direction_input(chip->base + pin); | ||
220 | if (ret) | ||
221 | return ret; | ||
222 | |||
223 | spin_lock_irqsave(&mvchip->lock, flags); | ||
224 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); | ||
225 | u |= 1 << pin; | ||
226 | writel_relaxed(u, mvebu_gpioreg_io_conf(mvchip)); | ||
227 | spin_unlock_irqrestore(&mvchip->lock, flags); | ||
228 | |||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin, | ||
233 | int value) | ||
234 | { | ||
235 | struct mvebu_gpio_chip *mvchip = | ||
236 | container_of(chip, struct mvebu_gpio_chip, chip); | ||
237 | unsigned long flags; | ||
238 | int ret; | ||
239 | u32 u; | ||
240 | |||
241 | /* Check with the pinctrl driver whether this pin is usable as | ||
242 | * an output GPIO */ | ||
243 | ret = pinctrl_gpio_direction_output(chip->base + pin); | ||
244 | if (ret) | ||
245 | return ret; | ||
246 | |||
247 | spin_lock_irqsave(&mvchip->lock, flags); | ||
248 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); | ||
249 | u &= ~(1 << pin); | ||
250 | writel_relaxed(u, mvebu_gpioreg_io_conf(mvchip)); | ||
251 | spin_unlock_irqrestore(&mvchip->lock, flags); | ||
252 | |||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | static int mvebu_gpio_to_irq(struct gpio_chip *chip, unsigned pin) | ||
257 | { | ||
258 | struct mvebu_gpio_chip *mvchip = | ||
259 | container_of(chip, struct mvebu_gpio_chip, chip); | ||
260 | return irq_create_mapping(mvchip->domain, pin); | ||
261 | } | ||
262 | |||
263 | /* | ||
264 | * Functions implementing the irq_chip methods | ||
265 | */ | ||
266 | static void mvebu_gpio_irq_ack(struct irq_data *d) | ||
267 | { | ||
268 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
269 | struct mvebu_gpio_chip *mvchip = gc->private; | ||
270 | u32 mask = ~(1 << (d->irq - gc->irq_base)); | ||
271 | |||
272 | irq_gc_lock(gc); | ||
273 | writel_relaxed(mask, mvebu_gpioreg_edge_cause(mvchip)); | ||
274 | irq_gc_unlock(gc); | ||
275 | } | ||
276 | |||
277 | static void mvebu_gpio_edge_irq_mask(struct irq_data *d) | ||
278 | { | ||
279 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
280 | struct mvebu_gpio_chip *mvchip = gc->private; | ||
281 | u32 mask = 1 << (d->irq - gc->irq_base); | ||
282 | |||
283 | irq_gc_lock(gc); | ||
284 | gc->mask_cache &= ~mask; | ||
285 | writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip)); | ||
286 | irq_gc_unlock(gc); | ||
287 | } | ||
288 | |||
289 | static void mvebu_gpio_edge_irq_unmask(struct irq_data *d) | ||
290 | { | ||
291 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
292 | struct mvebu_gpio_chip *mvchip = gc->private; | ||
293 | u32 mask = 1 << (d->irq - gc->irq_base); | ||
294 | |||
295 | irq_gc_lock(gc); | ||
296 | gc->mask_cache |= mask; | ||
297 | writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip)); | ||
298 | irq_gc_unlock(gc); | ||
299 | } | ||
300 | |||
301 | static void mvebu_gpio_level_irq_mask(struct irq_data *d) | ||
302 | { | ||
303 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
304 | struct mvebu_gpio_chip *mvchip = gc->private; | ||
305 | u32 mask = 1 << (d->irq - gc->irq_base); | ||
306 | |||
307 | irq_gc_lock(gc); | ||
308 | gc->mask_cache &= ~mask; | ||
309 | writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip)); | ||
310 | irq_gc_unlock(gc); | ||
311 | } | ||
312 | |||
313 | static void mvebu_gpio_level_irq_unmask(struct irq_data *d) | ||
314 | { | ||
315 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
316 | struct mvebu_gpio_chip *mvchip = gc->private; | ||
317 | u32 mask = 1 << (d->irq - gc->irq_base); | ||
318 | |||
319 | irq_gc_lock(gc); | ||
320 | gc->mask_cache |= mask; | ||
321 | writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip)); | ||
322 | irq_gc_unlock(gc); | ||
323 | } | ||
324 | |||
325 | /***************************************************************************** | ||
326 | * MVEBU GPIO IRQ | ||
327 | * | ||
328 | * GPIO_IN_POL register controls whether GPIO_DATA_IN will hold the same | ||
329 | * value of the line or the opposite value. | ||
330 | * | ||
331 | * Level IRQ handlers: DATA_IN is used directly as cause register. | ||
332 | * Interrupt are masked by LEVEL_MASK registers. | ||
333 | * Edge IRQ handlers: Change in DATA_IN are latched in EDGE_CAUSE. | ||
334 | * Interrupt are masked by EDGE_MASK registers. | ||
335 | * Both-edge handlers: Similar to regular Edge handlers, but also swaps | ||
336 | * the polarity to catch the next line transaction. | ||
337 | * This is a race condition that might not perfectly | ||
338 | * work on some use cases. | ||
339 | * | ||
340 | * Every eight GPIO lines are grouped (OR'ed) before going up to main | ||
341 | * cause register. | ||
342 | * | ||
343 | * EDGE cause mask | ||
344 | * data-in /--------| |-----| |----\ | ||
345 | * -----| |----- ---- to main cause reg | ||
346 | * X \----------------| |----/ | ||
347 | * polarity LEVEL mask | ||
348 | * | ||
349 | ****************************************************************************/ | ||
350 | |||
351 | static int mvebu_gpio_irq_set_type(struct irq_data *d, unsigned int type) | ||
352 | { | ||
353 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
354 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
355 | struct mvebu_gpio_chip *mvchip = gc->private; | ||
356 | int pin; | ||
357 | u32 u; | ||
358 | |||
359 | pin = d->hwirq; | ||
360 | |||
361 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)) & (1 << pin); | ||
362 | if (!u) { | ||
363 | return -EINVAL; | ||
364 | } | ||
365 | |||
366 | type &= IRQ_TYPE_SENSE_MASK; | ||
367 | if (type == IRQ_TYPE_NONE) | ||
368 | return -EINVAL; | ||
369 | |||
370 | /* Check if we need to change chip and handler */ | ||
371 | if (!(ct->type & type)) | ||
372 | if (irq_setup_alt_chip(d, type)) | ||
373 | return -EINVAL; | ||
374 | |||
375 | /* | ||
376 | * Configure interrupt polarity. | ||
377 | */ | ||
378 | switch(type) { | ||
379 | case IRQ_TYPE_EDGE_RISING: | ||
380 | case IRQ_TYPE_LEVEL_HIGH: | ||
381 | u = readl_relaxed(mvebu_gpioreg_in_pol(mvchip)); | ||
382 | u &= ~(1 << pin); | ||
383 | writel_relaxed(u, mvebu_gpioreg_in_pol(mvchip)); | ||
384 | case IRQ_TYPE_EDGE_FALLING: | ||
385 | case IRQ_TYPE_LEVEL_LOW: | ||
386 | u = readl_relaxed(mvebu_gpioreg_in_pol(mvchip)); | ||
387 | u |= 1 << pin; | ||
388 | writel_relaxed(u, mvebu_gpioreg_in_pol(mvchip)); | ||
389 | case IRQ_TYPE_EDGE_BOTH: { | ||
390 | u32 v; | ||
391 | |||
392 | v = readl_relaxed(mvebu_gpioreg_in_pol(mvchip)) ^ | ||
393 | readl_relaxed(mvebu_gpioreg_data_in(mvchip)); | ||
394 | |||
395 | /* | ||
396 | * set initial polarity based on current input level | ||
397 | */ | ||
398 | u = readl_relaxed(mvebu_gpioreg_in_pol(mvchip)); | ||
399 | if (v & (1 << pin)) | ||
400 | u |= 1 << pin; /* falling */ | ||
401 | else | ||
402 | u &= ~(1 << pin); /* rising */ | ||
403 | writel_relaxed(u, mvebu_gpioreg_in_pol(mvchip)); | ||
404 | } | ||
405 | } | ||
406 | return 0; | ||
407 | } | ||
408 | |||
409 | static void mvebu_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | ||
410 | { | ||
411 | struct mvebu_gpio_chip *mvchip = irq_get_handler_data(irq); | ||
412 | u32 cause, type; | ||
413 | int i; | ||
414 | |||
415 | if (mvchip == NULL) | ||
416 | return; | ||
417 | |||
418 | cause = readl_relaxed(mvebu_gpioreg_data_in(mvchip)) & | ||
419 | readl_relaxed(mvebu_gpioreg_level_mask(mvchip)); | ||
420 | cause |= readl_relaxed(mvebu_gpioreg_edge_cause(mvchip)) & | ||
421 | readl_relaxed(mvebu_gpioreg_edge_mask(mvchip)); | ||
422 | |||
423 | for (i = 0; i < mvchip->chip.ngpio; i++) { | ||
424 | int irq; | ||
425 | |||
426 | irq = mvchip->irqbase + i; | ||
427 | |||
428 | if (!(cause & (1 << i))) | ||
429 | continue; | ||
430 | |||
431 | type = irqd_get_trigger_type(irq_get_irq_data(irq)); | ||
432 | if ((type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) { | ||
433 | /* Swap polarity (race with GPIO line) */ | ||
434 | u32 polarity; | ||
435 | |||
436 | polarity = readl_relaxed(mvebu_gpioreg_in_pol(mvchip)); | ||
437 | polarity ^= 1 << i; | ||
438 | writel_relaxed(polarity, mvebu_gpioreg_in_pol(mvchip)); | ||
439 | } | ||
440 | generic_handle_irq(irq); | ||
441 | } | ||
442 | } | ||
443 | |||
444 | static struct platform_device_id mvebu_gpio_ids[] = { | ||
445 | { | ||
446 | .name = "orion-gpio", | ||
447 | }, { | ||
448 | .name = "mv78200-gpio", | ||
449 | }, { | ||
450 | .name = "armadaxp-gpio", | ||
451 | }, { | ||
452 | /* sentinel */ | ||
453 | }, | ||
454 | }; | ||
455 | MODULE_DEVICE_TABLE(platform, mvebu_gpio_ids); | ||
456 | |||
457 | static struct of_device_id mvebu_gpio_of_match[] __devinitdata = { | ||
458 | { | ||
459 | .compatible = "marvell,orion-gpio", | ||
460 | .data = (void*) MVEBU_GPIO_SOC_VARIANT_ORION, | ||
461 | }, | ||
462 | { | ||
463 | .compatible = "marvell,mv78200-gpio", | ||
464 | .data = (void*) MVEBU_GPIO_SOC_VARIANT_MV78200, | ||
465 | }, | ||
466 | { | ||
467 | .compatible = "marvell,armadaxp-gpio", | ||
468 | .data = (void*) MVEBU_GPIO_SOC_VARIANT_ARMADAXP, | ||
469 | }, | ||
470 | { | ||
471 | /* sentinel */ | ||
472 | }, | ||
473 | }; | ||
474 | MODULE_DEVICE_TABLE(of, mvebu_gpio_of_match); | ||
475 | |||
476 | static int __devinit mvebu_gpio_probe(struct platform_device *pdev) | ||
477 | { | ||
478 | struct mvebu_gpio_chip *mvchip; | ||
479 | const struct of_device_id *match; | ||
480 | struct device_node *np = pdev->dev.of_node; | ||
481 | struct resource *res; | ||
482 | struct irq_chip_generic *gc; | ||
483 | struct irq_chip_type *ct; | ||
484 | unsigned int ngpios; | ||
485 | int soc_variant; | ||
486 | int i, cpu, id; | ||
487 | |||
488 | match = of_match_device(mvebu_gpio_of_match, &pdev->dev); | ||
489 | if (match) | ||
490 | soc_variant = (int) match->data; | ||
491 | else | ||
492 | soc_variant = MVEBU_GPIO_SOC_VARIANT_ORION; | ||
493 | |||
494 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
495 | if (! res) { | ||
496 | dev_err(&pdev->dev, "Cannot get memory resource\n"); | ||
497 | return -ENODEV; | ||
498 | } | ||
499 | |||
500 | mvchip = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_gpio_chip), GFP_KERNEL); | ||
501 | if (! mvchip){ | ||
502 | dev_err(&pdev->dev, "Cannot allocate memory\n"); | ||
503 | return -ENOMEM; | ||
504 | } | ||
505 | |||
506 | if (of_property_read_u32(pdev->dev.of_node, "ngpios", &ngpios)) { | ||
507 | dev_err(&pdev->dev, "Missing ngpios OF property\n"); | ||
508 | return -ENODEV; | ||
509 | } | ||
510 | |||
511 | id = of_alias_get_id(pdev->dev.of_node, "gpio"); | ||
512 | if (id < 0) { | ||
513 | dev_err(&pdev->dev, "Couldn't get OF id\n"); | ||
514 | return id; | ||
515 | } | ||
516 | |||
517 | mvchip->soc_variant = soc_variant; | ||
518 | mvchip->chip.label = dev_name(&pdev->dev); | ||
519 | mvchip->chip.dev = &pdev->dev; | ||
520 | mvchip->chip.request = mvebu_gpio_request; | ||
521 | mvchip->chip.direction_input = mvebu_gpio_direction_input; | ||
522 | mvchip->chip.get = mvebu_gpio_get; | ||
523 | mvchip->chip.direction_output = mvebu_gpio_direction_output; | ||
524 | mvchip->chip.set = mvebu_gpio_set; | ||
525 | mvchip->chip.to_irq = mvebu_gpio_to_irq; | ||
526 | mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK; | ||
527 | mvchip->chip.ngpio = ngpios; | ||
528 | mvchip->chip.can_sleep = 0; | ||
529 | #ifdef CONFIG_OF | ||
530 | mvchip->chip.of_node = np; | ||
531 | #endif | ||
532 | |||
533 | spin_lock_init(&mvchip->lock); | ||
534 | mvchip->membase = devm_request_and_ioremap(&pdev->dev, res); | ||
535 | if (! mvchip->membase) { | ||
536 | dev_err(&pdev->dev, "Cannot ioremap\n"); | ||
537 | kfree(mvchip->chip.label); | ||
538 | return -ENOMEM; | ||
539 | } | ||
540 | |||
541 | /* The Armada XP has a second range of registers for the | ||
542 | * per-CPU registers */ | ||
543 | if (soc_variant == MVEBU_GPIO_SOC_VARIANT_ARMADAXP) { | ||
544 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
545 | if (! res) { | ||
546 | dev_err(&pdev->dev, "Cannot get memory resource\n"); | ||
547 | kfree(mvchip->chip.label); | ||
548 | return -ENODEV; | ||
549 | } | ||
550 | |||
551 | mvchip->percpu_membase = devm_request_and_ioremap(&pdev->dev, res); | ||
552 | if (! mvchip->percpu_membase) { | ||
553 | dev_err(&pdev->dev, "Cannot ioremap\n"); | ||
554 | kfree(mvchip->chip.label); | ||
555 | return -ENOMEM; | ||
556 | } | ||
557 | } | ||
558 | |||
559 | /* | ||
560 | * Mask and clear GPIO interrupts. | ||
561 | */ | ||
562 | switch(soc_variant) { | ||
563 | case MVEBU_GPIO_SOC_VARIANT_ORION: | ||
564 | writel_relaxed(0, mvchip->membase + GPIO_EDGE_CAUSE_OFF); | ||
565 | writel_relaxed(0, mvchip->membase + GPIO_EDGE_MASK_OFF); | ||
566 | writel_relaxed(0, mvchip->membase + GPIO_LEVEL_MASK_OFF); | ||
567 | break; | ||
568 | case MVEBU_GPIO_SOC_VARIANT_MV78200: | ||
569 | writel_relaxed(0, mvchip->membase + GPIO_EDGE_CAUSE_OFF); | ||
570 | for (cpu = 0; cpu < 2; cpu++) { | ||
571 | writel_relaxed(0, mvchip->membase + | ||
572 | GPIO_EDGE_MASK_MV78200_OFF(cpu)); | ||
573 | writel_relaxed(0, mvchip->membase + | ||
574 | GPIO_LEVEL_MASK_MV78200_OFF(cpu)); | ||
575 | } | ||
576 | break; | ||
577 | case MVEBU_GPIO_SOC_VARIANT_ARMADAXP: | ||
578 | writel_relaxed(0, mvchip->membase + GPIO_EDGE_CAUSE_OFF); | ||
579 | writel_relaxed(0, mvchip->membase + GPIO_EDGE_MASK_OFF); | ||
580 | writel_relaxed(0, mvchip->membase + GPIO_LEVEL_MASK_OFF); | ||
581 | for (cpu = 0; cpu < 4; cpu++) { | ||
582 | writel_relaxed(0, mvchip->percpu_membase + | ||
583 | GPIO_EDGE_CAUSE_ARMADAXP_OFF(cpu)); | ||
584 | writel_relaxed(0, mvchip->percpu_membase + | ||
585 | GPIO_EDGE_MASK_ARMADAXP_OFF(cpu)); | ||
586 | writel_relaxed(0, mvchip->percpu_membase + | ||
587 | GPIO_LEVEL_MASK_ARMADAXP_OFF(cpu)); | ||
588 | } | ||
589 | break; | ||
590 | default: | ||
591 | BUG(); | ||
592 | } | ||
593 | |||
594 | gpiochip_add(&mvchip->chip); | ||
595 | |||
596 | /* Some gpio controllers do not provide irq support */ | ||
597 | if (!of_irq_count(np)) | ||
598 | return 0; | ||
599 | |||
600 | /* Setup the interrupt handlers. Each chip can have up to 4 | ||
601 | * interrupt handlers, with each handler dealing with 8 GPIO | ||
602 | * pins. */ | ||
603 | for (i = 0; i < 4; i++) { | ||
604 | int irq; | ||
605 | irq = platform_get_irq(pdev, i); | ||
606 | if (irq < 0) | ||
607 | continue; | ||
608 | irq_set_handler_data(irq, mvchip); | ||
609 | irq_set_chained_handler(irq, mvebu_gpio_irq_handler); | ||
610 | } | ||
611 | |||
612 | mvchip->irqbase = irq_alloc_descs(-1, 0, ngpios, -1); | ||
613 | if (mvchip->irqbase < 0) { | ||
614 | dev_err(&pdev->dev, "no irqs\n"); | ||
615 | kfree(mvchip->chip.label); | ||
616 | return -ENOMEM; | ||
617 | } | ||
618 | |||
619 | gc = irq_alloc_generic_chip("mvebu_gpio_irq", 2, mvchip->irqbase, | ||
620 | mvchip->membase, handle_level_irq); | ||
621 | if (! gc) { | ||
622 | dev_err(&pdev->dev, "Cannot allocate generic irq_chip\n"); | ||
623 | kfree(mvchip->chip.label); | ||
624 | return -ENOMEM; | ||
625 | } | ||
626 | |||
627 | gc->private = mvchip; | ||
628 | ct = &gc->chip_types[0]; | ||
629 | ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW; | ||
630 | ct->chip.irq_mask = mvebu_gpio_level_irq_mask; | ||
631 | ct->chip.irq_unmask = mvebu_gpio_level_irq_unmask; | ||
632 | ct->chip.irq_set_type = mvebu_gpio_irq_set_type; | ||
633 | ct->chip.name = mvchip->chip.label; | ||
634 | |||
635 | ct = &gc->chip_types[1]; | ||
636 | ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; | ||
637 | ct->chip.irq_ack = mvebu_gpio_irq_ack; | ||
638 | ct->chip.irq_mask = mvebu_gpio_edge_irq_mask; | ||
639 | ct->chip.irq_unmask = mvebu_gpio_edge_irq_unmask; | ||
640 | ct->chip.irq_set_type = mvebu_gpio_irq_set_type; | ||
641 | ct->handler = handle_edge_irq; | ||
642 | ct->chip.name = mvchip->chip.label; | ||
643 | |||
644 | irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE, | ||
645 | IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); | ||
646 | |||
647 | /* Setup irq domain on top of the generic chip. */ | ||
648 | mvchip->domain = irq_domain_add_legacy(np, mvchip->chip.ngpio, | ||
649 | mvchip->irqbase, 0, | ||
650 | &irq_domain_simple_ops, | ||
651 | mvchip); | ||
652 | if (!mvchip->domain) { | ||
653 | dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n", | ||
654 | mvchip->chip.label); | ||
655 | irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST, | ||
656 | IRQ_LEVEL | IRQ_NOPROBE); | ||
657 | kfree(gc); | ||
658 | kfree(mvchip->chip.label); | ||
659 | return -ENODEV; | ||
660 | } | ||
661 | |||
662 | return 0; | ||
663 | } | ||
664 | |||
665 | static struct platform_driver mvebu_gpio_driver = { | ||
666 | .driver = { | ||
667 | .name = "mvebu-gpio", | ||
668 | .owner = THIS_MODULE, | ||
669 | .of_match_table = mvebu_gpio_of_match, | ||
670 | }, | ||
671 | .probe = mvebu_gpio_probe, | ||
672 | .id_table = mvebu_gpio_ids, | ||
673 | }; | ||
674 | |||
675 | static int __init mvebu_gpio_init(void) | ||
676 | { | ||
677 | return platform_driver_register(&mvebu_gpio_driver); | ||
678 | } | ||
679 | postcore_initcall(mvebu_gpio_init); | ||
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 9cac88a65f78..9528779ca463 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/syscore_ops.h> | 26 | #include <linux/syscore_ops.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | 28 | ||
29 | #include <asm/mach/irq.h> | ||
30 | |||
29 | #include <mach/irqs.h> | 31 | #include <mach/irqs.h> |
30 | 32 | ||
31 | /* | 33 | /* |
@@ -59,6 +61,7 @@ | |||
59 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) | 61 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) |
60 | 62 | ||
61 | int pxa_last_gpio; | 63 | int pxa_last_gpio; |
64 | static int irq_base; | ||
62 | 65 | ||
63 | #ifdef CONFIG_OF | 66 | #ifdef CONFIG_OF |
64 | static struct irq_domain *domain; | 67 | static struct irq_domain *domain; |
@@ -167,63 +170,14 @@ static inline int __gpio_is_occupied(unsigned gpio) | |||
167 | return ret; | 170 | return ret; |
168 | } | 171 | } |
169 | 172 | ||
170 | #ifdef CONFIG_ARCH_PXA | ||
171 | static inline int __pxa_gpio_to_irq(int gpio) | ||
172 | { | ||
173 | if (gpio_is_pxa_type(gpio_type)) | ||
174 | return PXA_GPIO_TO_IRQ(gpio); | ||
175 | return -1; | ||
176 | } | ||
177 | |||
178 | static inline int __pxa_irq_to_gpio(int irq) | ||
179 | { | ||
180 | if (gpio_is_pxa_type(gpio_type)) | ||
181 | return irq - PXA_GPIO_TO_IRQ(0); | ||
182 | return -1; | ||
183 | } | ||
184 | #else | ||
185 | static inline int __pxa_gpio_to_irq(int gpio) { return -1; } | ||
186 | static inline int __pxa_irq_to_gpio(int irq) { return -1; } | ||
187 | #endif | ||
188 | |||
189 | #ifdef CONFIG_ARCH_MMP | ||
190 | static inline int __mmp_gpio_to_irq(int gpio) | ||
191 | { | ||
192 | if (gpio_is_mmp_type(gpio_type)) | ||
193 | return MMP_GPIO_TO_IRQ(gpio); | ||
194 | return -1; | ||
195 | } | ||
196 | |||
197 | static inline int __mmp_irq_to_gpio(int irq) | ||
198 | { | ||
199 | if (gpio_is_mmp_type(gpio_type)) | ||
200 | return irq - MMP_GPIO_TO_IRQ(0); | ||
201 | return -1; | ||
202 | } | ||
203 | #else | ||
204 | static inline int __mmp_gpio_to_irq(int gpio) { return -1; } | ||
205 | static inline int __mmp_irq_to_gpio(int irq) { return -1; } | ||
206 | #endif | ||
207 | |||
208 | static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 173 | static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
209 | { | 174 | { |
210 | int gpio, ret; | 175 | return chip->base + offset + irq_base; |
211 | |||
212 | gpio = chip->base + offset; | ||
213 | ret = __pxa_gpio_to_irq(gpio); | ||
214 | if (ret >= 0) | ||
215 | return ret; | ||
216 | return __mmp_gpio_to_irq(gpio); | ||
217 | } | 176 | } |
218 | 177 | ||
219 | int pxa_irq_to_gpio(int irq) | 178 | int pxa_irq_to_gpio(int irq) |
220 | { | 179 | { |
221 | int ret; | 180 | return irq - irq_base; |
222 | |||
223 | ret = __pxa_irq_to_gpio(irq); | ||
224 | if (ret >= 0) | ||
225 | return ret; | ||
226 | return __mmp_irq_to_gpio(irq); | ||
227 | } | 181 | } |
228 | 182 | ||
229 | static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 183 | static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
@@ -403,6 +357,9 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc) | |||
403 | struct pxa_gpio_chip *c; | 357 | struct pxa_gpio_chip *c; |
404 | int loop, gpio, gpio_base, n; | 358 | int loop, gpio, gpio_base, n; |
405 | unsigned long gedr; | 359 | unsigned long gedr; |
360 | struct irq_chip *chip = irq_desc_get_chip(desc); | ||
361 | |||
362 | chained_irq_enter(chip, desc); | ||
406 | 363 | ||
407 | do { | 364 | do { |
408 | loop = 0; | 365 | loop = 0; |
@@ -422,6 +379,8 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc) | |||
422 | } | 379 | } |
423 | } | 380 | } |
424 | } while (loop); | 381 | } while (loop); |
382 | |||
383 | chained_irq_exit(chip, desc); | ||
425 | } | 384 | } |
426 | 385 | ||
427 | static void pxa_ack_muxed_gpio(struct irq_data *d) | 386 | static void pxa_ack_muxed_gpio(struct irq_data *d) |
@@ -535,7 +494,7 @@ const struct irq_domain_ops pxa_irq_domain_ops = { | |||
535 | 494 | ||
536 | static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev) | 495 | static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev) |
537 | { | 496 | { |
538 | int ret, nr_banks, nr_gpios, irq_base; | 497 | int ret, nr_banks, nr_gpios; |
539 | struct device_node *prev, *next, *np = pdev->dev.of_node; | 498 | struct device_node *prev, *next, *np = pdev->dev.of_node; |
540 | const struct of_device_id *of_id = | 499 | const struct of_device_id *of_id = |
541 | of_match_device(pxa_gpio_dt_ids, &pdev->dev); | 500 | of_match_device(pxa_gpio_dt_ids, &pdev->dev); |
@@ -590,10 +549,20 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) | |||
590 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; | 549 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; |
591 | 550 | ||
592 | ret = pxa_gpio_probe_dt(pdev); | 551 | ret = pxa_gpio_probe_dt(pdev); |
593 | if (ret < 0) | 552 | if (ret < 0) { |
594 | pxa_last_gpio = pxa_gpio_nums(); | 553 | pxa_last_gpio = pxa_gpio_nums(); |
595 | else | 554 | #ifdef CONFIG_ARCH_PXA |
555 | if (gpio_is_pxa_type(gpio_type)) | ||
556 | irq_base = PXA_GPIO_TO_IRQ(0); | ||
557 | #endif | ||
558 | #ifdef CONFIG_ARCH_MMP | ||
559 | if (gpio_is_mmp_type(gpio_type)) | ||
560 | irq_base = MMP_GPIO_TO_IRQ(0); | ||
561 | #endif | ||
562 | } else { | ||
596 | use_of = 1; | 563 | use_of = 1; |
564 | } | ||
565 | |||
597 | if (!pxa_last_gpio) | 566 | if (!pxa_last_gpio) |
598 | return -EINVAL; | 567 | return -EINVAL; |
599 | 568 | ||
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index ba126cc04073..8af4b06e80f7 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -938,6 +938,67 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip) | |||
938 | s3c_gpiolib_track(chip); | 938 | s3c_gpiolib_track(chip); |
939 | } | 939 | } |
940 | 940 | ||
941 | #if defined(CONFIG_PLAT_S3C24XX) && defined(CONFIG_OF) | ||
942 | static int s3c24xx_gpio_xlate(struct gpio_chip *gc, | ||
943 | const struct of_phandle_args *gpiospec, u32 *flags) | ||
944 | { | ||
945 | unsigned int pin; | ||
946 | |||
947 | if (WARN_ON(gc->of_gpio_n_cells < 3)) | ||
948 | return -EINVAL; | ||
949 | |||
950 | if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) | ||
951 | return -EINVAL; | ||
952 | |||
953 | if (gpiospec->args[0] > gc->ngpio) | ||
954 | return -EINVAL; | ||
955 | |||
956 | pin = gc->base + gpiospec->args[0]; | ||
957 | |||
958 | if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(gpiospec->args[1]))) | ||
959 | pr_warn("gpio_xlate: failed to set pin function\n"); | ||
960 | if (s3c_gpio_setpull(pin, gpiospec->args[2] & 0xffff)) | ||
961 | pr_warn("gpio_xlate: failed to set pin pull up/down\n"); | ||
962 | |||
963 | if (flags) | ||
964 | *flags = gpiospec->args[2] >> 16; | ||
965 | |||
966 | return gpiospec->args[0]; | ||
967 | } | ||
968 | |||
969 | static const struct of_device_id s3c24xx_gpio_dt_match[] __initdata = { | ||
970 | { .compatible = "samsung,s3c24xx-gpio", }, | ||
971 | {} | ||
972 | }; | ||
973 | |||
974 | static __init void s3c24xx_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip, | ||
975 | u64 base, u64 offset) | ||
976 | { | ||
977 | struct gpio_chip *gc = &chip->chip; | ||
978 | u64 address; | ||
979 | |||
980 | if (!of_have_populated_dt()) | ||
981 | return; | ||
982 | |||
983 | address = chip->base ? base + ((u32)chip->base & 0xfff) : base + offset; | ||
984 | gc->of_node = of_find_matching_node_by_address(NULL, | ||
985 | s3c24xx_gpio_dt_match, address); | ||
986 | if (!gc->of_node) { | ||
987 | pr_info("gpio: device tree node not found for gpio controller" | ||
988 | " with base address %08llx\n", address); | ||
989 | return; | ||
990 | } | ||
991 | gc->of_gpio_n_cells = 3; | ||
992 | gc->of_xlate = s3c24xx_gpio_xlate; | ||
993 | } | ||
994 | #else | ||
995 | static __init void s3c24xx_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip, | ||
996 | u64 base, u64 offset) | ||
997 | { | ||
998 | return; | ||
999 | } | ||
1000 | #endif /* defined(CONFIG_PLAT_S3C24XX) && defined(CONFIG_OF) */ | ||
1001 | |||
941 | static void __init s3c24xx_gpiolib_add_chips(struct samsung_gpio_chip *chip, | 1002 | static void __init s3c24xx_gpiolib_add_chips(struct samsung_gpio_chip *chip, |
942 | int nr_chips, void __iomem *base) | 1003 | int nr_chips, void __iomem *base) |
943 | { | 1004 | { |
@@ -962,6 +1023,8 @@ static void __init s3c24xx_gpiolib_add_chips(struct samsung_gpio_chip *chip, | |||
962 | gc->direction_output = samsung_gpiolib_2bit_output; | 1023 | gc->direction_output = samsung_gpiolib_2bit_output; |
963 | 1024 | ||
964 | samsung_gpiolib_add(chip); | 1025 | samsung_gpiolib_add(chip); |
1026 | |||
1027 | s3c24xx_gpiolib_attach_ofnode(chip, S3C24XX_PA_GPIO, i * 0x10); | ||
965 | } | 1028 | } |
966 | } | 1029 | } |
967 | 1030 | ||
@@ -3131,46 +3194,6 @@ samsung_gpio_pull_t s3c_gpio_getpull(unsigned int pin) | |||
3131 | } | 3194 | } |
3132 | EXPORT_SYMBOL(s3c_gpio_getpull); | 3195 | EXPORT_SYMBOL(s3c_gpio_getpull); |
3133 | 3196 | ||
3134 | /* gpiolib wrappers until these are totally eliminated */ | ||
3135 | |||
3136 | void s3c2410_gpio_pullup(unsigned int pin, unsigned int to) | ||
3137 | { | ||
3138 | int ret; | ||
3139 | |||
3140 | WARN_ON(to); /* should be none of these left */ | ||
3141 | |||
3142 | if (!to) { | ||
3143 | /* if pull is enabled, try first with up, and if that | ||
3144 | * fails, try using down */ | ||
3145 | |||
3146 | ret = s3c_gpio_setpull(pin, S3C_GPIO_PULL_UP); | ||
3147 | if (ret) | ||
3148 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_DOWN); | ||
3149 | } else { | ||
3150 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_NONE); | ||
3151 | } | ||
3152 | } | ||
3153 | EXPORT_SYMBOL(s3c2410_gpio_pullup); | ||
3154 | |||
3155 | void s3c2410_gpio_setpin(unsigned int pin, unsigned int to) | ||
3156 | { | ||
3157 | /* do this via gpiolib until all users removed */ | ||
3158 | |||
3159 | gpio_request(pin, "temporary"); | ||
3160 | gpio_set_value(pin, to); | ||
3161 | gpio_free(pin); | ||
3162 | } | ||
3163 | EXPORT_SYMBOL(s3c2410_gpio_setpin); | ||
3164 | |||
3165 | unsigned int s3c2410_gpio_getpin(unsigned int pin) | ||
3166 | { | ||
3167 | struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin); | ||
3168 | unsigned long offs = pin - chip->chip.base; | ||
3169 | |||
3170 | return __raw_readl(chip->base + 0x04) & (1 << offs); | ||
3171 | } | ||
3172 | EXPORT_SYMBOL(s3c2410_gpio_getpin); | ||
3173 | |||
3174 | #ifdef CONFIG_S5P_GPIO_DRVSTR | 3197 | #ifdef CONFIG_S5P_GPIO_DRVSTR |
3175 | s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin) | 3198 | s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin) |
3176 | { | 3199 | { |
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index dc5184d57892..d982593d7563 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -30,9 +30,6 @@ | |||
30 | 30 | ||
31 | #include <asm/mach/irq.h> | 31 | #include <asm/mach/irq.h> |
32 | 32 | ||
33 | #include <mach/iomap.h> | ||
34 | #include <mach/suspend.h> | ||
35 | |||
36 | #define GPIO_BANK(x) ((x) >> 5) | 33 | #define GPIO_BANK(x) ((x) >> 5) |
37 | #define GPIO_PORT(x) (((x) >> 3) & 0x3) | 34 | #define GPIO_PORT(x) (((x) >> 3) & 0x3) |
38 | #define GPIO_BIT(x) ((x) & 0x7) | 35 | #define GPIO_BIT(x) ((x) & 0x7) |
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c index f030880bc9bb..c5f8ca233e1f 100644 --- a/drivers/gpio/gpio-twl4030.c +++ b/drivers/gpio/gpio-twl4030.c | |||
@@ -396,6 +396,29 @@ static int __devinit gpio_twl4030_debounce(u32 debounce, u8 mmc_cd) | |||
396 | 396 | ||
397 | static int gpio_twl4030_remove(struct platform_device *pdev); | 397 | static int gpio_twl4030_remove(struct platform_device *pdev); |
398 | 398 | ||
399 | static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev) | ||
400 | { | ||
401 | struct twl4030_gpio_platform_data *omap_twl_info; | ||
402 | |||
403 | omap_twl_info = devm_kzalloc(dev, sizeof(*omap_twl_info), GFP_KERNEL); | ||
404 | if (!omap_twl_info) | ||
405 | return NULL; | ||
406 | |||
407 | omap_twl_info->use_leds = of_property_read_bool(dev->of_node, | ||
408 | "ti,use-leds"); | ||
409 | |||
410 | of_property_read_u32(dev->of_node, "ti,debounce", | ||
411 | &omap_twl_info->debounce); | ||
412 | of_property_read_u32(dev->of_node, "ti,mmc-cd", | ||
413 | (u32 *)&omap_twl_info->mmc_cd); | ||
414 | of_property_read_u32(dev->of_node, "ti,pullups", | ||
415 | &omap_twl_info->pullups); | ||
416 | of_property_read_u32(dev->of_node, "ti,pulldowns", | ||
417 | &omap_twl_info->pulldowns); | ||
418 | |||
419 | return omap_twl_info; | ||
420 | } | ||
421 | |||
399 | static int __devinit gpio_twl4030_probe(struct platform_device *pdev) | 422 | static int __devinit gpio_twl4030_probe(struct platform_device *pdev) |
400 | { | 423 | { |
401 | struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; | 424 | struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; |
@@ -428,33 +451,37 @@ no_irqs: | |||
428 | twl_gpiochip.ngpio = TWL4030_GPIO_MAX; | 451 | twl_gpiochip.ngpio = TWL4030_GPIO_MAX; |
429 | twl_gpiochip.dev = &pdev->dev; | 452 | twl_gpiochip.dev = &pdev->dev; |
430 | 453 | ||
431 | if (pdata) { | 454 | if (node) |
432 | /* | 455 | pdata = of_gpio_twl4030(&pdev->dev); |
433 | * NOTE: boards may waste power if they don't set pullups | 456 | |
434 | * and pulldowns correctly ... default for non-ULPI pins is | 457 | if (pdata == NULL) { |
435 | * pulldown, and some other pins may have external pullups | 458 | dev_err(&pdev->dev, "Platform data is missing\n"); |
436 | * or pulldowns. Careful! | 459 | return -ENXIO; |
437 | */ | ||
438 | ret = gpio_twl4030_pulls(pdata->pullups, pdata->pulldowns); | ||
439 | if (ret) | ||
440 | dev_dbg(&pdev->dev, "pullups %.05x %.05x --> %d\n", | ||
441 | pdata->pullups, pdata->pulldowns, | ||
442 | ret); | ||
443 | |||
444 | ret = gpio_twl4030_debounce(pdata->debounce, pdata->mmc_cd); | ||
445 | if (ret) | ||
446 | dev_dbg(&pdev->dev, "debounce %.03x %.01x --> %d\n", | ||
447 | pdata->debounce, pdata->mmc_cd, | ||
448 | ret); | ||
449 | |||
450 | /* | ||
451 | * NOTE: we assume VIBRA_CTL.VIBRA_EN, in MODULE_AUDIO_VOICE, | ||
452 | * is (still) clear if use_leds is set. | ||
453 | */ | ||
454 | if (pdata->use_leds) | ||
455 | twl_gpiochip.ngpio += 2; | ||
456 | } | 460 | } |
457 | 461 | ||
462 | /* | ||
463 | * NOTE: boards may waste power if they don't set pullups | ||
464 | * and pulldowns correctly ... default for non-ULPI pins is | ||
465 | * pulldown, and some other pins may have external pullups | ||
466 | * or pulldowns. Careful! | ||
467 | */ | ||
468 | ret = gpio_twl4030_pulls(pdata->pullups, pdata->pulldowns); | ||
469 | if (ret) | ||
470 | dev_dbg(&pdev->dev, "pullups %.05x %.05x --> %d\n", | ||
471 | pdata->pullups, pdata->pulldowns, ret); | ||
472 | |||
473 | ret = gpio_twl4030_debounce(pdata->debounce, pdata->mmc_cd); | ||
474 | if (ret) | ||
475 | dev_dbg(&pdev->dev, "debounce %.03x %.01x --> %d\n", | ||
476 | pdata->debounce, pdata->mmc_cd, ret); | ||
477 | |||
478 | /* | ||
479 | * NOTE: we assume VIBRA_CTL.VIBRA_EN, in MODULE_AUDIO_VOICE, | ||
480 | * is (still) clear if use_leds is set. | ||
481 | */ | ||
482 | if (pdata->use_leds) | ||
483 | twl_gpiochip.ngpio += 2; | ||
484 | |||
458 | ret = gpiochip_add(&twl_gpiochip); | 485 | ret = gpiochip_add(&twl_gpiochip); |
459 | if (ret < 0) { | 486 | if (ret < 0) { |
460 | dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret); | 487 | dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret); |
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index 2f4b01bda87c..36509ae32083 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include <linux/hwmon.h> | 31 | #include <linux/hwmon.h> |
32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
33 | #include <linux/gpio-fan.h> | 33 | #include <linux/gpio-fan.h> |
34 | #include <linux/of_platform.h> | ||
35 | #include <linux/of_gpio.h> | ||
34 | 36 | ||
35 | struct gpio_fan_data { | 37 | struct gpio_fan_data { |
36 | struct platform_device *pdev; | 38 | struct platform_device *pdev; |
@@ -400,14 +402,131 @@ static ssize_t show_name(struct device *dev, | |||
400 | 402 | ||
401 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 403 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
402 | 404 | ||
405 | |||
406 | #ifdef CONFIG_OF_GPIO | ||
407 | /* | ||
408 | * Translate OpenFirmware node properties into platform_data | ||
409 | */ | ||
410 | static int gpio_fan_get_of_pdata(struct device *dev, | ||
411 | struct gpio_fan_platform_data *pdata) | ||
412 | { | ||
413 | struct device_node *node; | ||
414 | struct gpio_fan_speed *speed; | ||
415 | unsigned *ctrl; | ||
416 | unsigned i; | ||
417 | u32 u; | ||
418 | struct property *prop; | ||
419 | const __be32 *p; | ||
420 | |||
421 | node = dev->of_node; | ||
422 | |||
423 | /* Fill GPIO pin array */ | ||
424 | pdata->num_ctrl = of_gpio_count(node); | ||
425 | if (!pdata->num_ctrl) { | ||
426 | dev_err(dev, "gpios DT property empty / missing"); | ||
427 | return -ENODEV; | ||
428 | } | ||
429 | ctrl = devm_kzalloc(dev, pdata->num_ctrl * sizeof(unsigned), | ||
430 | GFP_KERNEL); | ||
431 | if (!ctrl) | ||
432 | return -ENOMEM; | ||
433 | for (i = 0; i < pdata->num_ctrl; i++) { | ||
434 | int val; | ||
435 | |||
436 | val = of_get_gpio(node, i); | ||
437 | if (val < 0) | ||
438 | return val; | ||
439 | ctrl[i] = val; | ||
440 | } | ||
441 | pdata->ctrl = ctrl; | ||
442 | |||
443 | /* Get number of RPM/ctrl_val pairs in speed map */ | ||
444 | prop = of_find_property(node, "gpio-fan,speed-map", &i); | ||
445 | if (!prop) { | ||
446 | dev_err(dev, "gpio-fan,speed-map DT property missing"); | ||
447 | return -ENODEV; | ||
448 | } | ||
449 | i = i / sizeof(u32); | ||
450 | if (i == 0 || i & 1) { | ||
451 | dev_err(dev, "gpio-fan,speed-map contains zero/odd number of entries"); | ||
452 | return -ENODEV; | ||
453 | } | ||
454 | pdata->num_speed = i / 2; | ||
455 | |||
456 | /* | ||
457 | * Populate speed map | ||
458 | * Speed map is in the form <RPM ctrl_val RPM ctrl_val ...> | ||
459 | * this needs splitting into pairs to create gpio_fan_speed structs | ||
460 | */ | ||
461 | speed = devm_kzalloc(dev, | ||
462 | pdata->num_speed * sizeof(struct gpio_fan_speed), | ||
463 | GFP_KERNEL); | ||
464 | if (!speed) | ||
465 | return -ENOMEM; | ||
466 | p = NULL; | ||
467 | for (i = 0; i < pdata->num_speed; i++) { | ||
468 | p = of_prop_next_u32(prop, p, &u); | ||
469 | if (!p) | ||
470 | return -ENODEV; | ||
471 | speed[i].rpm = u; | ||
472 | p = of_prop_next_u32(prop, p, &u); | ||
473 | if (!p) | ||
474 | return -ENODEV; | ||
475 | speed[i].ctrl_val = u; | ||
476 | } | ||
477 | pdata->speed = speed; | ||
478 | |||
479 | /* Alarm GPIO if one exists */ | ||
480 | if (of_gpio_named_count(node, "alarm-gpios")) { | ||
481 | struct gpio_fan_alarm *alarm; | ||
482 | int val; | ||
483 | enum of_gpio_flags flags; | ||
484 | |||
485 | alarm = devm_kzalloc(dev, sizeof(struct gpio_fan_alarm), | ||
486 | GFP_KERNEL); | ||
487 | if (!alarm) | ||
488 | return -ENOMEM; | ||
489 | |||
490 | val = of_get_named_gpio_flags(node, "alarm-gpios", 0, &flags); | ||
491 | if (val < 0) | ||
492 | return val; | ||
493 | alarm->gpio = val; | ||
494 | alarm->active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
495 | |||
496 | pdata->alarm = alarm; | ||
497 | } | ||
498 | |||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | static struct of_device_id of_gpio_fan_match[] __devinitdata = { | ||
503 | { .compatible = "gpio-fan", }, | ||
504 | {}, | ||
505 | }; | ||
506 | #endif /* CONFIG_OF_GPIO */ | ||
507 | |||
403 | static int __devinit gpio_fan_probe(struct platform_device *pdev) | 508 | static int __devinit gpio_fan_probe(struct platform_device *pdev) |
404 | { | 509 | { |
405 | int err; | 510 | int err; |
406 | struct gpio_fan_data *fan_data; | 511 | struct gpio_fan_data *fan_data; |
407 | struct gpio_fan_platform_data *pdata = pdev->dev.platform_data; | 512 | struct gpio_fan_platform_data *pdata = pdev->dev.platform_data; |
408 | 513 | ||
514 | #ifdef CONFIG_OF_GPIO | ||
515 | if (!pdata) { | ||
516 | pdata = devm_kzalloc(&pdev->dev, | ||
517 | sizeof(struct gpio_fan_platform_data), | ||
518 | GFP_KERNEL); | ||
519 | if (!pdata) | ||
520 | return -ENOMEM; | ||
521 | |||
522 | err = gpio_fan_get_of_pdata(&pdev->dev, pdata); | ||
523 | if (err) | ||
524 | return err; | ||
525 | } | ||
526 | #else /* CONFIG_OF_GPIO */ | ||
409 | if (!pdata) | 527 | if (!pdata) |
410 | return -EINVAL; | 528 | return -EINVAL; |
529 | #endif /* CONFIG_OF_GPIO */ | ||
411 | 530 | ||
412 | fan_data = devm_kzalloc(&pdev->dev, sizeof(struct gpio_fan_data), | 531 | fan_data = devm_kzalloc(&pdev->dev, sizeof(struct gpio_fan_data), |
413 | GFP_KERNEL); | 532 | GFP_KERNEL); |
@@ -511,6 +630,7 @@ static struct platform_driver gpio_fan_driver = { | |||
511 | .driver = { | 630 | .driver = { |
512 | .name = "gpio-fan", | 631 | .name = "gpio-fan", |
513 | .pm = GPIO_FAN_PM, | 632 | .pm = GPIO_FAN_PM, |
633 | .of_match_table = of_match_ptr(of_gpio_fan_match), | ||
514 | }, | 634 | }, |
515 | }; | 635 | }; |
516 | 636 | ||
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c index b7975f858cff..fe11b95670bd 100644 --- a/drivers/hwmon/s3c-hwmon.c +++ b/drivers/hwmon/s3c-hwmon.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/hwmon-sysfs.h> | 34 | #include <linux/hwmon-sysfs.h> |
35 | 35 | ||
36 | #include <plat/adc.h> | 36 | #include <plat/adc.h> |
37 | #include <plat/hwmon.h> | 37 | #include <linux/platform_data/hwmon-s3c.h> |
38 | 38 | ||
39 | struct s3c_hwmon_attr { | 39 | struct s3c_hwmon_attr { |
40 | struct sensor_device_attribute in; | 40 | struct sensor_device_attribute in; |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 970a1612e795..42d9fdd63de0 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -551,7 +551,7 @@ config I2C_PMCMSP | |||
551 | 551 | ||
552 | config I2C_PNX | 552 | config I2C_PNX |
553 | tristate "I2C bus support for Philips PNX and NXP LPC targets" | 553 | tristate "I2C bus support for Philips PNX and NXP LPC targets" |
554 | depends on ARCH_PNX4008 || ARCH_LPC32XX | 554 | depends on ARCH_LPC32XX |
555 | help | 555 | help |
556 | This driver supports the Philips IP3204 I2C IP block master and/or | 556 | This driver supports the Philips IP3204 I2C IP block master and/or |
557 | slave controller | 557 | slave controller |
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 79b4bcb3b85c..79a2542d8c41 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <linux/gpio.h> | 40 | #include <linux/gpio.h> |
41 | 41 | ||
42 | #include <mach/hardware.h> | 42 | #include <mach/hardware.h> |
43 | #include <mach/i2c.h> | 43 | #include <linux/platform_data/i2c-davinci.h> |
44 | 44 | ||
45 | /* ----- global defines ----------------------------------------------- */ | 45 | /* ----- global defines ----------------------------------------------- */ |
46 | 46 | ||
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 0722f869465c..b7907ba7448a 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #include <linux/pinctrl/consumer.h> | 54 | #include <linux/pinctrl/consumer.h> |
55 | 55 | ||
56 | #include <mach/hardware.h> | 56 | #include <mach/hardware.h> |
57 | #include <mach/i2c.h> | 57 | #include <linux/platform_data/i2c-imx.h> |
58 | 58 | ||
59 | /** Defines ******************************************************************** | 59 | /** Defines ******************************************************************** |
60 | *******************************************************************************/ | 60 | *******************************************************************************/ |
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index 93f147a96b62..2f99613fd677 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -4,13 +4,13 @@ | |||
4 | /* Copyright (C) 2003 Peter Milne, D-TACQ Solutions Ltd | 4 | /* Copyright (C) 2003 Peter Milne, D-TACQ Solutions Ltd |
5 | * <Peter dot Milne at D hyphen TACQ dot com> | 5 | * <Peter dot Milne at D hyphen TACQ dot com> |
6 | * | 6 | * |
7 | * With acknowledgements to i2c-algo-ibm_ocp.c by | 7 | * With acknowledgements to i2c-algo-ibm_ocp.c by |
8 | * Ian DaSilva, MontaVista Software, Inc. idasilva@mvista.com | 8 | * Ian DaSilva, MontaVista Software, Inc. idasilva@mvista.com |
9 | * | 9 | * |
10 | * And i2c-algo-pcf.c, which was created by Simon G. Vogl and Hans Berglund: | 10 | * And i2c-algo-pcf.c, which was created by Simon G. Vogl and Hans Berglund: |
11 | * | 11 | * |
12 | * Copyright (C) 1995-1997 Simon G. Vogl, 1998-2000 Hans Berglund | 12 | * Copyright (C) 1995-1997 Simon G. Vogl, 1998-2000 Hans Berglund |
13 | * | 13 | * |
14 | * And which acknowledged Kyösti Mälkki <kmalkki@cc.hut.fi>, | 14 | * And which acknowledged Kyösti Mälkki <kmalkki@cc.hut.fi>, |
15 | * Frodo Looijaard <frodol@dds.nl>, Martin Bailey<mbailey@littlefeet-inc.com> | 15 | * Frodo Looijaard <frodol@dds.nl>, Martin Bailey<mbailey@littlefeet-inc.com> |
16 | * | 16 | * |
@@ -39,14 +39,15 @@ | |||
39 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
40 | #include <linux/i2c.h> | 40 | #include <linux/i2c.h> |
41 | #include <linux/io.h> | 41 | #include <linux/io.h> |
42 | #include <linux/gpio.h> | ||
42 | 43 | ||
43 | #include "i2c-iop3xx.h" | 44 | #include "i2c-iop3xx.h" |
44 | 45 | ||
45 | /* global unit counter */ | 46 | /* global unit counter */ |
46 | static int i2c_id; | 47 | static int i2c_id; |
47 | 48 | ||
48 | static inline unsigned char | 49 | static inline unsigned char |
49 | iic_cook_addr(struct i2c_msg *msg) | 50 | iic_cook_addr(struct i2c_msg *msg) |
50 | { | 51 | { |
51 | unsigned char addr; | 52 | unsigned char addr; |
52 | 53 | ||
@@ -55,38 +56,38 @@ iic_cook_addr(struct i2c_msg *msg) | |||
55 | if (msg->flags & I2C_M_RD) | 56 | if (msg->flags & I2C_M_RD) |
56 | addr |= 1; | 57 | addr |= 1; |
57 | 58 | ||
58 | return addr; | 59 | return addr; |
59 | } | 60 | } |
60 | 61 | ||
61 | static void | 62 | static void |
62 | iop3xx_i2c_reset(struct i2c_algo_iop3xx_data *iop3xx_adap) | 63 | iop3xx_i2c_reset(struct i2c_algo_iop3xx_data *iop3xx_adap) |
63 | { | 64 | { |
64 | /* Follows devman 9.3 */ | 65 | /* Follows devman 9.3 */ |
65 | __raw_writel(IOP3XX_ICR_UNIT_RESET, iop3xx_adap->ioaddr + CR_OFFSET); | 66 | __raw_writel(IOP3XX_ICR_UNIT_RESET, iop3xx_adap->ioaddr + CR_OFFSET); |
66 | __raw_writel(IOP3XX_ISR_CLEARBITS, iop3xx_adap->ioaddr + SR_OFFSET); | 67 | __raw_writel(IOP3XX_ISR_CLEARBITS, iop3xx_adap->ioaddr + SR_OFFSET); |
67 | __raw_writel(0, iop3xx_adap->ioaddr + CR_OFFSET); | 68 | __raw_writel(0, iop3xx_adap->ioaddr + CR_OFFSET); |
68 | } | 69 | } |
69 | 70 | ||
70 | static void | 71 | static void |
71 | iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap) | 72 | iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap) |
72 | { | 73 | { |
73 | u32 cr = IOP3XX_ICR_GCD | IOP3XX_ICR_SCLEN | IOP3XX_ICR_UE; | 74 | u32 cr = IOP3XX_ICR_GCD | IOP3XX_ICR_SCLEN | IOP3XX_ICR_UE; |
74 | 75 | ||
75 | /* | 76 | /* |
76 | * Every time unit enable is asserted, GPOD needs to be cleared | 77 | * Every time unit enable is asserted, GPOD needs to be cleared |
77 | * on IOP3XX to avoid data corruption on the bus. | 78 | * on IOP3XX to avoid data corruption on the bus. |
78 | */ | 79 | */ |
79 | #if defined(CONFIG_ARCH_IOP32X) || defined(CONFIG_ARCH_IOP33X) | 80 | #if defined(CONFIG_ARCH_IOP32X) || defined(CONFIG_ARCH_IOP33X) |
80 | if (iop3xx_adap->id == 0) { | 81 | if (iop3xx_adap->id == 0) { |
81 | gpio_line_set(IOP3XX_GPIO_LINE(7), GPIO_LOW); | 82 | gpio_set_value(7, 0); |
82 | gpio_line_set(IOP3XX_GPIO_LINE(6), GPIO_LOW); | 83 | gpio_set_value(6, 0); |
83 | } else { | 84 | } else { |
84 | gpio_line_set(IOP3XX_GPIO_LINE(5), GPIO_LOW); | 85 | gpio_set_value(5, 0); |
85 | gpio_line_set(IOP3XX_GPIO_LINE(4), GPIO_LOW); | 86 | gpio_set_value(4, 0); |
86 | } | 87 | } |
87 | #endif | 88 | #endif |
88 | /* NB SR bits not same position as CR IE bits :-( */ | 89 | /* NB SR bits not same position as CR IE bits :-( */ |
89 | iop3xx_adap->SR_enabled = | 90 | iop3xx_adap->SR_enabled = |
90 | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD | | 91 | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD | |
91 | IOP3XX_ISR_RXFULL | IOP3XX_ISR_TXEMPTY; | 92 | IOP3XX_ISR_RXFULL | IOP3XX_ISR_TXEMPTY; |
92 | 93 | ||
@@ -96,23 +97,23 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap) | |||
96 | __raw_writel(cr, iop3xx_adap->ioaddr + CR_OFFSET); | 97 | __raw_writel(cr, iop3xx_adap->ioaddr + CR_OFFSET); |
97 | } | 98 | } |
98 | 99 | ||
99 | static void | 100 | static void |
100 | iop3xx_i2c_transaction_cleanup(struct i2c_algo_iop3xx_data *iop3xx_adap) | 101 | iop3xx_i2c_transaction_cleanup(struct i2c_algo_iop3xx_data *iop3xx_adap) |
101 | { | 102 | { |
102 | unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); | 103 | unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); |
103 | 104 | ||
104 | cr &= ~(IOP3XX_ICR_MSTART | IOP3XX_ICR_TBYTE | | 105 | cr &= ~(IOP3XX_ICR_MSTART | IOP3XX_ICR_TBYTE | |
105 | IOP3XX_ICR_MSTOP | IOP3XX_ICR_SCLEN); | 106 | IOP3XX_ICR_MSTOP | IOP3XX_ICR_SCLEN); |
106 | 107 | ||
107 | __raw_writel(cr, iop3xx_adap->ioaddr + CR_OFFSET); | 108 | __raw_writel(cr, iop3xx_adap->ioaddr + CR_OFFSET); |
108 | } | 109 | } |
109 | 110 | ||
110 | /* | 111 | /* |
111 | * NB: the handler has to clear the source of the interrupt! | 112 | * NB: the handler has to clear the source of the interrupt! |
112 | * Then it passes the SR flags of interest to BH via adap data | 113 | * Then it passes the SR flags of interest to BH via adap data |
113 | */ | 114 | */ |
114 | static irqreturn_t | 115 | static irqreturn_t |
115 | iop3xx_i2c_irq_handler(int this_irq, void *dev_id) | 116 | iop3xx_i2c_irq_handler(int this_irq, void *dev_id) |
116 | { | 117 | { |
117 | struct i2c_algo_iop3xx_data *iop3xx_adap = dev_id; | 118 | struct i2c_algo_iop3xx_data *iop3xx_adap = dev_id; |
118 | u32 sr = __raw_readl(iop3xx_adap->ioaddr + SR_OFFSET); | 119 | u32 sr = __raw_readl(iop3xx_adap->ioaddr + SR_OFFSET); |
@@ -126,7 +127,7 @@ iop3xx_i2c_irq_handler(int this_irq, void *dev_id) | |||
126 | } | 127 | } |
127 | 128 | ||
128 | /* check all error conditions, clear them , report most important */ | 129 | /* check all error conditions, clear them , report most important */ |
129 | static int | 130 | static int |
130 | iop3xx_i2c_error(u32 sr) | 131 | iop3xx_i2c_error(u32 sr) |
131 | { | 132 | { |
132 | int rc = 0; | 133 | int rc = 0; |
@@ -135,12 +136,12 @@ iop3xx_i2c_error(u32 sr) | |||
135 | if ( !rc ) rc = -I2C_ERR_BERR; | 136 | if ( !rc ) rc = -I2C_ERR_BERR; |
136 | } | 137 | } |
137 | if ((sr & IOP3XX_ISR_ALD)) { | 138 | if ((sr & IOP3XX_ISR_ALD)) { |
138 | if ( !rc ) rc = -I2C_ERR_ALD; | 139 | if ( !rc ) rc = -I2C_ERR_ALD; |
139 | } | 140 | } |
140 | return rc; | 141 | return rc; |
141 | } | 142 | } |
142 | 143 | ||
143 | static inline u32 | 144 | static inline u32 |
144 | iop3xx_i2c_get_srstat(struct i2c_algo_iop3xx_data *iop3xx_adap) | 145 | iop3xx_i2c_get_srstat(struct i2c_algo_iop3xx_data *iop3xx_adap) |
145 | { | 146 | { |
146 | unsigned long flags; | 147 | unsigned long flags; |
@@ -161,8 +162,8 @@ iop3xx_i2c_get_srstat(struct i2c_algo_iop3xx_data *iop3xx_adap) | |||
161 | typedef int (* compare_func)(unsigned test, unsigned mask); | 162 | typedef int (* compare_func)(unsigned test, unsigned mask); |
162 | /* returns 1 on correct comparison */ | 163 | /* returns 1 on correct comparison */ |
163 | 164 | ||
164 | static int | 165 | static int |
165 | iop3xx_i2c_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap, | 166 | iop3xx_i2c_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap, |
166 | unsigned flags, unsigned* status, | 167 | unsigned flags, unsigned* status, |
167 | compare_func compare) | 168 | compare_func compare) |
168 | { | 169 | { |
@@ -192,47 +193,47 @@ iop3xx_i2c_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap, | |||
192 | } | 193 | } |
193 | 194 | ||
194 | /* | 195 | /* |
195 | * Concrete compare_funcs | 196 | * Concrete compare_funcs |
196 | */ | 197 | */ |
197 | static int | 198 | static int |
198 | all_bits_clear(unsigned test, unsigned mask) | 199 | all_bits_clear(unsigned test, unsigned mask) |
199 | { | 200 | { |
200 | return (test & mask) == 0; | 201 | return (test & mask) == 0; |
201 | } | 202 | } |
202 | 203 | ||
203 | static int | 204 | static int |
204 | any_bits_set(unsigned test, unsigned mask) | 205 | any_bits_set(unsigned test, unsigned mask) |
205 | { | 206 | { |
206 | return (test & mask) != 0; | 207 | return (test & mask) != 0; |
207 | } | 208 | } |
208 | 209 | ||
209 | static int | 210 | static int |
210 | iop3xx_i2c_wait_tx_done(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status) | 211 | iop3xx_i2c_wait_tx_done(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status) |
211 | { | 212 | { |
212 | return iop3xx_i2c_wait_event( | 213 | return iop3xx_i2c_wait_event( |
213 | iop3xx_adap, | 214 | iop3xx_adap, |
214 | IOP3XX_ISR_TXEMPTY | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD, | 215 | IOP3XX_ISR_TXEMPTY | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD, |
215 | status, any_bits_set); | 216 | status, any_bits_set); |
216 | } | 217 | } |
217 | 218 | ||
218 | static int | 219 | static int |
219 | iop3xx_i2c_wait_rx_done(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status) | 220 | iop3xx_i2c_wait_rx_done(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status) |
220 | { | 221 | { |
221 | return iop3xx_i2c_wait_event( | 222 | return iop3xx_i2c_wait_event( |
222 | iop3xx_adap, | 223 | iop3xx_adap, |
223 | IOP3XX_ISR_RXFULL | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD, | 224 | IOP3XX_ISR_RXFULL | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD, |
224 | status, any_bits_set); | 225 | status, any_bits_set); |
225 | } | 226 | } |
226 | 227 | ||
227 | static int | 228 | static int |
228 | iop3xx_i2c_wait_idle(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status) | 229 | iop3xx_i2c_wait_idle(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status) |
229 | { | 230 | { |
230 | return iop3xx_i2c_wait_event( | 231 | return iop3xx_i2c_wait_event( |
231 | iop3xx_adap, IOP3XX_ISR_UNITBUSY, status, all_bits_clear); | 232 | iop3xx_adap, IOP3XX_ISR_UNITBUSY, status, all_bits_clear); |
232 | } | 233 | } |
233 | 234 | ||
234 | static int | 235 | static int |
235 | iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap, | 236 | iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap, |
236 | struct i2c_msg* msg) | 237 | struct i2c_msg* msg) |
237 | { | 238 | { |
238 | unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); | 239 | unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); |
@@ -247,7 +248,7 @@ iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap, | |||
247 | } | 248 | } |
248 | 249 | ||
249 | __raw_writel(iic_cook_addr(msg), iop3xx_adap->ioaddr + DBR_OFFSET); | 250 | __raw_writel(iic_cook_addr(msg), iop3xx_adap->ioaddr + DBR_OFFSET); |
250 | 251 | ||
251 | cr &= ~(IOP3XX_ICR_MSTOP | IOP3XX_ICR_NACK); | 252 | cr &= ~(IOP3XX_ICR_MSTOP | IOP3XX_ICR_NACK); |
252 | cr |= IOP3XX_ICR_MSTART | IOP3XX_ICR_TBYTE; | 253 | cr |= IOP3XX_ICR_MSTART | IOP3XX_ICR_TBYTE; |
253 | 254 | ||
@@ -257,8 +258,8 @@ iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap, | |||
257 | return rc; | 258 | return rc; |
258 | } | 259 | } |
259 | 260 | ||
260 | static int | 261 | static int |
261 | iop3xx_i2c_write_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char byte, | 262 | iop3xx_i2c_write_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char byte, |
262 | int stop) | 263 | int stop) |
263 | { | 264 | { |
264 | unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); | 265 | unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); |
@@ -277,10 +278,10 @@ iop3xx_i2c_write_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char byte, | |||
277 | rc = iop3xx_i2c_wait_tx_done(iop3xx_adap, &status); | 278 | rc = iop3xx_i2c_wait_tx_done(iop3xx_adap, &status); |
278 | 279 | ||
279 | return rc; | 280 | return rc; |
280 | } | 281 | } |
281 | 282 | ||
282 | static int | 283 | static int |
283 | iop3xx_i2c_read_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char* byte, | 284 | iop3xx_i2c_read_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char* byte, |
284 | int stop) | 285 | int stop) |
285 | { | 286 | { |
286 | unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); | 287 | unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); |
@@ -304,19 +305,19 @@ iop3xx_i2c_read_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char* byte, | |||
304 | return rc; | 305 | return rc; |
305 | } | 306 | } |
306 | 307 | ||
307 | static int | 308 | static int |
308 | iop3xx_i2c_writebytes(struct i2c_adapter *i2c_adap, const char *buf, int count) | 309 | iop3xx_i2c_writebytes(struct i2c_adapter *i2c_adap, const char *buf, int count) |
309 | { | 310 | { |
310 | struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; | 311 | struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; |
311 | int ii; | 312 | int ii; |
312 | int rc = 0; | 313 | int rc = 0; |
313 | 314 | ||
314 | for (ii = 0; rc == 0 && ii != count; ++ii) | 315 | for (ii = 0; rc == 0 && ii != count; ++ii) |
315 | rc = iop3xx_i2c_write_byte(iop3xx_adap, buf[ii], ii==count-1); | 316 | rc = iop3xx_i2c_write_byte(iop3xx_adap, buf[ii], ii==count-1); |
316 | return rc; | 317 | return rc; |
317 | } | 318 | } |
318 | 319 | ||
319 | static int | 320 | static int |
320 | iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count) | 321 | iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count) |
321 | { | 322 | { |
322 | struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; | 323 | struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; |
@@ -325,7 +326,7 @@ iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count) | |||
325 | 326 | ||
326 | for (ii = 0; rc == 0 && ii != count; ++ii) | 327 | for (ii = 0; rc == 0 && ii != count; ++ii) |
327 | rc = iop3xx_i2c_read_byte(iop3xx_adap, &buf[ii], ii==count-1); | 328 | rc = iop3xx_i2c_read_byte(iop3xx_adap, &buf[ii], ii==count-1); |
328 | 329 | ||
329 | return rc; | 330 | return rc; |
330 | } | 331 | } |
331 | 332 | ||
@@ -336,8 +337,8 @@ iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count) | |||
336 | * Each transfer (i.e. a read or a write) is separated by a repeated start | 337 | * Each transfer (i.e. a read or a write) is separated by a repeated start |
337 | * condition. | 338 | * condition. |
338 | */ | 339 | */ |
339 | static int | 340 | static int |
340 | iop3xx_i2c_handle_msg(struct i2c_adapter *i2c_adap, struct i2c_msg* pmsg) | 341 | iop3xx_i2c_handle_msg(struct i2c_adapter *i2c_adap, struct i2c_msg* pmsg) |
341 | { | 342 | { |
342 | struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; | 343 | struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; |
343 | int rc; | 344 | int rc; |
@@ -357,8 +358,8 @@ iop3xx_i2c_handle_msg(struct i2c_adapter *i2c_adap, struct i2c_msg* pmsg) | |||
357 | /* | 358 | /* |
358 | * master_xfer() - main read/write entry | 359 | * master_xfer() - main read/write entry |
359 | */ | 360 | */ |
360 | static int | 361 | static int |
361 | iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, | 362 | iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, |
362 | int num) | 363 | int num) |
363 | { | 364 | { |
364 | struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; | 365 | struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; |
@@ -375,14 +376,14 @@ iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, | |||
375 | } | 376 | } |
376 | 377 | ||
377 | iop3xx_i2c_transaction_cleanup(iop3xx_adap); | 378 | iop3xx_i2c_transaction_cleanup(iop3xx_adap); |
378 | 379 | ||
379 | if(ret) | 380 | if(ret) |
380 | return ret; | 381 | return ret; |
381 | 382 | ||
382 | return im; | 383 | return im; |
383 | } | 384 | } |
384 | 385 | ||
385 | static u32 | 386 | static u32 |
386 | iop3xx_i2c_func(struct i2c_adapter *adap) | 387 | iop3xx_i2c_func(struct i2c_adapter *adap) |
387 | { | 388 | { |
388 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 389 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
@@ -393,11 +394,11 @@ static const struct i2c_algorithm iop3xx_i2c_algo = { | |||
393 | .functionality = iop3xx_i2c_func, | 394 | .functionality = iop3xx_i2c_func, |
394 | }; | 395 | }; |
395 | 396 | ||
396 | static int | 397 | static int |
397 | iop3xx_i2c_remove(struct platform_device *pdev) | 398 | iop3xx_i2c_remove(struct platform_device *pdev) |
398 | { | 399 | { |
399 | struct i2c_adapter *padapter = platform_get_drvdata(pdev); | 400 | struct i2c_adapter *padapter = platform_get_drvdata(pdev); |
400 | struct i2c_algo_iop3xx_data *adapter_data = | 401 | struct i2c_algo_iop3xx_data *adapter_data = |
401 | (struct i2c_algo_iop3xx_data *)padapter->algo_data; | 402 | (struct i2c_algo_iop3xx_data *)padapter->algo_data; |
402 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 403 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
403 | unsigned long cr = __raw_readl(adapter_data->ioaddr + CR_OFFSET); | 404 | unsigned long cr = __raw_readl(adapter_data->ioaddr + CR_OFFSET); |
@@ -419,7 +420,7 @@ iop3xx_i2c_remove(struct platform_device *pdev) | |||
419 | return 0; | 420 | return 0; |
420 | } | 421 | } |
421 | 422 | ||
422 | static int | 423 | static int |
423 | iop3xx_i2c_probe(struct platform_device *pdev) | 424 | iop3xx_i2c_probe(struct platform_device *pdev) |
424 | { | 425 | { |
425 | struct resource *res; | 426 | struct resource *res; |
diff --git a/drivers/i2c/busses/i2c-nuc900.c b/drivers/i2c/busses/i2c-nuc900.c index a26dfb8cd586..f41502ef3f55 100644 --- a/drivers/i2c/busses/i2c-nuc900.c +++ b/drivers/i2c/busses/i2c-nuc900.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
30 | 30 | ||
31 | #include <mach/mfp.h> | 31 | #include <mach/mfp.h> |
32 | #include <mach/i2c.h> | 32 | #include <linux/platform_data/i2c-nuc900.h> |
33 | 33 | ||
34 | /* nuc900 i2c registers offset */ | 34 | /* nuc900 i2c registers offset */ |
35 | 35 | ||
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 5ae3b0236bd3..4d07dea9bca9 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <asm/irq.h> | 42 | #include <asm/irq.h> |
43 | 43 | ||
44 | #include <plat/regs-iic.h> | 44 | #include <plat/regs-iic.h> |
45 | #include <plat/iic.h> | 45 | #include <linux/platform_data/i2c-s3c2410.h> |
46 | 46 | ||
47 | /* Treat S3C2410 as baseline hardware, anything else is supported via quirks */ | 47 | /* Treat S3C2410 as baseline hardware, anything else is supported via quirks */ |
48 | #define QUIRK_S3C2440 (1 << 0) | 48 | #define QUIRK_S3C2440 (1 << 0) |
diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c index 9d82b3aeff5e..d5bacbb479b0 100644 --- a/drivers/input/keyboard/davinci_keyscan.c +++ b/drivers/input/keyboard/davinci_keyscan.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
38 | #include <mach/irqs.h> | 38 | #include <mach/irqs.h> |
39 | #include <mach/keyscan.h> | 39 | #include <linux/platform_data/keyscan-davinci.h> |
40 | 40 | ||
41 | /* Key scan registers */ | 41 | /* Key scan registers */ |
42 | #define DAVINCI_KEYSCAN_KEYCTRL 0x0000 | 42 | #define DAVINCI_KEYSCAN_KEYCTRL 0x0000 |
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c index c46fc8185469..7363402de8d4 100644 --- a/drivers/input/keyboard/ep93xx_keypad.c +++ b/drivers/input/keyboard/ep93xx_keypad.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | 30 | ||
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
32 | #include <mach/ep93xx_keypad.h> | 32 | #include <linux/platform_data/keypad-ep93xx.h> |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * Keypad Interface Register offsets | 35 | * Keypad Interface Register offsets |
diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c index a880e7414202..49f5fa64e0b1 100644 --- a/drivers/input/keyboard/nomadik-ske-keypad.c +++ b/drivers/input/keyboard/nomadik-ske-keypad.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | 22 | ||
23 | #include <plat/ske.h> | 23 | #include <linux/platform_data/keypad-nomadik-ske.h> |
24 | 24 | ||
25 | /* SKE_CR bits */ | 25 | /* SKE_CR bits */ |
26 | #define SKE_KPMLT (0x1 << 6) | 26 | #define SKE_KPMLT (0x1 << 6) |
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index 2bda5f0b9c6e..6d6b1427ae12 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <linux/gpio.h> | 38 | #include <linux/gpio.h> |
39 | #include <linux/platform_data/gpio-omap.h> | 39 | #include <linux/platform_data/gpio-omap.h> |
40 | #include <plat/keypad.h> | 40 | #include <linux/platform_data/keypad-omap.h> |
41 | 41 | ||
42 | #undef NEW_BOARD_LEARNING_MODE | 42 | #undef NEW_BOARD_LEARNING_MODE |
43 | 43 | ||
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 7f7b72464a37..803ff6fe021e 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
33 | 33 | ||
34 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
35 | #include <plat/pxa27x_keypad.h> | 35 | #include <linux/platform_data/keypad-pxa27x.h> |
36 | /* | 36 | /* |
37 | * Keypad Controller registers | 37 | * Keypad Controller registers |
38 | */ | 38 | */ |
diff --git a/drivers/input/keyboard/pxa930_rotary.c b/drivers/input/keyboard/pxa930_rotary.c index d7f1134b789e..41488f9add20 100644 --- a/drivers/input/keyboard/pxa930_rotary.c +++ b/drivers/input/keyboard/pxa930_rotary.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | 17 | ||
18 | #include <mach/pxa930_rotary.h> | 18 | #include <linux/platform_data/keyboard-pxa930_rotary.h> |
19 | 19 | ||
20 | #define SBCR (0x04) | 20 | #define SBCR (0x04) |
21 | #define ERCR (0x0c) | 21 | #define ERCR (0x0c) |
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 72ef01be3360..c7ca97f44bfb 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/pm_wakeup.h> | 24 | #include <linux/pm_wakeup.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <plat/keyboard.h> | 27 | #include <linux/platform_data/keyboard-spear.h> |
28 | 28 | ||
29 | /* Keyboard Registers */ | 29 | /* Keyboard Registers */ |
30 | #define MODE_CTL_REG 0x00 | 30 | #define MODE_CTL_REG 0x00 |
diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c index 085ede4d972d..e0f6cd1ad0fd 100644 --- a/drivers/input/keyboard/w90p910_keypad.c +++ b/drivers/input/keyboard/w90p910_keypad.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | 23 | ||
24 | #include <mach/w90p910_keypad.h> | 24 | #include <linux/platform_data/keypad-w90p910.h> |
25 | 25 | ||
26 | /* Keypad Interface Control Registers */ | 26 | /* Keypad Interface Control Registers */ |
27 | #define KPI_CONF 0x00 | 27 | #define KPI_CONF 0x00 |
diff --git a/drivers/input/mouse/pxa930_trkball.c b/drivers/input/mouse/pxa930_trkball.c index a9e4bfdf31f4..4fe055f2c536 100644 --- a/drivers/input/mouse/pxa930_trkball.c +++ b/drivers/input/mouse/pxa930_trkball.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | 21 | ||
22 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
23 | #include <mach/pxa930_trkball.h> | 23 | #include <linux/platform_data/mouse-pxa930_trkball.h> |
24 | 24 | ||
25 | /* Trackball Controller Register Definitions */ | 25 | /* Trackball Controller Register Definitions */ |
26 | #define TBCR (0x000C) | 26 | #define TBCR (0x000C) |
diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c index 272deddc8db6..21c60fea5d31 100644 --- a/drivers/input/mouse/rpcmouse.c +++ b/drivers/input/mouse/rpcmouse.c | |||
@@ -42,7 +42,7 @@ static irqreturn_t rpcmouse_irq(int irq, void *dev_id) | |||
42 | 42 | ||
43 | x = (short) iomd_readl(IOMD_MOUSEX); | 43 | x = (short) iomd_readl(IOMD_MOUSEX); |
44 | y = (short) iomd_readl(IOMD_MOUSEY); | 44 | y = (short) iomd_readl(IOMD_MOUSEY); |
45 | b = (short) (__raw_readl(0xe0310000) ^ 0x70); | 45 | b = (short) (__raw_readl(IOMEM(0xe0310000)) ^ 0x70); |
46 | 46 | ||
47 | dx = x - rpcmouse_lastx; | 47 | dx = x - rpcmouse_lastx; |
48 | dy = y - rpcmouse_lasty; | 48 | dy = y - rpcmouse_lasty; |
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c index f5fbdf94de3b..45887e31242a 100644 --- a/drivers/input/serio/ams_delta_serio.c +++ b/drivers/input/serio/ams_delta_serio.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | 28 | ||
29 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
30 | #include <plat/board-ams-delta.h> | 30 | #include <mach/board-ams-delta.h> |
31 | 31 | ||
32 | #include <mach/ams-delta-fiq.h> | 32 | #include <mach/ams-delta-fiq.h> |
33 | 33 | ||
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index bf1a06400067..df9e816d55e4 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #include <plat/adc.h> | 38 | #include <plat/adc.h> |
39 | #include <plat/regs-adc.h> | 39 | #include <plat/regs-adc.h> |
40 | #include <plat/ts.h> | 40 | #include <linux/platform_data/touchscreen-s3c2410.h> |
41 | 41 | ||
42 | #define TSC_SLEEP (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0)) | 42 | #define TSC_SLEEP (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0)) |
43 | 43 | ||
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/drivers/irqchip/Kconfig | |||
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile new file mode 100644 index 000000000000..054321db4350 --- /dev/null +++ b/drivers/irqchip/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o | |||
diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c new file mode 100644 index 000000000000..dc670ccc6978 --- /dev/null +++ b/drivers/irqchip/irq-bcm2835.c | |||
@@ -0,0 +1,223 @@ | |||
1 | /* | ||
2 | * Copyright 2010 Broadcom | ||
3 | * Copyright 2012 Simon Arlott, Chris Boot, Stephen Warren | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * Quirk 1: Shortcut interrupts don't set the bank 1/2 register pending bits | ||
16 | * | ||
17 | * If an interrupt fires on bank 1 that isn't in the shortcuts list, bit 8 | ||
18 | * on bank 0 is set to signify that an interrupt in bank 1 has fired, and | ||
19 | * to look in the bank 1 status register for more information. | ||
20 | * | ||
21 | * If an interrupt fires on bank 1 that _is_ in the shortcuts list, its | ||
22 | * shortcut bit in bank 0 is set as well as its interrupt bit in the bank 1 | ||
23 | * status register, but bank 0 bit 8 is _not_ set. | ||
24 | * | ||
25 | * Quirk 2: You can't mask the register 1/2 pending interrupts | ||
26 | * | ||
27 | * In a proper cascaded interrupt controller, the interrupt lines with | ||
28 | * cascaded interrupt controllers on them are just normal interrupt lines. | ||
29 | * You can mask the interrupts and get on with things. With this controller | ||
30 | * you can't do that. | ||
31 | * | ||
32 | * Quirk 3: The shortcut interrupts can't be (un)masked in bank 0 | ||
33 | * | ||
34 | * Those interrupts that have shortcuts can only be masked/unmasked in | ||
35 | * their respective banks' enable/disable registers. Doing so in the bank 0 | ||
36 | * enable/disable registers has no effect. | ||
37 | * | ||
38 | * The FIQ control register: | ||
39 | * Bits 0-6: IRQ (index in order of interrupts from banks 1, 2, then 0) | ||
40 | * Bit 7: Enable FIQ generation | ||
41 | * Bits 8+: Unused | ||
42 | * | ||
43 | * An interrupt must be disabled before configuring it for FIQ generation | ||
44 | * otherwise both handlers will fire at the same time! | ||
45 | */ | ||
46 | |||
47 | #include <linux/io.h> | ||
48 | #include <linux/slab.h> | ||
49 | #include <linux/of_address.h> | ||
50 | #include <linux/of_irq.h> | ||
51 | #include <linux/irqdomain.h> | ||
52 | #include <linux/irqchip/bcm2835.h> | ||
53 | |||
54 | #include <asm/exception.h> | ||
55 | |||
56 | /* Put the bank and irq (32 bits) into the hwirq */ | ||
57 | #define MAKE_HWIRQ(b, n) ((b << 5) | (n)) | ||
58 | #define HWIRQ_BANK(i) (i >> 5) | ||
59 | #define HWIRQ_BIT(i) BIT(i & 0x1f) | ||
60 | |||
61 | #define NR_IRQS_BANK0 8 | ||
62 | #define BANK0_HWIRQ_MASK 0xff | ||
63 | /* Shortcuts can't be disabled so any unknown new ones need to be masked */ | ||
64 | #define SHORTCUT1_MASK 0x00007c00 | ||
65 | #define SHORTCUT2_MASK 0x001f8000 | ||
66 | #define SHORTCUT_SHIFT 10 | ||
67 | #define BANK1_HWIRQ BIT(8) | ||
68 | #define BANK2_HWIRQ BIT(9) | ||
69 | #define BANK0_VALID_MASK (BANK0_HWIRQ_MASK | BANK1_HWIRQ | BANK2_HWIRQ \ | ||
70 | | SHORTCUT1_MASK | SHORTCUT2_MASK) | ||
71 | |||
72 | #define REG_FIQ_CONTROL 0x0c | ||
73 | |||
74 | #define NR_BANKS 3 | ||
75 | #define IRQS_PER_BANK 32 | ||
76 | |||
77 | static int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; | ||
78 | static int reg_enable[] __initconst = { 0x18, 0x10, 0x14 }; | ||
79 | static int reg_disable[] __initconst = { 0x24, 0x1c, 0x20 }; | ||
80 | static int bank_irqs[] __initconst = { 8, 32, 32 }; | ||
81 | |||
82 | static const int shortcuts[] = { | ||
83 | 7, 9, 10, 18, 19, /* Bank 1 */ | ||
84 | 21, 22, 23, 24, 25, 30 /* Bank 2 */ | ||
85 | }; | ||
86 | |||
87 | struct armctrl_ic { | ||
88 | void __iomem *base; | ||
89 | void __iomem *pending[NR_BANKS]; | ||
90 | void __iomem *enable[NR_BANKS]; | ||
91 | void __iomem *disable[NR_BANKS]; | ||
92 | struct irq_domain *domain; | ||
93 | }; | ||
94 | |||
95 | static struct armctrl_ic intc __read_mostly; | ||
96 | |||
97 | static void armctrl_mask_irq(struct irq_data *d) | ||
98 | { | ||
99 | writel_relaxed(HWIRQ_BIT(d->hwirq), intc.disable[HWIRQ_BANK(d->hwirq)]); | ||
100 | } | ||
101 | |||
102 | static void armctrl_unmask_irq(struct irq_data *d) | ||
103 | { | ||
104 | writel_relaxed(HWIRQ_BIT(d->hwirq), intc.enable[HWIRQ_BANK(d->hwirq)]); | ||
105 | } | ||
106 | |||
107 | static struct irq_chip armctrl_chip = { | ||
108 | .name = "ARMCTRL-level", | ||
109 | .irq_mask = armctrl_mask_irq, | ||
110 | .irq_unmask = armctrl_unmask_irq | ||
111 | }; | ||
112 | |||
113 | static int armctrl_xlate(struct irq_domain *d, struct device_node *ctrlr, | ||
114 | const u32 *intspec, unsigned int intsize, | ||
115 | unsigned long *out_hwirq, unsigned int *out_type) | ||
116 | { | ||
117 | if (WARN_ON(intsize != 2)) | ||
118 | return -EINVAL; | ||
119 | |||
120 | if (WARN_ON(intspec[0] >= NR_BANKS)) | ||
121 | return -EINVAL; | ||
122 | |||
123 | if (WARN_ON(intspec[1] >= IRQS_PER_BANK)) | ||
124 | return -EINVAL; | ||
125 | |||
126 | if (WARN_ON(intspec[0] == 0 && intspec[1] >= NR_IRQS_BANK0)) | ||
127 | return -EINVAL; | ||
128 | |||
129 | *out_hwirq = MAKE_HWIRQ(intspec[0], intspec[1]); | ||
130 | *out_type = IRQ_TYPE_NONE; | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | static struct irq_domain_ops armctrl_ops = { | ||
135 | .xlate = armctrl_xlate | ||
136 | }; | ||
137 | |||
138 | static int __init armctrl_of_init(struct device_node *node, | ||
139 | struct device_node *parent) | ||
140 | { | ||
141 | void __iomem *base; | ||
142 | int irq, b, i; | ||
143 | |||
144 | base = of_iomap(node, 0); | ||
145 | if (!base) | ||
146 | panic("%s: unable to map IC registers\n", | ||
147 | node->full_name); | ||
148 | |||
149 | intc.domain = irq_domain_add_linear(node, MAKE_HWIRQ(NR_BANKS, 0), | ||
150 | &armctrl_ops, NULL); | ||
151 | if (!intc.domain) | ||
152 | panic("%s: unable to create IRQ domain\n", node->full_name); | ||
153 | |||
154 | for (b = 0; b < NR_BANKS; b++) { | ||
155 | intc.pending[b] = base + reg_pending[b]; | ||
156 | intc.enable[b] = base + reg_enable[b]; | ||
157 | intc.disable[b] = base + reg_disable[b]; | ||
158 | |||
159 | for (i = 0; i < bank_irqs[b]; i++) { | ||
160 | irq = irq_create_mapping(intc.domain, MAKE_HWIRQ(b, i)); | ||
161 | BUG_ON(irq <= 0); | ||
162 | irq_set_chip_and_handler(irq, &armctrl_chip, | ||
163 | handle_level_irq); | ||
164 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
165 | } | ||
166 | } | ||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | static struct of_device_id irq_of_match[] __initconst = { | ||
171 | { .compatible = "brcm,bcm2835-armctrl-ic", .data = armctrl_of_init } | ||
172 | }; | ||
173 | |||
174 | void __init bcm2835_init_irq(void) | ||
175 | { | ||
176 | of_irq_init(irq_of_match); | ||
177 | } | ||
178 | |||
179 | /* | ||
180 | * Handle each interrupt across the entire interrupt controller. This reads the | ||
181 | * status register before handling each interrupt, which is necessary given that | ||
182 | * handle_IRQ may briefly re-enable interrupts for soft IRQ handling. | ||
183 | */ | ||
184 | |||
185 | static void armctrl_handle_bank(int bank, struct pt_regs *regs) | ||
186 | { | ||
187 | u32 stat, irq; | ||
188 | |||
189 | while ((stat = readl_relaxed(intc.pending[bank]))) { | ||
190 | irq = MAKE_HWIRQ(bank, ffs(stat) - 1); | ||
191 | handle_IRQ(irq_linear_revmap(intc.domain, irq), regs); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | static void armctrl_handle_shortcut(int bank, struct pt_regs *regs, | ||
196 | u32 stat) | ||
197 | { | ||
198 | u32 irq = MAKE_HWIRQ(bank, shortcuts[ffs(stat >> SHORTCUT_SHIFT) - 1]); | ||
199 | handle_IRQ(irq_linear_revmap(intc.domain, irq), regs); | ||
200 | } | ||
201 | |||
202 | asmlinkage void __exception_irq_entry bcm2835_handle_irq( | ||
203 | struct pt_regs *regs) | ||
204 | { | ||
205 | u32 stat, irq; | ||
206 | |||
207 | while ((stat = readl_relaxed(intc.pending[0]) & BANK0_VALID_MASK)) { | ||
208 | if (stat & BANK0_HWIRQ_MASK) { | ||
209 | irq = MAKE_HWIRQ(0, ffs(stat & BANK0_HWIRQ_MASK) - 1); | ||
210 | handle_IRQ(irq_linear_revmap(intc.domain, irq), regs); | ||
211 | } else if (stat & SHORTCUT1_MASK) { | ||
212 | armctrl_handle_shortcut(1, regs, stat & SHORTCUT1_MASK); | ||
213 | } else if (stat & SHORTCUT2_MASK) { | ||
214 | armctrl_handle_shortcut(2, regs, stat & SHORTCUT2_MASK); | ||
215 | } else if (stat & BANK1_HWIRQ) { | ||
216 | armctrl_handle_bank(1, regs); | ||
217 | } else if (stat & BANK2_HWIRQ) { | ||
218 | armctrl_handle_bank(2, regs); | ||
219 | } else { | ||
220 | BUG(); | ||
221 | } | ||
222 | } | ||
223 | } | ||
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c index e37618e363cf..461bbf9b33fa 100644 --- a/drivers/leds/leds-netxbig.c +++ b/drivers/leds/leds-netxbig.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/gpio.h> | 29 | #include <linux/gpio.h> |
30 | #include <linux/leds.h> | 30 | #include <linux/leds.h> |
31 | #include <mach/leds-netxbig.h> | 31 | #include <linux/platform_data/leds-kirkwood-netxbig.h> |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * GPIO extension bus. | 34 | * GPIO extension bus. |
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 10528dafb043..d176ec83f5d9 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/gpio.h> | 29 | #include <linux/gpio.h> |
30 | #include <linux/leds.h> | 30 | #include <linux/leds.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <mach/leds-ns2.h> | 32 | #include <linux/platform_data/leds-kirkwood-ns2.h> |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * The Network Space v2 dual-GPIO LED is wired to a CPLD and can blink in | 35 | * The Network Space v2 dual-GPIO LED is wired to a CPLD and can blink in |
diff --git a/drivers/leds/leds-s3c24xx.c b/drivers/leds/leds-s3c24xx.c index 942f0ea18178..e1a0df63a37f 100644 --- a/drivers/leds/leds-s3c24xx.c +++ b/drivers/leds/leds-s3c24xx.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
23 | #include <mach/regs-gpio.h> | 23 | #include <mach/regs-gpio.h> |
24 | #include <mach/leds-gpio.h> | 24 | #include <linux/platform_data/leds-s3c24xx.h> |
25 | 25 | ||
26 | /* our context */ | 26 | /* our context */ |
27 | 27 | ||
diff --git a/drivers/media/video/davinci/vpbe_venc.c b/drivers/media/video/davinci/vpbe_venc.c index b21ecc8d134d..0302669622d6 100644 --- a/drivers/media/video/davinci/vpbe_venc.c +++ b/drivers/media/video/davinci/vpbe_venc.c | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
29 | #include <mach/mux.h> | 29 | #include <mach/mux.h> |
30 | #include <mach/i2c.h> | 30 | #include <linux/platform_data/i2c-davinci.h> |
31 | 31 | ||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | 33 | ||
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 560a65aa7038..bbe70991d30b 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <mach/dma-mx1-mx2.h> | 44 | #include <mach/dma-mx1-mx2.h> |
45 | #include <mach/hardware.h> | 45 | #include <mach/hardware.h> |
46 | #include <mach/irqs.h> | 46 | #include <mach/irqs.h> |
47 | #include <mach/mx1_camera.h> | 47 | #include <linux/platform_data/camera-mx1.h> |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * CSI registers | 50 | * CSI registers |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index ac175406e582..965427f279a5 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | #include <linux/videodev2.h> | 41 | #include <linux/videodev2.h> |
42 | 42 | ||
43 | #include <mach/mx2_cam.h> | 43 | #include <linux/platform_data/camera-mx2.h> |
44 | #include <mach/hardware.h> | 44 | #include <mach/hardware.h> |
45 | 45 | ||
46 | #include <asm/dma.h> | 46 | #include <asm/dma.h> |
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index af2297dd49c8..1481b0d419da 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #include <media/soc_mediabus.h> | 25 | #include <media/soc_mediabus.h> |
26 | 26 | ||
27 | #include <mach/ipu.h> | 27 | #include <mach/ipu.h> |
28 | #include <mach/mx3_camera.h> | 28 | #include <linux/platform_data/camera-mx3.h> |
29 | #include <mach/dma.h> | 29 | #include <linux/platform_data/dma-imx.h> |
30 | 30 | ||
31 | #define MX3_CAM_DRV_NAME "mx3-camera" | 31 | #define MX3_CAM_DRV_NAME "mx3-camera" |
32 | 32 | ||
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 9c21e01f2c24..1e3776d08dac 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/videodev2.h> | 37 | #include <linux/videodev2.h> |
38 | 38 | ||
39 | #include <mach/dma.h> | 39 | #include <mach/dma.h> |
40 | #include <mach/camera.h> | 40 | #include <linux/platform_data/camera-pxa.h> |
41 | 41 | ||
42 | #define PXA_CAM_VERSION "0.0.6" | 42 | #define PXA_CAM_VERSION "0.0.6" |
43 | #define PXA_CAM_DRV_NAME "pxa27x-camera" | 43 | #define PXA_CAM_DRV_NAME "pxa27x-camera" |
diff --git a/drivers/media/video/s5p-fimc/mipi-csis.c b/drivers/media/video/s5p-fimc/mipi-csis.c index 2f73d9e3d0b7..5e898432883a 100644 --- a/drivers/media/video/s5p-fimc/mipi-csis.c +++ b/drivers/media/video/s5p-fimc/mipi-csis.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/videodev2.h> | 27 | #include <linux/videodev2.h> |
28 | #include <media/v4l2-subdev.h> | 28 | #include <media/v4l2-subdev.h> |
29 | #include <plat/mipi_csis.h> | 29 | #include <linux/platform_data/mipi-csis.h> |
30 | #include "mipi-csis.h" | 30 | #include "mipi-csis.h" |
31 | 31 | ||
32 | static int debug; | 32 | static int debug; |
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 0e63cdd9b52a..6b67edbdbd01 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c | |||
@@ -418,6 +418,9 @@ static struct { | |||
418 | 418 | ||
419 | static atomic_t ac_wake_req_state = ATOMIC_INIT(0); | 419 | static atomic_t ac_wake_req_state = ATOMIC_INIT(0); |
420 | 420 | ||
421 | /* Functions definition */ | ||
422 | static void compute_armss_rate(void); | ||
423 | |||
421 | /* Spinlocks */ | 424 | /* Spinlocks */ |
422 | static DEFINE_SPINLOCK(prcmu_lock); | 425 | static DEFINE_SPINLOCK(prcmu_lock); |
423 | static DEFINE_SPINLOCK(clkout_lock); | 426 | static DEFINE_SPINLOCK(clkout_lock); |
@@ -517,6 +520,7 @@ static struct dsiescclk dsiescclk[3] = { | |||
517 | } | 520 | } |
518 | }; | 521 | }; |
519 | 522 | ||
523 | |||
520 | /* | 524 | /* |
521 | * Used by MCDE to setup all necessary PRCMU registers | 525 | * Used by MCDE to setup all necessary PRCMU registers |
522 | */ | 526 | */ |
@@ -1013,6 +1017,7 @@ int db8500_prcmu_set_arm_opp(u8 opp) | |||
1013 | (mb1_transfer.ack.arm_opp != opp)) | 1017 | (mb1_transfer.ack.arm_opp != opp)) |
1014 | r = -EIO; | 1018 | r = -EIO; |
1015 | 1019 | ||
1020 | compute_armss_rate(); | ||
1016 | mutex_unlock(&mb1_transfer.lock); | 1021 | mutex_unlock(&mb1_transfer.lock); |
1017 | 1022 | ||
1018 | return r; | 1023 | return r; |
@@ -1612,6 +1617,7 @@ static unsigned long pll_rate(void __iomem *reg, unsigned long src_rate, | |||
1612 | if ((branch == PLL_FIX) || ((branch == PLL_DIV) && | 1617 | if ((branch == PLL_FIX) || ((branch == PLL_DIV) && |
1613 | (val & PRCM_PLL_FREQ_DIV2EN) && | 1618 | (val & PRCM_PLL_FREQ_DIV2EN) && |
1614 | ((reg == PRCM_PLLSOC0_FREQ) || | 1619 | ((reg == PRCM_PLLSOC0_FREQ) || |
1620 | (reg == PRCM_PLLARM_FREQ) || | ||
1615 | (reg == PRCM_PLLDDR_FREQ)))) | 1621 | (reg == PRCM_PLLDDR_FREQ)))) |
1616 | div *= 2; | 1622 | div *= 2; |
1617 | 1623 | ||
@@ -1661,6 +1667,39 @@ static unsigned long clock_rate(u8 clock) | |||
1661 | else | 1667 | else |
1662 | return 0; | 1668 | return 0; |
1663 | } | 1669 | } |
1670 | static unsigned long latest_armss_rate; | ||
1671 | static unsigned long armss_rate(void) | ||
1672 | { | ||
1673 | return latest_armss_rate; | ||
1674 | } | ||
1675 | |||
1676 | static void compute_armss_rate(void) | ||
1677 | { | ||
1678 | u32 r; | ||
1679 | unsigned long rate; | ||
1680 | |||
1681 | r = readl(PRCM_ARM_CHGCLKREQ); | ||
1682 | |||
1683 | if (r & PRCM_ARM_CHGCLKREQ_PRCM_ARM_CHGCLKREQ) { | ||
1684 | /* External ARMCLKFIX clock */ | ||
1685 | |||
1686 | rate = pll_rate(PRCM_PLLDDR_FREQ, ROOT_CLOCK_RATE, PLL_FIX); | ||
1687 | |||
1688 | /* Check PRCM_ARM_CHGCLKREQ divider */ | ||
1689 | if (!(r & PRCM_ARM_CHGCLKREQ_PRCM_ARM_DIVSEL)) | ||
1690 | rate /= 2; | ||
1691 | |||
1692 | /* Check PRCM_ARMCLKFIX_MGT divider */ | ||
1693 | r = readl(PRCM_ARMCLKFIX_MGT); | ||
1694 | r &= PRCM_CLK_MGT_CLKPLLDIV_MASK; | ||
1695 | rate /= r; | ||
1696 | |||
1697 | } else {/* ARM PLL */ | ||
1698 | rate = pll_rate(PRCM_PLLARM_FREQ, ROOT_CLOCK_RATE, PLL_DIV); | ||
1699 | } | ||
1700 | |||
1701 | latest_armss_rate = rate; | ||
1702 | } | ||
1664 | 1703 | ||
1665 | static unsigned long dsiclk_rate(u8 n) | 1704 | static unsigned long dsiclk_rate(u8 n) |
1666 | { | 1705 | { |
@@ -1707,6 +1746,8 @@ unsigned long prcmu_clock_rate(u8 clock) | |||
1707 | return pll_rate(PRCM_PLLSOC0_FREQ, ROOT_CLOCK_RATE, PLL_RAW); | 1746 | return pll_rate(PRCM_PLLSOC0_FREQ, ROOT_CLOCK_RATE, PLL_RAW); |
1708 | else if (clock == PRCMU_PLLSOC1) | 1747 | else if (clock == PRCMU_PLLSOC1) |
1709 | return pll_rate(PRCM_PLLSOC1_FREQ, ROOT_CLOCK_RATE, PLL_RAW); | 1748 | return pll_rate(PRCM_PLLSOC1_FREQ, ROOT_CLOCK_RATE, PLL_RAW); |
1749 | else if (clock == PRCMU_ARMSS) | ||
1750 | return armss_rate(); | ||
1710 | else if (clock == PRCMU_PLLDDR) | 1751 | else if (clock == PRCMU_PLLDDR) |
1711 | return pll_rate(PRCM_PLLDDR_FREQ, ROOT_CLOCK_RATE, PLL_RAW); | 1752 | return pll_rate(PRCM_PLLDDR_FREQ, ROOT_CLOCK_RATE, PLL_RAW); |
1712 | else if (clock == PRCMU_PLLDSI) | 1753 | else if (clock == PRCMU_PLLDSI) |
@@ -2693,6 +2734,7 @@ void __init db8500_prcmu_early_init(void) | |||
2693 | handle_simple_irq); | 2734 | handle_simple_irq); |
2694 | set_irq_flags(irq, IRQF_VALID); | 2735 | set_irq_flags(irq, IRQF_VALID); |
2695 | } | 2736 | } |
2737 | compute_armss_rate(); | ||
2696 | } | 2738 | } |
2697 | 2739 | ||
2698 | static void __init init_prcm_registers(void) | 2740 | static void __init init_prcm_registers(void) |
diff --git a/drivers/mfd/dbx500-prcmu-regs.h b/drivers/mfd/dbx500-prcmu-regs.h index 23108a6e3167..79c76ebdba52 100644 --- a/drivers/mfd/dbx500-prcmu-regs.h +++ b/drivers/mfd/dbx500-prcmu-regs.h | |||
@@ -61,7 +61,8 @@ | |||
61 | #define PRCM_PLLARM_LOCKP_PRCM_PLLARM_LOCKP3 0x2 | 61 | #define PRCM_PLLARM_LOCKP_PRCM_PLLARM_LOCKP3 0x2 |
62 | 62 | ||
63 | #define PRCM_ARM_CHGCLKREQ (_PRCMU_BASE + 0x114) | 63 | #define PRCM_ARM_CHGCLKREQ (_PRCMU_BASE + 0x114) |
64 | #define PRCM_ARM_CHGCLKREQ_PRCM_ARM_CHGCLKREQ 0x1 | 64 | #define PRCM_ARM_CHGCLKREQ_PRCM_ARM_CHGCLKREQ BIT(0) |
65 | #define PRCM_ARM_CHGCLKREQ_PRCM_ARM_DIVSEL BIT(16) | ||
65 | 66 | ||
66 | #define PRCM_PLLARM_ENABLE (_PRCMU_BASE + 0x98) | 67 | #define PRCM_PLLARM_ENABLE (_PRCMU_BASE + 0x98) |
67 | #define PRCM_PLLARM_ENABLE_PRCM_PLLARM_ENABLE 0x1 | 68 | #define PRCM_PLLARM_ENABLE_PRCM_PLLARM_ENABLE 0x1 |
@@ -140,6 +141,7 @@ | |||
140 | /* PRCMU clock/PLL/reset registers */ | 141 | /* PRCMU clock/PLL/reset registers */ |
141 | #define PRCM_PLLSOC0_FREQ (_PRCMU_BASE + 0x080) | 142 | #define PRCM_PLLSOC0_FREQ (_PRCMU_BASE + 0x080) |
142 | #define PRCM_PLLSOC1_FREQ (_PRCMU_BASE + 0x084) | 143 | #define PRCM_PLLSOC1_FREQ (_PRCMU_BASE + 0x084) |
144 | #define PRCM_PLLARM_FREQ (_PRCMU_BASE + 0x088) | ||
143 | #define PRCM_PLLDDR_FREQ (_PRCMU_BASE + 0x08C) | 145 | #define PRCM_PLLDDR_FREQ (_PRCMU_BASE + 0x08C) |
144 | #define PRCM_PLL_FREQ_D_SHIFT 0 | 146 | #define PRCM_PLL_FREQ_D_SHIFT 0 |
145 | #define PRCM_PLL_FREQ_D_MASK BITS(0, 7) | 147 | #define PRCM_PLL_FREQ_D_MASK BITS(0, 7) |
diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c index c54e244ca0cf..f99d6299ec24 100644 --- a/drivers/mfd/mcp-sa11x0.c +++ b/drivers/mfd/mcp-sa11x0.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
26 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
27 | #include <mach/mcp.h> | 27 | #include <linux/platform_data/mfd-mcp-sa11x0.h> |
28 | 28 | ||
29 | #define DRIVER_NAME "sa11x0-mcp" | 29 | #define DRIVER_NAME "sa11x0-mcp" |
30 | 30 | ||
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index 5f58370ccf55..345960ca2fd8 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/regmap.h> | 26 | #include <linux/regmap.h> |
27 | #include <linux/regulator/of_regulator.h> | 27 | #include <linux/regulator/of_regulator.h> |
28 | #include <linux/regulator/machine.h> | ||
28 | 29 | ||
29 | #include <linux/mfd/core.h> | 30 | #include <linux/mfd/core.h> |
30 | #include <linux/mfd/tps6586x.h> | 31 | #include <linux/mfd/tps6586x.h> |
@@ -346,6 +347,7 @@ failed: | |||
346 | 347 | ||
347 | #ifdef CONFIG_OF | 348 | #ifdef CONFIG_OF |
348 | static struct of_regulator_match tps6586x_matches[] = { | 349 | static struct of_regulator_match tps6586x_matches[] = { |
350 | { .name = "sys", .driver_data = (void *)TPS6586X_ID_SYS }, | ||
349 | { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 }, | 351 | { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 }, |
350 | { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 }, | 352 | { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 }, |
351 | { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 }, | 353 | { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 }, |
@@ -369,6 +371,7 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien | |||
369 | struct tps6586x_platform_data *pdata; | 371 | struct tps6586x_platform_data *pdata; |
370 | struct tps6586x_subdev_info *devs; | 372 | struct tps6586x_subdev_info *devs; |
371 | struct device_node *regs; | 373 | struct device_node *regs; |
374 | const char *sys_rail_name = NULL; | ||
372 | unsigned int count; | 375 | unsigned int count; |
373 | unsigned int i, j; | 376 | unsigned int i, j; |
374 | int err; | 377 | int err; |
@@ -391,12 +394,22 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien | |||
391 | return NULL; | 394 | return NULL; |
392 | 395 | ||
393 | for (i = 0, j = 0; i < num && j < count; i++) { | 396 | for (i = 0, j = 0; i < num && j < count; i++) { |
397 | struct regulator_init_data *reg_idata; | ||
398 | |||
394 | if (!tps6586x_matches[i].init_data) | 399 | if (!tps6586x_matches[i].init_data) |
395 | continue; | 400 | continue; |
396 | 401 | ||
402 | reg_idata = tps6586x_matches[i].init_data; | ||
397 | devs[j].name = "tps6586x-regulator"; | 403 | devs[j].name = "tps6586x-regulator"; |
398 | devs[j].platform_data = tps6586x_matches[i].init_data; | 404 | devs[j].platform_data = tps6586x_matches[i].init_data; |
399 | devs[j].id = (int)tps6586x_matches[i].driver_data; | 405 | devs[j].id = (int)tps6586x_matches[i].driver_data; |
406 | if (devs[j].id == TPS6586X_ID_SYS) | ||
407 | sys_rail_name = reg_idata->constraints.name; | ||
408 | |||
409 | if ((devs[j].id == TPS6586X_ID_LDO_5) || | ||
410 | (devs[j].id == TPS6586X_ID_LDO_RTC)) | ||
411 | reg_idata->supply_regulator = sys_rail_name; | ||
412 | |||
400 | devs[j].of_node = tps6586x_matches[i].of_node; | 413 | devs[j].of_node = tps6586x_matches[i].of_node; |
401 | j++; | 414 | j++; |
402 | } | 415 | } |
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c index 7cf6c624bf73..3dfd3473269d 100644 --- a/drivers/mmc/host/davinci_mmc.c +++ b/drivers/mmc/host/davinci_mmc.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
34 | #include <linux/mmc/mmc.h> | 34 | #include <linux/mmc/mmc.h> |
35 | 35 | ||
36 | #include <mach/mmc.h> | 36 | #include <linux/platform_data/mmc-davinci.h> |
37 | #include <mach/edma.h> | 37 | #include <mach/edma.h> |
38 | 38 | ||
39 | /* | 39 | /* |
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c index 1d14cda95e56..7c0af0e80047 100644 --- a/drivers/mmc/host/msm_sdcc.c +++ b/drivers/mmc/host/msm_sdcc.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <asm/div64.h> | 42 | #include <asm/div64.h> |
43 | #include <asm/sizes.h> | 43 | #include <asm/sizes.h> |
44 | 44 | ||
45 | #include <mach/mmc.h> | 45 | #include <linux/platform_data/mmc-msm_sdcc.h> |
46 | #include <mach/msm_iomap.h> | 46 | #include <mach/msm_iomap.h> |
47 | #include <mach/dma.h> | 47 | #include <mach/dma.h> |
48 | #include <mach/clk.h> | 48 | #include <mach/clk.h> |
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index a61cb5fca22d..de4c20b3936c 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include <asm/sizes.h> | 26 | #include <asm/sizes.h> |
27 | #include <asm/unaligned.h> | 27 | #include <asm/unaligned.h> |
28 | #include <plat/mvsdio.h> | 28 | #include <linux/platform_data/mmc-mvsdio.h> |
29 | 29 | ||
30 | #include "mvsdio.h" | 30 | #include "mvsdio.h" |
31 | 31 | ||
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 28ed52d58f7f..7b1161de01d6 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c | |||
@@ -38,9 +38,9 @@ | |||
38 | #include <asm/dma.h> | 38 | #include <asm/dma.h> |
39 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
40 | #include <asm/sizes.h> | 40 | #include <asm/sizes.h> |
41 | #include <mach/mmc.h> | 41 | #include <linux/platform_data/mmc-mxcmmc.h> |
42 | 42 | ||
43 | #include <mach/dma.h> | 43 | #include <linux/platform_data/dma-imx.h> |
44 | #include <mach/hardware.h> | 44 | #include <mach/hardware.h> |
45 | 45 | ||
46 | #define DRIVER_NAME "mxc-mmc" | 46 | #define DRIVER_NAME "mxc-mmc" |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 87c0293a1eef..c6259a829544 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <plat/mmc.h> | 36 | #include <plat/mmc.h> |
37 | #include <asm/gpio.h> | 37 | #include <asm/gpio.h> |
38 | #include <plat/dma.h> | 38 | #include <plat/dma.h> |
39 | #include <plat/mux.h> | ||
40 | #include <plat/fpga.h> | 39 | #include <plat/fpga.h> |
41 | 40 | ||
42 | #define OMAP_MMC_REG_CMD 0x00 | 41 | #define OMAP_MMC_REG_CMD 0x00 |
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index cb2dc0e75ba7..ca3915dac03d 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
37 | #include <mach/dma.h> | 37 | #include <mach/dma.h> |
38 | #include <mach/mmc.h> | 38 | #include <linux/platform_data/mmc-pxamci.h> |
39 | 39 | ||
40 | #include "pxamci.h" | 40 | #include "pxamci.h" |
41 | 41 | ||
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index bd5a5cce122c..4638ddab97b8 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #include <mach/regs-sdi.h> | 28 | #include <mach/regs-sdi.h> |
29 | 29 | ||
30 | #include <plat/mci.h> | 30 | #include <linux/platform_data/mmc-s3cmci.h> |
31 | 31 | ||
32 | #include "s3cmci.h" | 32 | #include "s3cmci.h" |
33 | 33 | ||
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index e23f8134591c..c4c504c4802b 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/of_device.h> | 25 | #include <linux/of_device.h> |
26 | #include <linux/of_gpio.h> | 26 | #include <linux/of_gpio.h> |
27 | #include <linux/pinctrl/consumer.h> | 27 | #include <linux/pinctrl/consumer.h> |
28 | #include <mach/esdhc.h> | 28 | #include <linux/platform_data/mmc-esdhc-imx.h> |
29 | #include "sdhci-pltfm.h" | 29 | #include "sdhci-pltfm.h" |
30 | #include "sdhci-esdhc.h" | 30 | #include "sdhci-esdhc.h" |
31 | 31 | ||
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 0810ccc23d7e..d43e7462941f 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/gpio.h> | 28 | #include <asm/gpio.h> |
29 | 29 | ||
30 | #include <mach/gpio-tegra.h> | 30 | #include <mach/gpio-tegra.h> |
31 | #include <mach/sdhci.h> | 31 | #include <linux/platform_data/mmc-sdhci-tegra.h> |
32 | 32 | ||
33 | #include "sdhci-pltfm.h" | 33 | #include "sdhci-pltfm.h" |
34 | 34 | ||
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c index 78a524b49357..a7040af08536 100644 --- a/drivers/mtd/nand/ams-delta.c +++ b/drivers/mtd/nand/ams-delta.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <asm/io.h> | 29 | #include <asm/io.h> |
30 | #include <asm/sizes.h> | 30 | #include <asm/sizes.h> |
31 | 31 | ||
32 | #include <plat/board-ams-delta.h> | 32 | #include <mach/board-ams-delta.h> |
33 | 33 | ||
34 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
35 | 35 | ||
diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c index c855e7cd337b..d0d1bd4d0e7d 100644 --- a/drivers/mtd/nand/bcm_umi_nand.c +++ b/drivers/mtd/nand/bcm_umi_nand.c | |||
@@ -249,20 +249,20 @@ static int nand_dev_ready(struct mtd_info *mtd) | |||
249 | int bcm_umi_nand_inithw(void) | 249 | int bcm_umi_nand_inithw(void) |
250 | { | 250 | { |
251 | /* Configure nand timing parameters */ | 251 | /* Configure nand timing parameters */ |
252 | REG_UMI_NAND_TCR &= ~0x7ffff; | 252 | writel(readl(®_UMI_NAND_TCR) & ~0x7ffff, ®_UMI_NAND_TCR); |
253 | REG_UMI_NAND_TCR |= HW_CFG_NAND_TCR; | 253 | writel(readl(®_UMI_NAND_TCR) | HW_CFG_NAND_TCR, ®_UMI_NAND_TCR); |
254 | 254 | ||
255 | #if !defined(CONFIG_MTD_NAND_BCM_UMI_HWCS) | 255 | #if !defined(CONFIG_MTD_NAND_BCM_UMI_HWCS) |
256 | /* enable software control of CS */ | 256 | /* enable software control of CS */ |
257 | REG_UMI_NAND_TCR |= REG_UMI_NAND_TCR_CS_SWCTRL; | 257 | writel(readl(®_UMI_NAND_TCR) | REG_UMI_NAND_TCR_CS_SWCTRL, ®_UMI_NAND_TCR); |
258 | #endif | 258 | #endif |
259 | 259 | ||
260 | /* keep NAND chip select asserted */ | 260 | /* keep NAND chip select asserted */ |
261 | REG_UMI_NAND_RCSR |= REG_UMI_NAND_RCSR_CS_ASSERTED; | 261 | writel(readl(®_UMI_NAND_RCSR) | REG_UMI_NAND_RCSR_CS_ASSERTED, ®_UMI_NAND_RCSR); |
262 | 262 | ||
263 | REG_UMI_NAND_TCR &= ~REG_UMI_NAND_TCR_WORD16; | 263 | writel(readl(®_UMI_NAND_TCR) & ~REG_UMI_NAND_TCR_WORD16, ®_UMI_NAND_TCR); |
264 | /* enable writes to flash */ | 264 | /* enable writes to flash */ |
265 | REG_UMI_MMD_ICR |= REG_UMI_MMD_ICR_FLASH_WP; | 265 | writel(readl(®_UMI_MMD_ICR) | REG_UMI_MMD_ICR_FLASH_WP, ®_UMI_MMD_ICR); |
266 | 266 | ||
267 | writel(NAND_CMD_RESET, bcm_umi_io_base + REG_NAND_CMD_OFFSET); | 267 | writel(NAND_CMD_RESET, bcm_umi_io_base + REG_NAND_CMD_OFFSET); |
268 | nand_bcm_umi_wait_till_ready(); | 268 | nand_bcm_umi_wait_till_ready(); |
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c index d94b03c207af..f1deb1ee2c95 100644 --- a/drivers/mtd/nand/davinci_nand.c +++ b/drivers/mtd/nand/davinci_nand.c | |||
@@ -34,8 +34,8 @@ | |||
34 | #include <linux/mtd/partitions.h> | 34 | #include <linux/mtd/partitions.h> |
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | 36 | ||
37 | #include <mach/nand.h> | 37 | #include <linux/platform_data/mtd-davinci.h> |
38 | #include <mach/aemif.h> | 38 | #include <linux/platform_data/mtd-davinci-aemif.h> |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * This is a device driver for the NAND flash controller found on the | 41 | * This is a device driver for the NAND flash controller found on the |
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 6acc790c2fbb..5683604967d7 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/of_mtd.h> | 36 | #include <linux/of_mtd.h> |
37 | 37 | ||
38 | #include <asm/mach/flash.h> | 38 | #include <asm/mach/flash.h> |
39 | #include <mach/mxc_nand.h> | 39 | #include <linux/platform_data/mtd-mxc_nand.h> |
40 | #include <mach/hardware.h> | 40 | #include <mach/hardware.h> |
41 | 41 | ||
42 | #define DRIVER_NAME "mxc_nand" | 42 | #define DRIVER_NAME "mxc_nand" |
diff --git a/drivers/mtd/nand/nand_bcm_umi.h b/drivers/mtd/nand/nand_bcm_umi.h index 198b304d6f72..d90186684db8 100644 --- a/drivers/mtd/nand/nand_bcm_umi.h +++ b/drivers/mtd/nand/nand_bcm_umi.h | |||
@@ -17,7 +17,7 @@ | |||
17 | /* ---- Include Files ---------------------------------------------------- */ | 17 | /* ---- Include Files ---------------------------------------------------- */ |
18 | #include <mach/reg_umi.h> | 18 | #include <mach/reg_umi.h> |
19 | #include <mach/reg_nand.h> | 19 | #include <mach/reg_nand.h> |
20 | #include <cfg_global.h> | 20 | #include <mach/cfg_global.h> |
21 | 21 | ||
22 | /* ---- Constants and Types ---------------------------------------------- */ | 22 | /* ---- Constants and Types ---------------------------------------------- */ |
23 | #if (CFG_GLOBAL_CHIP_FAMILY == CFG_GLOBAL_CHIP_FAMILY_BCMRING) | 23 | #if (CFG_GLOBAL_CHIP_FAMILY == CFG_GLOBAL_CHIP_FAMILY_BCMRING) |
@@ -48,7 +48,7 @@ int nand_bcm_umi_bch_correct_page(uint8_t *datap, uint8_t *readEccData, | |||
48 | /* Check in device is ready */ | 48 | /* Check in device is ready */ |
49 | static inline int nand_bcm_umi_dev_ready(void) | 49 | static inline int nand_bcm_umi_dev_ready(void) |
50 | { | 50 | { |
51 | return REG_UMI_NAND_RCSR & REG_UMI_NAND_RCSR_RDY; | 51 | return readl(®_UMI_NAND_RCSR) & REG_UMI_NAND_RCSR_RDY; |
52 | } | 52 | } |
53 | 53 | ||
54 | /* Wait until device is ready */ | 54 | /* Wait until device is ready */ |
@@ -62,10 +62,11 @@ static inline void nand_bcm_umi_wait_till_ready(void) | |||
62 | static inline void nand_bcm_umi_hamming_enable_hwecc(void) | 62 | static inline void nand_bcm_umi_hamming_enable_hwecc(void) |
63 | { | 63 | { |
64 | /* disable and reset ECC, 512 byte page */ | 64 | /* disable and reset ECC, 512 byte page */ |
65 | REG_UMI_NAND_ECC_CSR &= ~(REG_UMI_NAND_ECC_CSR_ECC_ENABLE | | 65 | writel(readl(®_UMI_NAND_ECC_CSR) & ~(REG_UMI_NAND_ECC_CSR_ECC_ENABLE | |
66 | REG_UMI_NAND_ECC_CSR_256BYTE); | 66 | REG_UMI_NAND_ECC_CSR_256BYTE), ®_UMI_NAND_ECC_CSR); |
67 | /* enable ECC */ | 67 | /* enable ECC */ |
68 | REG_UMI_NAND_ECC_CSR |= REG_UMI_NAND_ECC_CSR_ECC_ENABLE; | 68 | writel(readl(®_UMI_NAND_ECC_CSR) | REG_UMI_NAND_ECC_CSR_ECC_ENABLE, |
69 | ®_UMI_NAND_ECC_CSR); | ||
69 | } | 70 | } |
70 | 71 | ||
71 | #if NAND_ECC_BCH | 72 | #if NAND_ECC_BCH |
@@ -76,18 +77,18 @@ static inline void nand_bcm_umi_hamming_enable_hwecc(void) | |||
76 | static inline void nand_bcm_umi_bch_enable_read_hwecc(void) | 77 | static inline void nand_bcm_umi_bch_enable_read_hwecc(void) |
77 | { | 78 | { |
78 | /* disable and reset ECC */ | 79 | /* disable and reset ECC */ |
79 | REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID; | 80 | writel(REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID, ®_UMI_BCH_CTRL_STATUS); |
80 | /* Turn on ECC */ | 81 | /* Turn on ECC */ |
81 | REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN; | 82 | writel(REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN, ®_UMI_BCH_CTRL_STATUS); |
82 | } | 83 | } |
83 | 84 | ||
84 | /* Enable BCH Write ECC */ | 85 | /* Enable BCH Write ECC */ |
85 | static inline void nand_bcm_umi_bch_enable_write_hwecc(void) | 86 | static inline void nand_bcm_umi_bch_enable_write_hwecc(void) |
86 | { | 87 | { |
87 | /* disable and reset ECC */ | 88 | /* disable and reset ECC */ |
88 | REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID; | 89 | writel(REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID, ®_UMI_BCH_CTRL_STATUS); |
89 | /* Turn on ECC */ | 90 | /* Turn on ECC */ |
90 | REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_WR_EN; | 91 | writel(REG_UMI_BCH_CTRL_STATUS_ECC_WR_EN, ®_UMI_BCH_CTRL_STATUS); |
91 | } | 92 | } |
92 | 93 | ||
93 | /* Config number of BCH ECC bytes */ | 94 | /* Config number of BCH ECC bytes */ |
@@ -99,9 +100,9 @@ static inline void nand_bcm_umi_bch_config_ecc(uint8_t numEccBytes) | |||
99 | uint32_t numBits = numEccBytes * 8; | 100 | uint32_t numBits = numEccBytes * 8; |
100 | 101 | ||
101 | /* disable and reset ECC */ | 102 | /* disable and reset ECC */ |
102 | REG_UMI_BCH_CTRL_STATUS = | 103 | writel(REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID | |
103 | REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID | | 104 | REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID, |
104 | REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID; | 105 | ®_UMI_BCH_CTRL_STATUS); |
105 | 106 | ||
106 | /* Every correctible bit requires 13 ECC bits */ | 107 | /* Every correctible bit requires 13 ECC bits */ |
107 | tValue = (uint32_t) (numBits / ECC_BITS_PER_CORRECTABLE_BIT); | 108 | tValue = (uint32_t) (numBits / ECC_BITS_PER_CORRECTABLE_BIT); |
@@ -113,23 +114,21 @@ static inline void nand_bcm_umi_bch_config_ecc(uint8_t numEccBytes) | |||
113 | kValue = nValue - (tValue * ECC_BITS_PER_CORRECTABLE_BIT); | 114 | kValue = nValue - (tValue * ECC_BITS_PER_CORRECTABLE_BIT); |
114 | 115 | ||
115 | /* Write the settings */ | 116 | /* Write the settings */ |
116 | REG_UMI_BCH_N = nValue; | 117 | writel(nValue, ®_UMI_BCH_N); |
117 | REG_UMI_BCH_T = tValue; | 118 | writel(tValue, ®_UMI_BCH_T); |
118 | REG_UMI_BCH_K = kValue; | 119 | writel(kValue, ®_UMI_BCH_K); |
119 | } | 120 | } |
120 | 121 | ||
121 | /* Pause during ECC read calculation to skip bytes in OOB */ | 122 | /* Pause during ECC read calculation to skip bytes in OOB */ |
122 | static inline void nand_bcm_umi_bch_pause_read_ecc_calc(void) | 123 | static inline void nand_bcm_umi_bch_pause_read_ecc_calc(void) |
123 | { | 124 | { |
124 | REG_UMI_BCH_CTRL_STATUS = | 125 | writel(REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN | REG_UMI_BCH_CTRL_STATUS_PAUSE_ECC_DEC, ®_UMI_BCH_CTRL_STATUS); |
125 | REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN | | ||
126 | REG_UMI_BCH_CTRL_STATUS_PAUSE_ECC_DEC; | ||
127 | } | 126 | } |
128 | 127 | ||
129 | /* Resume during ECC read calculation after skipping bytes in OOB */ | 128 | /* Resume during ECC read calculation after skipping bytes in OOB */ |
130 | static inline void nand_bcm_umi_bch_resume_read_ecc_calc(void) | 129 | static inline void nand_bcm_umi_bch_resume_read_ecc_calc(void) |
131 | { | 130 | { |
132 | REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN; | 131 | writel(REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN, ®_UMI_BCH_CTRL_STATUS); |
133 | } | 132 | } |
134 | 133 | ||
135 | /* Poll read ECC calc to check when hardware completes */ | 134 | /* Poll read ECC calc to check when hardware completes */ |
@@ -139,7 +138,7 @@ static inline uint32_t nand_bcm_umi_bch_poll_read_ecc_calc(void) | |||
139 | 138 | ||
140 | do { | 139 | do { |
141 | /* wait for ECC to be valid */ | 140 | /* wait for ECC to be valid */ |
142 | regVal = REG_UMI_BCH_CTRL_STATUS; | 141 | regVal = readl(®_UMI_BCH_CTRL_STATUS); |
143 | } while ((regVal & REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID) == 0); | 142 | } while ((regVal & REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID) == 0); |
144 | 143 | ||
145 | return regVal; | 144 | return regVal; |
@@ -149,7 +148,7 @@ static inline uint32_t nand_bcm_umi_bch_poll_read_ecc_calc(void) | |||
149 | static inline void nand_bcm_umi_bch_poll_write_ecc_calc(void) | 148 | static inline void nand_bcm_umi_bch_poll_write_ecc_calc(void) |
150 | { | 149 | { |
151 | /* wait for ECC to be valid */ | 150 | /* wait for ECC to be valid */ |
152 | while ((REG_UMI_BCH_CTRL_STATUS & REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID) | 151 | while ((readl(®_UMI_BCH_CTRL_STATUS) & REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID) |
153 | == 0) | 152 | == 0) |
154 | ; | 153 | ; |
155 | } | 154 | } |
@@ -170,9 +169,9 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, | |||
170 | if (pageSize != NAND_DATA_ACCESS_SIZE) { | 169 | if (pageSize != NAND_DATA_ACCESS_SIZE) { |
171 | /* skip BI */ | 170 | /* skip BI */ |
172 | #if defined(__KERNEL__) && !defined(STANDALONE) | 171 | #if defined(__KERNEL__) && !defined(STANDALONE) |
173 | *oobp++ = REG_NAND_DATA8; | 172 | *oobp++ = readb(®_NAND_DATA8); |
174 | #else | 173 | #else |
175 | REG_NAND_DATA8; | 174 | readb(®_NAND_DATA8); |
176 | #endif | 175 | #endif |
177 | numToRead--; | 176 | numToRead--; |
178 | } | 177 | } |
@@ -180,9 +179,9 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, | |||
180 | while (numToRead > numEccBytes) { | 179 | while (numToRead > numEccBytes) { |
181 | /* skip free oob region */ | 180 | /* skip free oob region */ |
182 | #if defined(__KERNEL__) && !defined(STANDALONE) | 181 | #if defined(__KERNEL__) && !defined(STANDALONE) |
183 | *oobp++ = REG_NAND_DATA8; | 182 | *oobp++ = readb(®_NAND_DATA8); |
184 | #else | 183 | #else |
185 | REG_NAND_DATA8; | 184 | readb(®_NAND_DATA8); |
186 | #endif | 185 | #endif |
187 | numToRead--; | 186 | numToRead--; |
188 | } | 187 | } |
@@ -193,11 +192,11 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, | |||
193 | 192 | ||
194 | while (numToRead > 11) { | 193 | while (numToRead > 11) { |
195 | #if defined(__KERNEL__) && !defined(STANDALONE) | 194 | #if defined(__KERNEL__) && !defined(STANDALONE) |
196 | *oobp = REG_NAND_DATA8; | 195 | *oobp = readb(®_NAND_DATA8); |
197 | eccCalc[eccPos++] = *oobp; | 196 | eccCalc[eccPos++] = *oobp; |
198 | oobp++; | 197 | oobp++; |
199 | #else | 198 | #else |
200 | eccCalc[eccPos++] = REG_NAND_DATA8; | 199 | eccCalc[eccPos++] = readb(®_NAND_DATA8); |
201 | #endif | 200 | #endif |
202 | numToRead--; | 201 | numToRead--; |
203 | } | 202 | } |
@@ -207,9 +206,9 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, | |||
207 | if (numToRead == 11) { | 206 | if (numToRead == 11) { |
208 | /* read BI */ | 207 | /* read BI */ |
209 | #if defined(__KERNEL__) && !defined(STANDALONE) | 208 | #if defined(__KERNEL__) && !defined(STANDALONE) |
210 | *oobp++ = REG_NAND_DATA8; | 209 | *oobp++ = readb(®_NAND_DATA8); |
211 | #else | 210 | #else |
212 | REG_NAND_DATA8; | 211 | readb(®_NAND_DATA8); |
213 | #endif | 212 | #endif |
214 | numToRead--; | 213 | numToRead--; |
215 | } | 214 | } |
@@ -219,11 +218,11 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, | |||
219 | nand_bcm_umi_bch_resume_read_ecc_calc(); | 218 | nand_bcm_umi_bch_resume_read_ecc_calc(); |
220 | while (numToRead) { | 219 | while (numToRead) { |
221 | #if defined(__KERNEL__) && !defined(STANDALONE) | 220 | #if defined(__KERNEL__) && !defined(STANDALONE) |
222 | *oobp = REG_NAND_DATA8; | 221 | *oobp = readb(®_NAND_DATA8); |
223 | eccCalc[eccPos++] = *oobp; | 222 | eccCalc[eccPos++] = *oobp; |
224 | oobp++; | 223 | oobp++; |
225 | #else | 224 | #else |
226 | eccCalc[eccPos++] = REG_NAND_DATA8; | 225 | eccCalc[eccPos++] = readb(®_NAND_DATA8); |
227 | #endif | 226 | #endif |
228 | numToRead--; | 227 | numToRead--; |
229 | } | 228 | } |
@@ -255,7 +254,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, | |||
255 | if (pageSize == NAND_DATA_ACCESS_SIZE) { | 254 | if (pageSize == NAND_DATA_ACCESS_SIZE) { |
256 | /* Now fill in the ECC bytes */ | 255 | /* Now fill in the ECC bytes */ |
257 | if (numEccBytes >= 13) | 256 | if (numEccBytes >= 13) |
258 | eccVal = REG_UMI_BCH_WR_ECC_3; | 257 | eccVal = readl(®_UMI_BCH_WR_ECC_3); |
259 | 258 | ||
260 | /* Usually we skip CM in oob[0,1] */ | 259 | /* Usually we skip CM in oob[0,1] */ |
261 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[0], | 260 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[0], |
@@ -268,7 +267,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, | |||
268 | eccVal & 0xff); /* ECC 12 */ | 267 | eccVal & 0xff); /* ECC 12 */ |
269 | 268 | ||
270 | if (numEccBytes >= 9) | 269 | if (numEccBytes >= 9) |
271 | eccVal = REG_UMI_BCH_WR_ECC_2; | 270 | eccVal = readl(®_UMI_BCH_WR_ECC_2); |
272 | 271 | ||
273 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[3], | 272 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[3], |
274 | (eccVal >> 24) & 0xff); /* ECC11 */ | 273 | (eccVal >> 24) & 0xff); /* ECC11 */ |
@@ -281,7 +280,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, | |||
281 | 280 | ||
282 | /* Now fill in the ECC bytes */ | 281 | /* Now fill in the ECC bytes */ |
283 | if (numEccBytes >= 13) | 282 | if (numEccBytes >= 13) |
284 | eccVal = REG_UMI_BCH_WR_ECC_3; | 283 | eccVal = readl(®_UMI_BCH_WR_ECC_3); |
285 | 284 | ||
286 | /* Usually skip CM in oob[1,2] */ | 285 | /* Usually skip CM in oob[1,2] */ |
287 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[1], | 286 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[1], |
@@ -294,7 +293,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, | |||
294 | eccVal & 0xff); /* ECC12 */ | 293 | eccVal & 0xff); /* ECC12 */ |
295 | 294 | ||
296 | if (numEccBytes >= 9) | 295 | if (numEccBytes >= 9) |
297 | eccVal = REG_UMI_BCH_WR_ECC_2; | 296 | eccVal = readl(®_UMI_BCH_WR_ECC_2); |
298 | 297 | ||
299 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[4], | 298 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[4], |
300 | (eccVal >> 24) & 0xff); /* ECC11 */ | 299 | (eccVal >> 24) & 0xff); /* ECC11 */ |
@@ -309,7 +308,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, | |||
309 | eccVal & 0xff); /* ECC8 */ | 308 | eccVal & 0xff); /* ECC8 */ |
310 | 309 | ||
311 | if (numEccBytes >= 5) | 310 | if (numEccBytes >= 5) |
312 | eccVal = REG_UMI_BCH_WR_ECC_1; | 311 | eccVal = readl(®_UMI_BCH_WR_ECC_1); |
313 | 312 | ||
314 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 8, &oobp[8], | 313 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 8, &oobp[8], |
315 | (eccVal >> 24) & 0xff); /* ECC7 */ | 314 | (eccVal >> 24) & 0xff); /* ECC7 */ |
@@ -321,7 +320,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, | |||
321 | eccVal & 0xff); /* ECC4 */ | 320 | eccVal & 0xff); /* ECC4 */ |
322 | 321 | ||
323 | if (numEccBytes >= 1) | 322 | if (numEccBytes >= 1) |
324 | eccVal = REG_UMI_BCH_WR_ECC_0; | 323 | eccVal = readl(®_UMI_BCH_WR_ECC_0); |
325 | 324 | ||
326 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 4, &oobp[12], | 325 | NAND_BCM_UMI_ECC_WRITE(numEccBytes, 4, &oobp[12], |
327 | (eccVal >> 24) & 0xff); /* ECC3 */ | 326 | (eccVal >> 24) & 0xff); /* ECC3 */ |
diff --git a/drivers/mtd/nand/nomadik_nand.c b/drivers/mtd/nand/nomadik_nand.c index a86aa812ca13..9ee0c4edfacf 100644 --- a/drivers/mtd/nand/nomadik_nand.c +++ b/drivers/mtd/nand/nomadik_nand.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/mtd/partitions.h> | 31 | #include <linux/mtd/partitions.h> |
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <mach/nand.h> | 34 | #include <linux/platform_data/mtd-nomadik-nand.h> |
35 | #include <mach/fsmc.h> | 35 | #include <mach/fsmc.h> |
36 | 36 | ||
37 | #include <mtd/mtd-abi.h> | 37 | #include <mtd/mtd-abi.h> |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 27293e328517..fc8111278d12 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | #include <plat/dma.h> | 30 | #include <plat/dma.h> |
31 | #include <plat/gpmc.h> | 31 | #include <plat/gpmc.h> |
32 | #include <plat/nand.h> | 32 | #include <linux/platform_data/mtd-nand-omap2.h> |
33 | 33 | ||
34 | #define DRIVER_NAME "omap2-nand" | 34 | #define DRIVER_NAME "omap2-nand" |
35 | #define OMAP_NAND_TIMEOUT_MS 5000 | 35 | #define OMAP_NAND_TIMEOUT_MS 5000 |
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index fc5a868c436e..131b58a133f1 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <asm/sizes.h> | 23 | #include <asm/sizes.h> |
24 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
25 | #include <plat/orion_nand.h> | 25 | #include <linux/platform_data/mtd-orion_nand.h> |
26 | 26 | ||
27 | static void orion_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) | 27 | static void orion_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) |
28 | { | 28 | { |
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 252aaefcacfa..c45227173efd 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -22,9 +22,11 @@ | |||
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/of.h> | ||
26 | #include <linux/of_device.h> | ||
25 | 27 | ||
26 | #include <mach/dma.h> | 28 | #include <mach/dma.h> |
27 | #include <plat/pxa3xx_nand.h> | 29 | #include <linux/platform_data/mtd-nand-pxa3xx.h> |
28 | 30 | ||
29 | #define CHIP_DELAY_TIMEOUT (2 * HZ/10) | 31 | #define CHIP_DELAY_TIMEOUT (2 * HZ/10) |
30 | #define NAND_STOP_DELAY (2 * HZ/50) | 32 | #define NAND_STOP_DELAY (2 * HZ/50) |
@@ -1032,7 +1034,7 @@ static int alloc_nand_resource(struct platform_device *pdev) | |||
1032 | struct pxa3xx_nand_platform_data *pdata; | 1034 | struct pxa3xx_nand_platform_data *pdata; |
1033 | struct pxa3xx_nand_info *info; | 1035 | struct pxa3xx_nand_info *info; |
1034 | struct pxa3xx_nand_host *host; | 1036 | struct pxa3xx_nand_host *host; |
1035 | struct nand_chip *chip; | 1037 | struct nand_chip *chip = NULL; |
1036 | struct mtd_info *mtd; | 1038 | struct mtd_info *mtd; |
1037 | struct resource *r; | 1039 | struct resource *r; |
1038 | int ret, irq, cs; | 1040 | int ret, irq, cs; |
@@ -1081,21 +1083,31 @@ static int alloc_nand_resource(struct platform_device *pdev) | |||
1081 | } | 1083 | } |
1082 | clk_enable(info->clk); | 1084 | clk_enable(info->clk); |
1083 | 1085 | ||
1084 | r = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 1086 | /* |
1085 | if (r == NULL) { | 1087 | * This is a dirty hack to make this driver work from devicetree |
1086 | dev_err(&pdev->dev, "no resource defined for data DMA\n"); | 1088 | * bindings. It can be removed once we have a prober DMA controller |
1087 | ret = -ENXIO; | 1089 | * framework for DT. |
1088 | goto fail_put_clk; | 1090 | */ |
1089 | } | 1091 | if (pdev->dev.of_node && cpu_is_pxa3xx()) { |
1090 | info->drcmr_dat = r->start; | 1092 | info->drcmr_dat = 97; |
1093 | info->drcmr_cmd = 99; | ||
1094 | } else { | ||
1095 | r = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
1096 | if (r == NULL) { | ||
1097 | dev_err(&pdev->dev, "no resource defined for data DMA\n"); | ||
1098 | ret = -ENXIO; | ||
1099 | goto fail_put_clk; | ||
1100 | } | ||
1101 | info->drcmr_dat = r->start; | ||
1091 | 1102 | ||
1092 | r = platform_get_resource(pdev, IORESOURCE_DMA, 1); | 1103 | r = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
1093 | if (r == NULL) { | 1104 | if (r == NULL) { |
1094 | dev_err(&pdev->dev, "no resource defined for command DMA\n"); | 1105 | dev_err(&pdev->dev, "no resource defined for command DMA\n"); |
1095 | ret = -ENXIO; | 1106 | ret = -ENXIO; |
1096 | goto fail_put_clk; | 1107 | goto fail_put_clk; |
1108 | } | ||
1109 | info->drcmr_cmd = r->start; | ||
1097 | } | 1110 | } |
1098 | info->drcmr_cmd = r->start; | ||
1099 | 1111 | ||
1100 | irq = platform_get_irq(pdev, 0); | 1112 | irq = platform_get_irq(pdev, 0); |
1101 | if (irq < 0) { | 1113 | if (irq < 0) { |
@@ -1200,12 +1212,55 @@ static int pxa3xx_nand_remove(struct platform_device *pdev) | |||
1200 | return 0; | 1212 | return 0; |
1201 | } | 1213 | } |
1202 | 1214 | ||
1215 | #ifdef CONFIG_OF | ||
1216 | static struct of_device_id pxa3xx_nand_dt_ids[] = { | ||
1217 | { .compatible = "marvell,pxa3xx-nand" }, | ||
1218 | {} | ||
1219 | }; | ||
1220 | MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids); | ||
1221 | |||
1222 | static int pxa3xx_nand_probe_dt(struct platform_device *pdev) | ||
1223 | { | ||
1224 | struct pxa3xx_nand_platform_data *pdata; | ||
1225 | struct device_node *np = pdev->dev.of_node; | ||
1226 | const struct of_device_id *of_id = | ||
1227 | of_match_device(pxa3xx_nand_dt_ids, &pdev->dev); | ||
1228 | |||
1229 | if (!of_id) | ||
1230 | return 0; | ||
1231 | |||
1232 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
1233 | if (!pdata) | ||
1234 | return -ENOMEM; | ||
1235 | |||
1236 | if (of_get_property(np, "marvell,nand-enable-arbiter", NULL)) | ||
1237 | pdata->enable_arbiter = 1; | ||
1238 | if (of_get_property(np, "marvell,nand-keep-config", NULL)) | ||
1239 | pdata->keep_config = 1; | ||
1240 | of_property_read_u32(np, "num-cs", &pdata->num_cs); | ||
1241 | |||
1242 | pdev->dev.platform_data = pdata; | ||
1243 | |||
1244 | return 0; | ||
1245 | } | ||
1246 | #else | ||
1247 | static inline int pxa3xx_nand_probe_dt(struct platform_device *pdev) | ||
1248 | { | ||
1249 | return 0; | ||
1250 | } | ||
1251 | #endif | ||
1252 | |||
1203 | static int pxa3xx_nand_probe(struct platform_device *pdev) | 1253 | static int pxa3xx_nand_probe(struct platform_device *pdev) |
1204 | { | 1254 | { |
1205 | struct pxa3xx_nand_platform_data *pdata; | 1255 | struct pxa3xx_nand_platform_data *pdata; |
1256 | struct mtd_part_parser_data ppdata = {}; | ||
1206 | struct pxa3xx_nand_info *info; | 1257 | struct pxa3xx_nand_info *info; |
1207 | int ret, cs, probe_success; | 1258 | int ret, cs, probe_success; |
1208 | 1259 | ||
1260 | ret = pxa3xx_nand_probe_dt(pdev); | ||
1261 | if (ret) | ||
1262 | return ret; | ||
1263 | |||
1209 | pdata = pdev->dev.platform_data; | 1264 | pdata = pdev->dev.platform_data; |
1210 | if (!pdata) { | 1265 | if (!pdata) { |
1211 | dev_err(&pdev->dev, "no platform data defined\n"); | 1266 | dev_err(&pdev->dev, "no platform data defined\n"); |
@@ -1229,8 +1284,9 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) | |||
1229 | continue; | 1284 | continue; |
1230 | } | 1285 | } |
1231 | 1286 | ||
1287 | ppdata.of_node = pdev->dev.of_node; | ||
1232 | ret = mtd_device_parse_register(info->host[cs]->mtd, NULL, | 1288 | ret = mtd_device_parse_register(info->host[cs]->mtd, NULL, |
1233 | NULL, pdata->parts[cs], | 1289 | &ppdata, pdata->parts[cs], |
1234 | pdata->nr_parts[cs]); | 1290 | pdata->nr_parts[cs]); |
1235 | if (!ret) | 1291 | if (!ret) |
1236 | probe_success = 1; | 1292 | probe_success = 1; |
@@ -1306,6 +1362,7 @@ static int pxa3xx_nand_resume(struct platform_device *pdev) | |||
1306 | static struct platform_driver pxa3xx_nand_driver = { | 1362 | static struct platform_driver pxa3xx_nand_driver = { |
1307 | .driver = { | 1363 | .driver = { |
1308 | .name = "pxa3xx-nand", | 1364 | .name = "pxa3xx-nand", |
1365 | .of_match_table = of_match_ptr(pxa3xx_nand_dt_ids), | ||
1309 | }, | 1366 | }, |
1310 | .probe = pxa3xx_nand_probe, | 1367 | .probe = pxa3xx_nand_probe, |
1311 | .remove = pxa3xx_nand_remove, | 1368 | .remove = pxa3xx_nand_remove, |
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index 91121f33f743..d8040619ad8d 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <asm/io.h> | 46 | #include <asm/io.h> |
47 | 47 | ||
48 | #include <plat/regs-nand.h> | 48 | #include <plat/regs-nand.h> |
49 | #include <plat/nand.h> | 49 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
50 | 50 | ||
51 | #ifdef CONFIG_MTD_NAND_S3C2410_HWECC | 51 | #ifdef CONFIG_MTD_NAND_S3C2410_HWECC |
52 | static int hardware_ecc = 1; | 52 | static int hardware_ecc = 1; |
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index 9d49b1f4ff53..1961be985171 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #include <asm/mach/flash.h> | 40 | #include <asm/mach/flash.h> |
41 | #include <plat/gpmc.h> | 41 | #include <plat/gpmc.h> |
42 | #include <plat/onenand.h> | 42 | #include <linux/platform_data/mtd-onenand-omap2.h> |
43 | #include <asm/gpio.h> | 43 | #include <asm/gpio.h> |
44 | 44 | ||
45 | #include <plat/dma.h> | 45 | #include <plat/dma.h> |
diff --git a/drivers/net/ethernet/netx-eth.c b/drivers/net/ethernet/netx-eth.c index 9d11ab7521bc..63e7af44366f 100644 --- a/drivers/net/ethernet/netx-eth.c +++ b/drivers/net/ethernet/netx-eth.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <mach/netx-regs.h> | 34 | #include <mach/netx-regs.h> |
35 | #include <mach/pfifo.h> | 35 | #include <mach/pfifo.h> |
36 | #include <mach/xc.h> | 36 | #include <mach/xc.h> |
37 | #include <mach/eth.h> | 37 | #include <linux/platform_data/eth-netx.h> |
38 | 38 | ||
39 | /* XC Fifo Offsets */ | 39 | /* XC Fifo Offsets */ |
40 | #define EMPTY_PTR_FIFO(xcno) (0 + ((xcno) << 3)) /* Index of the empty pointer FIFO */ | 40 | #define EMPTY_PTR_FIFO(xcno) (0 + ((xcno) << 3)) /* Index of the empty pointer FIFO */ |
diff --git a/drivers/net/ethernet/seeq/ether3.c b/drivers/net/ethernet/seeq/ether3.c index df808ac8cb65..6a40dd03a32f 100644 --- a/drivers/net/ethernet/seeq/ether3.c +++ b/drivers/net/ethernet/seeq/ether3.c | |||
@@ -99,13 +99,13 @@ typedef enum { | |||
99 | * The SEEQ8005 doesn't like us writing to its registers | 99 | * The SEEQ8005 doesn't like us writing to its registers |
100 | * too quickly. | 100 | * too quickly. |
101 | */ | 101 | */ |
102 | static inline void ether3_outb(int v, const void __iomem *r) | 102 | static inline void ether3_outb(int v, void __iomem *r) |
103 | { | 103 | { |
104 | writeb(v, r); | 104 | writeb(v, r); |
105 | udelay(1); | 105 | udelay(1); |
106 | } | 106 | } |
107 | 107 | ||
108 | static inline void ether3_outw(int v, const void __iomem *r) | 108 | static inline void ether3_outw(int v, void __iomem *r) |
109 | { | 109 | { |
110 | writew(v, r); | 110 | writew(v, r); |
111 | udelay(1); | 111 | udelay(1); |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 8d5476707912..002a442bf73f 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -28,9 +28,9 @@ | |||
28 | #include <net/irda/irda_device.h> | 28 | #include <net/irda/irda_device.h> |
29 | 29 | ||
30 | #include <mach/dma.h> | 30 | #include <mach/dma.h> |
31 | #include <mach/irda.h> | 31 | #include <linux/platform_data/irda-pxaficp.h> |
32 | #include <mach/regs-uart.h> | ||
33 | #include <mach/regs-ost.h> | 32 | #include <mach/regs-ost.h> |
33 | #include <mach/regs-uart.h> | ||
34 | 34 | ||
35 | #define FICP __REG(0x40800000) /* Start of FICP area */ | 35 | #define FICP __REG(0x40800000) /* Start of FICP area */ |
36 | #define ICCR0 __REG(0x40800000) /* ICP Control Register 0 */ | 36 | #define ICCR0 __REG(0x40800000) /* ICP Control Register 0 */ |
@@ -112,6 +112,9 @@ struct pxa_irda { | |||
112 | int txdma; | 112 | int txdma; |
113 | int rxdma; | 113 | int rxdma; |
114 | 114 | ||
115 | int uart_irq; | ||
116 | int icp_irq; | ||
117 | |||
115 | struct irlap_cb *irlap; | 118 | struct irlap_cb *irlap; |
116 | struct qos_info qos; | 119 | struct qos_info qos; |
117 | 120 | ||
@@ -672,19 +675,19 @@ static int pxa_irda_start(struct net_device *dev) | |||
672 | 675 | ||
673 | si->speed = 9600; | 676 | si->speed = 9600; |
674 | 677 | ||
675 | err = request_irq(IRQ_STUART, pxa_irda_sir_irq, 0, dev->name, dev); | 678 | err = request_irq(si->uart_irq, pxa_irda_sir_irq, 0, dev->name, dev); |
676 | if (err) | 679 | if (err) |
677 | goto err_irq1; | 680 | goto err_irq1; |
678 | 681 | ||
679 | err = request_irq(IRQ_ICP, pxa_irda_fir_irq, 0, dev->name, dev); | 682 | err = request_irq(si->icp_irq, pxa_irda_fir_irq, 0, dev->name, dev); |
680 | if (err) | 683 | if (err) |
681 | goto err_irq2; | 684 | goto err_irq2; |
682 | 685 | ||
683 | /* | 686 | /* |
684 | * The interrupt must remain disabled for now. | 687 | * The interrupt must remain disabled for now. |
685 | */ | 688 | */ |
686 | disable_irq(IRQ_STUART); | 689 | disable_irq(si->uart_irq); |
687 | disable_irq(IRQ_ICP); | 690 | disable_irq(si->icp_irq); |
688 | 691 | ||
689 | err = -EBUSY; | 692 | err = -EBUSY; |
690 | si->rxdma = pxa_request_dma("FICP_RX",DMA_PRIO_LOW, pxa_irda_fir_dma_rx_irq, dev); | 693 | si->rxdma = pxa_request_dma("FICP_RX",DMA_PRIO_LOW, pxa_irda_fir_dma_rx_irq, dev); |
@@ -720,8 +723,8 @@ static int pxa_irda_start(struct net_device *dev) | |||
720 | /* | 723 | /* |
721 | * Now enable the interrupt and start the queue | 724 | * Now enable the interrupt and start the queue |
722 | */ | 725 | */ |
723 | enable_irq(IRQ_STUART); | 726 | enable_irq(si->uart_irq); |
724 | enable_irq(IRQ_ICP); | 727 | enable_irq(si->icp_irq); |
725 | netif_start_queue(dev); | 728 | netif_start_queue(dev); |
726 | 729 | ||
727 | printk(KERN_DEBUG "pxa_ir: irda driver opened\n"); | 730 | printk(KERN_DEBUG "pxa_ir: irda driver opened\n"); |
@@ -738,9 +741,9 @@ err_dma_rx_buff: | |||
738 | err_tx_dma: | 741 | err_tx_dma: |
739 | pxa_free_dma(si->rxdma); | 742 | pxa_free_dma(si->rxdma); |
740 | err_rx_dma: | 743 | err_rx_dma: |
741 | free_irq(IRQ_ICP, dev); | 744 | free_irq(si->icp_irq, dev); |
742 | err_irq2: | 745 | err_irq2: |
743 | free_irq(IRQ_STUART, dev); | 746 | free_irq(si->uart_irq, dev); |
744 | err_irq1: | 747 | err_irq1: |
745 | 748 | ||
746 | return err; | 749 | return err; |
@@ -760,8 +763,8 @@ static int pxa_irda_stop(struct net_device *dev) | |||
760 | si->irlap = NULL; | 763 | si->irlap = NULL; |
761 | } | 764 | } |
762 | 765 | ||
763 | free_irq(IRQ_STUART, dev); | 766 | free_irq(si->uart_irq, dev); |
764 | free_irq(IRQ_ICP, dev); | 767 | free_irq(si->icp_irq, dev); |
765 | 768 | ||
766 | pxa_free_dma(si->rxdma); | 769 | pxa_free_dma(si->rxdma); |
767 | pxa_free_dma(si->txdma); | 770 | pxa_free_dma(si->txdma); |
@@ -851,6 +854,9 @@ static int pxa_irda_probe(struct platform_device *pdev) | |||
851 | si->dev = &pdev->dev; | 854 | si->dev = &pdev->dev; |
852 | si->pdata = pdev->dev.platform_data; | 855 | si->pdata = pdev->dev.platform_data; |
853 | 856 | ||
857 | si->uart_irq = platform_get_irq(pdev, 0); | ||
858 | si->icp_irq = platform_get_irq(pdev, 1); | ||
859 | |||
854 | si->sir_clk = clk_get(&pdev->dev, "UARTCLK"); | 860 | si->sir_clk = clk_get(&pdev->dev, "UARTCLK"); |
855 | si->fir_clk = clk_get(&pdev->dev, "FICPCLK"); | 861 | si->fir_clk = clk_get(&pdev->dev, "FICPCLK"); |
856 | if (IS_ERR(si->sir_clk) || IS_ERR(si->fir_clk)) { | 862 | if (IS_ERR(si->sir_clk) || IS_ERR(si->fir_clk)) { |
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c index 0ad06a3bd562..fa74efe82206 100644 --- a/drivers/pcmcia/omap_cf.c +++ b/drivers/pcmcia/omap_cf.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <asm/sizes.h> | 25 | #include <asm/sizes.h> |
26 | 26 | ||
27 | #include <plat/mux.h> | 27 | #include <mach/mux.h> |
28 | #include <plat/tc.h> | 28 | #include <plat/tc.h> |
29 | 29 | ||
30 | 30 | ||
diff --git a/drivers/pcmcia/pxa2xx_viper.c b/drivers/pcmcia/pxa2xx_viper.c index cb0c37ec7f24..a76f495953ab 100644 --- a/drivers/pcmcia/pxa2xx_viper.c +++ b/drivers/pcmcia/pxa2xx_viper.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
27 | 27 | ||
28 | #include <mach/arcom-pcmcia.h> | 28 | #include <linux/platform_data/pcmcia-pxa2xx_viper.h> |
29 | 29 | ||
30 | #include "soc_common.h" | 30 | #include "soc_common.h" |
31 | #include "pxa2xx_base.h" | 31 | #include "pxa2xx_base.h" |
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 54e3588bef62..a75414496369 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
@@ -145,6 +145,28 @@ config PINCTRL_COH901 | |||
145 | COH 901 335 and COH 901 571/3. They contain 3, 5 or 7 | 145 | COH 901 335 and COH 901 571/3. They contain 3, 5 or 7 |
146 | ports of 8 GPIO pins each. | 146 | ports of 8 GPIO pins each. |
147 | 147 | ||
148 | config PINCTRL_MVEBU | ||
149 | bool | ||
150 | depends on ARCH_MVEBU | ||
151 | select PINMUX | ||
152 | select PINCONF | ||
153 | |||
154 | config PINCTRL_DOVE | ||
155 | bool | ||
156 | select PINCTRL_MVEBU | ||
157 | |||
158 | config PINCTRL_KIRKWOOD | ||
159 | bool | ||
160 | select PINCTRL_MVEBU | ||
161 | |||
162 | config PINCTRL_ARMADA_370 | ||
163 | bool | ||
164 | select PINCTRL_MVEBU | ||
165 | |||
166 | config PINCTRL_ARMADA_XP | ||
167 | bool | ||
168 | select PINCTRL_MVEBU | ||
169 | |||
148 | source "drivers/pinctrl/spear/Kconfig" | 170 | source "drivers/pinctrl/spear/Kconfig" |
149 | 171 | ||
150 | endmenu | 172 | endmenu |
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index f40b1f81ff2c..f2ea0504efc7 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile | |||
@@ -29,5 +29,10 @@ obj-$(CONFIG_PINCTRL_TEGRA20) += pinctrl-tegra20.o | |||
29 | obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o | 29 | obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o |
30 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o | 30 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o |
31 | obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o | 31 | obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o |
32 | obj-$(CONFIG_PINCTRL_MVEBU) += pinctrl-mvebu.o | ||
33 | obj-$(CONFIG_PINCTRL_DOVE) += pinctrl-dove.o | ||
34 | obj-$(CONFIG_PINCTRL_KIRKWOOD) += pinctrl-kirkwood.o | ||
35 | obj-$(CONFIG_PINCTRL_ARMADA_370) += pinctrl-armada-370.o | ||
36 | obj-$(CONFIG_PINCTRL_ARMADA_XP) += pinctrl-armada-xp.o | ||
32 | 37 | ||
33 | obj-$(CONFIG_PLAT_SPEAR) += spear/ | 38 | obj-$(CONFIG_PLAT_SPEAR) += spear/ |
diff --git a/drivers/pinctrl/pinctrl-armada-370.c b/drivers/pinctrl/pinctrl-armada-370.c new file mode 100644 index 000000000000..c907647de6ad --- /dev/null +++ b/drivers/pinctrl/pinctrl-armada-370.c | |||
@@ -0,0 +1,421 @@ | |||
1 | /* | ||
2 | * Marvell Armada 370 pinctrl driver based on mvebu pinctrl core | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * | ||
6 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/err.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/of_device.h> | ||
22 | #include <linux/pinctrl/pinctrl.h> | ||
23 | |||
24 | #include "pinctrl-mvebu.h" | ||
25 | |||
26 | static struct mvebu_mpp_mode mv88f6710_mpp_modes[] = { | ||
27 | MPP_MODE(0, | ||
28 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
29 | MPP_FUNCTION(0x1, "uart0", "rxd")), | ||
30 | MPP_MODE(1, | ||
31 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
32 | MPP_FUNCTION(0x1, "uart0", "txd")), | ||
33 | MPP_MODE(2, | ||
34 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
35 | MPP_FUNCTION(0x1, "i2c0", "sck"), | ||
36 | MPP_FUNCTION(0x2, "uart0", "txd")), | ||
37 | MPP_MODE(3, | ||
38 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
39 | MPP_FUNCTION(0x1, "i2c0", "sda"), | ||
40 | MPP_FUNCTION(0x2, "uart0", "rxd")), | ||
41 | MPP_MODE(4, | ||
42 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
43 | MPP_FUNCTION(0x1, "cpu_pd", "vdd")), | ||
44 | MPP_MODE(5, | ||
45 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
46 | MPP_FUNCTION(0x1, "ge0", "txclko"), | ||
47 | MPP_FUNCTION(0x2, "uart1", "txd"), | ||
48 | MPP_FUNCTION(0x4, "spi1", "clk"), | ||
49 | MPP_FUNCTION(0x5, "audio", "mclk")), | ||
50 | MPP_MODE(6, | ||
51 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
52 | MPP_FUNCTION(0x1, "ge0", "txd0"), | ||
53 | MPP_FUNCTION(0x2, "sata0", "prsnt"), | ||
54 | MPP_FUNCTION(0x4, "tdm", "rst"), | ||
55 | MPP_FUNCTION(0x5, "audio", "sdo")), | ||
56 | MPP_MODE(7, | ||
57 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
58 | MPP_FUNCTION(0x1, "ge0", "txd1"), | ||
59 | MPP_FUNCTION(0x4, "tdm", "tdx"), | ||
60 | MPP_FUNCTION(0x5, "audio", "lrclk")), | ||
61 | MPP_MODE(8, | ||
62 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
63 | MPP_FUNCTION(0x1, "ge0", "txd2"), | ||
64 | MPP_FUNCTION(0x2, "uart0", "rts"), | ||
65 | MPP_FUNCTION(0x4, "tdm", "drx"), | ||
66 | MPP_FUNCTION(0x5, "audio", "bclk")), | ||
67 | MPP_MODE(9, | ||
68 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
69 | MPP_FUNCTION(0x1, "ge0", "txd3"), | ||
70 | MPP_FUNCTION(0x2, "uart1", "txd"), | ||
71 | MPP_FUNCTION(0x3, "sd0", "clk"), | ||
72 | MPP_FUNCTION(0x5, "audio", "spdifo")), | ||
73 | MPP_MODE(10, | ||
74 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
75 | MPP_FUNCTION(0x1, "ge0", "txctl"), | ||
76 | MPP_FUNCTION(0x2, "uart0", "cts"), | ||
77 | MPP_FUNCTION(0x4, "tdm", "fsync"), | ||
78 | MPP_FUNCTION(0x5, "audio", "sdi")), | ||
79 | MPP_MODE(11, | ||
80 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
81 | MPP_FUNCTION(0x1, "ge0", "rxd0"), | ||
82 | MPP_FUNCTION(0x2, "uart1", "rxd"), | ||
83 | MPP_FUNCTION(0x3, "sd0", "cmd"), | ||
84 | MPP_FUNCTION(0x4, "spi0", "cs1"), | ||
85 | MPP_FUNCTION(0x5, "sata1", "prsnt"), | ||
86 | MPP_FUNCTION(0x6, "spi1", "cs1")), | ||
87 | MPP_MODE(12, | ||
88 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
89 | MPP_FUNCTION(0x1, "ge0", "rxd1"), | ||
90 | MPP_FUNCTION(0x2, "i2c1", "sda"), | ||
91 | MPP_FUNCTION(0x3, "sd0", "d0"), | ||
92 | MPP_FUNCTION(0x4, "spi1", "cs0"), | ||
93 | MPP_FUNCTION(0x5, "audio", "spdifi")), | ||
94 | MPP_MODE(13, | ||
95 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
96 | MPP_FUNCTION(0x1, "ge0", "rxd2"), | ||
97 | MPP_FUNCTION(0x2, "i2c1", "sck"), | ||
98 | MPP_FUNCTION(0x3, "sd0", "d1"), | ||
99 | MPP_FUNCTION(0x4, "tdm", "pclk"), | ||
100 | MPP_FUNCTION(0x5, "audio", "rmclk")), | ||
101 | MPP_MODE(14, | ||
102 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
103 | MPP_FUNCTION(0x1, "ge0", "rxd3"), | ||
104 | MPP_FUNCTION(0x2, "pcie", "clkreq0"), | ||
105 | MPP_FUNCTION(0x3, "sd0", "d2"), | ||
106 | MPP_FUNCTION(0x4, "spi1", "mosi"), | ||
107 | MPP_FUNCTION(0x5, "spi0", "cs2")), | ||
108 | MPP_MODE(15, | ||
109 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
110 | MPP_FUNCTION(0x1, "ge0", "rxctl"), | ||
111 | MPP_FUNCTION(0x2, "pcie", "clkreq1"), | ||
112 | MPP_FUNCTION(0x3, "sd0", "d3"), | ||
113 | MPP_FUNCTION(0x4, "spi1", "miso"), | ||
114 | MPP_FUNCTION(0x5, "spi0", "cs3")), | ||
115 | MPP_MODE(16, | ||
116 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
117 | MPP_FUNCTION(0x1, "ge0", "rxclk"), | ||
118 | MPP_FUNCTION(0x2, "uart1", "rxd"), | ||
119 | MPP_FUNCTION(0x4, "tdm", "int"), | ||
120 | MPP_FUNCTION(0x5, "audio", "extclk")), | ||
121 | MPP_MODE(17, | ||
122 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
123 | MPP_FUNCTION(0x1, "ge", "mdc")), | ||
124 | MPP_MODE(18, | ||
125 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
126 | MPP_FUNCTION(0x1, "ge", "mdio")), | ||
127 | MPP_MODE(19, | ||
128 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
129 | MPP_FUNCTION(0x1, "ge0", "txclk"), | ||
130 | MPP_FUNCTION(0x2, "ge1", "txclkout"), | ||
131 | MPP_FUNCTION(0x4, "tdm", "pclk")), | ||
132 | MPP_MODE(20, | ||
133 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
134 | MPP_FUNCTION(0x1, "ge0", "txd4"), | ||
135 | MPP_FUNCTION(0x2, "ge1", "txd0")), | ||
136 | MPP_MODE(21, | ||
137 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
138 | MPP_FUNCTION(0x1, "ge0", "txd5"), | ||
139 | MPP_FUNCTION(0x2, "ge1", "txd1"), | ||
140 | MPP_FUNCTION(0x4, "uart1", "txd")), | ||
141 | MPP_MODE(22, | ||
142 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
143 | MPP_FUNCTION(0x1, "ge0", "txd6"), | ||
144 | MPP_FUNCTION(0x2, "ge1", "txd2"), | ||
145 | MPP_FUNCTION(0x4, "uart0", "rts")), | ||
146 | MPP_MODE(23, | ||
147 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
148 | MPP_FUNCTION(0x1, "ge0", "txd7"), | ||
149 | MPP_FUNCTION(0x2, "ge1", "txd3"), | ||
150 | MPP_FUNCTION(0x4, "spi1", "mosi")), | ||
151 | MPP_MODE(24, | ||
152 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
153 | MPP_FUNCTION(0x1, "ge0", "col"), | ||
154 | MPP_FUNCTION(0x2, "ge1", "txctl"), | ||
155 | MPP_FUNCTION(0x4, "spi1", "cs0")), | ||
156 | MPP_MODE(25, | ||
157 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
158 | MPP_FUNCTION(0x1, "ge0", "rxerr"), | ||
159 | MPP_FUNCTION(0x2, "ge1", "rxd0"), | ||
160 | MPP_FUNCTION(0x4, "uart1", "rxd")), | ||
161 | MPP_MODE(26, | ||
162 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
163 | MPP_FUNCTION(0x1, "ge0", "crs"), | ||
164 | MPP_FUNCTION(0x2, "ge1", "rxd1"), | ||
165 | MPP_FUNCTION(0x4, "spi1", "miso")), | ||
166 | MPP_MODE(27, | ||
167 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
168 | MPP_FUNCTION(0x1, "ge0", "rxd4"), | ||
169 | MPP_FUNCTION(0x2, "ge1", "rxd2"), | ||
170 | MPP_FUNCTION(0x4, "uart0", "cts")), | ||
171 | MPP_MODE(28, | ||
172 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
173 | MPP_FUNCTION(0x1, "ge0", "rxd5"), | ||
174 | MPP_FUNCTION(0x2, "ge1", "rxd3")), | ||
175 | MPP_MODE(29, | ||
176 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
177 | MPP_FUNCTION(0x1, "ge0", "rxd6"), | ||
178 | MPP_FUNCTION(0x2, "ge1", "rxctl"), | ||
179 | MPP_FUNCTION(0x4, "i2c1", "sda")), | ||
180 | MPP_MODE(30, | ||
181 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
182 | MPP_FUNCTION(0x1, "ge0", "rxd7"), | ||
183 | MPP_FUNCTION(0x2, "ge1", "rxclk"), | ||
184 | MPP_FUNCTION(0x4, "i2c1", "sck")), | ||
185 | MPP_MODE(31, | ||
186 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
187 | MPP_FUNCTION(0x3, "tclk", NULL), | ||
188 | MPP_FUNCTION(0x4, "ge0", "txerr")), | ||
189 | MPP_MODE(32, | ||
190 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
191 | MPP_FUNCTION(0x1, "spi0", "cs0")), | ||
192 | MPP_MODE(33, | ||
193 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
194 | MPP_FUNCTION(0x1, "dev", "bootcs"), | ||
195 | MPP_FUNCTION(0x2, "spi0", "cs0")), | ||
196 | MPP_MODE(34, | ||
197 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
198 | MPP_FUNCTION(0x1, "dev", "wen0"), | ||
199 | MPP_FUNCTION(0x2, "spi0", "mosi")), | ||
200 | MPP_MODE(35, | ||
201 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
202 | MPP_FUNCTION(0x1, "dev", "oen"), | ||
203 | MPP_FUNCTION(0x2, "spi0", "sck")), | ||
204 | MPP_MODE(36, | ||
205 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
206 | MPP_FUNCTION(0x1, "dev", "a1"), | ||
207 | MPP_FUNCTION(0x2, "spi0", "miso")), | ||
208 | MPP_MODE(37, | ||
209 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
210 | MPP_FUNCTION(0x1, "dev", "a0"), | ||
211 | MPP_FUNCTION(0x2, "sata0", "prsnt")), | ||
212 | MPP_MODE(38, | ||
213 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
214 | MPP_FUNCTION(0x1, "dev", "ready"), | ||
215 | MPP_FUNCTION(0x2, "uart1", "cts"), | ||
216 | MPP_FUNCTION(0x3, "uart0", "cts")), | ||
217 | MPP_MODE(39, | ||
218 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
219 | MPP_FUNCTION(0x1, "dev", "ad0"), | ||
220 | MPP_FUNCTION(0x2, "audio", "spdifo")), | ||
221 | MPP_MODE(40, | ||
222 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
223 | MPP_FUNCTION(0x1, "dev", "ad1"), | ||
224 | MPP_FUNCTION(0x2, "uart1", "rts"), | ||
225 | MPP_FUNCTION(0x3, "uart0", "rts")), | ||
226 | MPP_MODE(41, | ||
227 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
228 | MPP_FUNCTION(0x1, "dev", "ad2"), | ||
229 | MPP_FUNCTION(0x2, "uart1", "rxd")), | ||
230 | MPP_MODE(42, | ||
231 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
232 | MPP_FUNCTION(0x1, "dev", "ad3"), | ||
233 | MPP_FUNCTION(0x2, "uart1", "txd")), | ||
234 | MPP_MODE(43, | ||
235 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
236 | MPP_FUNCTION(0x1, "dev", "ad4"), | ||
237 | MPP_FUNCTION(0x2, "audio", "bclk")), | ||
238 | MPP_MODE(44, | ||
239 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
240 | MPP_FUNCTION(0x1, "dev", "ad5"), | ||
241 | MPP_FUNCTION(0x2, "audio", "mclk")), | ||
242 | MPP_MODE(45, | ||
243 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
244 | MPP_FUNCTION(0x1, "dev", "ad6"), | ||
245 | MPP_FUNCTION(0x2, "audio", "lrclk")), | ||
246 | MPP_MODE(46, | ||
247 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
248 | MPP_FUNCTION(0x1, "dev", "ad7"), | ||
249 | MPP_FUNCTION(0x2, "audio", "sdo")), | ||
250 | MPP_MODE(47, | ||
251 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
252 | MPP_FUNCTION(0x1, "dev", "ad8"), | ||
253 | MPP_FUNCTION(0x3, "sd0", "clk"), | ||
254 | MPP_FUNCTION(0x5, "audio", "spdifo")), | ||
255 | MPP_MODE(48, | ||
256 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
257 | MPP_FUNCTION(0x1, "dev", "ad9"), | ||
258 | MPP_FUNCTION(0x2, "uart0", "rts"), | ||
259 | MPP_FUNCTION(0x3, "sd0", "cmd"), | ||
260 | MPP_FUNCTION(0x4, "sata1", "prsnt"), | ||
261 | MPP_FUNCTION(0x5, "spi0", "cs1")), | ||
262 | MPP_MODE(49, | ||
263 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
264 | MPP_FUNCTION(0x1, "dev", "ad10"), | ||
265 | MPP_FUNCTION(0x2, "pcie", "clkreq1"), | ||
266 | MPP_FUNCTION(0x3, "sd0", "d0"), | ||
267 | MPP_FUNCTION(0x4, "spi1", "cs0"), | ||
268 | MPP_FUNCTION(0x5, "audio", "spdifi")), | ||
269 | MPP_MODE(50, | ||
270 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
271 | MPP_FUNCTION(0x1, "dev", "ad11"), | ||
272 | MPP_FUNCTION(0x2, "uart0", "cts"), | ||
273 | MPP_FUNCTION(0x3, "sd0", "d1"), | ||
274 | MPP_FUNCTION(0x4, "spi1", "miso"), | ||
275 | MPP_FUNCTION(0x5, "audio", "rmclk")), | ||
276 | MPP_MODE(51, | ||
277 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
278 | MPP_FUNCTION(0x1, "dev", "ad12"), | ||
279 | MPP_FUNCTION(0x2, "i2c1", "sda"), | ||
280 | MPP_FUNCTION(0x3, "sd0", "d2"), | ||
281 | MPP_FUNCTION(0x4, "spi1", "mosi")), | ||
282 | MPP_MODE(52, | ||
283 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
284 | MPP_FUNCTION(0x1, "dev", "ad13"), | ||
285 | MPP_FUNCTION(0x2, "i2c1", "sck"), | ||
286 | MPP_FUNCTION(0x3, "sd0", "d3"), | ||
287 | MPP_FUNCTION(0x4, "spi1", "sck")), | ||
288 | MPP_MODE(53, | ||
289 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
290 | MPP_FUNCTION(0x1, "dev", "ad14"), | ||
291 | MPP_FUNCTION(0x2, "sd0", "clk"), | ||
292 | MPP_FUNCTION(0x3, "tdm", "pclk"), | ||
293 | MPP_FUNCTION(0x4, "spi0", "cs2"), | ||
294 | MPP_FUNCTION(0x5, "pcie", "clkreq1")), | ||
295 | MPP_MODE(54, | ||
296 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
297 | MPP_FUNCTION(0x1, "dev", "ad15"), | ||
298 | MPP_FUNCTION(0x3, "tdm", "dtx")), | ||
299 | MPP_MODE(55, | ||
300 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
301 | MPP_FUNCTION(0x1, "dev", "cs1"), | ||
302 | MPP_FUNCTION(0x2, "uart1", "txd"), | ||
303 | MPP_FUNCTION(0x3, "tdm", "rst"), | ||
304 | MPP_FUNCTION(0x4, "sata1", "prsnt"), | ||
305 | MPP_FUNCTION(0x5, "sata0", "prsnt")), | ||
306 | MPP_MODE(56, | ||
307 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
308 | MPP_FUNCTION(0x1, "dev", "cs2"), | ||
309 | MPP_FUNCTION(0x2, "uart1", "cts"), | ||
310 | MPP_FUNCTION(0x3, "uart0", "cts"), | ||
311 | MPP_FUNCTION(0x4, "spi0", "cs3"), | ||
312 | MPP_FUNCTION(0x5, "pcie", "clkreq0"), | ||
313 | MPP_FUNCTION(0x6, "spi1", "cs1")), | ||
314 | MPP_MODE(57, | ||
315 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
316 | MPP_FUNCTION(0x1, "dev", "cs3"), | ||
317 | MPP_FUNCTION(0x2, "uart1", "rxd"), | ||
318 | MPP_FUNCTION(0x3, "tdm", "fsync"), | ||
319 | MPP_FUNCTION(0x4, "sata0", "prsnt"), | ||
320 | MPP_FUNCTION(0x5, "audio", "sdo")), | ||
321 | MPP_MODE(58, | ||
322 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
323 | MPP_FUNCTION(0x1, "dev", "cs0"), | ||
324 | MPP_FUNCTION(0x2, "uart1", "rts"), | ||
325 | MPP_FUNCTION(0x3, "tdm", "int"), | ||
326 | MPP_FUNCTION(0x5, "audio", "extclk"), | ||
327 | MPP_FUNCTION(0x6, "uart0", "rts")), | ||
328 | MPP_MODE(59, | ||
329 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
330 | MPP_FUNCTION(0x1, "dev", "ale0"), | ||
331 | MPP_FUNCTION(0x2, "uart1", "rts"), | ||
332 | MPP_FUNCTION(0x3, "uart0", "rts"), | ||
333 | MPP_FUNCTION(0x5, "audio", "bclk")), | ||
334 | MPP_MODE(60, | ||
335 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
336 | MPP_FUNCTION(0x1, "dev", "ale1"), | ||
337 | MPP_FUNCTION(0x2, "uart1", "rxd"), | ||
338 | MPP_FUNCTION(0x3, "sata0", "prsnt"), | ||
339 | MPP_FUNCTION(0x4, "pcie", "rst-out"), | ||
340 | MPP_FUNCTION(0x5, "audio", "sdi")), | ||
341 | MPP_MODE(61, | ||
342 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
343 | MPP_FUNCTION(0x1, "dev", "wen1"), | ||
344 | MPP_FUNCTION(0x2, "uart1", "txd"), | ||
345 | MPP_FUNCTION(0x5, "audio", "rclk")), | ||
346 | MPP_MODE(62, | ||
347 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
348 | MPP_FUNCTION(0x1, "dev", "a2"), | ||
349 | MPP_FUNCTION(0x2, "uart1", "cts"), | ||
350 | MPP_FUNCTION(0x3, "tdm", "drx"), | ||
351 | MPP_FUNCTION(0x4, "pcie", "clkreq0"), | ||
352 | MPP_FUNCTION(0x5, "audio", "mclk"), | ||
353 | MPP_FUNCTION(0x6, "uart0", "cts")), | ||
354 | MPP_MODE(63, | ||
355 | MPP_FUNCTION(0x0, "gpo", NULL), | ||
356 | MPP_FUNCTION(0x1, "spi0", "sck"), | ||
357 | MPP_FUNCTION(0x2, "tclk", NULL)), | ||
358 | MPP_MODE(64, | ||
359 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
360 | MPP_FUNCTION(0x1, "spi0", "miso"), | ||
361 | MPP_FUNCTION(0x2, "spi0-1", "cs1")), | ||
362 | MPP_MODE(65, | ||
363 | MPP_FUNCTION(0x0, "gpio", NULL), | ||
364 | MPP_FUNCTION(0x1, "spi0", "mosi"), | ||
365 | MPP_FUNCTION(0x2, "spi0-1", "cs2")), | ||
366 | }; | ||
367 | |||
368 | static struct mvebu_pinctrl_soc_info armada_370_pinctrl_info; | ||
369 | |||
370 | static struct of_device_id armada_370_pinctrl_of_match[] __devinitdata = { | ||
371 | { .compatible = "marvell,mv88f6710-pinctrl" }, | ||
372 | { }, | ||
373 | }; | ||
374 | |||
375 | static struct mvebu_mpp_ctrl mv88f6710_mpp_controls[] = { | ||
376 | MPP_REG_CTRL(0, 65), | ||
377 | }; | ||
378 | |||
379 | static struct pinctrl_gpio_range mv88f6710_mpp_gpio_ranges[] = { | ||
380 | MPP_GPIO_RANGE(0, 0, 0, 32), | ||
381 | MPP_GPIO_RANGE(1, 32, 32, 32), | ||
382 | MPP_GPIO_RANGE(2, 64, 64, 2), | ||
383 | }; | ||
384 | |||
385 | static int __devinit armada_370_pinctrl_probe(struct platform_device *pdev) | ||
386 | { | ||
387 | struct mvebu_pinctrl_soc_info *soc = &armada_370_pinctrl_info; | ||
388 | |||
389 | soc->variant = 0; /* no variants for Armada 370 */ | ||
390 | soc->controls = mv88f6710_mpp_controls; | ||
391 | soc->ncontrols = ARRAY_SIZE(mv88f6710_mpp_controls); | ||
392 | soc->modes = mv88f6710_mpp_modes; | ||
393 | soc->nmodes = ARRAY_SIZE(mv88f6710_mpp_modes); | ||
394 | soc->gpioranges = mv88f6710_mpp_gpio_ranges; | ||
395 | soc->ngpioranges = ARRAY_SIZE(mv88f6710_mpp_gpio_ranges); | ||
396 | |||
397 | pdev->dev.platform_data = soc; | ||
398 | |||
399 | return mvebu_pinctrl_probe(pdev); | ||
400 | } | ||
401 | |||
402 | static int __devexit armada_370_pinctrl_remove(struct platform_device *pdev) | ||
403 | { | ||
404 | return mvebu_pinctrl_remove(pdev); | ||
405 | } | ||
406 | |||
407 | static struct platform_driver armada_370_pinctrl_driver = { | ||
408 | .driver = { | ||
409 | .name = "armada-370-pinctrl", | ||
410 | .owner = THIS_MODULE, | ||
411 | .of_match_table = of_match_ptr(armada_370_pinctrl_of_match), | ||
412 | }, | ||
413 | .probe = armada_370_pinctrl_probe, | ||
414 | .remove = __devexit_p(armada_370_pinctrl_remove), | ||
415 | }; | ||
416 | |||
417 | module_platform_driver(armada_370_pinctrl_driver); | ||
418 | |||
419 | MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); | ||
420 | MODULE_DESCRIPTION("Marvell Armada 370 pinctrl driver"); | ||
421 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pinctrl/pinctrl-armada-xp.c b/drivers/pinctrl/pinctrl-armada-xp.c new file mode 100644 index 000000000000..40bd52a46b4e --- /dev/null +++ b/drivers/pinctrl/pinctrl-armada-xp.c | |||
@@ -0,0 +1,468 @@ | |||
1 | /* | ||
2 | * Marvell Armada XP pinctrl driver based on mvebu pinctrl core | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * | ||
6 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This file supports the three variants of Armada XP SoCs that are | ||
14 | * available: mv78230, mv78260 and mv78460. From a pin muxing | ||
15 | * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460 | ||
16 | * both have 67 MPP pins (more GPIOs and address lines for the memory | ||
17 | * bus mainly). The only difference between the mv78260 and the | ||
18 | * mv78460 in terms of pin muxing is the addition of two functions on | ||
19 | * pins 43 and 56 to access the VDD of the CPU2 and 3 (mv78260 has two | ||
20 | * cores, mv78460 has four cores). | ||
21 | */ | ||
22 | |||
23 | #include <linux/err.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/clk.h> | ||
29 | #include <linux/of.h> | ||
30 | #include <linux/of_device.h> | ||
31 | #include <linux/pinctrl/pinctrl.h> | ||
32 | #include <linux/bitops.h> | ||
33 | |||
34 | #include "pinctrl-mvebu.h" | ||
35 | |||
36 | enum armada_xp_variant { | ||
37 | V_MV78230 = BIT(0), | ||
38 | V_MV78260 = BIT(1), | ||
39 | V_MV78460 = BIT(2), | ||
40 | V_MV78230_PLUS = (V_MV78230 | V_MV78260 | V_MV78460), | ||
41 | V_MV78260_PLUS = (V_MV78260 | V_MV78460), | ||
42 | }; | ||
43 | |||
44 | static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { | ||
45 | MPP_MODE(0, | ||
46 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
47 | MPP_VAR_FUNCTION(0x1, "ge0", "txclko", V_MV78230_PLUS), | ||
48 | MPP_VAR_FUNCTION(0x4, "lcd", "d0", V_MV78230_PLUS)), | ||
49 | MPP_MODE(1, | ||
50 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
51 | MPP_VAR_FUNCTION(0x1, "ge0", "txd0", V_MV78230_PLUS), | ||
52 | MPP_VAR_FUNCTION(0x4, "lcd", "d1", V_MV78230_PLUS)), | ||
53 | MPP_MODE(2, | ||
54 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
55 | MPP_VAR_FUNCTION(0x1, "ge0", "txd1", V_MV78230_PLUS), | ||
56 | MPP_VAR_FUNCTION(0x4, "lcd", "d2", V_MV78230_PLUS)), | ||
57 | MPP_MODE(3, | ||
58 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
59 | MPP_VAR_FUNCTION(0x1, "ge0", "txd2", V_MV78230_PLUS), | ||
60 | MPP_VAR_FUNCTION(0x4, "lcd", "d3", V_MV78230_PLUS)), | ||
61 | MPP_MODE(4, | ||
62 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
63 | MPP_VAR_FUNCTION(0x1, "ge0", "txd3", V_MV78230_PLUS), | ||
64 | MPP_VAR_FUNCTION(0x4, "lcd", "d4", V_MV78230_PLUS)), | ||
65 | MPP_MODE(5, | ||
66 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
67 | MPP_VAR_FUNCTION(0x1, "ge0", "txctl", V_MV78230_PLUS), | ||
68 | MPP_VAR_FUNCTION(0x4, "lcd", "d5", V_MV78230_PLUS)), | ||
69 | MPP_MODE(6, | ||
70 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
71 | MPP_VAR_FUNCTION(0x1, "ge0", "rxd0", V_MV78230_PLUS), | ||
72 | MPP_VAR_FUNCTION(0x4, "lcd", "d6", V_MV78230_PLUS)), | ||
73 | MPP_MODE(7, | ||
74 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
75 | MPP_VAR_FUNCTION(0x1, "ge0", "rxd1", V_MV78230_PLUS), | ||
76 | MPP_VAR_FUNCTION(0x4, "lcd", "d7", V_MV78230_PLUS)), | ||
77 | MPP_MODE(8, | ||
78 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
79 | MPP_VAR_FUNCTION(0x1, "ge0", "rxd2", V_MV78230_PLUS), | ||
80 | MPP_VAR_FUNCTION(0x4, "lcd", "d8", V_MV78230_PLUS)), | ||
81 | MPP_MODE(9, | ||
82 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
83 | MPP_VAR_FUNCTION(0x1, "ge0", "rxd3", V_MV78230_PLUS), | ||
84 | MPP_VAR_FUNCTION(0x4, "lcd", "d9", V_MV78230_PLUS)), | ||
85 | MPP_MODE(10, | ||
86 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
87 | MPP_VAR_FUNCTION(0x1, "ge0", "rxctl", V_MV78230_PLUS), | ||
88 | MPP_VAR_FUNCTION(0x4, "lcd", "d10", V_MV78230_PLUS)), | ||
89 | MPP_MODE(11, | ||
90 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
91 | MPP_VAR_FUNCTION(0x1, "ge0", "rxclk", V_MV78230_PLUS), | ||
92 | MPP_VAR_FUNCTION(0x4, "lcd", "d11", V_MV78230_PLUS)), | ||
93 | MPP_MODE(12, | ||
94 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
95 | MPP_VAR_FUNCTION(0x1, "ge0", "txd4", V_MV78230_PLUS), | ||
96 | MPP_VAR_FUNCTION(0x2, "ge1", "clkout", V_MV78230_PLUS), | ||
97 | MPP_VAR_FUNCTION(0x4, "lcd", "d12", V_MV78230_PLUS)), | ||
98 | MPP_MODE(13, | ||
99 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
100 | MPP_VAR_FUNCTION(0x1, "ge0", "txd5", V_MV78230_PLUS), | ||
101 | MPP_VAR_FUNCTION(0x2, "ge1", "txd0", V_MV78230_PLUS), | ||
102 | MPP_VAR_FUNCTION(0x4, "lcd", "d13", V_MV78230_PLUS)), | ||
103 | MPP_MODE(14, | ||
104 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
105 | MPP_VAR_FUNCTION(0x1, "ge0", "txd6", V_MV78230_PLUS), | ||
106 | MPP_VAR_FUNCTION(0x2, "ge1", "txd1", V_MV78230_PLUS), | ||
107 | MPP_VAR_FUNCTION(0x4, "lcd", "d14", V_MV78230_PLUS)), | ||
108 | MPP_MODE(15, | ||
109 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
110 | MPP_VAR_FUNCTION(0x1, "ge0", "txd7", V_MV78230_PLUS), | ||
111 | MPP_VAR_FUNCTION(0x2, "ge1", "txd2", V_MV78230_PLUS), | ||
112 | MPP_VAR_FUNCTION(0x4, "lcd", "d15", V_MV78230_PLUS)), | ||
113 | MPP_MODE(16, | ||
114 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
115 | MPP_VAR_FUNCTION(0x1, "ge0", "txclk", V_MV78230_PLUS), | ||
116 | MPP_VAR_FUNCTION(0x2, "ge1", "txd3", V_MV78230_PLUS), | ||
117 | MPP_VAR_FUNCTION(0x4, "lcd", "d16", V_MV78230_PLUS)), | ||
118 | MPP_MODE(17, | ||
119 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
120 | MPP_VAR_FUNCTION(0x1, "ge0", "col", V_MV78230_PLUS), | ||
121 | MPP_VAR_FUNCTION(0x2, "ge1", "txctl", V_MV78230_PLUS), | ||
122 | MPP_VAR_FUNCTION(0x4, "lcd", "d17", V_MV78230_PLUS)), | ||
123 | MPP_MODE(18, | ||
124 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
125 | MPP_VAR_FUNCTION(0x1, "ge0", "rxerr", V_MV78230_PLUS), | ||
126 | MPP_VAR_FUNCTION(0x2, "ge1", "rxd0", V_MV78230_PLUS), | ||
127 | MPP_VAR_FUNCTION(0x3, "ptp", "trig", V_MV78230_PLUS), | ||
128 | MPP_VAR_FUNCTION(0x4, "lcd", "d18", V_MV78230_PLUS)), | ||
129 | MPP_MODE(19, | ||
130 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
131 | MPP_VAR_FUNCTION(0x1, "ge0", "crs", V_MV78230_PLUS), | ||
132 | MPP_VAR_FUNCTION(0x2, "ge1", "rxd1", V_MV78230_PLUS), | ||
133 | MPP_VAR_FUNCTION(0x3, "ptp", "evreq", V_MV78230_PLUS), | ||
134 | MPP_VAR_FUNCTION(0x4, "lcd", "d19", V_MV78230_PLUS)), | ||
135 | MPP_MODE(20, | ||
136 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
137 | MPP_VAR_FUNCTION(0x1, "ge0", "rxd4", V_MV78230_PLUS), | ||
138 | MPP_VAR_FUNCTION(0x2, "ge1", "rxd2", V_MV78230_PLUS), | ||
139 | MPP_VAR_FUNCTION(0x3, "ptp", "clk", V_MV78230_PLUS), | ||
140 | MPP_VAR_FUNCTION(0x4, "lcd", "d20", V_MV78230_PLUS)), | ||
141 | MPP_MODE(21, | ||
142 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
143 | MPP_VAR_FUNCTION(0x1, "ge0", "rxd5", V_MV78230_PLUS), | ||
144 | MPP_VAR_FUNCTION(0x2, "ge1", "rxd3", V_MV78230_PLUS), | ||
145 | MPP_VAR_FUNCTION(0x3, "mem", "bat", V_MV78230_PLUS), | ||
146 | MPP_VAR_FUNCTION(0x4, "lcd", "d21", V_MV78230_PLUS)), | ||
147 | MPP_MODE(22, | ||
148 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
149 | MPP_VAR_FUNCTION(0x1, "ge0", "rxd6", V_MV78230_PLUS), | ||
150 | MPP_VAR_FUNCTION(0x2, "ge1", "rxctl", V_MV78230_PLUS), | ||
151 | MPP_VAR_FUNCTION(0x3, "sata0", "prsnt", V_MV78230_PLUS), | ||
152 | MPP_VAR_FUNCTION(0x4, "lcd", "d22", V_MV78230_PLUS)), | ||
153 | MPP_MODE(23, | ||
154 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
155 | MPP_VAR_FUNCTION(0x1, "ge0", "rxd7", V_MV78230_PLUS), | ||
156 | MPP_VAR_FUNCTION(0x2, "ge1", "rxclk", V_MV78230_PLUS), | ||
157 | MPP_VAR_FUNCTION(0x3, "sata1", "prsnt", V_MV78230_PLUS), | ||
158 | MPP_VAR_FUNCTION(0x4, "lcd", "d23", V_MV78230_PLUS)), | ||
159 | MPP_MODE(24, | ||
160 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
161 | MPP_VAR_FUNCTION(0x1, "sata1", "prsnt", V_MV78230_PLUS), | ||
162 | MPP_VAR_FUNCTION(0x2, "nf", "bootcs-re", V_MV78230_PLUS), | ||
163 | MPP_VAR_FUNCTION(0x3, "tdm", "rst", V_MV78230_PLUS), | ||
164 | MPP_VAR_FUNCTION(0x4, "lcd", "hsync", V_MV78230_PLUS)), | ||
165 | MPP_MODE(25, | ||
166 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
167 | MPP_VAR_FUNCTION(0x1, "sata0", "prsnt", V_MV78230_PLUS), | ||
168 | MPP_VAR_FUNCTION(0x2, "nf", "bootcs-we", V_MV78230_PLUS), | ||
169 | MPP_VAR_FUNCTION(0x3, "tdm", "pclk", V_MV78230_PLUS), | ||
170 | MPP_VAR_FUNCTION(0x4, "lcd", "vsync", V_MV78230_PLUS)), | ||
171 | MPP_MODE(26, | ||
172 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
173 | MPP_VAR_FUNCTION(0x3, "tdm", "fsync", V_MV78230_PLUS), | ||
174 | MPP_VAR_FUNCTION(0x4, "lcd", "clk", V_MV78230_PLUS), | ||
175 | MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd", V_MV78230_PLUS)), | ||
176 | MPP_MODE(27, | ||
177 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
178 | MPP_VAR_FUNCTION(0x1, "ptp", "trig", V_MV78230_PLUS), | ||
179 | MPP_VAR_FUNCTION(0x3, "tdm", "dtx", V_MV78230_PLUS), | ||
180 | MPP_VAR_FUNCTION(0x4, "lcd", "e", V_MV78230_PLUS)), | ||
181 | MPP_MODE(28, | ||
182 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
183 | MPP_VAR_FUNCTION(0x1, "ptp", "evreq", V_MV78230_PLUS), | ||
184 | MPP_VAR_FUNCTION(0x3, "tdm", "drx", V_MV78230_PLUS), | ||
185 | MPP_VAR_FUNCTION(0x4, "lcd", "pwm", V_MV78230_PLUS)), | ||
186 | MPP_MODE(29, | ||
187 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
188 | MPP_VAR_FUNCTION(0x1, "ptp", "clk", V_MV78230_PLUS), | ||
189 | MPP_VAR_FUNCTION(0x3, "tdm", "int0", V_MV78230_PLUS), | ||
190 | MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS), | ||
191 | MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), | ||
192 | MPP_MODE(30, | ||
193 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
194 | MPP_VAR_FUNCTION(0x1, "sd0", "clk", V_MV78230_PLUS), | ||
195 | MPP_VAR_FUNCTION(0x3, "tdm", "int1", V_MV78230_PLUS)), | ||
196 | MPP_MODE(31, | ||
197 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
198 | MPP_VAR_FUNCTION(0x1, "sd0", "cmd", V_MV78230_PLUS), | ||
199 | MPP_VAR_FUNCTION(0x3, "tdm", "int2", V_MV78230_PLUS), | ||
200 | MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), | ||
201 | MPP_MODE(32, | ||
202 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
203 | MPP_VAR_FUNCTION(0x1, "sd0", "d0", V_MV78230_PLUS), | ||
204 | MPP_VAR_FUNCTION(0x3, "tdm", "int3", V_MV78230_PLUS), | ||
205 | MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd", V_MV78230_PLUS)), | ||
206 | MPP_MODE(33, | ||
207 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
208 | MPP_VAR_FUNCTION(0x1, "sd0", "d1", V_MV78230_PLUS), | ||
209 | MPP_VAR_FUNCTION(0x3, "tdm", "int4", V_MV78230_PLUS), | ||
210 | MPP_VAR_FUNCTION(0x4, "mem", "bat", V_MV78230_PLUS)), | ||
211 | MPP_MODE(34, | ||
212 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
213 | MPP_VAR_FUNCTION(0x1, "sd0", "d2", V_MV78230_PLUS), | ||
214 | MPP_VAR_FUNCTION(0x2, "sata0", "prsnt", V_MV78230_PLUS), | ||
215 | MPP_VAR_FUNCTION(0x3, "tdm", "int5", V_MV78230_PLUS)), | ||
216 | MPP_MODE(35, | ||
217 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
218 | MPP_VAR_FUNCTION(0x1, "sd0", "d3", V_MV78230_PLUS), | ||
219 | MPP_VAR_FUNCTION(0x2, "sata1", "prsnt", V_MV78230_PLUS), | ||
220 | MPP_VAR_FUNCTION(0x3, "tdm", "int6", V_MV78230_PLUS)), | ||
221 | MPP_MODE(36, | ||
222 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
223 | MPP_VAR_FUNCTION(0x1, "spi", "mosi", V_MV78230_PLUS)), | ||
224 | MPP_MODE(37, | ||
225 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
226 | MPP_VAR_FUNCTION(0x1, "spi", "miso", V_MV78230_PLUS)), | ||
227 | MPP_MODE(38, | ||
228 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
229 | MPP_VAR_FUNCTION(0x1, "spi", "sck", V_MV78230_PLUS)), | ||
230 | MPP_MODE(39, | ||
231 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
232 | MPP_VAR_FUNCTION(0x1, "spi", "cs0", V_MV78230_PLUS)), | ||
233 | MPP_MODE(40, | ||
234 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
235 | MPP_VAR_FUNCTION(0x1, "spi", "cs1", V_MV78230_PLUS), | ||
236 | MPP_VAR_FUNCTION(0x2, "uart2", "cts", V_MV78230_PLUS), | ||
237 | MPP_VAR_FUNCTION(0x3, "vdd", "cpu1-pd", V_MV78230_PLUS), | ||
238 | MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync", V_MV78230_PLUS), | ||
239 | MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0", V_MV78230_PLUS)), | ||
240 | MPP_MODE(41, | ||
241 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
242 | MPP_VAR_FUNCTION(0x1, "spi", "cs2", V_MV78230_PLUS), | ||
243 | MPP_VAR_FUNCTION(0x2, "uart2", "rts", V_MV78230_PLUS), | ||
244 | MPP_VAR_FUNCTION(0x3, "sata1", "prsnt", V_MV78230_PLUS), | ||
245 | MPP_VAR_FUNCTION(0x4, "lcd", "vga-vsync", V_MV78230_PLUS), | ||
246 | MPP_VAR_FUNCTION(0x5, "pcie", "clkreq1", V_MV78230_PLUS)), | ||
247 | MPP_MODE(42, | ||
248 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
249 | MPP_VAR_FUNCTION(0x1, "uart2", "rxd", V_MV78230_PLUS), | ||
250 | MPP_VAR_FUNCTION(0x2, "uart0", "cts", V_MV78230_PLUS), | ||
251 | MPP_VAR_FUNCTION(0x3, "tdm", "int7", V_MV78230_PLUS), | ||
252 | MPP_VAR_FUNCTION(0x4, "tdm-1", "timer", V_MV78230_PLUS), | ||
253 | MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), | ||
254 | MPP_MODE(43, | ||
255 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
256 | MPP_VAR_FUNCTION(0x1, "uart2", "txd", V_MV78230_PLUS), | ||
257 | MPP_VAR_FUNCTION(0x2, "uart0", "rts", V_MV78230_PLUS), | ||
258 | MPP_VAR_FUNCTION(0x3, "spi", "cs3", V_MV78230_PLUS), | ||
259 | MPP_VAR_FUNCTION(0x4, "pcie", "rstout", V_MV78230_PLUS), | ||
260 | MPP_VAR_FUNCTION(0x5, "vdd", "cpu2-3-pd", V_MV78460)), | ||
261 | MPP_MODE(44, | ||
262 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
263 | MPP_VAR_FUNCTION(0x1, "uart2", "cts", V_MV78230_PLUS), | ||
264 | MPP_VAR_FUNCTION(0x2, "uart3", "rxd", V_MV78230_PLUS), | ||
265 | MPP_VAR_FUNCTION(0x3, "spi", "cs4", V_MV78230_PLUS), | ||
266 | MPP_VAR_FUNCTION(0x4, "mem", "bat", V_MV78230_PLUS), | ||
267 | MPP_VAR_FUNCTION(0x5, "pcie", "clkreq2", V_MV78230_PLUS)), | ||
268 | MPP_MODE(45, | ||
269 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
270 | MPP_VAR_FUNCTION(0x1, "uart2", "rts", V_MV78230_PLUS), | ||
271 | MPP_VAR_FUNCTION(0x2, "uart3", "txd", V_MV78230_PLUS), | ||
272 | MPP_VAR_FUNCTION(0x3, "spi", "cs5", V_MV78230_PLUS), | ||
273 | MPP_VAR_FUNCTION(0x4, "sata1", "prsnt", V_MV78230_PLUS)), | ||
274 | MPP_MODE(46, | ||
275 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
276 | MPP_VAR_FUNCTION(0x1, "uart3", "rts", V_MV78230_PLUS), | ||
277 | MPP_VAR_FUNCTION(0x2, "uart1", "rts", V_MV78230_PLUS), | ||
278 | MPP_VAR_FUNCTION(0x3, "spi", "cs6", V_MV78230_PLUS), | ||
279 | MPP_VAR_FUNCTION(0x4, "sata0", "prsnt", V_MV78230_PLUS)), | ||
280 | MPP_MODE(47, | ||
281 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
282 | MPP_VAR_FUNCTION(0x1, "uart3", "cts", V_MV78230_PLUS), | ||
283 | MPP_VAR_FUNCTION(0x2, "uart1", "cts", V_MV78230_PLUS), | ||
284 | MPP_VAR_FUNCTION(0x3, "spi", "cs7", V_MV78230_PLUS), | ||
285 | MPP_VAR_FUNCTION(0x4, "ref", "clkout", V_MV78230_PLUS), | ||
286 | MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3", V_MV78230_PLUS)), | ||
287 | MPP_MODE(48, | ||
288 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), | ||
289 | MPP_VAR_FUNCTION(0x1, "tclk", NULL, V_MV78230_PLUS), | ||
290 | MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS)), | ||
291 | MPP_MODE(49, | ||
292 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
293 | MPP_VAR_FUNCTION(0x1, "dev", "we3", V_MV78260_PLUS)), | ||
294 | MPP_MODE(50, | ||
295 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
296 | MPP_VAR_FUNCTION(0x1, "dev", "we2", V_MV78260_PLUS)), | ||
297 | MPP_MODE(51, | ||
298 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
299 | MPP_VAR_FUNCTION(0x1, "dev", "ad16", V_MV78260_PLUS)), | ||
300 | MPP_MODE(52, | ||
301 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
302 | MPP_VAR_FUNCTION(0x1, "dev", "ad17", V_MV78260_PLUS)), | ||
303 | MPP_MODE(53, | ||
304 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
305 | MPP_VAR_FUNCTION(0x1, "dev", "ad18", V_MV78260_PLUS)), | ||
306 | MPP_MODE(54, | ||
307 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
308 | MPP_VAR_FUNCTION(0x1, "dev", "ad19", V_MV78260_PLUS)), | ||
309 | MPP_MODE(55, | ||
310 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
311 | MPP_VAR_FUNCTION(0x1, "dev", "ad20", V_MV78260_PLUS), | ||
312 | MPP_VAR_FUNCTION(0x2, "vdd", "cpu0-pd", V_MV78260_PLUS)), | ||
313 | MPP_MODE(56, | ||
314 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
315 | MPP_VAR_FUNCTION(0x1, "dev", "ad21", V_MV78260_PLUS), | ||
316 | MPP_VAR_FUNCTION(0x2, "vdd", "cpu1-pd", V_MV78260_PLUS)), | ||
317 | MPP_MODE(57, | ||
318 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
319 | MPP_VAR_FUNCTION(0x1, "dev", "ad22", V_MV78260_PLUS), | ||
320 | MPP_VAR_FUNCTION(0x2, "vdd", "cpu2-3-pd", V_MV78460)), | ||
321 | MPP_MODE(58, | ||
322 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
323 | MPP_VAR_FUNCTION(0x1, "dev", "ad23", V_MV78260_PLUS)), | ||
324 | MPP_MODE(59, | ||
325 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
326 | MPP_VAR_FUNCTION(0x1, "dev", "ad24", V_MV78260_PLUS)), | ||
327 | MPP_MODE(60, | ||
328 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
329 | MPP_VAR_FUNCTION(0x1, "dev", "ad25", V_MV78260_PLUS)), | ||
330 | MPP_MODE(61, | ||
331 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
332 | MPP_VAR_FUNCTION(0x1, "dev", "ad26", V_MV78260_PLUS)), | ||
333 | MPP_MODE(62, | ||
334 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
335 | MPP_VAR_FUNCTION(0x1, "dev", "ad27", V_MV78260_PLUS)), | ||
336 | MPP_MODE(63, | ||
337 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
338 | MPP_VAR_FUNCTION(0x1, "dev", "ad28", V_MV78260_PLUS)), | ||
339 | MPP_MODE(64, | ||
340 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
341 | MPP_VAR_FUNCTION(0x1, "dev", "ad29", V_MV78260_PLUS)), | ||
342 | MPP_MODE(65, | ||
343 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
344 | MPP_VAR_FUNCTION(0x1, "dev", "ad30", V_MV78260_PLUS)), | ||
345 | MPP_MODE(66, | ||
346 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), | ||
347 | MPP_VAR_FUNCTION(0x1, "dev", "ad31", V_MV78260_PLUS)), | ||
348 | }; | ||
349 | |||
350 | static struct mvebu_pinctrl_soc_info armada_xp_pinctrl_info; | ||
351 | |||
352 | static struct of_device_id armada_xp_pinctrl_of_match[] __devinitdata = { | ||
353 | { | ||
354 | .compatible = "marvell,mv78230-pinctrl", | ||
355 | .data = (void *) V_MV78230, | ||
356 | }, | ||
357 | { | ||
358 | .compatible = "marvell,mv78260-pinctrl", | ||
359 | .data = (void *) V_MV78260, | ||
360 | }, | ||
361 | { | ||
362 | .compatible = "marvell,mv78460-pinctrl", | ||
363 | .data = (void *) V_MV78460, | ||
364 | }, | ||
365 | { }, | ||
366 | }; | ||
367 | |||
368 | static struct mvebu_mpp_ctrl mv78230_mpp_controls[] = { | ||
369 | MPP_REG_CTRL(0, 48), | ||
370 | }; | ||
371 | |||
372 | static struct pinctrl_gpio_range mv78230_mpp_gpio_ranges[] = { | ||
373 | MPP_GPIO_RANGE(0, 0, 0, 32), | ||
374 | MPP_GPIO_RANGE(1, 32, 32, 17), | ||
375 | }; | ||
376 | |||
377 | static struct mvebu_mpp_ctrl mv78260_mpp_controls[] = { | ||
378 | MPP_REG_CTRL(0, 66), | ||
379 | }; | ||
380 | |||
381 | static struct pinctrl_gpio_range mv78260_mpp_gpio_ranges[] = { | ||
382 | MPP_GPIO_RANGE(0, 0, 0, 32), | ||
383 | MPP_GPIO_RANGE(1, 32, 32, 32), | ||
384 | MPP_GPIO_RANGE(2, 64, 64, 3), | ||
385 | }; | ||
386 | |||
387 | static struct mvebu_mpp_ctrl mv78460_mpp_controls[] = { | ||
388 | MPP_REG_CTRL(0, 66), | ||
389 | }; | ||
390 | |||
391 | static struct pinctrl_gpio_range mv78460_mpp_gpio_ranges[] = { | ||
392 | MPP_GPIO_RANGE(0, 0, 0, 32), | ||
393 | MPP_GPIO_RANGE(1, 32, 32, 32), | ||
394 | MPP_GPIO_RANGE(2, 64, 64, 3), | ||
395 | }; | ||
396 | |||
397 | static int __devinit armada_xp_pinctrl_probe(struct platform_device *pdev) | ||
398 | { | ||
399 | struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info; | ||
400 | const struct of_device_id *match = | ||
401 | of_match_device(armada_xp_pinctrl_of_match, &pdev->dev); | ||
402 | |||
403 | if (!match) | ||
404 | return -ENODEV; | ||
405 | |||
406 | soc->variant = (unsigned) match->data & 0xff; | ||
407 | |||
408 | switch (soc->variant) { | ||
409 | case V_MV78230: | ||
410 | soc->controls = mv78230_mpp_controls; | ||
411 | soc->ncontrols = ARRAY_SIZE(mv78230_mpp_controls); | ||
412 | soc->modes = armada_xp_mpp_modes; | ||
413 | /* We don't necessarily want the full list of the | ||
414 | * armada_xp_mpp_modes, but only the first 'n' ones | ||
415 | * that are available on this SoC */ | ||
416 | soc->nmodes = mv78230_mpp_controls[0].npins; | ||
417 | soc->gpioranges = mv78230_mpp_gpio_ranges; | ||
418 | soc->ngpioranges = ARRAY_SIZE(mv78230_mpp_gpio_ranges); | ||
419 | break; | ||
420 | case V_MV78260: | ||
421 | soc->controls = mv78260_mpp_controls; | ||
422 | soc->ncontrols = ARRAY_SIZE(mv78260_mpp_controls); | ||
423 | soc->modes = armada_xp_mpp_modes; | ||
424 | /* We don't necessarily want the full list of the | ||
425 | * armada_xp_mpp_modes, but only the first 'n' ones | ||
426 | * that are available on this SoC */ | ||
427 | soc->nmodes = mv78260_mpp_controls[0].npins; | ||
428 | soc->gpioranges = mv78260_mpp_gpio_ranges; | ||
429 | soc->ngpioranges = ARRAY_SIZE(mv78260_mpp_gpio_ranges); | ||
430 | break; | ||
431 | case V_MV78460: | ||
432 | soc->controls = mv78460_mpp_controls; | ||
433 | soc->ncontrols = ARRAY_SIZE(mv78460_mpp_controls); | ||
434 | soc->modes = armada_xp_mpp_modes; | ||
435 | /* We don't necessarily want the full list of the | ||
436 | * armada_xp_mpp_modes, but only the first 'n' ones | ||
437 | * that are available on this SoC */ | ||
438 | soc->nmodes = mv78460_mpp_controls[0].npins; | ||
439 | soc->gpioranges = mv78460_mpp_gpio_ranges; | ||
440 | soc->ngpioranges = ARRAY_SIZE(mv78460_mpp_gpio_ranges); | ||
441 | break; | ||
442 | } | ||
443 | |||
444 | pdev->dev.platform_data = soc; | ||
445 | |||
446 | return mvebu_pinctrl_probe(pdev); | ||
447 | } | ||
448 | |||
449 | static int __devexit armada_xp_pinctrl_remove(struct platform_device *pdev) | ||
450 | { | ||
451 | return mvebu_pinctrl_remove(pdev); | ||
452 | } | ||
453 | |||
454 | static struct platform_driver armada_xp_pinctrl_driver = { | ||
455 | .driver = { | ||
456 | .name = "armada-xp-pinctrl", | ||
457 | .owner = THIS_MODULE, | ||
458 | .of_match_table = of_match_ptr(armada_xp_pinctrl_of_match), | ||
459 | }, | ||
460 | .probe = armada_xp_pinctrl_probe, | ||
461 | .remove = __devexit_p(armada_xp_pinctrl_remove), | ||
462 | }; | ||
463 | |||
464 | module_platform_driver(armada_xp_pinctrl_driver); | ||
465 | |||
466 | MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); | ||
467 | MODULE_DESCRIPTION("Marvell Armada XP pinctrl driver"); | ||
468 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index cc0f00d73d15..b446c9641212 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c | |||
@@ -1,11 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * U300 GPIO module. | 2 | * U300 GPIO module. |
3 | * | 3 | * |
4 | * Copyright (C) 2007-2011 ST-Ericsson AB | 4 | * Copyright (C) 2007-2012 ST-Ericsson AB |
5 | * License terms: GNU General Public License (GPL) version 2 | 5 | * License terms: GNU General Public License (GPL) version 2 |
6 | * This can driver either of the two basic GPIO cores | ||
7 | * available in the U300 platforms: | ||
8 | * COH 901 335 - Used in DB3150 (U300 1.0) and DB3200 (U330 1.0) | ||
9 | * COH 901 571/3 - Used in DB3210 (U365 2.0) and DB3350 (U335 1.0) | 6 | * COH 901 571/3 - Used in DB3210 (U365 2.0) and DB3350 (U335 1.0) |
10 | * Author: Linus Walleij <linus.walleij@linaro.org> | 7 | * Author: Linus Walleij <linus.walleij@linaro.org> |
11 | * Author: Jonas Aaberg <jonas.aberg@stericsson.com> | 8 | * Author: Jonas Aaberg <jonas.aberg@stericsson.com> |
@@ -24,19 +21,22 @@ | |||
24 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
25 | #include <linux/pinctrl/consumer.h> | 22 | #include <linux/pinctrl/consumer.h> |
26 | #include <linux/pinctrl/pinconf-generic.h> | 23 | #include <linux/pinctrl/pinconf-generic.h> |
27 | #include <mach/gpio-u300.h> | 24 | #include <linux/platform_data/pinctrl-coh901.h> |
28 | #include "pinctrl-coh901.h" | 25 | #include "pinctrl-coh901.h" |
29 | 26 | ||
27 | #define U300_GPIO_PORT_STRIDE (0x30) | ||
30 | /* | 28 | /* |
31 | * Register definitions for COH 901 335 variant | 29 | * Control Register 32bit (R/W) |
30 | * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores | ||
31 | * gives the number of GPIO pins. | ||
32 | * bit 8-2 (mask 0x000001FC) contains the core version ID. | ||
32 | */ | 33 | */ |
33 | #define U300_335_PORT_STRIDE (0x1C) | 34 | #define U300_GPIO_CR (0x00) |
34 | /* Port X Pin Data Register 32bit, this is both input and output (R/W) */ | 35 | #define U300_GPIO_CR_SYNC_SEL_ENABLE (0x00000002UL) |
35 | #define U300_335_PXPDIR (0x00) | 36 | #define U300_GPIO_CR_BLOCK_CLKRQ_ENABLE (0x00000001UL) |
36 | #define U300_335_PXPDOR (0x00) | 37 | #define U300_GPIO_PXPDIR (0x04) |
37 | /* Port X Pin Config Register 32bit (R/W) */ | 38 | #define U300_GPIO_PXPDOR (0x08) |
38 | #define U300_335_PXPCR (0x04) | 39 | #define U300_GPIO_PXPCR (0x0C) |
39 | /* This register layout is the same in both blocks */ | ||
40 | #define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK (0x0000FFFFUL) | 40 | #define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK (0x0000FFFFUL) |
41 | #define U300_GPIO_PXPCR_PIN_MODE_MASK (0x00000003UL) | 41 | #define U300_GPIO_PXPCR_PIN_MODE_MASK (0x00000003UL) |
42 | #define U300_GPIO_PXPCR_PIN_MODE_SHIFT (0x00000002UL) | 42 | #define U300_GPIO_PXPCR_PIN_MODE_SHIFT (0x00000002UL) |
@@ -44,53 +44,17 @@ | |||
44 | #define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL (0x00000001UL) | 44 | #define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL (0x00000001UL) |
45 | #define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN (0x00000002UL) | 45 | #define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN (0x00000002UL) |
46 | #define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE (0x00000003UL) | 46 | #define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE (0x00000003UL) |
47 | /* Port X Interrupt Event Register 32bit (R/W) */ | 47 | #define U300_GPIO_PXPER (0x10) |
48 | #define U300_335_PXIEV (0x08) | 48 | #define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK (0x000000FFUL) |
49 | /* Port X Interrupt Enable Register 32bit (R/W) */ | 49 | #define U300_GPIO_PXPER_PULL_UP_DISABLE (0x00000001UL) |
50 | #define U300_335_PXIEN (0x0C) | 50 | #define U300_GPIO_PXIEV (0x14) |
51 | /* Port X Interrupt Force Register 32bit (R/W) */ | 51 | #define U300_GPIO_PXIEN (0x18) |
52 | #define U300_335_PXIFR (0x10) | 52 | #define U300_GPIO_PXIFR (0x1C) |
53 | /* Port X Interrupt Config Register 32bit (R/W) */ | 53 | #define U300_GPIO_PXICR (0x20) |
54 | #define U300_335_PXICR (0x14) | ||
55 | /* This register layout is the same in both blocks */ | ||
56 | #define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK (0x000000FFUL) | 54 | #define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK (0x000000FFUL) |
57 | #define U300_GPIO_PXICR_IRQ_CONFIG_MASK (0x00000001UL) | 55 | #define U300_GPIO_PXICR_IRQ_CONFIG_MASK (0x00000001UL) |
58 | #define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE (0x00000000UL) | 56 | #define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE (0x00000000UL) |
59 | #define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE (0x00000001UL) | 57 | #define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE (0x00000001UL) |
60 | /* Port X Pull-up Enable Register 32bit (R/W) */ | ||
61 | #define U300_335_PXPER (0x18) | ||
62 | /* This register layout is the same in both blocks */ | ||
63 | #define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK (0x000000FFUL) | ||
64 | #define U300_GPIO_PXPER_PULL_UP_DISABLE (0x00000001UL) | ||
65 | /* Control Register 32bit (R/W) */ | ||
66 | #define U300_335_CR (0x54) | ||
67 | #define U300_335_CR_BLOCK_CLOCK_ENABLE (0x00000001UL) | ||
68 | |||
69 | /* | ||
70 | * Register definitions for COH 901 571 / 3 variant | ||
71 | */ | ||
72 | #define U300_571_PORT_STRIDE (0x30) | ||
73 | /* | ||
74 | * Control Register 32bit (R/W) | ||
75 | * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores | ||
76 | * gives the number of GPIO pins. | ||
77 | * bit 8-2 (mask 0x000001FC) contains the core version ID. | ||
78 | */ | ||
79 | #define U300_571_CR (0x00) | ||
80 | #define U300_571_CR_SYNC_SEL_ENABLE (0x00000002UL) | ||
81 | #define U300_571_CR_BLOCK_CLKRQ_ENABLE (0x00000001UL) | ||
82 | /* | ||
83 | * These registers have the same layout and function as the corresponding | ||
84 | * COH 901 335 registers, just at different offset. | ||
85 | */ | ||
86 | #define U300_571_PXPDIR (0x04) | ||
87 | #define U300_571_PXPDOR (0x08) | ||
88 | #define U300_571_PXPCR (0x0C) | ||
89 | #define U300_571_PXPER (0x10) | ||
90 | #define U300_571_PXIEV (0x14) | ||
91 | #define U300_571_PXIEN (0x18) | ||
92 | #define U300_571_PXIFR (0x1C) | ||
93 | #define U300_571_PXICR (0x20) | ||
94 | 58 | ||
95 | /* 8 bits per port, no version has more than 7 ports */ | 59 | /* 8 bits per port, no version has more than 7 ports */ |
96 | #define U300_GPIO_PINS_PER_PORT 8 | 60 | #define U300_GPIO_PINS_PER_PORT 8 |
@@ -149,8 +113,6 @@ struct u300_gpio_confdata { | |||
149 | 113 | ||
150 | /* BS335 has seven ports of 8 bits each = GPIO pins 0..55 */ | 114 | /* BS335 has seven ports of 8 bits each = GPIO pins 0..55 */ |
151 | #define BS335_GPIO_NUM_PORTS 7 | 115 | #define BS335_GPIO_NUM_PORTS 7 |
152 | /* BS365 has five ports of 8 bits each = GPIO pins 0..39 */ | ||
153 | #define BS365_GPIO_NUM_PORTS 5 | ||
154 | 116 | ||
155 | #define U300_FLOATING_INPUT { \ | 117 | #define U300_FLOATING_INPUT { \ |
156 | .bias_mode = PIN_CONFIG_BIAS_HIGH_IMPEDANCE, \ | 118 | .bias_mode = PIN_CONFIG_BIAS_HIGH_IMPEDANCE, \ |
@@ -172,7 +134,6 @@ struct u300_gpio_confdata { | |||
172 | .outval = 1, \ | 134 | .outval = 1, \ |
173 | } | 135 | } |
174 | 136 | ||
175 | |||
176 | /* Initial configuration */ | 137 | /* Initial configuration */ |
177 | static const struct __initconst u300_gpio_confdata | 138 | static const struct __initconst u300_gpio_confdata |
178 | bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = { | 139 | bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = { |
@@ -255,66 +216,6 @@ bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = { | |||
255 | } | 216 | } |
256 | }; | 217 | }; |
257 | 218 | ||
258 | static const struct __initconst u300_gpio_confdata | ||
259 | bs365_gpio_config[BS365_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = { | ||
260 | /* Port 0, pins 0-7 */ | ||
261 | { | ||
262 | U300_FLOATING_INPUT, | ||
263 | U300_OUTPUT_LOW, | ||
264 | U300_FLOATING_INPUT, | ||
265 | U300_OUTPUT_LOW, | ||
266 | U300_OUTPUT_LOW, | ||
267 | U300_OUTPUT_LOW, | ||
268 | U300_PULL_UP_INPUT, | ||
269 | U300_FLOATING_INPUT, | ||
270 | }, | ||
271 | /* Port 1, pins 0-7 */ | ||
272 | { | ||
273 | U300_OUTPUT_LOW, | ||
274 | U300_FLOATING_INPUT, | ||
275 | U300_OUTPUT_LOW, | ||
276 | U300_FLOATING_INPUT, | ||
277 | U300_FLOATING_INPUT, | ||
278 | U300_OUTPUT_HIGH, | ||
279 | U300_OUTPUT_LOW, | ||
280 | U300_OUTPUT_LOW, | ||
281 | }, | ||
282 | /* Port 2, pins 0-7 */ | ||
283 | { | ||
284 | U300_FLOATING_INPUT, | ||
285 | U300_PULL_UP_INPUT, | ||
286 | U300_OUTPUT_LOW, | ||
287 | U300_OUTPUT_LOW, | ||
288 | U300_PULL_UP_INPUT, | ||
289 | U300_PULL_UP_INPUT, | ||
290 | U300_PULL_UP_INPUT, | ||
291 | U300_PULL_UP_INPUT, | ||
292 | }, | ||
293 | /* Port 3, pins 0-7 */ | ||
294 | { | ||
295 | U300_PULL_UP_INPUT, | ||
296 | U300_PULL_UP_INPUT, | ||
297 | U300_PULL_UP_INPUT, | ||
298 | U300_PULL_UP_INPUT, | ||
299 | U300_PULL_UP_INPUT, | ||
300 | U300_PULL_UP_INPUT, | ||
301 | U300_PULL_UP_INPUT, | ||
302 | U300_PULL_UP_INPUT, | ||
303 | }, | ||
304 | /* Port 4, pins 0-7 */ | ||
305 | { | ||
306 | U300_PULL_UP_INPUT, | ||
307 | U300_PULL_UP_INPUT, | ||
308 | U300_PULL_UP_INPUT, | ||
309 | U300_PULL_UP_INPUT, | ||
310 | /* These 4 pins doesn't exist on DB3210 */ | ||
311 | U300_OUTPUT_LOW, | ||
312 | U300_OUTPUT_LOW, | ||
313 | U300_OUTPUT_LOW, | ||
314 | U300_OUTPUT_LOW, | ||
315 | } | ||
316 | }; | ||
317 | |||
318 | /** | 219 | /** |
319 | * to_u300_gpio() - get the pointer to u300_gpio | 220 | * to_u300_gpio() - get the pointer to u300_gpio |
320 | * @chip: the gpio chip member of the structure u300_gpio | 221 | * @chip: the gpio chip member of the structure u300_gpio |
@@ -716,13 +617,7 @@ static void __init u300_gpio_init_coh901571(struct u300_gpio *gpio, | |||
716 | const struct u300_gpio_confdata *conf; | 617 | const struct u300_gpio_confdata *conf; |
717 | int offset = (i*8) + j; | 618 | int offset = (i*8) + j; |
718 | 619 | ||
719 | if (plat->variant == U300_GPIO_COH901571_3_BS335) | 620 | conf = &bs335_gpio_config[i][j]; |
720 | conf = &bs335_gpio_config[i][j]; | ||
721 | else if (plat->variant == U300_GPIO_COH901571_3_BS365) | ||
722 | conf = &bs365_gpio_config[i][j]; | ||
723 | else | ||
724 | break; | ||
725 | |||
726 | u300_gpio_init_pin(gpio, offset, conf); | 621 | u300_gpio_init_pin(gpio, offset, conf); |
727 | } | 622 | } |
728 | } | 623 | } |
@@ -796,50 +691,27 @@ static int __init u300_gpio_probe(struct platform_device *pdev) | |||
796 | goto err_no_ioremap; | 691 | goto err_no_ioremap; |
797 | } | 692 | } |
798 | 693 | ||
799 | if (plat->variant == U300_GPIO_COH901335) { | 694 | dev_info(gpio->dev, |
800 | dev_info(gpio->dev, | 695 | "initializing GPIO Controller COH 901 571/3\n"); |
801 | "initializing GPIO Controller COH 901 335\n"); | 696 | gpio->stride = U300_GPIO_PORT_STRIDE; |
802 | gpio->stride = U300_335_PORT_STRIDE; | 697 | gpio->pcr = U300_GPIO_PXPCR; |
803 | gpio->pcr = U300_335_PXPCR; | 698 | gpio->dor = U300_GPIO_PXPDOR; |
804 | gpio->dor = U300_335_PXPDOR; | 699 | gpio->dir = U300_GPIO_PXPDIR; |
805 | gpio->dir = U300_335_PXPDIR; | 700 | gpio->per = U300_GPIO_PXPER; |
806 | gpio->per = U300_335_PXPER; | 701 | gpio->icr = U300_GPIO_PXICR; |
807 | gpio->icr = U300_335_PXICR; | 702 | gpio->ien = U300_GPIO_PXIEN; |
808 | gpio->ien = U300_335_PXIEN; | 703 | gpio->iev = U300_GPIO_PXIEV; |
809 | gpio->iev = U300_335_PXIEV; | 704 | ifr = U300_GPIO_PXIFR; |
810 | ifr = U300_335_PXIFR; | 705 | |
811 | 706 | val = readl(gpio->base + U300_GPIO_CR); | |
812 | /* Turn on the GPIO block */ | 707 | dev_info(gpio->dev, "COH901571/3 block version: %d, " \ |
813 | writel(U300_335_CR_BLOCK_CLOCK_ENABLE, | 708 | "number of cores: %d totalling %d pins\n", |
814 | gpio->base + U300_335_CR); | 709 | ((val & 0x000001FC) >> 2), |
815 | } else if (plat->variant == U300_GPIO_COH901571_3_BS335 || | 710 | ((val & 0x0000FE00) >> 9), |
816 | plat->variant == U300_GPIO_COH901571_3_BS365) { | 711 | ((val & 0x0000FE00) >> 9) * 8); |
817 | dev_info(gpio->dev, | 712 | writel(U300_GPIO_CR_BLOCK_CLKRQ_ENABLE, |
818 | "initializing GPIO Controller COH 901 571/3\n"); | 713 | gpio->base + U300_GPIO_CR); |
819 | gpio->stride = U300_571_PORT_STRIDE; | 714 | u300_gpio_init_coh901571(gpio, plat); |
820 | gpio->pcr = U300_571_PXPCR; | ||
821 | gpio->dor = U300_571_PXPDOR; | ||
822 | gpio->dir = U300_571_PXPDIR; | ||
823 | gpio->per = U300_571_PXPER; | ||
824 | gpio->icr = U300_571_PXICR; | ||
825 | gpio->ien = U300_571_PXIEN; | ||
826 | gpio->iev = U300_571_PXIEV; | ||
827 | ifr = U300_571_PXIFR; | ||
828 | |||
829 | val = readl(gpio->base + U300_571_CR); | ||
830 | dev_info(gpio->dev, "COH901571/3 block version: %d, " \ | ||
831 | "number of cores: %d totalling %d pins\n", | ||
832 | ((val & 0x000001FC) >> 2), | ||
833 | ((val & 0x0000FE00) >> 9), | ||
834 | ((val & 0x0000FE00) >> 9) * 8); | ||
835 | writel(U300_571_CR_BLOCK_CLKRQ_ENABLE, | ||
836 | gpio->base + U300_571_CR); | ||
837 | u300_gpio_init_coh901571(gpio, plat); | ||
838 | } else { | ||
839 | dev_err(gpio->dev, "unknown block variant\n"); | ||
840 | err = -ENODEV; | ||
841 | goto err_unknown_variant; | ||
842 | } | ||
843 | 715 | ||
844 | /* Add each port with its IRQ separately */ | 716 | /* Add each port with its IRQ separately */ |
845 | INIT_LIST_HEAD(&gpio->port_list); | 717 | INIT_LIST_HEAD(&gpio->port_list); |
@@ -906,7 +778,6 @@ err_no_pinctrl: | |||
906 | err_no_chip: | 778 | err_no_chip: |
907 | err_no_port: | 779 | err_no_port: |
908 | u300_gpio_free_ports(gpio); | 780 | u300_gpio_free_ports(gpio); |
909 | err_unknown_variant: | ||
910 | iounmap(gpio->base); | 781 | iounmap(gpio->base); |
911 | err_no_ioremap: | 782 | err_no_ioremap: |
912 | release_mem_region(gpio->memres->start, resource_size(gpio->memres)); | 783 | release_mem_region(gpio->memres->start, resource_size(gpio->memres)); |
@@ -923,16 +794,11 @@ err_no_clk: | |||
923 | 794 | ||
924 | static int __exit u300_gpio_remove(struct platform_device *pdev) | 795 | static int __exit u300_gpio_remove(struct platform_device *pdev) |
925 | { | 796 | { |
926 | struct u300_gpio_platform *plat = dev_get_platdata(&pdev->dev); | ||
927 | struct u300_gpio *gpio = platform_get_drvdata(pdev); | 797 | struct u300_gpio *gpio = platform_get_drvdata(pdev); |
928 | int err; | 798 | int err; |
929 | 799 | ||
930 | /* Turn off the GPIO block */ | 800 | /* Turn off the GPIO block */ |
931 | if (plat->variant == U300_GPIO_COH901335) | 801 | writel(0x00000000U, gpio->base + U300_GPIO_CR); |
932 | writel(0x00000000U, gpio->base + U300_335_CR); | ||
933 | if (plat->variant == U300_GPIO_COH901571_3_BS335 || | ||
934 | plat->variant == U300_GPIO_COH901571_3_BS365) | ||
935 | writel(0x00000000U, gpio->base + U300_571_CR); | ||
936 | 802 | ||
937 | err = gpiochip_remove(&gpio->chip); | 803 | err = gpiochip_remove(&gpio->chip); |
938 | if (err < 0) { | 804 | if (err < 0) { |
diff --git a/drivers/pinctrl/pinctrl-dove.c b/drivers/pinctrl/pinctrl-dove.c new file mode 100644 index 000000000000..ffe74b27d66d --- /dev/null +++ b/drivers/pinctrl/pinctrl-dove.c | |||
@@ -0,0 +1,620 @@ | |||
1 | /* | ||
2 | * Marvell Dove pinctrl driver based on mvebu pinctrl core | ||
3 | * | ||
4 | * Author: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/err.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/bitops.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/of.h> | ||
20 | #include <linux/of_device.h> | ||
21 | #include <linux/pinctrl/pinctrl.h> | ||
22 | |||
23 | #include "pinctrl-mvebu.h" | ||
24 | |||
25 | #define DOVE_SB_REGS_VIRT_BASE 0xfde00000 | ||
26 | #define DOVE_MPP_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xd0200) | ||
27 | #define DOVE_PMU_MPP_GENERAL_CTRL (DOVE_MPP_VIRT_BASE + 0x10) | ||
28 | #define DOVE_AU0_AC97_SEL BIT(16) | ||
29 | #define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE | 0xe802C) | ||
30 | #define DOVE_TWSI_ENABLE_OPTION1 BIT(7) | ||
31 | #define DOVE_GLOBAL_CONFIG_2 (DOVE_SB_REGS_VIRT_BASE | 0xe8030) | ||
32 | #define DOVE_TWSI_ENABLE_OPTION2 BIT(20) | ||
33 | #define DOVE_TWSI_ENABLE_OPTION3 BIT(21) | ||
34 | #define DOVE_TWSI_OPTION3_GPIO BIT(22) | ||
35 | #define DOVE_SSP_CTRL_STATUS_1 (DOVE_SB_REGS_VIRT_BASE | 0xe8034) | ||
36 | #define DOVE_SSP_ON_AU1 BIT(0) | ||
37 | #define DOVE_MPP_GENERAL_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xe803c) | ||
38 | #define DOVE_AU1_SPDIFO_GPIO_EN BIT(1) | ||
39 | #define DOVE_NAND_GPIO_EN BIT(0) | ||
40 | #define DOVE_GPIO_LO_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0xd0400) | ||
41 | #define DOVE_MPP_CTRL4_VIRT_BASE (DOVE_GPIO_LO_VIRT_BASE + 0x40) | ||
42 | #define DOVE_SPI_GPIO_SEL BIT(5) | ||
43 | #define DOVE_UART1_GPIO_SEL BIT(4) | ||
44 | #define DOVE_AU1_GPIO_SEL BIT(3) | ||
45 | #define DOVE_CAM_GPIO_SEL BIT(2) | ||
46 | #define DOVE_SD1_GPIO_SEL BIT(1) | ||
47 | #define DOVE_SD0_GPIO_SEL BIT(0) | ||
48 | |||
49 | #define MPPS_PER_REG 8 | ||
50 | #define MPP_BITS 4 | ||
51 | #define MPP_MASK 0xf | ||
52 | |||
53 | #define CONFIG_PMU BIT(4) | ||
54 | |||
55 | static int dove_pmu_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl, | ||
56 | unsigned long *config) | ||
57 | { | ||
58 | unsigned off = (ctrl->pid / MPPS_PER_REG) * MPP_BITS; | ||
59 | unsigned shift = (ctrl->pid % MPPS_PER_REG) * MPP_BITS; | ||
60 | unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); | ||
61 | unsigned long mpp = readl(DOVE_MPP_VIRT_BASE + off); | ||
62 | |||
63 | if (pmu & (1 << ctrl->pid)) | ||
64 | *config = CONFIG_PMU; | ||
65 | else | ||
66 | *config = (mpp >> shift) & MPP_MASK; | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static int dove_pmu_mpp_ctrl_set(struct mvebu_mpp_ctrl *ctrl, | ||
71 | unsigned long config) | ||
72 | { | ||
73 | unsigned off = (ctrl->pid / MPPS_PER_REG) * MPP_BITS; | ||
74 | unsigned shift = (ctrl->pid % MPPS_PER_REG) * MPP_BITS; | ||
75 | unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); | ||
76 | unsigned long mpp = readl(DOVE_MPP_VIRT_BASE + off); | ||
77 | |||
78 | if (config == CONFIG_PMU) | ||
79 | writel(pmu | (1 << ctrl->pid), DOVE_PMU_MPP_GENERAL_CTRL); | ||
80 | else { | ||
81 | writel(pmu & ~(1 << ctrl->pid), DOVE_PMU_MPP_GENERAL_CTRL); | ||
82 | mpp &= ~(MPP_MASK << shift); | ||
83 | mpp |= config << shift; | ||
84 | writel(mpp, DOVE_MPP_VIRT_BASE + off); | ||
85 | } | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static int dove_mpp4_ctrl_get(struct mvebu_mpp_ctrl *ctrl, | ||
90 | unsigned long *config) | ||
91 | { | ||
92 | unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); | ||
93 | unsigned long mask; | ||
94 | |||
95 | switch (ctrl->pid) { | ||
96 | case 24: /* mpp_camera */ | ||
97 | mask = DOVE_CAM_GPIO_SEL; | ||
98 | break; | ||
99 | case 40: /* mpp_sdio0 */ | ||
100 | mask = DOVE_SD0_GPIO_SEL; | ||
101 | break; | ||
102 | case 46: /* mpp_sdio1 */ | ||
103 | mask = DOVE_SD1_GPIO_SEL; | ||
104 | break; | ||
105 | case 58: /* mpp_spi0 */ | ||
106 | mask = DOVE_SPI_GPIO_SEL; | ||
107 | break; | ||
108 | case 62: /* mpp_uart1 */ | ||
109 | mask = DOVE_UART1_GPIO_SEL; | ||
110 | break; | ||
111 | default: | ||
112 | return -EINVAL; | ||
113 | } | ||
114 | |||
115 | *config = ((mpp4 & mask) != 0); | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static int dove_mpp4_ctrl_set(struct mvebu_mpp_ctrl *ctrl, | ||
121 | unsigned long config) | ||
122 | { | ||
123 | unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); | ||
124 | unsigned long mask; | ||
125 | |||
126 | switch (ctrl->pid) { | ||
127 | case 24: /* mpp_camera */ | ||
128 | mask = DOVE_CAM_GPIO_SEL; | ||
129 | break; | ||
130 | case 40: /* mpp_sdio0 */ | ||
131 | mask = DOVE_SD0_GPIO_SEL; | ||
132 | break; | ||
133 | case 46: /* mpp_sdio1 */ | ||
134 | mask = DOVE_SD1_GPIO_SEL; | ||
135 | break; | ||
136 | case 58: /* mpp_spi0 */ | ||
137 | mask = DOVE_SPI_GPIO_SEL; | ||
138 | break; | ||
139 | case 62: /* mpp_uart1 */ | ||
140 | mask = DOVE_UART1_GPIO_SEL; | ||
141 | break; | ||
142 | default: | ||
143 | return -EINVAL; | ||
144 | } | ||
145 | |||
146 | mpp4 &= ~mask; | ||
147 | if (config) | ||
148 | mpp4 |= mask; | ||
149 | |||
150 | writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | static int dove_nand_ctrl_get(struct mvebu_mpp_ctrl *ctrl, | ||
156 | unsigned long *config) | ||
157 | { | ||
158 | unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); | ||
159 | |||
160 | *config = ((gmpp & DOVE_NAND_GPIO_EN) != 0); | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static int dove_nand_ctrl_set(struct mvebu_mpp_ctrl *ctrl, | ||
166 | unsigned long config) | ||
167 | { | ||
168 | unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); | ||
169 | |||
170 | gmpp &= ~DOVE_NAND_GPIO_EN; | ||
171 | if (config) | ||
172 | gmpp |= DOVE_NAND_GPIO_EN; | ||
173 | |||
174 | writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
179 | static int dove_audio0_ctrl_get(struct mvebu_mpp_ctrl *ctrl, | ||
180 | unsigned long *config) | ||
181 | { | ||
182 | unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); | ||
183 | |||
184 | *config = ((pmu & DOVE_AU0_AC97_SEL) != 0); | ||
185 | |||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | static int dove_audio0_ctrl_set(struct mvebu_mpp_ctrl *ctrl, | ||
190 | unsigned long config) | ||
191 | { | ||
192 | unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); | ||
193 | |||
194 | pmu &= ~DOVE_AU0_AC97_SEL; | ||
195 | if (config) | ||
196 | pmu |= DOVE_AU0_AC97_SEL; | ||
197 | writel(pmu, DOVE_PMU_MPP_GENERAL_CTRL); | ||
198 | |||
199 | return 0; | ||
200 | } | ||
201 | |||
202 | static int dove_audio1_ctrl_get(struct mvebu_mpp_ctrl *ctrl, | ||
203 | unsigned long *config) | ||
204 | { | ||
205 | unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); | ||
206 | unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); | ||
207 | unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); | ||
208 | unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); | ||
209 | |||
210 | *config = 0; | ||
211 | if (mpp4 & DOVE_AU1_GPIO_SEL) | ||
212 | *config |= BIT(3); | ||
213 | if (sspc1 & DOVE_SSP_ON_AU1) | ||
214 | *config |= BIT(2); | ||
215 | if (gmpp & DOVE_AU1_SPDIFO_GPIO_EN) | ||
216 | *config |= BIT(1); | ||
217 | if (gcfg2 & DOVE_TWSI_OPTION3_GPIO) | ||
218 | *config |= BIT(0); | ||
219 | |||
220 | /* SSP/TWSI only if I2S1 not set*/ | ||
221 | if ((*config & BIT(3)) == 0) | ||
222 | *config &= ~(BIT(2) | BIT(0)); | ||
223 | /* TWSI only if SPDIFO not set*/ | ||
224 | if ((*config & BIT(1)) == 0) | ||
225 | *config &= ~BIT(0); | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | static int dove_audio1_ctrl_set(struct mvebu_mpp_ctrl *ctrl, | ||
230 | unsigned long config) | ||
231 | { | ||
232 | unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); | ||
233 | unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); | ||
234 | unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); | ||
235 | unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); | ||
236 | |||
237 | if (config & BIT(0)) | ||
238 | gcfg2 |= DOVE_TWSI_OPTION3_GPIO; | ||
239 | if (config & BIT(1)) | ||
240 | gmpp |= DOVE_AU1_SPDIFO_GPIO_EN; | ||
241 | if (config & BIT(2)) | ||
242 | sspc1 |= DOVE_SSP_ON_AU1; | ||
243 | if (config & BIT(3)) | ||
244 | mpp4 |= DOVE_AU1_GPIO_SEL; | ||
245 | |||
246 | writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); | ||
247 | writel(sspc1, DOVE_SSP_CTRL_STATUS_1); | ||
248 | writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); | ||
249 | writel(gcfg2, DOVE_GLOBAL_CONFIG_2); | ||
250 | |||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | /* mpp[52:57] gpio pins depend heavily on current config; | ||
255 | * gpio_req does not try to mux in gpio capabilities to not | ||
256 | * break other functions. If you require all mpps as gpio | ||
257 | * enforce gpio setting by pinctrl mapping. | ||
258 | */ | ||
259 | static int dove_audio1_ctrl_gpio_req(struct mvebu_mpp_ctrl *ctrl, u8 pid) | ||
260 | { | ||
261 | unsigned long config; | ||
262 | |||
263 | dove_audio1_ctrl_get(ctrl, &config); | ||
264 | |||
265 | switch (config) { | ||
266 | case 0x02: /* i2s1 : gpio[56:57] */ | ||
267 | case 0x0e: /* ssp : gpio[56:57] */ | ||
268 | if (pid >= 56) | ||
269 | return 0; | ||
270 | return -ENOTSUPP; | ||
271 | case 0x08: /* spdifo : gpio[52:55] */ | ||
272 | case 0x0b: /* twsi : gpio[52:55] */ | ||
273 | if (pid <= 55) | ||
274 | return 0; | ||
275 | return -ENOTSUPP; | ||
276 | case 0x0a: /* all gpio */ | ||
277 | return 0; | ||
278 | /* 0x00 : i2s1/spdifo : no gpio */ | ||
279 | /* 0x0c : ssp/spdifo : no gpio */ | ||
280 | /* 0x0f : ssp/twsi : no gpio */ | ||
281 | } | ||
282 | return -ENOTSUPP; | ||
283 | } | ||
284 | |||
285 | /* mpp[52:57] has gpio pins capable of in and out */ | ||
286 | static int dove_audio1_ctrl_gpio_dir(struct mvebu_mpp_ctrl *ctrl, u8 pid, | ||
287 | bool input) | ||
288 | { | ||
289 | if (pid < 52 || pid > 57) | ||
290 | return -ENOTSUPP; | ||
291 | return 0; | ||
292 | } | ||
293 | |||
294 | static int dove_twsi_ctrl_get(struct mvebu_mpp_ctrl *ctrl, | ||
295 | unsigned long *config) | ||
296 | { | ||
297 | unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); | ||
298 | unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); | ||
299 | |||
300 | *config = 0; | ||
301 | if (gcfg1 & DOVE_TWSI_ENABLE_OPTION1) | ||
302 | *config = 1; | ||
303 | else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION2) | ||
304 | *config = 2; | ||
305 | else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION3) | ||
306 | *config = 3; | ||
307 | |||
308 | return 0; | ||
309 | } | ||
310 | |||
311 | static int dove_twsi_ctrl_set(struct mvebu_mpp_ctrl *ctrl, | ||
312 | unsigned long config) | ||
313 | { | ||
314 | unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); | ||
315 | unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); | ||
316 | |||
317 | gcfg1 &= ~DOVE_TWSI_ENABLE_OPTION1; | ||
318 | gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION2); | ||
319 | |||
320 | switch (config) { | ||
321 | case 1: | ||
322 | gcfg1 |= DOVE_TWSI_ENABLE_OPTION1; | ||
323 | break; | ||
324 | case 2: | ||
325 | gcfg2 |= DOVE_TWSI_ENABLE_OPTION2; | ||
326 | break; | ||
327 | case 3: | ||
328 | gcfg2 |= DOVE_TWSI_ENABLE_OPTION3; | ||
329 | break; | ||
330 | } | ||
331 | |||
332 | writel(gcfg1, DOVE_GLOBAL_CONFIG_1); | ||
333 | writel(gcfg2, DOVE_GLOBAL_CONFIG_2); | ||
334 | |||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static struct mvebu_mpp_ctrl dove_mpp_controls[] = { | ||
339 | MPP_FUNC_CTRL(0, 0, "mpp0", dove_pmu_mpp_ctrl), | ||
340 | MPP_FUNC_CTRL(1, 1, "mpp1", dove_pmu_mpp_ctrl), | ||
341 | MPP_FUNC_CTRL(2, 2, "mpp2", dove_pmu_mpp_ctrl), | ||
342 | MPP_FUNC_CTRL(3, 3, "mpp3", dove_pmu_mpp_ctrl), | ||
343 | MPP_FUNC_CTRL(4, 4, "mpp4", dove_pmu_mpp_ctrl), | ||
344 | MPP_FUNC_CTRL(5, 5, "mpp5", dove_pmu_mpp_ctrl), | ||
345 | MPP_FUNC_CTRL(6, 6, "mpp6", dove_pmu_mpp_ctrl), | ||
346 | MPP_FUNC_CTRL(7, 7, "mpp7", dove_pmu_mpp_ctrl), | ||
347 | MPP_FUNC_CTRL(8, 8, "mpp8", dove_pmu_mpp_ctrl), | ||
348 | MPP_FUNC_CTRL(9, 9, "mpp9", dove_pmu_mpp_ctrl), | ||
349 | MPP_FUNC_CTRL(10, 10, "mpp10", dove_pmu_mpp_ctrl), | ||
350 | MPP_FUNC_CTRL(11, 11, "mpp11", dove_pmu_mpp_ctrl), | ||
351 | MPP_FUNC_CTRL(12, 12, "mpp12", dove_pmu_mpp_ctrl), | ||
352 | MPP_FUNC_CTRL(13, 13, "mpp13", dove_pmu_mpp_ctrl), | ||
353 | MPP_FUNC_CTRL(14, 14, "mpp14", dove_pmu_mpp_ctrl), | ||
354 | MPP_FUNC_CTRL(15, 15, "mpp15", dove_pmu_mpp_ctrl), | ||
355 | MPP_REG_CTRL(16, 23), | ||
356 | MPP_FUNC_CTRL(24, 39, "mpp_camera", dove_mpp4_ctrl), | ||
357 | MPP_FUNC_CTRL(40, 45, "mpp_sdio0", dove_mpp4_ctrl), | ||
358 | MPP_FUNC_CTRL(46, 51, "mpp_sdio1", dove_mpp4_ctrl), | ||
359 | MPP_FUNC_GPIO_CTRL(52, 57, "mpp_audio1", dove_audio1_ctrl), | ||
360 | MPP_FUNC_CTRL(58, 61, "mpp_spi0", dove_mpp4_ctrl), | ||
361 | MPP_FUNC_CTRL(62, 63, "mpp_uart1", dove_mpp4_ctrl), | ||
362 | MPP_FUNC_CTRL(64, 71, "mpp_nand", dove_nand_ctrl), | ||
363 | MPP_FUNC_CTRL(72, 72, "audio0", dove_audio0_ctrl), | ||
364 | MPP_FUNC_CTRL(73, 73, "twsi", dove_twsi_ctrl), | ||
365 | }; | ||
366 | |||
367 | static struct mvebu_mpp_mode dove_mpp_modes[] = { | ||
368 | MPP_MODE(0, | ||
369 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
370 | MPP_FUNCTION(0x02, "uart2", "rts"), | ||
371 | MPP_FUNCTION(0x03, "sdio0", "cd"), | ||
372 | MPP_FUNCTION(0x0f, "lcd0", "pwm"), | ||
373 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
374 | MPP_MODE(1, | ||
375 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
376 | MPP_FUNCTION(0x02, "uart2", "cts"), | ||
377 | MPP_FUNCTION(0x03, "sdio0", "wp"), | ||
378 | MPP_FUNCTION(0x0f, "lcd1", "pwm"), | ||
379 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
380 | MPP_MODE(2, | ||
381 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
382 | MPP_FUNCTION(0x01, "sata", "prsnt"), | ||
383 | MPP_FUNCTION(0x02, "uart2", "txd"), | ||
384 | MPP_FUNCTION(0x03, "sdio0", "buspwr"), | ||
385 | MPP_FUNCTION(0x04, "uart1", "rts"), | ||
386 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
387 | MPP_MODE(3, | ||
388 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
389 | MPP_FUNCTION(0x01, "sata", "act"), | ||
390 | MPP_FUNCTION(0x02, "uart2", "rxd"), | ||
391 | MPP_FUNCTION(0x03, "sdio0", "ledctrl"), | ||
392 | MPP_FUNCTION(0x04, "uart1", "cts"), | ||
393 | MPP_FUNCTION(0x0f, "lcd-spi", "cs1"), | ||
394 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
395 | MPP_MODE(4, | ||
396 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
397 | MPP_FUNCTION(0x02, "uart3", "rts"), | ||
398 | MPP_FUNCTION(0x03, "sdio1", "cd"), | ||
399 | MPP_FUNCTION(0x04, "spi1", "miso"), | ||
400 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
401 | MPP_MODE(5, | ||
402 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
403 | MPP_FUNCTION(0x02, "uart3", "cts"), | ||
404 | MPP_FUNCTION(0x03, "sdio1", "wp"), | ||
405 | MPP_FUNCTION(0x04, "spi1", "cs"), | ||
406 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
407 | MPP_MODE(6, | ||
408 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
409 | MPP_FUNCTION(0x02, "uart3", "txd"), | ||
410 | MPP_FUNCTION(0x03, "sdio1", "buspwr"), | ||
411 | MPP_FUNCTION(0x04, "spi1", "mosi"), | ||
412 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
413 | MPP_MODE(7, | ||
414 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
415 | MPP_FUNCTION(0x02, "uart3", "rxd"), | ||
416 | MPP_FUNCTION(0x03, "sdio1", "ledctrl"), | ||
417 | MPP_FUNCTION(0x04, "spi1", "sck"), | ||
418 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
419 | MPP_MODE(8, | ||
420 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
421 | MPP_FUNCTION(0x01, "watchdog", "rstout"), | ||
422 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
423 | MPP_MODE(9, | ||
424 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
425 | MPP_FUNCTION(0x05, "pex1", "clkreq"), | ||
426 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
427 | MPP_MODE(10, | ||
428 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
429 | MPP_FUNCTION(0x05, "ssp", "sclk"), | ||
430 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
431 | MPP_MODE(11, | ||
432 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
433 | MPP_FUNCTION(0x01, "sata", "prsnt"), | ||
434 | MPP_FUNCTION(0x02, "sata-1", "act"), | ||
435 | MPP_FUNCTION(0x03, "sdio0", "ledctrl"), | ||
436 | MPP_FUNCTION(0x04, "sdio1", "ledctrl"), | ||
437 | MPP_FUNCTION(0x05, "pex0", "clkreq"), | ||
438 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
439 | MPP_MODE(12, | ||
440 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
441 | MPP_FUNCTION(0x01, "sata", "act"), | ||
442 | MPP_FUNCTION(0x02, "uart2", "rts"), | ||
443 | MPP_FUNCTION(0x03, "audio0", "extclk"), | ||
444 | MPP_FUNCTION(0x04, "sdio1", "cd"), | ||
445 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
446 | MPP_MODE(13, | ||
447 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
448 | MPP_FUNCTION(0x02, "uart2", "cts"), | ||
449 | MPP_FUNCTION(0x03, "audio1", "extclk"), | ||
450 | MPP_FUNCTION(0x04, "sdio1", "wp"), | ||
451 | MPP_FUNCTION(0x05, "ssp", "extclk"), | ||
452 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
453 | MPP_MODE(14, | ||
454 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
455 | MPP_FUNCTION(0x02, "uart2", "txd"), | ||
456 | MPP_FUNCTION(0x04, "sdio1", "buspwr"), | ||
457 | MPP_FUNCTION(0x05, "ssp", "rxd"), | ||
458 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
459 | MPP_MODE(15, | ||
460 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
461 | MPP_FUNCTION(0x02, "uart2", "rxd"), | ||
462 | MPP_FUNCTION(0x04, "sdio1", "ledctrl"), | ||
463 | MPP_FUNCTION(0x05, "ssp", "sfrm"), | ||
464 | MPP_FUNCTION(0x10, "pmu", NULL)), | ||
465 | MPP_MODE(16, | ||
466 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
467 | MPP_FUNCTION(0x02, "uart3", "rts"), | ||
468 | MPP_FUNCTION(0x03, "sdio0", "cd"), | ||
469 | MPP_FUNCTION(0x04, "lcd-spi", "cs1"), | ||
470 | MPP_FUNCTION(0x05, "ac97", "sdi1")), | ||
471 | MPP_MODE(17, | ||
472 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
473 | MPP_FUNCTION(0x01, "ac97-1", "sysclko"), | ||
474 | MPP_FUNCTION(0x02, "uart3", "cts"), | ||
475 | MPP_FUNCTION(0x03, "sdio0", "wp"), | ||
476 | MPP_FUNCTION(0x04, "twsi", "sda"), | ||
477 | MPP_FUNCTION(0x05, "ac97", "sdi2")), | ||
478 | MPP_MODE(18, | ||
479 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
480 | MPP_FUNCTION(0x02, "uart3", "txd"), | ||
481 | MPP_FUNCTION(0x03, "sdio0", "buspwr"), | ||
482 | MPP_FUNCTION(0x04, "lcd0", "pwm"), | ||
483 | MPP_FUNCTION(0x05, "ac97", "sdi3")), | ||
484 | MPP_MODE(19, | ||
485 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
486 | MPP_FUNCTION(0x02, "uart3", "rxd"), | ||
487 | MPP_FUNCTION(0x03, "sdio0", "ledctrl"), | ||
488 | MPP_FUNCTION(0x04, "twsi", "sck")), | ||
489 | MPP_MODE(20, | ||
490 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
491 | MPP_FUNCTION(0x01, "ac97", "sysclko"), | ||
492 | MPP_FUNCTION(0x02, "lcd-spi", "miso"), | ||
493 | MPP_FUNCTION(0x03, "sdio1", "cd"), | ||
494 | MPP_FUNCTION(0x05, "sdio0", "cd"), | ||
495 | MPP_FUNCTION(0x06, "spi1", "miso")), | ||
496 | MPP_MODE(21, | ||
497 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
498 | MPP_FUNCTION(0x01, "uart1", "rts"), | ||
499 | MPP_FUNCTION(0x02, "lcd-spi", "cs0"), | ||
500 | MPP_FUNCTION(0x03, "sdio1", "wp"), | ||
501 | MPP_FUNCTION(0x04, "ssp", "sfrm"), | ||
502 | MPP_FUNCTION(0x05, "sdio0", "wp"), | ||
503 | MPP_FUNCTION(0x06, "spi1", "cs")), | ||
504 | MPP_MODE(22, | ||
505 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
506 | MPP_FUNCTION(0x01, "uart1", "cts"), | ||
507 | MPP_FUNCTION(0x02, "lcd-spi", "mosi"), | ||
508 | MPP_FUNCTION(0x03, "sdio1", "buspwr"), | ||
509 | MPP_FUNCTION(0x04, "ssp", "txd"), | ||
510 | MPP_FUNCTION(0x05, "sdio0", "buspwr"), | ||
511 | MPP_FUNCTION(0x06, "spi1", "mosi")), | ||
512 | MPP_MODE(23, | ||
513 | MPP_FUNCTION(0x00, "gpio", NULL), | ||
514 | MPP_FUNCTION(0x02, "lcd-spi", "sck"), | ||
515 | MPP_FUNCTION(0x03, "sdio1", "ledctrl"), | ||
516 | MPP_FUNCTION(0x04, "ssp", "sclk"), | ||
517 | MPP_FUNCTION(0x05, "sdio0", "ledctrl"), | ||
518 | MPP_FUNCTION(0x06, "spi1", "sck")), | ||
519 | MPP_MODE(24, | ||
520 | MPP_FUNCTION(0x00, "camera", NULL), | ||
521 | MPP_FUNCTION(0x01, "gpio", NULL)), | ||
522 | MPP_MODE(40, | ||
523 | MPP_FUNCTION(0x00, "sdio0", NULL), | ||
524 | MPP_FUNCTION(0x01, "gpio", NULL)), | ||
525 | MPP_MODE(46, | ||
526 | MPP_FUNCTION(0x00, "sdio1", NULL), | ||
527 | MPP_FUNCTION(0x01, "gpio", NULL)), | ||
528 | MPP_MODE(52, | ||
529 | MPP_FUNCTION(0x00, "i2s1/spdifo", NULL), | ||
530 | MPP_FUNCTION(0x02, "i2s1", NULL), | ||
531 | MPP_FUNCTION(0x08, "spdifo", NULL), | ||
532 | MPP_FUNCTION(0x0a, "gpio", NULL), | ||
533 | MPP_FUNCTION(0x0b, "twsi", NULL), | ||
534 | MPP_FUNCTION(0x0c, "ssp/spdifo", NULL), | ||
535 | MPP_FUNCTION(0x0e, "ssp", NULL), | ||
536 | MPP_FUNCTION(0x0f, "ssp/twsi", NULL)), | ||
537 | MPP_MODE(58, | ||
538 | MPP_FUNCTION(0x00, "spi0", NULL), | ||
539 | MPP_FUNCTION(0x01, "gpio", NULL)), | ||
540 | MPP_MODE(62, | ||
541 | MPP_FUNCTION(0x00, "uart1", NULL), | ||
542 | MPP_FUNCTION(0x01, "gpio", NULL)), | ||
543 | MPP_MODE(64, | ||
544 | MPP_FUNCTION(0x00, "nand", NULL), | ||
545 | MPP_FUNCTION(0x01, "gpo", NULL)), | ||
546 | MPP_MODE(72, | ||
547 | MPP_FUNCTION(0x00, "i2s", NULL), | ||
548 | MPP_FUNCTION(0x01, "ac97", NULL)), | ||
549 | MPP_MODE(73, | ||
550 | MPP_FUNCTION(0x00, "twsi-none", NULL), | ||
551 | MPP_FUNCTION(0x01, "twsi-opt1", NULL), | ||
552 | MPP_FUNCTION(0x02, "twsi-opt2", NULL), | ||
553 | MPP_FUNCTION(0x03, "twsi-opt3", NULL)), | ||
554 | }; | ||
555 | |||
556 | static struct pinctrl_gpio_range dove_mpp_gpio_ranges[] = { | ||
557 | MPP_GPIO_RANGE(0, 0, 0, 32), | ||
558 | MPP_GPIO_RANGE(1, 32, 32, 32), | ||
559 | MPP_GPIO_RANGE(2, 64, 64, 8), | ||
560 | }; | ||
561 | |||
562 | static struct mvebu_pinctrl_soc_info dove_pinctrl_info = { | ||
563 | .controls = dove_mpp_controls, | ||
564 | .ncontrols = ARRAY_SIZE(dove_mpp_controls), | ||
565 | .modes = dove_mpp_modes, | ||
566 | .nmodes = ARRAY_SIZE(dove_mpp_modes), | ||
567 | .gpioranges = dove_mpp_gpio_ranges, | ||
568 | .ngpioranges = ARRAY_SIZE(dove_mpp_gpio_ranges), | ||
569 | .variant = 0, | ||
570 | }; | ||
571 | |||
572 | static struct clk *clk; | ||
573 | |||
574 | static struct of_device_id dove_pinctrl_of_match[] __devinitdata = { | ||
575 | { .compatible = "marvell,dove-pinctrl", .data = &dove_pinctrl_info }, | ||
576 | { } | ||
577 | }; | ||
578 | |||
579 | static int __devinit dove_pinctrl_probe(struct platform_device *pdev) | ||
580 | { | ||
581 | const struct of_device_id *match = | ||
582 | of_match_device(dove_pinctrl_of_match, &pdev->dev); | ||
583 | pdev->dev.platform_data = match->data; | ||
584 | |||
585 | /* | ||
586 | * General MPP Configuration Register is part of pdma registers. | ||
587 | * grab clk to make sure it is ticking. | ||
588 | */ | ||
589 | clk = devm_clk_get(&pdev->dev, NULL); | ||
590 | if (!IS_ERR(clk)) | ||
591 | clk_prepare_enable(clk); | ||
592 | |||
593 | return mvebu_pinctrl_probe(pdev); | ||
594 | } | ||
595 | |||
596 | static int __devexit dove_pinctrl_remove(struct platform_device *pdev) | ||
597 | { | ||
598 | int ret; | ||
599 | |||
600 | ret = mvebu_pinctrl_remove(pdev); | ||
601 | if (!IS_ERR(clk)) | ||
602 | clk_disable_unprepare(clk); | ||
603 | return ret; | ||
604 | } | ||
605 | |||
606 | static struct platform_driver dove_pinctrl_driver = { | ||
607 | .driver = { | ||
608 | .name = "dove-pinctrl", | ||
609 | .owner = THIS_MODULE, | ||
610 | .of_match_table = of_match_ptr(dove_pinctrl_of_match), | ||
611 | }, | ||
612 | .probe = dove_pinctrl_probe, | ||
613 | .remove = __devexit_p(dove_pinctrl_remove), | ||
614 | }; | ||
615 | |||
616 | module_platform_driver(dove_pinctrl_driver); | ||
617 | |||
618 | MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>"); | ||
619 | MODULE_DESCRIPTION("Marvell Dove pinctrl driver"); | ||
620 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pinctrl/pinctrl-kirkwood.c b/drivers/pinctrl/pinctrl-kirkwood.c new file mode 100644 index 000000000000..9a74ef674a0e --- /dev/null +++ b/drivers/pinctrl/pinctrl-kirkwood.c | |||
@@ -0,0 +1,472 @@ | |||
1 | /* | ||
2 | * Marvell Kirkwood pinctrl driver based on mvebu pinctrl core | ||
3 | * | ||
4 | * Author: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/err.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/clk.h> | ||
18 | #include <linux/of.h> | ||
19 | #include <linux/of_device.h> | ||
20 | #include <linux/pinctrl/pinctrl.h> | ||
21 | |||
22 | #include "pinctrl-mvebu.h" | ||
23 | |||
24 | #define V(f6180, f6190, f6192, f6281, f6282) \ | ||
25 | ((f6180 << 0) | (f6190 << 1) | (f6192 << 2) | \ | ||
26 | (f6281 << 3) | (f6282 << 4)) | ||
27 | |||
28 | enum kirkwood_variant { | ||
29 | VARIANT_MV88F6180 = V(1, 0, 0, 0, 0), | ||
30 | VARIANT_MV88F6190 = V(0, 1, 0, 0, 0), | ||
31 | VARIANT_MV88F6192 = V(0, 0, 1, 0, 0), | ||
32 | VARIANT_MV88F6281 = V(0, 0, 0, 1, 0), | ||
33 | VARIANT_MV88F6282 = V(0, 0, 0, 0, 1), | ||
34 | }; | ||
35 | |||
36 | static struct mvebu_mpp_mode mv88f6xxx_mpp_modes[] = { | ||
37 | MPP_MODE(0, | ||
38 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
39 | MPP_VAR_FUNCTION(0x1, "nand", "io2", V(1, 1, 1, 1, 1)), | ||
40 | MPP_VAR_FUNCTION(0x2, "spi", "cs", V(1, 1, 1, 1, 1))), | ||
41 | MPP_MODE(1, | ||
42 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1)), | ||
43 | MPP_VAR_FUNCTION(0x1, "nand", "io3", V(1, 1, 1, 1, 1)), | ||
44 | MPP_VAR_FUNCTION(0x2, "spi", "mosi", V(1, 1, 1, 1, 1))), | ||
45 | MPP_MODE(2, | ||
46 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1)), | ||
47 | MPP_VAR_FUNCTION(0x1, "nand", "io4", V(1, 1, 1, 1, 1)), | ||
48 | MPP_VAR_FUNCTION(0x2, "spi", "sck", V(1, 1, 1, 1, 1))), | ||
49 | MPP_MODE(3, | ||
50 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1)), | ||
51 | MPP_VAR_FUNCTION(0x1, "nand", "io5", V(1, 1, 1, 1, 1)), | ||
52 | MPP_VAR_FUNCTION(0x2, "spi", "miso", V(1, 1, 1, 1, 1))), | ||
53 | MPP_MODE(4, | ||
54 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
55 | MPP_VAR_FUNCTION(0x1, "nand", "io6", V(1, 1, 1, 1, 1)), | ||
56 | MPP_VAR_FUNCTION(0x2, "uart0", "rxd", V(1, 1, 1, 1, 1)), | ||
57 | MPP_VAR_FUNCTION(0x5, "sata1", "act", V(0, 0, 1, 1, 1)), | ||
58 | MPP_VAR_FUNCTION(0xb, "lcd", "hsync", V(0, 0, 0, 0, 1)), | ||
59 | MPP_VAR_FUNCTION(0xd, "ptp", "clk", V(1, 1, 1, 1, 0))), | ||
60 | MPP_MODE(5, | ||
61 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1)), | ||
62 | MPP_VAR_FUNCTION(0x1, "nand", "io7", V(1, 1, 1, 1, 1)), | ||
63 | MPP_VAR_FUNCTION(0x2, "uart0", "txd", V(1, 1, 1, 1, 1)), | ||
64 | MPP_VAR_FUNCTION(0x4, "ptp", "trig", V(1, 1, 1, 1, 0)), | ||
65 | MPP_VAR_FUNCTION(0x5, "sata0", "act", V(0, 1, 1, 1, 1)), | ||
66 | MPP_VAR_FUNCTION(0xb, "lcd", "vsync", V(0, 0, 0, 0, 1))), | ||
67 | MPP_MODE(6, | ||
68 | MPP_VAR_FUNCTION(0x0, "sysrst", "out", V(1, 1, 1, 1, 1)), | ||
69 | MPP_VAR_FUNCTION(0x1, "spi", "mosi", V(1, 1, 1, 1, 1)), | ||
70 | MPP_VAR_FUNCTION(0x2, "ptp", "trig", V(1, 1, 1, 1, 0))), | ||
71 | MPP_MODE(7, | ||
72 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1)), | ||
73 | MPP_VAR_FUNCTION(0x1, "pex", "rsto", V(1, 1, 1, 1, 0)), | ||
74 | MPP_VAR_FUNCTION(0x2, "spi", "cs", V(1, 1, 1, 1, 1)), | ||
75 | MPP_VAR_FUNCTION(0x3, "ptp", "trig", V(1, 1, 1, 1, 0)), | ||
76 | MPP_VAR_FUNCTION(0xb, "lcd", "pwm", V(0, 0, 0, 0, 1))), | ||
77 | MPP_MODE(8, | ||
78 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
79 | MPP_VAR_FUNCTION(0x1, "twsi0", "sda", V(1, 1, 1, 1, 1)), | ||
80 | MPP_VAR_FUNCTION(0x2, "uart0", "rts", V(1, 1, 1, 1, 1)), | ||
81 | MPP_VAR_FUNCTION(0x3, "uart1", "rts", V(1, 1, 1, 1, 1)), | ||
82 | MPP_VAR_FUNCTION(0x4, "mii-1", "rxerr", V(0, 1, 1, 1, 1)), | ||
83 | MPP_VAR_FUNCTION(0x5, "sata1", "prsnt", V(0, 0, 1, 1, 1)), | ||
84 | MPP_VAR_FUNCTION(0xc, "ptp", "clk", V(1, 1, 1, 1, 0)), | ||
85 | MPP_VAR_FUNCTION(0xd, "mii", "col", V(1, 1, 1, 1, 1))), | ||
86 | MPP_MODE(9, | ||
87 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
88 | MPP_VAR_FUNCTION(0x1, "twsi0", "sck", V(1, 1, 1, 1, 1)), | ||
89 | MPP_VAR_FUNCTION(0x2, "uart0", "cts", V(1, 1, 1, 1, 1)), | ||
90 | MPP_VAR_FUNCTION(0x3, "uart1", "cts", V(1, 1, 1, 1, 1)), | ||
91 | MPP_VAR_FUNCTION(0x5, "sata0", "prsnt", V(0, 1, 1, 1, 1)), | ||
92 | MPP_VAR_FUNCTION(0xc, "ptp", "evreq", V(1, 1, 1, 1, 0)), | ||
93 | MPP_VAR_FUNCTION(0xd, "mii", "crs", V(1, 1, 1, 1, 1))), | ||
94 | MPP_MODE(10, | ||
95 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1)), | ||
96 | MPP_VAR_FUNCTION(0x2, "spi", "sck", V(1, 1, 1, 1, 1)), | ||
97 | MPP_VAR_FUNCTION(0X3, "uart0", "txd", V(1, 1, 1, 1, 1)), | ||
98 | MPP_VAR_FUNCTION(0x5, "sata1", "act", V(0, 0, 1, 1, 1)), | ||
99 | MPP_VAR_FUNCTION(0xc, "ptp", "trig", V(1, 1, 1, 1, 0))), | ||
100 | MPP_MODE(11, | ||
101 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
102 | MPP_VAR_FUNCTION(0x2, "spi", "miso", V(1, 1, 1, 1, 1)), | ||
103 | MPP_VAR_FUNCTION(0x3, "uart0", "rxd", V(1, 1, 1, 1, 1)), | ||
104 | MPP_VAR_FUNCTION(0x4, "ptp-1", "evreq", V(1, 1, 1, 1, 0)), | ||
105 | MPP_VAR_FUNCTION(0xc, "ptp-2", "trig", V(1, 1, 1, 1, 0)), | ||
106 | MPP_VAR_FUNCTION(0xd, "ptp", "clk", V(1, 1, 1, 1, 0)), | ||
107 | MPP_VAR_FUNCTION(0x5, "sata0", "act", V(0, 1, 1, 1, 1))), | ||
108 | MPP_MODE(12, | ||
109 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 0, 1)), | ||
110 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 0)), | ||
111 | MPP_VAR_FUNCTION(0x1, "sdio", "clk", V(1, 1, 1, 1, 1)), | ||
112 | MPP_VAR_FUNCTION(0xa, "audio", "spdifo", V(0, 0, 0, 0, 1)), | ||
113 | MPP_VAR_FUNCTION(0xb, "spi", "mosi", V(0, 0, 0, 0, 1)), | ||
114 | MPP_VAR_FUNCTION(0xd, "twsi1", "sda", V(0, 0, 0, 0, 1))), | ||
115 | MPP_MODE(13, | ||
116 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
117 | MPP_VAR_FUNCTION(0x1, "sdio", "cmd", V(1, 1, 1, 1, 1)), | ||
118 | MPP_VAR_FUNCTION(0x3, "uart1", "txd", V(1, 1, 1, 1, 1)), | ||
119 | MPP_VAR_FUNCTION(0xa, "audio", "rmclk", V(0, 0, 0, 0, 1)), | ||
120 | MPP_VAR_FUNCTION(0xb, "lcd", "pwm", V(0, 0, 0, 0, 1))), | ||
121 | MPP_MODE(14, | ||
122 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
123 | MPP_VAR_FUNCTION(0x1, "sdio", "d0", V(1, 1, 1, 1, 1)), | ||
124 | MPP_VAR_FUNCTION(0x3, "uart1", "rxd", V(1, 1, 1, 1, 1)), | ||
125 | MPP_VAR_FUNCTION(0x4, "sata1", "prsnt", V(0, 0, 1, 1, 1)), | ||
126 | MPP_VAR_FUNCTION(0xa, "audio", "spdifi", V(0, 0, 0, 0, 1)), | ||
127 | MPP_VAR_FUNCTION(0xb, "audio-1", "sdi", V(0, 0, 0, 0, 1)), | ||
128 | MPP_VAR_FUNCTION(0xd, "mii", "col", V(1, 1, 1, 1, 1))), | ||
129 | MPP_MODE(15, | ||
130 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
131 | MPP_VAR_FUNCTION(0x1, "sdio", "d1", V(1, 1, 1, 1, 1)), | ||
132 | MPP_VAR_FUNCTION(0x2, "uart0", "rts", V(1, 1, 1, 1, 1)), | ||
133 | MPP_VAR_FUNCTION(0x3, "uart1", "txd", V(1, 1, 1, 1, 1)), | ||
134 | MPP_VAR_FUNCTION(0x4, "sata0", "act", V(0, 1, 1, 1, 1)), | ||
135 | MPP_VAR_FUNCTION(0xb, "spi", "cs", V(0, 0, 0, 0, 1))), | ||
136 | MPP_MODE(16, | ||
137 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
138 | MPP_VAR_FUNCTION(0x1, "sdio", "d2", V(1, 1, 1, 1, 1)), | ||
139 | MPP_VAR_FUNCTION(0x2, "uart0", "cts", V(1, 1, 1, 1, 1)), | ||
140 | MPP_VAR_FUNCTION(0x3, "uart1", "rxd", V(1, 1, 1, 1, 1)), | ||
141 | MPP_VAR_FUNCTION(0x4, "sata1", "act", V(0, 0, 1, 1, 1)), | ||
142 | MPP_VAR_FUNCTION(0xb, "lcd", "extclk", V(0, 0, 0, 0, 1)), | ||
143 | MPP_VAR_FUNCTION(0xd, "mii", "crs", V(1, 1, 1, 1, 1))), | ||
144 | MPP_MODE(17, | ||
145 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
146 | MPP_VAR_FUNCTION(0x1, "sdio", "d3", V(1, 1, 1, 1, 1)), | ||
147 | MPP_VAR_FUNCTION(0x4, "sata0", "prsnt", V(0, 1, 1, 1, 1)), | ||
148 | MPP_VAR_FUNCTION(0xa, "sata1", "act", V(0, 0, 0, 0, 1)), | ||
149 | MPP_VAR_FUNCTION(0xd, "twsi1", "sck", V(0, 0, 0, 0, 1))), | ||
150 | MPP_MODE(18, | ||
151 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1)), | ||
152 | MPP_VAR_FUNCTION(0x1, "nand", "io0", V(1, 1, 1, 1, 1)), | ||
153 | MPP_VAR_FUNCTION(0x2, "pex", "clkreq", V(0, 0, 0, 0, 1))), | ||
154 | MPP_MODE(19, | ||
155 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1)), | ||
156 | MPP_VAR_FUNCTION(0x1, "nand", "io1", V(1, 1, 1, 1, 1))), | ||
157 | MPP_MODE(20, | ||
158 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
159 | MPP_VAR_FUNCTION(0x1, "ts", "mp0", V(0, 0, 1, 1, 1)), | ||
160 | MPP_VAR_FUNCTION(0x2, "tdm", "tx0ql", V(0, 0, 1, 1, 1)), | ||
161 | MPP_VAR_FUNCTION(0x3, "ge1", "txd0", V(0, 1, 1, 1, 1)), | ||
162 | MPP_VAR_FUNCTION(0x4, "audio", "spdifi", V(0, 0, 1, 1, 1)), | ||
163 | MPP_VAR_FUNCTION(0x5, "sata1", "act", V(0, 0, 1, 1, 1)), | ||
164 | MPP_VAR_FUNCTION(0xb, "lcd", "d0", V(0, 0, 0, 0, 1)), | ||
165 | MPP_VAR_FUNCTION(0xc, "mii", "rxerr", V(1, 0, 0, 0, 0))), | ||
166 | MPP_MODE(21, | ||
167 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
168 | MPP_VAR_FUNCTION(0x1, "ts", "mp1", V(0, 0, 1, 1, 1)), | ||
169 | MPP_VAR_FUNCTION(0x2, "tdm", "rx0ql", V(0, 0, 1, 1, 1)), | ||
170 | MPP_VAR_FUNCTION(0x3, "ge1", "txd1", V(0, 1, 1, 1, 1)), | ||
171 | MPP_VAR_FUNCTION(0x4, "audio", "spdifi", V(1, 0, 0, 0, 0)), | ||
172 | MPP_VAR_FUNCTION(0x4, "audio", "spdifo", V(0, 0, 1, 1, 1)), | ||
173 | MPP_VAR_FUNCTION(0x5, "sata0", "act", V(0, 1, 1, 1, 1)), | ||
174 | MPP_VAR_FUNCTION(0xb, "lcd", "d1", V(0, 0, 0, 0, 1))), | ||
175 | MPP_MODE(22, | ||
176 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
177 | MPP_VAR_FUNCTION(0x1, "ts", "mp2", V(0, 0, 1, 1, 1)), | ||
178 | MPP_VAR_FUNCTION(0x2, "tdm", "tx2ql", V(0, 0, 1, 1, 1)), | ||
179 | MPP_VAR_FUNCTION(0x3, "ge1", "txd2", V(0, 1, 1, 1, 1)), | ||
180 | MPP_VAR_FUNCTION(0x4, "audio", "spdifo", V(1, 0, 0, 0, 0)), | ||
181 | MPP_VAR_FUNCTION(0x4, "audio", "rmclk", V(0, 0, 1, 1, 1)), | ||
182 | MPP_VAR_FUNCTION(0x5, "sata1", "prsnt", V(0, 0, 1, 1, 1)), | ||
183 | MPP_VAR_FUNCTION(0xb, "lcd", "d2", V(0, 0, 0, 0, 1))), | ||
184 | MPP_MODE(23, | ||
185 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
186 | MPP_VAR_FUNCTION(0x1, "ts", "mp3", V(0, 0, 1, 1, 1)), | ||
187 | MPP_VAR_FUNCTION(0x2, "tdm", "rx2ql", V(0, 0, 1, 1, 1)), | ||
188 | MPP_VAR_FUNCTION(0x3, "ge1", "txd3", V(0, 1, 1, 1, 1)), | ||
189 | MPP_VAR_FUNCTION(0x4, "audio", "rmclk", V(1, 0, 0, 0, 0)), | ||
190 | MPP_VAR_FUNCTION(0x4, "audio", "bclk", V(0, 0, 1, 1, 1)), | ||
191 | MPP_VAR_FUNCTION(0x5, "sata0", "prsnt", V(0, 1, 1, 1, 1)), | ||
192 | MPP_VAR_FUNCTION(0xb, "lcd", "d3", V(0, 0, 0, 0, 1))), | ||
193 | MPP_MODE(24, | ||
194 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
195 | MPP_VAR_FUNCTION(0x1, "ts", "mp4", V(0, 0, 1, 1, 1)), | ||
196 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-cs0", V(0, 0, 1, 1, 1)), | ||
197 | MPP_VAR_FUNCTION(0x3, "ge1", "rxd0", V(0, 1, 1, 1, 1)), | ||
198 | MPP_VAR_FUNCTION(0x4, "audio", "bclk", V(1, 0, 0, 0, 0)), | ||
199 | MPP_VAR_FUNCTION(0x4, "audio", "sdo", V(0, 0, 1, 1, 1)), | ||
200 | MPP_VAR_FUNCTION(0xb, "lcd", "d4", V(0, 0, 0, 0, 1))), | ||
201 | MPP_MODE(25, | ||
202 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
203 | MPP_VAR_FUNCTION(0x1, "ts", "mp5", V(0, 0, 1, 1, 1)), | ||
204 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-sck", V(0, 0, 1, 1, 1)), | ||
205 | MPP_VAR_FUNCTION(0x3, "ge1", "rxd1", V(0, 1, 1, 1, 1)), | ||
206 | MPP_VAR_FUNCTION(0x4, "audio", "sdo", V(1, 0, 0, 0, 0)), | ||
207 | MPP_VAR_FUNCTION(0x4, "audio", "lrclk", V(0, 0, 1, 1, 1)), | ||
208 | MPP_VAR_FUNCTION(0xb, "lcd", "d5", V(0, 0, 0, 0, 1))), | ||
209 | MPP_MODE(26, | ||
210 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
211 | MPP_VAR_FUNCTION(0x1, "ts", "mp6", V(0, 0, 1, 1, 1)), | ||
212 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-miso", V(0, 0, 1, 1, 1)), | ||
213 | MPP_VAR_FUNCTION(0x3, "ge1", "rxd2", V(0, 1, 1, 1, 1)), | ||
214 | MPP_VAR_FUNCTION(0x4, "audio", "lrclk", V(1, 0, 0, 0, 0)), | ||
215 | MPP_VAR_FUNCTION(0x4, "audio", "mclk", V(0, 0, 1, 1, 1)), | ||
216 | MPP_VAR_FUNCTION(0xb, "lcd", "d6", V(0, 0, 0, 0, 1))), | ||
217 | MPP_MODE(27, | ||
218 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
219 | MPP_VAR_FUNCTION(0x1, "ts", "mp7", V(0, 0, 1, 1, 1)), | ||
220 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-mosi", V(0, 0, 1, 1, 1)), | ||
221 | MPP_VAR_FUNCTION(0x3, "ge1", "rxd3", V(0, 1, 1, 1, 1)), | ||
222 | MPP_VAR_FUNCTION(0x4, "audio", "mclk", V(1, 0, 0, 0, 0)), | ||
223 | MPP_VAR_FUNCTION(0x4, "audio", "sdi", V(0, 0, 1, 1, 1)), | ||
224 | MPP_VAR_FUNCTION(0xb, "lcd", "d7", V(0, 0, 0, 0, 1))), | ||
225 | MPP_MODE(28, | ||
226 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
227 | MPP_VAR_FUNCTION(0x1, "ts", "mp8", V(0, 0, 1, 1, 1)), | ||
228 | MPP_VAR_FUNCTION(0x2, "tdm", "int", V(0, 0, 1, 1, 1)), | ||
229 | MPP_VAR_FUNCTION(0x3, "ge1", "col", V(0, 1, 1, 1, 1)), | ||
230 | MPP_VAR_FUNCTION(0x4, "audio", "sdi", V(1, 0, 0, 0, 0)), | ||
231 | MPP_VAR_FUNCTION(0x4, "audio", "extclk", V(0, 0, 1, 1, 1)), | ||
232 | MPP_VAR_FUNCTION(0xb, "lcd", "d8", V(0, 0, 0, 0, 1))), | ||
233 | MPP_MODE(29, | ||
234 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(1, 1, 1, 1, 1)), | ||
235 | MPP_VAR_FUNCTION(0x1, "ts", "mp9", V(0, 0, 1, 1, 1)), | ||
236 | MPP_VAR_FUNCTION(0x2, "tdm", "rst", V(0, 0, 1, 1, 1)), | ||
237 | MPP_VAR_FUNCTION(0x3, "ge1", "txclk", V(0, 1, 1, 1, 1)), | ||
238 | MPP_VAR_FUNCTION(0x4, "audio", "extclk", V(1, 0, 0, 0, 0)), | ||
239 | MPP_VAR_FUNCTION(0xb, "lcd", "d9", V(0, 0, 0, 0, 1))), | ||
240 | MPP_MODE(30, | ||
241 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 1, 1, 1, 1)), | ||
242 | MPP_VAR_FUNCTION(0x1, "ts", "mp10", V(0, 0, 1, 1, 1)), | ||
243 | MPP_VAR_FUNCTION(0x2, "tdm", "pclk", V(0, 0, 1, 1, 1)), | ||
244 | MPP_VAR_FUNCTION(0x3, "ge1", "rxctl", V(0, 1, 1, 1, 1)), | ||
245 | MPP_VAR_FUNCTION(0xb, "lcd", "d10", V(0, 0, 0, 0, 1))), | ||
246 | MPP_MODE(31, | ||
247 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 1, 1, 1, 1)), | ||
248 | MPP_VAR_FUNCTION(0x1, "ts", "mp11", V(0, 0, 1, 1, 1)), | ||
249 | MPP_VAR_FUNCTION(0x2, "tdm", "fs", V(0, 0, 1, 1, 1)), | ||
250 | MPP_VAR_FUNCTION(0x3, "ge1", "rxclk", V(0, 1, 1, 1, 1)), | ||
251 | MPP_VAR_FUNCTION(0xb, "lcd", "d11", V(0, 0, 0, 0, 1))), | ||
252 | MPP_MODE(32, | ||
253 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 1, 1, 1, 1)), | ||
254 | MPP_VAR_FUNCTION(0x1, "ts", "mp12", V(0, 0, 1, 1, 1)), | ||
255 | MPP_VAR_FUNCTION(0x2, "tdm", "drx", V(0, 0, 1, 1, 1)), | ||
256 | MPP_VAR_FUNCTION(0x3, "ge1", "txclko", V(0, 1, 1, 1, 1)), | ||
257 | MPP_VAR_FUNCTION(0xb, "lcd", "d12", V(0, 0, 0, 0, 1))), | ||
258 | MPP_MODE(33, | ||
259 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(0, 1, 1, 1, 1)), | ||
260 | MPP_VAR_FUNCTION(0x2, "tdm", "dtx", V(0, 0, 1, 1, 1)), | ||
261 | MPP_VAR_FUNCTION(0x3, "ge1", "txctl", V(0, 1, 1, 1, 1)), | ||
262 | MPP_VAR_FUNCTION(0xb, "lcd", "d13", V(0, 0, 0, 0, 1))), | ||
263 | MPP_MODE(34, | ||
264 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 1, 1, 1, 1)), | ||
265 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-cs1", V(0, 0, 1, 1, 1)), | ||
266 | MPP_VAR_FUNCTION(0x3, "ge1", "txen", V(0, 1, 1, 1, 1)), | ||
267 | MPP_VAR_FUNCTION(0x5, "sata1", "act", V(0, 0, 0, 1, 1)), | ||
268 | MPP_VAR_FUNCTION(0xb, "lcd", "d14", V(0, 0, 0, 0, 1))), | ||
269 | MPP_MODE(35, | ||
270 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 1, 1, 1, 1)), | ||
271 | MPP_VAR_FUNCTION(0x2, "tdm", "tx0ql", V(0, 0, 1, 1, 1)), | ||
272 | MPP_VAR_FUNCTION(0x3, "ge1", "rxerr", V(0, 1, 1, 1, 1)), | ||
273 | MPP_VAR_FUNCTION(0x5, "sata0", "act", V(0, 1, 1, 1, 1)), | ||
274 | MPP_VAR_FUNCTION(0xb, "lcd", "d15", V(0, 0, 0, 0, 1)), | ||
275 | MPP_VAR_FUNCTION(0xc, "mii", "rxerr", V(0, 1, 1, 1, 1))), | ||
276 | MPP_MODE(36, | ||
277 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
278 | MPP_VAR_FUNCTION(0x1, "ts", "mp0", V(0, 0, 0, 1, 1)), | ||
279 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-cs1", V(0, 0, 0, 1, 1)), | ||
280 | MPP_VAR_FUNCTION(0x4, "audio", "spdifi", V(0, 0, 0, 1, 1)), | ||
281 | MPP_VAR_FUNCTION(0xb, "twsi1", "sda", V(0, 0, 0, 0, 1))), | ||
282 | MPP_MODE(37, | ||
283 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
284 | MPP_VAR_FUNCTION(0x1, "ts", "mp1", V(0, 0, 0, 1, 1)), | ||
285 | MPP_VAR_FUNCTION(0x2, "tdm", "tx2ql", V(0, 0, 0, 1, 1)), | ||
286 | MPP_VAR_FUNCTION(0x4, "audio", "spdifo", V(0, 0, 0, 1, 1)), | ||
287 | MPP_VAR_FUNCTION(0xb, "twsi1", "sck", V(0, 0, 0, 0, 1))), | ||
288 | MPP_MODE(38, | ||
289 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
290 | MPP_VAR_FUNCTION(0x1, "ts", "mp2", V(0, 0, 0, 1, 1)), | ||
291 | MPP_VAR_FUNCTION(0x2, "tdm", "rx2ql", V(0, 0, 0, 1, 1)), | ||
292 | MPP_VAR_FUNCTION(0x4, "audio", "rmclk", V(0, 0, 0, 1, 1)), | ||
293 | MPP_VAR_FUNCTION(0xb, "lcd", "d18", V(0, 0, 0, 0, 1))), | ||
294 | MPP_MODE(39, | ||
295 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
296 | MPP_VAR_FUNCTION(0x1, "ts", "mp3", V(0, 0, 0, 1, 1)), | ||
297 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-cs0", V(0, 0, 0, 1, 1)), | ||
298 | MPP_VAR_FUNCTION(0x4, "audio", "bclk", V(0, 0, 0, 1, 1)), | ||
299 | MPP_VAR_FUNCTION(0xb, "lcd", "d19", V(0, 0, 0, 0, 1))), | ||
300 | MPP_MODE(40, | ||
301 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
302 | MPP_VAR_FUNCTION(0x1, "ts", "mp4", V(0, 0, 0, 1, 1)), | ||
303 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-sck", V(0, 0, 0, 1, 1)), | ||
304 | MPP_VAR_FUNCTION(0x4, "audio", "sdo", V(0, 0, 0, 1, 1)), | ||
305 | MPP_VAR_FUNCTION(0xb, "lcd", "d20", V(0, 0, 0, 0, 1))), | ||
306 | MPP_MODE(41, | ||
307 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
308 | MPP_VAR_FUNCTION(0x1, "ts", "mp5", V(0, 0, 0, 1, 1)), | ||
309 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-miso", V(0, 0, 0, 1, 1)), | ||
310 | MPP_VAR_FUNCTION(0x4, "audio", "lrclk", V(0, 0, 0, 1, 1)), | ||
311 | MPP_VAR_FUNCTION(0xb, "lcd", "d21", V(0, 0, 0, 0, 1))), | ||
312 | MPP_MODE(42, | ||
313 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
314 | MPP_VAR_FUNCTION(0x1, "ts", "mp6", V(0, 0, 0, 1, 1)), | ||
315 | MPP_VAR_FUNCTION(0x2, "tdm", "spi-mosi", V(0, 0, 0, 1, 1)), | ||
316 | MPP_VAR_FUNCTION(0x4, "audio", "mclk", V(0, 0, 0, 1, 1)), | ||
317 | MPP_VAR_FUNCTION(0xb, "lcd", "d22", V(0, 0, 0, 0, 1))), | ||
318 | MPP_MODE(43, | ||
319 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
320 | MPP_VAR_FUNCTION(0x1, "ts", "mp7", V(0, 0, 0, 1, 1)), | ||
321 | MPP_VAR_FUNCTION(0x2, "tdm", "int", V(0, 0, 0, 1, 1)), | ||
322 | MPP_VAR_FUNCTION(0x4, "audio", "sdi", V(0, 0, 0, 1, 1)), | ||
323 | MPP_VAR_FUNCTION(0xb, "lcd", "d23", V(0, 0, 0, 0, 1))), | ||
324 | MPP_MODE(44, | ||
325 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
326 | MPP_VAR_FUNCTION(0x1, "ts", "mp8", V(0, 0, 0, 1, 1)), | ||
327 | MPP_VAR_FUNCTION(0x2, "tdm", "rst", V(0, 0, 0, 1, 1)), | ||
328 | MPP_VAR_FUNCTION(0x4, "audio", "extclk", V(0, 0, 0, 1, 1)), | ||
329 | MPP_VAR_FUNCTION(0xb, "lcd", "clk", V(0, 0, 0, 0, 1))), | ||
330 | MPP_MODE(45, | ||
331 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
332 | MPP_VAR_FUNCTION(0x1, "ts", "mp9", V(0, 0, 0, 1, 1)), | ||
333 | MPP_VAR_FUNCTION(0x2, "tdm", "pclk", V(0, 0, 0, 1, 1)), | ||
334 | MPP_VAR_FUNCTION(0xb, "lcd", "e", V(0, 0, 0, 0, 1))), | ||
335 | MPP_MODE(46, | ||
336 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
337 | MPP_VAR_FUNCTION(0x1, "ts", "mp10", V(0, 0, 0, 1, 1)), | ||
338 | MPP_VAR_FUNCTION(0x2, "tdm", "fs", V(0, 0, 0, 1, 1)), | ||
339 | MPP_VAR_FUNCTION(0xb, "lcd", "hsync", V(0, 0, 0, 0, 1))), | ||
340 | MPP_MODE(47, | ||
341 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
342 | MPP_VAR_FUNCTION(0x1, "ts", "mp11", V(0, 0, 0, 1, 1)), | ||
343 | MPP_VAR_FUNCTION(0x2, "tdm", "drx", V(0, 0, 0, 1, 1)), | ||
344 | MPP_VAR_FUNCTION(0xb, "lcd", "vsync", V(0, 0, 0, 0, 1))), | ||
345 | MPP_MODE(48, | ||
346 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 1)), | ||
347 | MPP_VAR_FUNCTION(0x1, "ts", "mp12", V(0, 0, 0, 1, 1)), | ||
348 | MPP_VAR_FUNCTION(0x2, "tdm", "dtx", V(0, 0, 0, 1, 1)), | ||
349 | MPP_VAR_FUNCTION(0xb, "lcd", "d16", V(0, 0, 0, 0, 1))), | ||
350 | MPP_MODE(49, | ||
351 | MPP_VAR_FUNCTION(0x0, "gpio", NULL, V(0, 0, 0, 1, 0)), | ||
352 | MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(0, 0, 0, 0, 1)), | ||
353 | MPP_VAR_FUNCTION(0x1, "ts", "mp9", V(0, 0, 0, 1, 0)), | ||
354 | MPP_VAR_FUNCTION(0x2, "tdm", "rx0ql", V(0, 0, 0, 1, 1)), | ||
355 | MPP_VAR_FUNCTION(0x5, "ptp", "clk", V(0, 0, 0, 1, 0)), | ||
356 | MPP_VAR_FUNCTION(0xa, "pex", "clkreq", V(0, 0, 0, 0, 1)), | ||
357 | MPP_VAR_FUNCTION(0xb, "lcd", "d17", V(0, 0, 0, 0, 1))), | ||
358 | }; | ||
359 | |||
360 | static struct mvebu_mpp_ctrl mv88f6180_mpp_controls[] = { | ||
361 | MPP_REG_CTRL(0, 29), | ||
362 | }; | ||
363 | |||
364 | static struct pinctrl_gpio_range mv88f6180_gpio_ranges[] = { | ||
365 | MPP_GPIO_RANGE(0, 0, 0, 30), | ||
366 | }; | ||
367 | |||
368 | static struct mvebu_mpp_ctrl mv88f619x_mpp_controls[] = { | ||
369 | MPP_REG_CTRL(0, 35), | ||
370 | }; | ||
371 | |||
372 | static struct pinctrl_gpio_range mv88f619x_gpio_ranges[] = { | ||
373 | MPP_GPIO_RANGE(0, 0, 0, 32), | ||
374 | MPP_GPIO_RANGE(1, 32, 32, 4), | ||
375 | }; | ||
376 | |||
377 | static struct mvebu_mpp_ctrl mv88f628x_mpp_controls[] = { | ||
378 | MPP_REG_CTRL(0, 49), | ||
379 | }; | ||
380 | |||
381 | static struct pinctrl_gpio_range mv88f628x_gpio_ranges[] = { | ||
382 | MPP_GPIO_RANGE(0, 0, 0, 32), | ||
383 | MPP_GPIO_RANGE(1, 32, 32, 18), | ||
384 | }; | ||
385 | |||
386 | static struct mvebu_pinctrl_soc_info mv88f6180_info = { | ||
387 | .variant = VARIANT_MV88F6180, | ||
388 | .controls = mv88f6180_mpp_controls, | ||
389 | .ncontrols = ARRAY_SIZE(mv88f6180_mpp_controls), | ||
390 | .modes = mv88f6xxx_mpp_modes, | ||
391 | .nmodes = ARRAY_SIZE(mv88f6xxx_mpp_modes), | ||
392 | .gpioranges = mv88f6180_gpio_ranges, | ||
393 | .ngpioranges = ARRAY_SIZE(mv88f6180_gpio_ranges), | ||
394 | }; | ||
395 | |||
396 | static struct mvebu_pinctrl_soc_info mv88f6190_info = { | ||
397 | .variant = VARIANT_MV88F6190, | ||
398 | .controls = mv88f619x_mpp_controls, | ||
399 | .ncontrols = ARRAY_SIZE(mv88f619x_mpp_controls), | ||
400 | .modes = mv88f6xxx_mpp_modes, | ||
401 | .nmodes = ARRAY_SIZE(mv88f6xxx_mpp_modes), | ||
402 | .gpioranges = mv88f619x_gpio_ranges, | ||
403 | .ngpioranges = ARRAY_SIZE(mv88f619x_gpio_ranges), | ||
404 | }; | ||
405 | |||
406 | static struct mvebu_pinctrl_soc_info mv88f6192_info = { | ||
407 | .variant = VARIANT_MV88F6192, | ||
408 | .controls = mv88f619x_mpp_controls, | ||
409 | .ncontrols = ARRAY_SIZE(mv88f619x_mpp_controls), | ||
410 | .modes = mv88f6xxx_mpp_modes, | ||
411 | .nmodes = ARRAY_SIZE(mv88f6xxx_mpp_modes), | ||
412 | .gpioranges = mv88f619x_gpio_ranges, | ||
413 | .ngpioranges = ARRAY_SIZE(mv88f619x_gpio_ranges), | ||
414 | }; | ||
415 | |||
416 | static struct mvebu_pinctrl_soc_info mv88f6281_info = { | ||
417 | .variant = VARIANT_MV88F6281, | ||
418 | .controls = mv88f628x_mpp_controls, | ||
419 | .ncontrols = ARRAY_SIZE(mv88f628x_mpp_controls), | ||
420 | .modes = mv88f6xxx_mpp_modes, | ||
421 | .nmodes = ARRAY_SIZE(mv88f6xxx_mpp_modes), | ||
422 | .gpioranges = mv88f628x_gpio_ranges, | ||
423 | .ngpioranges = ARRAY_SIZE(mv88f628x_gpio_ranges), | ||
424 | }; | ||
425 | |||
426 | static struct mvebu_pinctrl_soc_info mv88f6282_info = { | ||
427 | .variant = VARIANT_MV88F6282, | ||
428 | .controls = mv88f628x_mpp_controls, | ||
429 | .ncontrols = ARRAY_SIZE(mv88f628x_mpp_controls), | ||
430 | .modes = mv88f6xxx_mpp_modes, | ||
431 | .nmodes = ARRAY_SIZE(mv88f6xxx_mpp_modes), | ||
432 | .gpioranges = mv88f628x_gpio_ranges, | ||
433 | .ngpioranges = ARRAY_SIZE(mv88f628x_gpio_ranges), | ||
434 | }; | ||
435 | |||
436 | static struct of_device_id kirkwood_pinctrl_of_match[] __devinitdata = { | ||
437 | { .compatible = "marvell,88f6180-pinctrl", .data = &mv88f6180_info }, | ||
438 | { .compatible = "marvell,88f6190-pinctrl", .data = &mv88f6190_info }, | ||
439 | { .compatible = "marvell,88f6192-pinctrl", .data = &mv88f6192_info }, | ||
440 | { .compatible = "marvell,88f6281-pinctrl", .data = &mv88f6281_info }, | ||
441 | { .compatible = "marvell,88f6282-pinctrl", .data = &mv88f6282_info }, | ||
442 | { } | ||
443 | }; | ||
444 | |||
445 | static int __devinit kirkwood_pinctrl_probe(struct platform_device *pdev) | ||
446 | { | ||
447 | const struct of_device_id *match = | ||
448 | of_match_device(kirkwood_pinctrl_of_match, &pdev->dev); | ||
449 | pdev->dev.platform_data = match->data; | ||
450 | return mvebu_pinctrl_probe(pdev); | ||
451 | } | ||
452 | |||
453 | static int __devexit kirkwood_pinctrl_remove(struct platform_device *pdev) | ||
454 | { | ||
455 | return mvebu_pinctrl_remove(pdev); | ||
456 | } | ||
457 | |||
458 | static struct platform_driver kirkwood_pinctrl_driver = { | ||
459 | .driver = { | ||
460 | .name = "kirkwood-pinctrl", | ||
461 | .owner = THIS_MODULE, | ||
462 | .of_match_table = of_match_ptr(kirkwood_pinctrl_of_match), | ||
463 | }, | ||
464 | .probe = kirkwood_pinctrl_probe, | ||
465 | .remove = __devexit_p(kirkwood_pinctrl_remove), | ||
466 | }; | ||
467 | |||
468 | module_platform_driver(kirkwood_pinctrl_driver); | ||
469 | |||
470 | MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>"); | ||
471 | MODULE_DESCRIPTION("Marvell Kirkwood pinctrl driver"); | ||
472 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pinctrl/pinctrl-mvebu.c b/drivers/pinctrl/pinctrl-mvebu.c new file mode 100644 index 000000000000..8e6266c6249a --- /dev/null +++ b/drivers/pinctrl/pinctrl-mvebu.c | |||
@@ -0,0 +1,754 @@ | |||
1 | /* | ||
2 | * Marvell MVEBU pinctrl core driver | ||
3 | * | ||
4 | * Authors: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | ||
5 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/of.h> | ||
18 | #include <linux/of_address.h> | ||
19 | #include <linux/of_platform.h> | ||
20 | #include <linux/err.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/pinctrl/machine.h> | ||
23 | #include <linux/pinctrl/pinconf.h> | ||
24 | #include <linux/pinctrl/pinctrl.h> | ||
25 | #include <linux/pinctrl/pinmux.h> | ||
26 | |||
27 | #include "core.h" | ||
28 | #include "pinctrl-mvebu.h" | ||
29 | |||
30 | #define MPPS_PER_REG 8 | ||
31 | #define MPP_BITS 4 | ||
32 | #define MPP_MASK 0xf | ||
33 | |||
34 | struct mvebu_pinctrl_function { | ||
35 | const char *name; | ||
36 | const char **groups; | ||
37 | unsigned num_groups; | ||
38 | }; | ||
39 | |||
40 | struct mvebu_pinctrl_group { | ||
41 | const char *name; | ||
42 | struct mvebu_mpp_ctrl *ctrl; | ||
43 | struct mvebu_mpp_ctrl_setting *settings; | ||
44 | unsigned num_settings; | ||
45 | unsigned gid; | ||
46 | unsigned *pins; | ||
47 | unsigned npins; | ||
48 | }; | ||
49 | |||
50 | struct mvebu_pinctrl { | ||
51 | struct device *dev; | ||
52 | struct pinctrl_dev *pctldev; | ||
53 | struct pinctrl_desc desc; | ||
54 | void __iomem *base; | ||
55 | struct mvebu_pinctrl_group *groups; | ||
56 | unsigned num_groups; | ||
57 | struct mvebu_pinctrl_function *functions; | ||
58 | unsigned num_functions; | ||
59 | u8 variant; | ||
60 | }; | ||
61 | |||
62 | static struct mvebu_pinctrl_group *mvebu_pinctrl_find_group_by_pid( | ||
63 | struct mvebu_pinctrl *pctl, unsigned pid) | ||
64 | { | ||
65 | unsigned n; | ||
66 | for (n = 0; n < pctl->num_groups; n++) { | ||
67 | if (pid >= pctl->groups[n].pins[0] && | ||
68 | pid < pctl->groups[n].pins[0] + | ||
69 | pctl->groups[n].npins) | ||
70 | return &pctl->groups[n]; | ||
71 | } | ||
72 | return NULL; | ||
73 | } | ||
74 | |||
75 | static struct mvebu_pinctrl_group *mvebu_pinctrl_find_group_by_name( | ||
76 | struct mvebu_pinctrl *pctl, const char *name) | ||
77 | { | ||
78 | unsigned n; | ||
79 | for (n = 0; n < pctl->num_groups; n++) { | ||
80 | if (strcmp(name, pctl->groups[n].name) == 0) | ||
81 | return &pctl->groups[n]; | ||
82 | } | ||
83 | return NULL; | ||
84 | } | ||
85 | |||
86 | static struct mvebu_mpp_ctrl_setting *mvebu_pinctrl_find_setting_by_val( | ||
87 | struct mvebu_pinctrl *pctl, struct mvebu_pinctrl_group *grp, | ||
88 | unsigned long config) | ||
89 | { | ||
90 | unsigned n; | ||
91 | for (n = 0; n < grp->num_settings; n++) { | ||
92 | if (config == grp->settings[n].val) { | ||
93 | if (!pctl->variant || (pctl->variant & | ||
94 | grp->settings[n].variant)) | ||
95 | return &grp->settings[n]; | ||
96 | } | ||
97 | } | ||
98 | return NULL; | ||
99 | } | ||
100 | |||
101 | static struct mvebu_mpp_ctrl_setting *mvebu_pinctrl_find_setting_by_name( | ||
102 | struct mvebu_pinctrl *pctl, struct mvebu_pinctrl_group *grp, | ||
103 | const char *name) | ||
104 | { | ||
105 | unsigned n; | ||
106 | for (n = 0; n < grp->num_settings; n++) { | ||
107 | if (strcmp(name, grp->settings[n].name) == 0) { | ||
108 | if (!pctl->variant || (pctl->variant & | ||
109 | grp->settings[n].variant)) | ||
110 | return &grp->settings[n]; | ||
111 | } | ||
112 | } | ||
113 | return NULL; | ||
114 | } | ||
115 | |||
116 | static struct mvebu_mpp_ctrl_setting *mvebu_pinctrl_find_gpio_setting( | ||
117 | struct mvebu_pinctrl *pctl, struct mvebu_pinctrl_group *grp) | ||
118 | { | ||
119 | unsigned n; | ||
120 | for (n = 0; n < grp->num_settings; n++) { | ||
121 | if (grp->settings[n].flags & | ||
122 | (MVEBU_SETTING_GPO | MVEBU_SETTING_GPI)) { | ||
123 | if (!pctl->variant || (pctl->variant & | ||
124 | grp->settings[n].variant)) | ||
125 | return &grp->settings[n]; | ||
126 | } | ||
127 | } | ||
128 | return NULL; | ||
129 | } | ||
130 | |||
131 | static struct mvebu_pinctrl_function *mvebu_pinctrl_find_function_by_name( | ||
132 | struct mvebu_pinctrl *pctl, const char *name) | ||
133 | { | ||
134 | unsigned n; | ||
135 | for (n = 0; n < pctl->num_functions; n++) { | ||
136 | if (strcmp(name, pctl->functions[n].name) == 0) | ||
137 | return &pctl->functions[n]; | ||
138 | } | ||
139 | return NULL; | ||
140 | } | ||
141 | |||
142 | /* | ||
143 | * Common mpp pin configuration registers on MVEBU are | ||
144 | * registers of eight 4-bit values for each mpp setting. | ||
145 | * Register offset and bit mask are calculated accordingly below. | ||
146 | */ | ||
147 | static int mvebu_common_mpp_get(struct mvebu_pinctrl *pctl, | ||
148 | struct mvebu_pinctrl_group *grp, | ||
149 | unsigned long *config) | ||
150 | { | ||
151 | unsigned pin = grp->gid; | ||
152 | unsigned off = (pin / MPPS_PER_REG) * MPP_BITS; | ||
153 | unsigned shift = (pin % MPPS_PER_REG) * MPP_BITS; | ||
154 | |||
155 | *config = readl(pctl->base + off); | ||
156 | *config >>= shift; | ||
157 | *config &= MPP_MASK; | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | static int mvebu_common_mpp_set(struct mvebu_pinctrl *pctl, | ||
163 | struct mvebu_pinctrl_group *grp, | ||
164 | unsigned long config) | ||
165 | { | ||
166 | unsigned pin = grp->gid; | ||
167 | unsigned off = (pin / MPPS_PER_REG) * MPP_BITS; | ||
168 | unsigned shift = (pin % MPPS_PER_REG) * MPP_BITS; | ||
169 | unsigned long reg; | ||
170 | |||
171 | reg = readl(pctl->base + off); | ||
172 | reg &= ~(MPP_MASK << shift); | ||
173 | reg |= (config << shift); | ||
174 | writel(reg, pctl->base + off); | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
179 | static int mvebu_pinconf_group_get(struct pinctrl_dev *pctldev, | ||
180 | unsigned gid, unsigned long *config) | ||
181 | { | ||
182 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
183 | struct mvebu_pinctrl_group *grp = &pctl->groups[gid]; | ||
184 | |||
185 | if (!grp->ctrl) | ||
186 | return -EINVAL; | ||
187 | |||
188 | if (grp->ctrl->mpp_get) | ||
189 | return grp->ctrl->mpp_get(grp->ctrl, config); | ||
190 | |||
191 | return mvebu_common_mpp_get(pctl, grp, config); | ||
192 | } | ||
193 | |||
194 | static int mvebu_pinconf_group_set(struct pinctrl_dev *pctldev, | ||
195 | unsigned gid, unsigned long config) | ||
196 | { | ||
197 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
198 | struct mvebu_pinctrl_group *grp = &pctl->groups[gid]; | ||
199 | |||
200 | if (!grp->ctrl) | ||
201 | return -EINVAL; | ||
202 | |||
203 | if (grp->ctrl->mpp_set) | ||
204 | return grp->ctrl->mpp_set(grp->ctrl, config); | ||
205 | |||
206 | return mvebu_common_mpp_set(pctl, grp, config); | ||
207 | } | ||
208 | |||
209 | static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev, | ||
210 | struct seq_file *s, unsigned gid) | ||
211 | { | ||
212 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
213 | struct mvebu_pinctrl_group *grp = &pctl->groups[gid]; | ||
214 | struct mvebu_mpp_ctrl_setting *curr; | ||
215 | unsigned long config; | ||
216 | unsigned n; | ||
217 | |||
218 | if (mvebu_pinconf_group_get(pctldev, gid, &config)) | ||
219 | return; | ||
220 | |||
221 | curr = mvebu_pinctrl_find_setting_by_val(pctl, grp, config); | ||
222 | |||
223 | if (curr) { | ||
224 | seq_printf(s, "current: %s", curr->name); | ||
225 | if (curr->subname) | ||
226 | seq_printf(s, "(%s)", curr->subname); | ||
227 | if (curr->flags & (MVEBU_SETTING_GPO | MVEBU_SETTING_GPI)) { | ||
228 | seq_printf(s, "("); | ||
229 | if (curr->flags & MVEBU_SETTING_GPI) | ||
230 | seq_printf(s, "i"); | ||
231 | if (curr->flags & MVEBU_SETTING_GPO) | ||
232 | seq_printf(s, "o"); | ||
233 | seq_printf(s, ")"); | ||
234 | } | ||
235 | } else | ||
236 | seq_printf(s, "current: UNKNOWN"); | ||
237 | |||
238 | if (grp->num_settings > 1) { | ||
239 | seq_printf(s, ", available = ["); | ||
240 | for (n = 0; n < grp->num_settings; n++) { | ||
241 | if (curr == &grp->settings[n]) | ||
242 | continue; | ||
243 | |||
244 | /* skip unsupported settings for this variant */ | ||
245 | if (pctl->variant && | ||
246 | !(pctl->variant & grp->settings[n].variant)) | ||
247 | continue; | ||
248 | |||
249 | seq_printf(s, " %s", grp->settings[n].name); | ||
250 | if (grp->settings[n].subname) | ||
251 | seq_printf(s, "(%s)", grp->settings[n].subname); | ||
252 | if (grp->settings[n].flags & | ||
253 | (MVEBU_SETTING_GPO | MVEBU_SETTING_GPI)) { | ||
254 | seq_printf(s, "("); | ||
255 | if (grp->settings[n].flags & MVEBU_SETTING_GPI) | ||
256 | seq_printf(s, "i"); | ||
257 | if (grp->settings[n].flags & MVEBU_SETTING_GPO) | ||
258 | seq_printf(s, "o"); | ||
259 | seq_printf(s, ")"); | ||
260 | } | ||
261 | } | ||
262 | seq_printf(s, " ]"); | ||
263 | } | ||
264 | return; | ||
265 | } | ||
266 | |||
267 | static struct pinconf_ops mvebu_pinconf_ops = { | ||
268 | .pin_config_group_get = mvebu_pinconf_group_get, | ||
269 | .pin_config_group_set = mvebu_pinconf_group_set, | ||
270 | .pin_config_group_dbg_show = mvebu_pinconf_group_dbg_show, | ||
271 | }; | ||
272 | |||
273 | static int mvebu_pinmux_get_funcs_count(struct pinctrl_dev *pctldev) | ||
274 | { | ||
275 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
276 | |||
277 | return pctl->num_functions; | ||
278 | } | ||
279 | |||
280 | static const char *mvebu_pinmux_get_func_name(struct pinctrl_dev *pctldev, | ||
281 | unsigned fid) | ||
282 | { | ||
283 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
284 | |||
285 | return pctl->functions[fid].name; | ||
286 | } | ||
287 | |||
288 | static int mvebu_pinmux_get_groups(struct pinctrl_dev *pctldev, unsigned fid, | ||
289 | const char * const **groups, | ||
290 | unsigned * const num_groups) | ||
291 | { | ||
292 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
293 | |||
294 | *groups = pctl->functions[fid].groups; | ||
295 | *num_groups = pctl->functions[fid].num_groups; | ||
296 | return 0; | ||
297 | } | ||
298 | |||
299 | static int mvebu_pinmux_enable(struct pinctrl_dev *pctldev, unsigned fid, | ||
300 | unsigned gid) | ||
301 | { | ||
302 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
303 | struct mvebu_pinctrl_function *func = &pctl->functions[fid]; | ||
304 | struct mvebu_pinctrl_group *grp = &pctl->groups[gid]; | ||
305 | struct mvebu_mpp_ctrl_setting *setting; | ||
306 | int ret; | ||
307 | |||
308 | setting = mvebu_pinctrl_find_setting_by_name(pctl, grp, | ||
309 | func->name); | ||
310 | if (!setting) { | ||
311 | dev_err(pctl->dev, | ||
312 | "unable to find setting %s in group %s\n", | ||
313 | func->name, func->groups[gid]); | ||
314 | return -EINVAL; | ||
315 | } | ||
316 | |||
317 | ret = mvebu_pinconf_group_set(pctldev, grp->gid, setting->val); | ||
318 | if (ret) { | ||
319 | dev_err(pctl->dev, "cannot set group %s to %s\n", | ||
320 | func->groups[gid], func->name); | ||
321 | return ret; | ||
322 | } | ||
323 | |||
324 | return 0; | ||
325 | } | ||
326 | |||
327 | static int mvebu_pinmux_gpio_request_enable(struct pinctrl_dev *pctldev, | ||
328 | struct pinctrl_gpio_range *range, unsigned offset) | ||
329 | { | ||
330 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
331 | struct mvebu_pinctrl_group *grp; | ||
332 | struct mvebu_mpp_ctrl_setting *setting; | ||
333 | |||
334 | grp = mvebu_pinctrl_find_group_by_pid(pctl, offset); | ||
335 | if (!grp) | ||
336 | return -EINVAL; | ||
337 | |||
338 | if (grp->ctrl->mpp_gpio_req) | ||
339 | return grp->ctrl->mpp_gpio_req(grp->ctrl, offset); | ||
340 | |||
341 | setting = mvebu_pinctrl_find_gpio_setting(pctl, grp); | ||
342 | if (!setting) | ||
343 | return -ENOTSUPP; | ||
344 | |||
345 | return mvebu_pinconf_group_set(pctldev, grp->gid, setting->val); | ||
346 | } | ||
347 | |||
348 | static int mvebu_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev, | ||
349 | struct pinctrl_gpio_range *range, unsigned offset, bool input) | ||
350 | { | ||
351 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
352 | struct mvebu_pinctrl_group *grp; | ||
353 | struct mvebu_mpp_ctrl_setting *setting; | ||
354 | |||
355 | grp = mvebu_pinctrl_find_group_by_pid(pctl, offset); | ||
356 | if (!grp) | ||
357 | return -EINVAL; | ||
358 | |||
359 | if (grp->ctrl->mpp_gpio_dir) | ||
360 | return grp->ctrl->mpp_gpio_dir(grp->ctrl, offset, input); | ||
361 | |||
362 | setting = mvebu_pinctrl_find_gpio_setting(pctl, grp); | ||
363 | if (!setting) | ||
364 | return -ENOTSUPP; | ||
365 | |||
366 | if ((input && (setting->flags & MVEBU_SETTING_GPI)) || | ||
367 | (!input && (setting->flags & MVEBU_SETTING_GPO))) | ||
368 | return 0; | ||
369 | |||
370 | return -ENOTSUPP; | ||
371 | } | ||
372 | |||
373 | static struct pinmux_ops mvebu_pinmux_ops = { | ||
374 | .get_functions_count = mvebu_pinmux_get_funcs_count, | ||
375 | .get_function_name = mvebu_pinmux_get_func_name, | ||
376 | .get_function_groups = mvebu_pinmux_get_groups, | ||
377 | .gpio_request_enable = mvebu_pinmux_gpio_request_enable, | ||
378 | .gpio_set_direction = mvebu_pinmux_gpio_set_direction, | ||
379 | .enable = mvebu_pinmux_enable, | ||
380 | }; | ||
381 | |||
382 | static int mvebu_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) | ||
383 | { | ||
384 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
385 | return pctl->num_groups; | ||
386 | } | ||
387 | |||
388 | static const char *mvebu_pinctrl_get_group_name(struct pinctrl_dev *pctldev, | ||
389 | unsigned gid) | ||
390 | { | ||
391 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
392 | return pctl->groups[gid].name; | ||
393 | } | ||
394 | |||
395 | static int mvebu_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, | ||
396 | unsigned gid, const unsigned **pins, | ||
397 | unsigned *num_pins) | ||
398 | { | ||
399 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
400 | *pins = pctl->groups[gid].pins; | ||
401 | *num_pins = pctl->groups[gid].npins; | ||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | static int mvebu_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, | ||
406 | struct device_node *np, | ||
407 | struct pinctrl_map **map, | ||
408 | unsigned *num_maps) | ||
409 | { | ||
410 | struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | ||
411 | struct property *prop; | ||
412 | const char *function; | ||
413 | const char *group; | ||
414 | int ret, nmaps, n; | ||
415 | |||
416 | *map = NULL; | ||
417 | *num_maps = 0; | ||
418 | |||
419 | ret = of_property_read_string(np, "marvell,function", &function); | ||
420 | if (ret) { | ||
421 | dev_err(pctl->dev, | ||
422 | "missing marvell,function in node %s\n", np->name); | ||
423 | return 0; | ||
424 | } | ||
425 | |||
426 | nmaps = of_property_count_strings(np, "marvell,pins"); | ||
427 | if (nmaps < 0) { | ||
428 | dev_err(pctl->dev, | ||
429 | "missing marvell,pins in node %s\n", np->name); | ||
430 | return 0; | ||
431 | } | ||
432 | |||
433 | *map = kmalloc(nmaps * sizeof(struct pinctrl_map), GFP_KERNEL); | ||
434 | if (map == NULL) { | ||
435 | dev_err(pctl->dev, | ||
436 | "cannot allocate pinctrl_map memory for %s\n", | ||
437 | np->name); | ||
438 | return -ENOMEM; | ||
439 | } | ||
440 | |||
441 | n = 0; | ||
442 | of_property_for_each_string(np, "marvell,pins", prop, group) { | ||
443 | struct mvebu_pinctrl_group *grp = | ||
444 | mvebu_pinctrl_find_group_by_name(pctl, group); | ||
445 | |||
446 | if (!grp) { | ||
447 | dev_err(pctl->dev, "unknown pin %s", group); | ||
448 | continue; | ||
449 | } | ||
450 | |||
451 | if (!mvebu_pinctrl_find_setting_by_name(pctl, grp, function)) { | ||
452 | dev_err(pctl->dev, "unsupported function %s on pin %s", | ||
453 | function, group); | ||
454 | continue; | ||
455 | } | ||
456 | |||
457 | (*map)[n].type = PIN_MAP_TYPE_MUX_GROUP; | ||
458 | (*map)[n].data.mux.group = group; | ||
459 | (*map)[n].data.mux.function = function; | ||
460 | n++; | ||
461 | } | ||
462 | |||
463 | *num_maps = nmaps; | ||
464 | |||
465 | return 0; | ||
466 | } | ||
467 | |||
468 | static void mvebu_pinctrl_dt_free_map(struct pinctrl_dev *pctldev, | ||
469 | struct pinctrl_map *map, unsigned num_maps) | ||
470 | { | ||
471 | kfree(map); | ||
472 | } | ||
473 | |||
474 | static struct pinctrl_ops mvebu_pinctrl_ops = { | ||
475 | .get_groups_count = mvebu_pinctrl_get_groups_count, | ||
476 | .get_group_name = mvebu_pinctrl_get_group_name, | ||
477 | .get_group_pins = mvebu_pinctrl_get_group_pins, | ||
478 | .dt_node_to_map = mvebu_pinctrl_dt_node_to_map, | ||
479 | .dt_free_map = mvebu_pinctrl_dt_free_map, | ||
480 | }; | ||
481 | |||
482 | static int __devinit _add_function(struct mvebu_pinctrl_function *funcs, | ||
483 | const char *name) | ||
484 | { | ||
485 | while (funcs->num_groups) { | ||
486 | /* function already there */ | ||
487 | if (strcmp(funcs->name, name) == 0) { | ||
488 | funcs->num_groups++; | ||
489 | return -EEXIST; | ||
490 | } | ||
491 | funcs++; | ||
492 | } | ||
493 | funcs->name = name; | ||
494 | funcs->num_groups = 1; | ||
495 | return 0; | ||
496 | } | ||
497 | |||
498 | static int __devinit mvebu_pinctrl_build_functions(struct platform_device *pdev, | ||
499 | struct mvebu_pinctrl *pctl) | ||
500 | { | ||
501 | struct mvebu_pinctrl_function *funcs; | ||
502 | int num = 0; | ||
503 | int n, s; | ||
504 | |||
505 | /* we allocate functions for number of pins and hope | ||
506 | * there are less unique functions than pins available */ | ||
507 | funcs = devm_kzalloc(&pdev->dev, pctl->desc.npins * | ||
508 | sizeof(struct mvebu_pinctrl_function), GFP_KERNEL); | ||
509 | if (!funcs) | ||
510 | return -ENOMEM; | ||
511 | |||
512 | for (n = 0; n < pctl->num_groups; n++) { | ||
513 | struct mvebu_pinctrl_group *grp = &pctl->groups[n]; | ||
514 | for (s = 0; s < grp->num_settings; s++) { | ||
515 | /* skip unsupported settings on this variant */ | ||
516 | if (pctl->variant && | ||
517 | !(pctl->variant & grp->settings[s].variant)) | ||
518 | continue; | ||
519 | |||
520 | /* check for unique functions and count groups */ | ||
521 | if (_add_function(funcs, grp->settings[s].name)) | ||
522 | continue; | ||
523 | |||
524 | num++; | ||
525 | } | ||
526 | } | ||
527 | |||
528 | /* with the number of unique functions and it's groups known, | ||
529 | reallocate functions and assign group names */ | ||
530 | funcs = krealloc(funcs, num * sizeof(struct mvebu_pinctrl_function), | ||
531 | GFP_KERNEL); | ||
532 | if (!funcs) | ||
533 | return -ENOMEM; | ||
534 | |||
535 | pctl->num_functions = num; | ||
536 | pctl->functions = funcs; | ||
537 | |||
538 | for (n = 0; n < pctl->num_groups; n++) { | ||
539 | struct mvebu_pinctrl_group *grp = &pctl->groups[n]; | ||
540 | for (s = 0; s < grp->num_settings; s++) { | ||
541 | struct mvebu_pinctrl_function *f; | ||
542 | const char **groups; | ||
543 | |||
544 | /* skip unsupported settings on this variant */ | ||
545 | if (pctl->variant && | ||
546 | !(pctl->variant & grp->settings[s].variant)) | ||
547 | continue; | ||
548 | |||
549 | f = mvebu_pinctrl_find_function_by_name(pctl, | ||
550 | grp->settings[s].name); | ||
551 | |||
552 | /* allocate group name array if not done already */ | ||
553 | if (!f->groups) { | ||
554 | f->groups = devm_kzalloc(&pdev->dev, | ||
555 | f->num_groups * sizeof(char *), | ||
556 | GFP_KERNEL); | ||
557 | if (!f->groups) | ||
558 | return -ENOMEM; | ||
559 | } | ||
560 | |||
561 | /* find next free group name and assign current name */ | ||
562 | groups = f->groups; | ||
563 | while (*groups) | ||
564 | groups++; | ||
565 | *groups = grp->name; | ||
566 | } | ||
567 | } | ||
568 | |||
569 | return 0; | ||
570 | } | ||
571 | |||
572 | int __devinit mvebu_pinctrl_probe(struct platform_device *pdev) | ||
573 | { | ||
574 | struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev); | ||
575 | struct device_node *np = pdev->dev.of_node; | ||
576 | struct mvebu_pinctrl *pctl; | ||
577 | void __iomem *base; | ||
578 | struct pinctrl_pin_desc *pdesc; | ||
579 | unsigned gid, n, k; | ||
580 | int ret; | ||
581 | |||
582 | if (!soc || !soc->controls || !soc->modes) { | ||
583 | dev_err(&pdev->dev, "wrong pinctrl soc info\n"); | ||
584 | return -EINVAL; | ||
585 | } | ||
586 | |||
587 | base = of_iomap(np, 0); | ||
588 | if (!base) { | ||
589 | dev_err(&pdev->dev, "unable to get base address\n"); | ||
590 | return -ENODEV; | ||
591 | } | ||
592 | |||
593 | pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl), | ||
594 | GFP_KERNEL); | ||
595 | if (!pctl) { | ||
596 | dev_err(&pdev->dev, "unable to alloc driver\n"); | ||
597 | return -ENOMEM; | ||
598 | } | ||
599 | |||
600 | pctl->desc.name = dev_name(&pdev->dev); | ||
601 | pctl->desc.owner = THIS_MODULE; | ||
602 | pctl->desc.pctlops = &mvebu_pinctrl_ops; | ||
603 | pctl->desc.pmxops = &mvebu_pinmux_ops; | ||
604 | pctl->desc.confops = &mvebu_pinconf_ops; | ||
605 | pctl->variant = soc->variant; | ||
606 | pctl->base = base; | ||
607 | pctl->dev = &pdev->dev; | ||
608 | platform_set_drvdata(pdev, pctl); | ||
609 | |||
610 | /* count controls and create names for mvebu generic | ||
611 | register controls; also does sanity checks */ | ||
612 | pctl->num_groups = 0; | ||
613 | pctl->desc.npins = 0; | ||
614 | for (n = 0; n < soc->ncontrols; n++) { | ||
615 | struct mvebu_mpp_ctrl *ctrl = &soc->controls[n]; | ||
616 | char *names; | ||
617 | |||
618 | pctl->desc.npins += ctrl->npins; | ||
619 | /* initial control pins */ | ||
620 | for (k = 0; k < ctrl->npins; k++) | ||
621 | ctrl->pins[k] = ctrl->pid + k; | ||
622 | |||
623 | /* special soc specific control */ | ||
624 | if (ctrl->mpp_get || ctrl->mpp_set) { | ||
625 | if (!ctrl->name || !ctrl->mpp_set || !ctrl->mpp_set) { | ||
626 | dev_err(&pdev->dev, "wrong soc control info\n"); | ||
627 | return -EINVAL; | ||
628 | } | ||
629 | pctl->num_groups += 1; | ||
630 | continue; | ||
631 | } | ||
632 | |||
633 | /* generic mvebu register control */ | ||
634 | names = devm_kzalloc(&pdev->dev, ctrl->npins * 8, GFP_KERNEL); | ||
635 | if (!names) { | ||
636 | dev_err(&pdev->dev, "failed to alloc mpp names\n"); | ||
637 | return -ENOMEM; | ||
638 | } | ||
639 | for (k = 0; k < ctrl->npins; k++) | ||
640 | sprintf(names + 8*k, "mpp%d", ctrl->pid+k); | ||
641 | ctrl->name = names; | ||
642 | pctl->num_groups += ctrl->npins; | ||
643 | } | ||
644 | |||
645 | pdesc = devm_kzalloc(&pdev->dev, pctl->desc.npins * | ||
646 | sizeof(struct pinctrl_pin_desc), GFP_KERNEL); | ||
647 | if (!pdesc) { | ||
648 | dev_err(&pdev->dev, "failed to alloc pinctrl pins\n"); | ||
649 | return -ENOMEM; | ||
650 | } | ||
651 | |||
652 | for (n = 0; n < pctl->desc.npins; n++) | ||
653 | pdesc[n].number = n; | ||
654 | pctl->desc.pins = pdesc; | ||
655 | |||
656 | pctl->groups = devm_kzalloc(&pdev->dev, pctl->num_groups * | ||
657 | sizeof(struct mvebu_pinctrl_group), GFP_KERNEL); | ||
658 | if (!pctl->groups) { | ||
659 | dev_err(&pdev->dev, "failed to alloc pinctrl groups\n"); | ||
660 | return -ENOMEM; | ||
661 | } | ||
662 | |||
663 | /* assign mpp controls to groups */ | ||
664 | gid = 0; | ||
665 | for (n = 0; n < soc->ncontrols; n++) { | ||
666 | struct mvebu_mpp_ctrl *ctrl = &soc->controls[n]; | ||
667 | pctl->groups[gid].gid = gid; | ||
668 | pctl->groups[gid].ctrl = ctrl; | ||
669 | pctl->groups[gid].name = ctrl->name; | ||
670 | pctl->groups[gid].pins = ctrl->pins; | ||
671 | pctl->groups[gid].npins = ctrl->npins; | ||
672 | |||
673 | /* generic mvebu register control maps to a number of groups */ | ||
674 | if (!ctrl->mpp_get && !ctrl->mpp_set) { | ||
675 | pctl->groups[gid].npins = 1; | ||
676 | |||
677 | for (k = 1; k < ctrl->npins; k++) { | ||
678 | gid++; | ||
679 | pctl->groups[gid].gid = gid; | ||
680 | pctl->groups[gid].ctrl = ctrl; | ||
681 | pctl->groups[gid].name = &ctrl->name[8*k]; | ||
682 | pctl->groups[gid].pins = &ctrl->pins[k]; | ||
683 | pctl->groups[gid].npins = 1; | ||
684 | } | ||
685 | } | ||
686 | gid++; | ||
687 | } | ||
688 | |||
689 | /* assign mpp modes to groups */ | ||
690 | for (n = 0; n < soc->nmodes; n++) { | ||
691 | struct mvebu_mpp_mode *mode = &soc->modes[n]; | ||
692 | struct mvebu_pinctrl_group *grp = | ||
693 | mvebu_pinctrl_find_group_by_pid(pctl, mode->pid); | ||
694 | unsigned num_settings; | ||
695 | |||
696 | if (!grp) { | ||
697 | dev_warn(&pdev->dev, "unknown pinctrl group %d\n", | ||
698 | mode->pid); | ||
699 | continue; | ||
700 | } | ||
701 | |||
702 | for (num_settings = 0; ;) { | ||
703 | struct mvebu_mpp_ctrl_setting *set = | ||
704 | &mode->settings[num_settings]; | ||
705 | |||
706 | if (!set->name) | ||
707 | break; | ||
708 | num_settings++; | ||
709 | |||
710 | /* skip unsupported settings for this variant */ | ||
711 | if (pctl->variant && !(pctl->variant & set->variant)) | ||
712 | continue; | ||
713 | |||
714 | /* find gpio/gpo/gpi settings */ | ||
715 | if (strcmp(set->name, "gpio") == 0) | ||
716 | set->flags = MVEBU_SETTING_GPI | | ||
717 | MVEBU_SETTING_GPO; | ||
718 | else if (strcmp(set->name, "gpo") == 0) | ||
719 | set->flags = MVEBU_SETTING_GPO; | ||
720 | else if (strcmp(set->name, "gpi") == 0) | ||
721 | set->flags = MVEBU_SETTING_GPI; | ||
722 | } | ||
723 | |||
724 | grp->settings = mode->settings; | ||
725 | grp->num_settings = num_settings; | ||
726 | } | ||
727 | |||
728 | ret = mvebu_pinctrl_build_functions(pdev, pctl); | ||
729 | if (ret) { | ||
730 | dev_err(&pdev->dev, "unable to build functions\n"); | ||
731 | return ret; | ||
732 | } | ||
733 | |||
734 | pctl->pctldev = pinctrl_register(&pctl->desc, &pdev->dev, pctl); | ||
735 | if (!pctl->pctldev) { | ||
736 | dev_err(&pdev->dev, "unable to register pinctrl driver\n"); | ||
737 | return -EINVAL; | ||
738 | } | ||
739 | |||
740 | dev_info(&pdev->dev, "registered pinctrl driver\n"); | ||
741 | |||
742 | /* register gpio ranges */ | ||
743 | for (n = 0; n < soc->ngpioranges; n++) | ||
744 | pinctrl_add_gpio_range(pctl->pctldev, &soc->gpioranges[n]); | ||
745 | |||
746 | return 0; | ||
747 | } | ||
748 | |||
749 | int __devexit mvebu_pinctrl_remove(struct platform_device *pdev) | ||
750 | { | ||
751 | struct mvebu_pinctrl *pctl = platform_get_drvdata(pdev); | ||
752 | pinctrl_unregister(pctl->pctldev); | ||
753 | return 0; | ||
754 | } | ||
diff --git a/drivers/pinctrl/pinctrl-mvebu.h b/drivers/pinctrl/pinctrl-mvebu.h new file mode 100644 index 000000000000..90bd3beee860 --- /dev/null +++ b/drivers/pinctrl/pinctrl-mvebu.h | |||
@@ -0,0 +1,192 @@ | |||
1 | /* | ||
2 | * Marvell MVEBU pinctrl driver | ||
3 | * | ||
4 | * Authors: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | ||
5 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __PINCTRL_MVEBU_H__ | ||
14 | #define __PINCTRL_MVEBU_H__ | ||
15 | |||
16 | /** | ||
17 | * struct mvebu_mpp_ctrl - describe a mpp control | ||
18 | * @name: name of the control group | ||
19 | * @pid: first pin id handled by this control | ||
20 | * @npins: number of pins controlled by this control | ||
21 | * @mpp_get: (optional) special function to get mpp setting | ||
22 | * @mpp_set: (optional) special function to set mpp setting | ||
23 | * @mpp_gpio_req: (optional) special function to request gpio | ||
24 | * @mpp_gpio_dir: (optional) special function to set gpio direction | ||
25 | * | ||
26 | * A mpp_ctrl describes a muxable unit, e.g. pin, group of pins, or | ||
27 | * internal function, inside the SoC. Each muxable unit can be switched | ||
28 | * between two or more different settings, e.g. assign mpp pin 13 to | ||
29 | * uart1 or sata. | ||
30 | * | ||
31 | * If optional mpp_get/_set functions are set these are used to get/set | ||
32 | * a specific mode. Otherwise it is assumed that the mpp control is based | ||
33 | * on 4-bit groups in subsequent registers. The optional mpp_gpio_req/_dir | ||
34 | * functions can be used to allow pin settings with varying gpio pins. | ||
35 | */ | ||
36 | struct mvebu_mpp_ctrl { | ||
37 | const char *name; | ||
38 | u8 pid; | ||
39 | u8 npins; | ||
40 | unsigned *pins; | ||
41 | int (*mpp_get)(struct mvebu_mpp_ctrl *ctrl, unsigned long *config); | ||
42 | int (*mpp_set)(struct mvebu_mpp_ctrl *ctrl, unsigned long config); | ||
43 | int (*mpp_gpio_req)(struct mvebu_mpp_ctrl *ctrl, u8 pid); | ||
44 | int (*mpp_gpio_dir)(struct mvebu_mpp_ctrl *ctrl, u8 pid, bool input); | ||
45 | }; | ||
46 | |||
47 | /** | ||
48 | * struct mvebu_mpp_ctrl_setting - describe a mpp ctrl setting | ||
49 | * @val: ctrl setting value | ||
50 | * @name: ctrl setting name, e.g. uart2, spi0 - unique per mpp_mode | ||
51 | * @subname: (optional) additional ctrl setting name, e.g. rts, cts | ||
52 | * @variant: (optional) variant identifier mask | ||
53 | * @flags: (private) flags to store gpi/gpo/gpio capabilities | ||
54 | * | ||
55 | * A ctrl_setting describes a specific internal mux function that a mpp pin | ||
56 | * can be switched to. The value (val) will be written in the corresponding | ||
57 | * register for common mpp pin configuration registers on MVEBU. SoC specific | ||
58 | * mpp_get/_set function may use val to distinguish between different settings. | ||
59 | * | ||
60 | * The name will be used to switch to this setting in DT description, e.g. | ||
61 | * marvell,function = "uart2". subname is only for debugging purposes. | ||
62 | * | ||
63 | * If name is one of "gpi", "gpo", "gpio" gpio capabilities are | ||
64 | * parsed during initialization and stored in flags. | ||
65 | * | ||
66 | * The variant can be used to combine different revisions of one SoC to a | ||
67 | * common pinctrl driver. It is matched (AND) with variant of soc_info to | ||
68 | * determine if a setting is available on the current SoC revision. | ||
69 | */ | ||
70 | struct mvebu_mpp_ctrl_setting { | ||
71 | u8 val; | ||
72 | const char *name; | ||
73 | const char *subname; | ||
74 | u8 variant; | ||
75 | u8 flags; | ||
76 | #define MVEBU_SETTING_GPO (1 << 0) | ||
77 | #define MVEBU_SETTING_GPI (1 << 1) | ||
78 | }; | ||
79 | |||
80 | /** | ||
81 | * struct mvebu_mpp_mode - link ctrl and settings | ||
82 | * @pid: first pin id handled by this mode | ||
83 | * @settings: list of settings available for this mode | ||
84 | * | ||
85 | * A mode connects all available settings with the corresponding mpp_ctrl | ||
86 | * given by pid. | ||
87 | */ | ||
88 | struct mvebu_mpp_mode { | ||
89 | u8 pid; | ||
90 | struct mvebu_mpp_ctrl_setting *settings; | ||
91 | }; | ||
92 | |||
93 | /** | ||
94 | * struct mvebu_pinctrl_soc_info - SoC specific info passed to pinctrl-mvebu | ||
95 | * @variant: variant mask of soc_info | ||
96 | * @controls: list of available mvebu_mpp_ctrls | ||
97 | * @ncontrols: number of available mvebu_mpp_ctrls | ||
98 | * @modes: list of available mvebu_mpp_modes | ||
99 | * @nmodes: number of available mvebu_mpp_modes | ||
100 | * @gpioranges: list of pinctrl_gpio_ranges | ||
101 | * @ngpioranges: number of available pinctrl_gpio_ranges | ||
102 | * | ||
103 | * This struct describes all pinctrl related information for a specific SoC. | ||
104 | * If variant is unequal 0 it will be matched (AND) with variant of each | ||
105 | * setting and allows to distinguish between different revisions of one SoC. | ||
106 | */ | ||
107 | struct mvebu_pinctrl_soc_info { | ||
108 | u8 variant; | ||
109 | struct mvebu_mpp_ctrl *controls; | ||
110 | int ncontrols; | ||
111 | struct mvebu_mpp_mode *modes; | ||
112 | int nmodes; | ||
113 | struct pinctrl_gpio_range *gpioranges; | ||
114 | int ngpioranges; | ||
115 | }; | ||
116 | |||
117 | #define MPP_REG_CTRL(_idl, _idh) \ | ||
118 | { \ | ||
119 | .name = NULL, \ | ||
120 | .pid = _idl, \ | ||
121 | .npins = _idh - _idl + 1, \ | ||
122 | .pins = (unsigned[_idh - _idl + 1]) { }, \ | ||
123 | .mpp_get = NULL, \ | ||
124 | .mpp_set = NULL, \ | ||
125 | .mpp_gpio_req = NULL, \ | ||
126 | .mpp_gpio_dir = NULL, \ | ||
127 | } | ||
128 | |||
129 | #define MPP_FUNC_CTRL(_idl, _idh, _name, _func) \ | ||
130 | { \ | ||
131 | .name = _name, \ | ||
132 | .pid = _idl, \ | ||
133 | .npins = _idh - _idl + 1, \ | ||
134 | .pins = (unsigned[_idh - _idl + 1]) { }, \ | ||
135 | .mpp_get = _func ## _get, \ | ||
136 | .mpp_set = _func ## _set, \ | ||
137 | .mpp_gpio_req = NULL, \ | ||
138 | .mpp_gpio_dir = NULL, \ | ||
139 | } | ||
140 | |||
141 | #define MPP_FUNC_GPIO_CTRL(_idl, _idh, _name, _func) \ | ||
142 | { \ | ||
143 | .name = _name, \ | ||
144 | .pid = _idl, \ | ||
145 | .npins = _idh - _idl + 1, \ | ||
146 | .pins = (unsigned[_idh - _idl + 1]) { }, \ | ||
147 | .mpp_get = _func ## _get, \ | ||
148 | .mpp_set = _func ## _set, \ | ||
149 | .mpp_gpio_req = _func ## _gpio_req, \ | ||
150 | .mpp_gpio_dir = _func ## _gpio_dir, \ | ||
151 | } | ||
152 | |||
153 | #define _MPP_VAR_FUNCTION(_val, _name, _subname, _mask) \ | ||
154 | { \ | ||
155 | .val = _val, \ | ||
156 | .name = _name, \ | ||
157 | .subname = _subname, \ | ||
158 | .variant = _mask, \ | ||
159 | .flags = 0, \ | ||
160 | } | ||
161 | |||
162 | #if defined(CONFIG_DEBUG_FS) | ||
163 | #define MPP_VAR_FUNCTION(_val, _name, _subname, _mask) \ | ||
164 | _MPP_VAR_FUNCTION(_val, _name, _subname, _mask) | ||
165 | #else | ||
166 | #define MPP_VAR_FUNCTION(_val, _name, _subname, _mask) \ | ||
167 | _MPP_VAR_FUNCTION(_val, _name, NULL, _mask) | ||
168 | #endif | ||
169 | |||
170 | #define MPP_FUNCTION(_val, _name, _subname) \ | ||
171 | MPP_VAR_FUNCTION(_val, _name, _subname, (u8)-1) | ||
172 | |||
173 | #define MPP_MODE(_id, ...) \ | ||
174 | { \ | ||
175 | .pid = _id, \ | ||
176 | .settings = (struct mvebu_mpp_ctrl_setting[]){ \ | ||
177 | __VA_ARGS__, { } }, \ | ||
178 | } | ||
179 | |||
180 | #define MPP_GPIO_RANGE(_id, _pinbase, _gpiobase, _npins) \ | ||
181 | { \ | ||
182 | .name = "mvebu-gpio", \ | ||
183 | .id = _id, \ | ||
184 | .pin_base = _pinbase, \ | ||
185 | .base = _gpiobase, \ | ||
186 | .npins = _npins, \ | ||
187 | } | ||
188 | |||
189 | int mvebu_pinctrl_probe(struct platform_device *pdev); | ||
190 | int mvebu_pinctrl_remove(struct platform_device *pdev); | ||
191 | |||
192 | #endif | ||
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c index 7fca6ce5952b..304360cd213e 100644 --- a/drivers/pinctrl/pinctrl-sirf.c +++ b/drivers/pinctrl/pinctrl-sirf.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/pinctrl/pinctrl.h> | 17 | #include <linux/pinctrl/pinctrl.h> |
18 | #include <linux/pinctrl/pinmux.h> | 18 | #include <linux/pinctrl/pinmux.h> |
19 | #include <linux/pinctrl/consumer.h> | 19 | #include <linux/pinctrl/consumer.h> |
20 | #include <linux/pinctrl/machine.h> | ||
20 | #include <linux/of.h> | 21 | #include <linux/of.h> |
21 | #include <linux/of_address.h> | 22 | #include <linux/of_address.h> |
22 | #include <linux/of_device.h> | 23 | #include <linux/of_device.h> |
@@ -916,11 +917,66 @@ static void sirfsoc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s | |||
916 | seq_printf(s, " " DRIVER_NAME); | 917 | seq_printf(s, " " DRIVER_NAME); |
917 | } | 918 | } |
918 | 919 | ||
920 | static int sirfsoc_dt_node_to_map(struct pinctrl_dev *pctldev, | ||
921 | struct device_node *np_config, | ||
922 | struct pinctrl_map **map, unsigned *num_maps) | ||
923 | { | ||
924 | struct sirfsoc_pmx *spmx = pinctrl_dev_get_drvdata(pctldev); | ||
925 | struct device_node *np; | ||
926 | struct property *prop; | ||
927 | const char *function, *group; | ||
928 | int ret, index = 0, count = 0; | ||
929 | |||
930 | /* calculate number of maps required */ | ||
931 | for_each_child_of_node(np_config, np) { | ||
932 | ret = of_property_read_string(np, "sirf,function", &function); | ||
933 | if (ret < 0) | ||
934 | return ret; | ||
935 | |||
936 | ret = of_property_count_strings(np, "sirf,pins"); | ||
937 | if (ret < 0) | ||
938 | return ret; | ||
939 | |||
940 | count += ret; | ||
941 | } | ||
942 | |||
943 | if (!count) { | ||
944 | dev_err(spmx->dev, "No child nodes passed via DT\n"); | ||
945 | return -ENODEV; | ||
946 | } | ||
947 | |||
948 | *map = kzalloc(sizeof(**map) * count, GFP_KERNEL); | ||
949 | if (!*map) | ||
950 | return -ENOMEM; | ||
951 | |||
952 | for_each_child_of_node(np_config, np) { | ||
953 | of_property_read_string(np, "sirf,function", &function); | ||
954 | of_property_for_each_string(np, "sirf,pins", prop, group) { | ||
955 | (*map)[index].type = PIN_MAP_TYPE_MUX_GROUP; | ||
956 | (*map)[index].data.mux.group = group; | ||
957 | (*map)[index].data.mux.function = function; | ||
958 | index++; | ||
959 | } | ||
960 | } | ||
961 | |||
962 | *num_maps = count; | ||
963 | |||
964 | return 0; | ||
965 | } | ||
966 | |||
967 | static void sirfsoc_dt_free_map(struct pinctrl_dev *pctldev, | ||
968 | struct pinctrl_map *map, unsigned num_maps) | ||
969 | { | ||
970 | kfree(map); | ||
971 | } | ||
972 | |||
919 | static struct pinctrl_ops sirfsoc_pctrl_ops = { | 973 | static struct pinctrl_ops sirfsoc_pctrl_ops = { |
920 | .get_groups_count = sirfsoc_get_groups_count, | 974 | .get_groups_count = sirfsoc_get_groups_count, |
921 | .get_group_name = sirfsoc_get_group_name, | 975 | .get_group_name = sirfsoc_get_group_name, |
922 | .get_group_pins = sirfsoc_get_group_pins, | 976 | .get_group_pins = sirfsoc_get_group_pins, |
923 | .pin_dbg_show = sirfsoc_pin_dbg_show, | 977 | .pin_dbg_show = sirfsoc_pin_dbg_show, |
978 | .dt_node_to_map = sirfsoc_dt_node_to_map, | ||
979 | .dt_free_map = sirfsoc_dt_free_map, | ||
924 | }; | 980 | }; |
925 | 981 | ||
926 | struct sirfsoc_pmx_func { | 982 | struct sirfsoc_pmx_func { |
@@ -1221,7 +1277,7 @@ out_no_gpio_remap: | |||
1221 | } | 1277 | } |
1222 | 1278 | ||
1223 | static const struct of_device_id pinmux_ids[] __devinitconst = { | 1279 | static const struct of_device_id pinmux_ids[] __devinitconst = { |
1224 | { .compatible = "sirf,prima2-gpio-pinmux" }, | 1280 | { .compatible = "sirf,prima2-pinctrl" }, |
1225 | {} | 1281 | {} |
1226 | }; | 1282 | }; |
1227 | 1283 | ||
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 19241fc30050..82125269b667 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c | |||
@@ -162,6 +162,9 @@ static struct regulator_ops tps6586x_regulator_ops = { | |||
162 | .disable = tps6586x_regulator_disable, | 162 | .disable = tps6586x_regulator_disable, |
163 | }; | 163 | }; |
164 | 164 | ||
165 | static struct regulator_ops tps6586x_sys_regulator_ops = { | ||
166 | }; | ||
167 | |||
165 | static const unsigned int tps6586x_ldo0_voltages[] = { | 168 | static const unsigned int tps6586x_ldo0_voltages[] = { |
166 | 1200000, 1500000, 1800000, 2500000, 2700000, 2850000, 3100000, 3300000, | 169 | 1200000, 1500000, 1800000, 2500000, 2700000, 2850000, 3100000, 3300000, |
167 | }; | 170 | }; |
@@ -230,15 +233,28 @@ static const unsigned int tps6586x_dvm_voltages[] = { | |||
230 | TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \ | 233 | TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \ |
231 | } | 234 | } |
232 | 235 | ||
236 | #define TPS6586X_SYS_REGULATOR() \ | ||
237 | { \ | ||
238 | .desc = { \ | ||
239 | .supply_name = "sys", \ | ||
240 | .name = "REG-SYS", \ | ||
241 | .ops = &tps6586x_sys_regulator_ops, \ | ||
242 | .type = REGULATOR_VOLTAGE, \ | ||
243 | .id = TPS6586X_ID_SYS, \ | ||
244 | .owner = THIS_MODULE, \ | ||
245 | }, \ | ||
246 | } | ||
247 | |||
233 | static struct tps6586x_regulator tps6586x_regulator[] = { | 248 | static struct tps6586x_regulator tps6586x_regulator[] = { |
249 | TPS6586X_SYS_REGULATOR(), | ||
234 | TPS6586X_LDO(LDO_0, "vinldo01", ldo0, SUPPLYV1, 5, 3, ENC, 0, END, 0), | 250 | TPS6586X_LDO(LDO_0, "vinldo01", ldo0, SUPPLYV1, 5, 3, ENC, 0, END, 0), |
235 | TPS6586X_LDO(LDO_3, "vinldo23", ldo, SUPPLYV4, 0, 3, ENC, 2, END, 2), | 251 | TPS6586X_LDO(LDO_3, "vinldo23", ldo, SUPPLYV4, 0, 3, ENC, 2, END, 2), |
236 | TPS6586X_LDO(LDO_5, NULL, ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6), | 252 | TPS6586X_LDO(LDO_5, "REG-SYS", ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6), |
237 | TPS6586X_LDO(LDO_6, "vinldo678", ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4), | 253 | TPS6586X_LDO(LDO_6, "vinldo678", ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4), |
238 | TPS6586X_LDO(LDO_7, "vinldo678", ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5), | 254 | TPS6586X_LDO(LDO_7, "vinldo678", ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5), |
239 | TPS6586X_LDO(LDO_8, "vinldo678", ldo, SUPPLYV2, 5, 3, ENC, 6, END, 6), | 255 | TPS6586X_LDO(LDO_8, "vinldo678", ldo, SUPPLYV2, 5, 3, ENC, 6, END, 6), |
240 | TPS6586X_LDO(LDO_9, "vinldo9", ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7), | 256 | TPS6586X_LDO(LDO_9, "vinldo9", ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7), |
241 | TPS6586X_LDO(LDO_RTC, NULL, ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7), | 257 | TPS6586X_LDO(LDO_RTC, "REG-SYS", ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7), |
242 | TPS6586X_LDO(LDO_1, "vinldo01", dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1), | 258 | TPS6586X_LDO(LDO_1, "vinldo01", dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1), |
243 | TPS6586X_LDO(SM_2, "vin-sm2", sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7), | 259 | TPS6586X_LDO(SM_2, "vin-sm2", sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7), |
244 | 260 | ||
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c index a1f7ac1f8cf6..b54504ee61f1 100644 --- a/drivers/remoteproc/omap_remoteproc.c +++ b/drivers/remoteproc/omap_remoteproc.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/remoteproc.h> | 29 | #include <linux/remoteproc.h> |
30 | 30 | ||
31 | #include <plat/mailbox.h> | 31 | #include <plat/mailbox.h> |
32 | #include <plat/remoteproc.h> | 32 | #include <linux/platform_data/remoteproc-omap.h> |
33 | 33 | ||
34 | #include "omap_remoteproc.h" | 34 | #include "omap_remoteproc.h" |
35 | #include "remoteproc_internal.h" | 35 | #include "remoteproc_internal.h" |
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c index 0075c8fd93d8..f771b2ee4b18 100644 --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/of.h> | ||
31 | #include <linux/of_device.h> | ||
30 | 32 | ||
31 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
32 | 34 | ||
@@ -396,6 +398,14 @@ static int __exit pxa_rtc_remove(struct platform_device *pdev) | |||
396 | return 0; | 398 | return 0; |
397 | } | 399 | } |
398 | 400 | ||
401 | #ifdef CONFIG_OF | ||
402 | static struct of_device_id pxa_rtc_dt_ids[] = { | ||
403 | { .compatible = "marvell,pxa-rtc" }, | ||
404 | {} | ||
405 | }; | ||
406 | MODULE_DEVICE_TABLE(of, pxa_rtc_dt_ids); | ||
407 | #endif | ||
408 | |||
399 | #ifdef CONFIG_PM | 409 | #ifdef CONFIG_PM |
400 | static int pxa_rtc_suspend(struct device *dev) | 410 | static int pxa_rtc_suspend(struct device *dev) |
401 | { | 411 | { |
@@ -425,6 +435,7 @@ static struct platform_driver pxa_rtc_driver = { | |||
425 | .remove = __exit_p(pxa_rtc_remove), | 435 | .remove = __exit_p(pxa_rtc_remove), |
426 | .driver = { | 436 | .driver = { |
427 | .name = "pxa-rtc", | 437 | .name = "pxa-rtc", |
438 | .of_match_table = of_match_ptr(pxa_rtc_dt_ids), | ||
428 | #ifdef CONFIG_PM | 439 | #ifdef CONFIG_PM |
429 | .pm = &pxa_rtc_pm_ops, | 440 | .pm = &pxa_rtc_pm_ops, |
430 | #endif | 441 | #endif |
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c index edfd12b48c28..968d08358d20 100644 --- a/drivers/scsi/arm/eesox.c +++ b/drivers/scsi/arm/eesox.c | |||
@@ -273,7 +273,7 @@ static void eesoxscsi_buffer_out(void *buf, int length, void __iomem *base) | |||
273 | { | 273 | { |
274 | const void __iomem *reg_fas = base + EESOX_FAS216_OFFSET; | 274 | const void __iomem *reg_fas = base + EESOX_FAS216_OFFSET; |
275 | const void __iomem *reg_dmastat = base + EESOX_DMASTAT; | 275 | const void __iomem *reg_dmastat = base + EESOX_DMASTAT; |
276 | const void __iomem *reg_dmadata = base + EESOX_DMADATA; | 276 | void __iomem *reg_dmadata = base + EESOX_DMADATA; |
277 | 277 | ||
278 | do { | 278 | do { |
279 | unsigned int status; | 279 | unsigned int status; |
diff --git a/drivers/sh/pfc/gpio.c b/drivers/sh/pfc/gpio.c index 62bca98474a9..038fa071382a 100644 --- a/drivers/sh/pfc/gpio.c +++ b/drivers/sh/pfc/gpio.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/pinctrl/consumer.h> | 19 | #include <linux/pinctrl/consumer.h> |
20 | #include <linux/sh_pfc.h> | ||
20 | 21 | ||
21 | struct sh_pfc_chip { | 22 | struct sh_pfc_chip { |
22 | struct sh_pfc *pfc; | 23 | struct sh_pfc *pfc; |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 5f84b5563c2d..2d198a01a410 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -366,7 +366,7 @@ config SPI_STMP3XXX | |||
366 | 366 | ||
367 | config SPI_TEGRA | 367 | config SPI_TEGRA |
368 | tristate "Nvidia Tegra SPI controller" | 368 | tristate "Nvidia Tegra SPI controller" |
369 | depends on ARCH_TEGRA && (TEGRA_SYSTEM_DMA || TEGRA20_APB_DMA) | 369 | depends on ARCH_TEGRA && TEGRA20_APB_DMA |
370 | help | 370 | help |
371 | SPI driver for NVidia Tegra SoCs | 371 | SPI driver for NVidia Tegra SoCs |
372 | 372 | ||
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 9b2901feaf78..3afe2f4f5b8e 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/spi/spi_bitbang.h> | 30 | #include <linux/spi/spi_bitbang.h> |
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | 32 | ||
33 | #include <mach/spi.h> | 33 | #include <linux/platform_data/spi-davinci.h> |
34 | #include <mach/edma.h> | 34 | #include <mach/edma.h> |
35 | 35 | ||
36 | #define SPI_NO_RESOURCE ((resource_size_t)-1) | 36 | #define SPI_NO_RESOURCE ((resource_size_t)-1) |
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index f97f1d248800..3a219599612a 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c | |||
@@ -31,8 +31,8 @@ | |||
31 | #include <linux/scatterlist.h> | 31 | #include <linux/scatterlist.h> |
32 | #include <linux/spi/spi.h> | 32 | #include <linux/spi/spi.h> |
33 | 33 | ||
34 | #include <mach/dma.h> | 34 | #include <linux/platform_data/dma-ep93xx.h> |
35 | #include <mach/ep93xx_spi.h> | 35 | #include <linux/platform_data/spi-ep93xx.h> |
36 | 36 | ||
37 | #define SSPCR0 0x0000 | 37 | #define SSPCR0 0x0000 |
38 | #define SSPCR0_MODE_SHIFT 6 | 38 | #define SSPCR0_MODE_SHIFT 6 |
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index e834ff8c0188..63e7fc9801cd 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/of_gpio.h> | 39 | #include <linux/of_gpio.h> |
40 | #include <linux/pinctrl/consumer.h> | 40 | #include <linux/pinctrl/consumer.h> |
41 | 41 | ||
42 | #include <mach/spi.h> | 42 | #include <linux/platform_data/spi-imx.h> |
43 | 43 | ||
44 | #define DRIVER_NAME "spi_imx" | 44 | #define DRIVER_NAME "spi_imx" |
45 | 45 | ||
diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c index dae8be229c5d..a6eca6ffdabe 100644 --- a/drivers/spi/spi-nuc900.c +++ b/drivers/spi/spi-nuc900.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/spi/spi.h> | 26 | #include <linux/spi/spi.h> |
27 | #include <linux/spi/spi_bitbang.h> | 27 | #include <linux/spi/spi_bitbang.h> |
28 | 28 | ||
29 | #include <mach/nuc900_spi.h> | 29 | #include <linux/platform_data/spi-nuc900.h> |
30 | 30 | ||
31 | /* usi registers offset */ | 31 | /* usi registers offset */ |
32 | #define USI_CNT 0x00 | 32 | #define USI_CNT 0x00 |
diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c index a3996a1c6345..0a94d9dc9c31 100644 --- a/drivers/spi/spi-omap-uwire.c +++ b/drivers/spi/spi-omap-uwire.c | |||
@@ -52,7 +52,7 @@ | |||
52 | #include <asm/io.h> | 52 | #include <asm/io.h> |
53 | #include <asm/mach-types.h> | 53 | #include <asm/mach-types.h> |
54 | 54 | ||
55 | #include <plat/mux.h> | 55 | #include <mach/mux.h> |
56 | 56 | ||
57 | #include <mach/omap7xx.h> /* OMAP7XX_IO_CONF registers */ | 57 | #include <mach/omap7xx.h> /* OMAP7XX_IO_CONF registers */ |
58 | 58 | ||
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index b5d6994c8ba3..d3d62f1e894c 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | #include <linux/spi/spi.h> | 42 | #include <linux/spi/spi.h> |
43 | 43 | ||
44 | #include <plat/mcspi.h> | 44 | #include <linux/platform_data/spi-omap2-mcspi.h> |
45 | 45 | ||
46 | #define OMAP2_MCSPI_MAX_FREQ 48000000 | 46 | #define OMAP2_MCSPI_MAX_FREQ 48000000 |
47 | #define SPI_AUTOSUSPEND_TIMEOUT 2000 | 47 | #define SPI_AUTOSUSPEND_TIMEOUT 2000 |
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index d1c8441f638c..0e2a02228d5e 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <linux/of_gpio.h> | 32 | #include <linux/of_gpio.h> |
33 | 33 | ||
34 | #include <mach/dma.h> | 34 | #include <mach/dma.h> |
35 | #include <plat/s3c64xx-spi.h> | 35 | #include <linux/platform_data/spi-s3c64xx.h> |
36 | 36 | ||
37 | #define MAX_SPI_PORTS 3 | 37 | #define MAX_SPI_PORTS 3 |
38 | 38 | ||
diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c index ef52c1c6f5c5..488d9b6e9cbe 100644 --- a/drivers/spi/spi-tegra.c +++ b/drivers/spi/spi-tegra.c | |||
@@ -164,23 +164,15 @@ struct spi_tegra_data { | |||
164 | * for the generic case. | 164 | * for the generic case. |
165 | */ | 165 | */ |
166 | int dma_req_len; | 166 | int dma_req_len; |
167 | #if defined(CONFIG_TEGRA_SYSTEM_DMA) | ||
168 | struct tegra_dma_req rx_dma_req; | ||
169 | struct tegra_dma_channel *rx_dma; | ||
170 | #else | ||
171 | struct dma_chan *rx_dma; | 167 | struct dma_chan *rx_dma; |
172 | struct dma_slave_config sconfig; | 168 | struct dma_slave_config sconfig; |
173 | struct dma_async_tx_descriptor *rx_dma_desc; | 169 | struct dma_async_tx_descriptor *rx_dma_desc; |
174 | dma_cookie_t rx_cookie; | 170 | dma_cookie_t rx_cookie; |
175 | #endif | ||
176 | u32 *rx_bb; | 171 | u32 *rx_bb; |
177 | dma_addr_t rx_bb_phys; | 172 | dma_addr_t rx_bb_phys; |
178 | }; | 173 | }; |
179 | 174 | ||
180 | #if !defined(CONFIG_TEGRA_SYSTEM_DMA) | ||
181 | static void tegra_spi_rx_dma_complete(void *args); | 175 | static void tegra_spi_rx_dma_complete(void *args); |
182 | #endif | ||
183 | |||
184 | static inline unsigned long spi_tegra_readl(struct spi_tegra_data *tspi, | 176 | static inline unsigned long spi_tegra_readl(struct spi_tegra_data *tspi, |
185 | unsigned long reg) | 177 | unsigned long reg) |
186 | { | 178 | { |
@@ -204,10 +196,6 @@ static void spi_tegra_go(struct spi_tegra_data *tspi) | |||
204 | val &= ~SLINK_DMA_BLOCK_SIZE(~0) & ~SLINK_DMA_EN; | 196 | val &= ~SLINK_DMA_BLOCK_SIZE(~0) & ~SLINK_DMA_EN; |
205 | val |= SLINK_DMA_BLOCK_SIZE(tspi->dma_req_len / 4 - 1); | 197 | val |= SLINK_DMA_BLOCK_SIZE(tspi->dma_req_len / 4 - 1); |
206 | spi_tegra_writel(tspi, val, SLINK_DMA_CTL); | 198 | spi_tegra_writel(tspi, val, SLINK_DMA_CTL); |
207 | #if defined(CONFIG_TEGRA_SYSTEM_DMA) | ||
208 | tspi->rx_dma_req.size = tspi->dma_req_len; | ||
209 | tegra_dma_enqueue_req(tspi->rx_dma, &tspi->rx_dma_req); | ||
210 | #else | ||
211 | tspi->rx_dma_desc = dmaengine_prep_slave_single(tspi->rx_dma, | 199 | tspi->rx_dma_desc = dmaengine_prep_slave_single(tspi->rx_dma, |
212 | tspi->rx_bb_phys, tspi->dma_req_len, | 200 | tspi->rx_bb_phys, tspi->dma_req_len, |
213 | DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT); | 201 | DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT); |
@@ -219,7 +207,6 @@ static void spi_tegra_go(struct spi_tegra_data *tspi) | |||
219 | tspi->rx_dma_desc->callback_param = tspi; | 207 | tspi->rx_dma_desc->callback_param = tspi; |
220 | tspi->rx_cookie = dmaengine_submit(tspi->rx_dma_desc); | 208 | tspi->rx_cookie = dmaengine_submit(tspi->rx_dma_desc); |
221 | dma_async_issue_pending(tspi->rx_dma); | 209 | dma_async_issue_pending(tspi->rx_dma); |
222 | #endif | ||
223 | 210 | ||
224 | val |= SLINK_DMA_EN; | 211 | val |= SLINK_DMA_EN; |
225 | spi_tegra_writel(tspi, val, SLINK_DMA_CTL); | 212 | spi_tegra_writel(tspi, val, SLINK_DMA_CTL); |
@@ -405,19 +392,12 @@ static void handle_spi_rx_dma_complete(struct spi_tegra_data *tspi) | |||
405 | 392 | ||
406 | spin_unlock_irqrestore(&tspi->lock, flags); | 393 | spin_unlock_irqrestore(&tspi->lock, flags); |
407 | } | 394 | } |
408 | #if defined(CONFIG_TEGRA_SYSTEM_DMA) | 395 | |
409 | static void tegra_spi_rx_dma_complete(struct tegra_dma_req *req) | ||
410 | { | ||
411 | struct spi_tegra_data *tspi = req->dev; | ||
412 | handle_spi_rx_dma_complete(tspi); | ||
413 | } | ||
414 | #else | ||
415 | static void tegra_spi_rx_dma_complete(void *args) | 396 | static void tegra_spi_rx_dma_complete(void *args) |
416 | { | 397 | { |
417 | struct spi_tegra_data *tspi = args; | 398 | struct spi_tegra_data *tspi = args; |
418 | handle_spi_rx_dma_complete(tspi); | 399 | handle_spi_rx_dma_complete(tspi); |
419 | } | 400 | } |
420 | #endif | ||
421 | 401 | ||
422 | static int spi_tegra_setup(struct spi_device *spi) | 402 | static int spi_tegra_setup(struct spi_device *spi) |
423 | { | 403 | { |
@@ -509,9 +489,7 @@ static int __devinit spi_tegra_probe(struct platform_device *pdev) | |||
509 | struct spi_tegra_data *tspi; | 489 | struct spi_tegra_data *tspi; |
510 | struct resource *r; | 490 | struct resource *r; |
511 | int ret; | 491 | int ret; |
512 | #if !defined(CONFIG_TEGRA_SYSTEM_DMA) | ||
513 | dma_cap_mask_t mask; | 492 | dma_cap_mask_t mask; |
514 | #endif | ||
515 | 493 | ||
516 | master = spi_alloc_master(&pdev->dev, sizeof *tspi); | 494 | master = spi_alloc_master(&pdev->dev, sizeof *tspi); |
517 | if (master == NULL) { | 495 | if (master == NULL) { |
@@ -563,14 +541,6 @@ static int __devinit spi_tegra_probe(struct platform_device *pdev) | |||
563 | 541 | ||
564 | INIT_LIST_HEAD(&tspi->queue); | 542 | INIT_LIST_HEAD(&tspi->queue); |
565 | 543 | ||
566 | #if defined(CONFIG_TEGRA_SYSTEM_DMA) | ||
567 | tspi->rx_dma = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT); | ||
568 | if (!tspi->rx_dma) { | ||
569 | dev_err(&pdev->dev, "can not allocate rx dma channel\n"); | ||
570 | ret = -ENODEV; | ||
571 | goto err3; | ||
572 | } | ||
573 | #else | ||
574 | dma_cap_zero(mask); | 544 | dma_cap_zero(mask); |
575 | dma_cap_set(DMA_SLAVE, mask); | 545 | dma_cap_set(DMA_SLAVE, mask); |
576 | tspi->rx_dma = dma_request_channel(mask, NULL, NULL); | 546 | tspi->rx_dma = dma_request_channel(mask, NULL, NULL); |
@@ -580,8 +550,6 @@ static int __devinit spi_tegra_probe(struct platform_device *pdev) | |||
580 | goto err3; | 550 | goto err3; |
581 | } | 551 | } |
582 | 552 | ||
583 | #endif | ||
584 | |||
585 | tspi->rx_bb = dma_alloc_coherent(&pdev->dev, sizeof(u32) * BB_LEN, | 553 | tspi->rx_bb = dma_alloc_coherent(&pdev->dev, sizeof(u32) * BB_LEN, |
586 | &tspi->rx_bb_phys, GFP_KERNEL); | 554 | &tspi->rx_bb_phys, GFP_KERNEL); |
587 | if (!tspi->rx_bb) { | 555 | if (!tspi->rx_bb) { |
@@ -590,17 +558,6 @@ static int __devinit spi_tegra_probe(struct platform_device *pdev) | |||
590 | goto err4; | 558 | goto err4; |
591 | } | 559 | } |
592 | 560 | ||
593 | #if defined(CONFIG_TEGRA_SYSTEM_DMA) | ||
594 | tspi->rx_dma_req.complete = tegra_spi_rx_dma_complete; | ||
595 | tspi->rx_dma_req.to_memory = 1; | ||
596 | tspi->rx_dma_req.dest_addr = tspi->rx_bb_phys; | ||
597 | tspi->rx_dma_req.dest_bus_width = 32; | ||
598 | tspi->rx_dma_req.source_addr = tspi->phys + SLINK_RX_FIFO; | ||
599 | tspi->rx_dma_req.source_bus_width = 32; | ||
600 | tspi->rx_dma_req.source_wrap = 4; | ||
601 | tspi->rx_dma_req.req_sel = spi_tegra_req_sels[pdev->id]; | ||
602 | tspi->rx_dma_req.dev = tspi; | ||
603 | #else | ||
604 | /* Dmaengine Dma slave config */ | 561 | /* Dmaengine Dma slave config */ |
605 | tspi->sconfig.src_addr = tspi->phys + SLINK_RX_FIFO; | 562 | tspi->sconfig.src_addr = tspi->phys + SLINK_RX_FIFO; |
606 | tspi->sconfig.dst_addr = tspi->phys + SLINK_RX_FIFO; | 563 | tspi->sconfig.dst_addr = tspi->phys + SLINK_RX_FIFO; |
@@ -616,7 +573,6 @@ static int __devinit spi_tegra_probe(struct platform_device *pdev) | |||
616 | ret); | 573 | ret); |
617 | goto err4; | 574 | goto err4; |
618 | } | 575 | } |
619 | #endif | ||
620 | 576 | ||
621 | master->dev.of_node = pdev->dev.of_node; | 577 | master->dev.of_node = pdev->dev.of_node; |
622 | ret = spi_register_master(master); | 578 | ret = spi_register_master(master); |
@@ -630,11 +586,7 @@ err5: | |||
630 | dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN, | 586 | dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN, |
631 | tspi->rx_bb, tspi->rx_bb_phys); | 587 | tspi->rx_bb, tspi->rx_bb_phys); |
632 | err4: | 588 | err4: |
633 | #if defined(CONFIG_TEGRA_SYSTEM_DMA) | ||
634 | tegra_dma_free_channel(tspi->rx_dma); | ||
635 | #else | ||
636 | dma_release_channel(tspi->rx_dma); | 589 | dma_release_channel(tspi->rx_dma); |
637 | #endif | ||
638 | err3: | 590 | err3: |
639 | clk_put(tspi->clk); | 591 | clk_put(tspi->clk); |
640 | err2: | 592 | err2: |
@@ -656,12 +608,7 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev) | |||
656 | tspi = spi_master_get_devdata(master); | 608 | tspi = spi_master_get_devdata(master); |
657 | 609 | ||
658 | spi_unregister_master(master); | 610 | spi_unregister_master(master); |
659 | #if defined(CONFIG_TEGRA_SYSTEM_DMA) | ||
660 | tegra_dma_free_channel(tspi->rx_dma); | ||
661 | #else | ||
662 | dma_release_channel(tspi->rx_dma); | 611 | dma_release_channel(tspi->rx_dma); |
663 | #endif | ||
664 | |||
665 | dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN, | 612 | dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN, |
666 | tspi->rx_bb, tspi->rx_bb_phys); | 613 | tspi->rx_bb, tspi->rx_bb_phys); |
667 | 614 | ||
diff --git a/drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c b/drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c index a272e488e5b9..47439c3f7258 100644 --- a/drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c +++ b/drivers/staging/ste_rmi4/board-mop500-u8500uib-rmi4.c | |||
@@ -5,7 +5,6 @@ | |||
5 | #include <linux/i2c.h> | 5 | #include <linux/i2c.h> |
6 | #include <linux/gpio.h> | 6 | #include <linux/gpio.h> |
7 | #include <linux/interrupt.h> | 7 | #include <linux/interrupt.h> |
8 | #include <mach/gpio.h> | ||
9 | #include <mach/irqs.h> | 8 | #include <mach/irqs.h> |
10 | #include "synaptics_i2c_rmi4.h" | 9 | #include "synaptics_i2c_rmi4.h" |
11 | 10 | ||
diff --git a/drivers/staging/tidspbridge/core/dsp-clock.c b/drivers/staging/tidspbridge/core/dsp-clock.c index c7df34e6b60b..7d056bd1eaad 100644 --- a/drivers/staging/tidspbridge/core/dsp-clock.c +++ b/drivers/staging/tidspbridge/core/dsp-clock.c | |||
@@ -21,7 +21,7 @@ | |||
21 | /* ----------------------------------- Host OS */ | 21 | /* ----------------------------------- Host OS */ |
22 | #include <dspbridge/host_os.h> | 22 | #include <dspbridge/host_os.h> |
23 | #include <plat/dmtimer.h> | 23 | #include <plat/dmtimer.h> |
24 | #include <plat/mcbsp.h> | 24 | #include <linux/platform_data/asoc-ti-mcbsp.h> |
25 | 25 | ||
26 | /* ----------------------------------- DSP/BIOS Bridge */ | 26 | /* ----------------------------------- DSP/BIOS Bridge */ |
27 | #include <dspbridge/dbdefs.h> | 27 | #include <dspbridge/dbdefs.h> |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index f9609ce2c163..7bf55c40944e 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 16 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <plat/dsp.h> | 19 | #include <linux/platform_data/dsp-omap.h> |
20 | 20 | ||
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | /* ----------------------------------- Host OS */ | 22 | /* ----------------------------------- Host OS */ |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430_pwr.c b/drivers/staging/tidspbridge/core/tiomap3430_pwr.c index 16a4aafa86ae..55675b7b9b66 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430_pwr.c +++ b/drivers/staging/tidspbridge/core/tiomap3430_pwr.c | |||
@@ -19,7 +19,7 @@ | |||
19 | /* ----------------------------------- Host OS */ | 19 | /* ----------------------------------- Host OS */ |
20 | #include <dspbridge/host_os.h> | 20 | #include <dspbridge/host_os.h> |
21 | 21 | ||
22 | #include <plat/dsp.h> | 22 | #include <linux/platform_data/dsp-omap.h> |
23 | 23 | ||
24 | /* ----------------------------------- DSP/BIOS Bridge */ | 24 | /* ----------------------------------- DSP/BIOS Bridge */ |
25 | #include <dspbridge/dbdefs.h> | 25 | #include <dspbridge/dbdefs.h> |
diff --git a/drivers/staging/tidspbridge/core/tiomap_io.c b/drivers/staging/tidspbridge/core/tiomap_io.c index 7fda10c36862..f53ed98d18c1 100644 --- a/drivers/staging/tidspbridge/core/tiomap_io.c +++ b/drivers/staging/tidspbridge/core/tiomap_io.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 16 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <plat/dsp.h> | 19 | #include <linux/platform_data/dsp-omap.h> |
20 | 20 | ||
21 | /* ----------------------------------- DSP/BIOS Bridge */ | 21 | /* ----------------------------------- DSP/BIOS Bridge */ |
22 | #include <dspbridge/dbdefs.h> | 22 | #include <dspbridge/dbdefs.h> |
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c index 3cac01492063..49c9b662392f 100644 --- a/drivers/staging/tidspbridge/rmgr/drv_interface.c +++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 16 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <plat/dsp.h> | 19 | #include <linux/platform_data/dsp-omap.h> |
20 | 20 | ||
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 5952b25c288e..2a093a42512f 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -51,7 +51,7 @@ | |||
51 | 51 | ||
52 | #include <asm/io.h> | 52 | #include <asm/io.h> |
53 | #include <asm/irq.h> | 53 | #include <asm/irq.h> |
54 | #include <mach/imx-uart.h> | 54 | #include <linux/platform_data/serial-imx.h> |
55 | 55 | ||
56 | /* Register definitions */ | 56 | /* Register definitions */ |
57 | #define URXD0 0x0 /* Receiver Register */ | 57 | #define URXD0 0x0 /* Receiver Register */ |
diff --git a/drivers/tty/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c index 7c13639c597e..9bd004f9da89 100644 --- a/drivers/tty/serial/serial_ks8695.c +++ b/drivers/tty/serial/serial_ks8695.c | |||
@@ -548,8 +548,8 @@ static struct uart_ops ks8695uart_pops = { | |||
548 | 548 | ||
549 | static struct uart_port ks8695uart_ports[SERIAL_KS8695_NR] = { | 549 | static struct uart_port ks8695uart_ports[SERIAL_KS8695_NR] = { |
550 | { | 550 | { |
551 | .membase = (void *) KS8695_UART_VA, | 551 | .membase = KS8695_UART_VA, |
552 | .mapbase = KS8695_UART_VA, | 552 | .mapbase = KS8695_UART_PA, |
553 | .iotype = SERIAL_IO_MEM, | 553 | .iotype = SERIAL_IO_MEM, |
554 | .irq = KS8695_IRQ_UART_TX, | 554 | .irq = KS8695_IRQ_UART_TX, |
555 | .uartclk = KS8695_CLOCK_RATE * 16, | 555 | .uartclk = KS8695_CLOCK_RATE * 16, |
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 7065df6036ca..7de2285d9fa9 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -13,7 +13,6 @@ config USB_ARCH_HAS_OHCI | |||
13 | default y if PXA3xx | 13 | default y if PXA3xx |
14 | default y if ARCH_EP93XX | 14 | default y if ARCH_EP93XX |
15 | default y if ARCH_AT91 | 15 | default y if ARCH_AT91 |
16 | default y if ARCH_PNX4008 | ||
17 | default y if MFD_TC6393XB | 16 | default y if MFD_TC6393XB |
18 | default y if ARCH_W90X900 | 17 | default y if ARCH_W90X900 |
19 | default y if ARCH_DAVINCI_DA8XX | 18 | default y if ARCH_DAVINCI_DA8XX |
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c index dc5334856afe..a0eb85794fd4 100644 --- a/drivers/usb/gadget/imx_udc.c +++ b/drivers/usb/gadget/imx_udc.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/usb/ch9.h> | 35 | #include <linux/usb/ch9.h> |
36 | #include <linux/usb/gadget.h> | 36 | #include <linux/usb/gadget.h> |
37 | 37 | ||
38 | #include <mach/usb.h> | 38 | #include <linux/platform_data/usb-imx_udc.h> |
39 | #include <mach/hardware.h> | 39 | #include <mach/hardware.h> |
40 | 40 | ||
41 | #include "imx_udc.h" | 41 | #include "imx_udc.h" |
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 644b4305cb99..7a8713cda945 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -2508,7 +2508,7 @@ static int __init pxa_udc_probe(struct platform_device *pdev) | |||
2508 | IRQF_SHARED, driver_name, udc); | 2508 | IRQF_SHARED, driver_name, udc); |
2509 | if (retval != 0) { | 2509 | if (retval != 0) { |
2510 | dev_err(udc->dev, "%s: can't get irq %i, err %d\n", | 2510 | dev_err(udc->dev, "%s: can't get irq %i, err %d\n", |
2511 | driver_name, IRQ_USB, retval); | 2511 | driver_name, udc->irq, retval); |
2512 | goto err_irq; | 2512 | goto err_irq; |
2513 | } | 2513 | } |
2514 | retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget); | 2514 | retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget); |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index f2e51f50e528..f006045fc44c 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include <mach/hardware.h> | 43 | #include <mach/hardware.h> |
44 | 44 | ||
45 | #include <plat/regs-udc.h> | 45 | #include <plat/regs-udc.h> |
46 | #include <plat/udc.h> | 46 | #include <linux/platform_data/usb-s3c2410_udc.h> |
47 | 47 | ||
48 | 48 | ||
49 | #include "s3c2410_udc.h" | 49 | #include "s3c2410_udc.h" |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 075d2eca8108..276add2358a1 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -292,7 +292,7 @@ config USB_OHCI_HCD | |||
292 | depends on USB && USB_ARCH_HAS_OHCI | 292 | depends on USB && USB_ARCH_HAS_OHCI |
293 | select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 | 293 | select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 |
294 | select USB_OTG_UTILS if ARCH_OMAP | 294 | select USB_OTG_UTILS if ARCH_OMAP |
295 | select USB_ISP1301 if ARCH_LPC32XX || ARCH_PNX4008 | 295 | select USB_ISP1301 if ARCH_LPC32XX |
296 | ---help--- | 296 | ---help--- |
297 | The Open Host Controller Interface (OHCI) is a standard for accessing | 297 | The Open Host Controller Interface (OHCI) is a standard for accessing |
298 | USB 1.1 host controller hardware. It does more in hardware than Intel's | 298 | USB 1.1 host controller hardware. It does more in hardware than Intel's |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index 34201372c85f..a6e2ea4ef8fd 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | 26 | ||
27 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
28 | #include <mach/mxc_ehci.h> | 28 | #include <linux/platform_data/usb-ehci-mxc.h> |
29 | 29 | ||
30 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
31 | 31 | ||
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 8892d3642cef..8e7eca62f169 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/mbus.h> | 14 | #include <linux/mbus.h> |
15 | #include <linux/clk.h> | 15 | #include <linux/clk.h> |
16 | #include <plat/ehci-orion.h> | 16 | #include <linux/platform_data/usb-ehci-orion.h> |
17 | 17 | ||
18 | #define rdl(off) __raw_readl(hcd->regs + (off)) | 18 | #define rdl(off) __raw_readl(hcd->regs + (off)) |
19 | #define wrl(off, val) __raw_writel((val), hcd->regs + (off)) | 19 | #define wrl(off, val) __raw_writel((val), hcd->regs + (off)) |
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index 9d8f1dd57cb3..dfb14c7a61e2 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/of.h> | 16 | #include <linux/of.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/of_gpio.h> | 18 | #include <linux/of_gpio.h> |
19 | #include <plat/ehci.h> | 19 | #include <linux/platform_data/usb-ehci-s5p.h> |
20 | #include <plat/usb-phy.h> | 20 | #include <plat/usb-phy.h> |
21 | 21 | ||
22 | #define EHCI_INSNREG00(base) (base + 0x90) | 22 | #define EHCI_INSNREG00(base) (base + 0x90) |
diff --git a/drivers/usb/host/imx21-hcd.h b/drivers/usb/host/imx21-hcd.h index 87b29fd971b4..c005770a73e9 100644 --- a/drivers/usb/host/imx21-hcd.h +++ b/drivers/usb/host/imx21-hcd.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #ifndef __LINUX_IMX21_HCD_H__ | 24 | #ifndef __LINUX_IMX21_HCD_H__ |
25 | #define __LINUX_IMX21_HCD_H__ | 25 | #define __LINUX_IMX21_HCD_H__ |
26 | 26 | ||
27 | #include <mach/mx21-usbhost.h> | 27 | #include <linux/platform_data/usb-mx2.h> |
28 | 28 | ||
29 | #define NUM_ISO_ETDS 2 | 29 | #define NUM_ISO_ETDS 2 |
30 | #define USB_NUM_ETD 32 | 30 | #define USB_NUM_ETD 32 |
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 269b1e0f7691..0b815a856811 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | 18 | ||
19 | #include <mach/da8xx.h> | 19 | #include <mach/da8xx.h> |
20 | #include <mach/usb.h> | 20 | #include <linux/platform_data/usb-davinci.h> |
21 | 21 | ||
22 | #ifndef CONFIG_ARCH_DAVINCI_DA8XX | 22 | #ifndef CONFIG_ARCH_DAVINCI_DA8XX |
23 | #error "This file is DA8xx bus glue. Define CONFIG_ARCH_DAVINCI_DA8XX." | 23 | #error "This file is DA8xx bus glue. Define CONFIG_ARCH_DAVINCI_DA8XX." |
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index fc3091bd2379..20a50081f922 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <mach/ohci.h> | 17 | #include <linux/platform_data/usb-exynos.h> |
18 | #include <plat/usb-phy.h> | 18 | #include <plat/usb-phy.h> |
19 | 19 | ||
20 | struct exynos_ohci_hcd { | 20 | struct exynos_ohci_hcd { |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 2b1e8d84c873..6780010e9c3c 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -1049,7 +1049,7 @@ MODULE_LICENSE ("GPL"); | |||
1049 | #define PLATFORM_DRIVER ohci_hcd_at91_driver | 1049 | #define PLATFORM_DRIVER ohci_hcd_at91_driver |
1050 | #endif | 1050 | #endif |
1051 | 1051 | ||
1052 | #if defined(CONFIG_ARCH_PNX4008) || defined(CONFIG_ARCH_LPC32XX) | 1052 | #ifdef CONFIG_ARCH_LPC32XX |
1053 | #include "ohci-nxp.c" | 1053 | #include "ohci-nxp.c" |
1054 | #define PLATFORM_DRIVER usb_hcd_nxp_driver | 1054 | #define PLATFORM_DRIVER usb_hcd_nxp_driver |
1055 | #endif | 1055 | #endif |
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index a446386bf779..119966603d8d 100644 --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * driver for NXP USB Host devices | 2 | * driver for NXP USB Host devices |
3 | * | 3 | * |
4 | * Currently supported OHCI host devices: | 4 | * Currently supported OHCI host devices: |
5 | * - Philips PNX4008 | ||
6 | * - NXP LPC32xx | 5 | * - NXP LPC32xx |
7 | * | 6 | * |
8 | * Authors: Dmitry Chigirev <source@mvista.com> | 7 | * Authors: Dmitry Chigirev <source@mvista.com> |
@@ -66,38 +65,6 @@ static struct clk *usb_pll_clk; | |||
66 | static struct clk *usb_dev_clk; | 65 | static struct clk *usb_dev_clk; |
67 | static struct clk *usb_otg_clk; | 66 | static struct clk *usb_otg_clk; |
68 | 67 | ||
69 | static void isp1301_configure_pnx4008(void) | ||
70 | { | ||
71 | /* PNX4008 only supports DAT_SE0 USB mode */ | ||
72 | /* PNX4008 R2A requires setting the MAX603 to output 3.6V */ | ||
73 | /* Power up externel charge-pump */ | ||
74 | |||
75 | i2c_smbus_write_byte_data(isp1301_i2c_client, | ||
76 | ISP1301_I2C_MODE_CONTROL_1, MC1_DAT_SE0 | MC1_SPEED_REG); | ||
77 | i2c_smbus_write_byte_data(isp1301_i2c_client, | ||
78 | ISP1301_I2C_MODE_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR, | ||
79 | ~(MC1_DAT_SE0 | MC1_SPEED_REG)); | ||
80 | i2c_smbus_write_byte_data(isp1301_i2c_client, | ||
81 | ISP1301_I2C_MODE_CONTROL_2, | ||
82 | MC2_BI_DI | MC2_PSW_EN | MC2_SPD_SUSP_CTRL); | ||
83 | i2c_smbus_write_byte_data(isp1301_i2c_client, | ||
84 | ISP1301_I2C_MODE_CONTROL_2 | ISP1301_I2C_REG_CLEAR_ADDR, | ||
85 | ~(MC2_BI_DI | MC2_PSW_EN | MC2_SPD_SUSP_CTRL)); | ||
86 | i2c_smbus_write_byte_data(isp1301_i2c_client, | ||
87 | ISP1301_I2C_OTG_CONTROL_1, OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN); | ||
88 | i2c_smbus_write_byte_data(isp1301_i2c_client, | ||
89 | ISP1301_I2C_OTG_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR, | ||
90 | ~(OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN)); | ||
91 | i2c_smbus_write_byte_data(isp1301_i2c_client, | ||
92 | ISP1301_I2C_INTERRUPT_LATCH | ISP1301_I2C_REG_CLEAR_ADDR, 0xFF); | ||
93 | i2c_smbus_write_byte_data(isp1301_i2c_client, | ||
94 | ISP1301_I2C_INTERRUPT_FALLING | ISP1301_I2C_REG_CLEAR_ADDR, | ||
95 | 0xFF); | ||
96 | i2c_smbus_write_byte_data(isp1301_i2c_client, | ||
97 | ISP1301_I2C_INTERRUPT_RISING | ISP1301_I2C_REG_CLEAR_ADDR, | ||
98 | 0xFF); | ||
99 | } | ||
100 | |||
101 | static void isp1301_configure_lpc32xx(void) | 68 | static void isp1301_configure_lpc32xx(void) |
102 | { | 69 | { |
103 | /* LPC32XX only supports DAT_SE0 USB mode */ | 70 | /* LPC32XX only supports DAT_SE0 USB mode */ |
@@ -149,10 +116,7 @@ static void isp1301_configure_lpc32xx(void) | |||
149 | 116 | ||
150 | static void isp1301_configure(void) | 117 | static void isp1301_configure(void) |
151 | { | 118 | { |
152 | if (machine_is_pnx4008()) | 119 | isp1301_configure_lpc32xx(); |
153 | isp1301_configure_pnx4008(); | ||
154 | else | ||
155 | isp1301_configure_lpc32xx(); | ||
156 | } | 120 | } |
157 | 121 | ||
158 | static inline void isp1301_vbus_on(void) | 122 | static inline void isp1301_vbus_on(void) |
@@ -241,47 +205,6 @@ static const struct hc_driver ohci_nxp_hc_driver = { | |||
241 | .start_port_reset = ohci_start_port_reset, | 205 | .start_port_reset = ohci_start_port_reset, |
242 | }; | 206 | }; |
243 | 207 | ||
244 | static void nxp_set_usb_bits(void) | ||
245 | { | ||
246 | if (machine_is_pnx4008()) { | ||
247 | start_int_set_falling_edge(SE_USB_OTG_ATX_INT_N); | ||
248 | start_int_ack(SE_USB_OTG_ATX_INT_N); | ||
249 | start_int_umask(SE_USB_OTG_ATX_INT_N); | ||
250 | |||
251 | start_int_set_rising_edge(SE_USB_OTG_TIMER_INT); | ||
252 | start_int_ack(SE_USB_OTG_TIMER_INT); | ||
253 | start_int_umask(SE_USB_OTG_TIMER_INT); | ||
254 | |||
255 | start_int_set_rising_edge(SE_USB_I2C_INT); | ||
256 | start_int_ack(SE_USB_I2C_INT); | ||
257 | start_int_umask(SE_USB_I2C_INT); | ||
258 | |||
259 | start_int_set_rising_edge(SE_USB_INT); | ||
260 | start_int_ack(SE_USB_INT); | ||
261 | start_int_umask(SE_USB_INT); | ||
262 | |||
263 | start_int_set_rising_edge(SE_USB_NEED_CLK_INT); | ||
264 | start_int_ack(SE_USB_NEED_CLK_INT); | ||
265 | start_int_umask(SE_USB_NEED_CLK_INT); | ||
266 | |||
267 | start_int_set_rising_edge(SE_USB_AHB_NEED_CLK_INT); | ||
268 | start_int_ack(SE_USB_AHB_NEED_CLK_INT); | ||
269 | start_int_umask(SE_USB_AHB_NEED_CLK_INT); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | static void nxp_unset_usb_bits(void) | ||
274 | { | ||
275 | if (machine_is_pnx4008()) { | ||
276 | start_int_mask(SE_USB_OTG_ATX_INT_N); | ||
277 | start_int_mask(SE_USB_OTG_TIMER_INT); | ||
278 | start_int_mask(SE_USB_I2C_INT); | ||
279 | start_int_mask(SE_USB_INT); | ||
280 | start_int_mask(SE_USB_NEED_CLK_INT); | ||
281 | start_int_mask(SE_USB_AHB_NEED_CLK_INT); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev) | 208 | static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev) |
286 | { | 209 | { |
287 | struct usb_hcd *hcd = 0; | 210 | struct usb_hcd *hcd = 0; |
@@ -376,9 +299,6 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev) | |||
376 | goto out8; | 299 | goto out8; |
377 | } | 300 | } |
378 | 301 | ||
379 | /* Set all USB bits in the Start Enable register */ | ||
380 | nxp_set_usb_bits(); | ||
381 | |||
382 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 302 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
383 | if (!res) { | 303 | if (!res) { |
384 | dev_err(&pdev->dev, "Failed to get MEM resource\n"); | 304 | dev_err(&pdev->dev, "Failed to get MEM resource\n"); |
@@ -413,7 +333,6 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev) | |||
413 | 333 | ||
414 | nxp_stop_hc(); | 334 | nxp_stop_hc(); |
415 | out8: | 335 | out8: |
416 | nxp_unset_usb_bits(); | ||
417 | usb_put_hcd(hcd); | 336 | usb_put_hcd(hcd); |
418 | out7: | 337 | out7: |
419 | clk_disable(usb_otg_clk); | 338 | clk_disable(usb_otg_clk); |
@@ -441,7 +360,6 @@ static int usb_hcd_nxp_remove(struct platform_device *pdev) | |||
441 | nxp_stop_hc(); | 360 | nxp_stop_hc(); |
442 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 361 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
443 | usb_put_hcd(hcd); | 362 | usb_put_hcd(hcd); |
444 | nxp_unset_usb_bits(); | ||
445 | clk_disable(usb_pll_clk); | 363 | clk_disable(usb_pll_clk); |
446 | clk_put(usb_pll_clk); | 364 | clk_put(usb_pll_clk); |
447 | clk_disable(usb_dev_clk); | 365 | clk_disable(usb_dev_clk); |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index f8b2d91851f7..4531d03503c3 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
26 | 26 | ||
27 | #include <plat/mux.h> | 27 | #include <mach/mux.h> |
28 | #include <plat/fpga.h> | 28 | #include <plat/fpga.h> |
29 | 29 | ||
30 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e1a3cc6d28dc..955c410d59b6 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -24,8 +24,8 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
27 | #include <mach/ohci.h> | 27 | #include <linux/platform_data/usb-ohci-pxa27x.h> |
28 | #include <mach/pxa3xx-u2d.h> | 28 | #include <linux/platform_data/usb-pxa3xx-ulpi.h> |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * UHC: USB Host Controller (OHCI-like) register definitions | 31 | * UHC: USB Host Controller (OHCI-like) register definitions |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 664c869eb096..0d2309ca471e 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <plat/usb-control.h> | 24 | #include <linux/platform_data/usb-ohci-s3c2410.h> |
25 | 25 | ||
26 | #define valid_port(idx) ((idx) == 1 || (idx) == 2) | 26 | #define valid_port(idx) ((idx) == 1 || (idx) == 2) |
27 | 27 | ||
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 0f9fcec4e1d3..15a262754150 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/dma-mapping.h> | 35 | #include <linux/dma-mapping.h> |
36 | 36 | ||
37 | #include <mach/da8xx.h> | 37 | #include <mach/da8xx.h> |
38 | #include <mach/usb.h> | 38 | #include <linux/platform_data/usb-davinci.h> |
39 | 39 | ||
40 | #include "musb_core.h" | 40 | #include "musb_core.h" |
41 | 41 | ||
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c index b67b4bc596c1..89f0709f8935 100644 --- a/drivers/usb/musb/tusb6010_omap.c +++ b/drivers/usb/musb/tusb6010_omap.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/dma-mapping.h> | 17 | #include <linux/dma-mapping.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <plat/dma.h> | 19 | #include <plat/dma.h> |
20 | #include <plat/mux.h> | ||
21 | 20 | ||
22 | #include "musb_core.h" | 21 | #include "musb_core.h" |
23 | #include "tusb6010.h" | 22 | #include "tusb6010.h" |
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c index d05c7fbbb703..f82246d2fd16 100644 --- a/drivers/usb/musb/ux500_dma.c +++ b/drivers/usb/musb/ux500_dma.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
31 | #include <linux/dmaengine.h> | 31 | #include <linux/dmaengine.h> |
32 | #include <linux/pfn.h> | 32 | #include <linux/pfn.h> |
33 | #include <mach/usb.h> | 33 | #include <linux/platform_data/usb-musb-ux500.h> |
34 | #include "musb_core.h" | 34 | #include "musb_core.h" |
35 | 35 | ||
36 | struct ux500_dma_channel { | 36 | struct ux500_dma_channel { |
diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c index 7a88667742b6..81f1f9a0be8f 100644 --- a/drivers/usb/otg/isp1301_omap.c +++ b/drivers/usb/otg/isp1301_omap.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
37 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
38 | 38 | ||
39 | #include <plat/mux.h> | 39 | #include <mach/mux.h> |
40 | 40 | ||
41 | #include <mach/usb.h> | 41 | #include <mach/usb.h> |
42 | 42 | ||
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c index 92257ef19403..9a046a4c98f5 100644 --- a/drivers/video/backlight/omap1_bl.c +++ b/drivers/video/backlight/omap1_bl.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/platform_data/omap1_bl.h> | 30 | #include <linux/platform_data/omap1_bl.h> |
31 | 31 | ||
32 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
33 | #include <plat/mux.h> | 33 | #include <mach/mux.h> |
34 | 34 | ||
35 | #define OMAPBL_MAX_INTENSITY 0xff | 35 | #define OMAPBL_MAX_INTENSITY 0xff |
36 | 36 | ||
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 7ae9d53f2bf1..113d43a16f54 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
@@ -131,7 +131,7 @@ | |||
131 | #define UPPER_MARGIN 32 | 131 | #define UPPER_MARGIN 32 |
132 | #define LOWER_MARGIN 32 | 132 | #define LOWER_MARGIN 32 |
133 | 133 | ||
134 | static resource_size_t da8xx_fb_reg_base; | 134 | static void __iomem *da8xx_fb_reg_base; |
135 | static struct resource *lcdc_regs; | 135 | static struct resource *lcdc_regs; |
136 | static unsigned int lcd_revision; | 136 | static unsigned int lcd_revision; |
137 | static irq_handler_t lcdc_irq_handler; | 137 | static irq_handler_t lcdc_irq_handler; |
@@ -951,7 +951,7 @@ static int __devexit fb_remove(struct platform_device *dev) | |||
951 | clk_disable(par->lcdc_clk); | 951 | clk_disable(par->lcdc_clk); |
952 | clk_put(par->lcdc_clk); | 952 | clk_put(par->lcdc_clk); |
953 | framebuffer_release(info); | 953 | framebuffer_release(info); |
954 | iounmap((void __iomem *)da8xx_fb_reg_base); | 954 | iounmap(da8xx_fb_reg_base); |
955 | release_mem_region(lcdc_regs->start, resource_size(lcdc_regs)); | 955 | release_mem_region(lcdc_regs->start, resource_size(lcdc_regs)); |
956 | 956 | ||
957 | } | 957 | } |
@@ -1171,7 +1171,7 @@ static int __devinit fb_probe(struct platform_device *device) | |||
1171 | if (!lcdc_regs) | 1171 | if (!lcdc_regs) |
1172 | return -EBUSY; | 1172 | return -EBUSY; |
1173 | 1173 | ||
1174 | da8xx_fb_reg_base = (resource_size_t)ioremap(lcdc_regs->start, len); | 1174 | da8xx_fb_reg_base = ioremap(lcdc_regs->start, len); |
1175 | if (!da8xx_fb_reg_base) { | 1175 | if (!da8xx_fb_reg_base) { |
1176 | ret = -EBUSY; | 1176 | ret = -EBUSY; |
1177 | goto err_request_mem; | 1177 | goto err_request_mem; |
@@ -1392,7 +1392,7 @@ err_clk_put: | |||
1392 | clk_put(fb_clk); | 1392 | clk_put(fb_clk); |
1393 | 1393 | ||
1394 | err_ioremap: | 1394 | err_ioremap: |
1395 | iounmap((void __iomem *)da8xx_fb_reg_base); | 1395 | iounmap(da8xx_fb_reg_base); |
1396 | 1396 | ||
1397 | err_request_mem: | 1397 | err_request_mem: |
1398 | release_mem_region(lcdc_regs->start, len); | 1398 | release_mem_region(lcdc_regs->start, len); |
diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c index 345d96230978..f2c092da84b0 100644 --- a/drivers/video/ep93xx-fb.c +++ b/drivers/video/ep93xx-fb.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
25 | #include <linux/fb.h> | 25 | #include <linux/fb.h> |
26 | 26 | ||
27 | #include <mach/fb.h> | 27 | #include <linux/platform_data/video-ep93xx.h> |
28 | 28 | ||
29 | /* Vertical Frame Timing Registers */ | 29 | /* Vertical Frame Timing Registers */ |
30 | #define EP93XXFB_VLINES_TOTAL 0x0000 /* SW locked */ | 30 | #define EP93XXFB_VLINES_TOTAL 0x0000 /* SW locked */ |
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index caad3689b4e6..53ffdfc82a75 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/math64.h> | 33 | #include <linux/math64.h> |
34 | 34 | ||
35 | #include <mach/imxfb.h> | 35 | #include <linux/platform_data/video-imxfb.h> |
36 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
37 | 37 | ||
38 | /* | 38 | /* |
diff --git a/drivers/video/msm/mddi.c b/drivers/video/msm/mddi.c index b061d709bc44..bf73f0480061 100644 --- a/drivers/video/msm/mddi.c +++ b/drivers/video/msm/mddi.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <mach/msm_iomap.h> | 29 | #include <mach/msm_iomap.h> |
30 | #include <mach/irqs.h> | 30 | #include <mach/irqs.h> |
31 | #include <mach/board.h> | 31 | #include <mach/board.h> |
32 | #include <mach/msm_fb.h> | 32 | #include <linux/platform_data/video-msm_fb.h> |
33 | #include "mddi_hw.h" | 33 | #include "mddi_hw.h" |
34 | 34 | ||
35 | #define FLAG_DISABLE_HIBERNATION 0x0001 | 35 | #define FLAG_DISABLE_HIBERNATION 0x0001 |
diff --git a/drivers/video/msm/mddi_client_dummy.c b/drivers/video/msm/mddi_client_dummy.c index d2a091cebe2c..f1b0dfcc9717 100644 --- a/drivers/video/msm/mddi_client_dummy.c +++ b/drivers/video/msm/mddi_client_dummy.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | 22 | ||
23 | #include <mach/msm_fb.h> | 23 | #include <linux/platform_data/video-msm_fb.h> |
24 | 24 | ||
25 | struct panel_info { | 25 | struct panel_info { |
26 | struct platform_device pdev; | 26 | struct platform_device pdev; |
diff --git a/drivers/video/msm/mddi_client_nt35399.c b/drivers/video/msm/mddi_client_nt35399.c index 7fcd67e132bf..d7a5bf84fb2a 100644 --- a/drivers/video/msm/mddi_client_nt35399.c +++ b/drivers/video/msm/mddi_client_nt35399.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <mach/msm_fb.h> | 25 | #include <linux/platform_data/video-msm_fb.h> |
26 | 26 | ||
27 | static DECLARE_WAIT_QUEUE_HEAD(nt35399_vsync_wait); | 27 | static DECLARE_WAIT_QUEUE_HEAD(nt35399_vsync_wait); |
28 | 28 | ||
diff --git a/drivers/video/msm/mddi_client_toshiba.c b/drivers/video/msm/mddi_client_toshiba.c index 053eb6877330..061d7dfebbf3 100644 --- a/drivers/video/msm/mddi_client_toshiba.c +++ b/drivers/video/msm/mddi_client_toshiba.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
23 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <mach/msm_fb.h> | 25 | #include <linux/platform_data/video-msm_fb.h> |
26 | 26 | ||
27 | 27 | ||
28 | #define LCD_CONTROL_BLOCK_BASE 0x110000 | 28 | #define LCD_CONTROL_BLOCK_BASE 0x110000 |
diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index cb2ddf164c98..d1f881e8030e 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | 27 | ||
28 | #include <mach/msm_iomap.h> | 28 | #include <mach/msm_iomap.h> |
29 | #include <mach/msm_fb.h> | 29 | #include <linux/platform_data/video-msm_fb.h> |
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/export.h> | 31 | #include <linux/export.h> |
32 | 32 | ||
diff --git a/drivers/video/msm/mdp_hw.h b/drivers/video/msm/mdp_hw.h index d80477415caa..a0bacf581b32 100644 --- a/drivers/video/msm/mdp_hw.h +++ b/drivers/video/msm/mdp_hw.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #define _MDP_HW_H_ | 16 | #define _MDP_HW_H_ |
17 | 17 | ||
18 | #include <mach/msm_iomap.h> | 18 | #include <mach/msm_iomap.h> |
19 | #include <mach/msm_fb.h> | 19 | #include <linux/platform_data/video-msm_fb.h> |
20 | 20 | ||
21 | struct mdp_info { | 21 | struct mdp_info { |
22 | struct mdp_device mdp_dev; | 22 | struct mdp_device mdp_dev; |
diff --git a/drivers/video/msm/mdp_ppp.c b/drivers/video/msm/mdp_ppp.c index 2b6564e8bfea..be6079cdfbb6 100644 --- a/drivers/video/msm/mdp_ppp.c +++ b/drivers/video/msm/mdp_ppp.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/file.h> | 16 | #include <linux/file.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/msm_mdp.h> | 18 | #include <linux/msm_mdp.h> |
19 | #include <mach/msm_fb.h> | 19 | #include <linux/platform_data/video-msm_fb.h> |
20 | 20 | ||
21 | #include "mdp_hw.h" | 21 | #include "mdp_hw.h" |
22 | #include "mdp_scale_tables.h" | 22 | #include "mdp_scale_tables.h" |
diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c index c6e3b4fcdd68..ec08a9ec377d 100644 --- a/drivers/video/msm/msm_fb.c +++ b/drivers/video/msm/msm_fb.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/msm_mdp.h> | 25 | #include <linux/msm_mdp.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
28 | #include <mach/msm_fb.h> | 28 | #include <linux/platform_data/video-msm_fb.h> |
29 | #include <mach/board.h> | 29 | #include <mach/board.h> |
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
31 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index c89f8a8d36d2..d7381088a180 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c | |||
@@ -27,10 +27,10 @@ | |||
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | 29 | ||
30 | #include <mach/dma.h> | 30 | #include <linux/platform_data/dma-imx.h> |
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
32 | #include <mach/ipu.h> | 32 | #include <mach/ipu.h> |
33 | #include <mach/mx3fb.h> | 33 | #include <linux/platform_data/video-mx3fb.h> |
34 | 34 | ||
35 | #include <asm/io.h> | 35 | #include <asm/io.h> |
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index e10f551ade21..93387555337e 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <mach/map.h> | 38 | #include <mach/map.h> |
39 | #include <mach/regs-clock.h> | 39 | #include <mach/regs-clock.h> |
40 | #include <mach/regs-ldm.h> | 40 | #include <mach/regs-ldm.h> |
41 | #include <mach/fb.h> | 41 | #include <linux/platform_data/video-nuc900fb.h> |
42 | 42 | ||
43 | #include "nuc900fb.h" | 43 | #include "nuc900fb.h" |
44 | 44 | ||
diff --git a/drivers/video/nuc900fb.h b/drivers/video/nuc900fb.h index bc7c9300f276..9a1ca6dbb6b2 100644 --- a/drivers/video/nuc900fb.h +++ b/drivers/video/nuc900fb.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #define __NUC900FB_H | 16 | #define __NUC900FB_H |
17 | 17 | ||
18 | #include <mach/map.h> | 18 | #include <mach/map.h> |
19 | #include <mach/fb.h> | 19 | #include <linux/platform_data/video-nuc900fb.h> |
20 | 20 | ||
21 | enum nuc900_lcddrv_type { | 21 | enum nuc900_lcddrv_type { |
22 | LCDDRV_NUC910, | 22 | LCDDRV_NUC910, |
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c index d3a311327227..ed4cad87fbcd 100644 --- a/drivers/video/omap/lcd_ams_delta.c +++ b/drivers/video/omap/lcd_ams_delta.c | |||
@@ -27,8 +27,7 @@ | |||
27 | #include <linux/lcd.h> | 27 | #include <linux/lcd.h> |
28 | #include <linux/gpio.h> | 28 | #include <linux/gpio.h> |
29 | 29 | ||
30 | #include <plat/board-ams-delta.h> | 30 | #include <mach/board-ams-delta.h> |
31 | #include <mach/hardware.h> | ||
32 | 31 | ||
33 | #include "omapfb.h" | 32 | #include "omapfb.h" |
34 | 33 | ||
diff --git a/drivers/video/omap/lcd_mipid.c b/drivers/video/omap/lcd_mipid.c index e3880c4a0bb1..b739600c51ac 100644 --- a/drivers/video/omap/lcd_mipid.c +++ b/drivers/video/omap/lcd_mipid.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/spi/spi.h> | 25 | #include <linux/spi/spi.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | 27 | ||
28 | #include <plat/lcd_mipid.h> | 28 | #include <linux/platform_data/lcd-mipid.h> |
29 | 29 | ||
30 | #include "omapfb.h" | 30 | #include "omapfb.h" |
31 | 31 | ||
diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c index 5914220dfa9c..3aa62da89195 100644 --- a/drivers/video/omap/lcd_osk.c +++ b/drivers/video/omap/lcd_osk.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | 25 | ||
26 | #include <asm/gpio.h> | 26 | #include <asm/gpio.h> |
27 | #include <plat/mux.h> | 27 | #include <mach/mux.h> |
28 | #include "omapfb.h" | 28 | #include "omapfb.h" |
29 | 29 | ||
30 | static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) | 30 | static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 3f902557690e..4fa2ad43fd97 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #include <asm/irq.h> | 61 | #include <asm/irq.h> |
62 | #include <asm/div64.h> | 62 | #include <asm/div64.h> |
63 | #include <mach/bitfield.h> | 63 | #include <mach/bitfield.h> |
64 | #include <mach/pxafb.h> | 64 | #include <linux/platform_data/video-pxafb.h> |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Complain if VAR is out of range. | 67 | * Complain if VAR is out of range. |
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c index 2a5fe6ede845..66a74f9073fb 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/vt8500lcdfb.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
32 | 32 | ||
33 | #include <mach/vt8500fb.h> | 33 | #include <linux/platform_data/video-vt8500lcdfb.h> |
34 | 34 | ||
35 | #include "vt8500lcdfb.h" | 35 | #include "vt8500lcdfb.h" |
36 | #include "wmt_ge_rops.h" | 36 | #include "wmt_ge_rops.h" |
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index c8703bd61b74..ffeff4838120 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/wait.h> | 30 | #include <linux/wait.h> |
31 | 31 | ||
32 | #include <mach/vt8500fb.h> | 32 | #include <linux/platform_data/video-vt8500lcdfb.h> |
33 | 33 | ||
34 | #include "wm8505fb_regs.h" | 34 | #include "wm8505fb_regs.h" |
35 | #include "wmt_ge_rops.h" | 35 | #include "wmt_ge_rops.h" |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 53d75719078e..ad1bb9382a96 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -237,12 +237,12 @@ config OMAP_WATCHDOG | |||
237 | here to enable the OMAP1610/OMAP1710/OMAP2420/OMAP3430/OMAP4430 watchdog timer. | 237 | here to enable the OMAP1610/OMAP1710/OMAP2420/OMAP3430/OMAP4430 watchdog timer. |
238 | 238 | ||
239 | config PNX4008_WATCHDOG | 239 | config PNX4008_WATCHDOG |
240 | tristate "PNX4008 and LPC32XX Watchdog" | 240 | tristate "LPC32XX Watchdog" |
241 | depends on ARCH_PNX4008 || ARCH_LPC32XX | 241 | depends on ARCH_LPC32XX |
242 | select WATCHDOG_CORE | 242 | select WATCHDOG_CORE |
243 | help | 243 | help |
244 | Say Y here if to include support for the watchdog timer | 244 | Say Y here if to include support for the watchdog timer |
245 | in the PNX4008 or LPC32XX processor. | 245 | in the LPC32XX processor. |
246 | This driver can be built as a module by choosing M. The module | 246 | This driver can be built as a module by choosing M. The module |
247 | will be called pnx4008_wdt. | 247 | will be called pnx4008_wdt. |
248 | 248 | ||
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c index 59e75d9a6b7f..c1a4d3bf581d 100644 --- a/drivers/watchdog/ks8695_wdt.c +++ b/drivers/watchdog/ks8695_wdt.c | |||
@@ -24,7 +24,19 @@ | |||
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/uaccess.h> | 25 | #include <linux/uaccess.h> |
26 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
27 | #include <mach/regs-timer.h> | 27 | |
28 | #define KS8695_TMR_OFFSET (0xF0000 + 0xE400) | ||
29 | #define KS8695_TMR_VA (KS8695_IO_VA + KS8695_TMR_OFFSET) | ||
30 | |||
31 | /* | ||
32 | * Timer registers | ||
33 | */ | ||
34 | #define KS8695_TMCON (0x00) /* Timer Control Register */ | ||
35 | #define KS8695_T0TC (0x08) /* Timer 0 Timeout Count Register */ | ||
36 | #define TMCON_T0EN (1 << 0) /* Timer 0 Enable */ | ||
37 | |||
38 | /* Timer0 Timeout Counter Register */ | ||
39 | #define T0TC_WATCHDOG (0xff) /* Enable watchdog mode */ | ||
28 | 40 | ||
29 | #define WDT_DEFAULT_TIME 5 /* seconds */ | 41 | #define WDT_DEFAULT_TIME 5 /* seconds */ |
30 | #define WDT_MAX_TIME 171 /* seconds */ | 42 | #define WDT_MAX_TIME 171 /* seconds */ |