diff options
230 files changed, 4424 insertions, 6020 deletions
diff --git a/Documentation/IRQ-domain.txt b/Documentation/IRQ-domain.txt new file mode 100644 index 000000000000..27dcaabfb4db --- /dev/null +++ b/Documentation/IRQ-domain.txt | |||
@@ -0,0 +1,117 @@ | |||
1 | irq_domain interrupt number mapping library | ||
2 | |||
3 | The current design of the Linux kernel uses a single large number | ||
4 | space where each separate IRQ source is assigned a different number. | ||
5 | This is simple when there is only one interrupt controller, but in | ||
6 | systems with multiple interrupt controllers the kernel must ensure | ||
7 | that each one gets assigned non-overlapping allocations of Linux | ||
8 | IRQ numbers. | ||
9 | |||
10 | The irq_alloc_desc*() and irq_free_desc*() APIs provide allocation of | ||
11 | irq numbers, but they don't provide any support for reverse mapping of | ||
12 | the controller-local IRQ (hwirq) number into the Linux IRQ number | ||
13 | space. | ||
14 | |||
15 | The irq_domain library adds mapping between hwirq and IRQ numbers on | ||
16 | top of the irq_alloc_desc*() API. An irq_domain to manage mapping is | ||
17 | preferred over interrupt controller drivers open coding their own | ||
18 | reverse mapping scheme. | ||
19 | |||
20 | irq_domain also implements translation from Device Tree interrupt | ||
21 | specifiers to hwirq numbers, and can be easily extended to support | ||
22 | other IRQ topology data sources. | ||
23 | |||
24 | === irq_domain usage === | ||
25 | An interrupt controller driver creates and registers an irq_domain by | ||
26 | calling one of the irq_domain_add_*() functions (each mapping method | ||
27 | has a different allocator function, more on that later). The function | ||
28 | will return a pointer to the irq_domain on success. The caller must | ||
29 | provide the allocator function with an irq_domain_ops structure with | ||
30 | the .map callback populated as a minimum. | ||
31 | |||
32 | In most cases, the irq_domain will begin empty without any mappings | ||
33 | between hwirq and IRQ numbers. Mappings are added to the irq_domain | ||
34 | by calling irq_create_mapping() which accepts the irq_domain and a | ||
35 | hwirq number as arguments. If a mapping for the hwirq doesn't already | ||
36 | exist then it will allocate a new Linux irq_desc, associate it with | ||
37 | the hwirq, and call the .map() callback so the driver can perform any | ||
38 | required hardware setup. | ||
39 | |||
40 | When an interrupt is received, irq_find_mapping() function should | ||
41 | be used to find the Linux IRQ number from the hwirq number. | ||
42 | |||
43 | If the driver has the Linux IRQ number or the irq_data pointer, and | ||
44 | needs to know the associated hwirq number (such as in the irq_chip | ||
45 | callbacks) then it can be directly obtained from irq_data->hwirq. | ||
46 | |||
47 | === Types of irq_domain mappings === | ||
48 | There are several mechanisms available for reverse mapping from hwirq | ||
49 | to Linux irq, and each mechanism uses a different allocation function. | ||
50 | Which reverse map type should be used depends on the use case. Each | ||
51 | of the reverse map types are described below: | ||
52 | |||
53 | ==== Linear ==== | ||
54 | irq_domain_add_linear() | ||
55 | |||
56 | The linear reverse map maintains a fixed size table indexed by the | ||
57 | hwirq number. When a hwirq is mapped, an irq_desc is allocated for | ||
58 | the hwirq, and the IRQ number is stored in the table. | ||
59 | |||
60 | The Linear map is a good choice when the maximum number of hwirqs is | ||
61 | fixed and a relatively small number (~ < 256). The advantages of this | ||
62 | map are fixed time lookup for IRQ numbers, and irq_descs are only | ||
63 | allocated for in-use IRQs. The disadvantage is that the table must be | ||
64 | as large as the largest possible hwirq number. | ||
65 | |||
66 | The majority of drivers should use the linear map. | ||
67 | |||
68 | ==== Tree ==== | ||
69 | irq_domain_add_tree() | ||
70 | |||
71 | The irq_domain maintains a radix tree map from hwirq numbers to Linux | ||
72 | IRQs. When an hwirq is mapped, an irq_desc is allocated and the | ||
73 | hwirq is used as the lookup key for the radix tree. | ||
74 | |||
75 | The tree map is a good choice if the hwirq number can be very large | ||
76 | since it doesn't need to allocate a table as large as the largest | ||
77 | hwirq number. The disadvantage is that hwirq to IRQ number lookup is | ||
78 | dependent on how many entries are in the table. | ||
79 | |||
80 | Very few drivers should need this mapping. At the moment, powerpc | ||
81 | iseries is the only user. | ||
82 | |||
83 | ==== No Map ===- | ||
84 | irq_domain_add_nomap() | ||
85 | |||
86 | The No Map mapping is to be used when the hwirq number is | ||
87 | programmable in the hardware. In this case it is best to program the | ||
88 | Linux IRQ number into the hardware itself so that no mapping is | ||
89 | required. Calling irq_create_direct_mapping() will allocate a Linux | ||
90 | IRQ number and call the .map() callback so that driver can program the | ||
91 | Linux IRQ number into the hardware. | ||
92 | |||
93 | Most drivers cannot use this mapping. | ||
94 | |||
95 | ==== Legacy ==== | ||
96 | irq_domain_add_legacy() | ||
97 | irq_domain_add_legacy_isa() | ||
98 | |||
99 | The Legacy mapping is a special case for drivers that already have a | ||
100 | range of irq_descs allocated for the hwirqs. It is used when the | ||
101 | driver cannot be immediately converted to use the linear mapping. For | ||
102 | example, many embedded system board support files use a set of #defines | ||
103 | for IRQ numbers that are passed to struct device registrations. In that | ||
104 | case the Linux IRQ numbers cannot be dynamically assigned and the legacy | ||
105 | mapping should be used. | ||
106 | |||
107 | The legacy map assumes a contiguous range of IRQ numbers has already | ||
108 | been allocated for the controller and that the IRQ number can be | ||
109 | calculated by adding a fixed offset to the hwirq number, and | ||
110 | visa-versa. The disadvantage is that it requires the interrupt | ||
111 | controller to manage IRQ allocations and it requires an irq_desc to be | ||
112 | allocated for every hwirq, even if it is unused. | ||
113 | |||
114 | The legacy map should only be used if fixed IRQ mappings must be | ||
115 | supported. For example, ISA controllers would use the legacy map for | ||
116 | mapping Linux IRQs 0-15 so that existing ISA drivers get the correct IRQ | ||
117 | numbers. | ||
diff --git a/Documentation/devicetree/bindings/arm/tegra/emc.txt b/Documentation/devicetree/bindings/arm/tegra/emc.txt new file mode 100644 index 000000000000..09335f8eee00 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/tegra/emc.txt | |||
@@ -0,0 +1,100 @@ | |||
1 | Embedded Memory Controller | ||
2 | |||
3 | Properties: | ||
4 | - name : Should be emc | ||
5 | - #address-cells : Should be 1 | ||
6 | - #size-cells : Should be 0 | ||
7 | - compatible : Should contain "nvidia,tegra20-emc". | ||
8 | - reg : Offset and length of the register set for the device | ||
9 | - nvidia,use-ram-code : If present, the sub-nodes will be addressed | ||
10 | and chosen using the ramcode board selector. If omitted, only one | ||
11 | set of tables can be present and said tables will be used | ||
12 | irrespective of ram-code configuration. | ||
13 | |||
14 | Child device nodes describe the memory settings for different configurations and clock rates. | ||
15 | |||
16 | Example: | ||
17 | |||
18 | emc@7000f400 { | ||
19 | #address-cells = < 1 >; | ||
20 | #size-cells = < 0 >; | ||
21 | compatible = "nvidia,tegra20-emc"; | ||
22 | reg = <0x7000f4000 0x200>; | ||
23 | } | ||
24 | |||
25 | |||
26 | Embedded Memory Controller ram-code table | ||
27 | |||
28 | If the emc node has the nvidia,use-ram-code property present, then the | ||
29 | next level of nodes below the emc table are used to specify which settings | ||
30 | apply for which ram-code settings. | ||
31 | |||
32 | If the emc node lacks the nvidia,use-ram-code property, this level is omitted | ||
33 | and the tables are stored directly under the emc node (see below). | ||
34 | |||
35 | Properties: | ||
36 | |||
37 | - name : Should be emc-tables | ||
38 | - nvidia,ram-code : the binary representation of the ram-code board strappings | ||
39 | for which this node (and children) are valid. | ||
40 | |||
41 | |||
42 | |||
43 | Embedded Memory Controller configuration table | ||
44 | |||
45 | This is a table containing the EMC register settings for the various | ||
46 | operating speeds of the memory controller. They are always located as | ||
47 | subnodes of the emc controller node. | ||
48 | |||
49 | There are two ways of specifying which tables to use: | ||
50 | |||
51 | * The simplest is if there is just one set of tables in the device tree, | ||
52 | and they will always be used (based on which frequency is used). | ||
53 | This is the preferred method, especially when firmware can fill in | ||
54 | this information based on the specific system information and just | ||
55 | pass it on to the kernel. | ||
56 | |||
57 | * The slightly more complex one is when more than one memory configuration | ||
58 | might exist on the system. The Tegra20 platform handles this during | ||
59 | early boot by selecting one out of possible 4 memory settings based | ||
60 | on a 2-pin "ram code" bootstrap setting on the board. The values of | ||
61 | these strappings can be read through a register in the SoC, and thus | ||
62 | used to select which tables to use. | ||
63 | |||
64 | Properties: | ||
65 | - name : Should be emc-table | ||
66 | - compatible : Should contain "nvidia,tegra20-emc-table". | ||
67 | - reg : either an opaque enumerator to tell different tables apart, or | ||
68 | the valid frequency for which the table should be used (in kHz). | ||
69 | - clock-frequency : the clock frequency for the EMC at which this | ||
70 | table should be used (in kHz). | ||
71 | - nvidia,emc-registers : a 46 word array of EMC registers to be programmed | ||
72 | for operation at the 'clock-frequency' setting. | ||
73 | The order and contents of the registers are: | ||
74 | RC, RFC, RAS, RP, R2W, W2R, R2P, W2P, RD_RCD, WR_RCD, RRD, REXT, | ||
75 | WDV, QUSE, QRST, QSAFE, RDV, REFRESH, BURST_REFRESH_NUM, PDEX2WR, | ||
76 | PDEX2RD, PCHG2PDEN, ACT2PDEN, AR2PDEN, RW2PDEN, TXSR, TCKE, TFAW, | ||
77 | TRPAB, TCLKSTABLE, TCLKSTOP, TREFBW, QUSE_EXTRA, FBIO_CFG6, ODT_WRITE, | ||
78 | ODT_READ, FBIO_CFG5, CFG_DIG_DLL, DLL_XFORM_DQS, DLL_XFORM_QUSE, | ||
79 | ZCAL_REF_CNT, ZCAL_WAIT_CNT, AUTO_CAL_INTERVAL, CFG_CLKTRIM_0, | ||
80 | CFG_CLKTRIM_1, CFG_CLKTRIM_2 | ||
81 | |||
82 | emc-table@166000 { | ||
83 | reg = <166000>; | ||
84 | compatible = "nvidia,tegra20-emc-table"; | ||
85 | clock-frequency = < 166000 >; | ||
86 | nvidia,emc-registers = < 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
87 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
88 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
89 | 0 0 0 0 >; | ||
90 | }; | ||
91 | |||
92 | emc-table@333000 { | ||
93 | reg = <333000>; | ||
94 | compatible = "nvidia,tegra20-emc-table"; | ||
95 | clock-frequency = < 333000 >; | ||
96 | nvidia,emc-registers = < 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
97 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
98 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
99 | 0 0 0 0 >; | ||
100 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt new file mode 100644 index 000000000000..b5846e21cc2e --- /dev/null +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | NVIDIA Tegra Power Management Controller (PMC) | ||
2 | |||
3 | Properties: | ||
4 | - name : Should be pmc | ||
5 | - compatible : Should contain "nvidia,tegra<chip>-pmc". | ||
6 | - reg : Offset and length of the register set for the device | ||
7 | - nvidia,invert-interrupt : If present, inverts the PMU interrupt signal. | ||
8 | The PMU is an external Power Management Unit, whose interrupt output | ||
9 | signal is fed into the PMC. This signal is optionally inverted, and then | ||
10 | fed into the ARM GIC. The PMC is not involved in the detection or | ||
11 | handling of this interrupt signal, merely its inversion. | ||
12 | |||
13 | Example: | ||
14 | |||
15 | pmc@7000f400 { | ||
16 | compatible = "nvidia,tegra20-pmc"; | ||
17 | reg = <0x7000e400 0x400>; | ||
18 | nvidia,invert-interrupt; | ||
19 | }; | ||
diff --git a/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt b/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt new file mode 100644 index 000000000000..90fa7da525b8 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt | |||
@@ -0,0 +1,30 @@ | |||
1 | * NVIDIA Tegra APB DMA controller | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: Should be "nvidia,<chip>-apbdma" | ||
5 | - reg: Should contain DMA registers location and length. This shuld include | ||
6 | all of the per-channel registers. | ||
7 | - interrupts: Should contain all of the per-channel DMA interrupts. | ||
8 | |||
9 | Examples: | ||
10 | |||
11 | apbdma: dma@6000a000 { | ||
12 | compatible = "nvidia,tegra20-apbdma"; | ||
13 | reg = <0x6000a000 0x1200>; | ||
14 | interrupts = < 0 136 0x04 | ||
15 | 0 137 0x04 | ||
16 | 0 138 0x04 | ||
17 | 0 139 0x04 | ||
18 | 0 140 0x04 | ||
19 | 0 141 0x04 | ||
20 | 0 142 0x04 | ||
21 | 0 143 0x04 | ||
22 | 0 144 0x04 | ||
23 | 0 145 0x04 | ||
24 | 0 146 0x04 | ||
25 | 0 147 0x04 | ||
26 | 0 148 0x04 | ||
27 | 0 149 0x04 | ||
28 | 0 150 0x04 | ||
29 | 0 151 0x04 >; | ||
30 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt b/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt index eb4b530d64e1..023c9526e5f8 100644 --- a/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt +++ b/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt | |||
@@ -1,8 +1,40 @@ | |||
1 | NVIDIA Tegra 2 GPIO controller | 1 | NVIDIA Tegra GPIO controller |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra20-gpio" | 4 | - compatible : "nvidia,tegra<chip>-gpio" |
5 | - reg : Physical base address and length of the controller's registers. | ||
6 | - interrupts : The interrupt outputs from the controller. For Tegra20, | ||
7 | there should be 7 interrupts specified, and for Tegra30, there should | ||
8 | be 8 interrupts specified. | ||
5 | - #gpio-cells : Should be two. The first cell is the pin number and the | 9 | - #gpio-cells : Should be two. The first cell is the pin number and the |
6 | second cell is used to specify optional parameters: | 10 | second cell is used to specify optional parameters: |
7 | - bit 0 specifies polarity (0 for normal, 1 for inverted) | 11 | - bit 0 specifies polarity (0 for normal, 1 for inverted) |
8 | - gpio-controller : Marks the device node as a GPIO controller. | 12 | - gpio-controller : Marks the device node as a GPIO controller. |
13 | - #interrupt-cells : Should be 2. | ||
14 | The first cell is the GPIO number. | ||
15 | The second cell is used to specify flags: | ||
16 | bits[3:0] trigger type and level flags: | ||
17 | 1 = low-to-high edge triggered. | ||
18 | 2 = high-to-low edge triggered. | ||
19 | 4 = active high level-sensitive. | ||
20 | 8 = active low level-sensitive. | ||
21 | Valid combinations are 1, 2, 3, 4, 8. | ||
22 | - interrupt-controller : Marks the device node as an interrupt controller. | ||
23 | |||
24 | Example: | ||
25 | |||
26 | gpio: gpio@6000d000 { | ||
27 | compatible = "nvidia,tegra20-gpio"; | ||
28 | reg = < 0x6000d000 0x1000 >; | ||
29 | interrupts = < 0 32 0x04 | ||
30 | 0 33 0x04 | ||
31 | 0 34 0x04 | ||
32 | 0 35 0x04 | ||
33 | 0 55 0x04 | ||
34 | 0 87 0x04 | ||
35 | 0 89 0x04 >; | ||
36 | #gpio-cells = <2>; | ||
37 | gpio-controller; | ||
38 | #interrupt-cells = <2>; | ||
39 | interrupt-controller; | ||
40 | }; | ||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index a0ffac029a0d..1bea46a54b1c 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -510,17 +510,3 @@ Why: The pci_scan_bus_parented() interface creates a new root bus. The | |||
510 | convert to using pci_scan_root_bus() so they can supply a list of | 510 | convert to using pci_scan_root_bus() so they can supply a list of |
511 | bus resources when the bus is created. | 511 | bus resources when the bus is created. |
512 | Who: Bjorn Helgaas <bhelgaas@google.com> | 512 | Who: Bjorn Helgaas <bhelgaas@google.com> |
513 | |||
514 | ---------------------------- | ||
515 | |||
516 | What: The CAP9 SoC family will be removed | ||
517 | When: 3.4 | ||
518 | Files: arch/arm/mach-at91/at91cap9.c | ||
519 | arch/arm/mach-at91/at91cap9_devices.c | ||
520 | arch/arm/mach-at91/include/mach/at91cap9.h | ||
521 | arch/arm/mach-at91/include/mach/at91cap9_matrix.h | ||
522 | arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h | ||
523 | arch/arm/mach-at91/board-cap9adk.c | ||
524 | Why: The code is not actively maintained and platforms are now hard to find. | ||
525 | Who: Nicolas Ferre <nicolas.ferre@atmel.com> | ||
526 | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 4e41d5255d72..f096b0d8e973 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3638,6 +3638,15 @@ S: Maintained | |||
3638 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core | 3638 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core |
3639 | F: kernel/irq/ | 3639 | F: kernel/irq/ |
3640 | 3640 | ||
3641 | IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY) | ||
3642 | M: Benjamin Herrenschmidt <benh@kernel.crashing.org> | ||
3643 | M: Grant Likely <grant.likely@secretlab.ca> | ||
3644 | T: git git://git.secretlab.ca/git/linux-2.6.git irqdomain/next | ||
3645 | S: Maintained | ||
3646 | F: Documentation/IRQ-domain.txt | ||
3647 | F: include/linux/irqdomain.h | ||
3648 | F: kernel/irq/irqdomain.c | ||
3649 | |||
3641 | ISAPNP | 3650 | ISAPNP |
3642 | M: Jaroslav Kysela <perex@perex.cz> | 3651 | M: Jaroslav Kysela <perex@perex.cz> |
3643 | S: Maintained | 3652 | S: Maintained |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a48aecc17eac..baf6dc6e9a1b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -324,7 +324,7 @@ config ARCH_AT91 | |||
324 | select CLKDEV_LOOKUP | 324 | select CLKDEV_LOOKUP |
325 | help | 325 | help |
326 | This enables support for systems based on the Atmel AT91RM9200, | 326 | This enables support for systems based on the Atmel AT91RM9200, |
327 | AT91SAM9 and AT91CAP9 processors. | 327 | AT91SAM9 processors. |
328 | 328 | ||
329 | config ARCH_BCMRING | 329 | config ARCH_BCMRING |
330 | bool "Broadcom BCMRING" | 330 | bool "Broadcom BCMRING" |
@@ -754,7 +754,7 @@ config ARCH_SA1100 | |||
754 | select ARCH_HAS_CPUFREQ | 754 | select ARCH_HAS_CPUFREQ |
755 | select CPU_FREQ | 755 | select CPU_FREQ |
756 | select GENERIC_CLOCKEVENTS | 756 | select GENERIC_CLOCKEVENTS |
757 | select HAVE_CLK | 757 | select CLKDEV_LOOKUP |
758 | select HAVE_SCHED_CLOCK | 758 | select HAVE_SCHED_CLOCK |
759 | select TICK_ONESHOT | 759 | select TICK_ONESHOT |
760 | select ARCH_REQUIRE_GPIOLIB | 760 | select ARCH_REQUIRE_GPIOLIB |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 03646c4c13d1..66ca8014ff3e 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -86,7 +86,7 @@ choice | |||
86 | depends on HAVE_AT91_DBGU0 | 86 | depends on HAVE_AT91_DBGU0 |
87 | 87 | ||
88 | config AT91_DEBUG_LL_DBGU1 | 88 | config AT91_DEBUG_LL_DBGU1 |
89 | bool "Kernel low-level debugging on 9263, 9g45 and cap9" | 89 | bool "Kernel low-level debugging on 9263 and 9g45" |
90 | depends on HAVE_AT91_DBGU1 | 90 | depends on HAVE_AT91_DBGU1 |
91 | 91 | ||
92 | config DEBUG_CLPS711X_UART1 | 92 | config DEBUG_CLPS711X_UART1 |
@@ -180,12 +180,12 @@ choice | |||
180 | Say Y here if you want kernel low-level debugging support | 180 | Say Y here if you want kernel low-level debugging support |
181 | on i.MX50 or i.MX53. | 181 | on i.MX50 or i.MX53. |
182 | 182 | ||
183 | config DEBUG_IMX6Q_UART | 183 | config DEBUG_IMX6Q_UART4 |
184 | bool "i.MX6Q Debug UART" | 184 | bool "i.MX6Q Debug UART4" |
185 | depends on SOC_IMX6Q | 185 | depends on SOC_IMX6Q |
186 | help | 186 | help |
187 | Say Y here if you want kernel low-level debugging support | 187 | Say Y here if you want kernel low-level debugging support |
188 | on i.MX6Q. | 188 | on i.MX6Q UART4. |
189 | 189 | ||
190 | config DEBUG_MSM_UART1 | 190 | config DEBUG_MSM_UART1 |
191 | bool "Kernel low-level debugging messages via MSM UART1" | 191 | bool "Kernel low-level debugging messages via MSM UART1" |
diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts index 80afa1b70b80..6e8447dc0202 100644 --- a/arch/arm/boot/dts/tegra-harmony.dts +++ b/arch/arm/boot/dts/tegra-harmony.dts | |||
@@ -10,19 +10,25 @@ | |||
10 | reg = < 0x00000000 0x40000000 >; | 10 | reg = < 0x00000000 0x40000000 >; |
11 | }; | 11 | }; |
12 | 12 | ||
13 | pmc@7000f400 { | ||
14 | nvidia,invert-interrupt; | ||
15 | }; | ||
16 | |||
13 | i2c@7000c000 { | 17 | i2c@7000c000 { |
14 | clock-frequency = <400000>; | 18 | clock-frequency = <400000>; |
15 | 19 | ||
16 | codec: wm8903@1a { | 20 | wm8903: wm8903@1a { |
17 | compatible = "wlf,wm8903"; | 21 | compatible = "wlf,wm8903"; |
18 | reg = <0x1a>; | 22 | reg = <0x1a>; |
19 | interrupts = < 347 >; | 23 | interrupt-parent = <&gpio>; |
24 | interrupts = < 187 0x04 >; | ||
20 | 25 | ||
21 | gpio-controller; | 26 | gpio-controller; |
22 | #gpio-cells = <2>; | 27 | #gpio-cells = <2>; |
23 | 28 | ||
24 | /* 0x8000 = Not configured */ | 29 | micdet-cfg = <0>; |
25 | gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >; | 30 | micdet-delay = <100>; |
31 | gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >; | ||
26 | }; | 32 | }; |
27 | }; | 33 | }; |
28 | 34 | ||
@@ -38,13 +44,32 @@ | |||
38 | clock-frequency = <400000>; | 44 | clock-frequency = <400000>; |
39 | }; | 45 | }; |
40 | 46 | ||
41 | sound { | 47 | i2s@70002a00 { |
42 | compatible = "nvidia,harmony-sound", "nvidia,tegra-wm8903"; | 48 | status = "disable"; |
49 | }; | ||
43 | 50 | ||
44 | spkr-en-gpios = <&codec 2 0>; | 51 | sound { |
45 | hp-det-gpios = <&gpio 178 0>; | 52 | compatible = "nvidia,tegra-audio-wm8903-harmony", |
46 | int-mic-en-gpios = <&gpio 184 0>; | 53 | "nvidia,tegra-audio-wm8903"; |
47 | ext-mic-en-gpios = <&gpio 185 0>; | 54 | nvidia,model = "NVIDIA Tegra Harmony"; |
55 | |||
56 | nvidia,audio-routing = | ||
57 | "Headphone Jack", "HPOUTR", | ||
58 | "Headphone Jack", "HPOUTL", | ||
59 | "Int Spk", "ROP", | ||
60 | "Int Spk", "RON", | ||
61 | "Int Spk", "LOP", | ||
62 | "Int Spk", "LON", | ||
63 | "Mic Jack", "MICBIAS", | ||
64 | "IN1L", "Mic Jack"; | ||
65 | |||
66 | nvidia,i2s-controller = <&tegra_i2s1>; | ||
67 | nvidia,audio-codec = <&wm8903>; | ||
68 | |||
69 | nvidia,spkr-en-gpios = <&wm8903 2 0>; | ||
70 | nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ | ||
71 | nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */ | ||
72 | nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ | ||
48 | }; | 73 | }; |
49 | 74 | ||
50 | serial@70006000 { | 75 | serial@70006000 { |
diff --git a/arch/arm/boot/dts/tegra-paz00.dts b/arch/arm/boot/dts/tegra-paz00.dts index 825d2957da0b..e4b552b46fe2 100644 --- a/arch/arm/boot/dts/tegra-paz00.dts +++ b/arch/arm/boot/dts/tegra-paz00.dts | |||
@@ -12,6 +12,13 @@ | |||
12 | 12 | ||
13 | i2c@7000c000 { | 13 | i2c@7000c000 { |
14 | clock-frequency = <400000>; | 14 | clock-frequency = <400000>; |
15 | |||
16 | alc5632: alc5632@1e { | ||
17 | compatible = "realtek,alc5632"; | ||
18 | reg = <0x1e>; | ||
19 | gpio-controller; | ||
20 | #gpio-cells = <2>; | ||
21 | }; | ||
15 | }; | 22 | }; |
16 | 23 | ||
17 | i2c@7000c400 { | 24 | i2c@7000c400 { |
@@ -37,6 +44,29 @@ | |||
37 | clock-frequency = <400000>; | 44 | clock-frequency = <400000>; |
38 | }; | 45 | }; |
39 | 46 | ||
47 | i2s@70002a00 { | ||
48 | status = "disable"; | ||
49 | }; | ||
50 | |||
51 | sound { | ||
52 | compatible = "nvidia,tegra-audio-alc5632-paz00", | ||
53 | "nvidia,tegra-audio-alc5632"; | ||
54 | |||
55 | nvidia,model = "Compal PAZ00"; | ||
56 | |||
57 | nvidia,audio-routing = | ||
58 | "Int Spk", "SPKOUT", | ||
59 | "Int Spk", "SPKOUTN", | ||
60 | "Headset Mic", "MICBIAS1", | ||
61 | "MIC1", "Headset Mic", | ||
62 | "Headset Stereophone", "HPR", | ||
63 | "Headset Stereophone", "HPL"; | ||
64 | |||
65 | nvidia,audio-codec = <&alc5632>; | ||
66 | nvidia,i2s-controller = <&tegra_i2s1>; | ||
67 | nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ | ||
68 | }; | ||
69 | |||
40 | serial@70006000 { | 70 | serial@70006000 { |
41 | clock-frequency = <216000000>; | 71 | clock-frequency = <216000000>; |
42 | }; | 72 | }; |
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts index b55a02e34ba7..876d5c92ce36 100644 --- a/arch/arm/boot/dts/tegra-seaboard.dts +++ b/arch/arm/boot/dts/tegra-seaboard.dts | |||
@@ -13,6 +13,20 @@ | |||
13 | 13 | ||
14 | i2c@7000c000 { | 14 | i2c@7000c000 { |
15 | clock-frequency = <400000>; | 15 | clock-frequency = <400000>; |
16 | |||
17 | wm8903: wm8903@1a { | ||
18 | compatible = "wlf,wm8903"; | ||
19 | reg = <0x1a>; | ||
20 | interrupt-parent = <&gpio>; | ||
21 | interrupts = < 187 0x04 >; | ||
22 | |||
23 | gpio-controller; | ||
24 | #gpio-cells = <2>; | ||
25 | |||
26 | micdet-cfg = <0>; | ||
27 | micdet-delay = <100>; | ||
28 | gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >; | ||
29 | }; | ||
16 | }; | 30 | }; |
17 | 31 | ||
18 | i2c@7000c400 { | 32 | i2c@7000c400 { |
@@ -32,6 +46,32 @@ | |||
32 | }; | 46 | }; |
33 | }; | 47 | }; |
34 | 48 | ||
49 | i2s@70002a00 { | ||
50 | status = "disable"; | ||
51 | }; | ||
52 | |||
53 | sound { | ||
54 | compatible = "nvidia,tegra-audio-wm8903-seaboard", | ||
55 | "nvidia,tegra-audio-wm8903"; | ||
56 | nvidia,model = "NVIDIA Tegra Seaboard"; | ||
57 | |||
58 | nvidia,audio-routing = | ||
59 | "Headphone Jack", "HPOUTR", | ||
60 | "Headphone Jack", "HPOUTL", | ||
61 | "Int Spk", "ROP", | ||
62 | "Int Spk", "RON", | ||
63 | "Int Spk", "LOP", | ||
64 | "Int Spk", "LON", | ||
65 | "Mic Jack", "MICBIAS", | ||
66 | "IN1R", "Mic Jack"; | ||
67 | |||
68 | nvidia,i2s-controller = <&tegra_i2s1>; | ||
69 | nvidia,audio-codec = <&wm8903>; | ||
70 | |||
71 | nvidia,spkr-en-gpios = <&wm8903 2 0>; | ||
72 | nvidia,hp-det-gpios = <&gpio 185 0>; /* gpio PX1 */ | ||
73 | }; | ||
74 | |||
35 | serial@70006000 { | 75 | serial@70006000 { |
36 | status = "disable"; | 76 | status = "disable"; |
37 | }; | 77 | }; |
@@ -93,4 +133,42 @@ | |||
93 | gpio-key,wakeup; | 133 | gpio-key,wakeup; |
94 | }; | 134 | }; |
95 | }; | 135 | }; |
136 | |||
137 | emc@7000f400 { | ||
138 | emc-table@190000 { | ||
139 | reg = < 190000 >; | ||
140 | compatible = "nvidia,tegra20-emc-table"; | ||
141 | clock-frequency = < 190000 >; | ||
142 | nvidia,emc-registers = < 0x0000000c 0x00000026 | ||
143 | 0x00000009 0x00000003 0x00000004 0x00000004 | ||
144 | 0x00000002 0x0000000c 0x00000003 0x00000003 | ||
145 | 0x00000002 0x00000001 0x00000004 0x00000005 | ||
146 | 0x00000004 0x00000009 0x0000000d 0x0000059f | ||
147 | 0x00000000 0x00000003 0x00000003 0x00000003 | ||
148 | 0x00000003 0x00000001 0x0000000b 0x000000c8 | ||
149 | 0x00000003 0x00000007 0x00000004 0x0000000f | ||
150 | 0x00000002 0x00000000 0x00000000 0x00000002 | ||
151 | 0x00000000 0x00000000 0x00000083 0xa06204ae | ||
152 | 0x007dc010 0x00000000 0x00000000 0x00000000 | ||
153 | 0x00000000 0x00000000 0x00000000 0x00000000 >; | ||
154 | }; | ||
155 | |||
156 | emc-table@380000 { | ||
157 | reg = < 380000 >; | ||
158 | compatible = "nvidia,tegra20-emc-table"; | ||
159 | clock-frequency = < 380000 >; | ||
160 | nvidia,emc-registers = < 0x00000017 0x0000004b | ||
161 | 0x00000012 0x00000006 0x00000004 0x00000005 | ||
162 | 0x00000003 0x0000000c 0x00000006 0x00000006 | ||
163 | 0x00000003 0x00000001 0x00000004 0x00000005 | ||
164 | 0x00000004 0x00000009 0x0000000d 0x00000b5f | ||
165 | 0x00000000 0x00000003 0x00000003 0x00000006 | ||
166 | 0x00000006 0x00000001 0x00000011 0x000000c8 | ||
167 | 0x00000003 0x0000000e 0x00000007 0x0000000f | ||
168 | 0x00000002 0x00000000 0x00000000 0x00000002 | ||
169 | 0x00000000 0x00000000 0x00000083 0xe044048b | ||
170 | 0x007d8010 0x00000000 0x00000000 0x00000000 | ||
171 | 0x00000000 0x00000000 0x00000000 0x00000000 >; | ||
172 | }; | ||
173 | }; | ||
96 | }; | 174 | }; |
diff --git a/arch/arm/boot/dts/tegra-trimslice.dts b/arch/arm/boot/dts/tegra-trimslice.dts index 3b3ee7db99f3..252476867b54 100644 --- a/arch/arm/boot/dts/tegra-trimslice.dts +++ b/arch/arm/boot/dts/tegra-trimslice.dts | |||
@@ -26,6 +26,18 @@ | |||
26 | status = "disable"; | 26 | status = "disable"; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | i2s@70002800 { | ||
30 | status = "disable"; | ||
31 | }; | ||
32 | |||
33 | i2s@70002a00 { | ||
34 | status = "disable"; | ||
35 | }; | ||
36 | |||
37 | das@70000c00 { | ||
38 | status = "disable"; | ||
39 | }; | ||
40 | |||
29 | serial@70006000 { | 41 | serial@70006000 { |
30 | clock-frequency = < 216000000 >; | 42 | clock-frequency = < 216000000 >; |
31 | }; | 43 | }; |
diff --git a/arch/arm/boot/dts/tegra-ventana.dts b/arch/arm/boot/dts/tegra-ventana.dts index c7d3b87f29df..2dcff8728e90 100644 --- a/arch/arm/boot/dts/tegra-ventana.dts +++ b/arch/arm/boot/dts/tegra-ventana.dts | |||
@@ -12,6 +12,20 @@ | |||
12 | 12 | ||
13 | i2c@7000c000 { | 13 | i2c@7000c000 { |
14 | clock-frequency = <400000>; | 14 | clock-frequency = <400000>; |
15 | |||
16 | wm8903: wm8903@1a { | ||
17 | compatible = "wlf,wm8903"; | ||
18 | reg = <0x1a>; | ||
19 | interrupt-parent = <&gpio>; | ||
20 | interrupts = < 187 0x04 >; | ||
21 | |||
22 | gpio-controller; | ||
23 | #gpio-cells = <2>; | ||
24 | |||
25 | micdet-cfg = <0>; | ||
26 | micdet-delay = <100>; | ||
27 | gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >; | ||
28 | }; | ||
15 | }; | 29 | }; |
16 | 30 | ||
17 | i2c@7000c400 { | 31 | i2c@7000c400 { |
@@ -26,6 +40,34 @@ | |||
26 | clock-frequency = <400000>; | 40 | clock-frequency = <400000>; |
27 | }; | 41 | }; |
28 | 42 | ||
43 | i2s@70002a00 { | ||
44 | status = "disable"; | ||
45 | }; | ||
46 | |||
47 | sound { | ||
48 | compatible = "nvidia,tegra-audio-wm8903-ventana", | ||
49 | "nvidia,tegra-audio-wm8903"; | ||
50 | nvidia,model = "NVIDIA Tegra Ventana"; | ||
51 | |||
52 | nvidia,audio-routing = | ||
53 | "Headphone Jack", "HPOUTR", | ||
54 | "Headphone Jack", "HPOUTL", | ||
55 | "Int Spk", "ROP", | ||
56 | "Int Spk", "RON", | ||
57 | "Int Spk", "LOP", | ||
58 | "Int Spk", "LON", | ||
59 | "Mic Jack", "MICBIAS", | ||
60 | "IN1L", "Mic Jack"; | ||
61 | |||
62 | nvidia,i2s-controller = <&tegra_i2s1>; | ||
63 | nvidia,audio-codec = <&wm8903>; | ||
64 | |||
65 | nvidia,spkr-en-gpios = <&wm8903 2 0>; | ||
66 | nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ | ||
67 | nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */ | ||
68 | nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ | ||
69 | }; | ||
70 | |||
29 | serial@70006000 { | 71 | serial@70006000 { |
30 | status = "disable"; | 72 | status = "disable"; |
31 | }; | 73 | }; |
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi index 3da7afd45322..ec1f0101c79c 100644 --- a/arch/arm/boot/dts/tegra20.dtsi +++ b/arch/arm/boot/dts/tegra20.dtsi | |||
@@ -4,6 +4,11 @@ | |||
4 | compatible = "nvidia,tegra20"; | 4 | compatible = "nvidia,tegra20"; |
5 | interrupt-parent = <&intc>; | 5 | interrupt-parent = <&intc>; |
6 | 6 | ||
7 | pmc@7000f400 { | ||
8 | compatible = "nvidia,tegra20-pmc"; | ||
9 | reg = <0x7000e400 0x400>; | ||
10 | }; | ||
11 | |||
7 | intc: interrupt-controller@50041000 { | 12 | intc: interrupt-controller@50041000 { |
8 | compatible = "arm,cortex-a9-gic"; | 13 | compatible = "arm,cortex-a9-gic"; |
9 | interrupt-controller; | 14 | interrupt-controller; |
@@ -12,6 +17,27 @@ | |||
12 | < 0x50040100 0x0100 >; | 17 | < 0x50040100 0x0100 >; |
13 | }; | 18 | }; |
14 | 19 | ||
20 | apbdma: dma@6000a000 { | ||
21 | compatible = "nvidia,tegra20-apbdma"; | ||
22 | reg = <0x6000a000 0x1200>; | ||
23 | interrupts = < 0 104 0x04 | ||
24 | 0 105 0x04 | ||
25 | 0 106 0x04 | ||
26 | 0 107 0x04 | ||
27 | 0 108 0x04 | ||
28 | 0 109 0x04 | ||
29 | 0 110 0x04 | ||
30 | 0 111 0x04 | ||
31 | 0 112 0x04 | ||
32 | 0 113 0x04 | ||
33 | 0 114 0x04 | ||
34 | 0 115 0x04 | ||
35 | 0 116 0x04 | ||
36 | 0 117 0x04 | ||
37 | 0 118 0x04 | ||
38 | 0 119 0x04 >; | ||
39 | }; | ||
40 | |||
15 | i2c@7000c000 { | 41 | i2c@7000c000 { |
16 | #address-cells = <1>; | 42 | #address-cells = <1>; |
17 | #size-cells = <0>; | 43 | #size-cells = <0>; |
@@ -44,18 +70,18 @@ | |||
44 | interrupts = < 0 53 0x04 >; | 70 | interrupts = < 0 53 0x04 >; |
45 | }; | 71 | }; |
46 | 72 | ||
47 | i2s@70002800 { | 73 | tegra_i2s1: i2s@70002800 { |
48 | compatible = "nvidia,tegra20-i2s"; | 74 | compatible = "nvidia,tegra20-i2s"; |
49 | reg = <0x70002800 0x200>; | 75 | reg = <0x70002800 0x200>; |
50 | interrupts = < 0 13 0x04 >; | 76 | interrupts = < 0 13 0x04 >; |
51 | dma-channel = < 2 >; | 77 | nvidia,dma-request-selector = < &apbdma 2 >; |
52 | }; | 78 | }; |
53 | 79 | ||
54 | i2s@70002a00 { | 80 | tegra_i2s2: i2s@70002a00 { |
55 | compatible = "nvidia,tegra20-i2s"; | 81 | compatible = "nvidia,tegra20-i2s"; |
56 | reg = <0x70002a00 0x200>; | 82 | reg = <0x70002a00 0x200>; |
57 | interrupts = < 0 3 0x04 >; | 83 | interrupts = < 0 3 0x04 >; |
58 | dma-channel = < 1 >; | 84 | nvidia,dma-request-selector = < &apbdma 1 >; |
59 | }; | 85 | }; |
60 | 86 | ||
61 | das@70000c00 { | 87 | das@70000c00 { |
@@ -75,6 +101,8 @@ | |||
75 | 0 89 0x04 >; | 101 | 0 89 0x04 >; |
76 | #gpio-cells = <2>; | 102 | #gpio-cells = <2>; |
77 | gpio-controller; | 103 | gpio-controller; |
104 | #interrupt-cells = <2>; | ||
105 | interrupt-controller; | ||
78 | }; | 106 | }; |
79 | 107 | ||
80 | pinmux: pinmux@70000000 { | 108 | pinmux: pinmux@70000000 { |
@@ -120,6 +148,13 @@ | |||
120 | interrupts = < 0 91 0x04 >; | 148 | interrupts = < 0 91 0x04 >; |
121 | }; | 149 | }; |
122 | 150 | ||
151 | emc@7000f400 { | ||
152 | #address-cells = <1>; | ||
153 | #size-cells = <0>; | ||
154 | compatible = "nvidia,tegra20-emc"; | ||
155 | reg = <0x7000f400 0x200>; | ||
156 | }; | ||
157 | |||
123 | sdhci@c8000000 { | 158 | sdhci@c8000000 { |
124 | compatible = "nvidia,tegra20-sdhci"; | 159 | compatible = "nvidia,tegra20-sdhci"; |
125 | reg = <0xc8000000 0x200>; | 160 | reg = <0xc8000000 0x200>; |
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index ee7db9892e02..ac4b75cb26c0 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi | |||
@@ -4,6 +4,11 @@ | |||
4 | compatible = "nvidia,tegra30"; | 4 | compatible = "nvidia,tegra30"; |
5 | interrupt-parent = <&intc>; | 5 | interrupt-parent = <&intc>; |
6 | 6 | ||
7 | pmc@7000f400 { | ||
8 | compatible = "nvidia,tegra20-pmc", "nvidia,tegra30-pmc"; | ||
9 | reg = <0x7000e400 0x400>; | ||
10 | }; | ||
11 | |||
7 | intc: interrupt-controller@50041000 { | 12 | intc: interrupt-controller@50041000 { |
8 | compatible = "arm,cortex-a9-gic"; | 13 | compatible = "arm,cortex-a9-gic"; |
9 | interrupt-controller; | 14 | interrupt-controller; |
@@ -12,6 +17,43 @@ | |||
12 | < 0x50040100 0x0100 >; | 17 | < 0x50040100 0x0100 >; |
13 | }; | 18 | }; |
14 | 19 | ||
20 | apbdma: dma@6000a000 { | ||
21 | compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma"; | ||
22 | reg = <0x6000a000 0x1400>; | ||
23 | interrupts = < 0 104 0x04 | ||
24 | 0 105 0x04 | ||
25 | 0 106 0x04 | ||
26 | 0 107 0x04 | ||
27 | 0 108 0x04 | ||
28 | 0 109 0x04 | ||
29 | 0 110 0x04 | ||
30 | 0 111 0x04 | ||
31 | 0 112 0x04 | ||
32 | 0 113 0x04 | ||
33 | 0 114 0x04 | ||
34 | 0 115 0x04 | ||
35 | 0 116 0x04 | ||
36 | 0 117 0x04 | ||
37 | 0 118 0x04 | ||
38 | 0 119 0x04 | ||
39 | 0 128 0x04 | ||
40 | 0 129 0x04 | ||
41 | 0 130 0x04 | ||
42 | 0 131 0x04 | ||
43 | 0 132 0x04 | ||
44 | 0 133 0x04 | ||
45 | 0 134 0x04 | ||
46 | 0 135 0x04 | ||
47 | 0 136 0x04 | ||
48 | 0 137 0x04 | ||
49 | 0 138 0x04 | ||
50 | 0 139 0x04 | ||
51 | 0 140 0x04 | ||
52 | 0 141 0x04 | ||
53 | 0 142 0x04 | ||
54 | 0 143 0x04 >; | ||
55 | }; | ||
56 | |||
15 | i2c@7000c000 { | 57 | i2c@7000c000 { |
16 | #address-cells = <1>; | 58 | #address-cells = <1>; |
17 | #size-cells = <0>; | 59 | #size-cells = <0>; |
@@ -55,9 +97,18 @@ | |||
55 | gpio: gpio@6000d000 { | 97 | gpio: gpio@6000d000 { |
56 | compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio"; | 98 | compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio"; |
57 | reg = < 0x6000d000 0x1000 >; | 99 | reg = < 0x6000d000 0x1000 >; |
58 | interrupts = < 0 32 0x04 0 33 0x04 0 34 0x04 0 35 0x04 0 55 0x04 0 87 0x04 0 89 0x04 >; | 100 | interrupts = < 0 32 0x04 |
101 | 0 33 0x04 | ||
102 | 0 34 0x04 | ||
103 | 0 35 0x04 | ||
104 | 0 55 0x04 | ||
105 | 0 87 0x04 | ||
106 | 0 89 0x04 | ||
107 | 0 125 0x04 >; | ||
59 | #gpio-cells = <2>; | 108 | #gpio-cells = <2>; |
60 | gpio-controller; | 109 | gpio-controller; |
110 | #interrupt-cells = <2>; | ||
111 | interrupt-controller; | ||
61 | }; | 112 | }; |
62 | 113 | ||
63 | serial@70006000 { | 114 | serial@70006000 { |
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index c47d6199b784..f0783be17352 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c | |||
@@ -51,7 +51,6 @@ union gic_base { | |||
51 | }; | 51 | }; |
52 | 52 | ||
53 | struct gic_chip_data { | 53 | struct gic_chip_data { |
54 | unsigned int irq_offset; | ||
55 | union gic_base dist_base; | 54 | union gic_base dist_base; |
56 | union gic_base cpu_base; | 55 | union gic_base cpu_base; |
57 | #ifdef CONFIG_CPU_PM | 56 | #ifdef CONFIG_CPU_PM |
@@ -61,9 +60,7 @@ struct gic_chip_data { | |||
61 | u32 __percpu *saved_ppi_enable; | 60 | u32 __percpu *saved_ppi_enable; |
62 | u32 __percpu *saved_ppi_conf; | 61 | u32 __percpu *saved_ppi_conf; |
63 | #endif | 62 | #endif |
64 | #ifdef CONFIG_IRQ_DOMAIN | 63 | struct irq_domain *domain; |
65 | struct irq_domain domain; | ||
66 | #endif | ||
67 | unsigned int gic_irqs; | 64 | unsigned int gic_irqs; |
68 | #ifdef CONFIG_GIC_NON_BANKED | 65 | #ifdef CONFIG_GIC_NON_BANKED |
69 | void __iomem *(*get_base)(union gic_base *); | 66 | void __iomem *(*get_base)(union gic_base *); |
@@ -282,7 +279,7 @@ asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs) | |||
282 | irqnr = irqstat & ~0x1c00; | 279 | irqnr = irqstat & ~0x1c00; |
283 | 280 | ||
284 | if (likely(irqnr > 15 && irqnr < 1021)) { | 281 | if (likely(irqnr > 15 && irqnr < 1021)) { |
285 | irqnr = irq_domain_to_irq(&gic->domain, irqnr); | 282 | irqnr = irq_find_mapping(gic->domain, irqnr); |
286 | handle_IRQ(irqnr, regs); | 283 | handle_IRQ(irqnr, regs); |
287 | continue; | 284 | continue; |
288 | } | 285 | } |
@@ -314,8 +311,8 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) | |||
314 | if (gic_irq == 1023) | 311 | if (gic_irq == 1023) |
315 | goto out; | 312 | goto out; |
316 | 313 | ||
317 | cascade_irq = irq_domain_to_irq(&chip_data->domain, gic_irq); | 314 | cascade_irq = irq_find_mapping(chip_data->domain, gic_irq); |
318 | if (unlikely(gic_irq < 32 || gic_irq > 1020 || cascade_irq >= NR_IRQS)) | 315 | if (unlikely(gic_irq < 32 || gic_irq > 1020)) |
319 | do_bad_IRQ(cascade_irq, desc); | 316 | do_bad_IRQ(cascade_irq, desc); |
320 | else | 317 | else |
321 | generic_handle_irq(cascade_irq); | 318 | generic_handle_irq(cascade_irq); |
@@ -348,10 +345,9 @@ void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq) | |||
348 | 345 | ||
349 | static void __init gic_dist_init(struct gic_chip_data *gic) | 346 | static void __init gic_dist_init(struct gic_chip_data *gic) |
350 | { | 347 | { |
351 | unsigned int i, irq; | 348 | unsigned int i; |
352 | u32 cpumask; | 349 | u32 cpumask; |
353 | unsigned int gic_irqs = gic->gic_irqs; | 350 | unsigned int gic_irqs = gic->gic_irqs; |
354 | struct irq_domain *domain = &gic->domain; | ||
355 | void __iomem *base = gic_data_dist_base(gic); | 351 | void __iomem *base = gic_data_dist_base(gic); |
356 | u32 cpu = cpu_logical_map(smp_processor_id()); | 352 | u32 cpu = cpu_logical_map(smp_processor_id()); |
357 | 353 | ||
@@ -386,23 +382,6 @@ static void __init gic_dist_init(struct gic_chip_data *gic) | |||
386 | for (i = 32; i < gic_irqs; i += 32) | 382 | for (i = 32; i < gic_irqs; i += 32) |
387 | writel_relaxed(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32); | 383 | writel_relaxed(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32); |
388 | 384 | ||
389 | /* | ||
390 | * Setup the Linux IRQ subsystem. | ||
391 | */ | ||
392 | irq_domain_for_each_irq(domain, i, irq) { | ||
393 | if (i < 32) { | ||
394 | irq_set_percpu_devid(irq); | ||
395 | irq_set_chip_and_handler(irq, &gic_chip, | ||
396 | handle_percpu_devid_irq); | ||
397 | set_irq_flags(irq, IRQF_VALID | IRQF_NOAUTOEN); | ||
398 | } else { | ||
399 | irq_set_chip_and_handler(irq, &gic_chip, | ||
400 | handle_fasteoi_irq); | ||
401 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
402 | } | ||
403 | irq_set_chip_data(irq, gic); | ||
404 | } | ||
405 | |||
406 | writel_relaxed(1, base + GIC_DIST_CTRL); | 385 | writel_relaxed(1, base + GIC_DIST_CTRL); |
407 | } | 386 | } |
408 | 387 | ||
@@ -618,11 +597,27 @@ static void __init gic_pm_init(struct gic_chip_data *gic) | |||
618 | } | 597 | } |
619 | #endif | 598 | #endif |
620 | 599 | ||
621 | #ifdef CONFIG_OF | 600 | static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq, |
622 | static int gic_irq_domain_dt_translate(struct irq_domain *d, | 601 | irq_hw_number_t hw) |
623 | struct device_node *controller, | 602 | { |
624 | const u32 *intspec, unsigned int intsize, | 603 | if (hw < 32) { |
625 | unsigned long *out_hwirq, unsigned int *out_type) | 604 | irq_set_percpu_devid(irq); |
605 | irq_set_chip_and_handler(irq, &gic_chip, | ||
606 | handle_percpu_devid_irq); | ||
607 | set_irq_flags(irq, IRQF_VALID | IRQF_NOAUTOEN); | ||
608 | } else { | ||
609 | irq_set_chip_and_handler(irq, &gic_chip, | ||
610 | handle_fasteoi_irq); | ||
611 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
612 | } | ||
613 | irq_set_chip_data(irq, d->host_data); | ||
614 | return 0; | ||
615 | } | ||
616 | |||
617 | static int gic_irq_domain_xlate(struct irq_domain *d, | ||
618 | struct device_node *controller, | ||
619 | const u32 *intspec, unsigned int intsize, | ||
620 | unsigned long *out_hwirq, unsigned int *out_type) | ||
626 | { | 621 | { |
627 | if (d->of_node != controller) | 622 | if (d->of_node != controller) |
628 | return -EINVAL; | 623 | return -EINVAL; |
@@ -639,26 +634,23 @@ static int gic_irq_domain_dt_translate(struct irq_domain *d, | |||
639 | *out_type = intspec[2] & IRQ_TYPE_SENSE_MASK; | 634 | *out_type = intspec[2] & IRQ_TYPE_SENSE_MASK; |
640 | return 0; | 635 | return 0; |
641 | } | 636 | } |
642 | #endif | ||
643 | 637 | ||
644 | const struct irq_domain_ops gic_irq_domain_ops = { | 638 | const struct irq_domain_ops gic_irq_domain_ops = { |
645 | #ifdef CONFIG_OF | 639 | .map = gic_irq_domain_map, |
646 | .dt_translate = gic_irq_domain_dt_translate, | 640 | .xlate = gic_irq_domain_xlate, |
647 | #endif | ||
648 | }; | 641 | }; |
649 | 642 | ||
650 | void __init gic_init_bases(unsigned int gic_nr, int irq_start, | 643 | void __init gic_init_bases(unsigned int gic_nr, int irq_start, |
651 | void __iomem *dist_base, void __iomem *cpu_base, | 644 | void __iomem *dist_base, void __iomem *cpu_base, |
652 | u32 percpu_offset) | 645 | u32 percpu_offset, struct device_node *node) |
653 | { | 646 | { |
647 | irq_hw_number_t hwirq_base; | ||
654 | struct gic_chip_data *gic; | 648 | struct gic_chip_data *gic; |
655 | struct irq_domain *domain; | 649 | int gic_irqs, irq_base; |
656 | int gic_irqs; | ||
657 | 650 | ||
658 | BUG_ON(gic_nr >= MAX_GIC_NR); | 651 | BUG_ON(gic_nr >= MAX_GIC_NR); |
659 | 652 | ||
660 | gic = &gic_data[gic_nr]; | 653 | gic = &gic_data[gic_nr]; |
661 | domain = &gic->domain; | ||
662 | #ifdef CONFIG_GIC_NON_BANKED | 654 | #ifdef CONFIG_GIC_NON_BANKED |
663 | if (percpu_offset) { /* Frankein-GIC without banked registers... */ | 655 | if (percpu_offset) { /* Frankein-GIC without banked registers... */ |
664 | unsigned int cpu; | 656 | unsigned int cpu; |
@@ -694,10 +686,10 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, | |||
694 | * For primary GICs, skip over SGIs. | 686 | * For primary GICs, skip over SGIs. |
695 | * For secondary GICs, skip over PPIs, too. | 687 | * For secondary GICs, skip over PPIs, too. |
696 | */ | 688 | */ |
697 | domain->hwirq_base = 32; | 689 | hwirq_base = 32; |
698 | if (gic_nr == 0) { | 690 | if (gic_nr == 0) { |
699 | if ((irq_start & 31) > 0) { | 691 | if ((irq_start & 31) > 0) { |
700 | domain->hwirq_base = 16; | 692 | hwirq_base = 16; |
701 | if (irq_start != -1) | 693 | if (irq_start != -1) |
702 | irq_start = (irq_start & ~31) + 16; | 694 | irq_start = (irq_start & ~31) + 16; |
703 | } | 695 | } |
@@ -713,17 +705,17 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, | |||
713 | gic_irqs = 1020; | 705 | gic_irqs = 1020; |
714 | gic->gic_irqs = gic_irqs; | 706 | gic->gic_irqs = gic_irqs; |
715 | 707 | ||
716 | domain->nr_irq = gic_irqs - domain->hwirq_base; | 708 | gic_irqs -= hwirq_base; /* calculate # of irqs to allocate */ |
717 | domain->irq_base = irq_alloc_descs(irq_start, 16, domain->nr_irq, | 709 | irq_base = irq_alloc_descs(irq_start, 16, gic_irqs, numa_node_id()); |
718 | numa_node_id()); | 710 | if (IS_ERR_VALUE(irq_base)) { |
719 | if (IS_ERR_VALUE(domain->irq_base)) { | ||
720 | WARN(1, "Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n", | 711 | WARN(1, "Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n", |
721 | irq_start); | 712 | irq_start); |
722 | domain->irq_base = irq_start; | 713 | irq_base = irq_start; |
723 | } | 714 | } |
724 | domain->priv = gic; | 715 | gic->domain = irq_domain_add_legacy(node, gic_irqs, irq_base, |
725 | domain->ops = &gic_irq_domain_ops; | 716 | hwirq_base, &gic_irq_domain_ops, gic); |
726 | irq_domain_add(domain); | 717 | if (WARN_ON(!gic->domain)) |
718 | return; | ||
727 | 719 | ||
728 | gic_chip.flags |= gic_arch_extn.flags; | 720 | gic_chip.flags |= gic_arch_extn.flags; |
729 | gic_dist_init(gic); | 721 | gic_dist_init(gic); |
@@ -768,7 +760,6 @@ int __init gic_of_init(struct device_node *node, struct device_node *parent) | |||
768 | void __iomem *dist_base; | 760 | void __iomem *dist_base; |
769 | u32 percpu_offset; | 761 | u32 percpu_offset; |
770 | int irq; | 762 | int irq; |
771 | struct irq_domain *domain = &gic_data[gic_cnt].domain; | ||
772 | 763 | ||
773 | if (WARN_ON(!node)) | 764 | if (WARN_ON(!node)) |
774 | return -ENODEV; | 765 | return -ENODEV; |
@@ -782,9 +773,7 @@ int __init gic_of_init(struct device_node *node, struct device_node *parent) | |||
782 | if (of_property_read_u32(node, "cpu-offset", &percpu_offset)) | 773 | if (of_property_read_u32(node, "cpu-offset", &percpu_offset)) |
783 | percpu_offset = 0; | 774 | percpu_offset = 0; |
784 | 775 | ||
785 | domain->of_node = of_node_get(node); | 776 | gic_init_bases(gic_cnt, -1, dist_base, cpu_base, percpu_offset, node); |
786 | |||
787 | gic_init_bases(gic_cnt, -1, dist_base, cpu_base, percpu_offset); | ||
788 | 777 | ||
789 | if (parent) { | 778 | if (parent) { |
790 | irq = irq_of_parse_and_map(node, 0); | 779 | irq = irq_of_parse_and_map(node, 0); |
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c index dcb004a804c7..7a66311f3066 100644 --- a/arch/arm/common/vic.c +++ b/arch/arm/common/vic.c | |||
@@ -56,7 +56,7 @@ struct vic_device { | |||
56 | u32 int_enable; | 56 | u32 int_enable; |
57 | u32 soft_int; | 57 | u32 soft_int; |
58 | u32 protect; | 58 | u32 protect; |
59 | struct irq_domain domain; | 59 | struct irq_domain *domain; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | /* we cannot allocate memory when VICs are initially registered */ | 62 | /* we cannot allocate memory when VICs are initially registered */ |
@@ -192,14 +192,8 @@ static void __init vic_register(void __iomem *base, unsigned int irq, | |||
192 | v->resume_sources = resume_sources; | 192 | v->resume_sources = resume_sources; |
193 | v->irq = irq; | 193 | v->irq = irq; |
194 | vic_id++; | 194 | vic_id++; |
195 | 195 | v->domain = irq_domain_add_legacy(node, 32, irq, 0, | |
196 | v->domain.irq_base = irq; | 196 | &irq_domain_simple_ops, v); |
197 | v->domain.nr_irq = 32; | ||
198 | #ifdef CONFIG_OF_IRQ | ||
199 | v->domain.of_node = of_node_get(node); | ||
200 | #endif /* CONFIG_OF */ | ||
201 | v->domain.ops = &irq_domain_simple_ops; | ||
202 | irq_domain_add(&v->domain); | ||
203 | } | 197 | } |
204 | 198 | ||
205 | static void vic_ack_irq(struct irq_data *d) | 199 | static void vic_ack_irq(struct irq_data *d) |
@@ -348,7 +342,7 @@ static void __init vic_init_st(void __iomem *base, unsigned int irq_start, | |||
348 | vic_register(base, irq_start, 0, node); | 342 | vic_register(base, irq_start, 0, node); |
349 | } | 343 | } |
350 | 344 | ||
351 | static void __init __vic_init(void __iomem *base, unsigned int irq_start, | 345 | void __init __vic_init(void __iomem *base, unsigned int irq_start, |
352 | u32 vic_sources, u32 resume_sources, | 346 | u32 vic_sources, u32 resume_sources, |
353 | struct device_node *node) | 347 | struct device_node *node) |
354 | { | 348 | { |
@@ -444,7 +438,7 @@ static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs) | |||
444 | stat = readl_relaxed(vic->base + VIC_IRQ_STATUS); | 438 | stat = readl_relaxed(vic->base + VIC_IRQ_STATUS); |
445 | while (stat) { | 439 | while (stat) { |
446 | irq = ffs(stat) - 1; | 440 | irq = ffs(stat) - 1; |
447 | handle_IRQ(irq_domain_to_irq(&vic->domain, irq), regs); | 441 | handle_IRQ(irq_find_mapping(vic->domain, irq), regs); |
448 | stat &= ~(1 << irq); | 442 | stat &= ~(1 << irq); |
449 | handled = 1; | 443 | handled = 1; |
450 | } | 444 | } |
diff --git a/arch/arm/configs/at91cap9_defconfig b/arch/arm/configs/at91cap9_defconfig deleted file mode 100644 index 8826eb218e73..000000000000 --- a/arch/arm/configs/at91cap9_defconfig +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | # CONFIG_LOCALVERSION_AUTO is not set | ||
3 | # CONFIG_SWAP is not set | ||
4 | CONFIG_SYSVIPC=y | ||
5 | CONFIG_LOG_BUF_SHIFT=14 | ||
6 | CONFIG_BLK_DEV_INITRD=y | ||
7 | CONFIG_SLAB=y | ||
8 | CONFIG_MODULES=y | ||
9 | CONFIG_MODULE_UNLOAD=y | ||
10 | # CONFIG_BLK_DEV_BSG is not set | ||
11 | # CONFIG_IOSCHED_DEADLINE is not set | ||
12 | # CONFIG_IOSCHED_CFQ is not set | ||
13 | CONFIG_ARCH_AT91=y | ||
14 | CONFIG_ARCH_AT91CAP9=y | ||
15 | CONFIG_MACH_AT91CAP9ADK=y | ||
16 | CONFIG_MTD_AT91_DATAFLASH_CARD=y | ||
17 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
18 | # CONFIG_ARM_THUMB is not set | ||
19 | CONFIG_AEABI=y | ||
20 | CONFIG_LEDS=y | ||
21 | CONFIG_LEDS_CPU=y | ||
22 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
23 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
24 | CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/ram0 rw" | ||
25 | CONFIG_FPE_NWFPE=y | ||
26 | CONFIG_NET=y | ||
27 | CONFIG_PACKET=y | ||
28 | CONFIG_UNIX=y | ||
29 | CONFIG_INET=y | ||
30 | CONFIG_IP_PNP=y | ||
31 | CONFIG_IP_PNP_BOOTP=y | ||
32 | CONFIG_IP_PNP_RARP=y | ||
33 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
34 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
35 | # CONFIG_INET_XFRM_MODE_BEET is not set | ||
36 | # CONFIG_INET_LRO is not set | ||
37 | # CONFIG_INET_DIAG is not set | ||
38 | # CONFIG_IPV6 is not set | ||
39 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
40 | CONFIG_MTD=y | ||
41 | CONFIG_MTD_CMDLINE_PARTS=y | ||
42 | CONFIG_MTD_CHAR=y | ||
43 | CONFIG_MTD_BLOCK=y | ||
44 | CONFIG_MTD_CFI=y | ||
45 | CONFIG_MTD_JEDECPROBE=y | ||
46 | CONFIG_MTD_CFI_AMDSTD=y | ||
47 | CONFIG_MTD_PHYSMAP=y | ||
48 | CONFIG_MTD_DATAFLASH=y | ||
49 | CONFIG_MTD_NAND=y | ||
50 | CONFIG_MTD_NAND_ATMEL=y | ||
51 | CONFIG_BLK_DEV_LOOP=y | ||
52 | CONFIG_BLK_DEV_RAM=y | ||
53 | CONFIG_BLK_DEV_RAM_SIZE=8192 | ||
54 | CONFIG_SCSI=y | ||
55 | CONFIG_BLK_DEV_SD=y | ||
56 | CONFIG_SCSI_MULTI_LUN=y | ||
57 | CONFIG_NETDEVICES=y | ||
58 | CONFIG_MII=y | ||
59 | CONFIG_MACB=y | ||
60 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | ||
61 | CONFIG_INPUT_EVDEV=y | ||
62 | # CONFIG_INPUT_KEYBOARD is not set | ||
63 | # CONFIG_INPUT_MOUSE is not set | ||
64 | CONFIG_INPUT_TOUCHSCREEN=y | ||
65 | CONFIG_TOUCHSCREEN_ADS7846=y | ||
66 | # CONFIG_SERIO is not set | ||
67 | CONFIG_SERIAL_ATMEL=y | ||
68 | CONFIG_SERIAL_ATMEL_CONSOLE=y | ||
69 | CONFIG_HW_RANDOM=y | ||
70 | CONFIG_I2C=y | ||
71 | CONFIG_I2C_CHARDEV=y | ||
72 | CONFIG_SPI=y | ||
73 | CONFIG_SPI_ATMEL=y | ||
74 | # CONFIG_HWMON is not set | ||
75 | CONFIG_WATCHDOG=y | ||
76 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
77 | CONFIG_FB=y | ||
78 | CONFIG_FB_ATMEL=y | ||
79 | CONFIG_LOGO=y | ||
80 | # CONFIG_LOGO_LINUX_MONO is not set | ||
81 | # CONFIG_LOGO_LINUX_CLUT224 is not set | ||
82 | # CONFIG_USB_HID is not set | ||
83 | CONFIG_USB=y | ||
84 | CONFIG_USB_DEVICEFS=y | ||
85 | CONFIG_USB_MON=y | ||
86 | CONFIG_USB_OHCI_HCD=y | ||
87 | CONFIG_USB_STORAGE=y | ||
88 | CONFIG_USB_GADGET=y | ||
89 | CONFIG_USB_ETH=m | ||
90 | CONFIG_USB_FILE_STORAGE=m | ||
91 | CONFIG_MMC=y | ||
92 | CONFIG_MMC_AT91=m | ||
93 | CONFIG_RTC_CLASS=y | ||
94 | CONFIG_RTC_DRV_AT91SAM9=y | ||
95 | CONFIG_EXT2_FS=y | ||
96 | CONFIG_VFAT_FS=y | ||
97 | CONFIG_TMPFS=y | ||
98 | CONFIG_JFFS2_FS=y | ||
99 | CONFIG_CRAMFS=y | ||
100 | CONFIG_NFS_FS=y | ||
101 | CONFIG_ROOT_NFS=y | ||
102 | CONFIG_NLS_CODEPAGE_437=y | ||
103 | CONFIG_NLS_CODEPAGE_850=y | ||
104 | CONFIG_NLS_ISO8859_1=y | ||
105 | CONFIG_DEBUG_FS=y | ||
106 | CONFIG_DEBUG_KERNEL=y | ||
107 | CONFIG_DEBUG_INFO=y | ||
108 | CONFIG_DEBUG_USER=y | ||
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index a22e93079063..d9eddfd77428 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig | |||
@@ -45,6 +45,7 @@ CONFIG_FPE_NWFPE=y | |||
45 | CONFIG_FPE_NWFPE_XP=y | 45 | CONFIG_FPE_NWFPE_XP=y |
46 | CONFIG_PM_DEBUG=y | 46 | CONFIG_PM_DEBUG=y |
47 | CONFIG_NET=y | 47 | CONFIG_NET=y |
48 | CONFIG_SMSC911X=y | ||
48 | CONFIG_PACKET=y | 49 | CONFIG_PACKET=y |
49 | CONFIG_UNIX=y | 50 | CONFIG_UNIX=y |
50 | CONFIG_INET=y | 51 | CONFIG_INET=y |
@@ -78,6 +79,8 @@ CONFIG_MISC_DEVICES=y | |||
78 | CONFIG_EEPROM_AT24=y | 79 | CONFIG_EEPROM_AT24=y |
79 | CONFIG_EEPROM_AT25=y | 80 | CONFIG_EEPROM_AT25=y |
80 | CONFIG_NETDEVICES=y | 81 | CONFIG_NETDEVICES=y |
82 | CONFIG_CS89x0=y | ||
83 | CONFIG_CS89x0_PLATFORM=y | ||
81 | CONFIG_DM9000=y | 84 | CONFIG_DM9000=y |
82 | CONFIG_SMC91X=y | 85 | CONFIG_SMC91X=y |
83 | CONFIG_SMC911X=y | 86 | CONFIG_SMC911X=y |
@@ -115,6 +118,21 @@ CONFIG_FB_IMX=y | |||
115 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | 118 | CONFIG_BACKLIGHT_LCD_SUPPORT=y |
116 | CONFIG_LCD_CLASS_DEVICE=y | 119 | CONFIG_LCD_CLASS_DEVICE=y |
117 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | 120 | CONFIG_BACKLIGHT_CLASS_DEVICE=y |
121 | CONFIG_LCD_L4F00242T03=y | ||
122 | CONFIG_MEDIA_SUPPORT=y | ||
123 | CONFIG_VIDEO_DEV=y | ||
124 | CONFIG_VIDEO_V4L2_COMMON=y | ||
125 | CONFIG_VIDEO_MEDIA=y | ||
126 | CONFIG_VIDEO_V4L2=y | ||
127 | CONFIG_VIDEOBUF_GEN=y | ||
128 | CONFIG_VIDEOBUF_DMA_CONTIG=y | ||
129 | CONFIG_VIDEOBUF2_CORE=y | ||
130 | CONFIG_VIDEO_CAPTURE_DRIVERS=y | ||
131 | CONFIG_V4L_PLATFORM_DRIVERS=y | ||
132 | CONFIG_SOC_CAMERA=y | ||
133 | CONFIG_SOC_CAMERA_OV2640=y | ||
134 | CONFIG_VIDEO_MX2_HOSTSUPPORT=y | ||
135 | CONFIG_VIDEO_MX2=y | ||
118 | CONFIG_BACKLIGHT_PWM=y | 136 | CONFIG_BACKLIGHT_PWM=y |
119 | CONFIG_FRAMEBUFFER_CONSOLE=y | 137 | CONFIG_FRAMEBUFFER_CONSOLE=y |
120 | CONFIG_FONTS=y | 138 | CONFIG_FONTS=y |
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 3a4fb2e5fc68..6ae457aeea49 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig | |||
@@ -26,7 +26,6 @@ CONFIG_MACH_ARMADILLO5X0=y | |||
26 | CONFIG_MACH_KZM_ARM11_01=y | 26 | CONFIG_MACH_KZM_ARM11_01=y |
27 | CONFIG_MACH_PCM043=y | 27 | CONFIG_MACH_PCM043=y |
28 | CONFIG_MACH_MX35_3DS=y | 28 | CONFIG_MACH_MX35_3DS=y |
29 | CONFIG_MACH_EUKREA_CPUIMX35=y | ||
30 | CONFIG_MACH_VPR200=y | 29 | CONFIG_MACH_VPR200=y |
31 | CONFIG_MACH_IMX51_DT=y | 30 | CONFIG_MACH_IMX51_DT=y |
32 | CONFIG_MACH_MX51_3DS=y | 31 | CONFIG_MACH_MX51_3DS=y |
@@ -82,8 +81,9 @@ CONFIG_PATA_IMX=y | |||
82 | CONFIG_NETDEVICES=y | 81 | CONFIG_NETDEVICES=y |
83 | # CONFIG_NET_VENDOR_BROADCOM is not set | 82 | # CONFIG_NET_VENDOR_BROADCOM is not set |
84 | # CONFIG_NET_VENDOR_CHELSIO is not set | 83 | # CONFIG_NET_VENDOR_CHELSIO is not set |
84 | CONFIG_CS89x0=y | ||
85 | CONFIG_CS89x0_PLATFORM=y | ||
85 | # CONFIG_NET_VENDOR_FARADAY is not set | 86 | # CONFIG_NET_VENDOR_FARADAY is not set |
86 | CONFIG_FEC=y | ||
87 | # CONFIG_NET_VENDOR_INTEL is not set | 87 | # CONFIG_NET_VENDOR_INTEL is not set |
88 | # CONFIG_NET_VENDOR_MARVELL is not set | 88 | # CONFIG_NET_VENDOR_MARVELL is not set |
89 | # CONFIG_NET_VENDOR_MICREL is not set | 89 | # CONFIG_NET_VENDOR_MICREL is not set |
@@ -126,7 +126,39 @@ CONFIG_WATCHDOG=y | |||
126 | CONFIG_IMX2_WDT=y | 126 | CONFIG_IMX2_WDT=y |
127 | CONFIG_MFD_MC13XXX=y | 127 | CONFIG_MFD_MC13XXX=y |
128 | CONFIG_REGULATOR=y | 128 | CONFIG_REGULATOR=y |
129 | CONFIG_REGULATOR_MC13783=y | ||
129 | CONFIG_REGULATOR_MC13892=y | 130 | CONFIG_REGULATOR_MC13892=y |
131 | CONFIG_MEDIA_SUPPORT=y | ||
132 | CONFIG_VIDEO_V4L2=y | ||
133 | CONFIG_VIDEO_DEV=y | ||
134 | CONFIG_VIDEO_V4L2_COMMON=y | ||
135 | CONFIG_VIDEOBUF_GEN=y | ||
136 | CONFIG_VIDEOBUF2_CORE=y | ||
137 | CONFIG_VIDEOBUF2_MEMOPS=y | ||
138 | CONFIG_VIDEOBUF2_DMA_CONTIG=y | ||
139 | CONFIG_VIDEO_CAPTURE_DRIVERS=y | ||
140 | CONFIG_V4L_PLATFORM_DRIVERS=y | ||
141 | CONFIG_SOC_CAMERA=y | ||
142 | CONFIG_SOC_CAMERA_OV2640=y | ||
143 | CONFIG_MX3_VIDEO=y | ||
144 | CONFIG_VIDEO_MX3=y | ||
145 | CONFIG_FB=y | ||
146 | CONFIG_FB_MX3=y | ||
147 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | ||
148 | CONFIG_LCD_CLASS_DEVICE=y | ||
149 | CONFIG_LCD_L4F00242T03=y | ||
150 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | ||
151 | CONFIG_BACKLIGHT_GENERIC=y | ||
152 | CONFIG_DUMMY_CONSOLE=y | ||
153 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
154 | CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | ||
155 | CONFIG_FONTS=y | ||
156 | CONFIG_FONT_8x8=y | ||
157 | CONFIG_FONT_8x16=y | ||
158 | CONFIG_LOGO=y | ||
159 | CONFIG_LOGO_LINUX_MONO=y | ||
160 | CONFIG_LOGO_LINUX_VGA16=y | ||
161 | CONFIG_LOGO_LINUX_CLUT224=y | ||
130 | CONFIG_USB=y | 162 | CONFIG_USB=y |
131 | CONFIG_USB_EHCI_HCD=y | 163 | CONFIG_USB_EHCI_HCD=y |
132 | CONFIG_USB_EHCI_MXC=y | 164 | CONFIG_USB_EHCI_MXC=y |
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig index 443675d317e6..a691ef4c6008 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig | |||
@@ -101,7 +101,7 @@ CONFIG_MFD_ASIC3=y | |||
101 | CONFIG_HTC_EGPIO=y | 101 | CONFIG_HTC_EGPIO=y |
102 | CONFIG_HTC_PASIC3=y | 102 | CONFIG_HTC_PASIC3=y |
103 | CONFIG_REGULATOR=y | 103 | CONFIG_REGULATOR=y |
104 | CONFIG_REGULATOR_BQ24022=y | 104 | CONFIG_REGULATOR_GPIO=y |
105 | CONFIG_FB=y | 105 | CONFIG_FB=y |
106 | CONFIG_FB_PXA=y | 106 | CONFIG_FB_PXA=y |
107 | CONFIG_FB_PXA_OVERLAY=y | 107 | CONFIG_FB_PXA_OVERLAY=y |
diff --git a/arch/arm/include/asm/hardware/gic.h b/arch/arm/include/asm/hardware/gic.h index 4bdfe0018696..4b1ce6cd477f 100644 --- a/arch/arm/include/asm/hardware/gic.h +++ b/arch/arm/include/asm/hardware/gic.h | |||
@@ -39,7 +39,7 @@ struct device_node; | |||
39 | extern struct irq_chip gic_arch_extn; | 39 | extern struct irq_chip gic_arch_extn; |
40 | 40 | ||
41 | void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, | 41 | void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, |
42 | u32 offset); | 42 | u32 offset, struct device_node *); |
43 | int gic_of_init(struct device_node *node, struct device_node *parent); | 43 | int gic_of_init(struct device_node *node, struct device_node *parent); |
44 | void gic_secondary_init(unsigned int); | 44 | void gic_secondary_init(unsigned int); |
45 | void gic_handle_irq(struct pt_regs *regs); | 45 | void gic_handle_irq(struct pt_regs *regs); |
@@ -49,7 +49,7 @@ void gic_raise_softirq(const struct cpumask *mask, unsigned int irq); | |||
49 | static inline void gic_init(unsigned int nr, int start, | 49 | static inline void gic_init(unsigned int nr, int start, |
50 | void __iomem *dist , void __iomem *cpu) | 50 | void __iomem *dist , void __iomem *cpu) |
51 | { | 51 | { |
52 | gic_init_bases(nr, start, dist, cpu, 0); | 52 | gic_init_bases(nr, start, dist, cpu, 0, NULL); |
53 | } | 53 | } |
54 | 54 | ||
55 | #endif | 55 | #endif |
diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h index f42ebd619590..e14af1a1a320 100644 --- a/arch/arm/include/asm/hardware/vic.h +++ b/arch/arm/include/asm/hardware/vic.h | |||
@@ -47,6 +47,8 @@ | |||
47 | struct device_node; | 47 | struct device_node; |
48 | struct pt_regs; | 48 | struct pt_regs; |
49 | 49 | ||
50 | void __vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, | ||
51 | u32 resume_sources, struct device_node *node); | ||
50 | void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); | 52 | void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); |
51 | int vic_of_init(struct device_node *node, struct device_node *parent); | 53 | int vic_of_init(struct device_node *node, struct device_node *parent); |
52 | void vic_handle_irq(struct pt_regs *regs); | 54 | void vic_handle_irq(struct pt_regs *regs); |
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 71feb00a1e99..0284e66c47f9 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -102,15 +102,6 @@ config ARCH_AT91SAM9G45 | |||
102 | select HAVE_AT91_DBGU1 | 102 | select HAVE_AT91_DBGU1 |
103 | select AT91_SAM9G45_RESET | 103 | select AT91_SAM9G45_RESET |
104 | 104 | ||
105 | config ARCH_AT91CAP9 | ||
106 | bool "AT91CAP9" | ||
107 | select CPU_ARM926T | ||
108 | select GENERIC_CLOCKEVENTS | ||
109 | select HAVE_FB_ATMEL | ||
110 | select HAVE_NET_MACB | ||
111 | select HAVE_AT91_DBGU1 | ||
112 | select AT91_SAM9G45_RESET | ||
113 | |||
114 | config ARCH_AT91X40 | 105 | config ARCH_AT91X40 |
115 | bool "AT91x40" | 106 | bool "AT91x40" |
116 | select ARCH_USES_GETTIMEOFFSET | 107 | select ARCH_USES_GETTIMEOFFSET |
@@ -447,21 +438,6 @@ endif | |||
447 | 438 | ||
448 | # ---------------------------------------------------------- | 439 | # ---------------------------------------------------------- |
449 | 440 | ||
450 | if ARCH_AT91CAP9 | ||
451 | |||
452 | comment "AT91CAP9 Board Type" | ||
453 | |||
454 | config MACH_AT91CAP9ADK | ||
455 | bool "Atmel AT91CAP9A-DK Evaluation Kit" | ||
456 | select HAVE_AT91_DATAFLASH_CARD | ||
457 | help | ||
458 | Select this if you are using Atmel's AT91CAP9A-DK Evaluation Kit. | ||
459 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4138> | ||
460 | |||
461 | endif | ||
462 | |||
463 | # ---------------------------------------------------------- | ||
464 | |||
465 | if ARCH_AT91X40 | 441 | if ARCH_AT91X40 |
466 | 442 | ||
467 | comment "AT91X40 Board Type" | 443 | comment "AT91X40 Board Type" |
@@ -544,7 +520,7 @@ config AT91_EARLY_DBGU0 | |||
544 | depends on HAVE_AT91_DBGU0 | 520 | depends on HAVE_AT91_DBGU0 |
545 | 521 | ||
546 | config AT91_EARLY_DBGU1 | 522 | config AT91_EARLY_DBGU1 |
547 | bool "DBGU on 9263, 9g45 and cap9" | 523 | bool "DBGU on 9263 and 9g45" |
548 | depends on HAVE_AT91_DBGU1 | 524 | depends on HAVE_AT91_DBGU1 |
549 | 525 | ||
550 | config AT91_EARLY_USART0 | 526 | config AT91_EARLY_USART0 |
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 705e1fbded39..aeb76f1690d9 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
@@ -20,7 +20,6 @@ obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_d | |||
20 | obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o | 20 | obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o |
21 | obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o | 21 | obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o |
22 | obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o | 22 | obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o |
23 | obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o sam9_smc.o | ||
24 | obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o | 23 | obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o |
25 | 24 | ||
26 | # AT91RM9200 board-specific support | 25 | # AT91RM9200 board-specific support |
@@ -81,9 +80,6 @@ obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o | |||
81 | # AT91SAM board with device-tree | 80 | # AT91SAM board with device-tree |
82 | obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o | 81 | obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o |
83 | 82 | ||
84 | # AT91CAP9 board-specific support | ||
85 | obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o | ||
86 | |||
87 | # AT91X40 board-specific support | 83 | # AT91X40 board-specific support |
88 | obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o | 84 | obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o |
89 | 85 | ||
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot index 8ddafadfdc7d..2fd051eb2449 100644 --- a/arch/arm/mach-at91/Makefile.boot +++ b/arch/arm/mach-at91/Makefile.boot | |||
@@ -3,11 +3,7 @@ | |||
3 | # PARAMS_PHYS must be within 4MB of ZRELADDR | 3 | # PARAMS_PHYS must be within 4MB of ZRELADDR |
4 | # INITRD_PHYS must be in RAM | 4 | # INITRD_PHYS must be in RAM |
5 | 5 | ||
6 | ifeq ($(CONFIG_ARCH_AT91CAP9),y) | 6 | ifeq ($(CONFIG_ARCH_AT91SAM9G45),y) |
7 | zreladdr-y += 0x70008000 | ||
8 | params_phys-y := 0x70000100 | ||
9 | initrd_phys-y := 0x70410000 | ||
10 | else ifeq ($(CONFIG_ARCH_AT91SAM9G45),y) | ||
11 | zreladdr-y += 0x70008000 | 7 | zreladdr-y += 0x70008000 |
12 | params_phys-y := 0x70000100 | 8 | params_phys-y := 0x70000100 |
13 | initrd_phys-y := 0x70410000 | 9 | initrd_phys-y := 0x70410000 |
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c deleted file mode 100644 index 8967d75c2ea3..000000000000 --- a/arch/arm/mach-at91/at91cap9.c +++ /dev/null | |||
@@ -1,404 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/at91cap9.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> | ||
5 | * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> | ||
6 | * Copyright (C) 2007 Atmel Corporation. | ||
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 | |||
15 | #include <linux/module.h> | ||
16 | |||
17 | #include <asm/proc-fns.h> | ||
18 | #include <asm/irq.h> | ||
19 | #include <asm/mach/arch.h> | ||
20 | #include <asm/mach/map.h> | ||
21 | |||
22 | #include <mach/cpu.h> | ||
23 | #include <mach/at91cap9.h> | ||
24 | #include <mach/at91_pmc.h> | ||
25 | |||
26 | #include "soc.h" | ||
27 | #include "generic.h" | ||
28 | #include "clock.h" | ||
29 | #include "sam9_smc.h" | ||
30 | |||
31 | /* -------------------------------------------------------------------- | ||
32 | * Clocks | ||
33 | * -------------------------------------------------------------------- */ | ||
34 | |||
35 | /* | ||
36 | * The peripheral clocks. | ||
37 | */ | ||
38 | static struct clk pioABCD_clk = { | ||
39 | .name = "pioABCD_clk", | ||
40 | .pmc_mask = 1 << AT91CAP9_ID_PIOABCD, | ||
41 | .type = CLK_TYPE_PERIPHERAL, | ||
42 | }; | ||
43 | static struct clk mpb0_clk = { | ||
44 | .name = "mpb0_clk", | ||
45 | .pmc_mask = 1 << AT91CAP9_ID_MPB0, | ||
46 | .type = CLK_TYPE_PERIPHERAL, | ||
47 | }; | ||
48 | static struct clk mpb1_clk = { | ||
49 | .name = "mpb1_clk", | ||
50 | .pmc_mask = 1 << AT91CAP9_ID_MPB1, | ||
51 | .type = CLK_TYPE_PERIPHERAL, | ||
52 | }; | ||
53 | static struct clk mpb2_clk = { | ||
54 | .name = "mpb2_clk", | ||
55 | .pmc_mask = 1 << AT91CAP9_ID_MPB2, | ||
56 | .type = CLK_TYPE_PERIPHERAL, | ||
57 | }; | ||
58 | static struct clk mpb3_clk = { | ||
59 | .name = "mpb3_clk", | ||
60 | .pmc_mask = 1 << AT91CAP9_ID_MPB3, | ||
61 | .type = CLK_TYPE_PERIPHERAL, | ||
62 | }; | ||
63 | static struct clk mpb4_clk = { | ||
64 | .name = "mpb4_clk", | ||
65 | .pmc_mask = 1 << AT91CAP9_ID_MPB4, | ||
66 | .type = CLK_TYPE_PERIPHERAL, | ||
67 | }; | ||
68 | static struct clk usart0_clk = { | ||
69 | .name = "usart0_clk", | ||
70 | .pmc_mask = 1 << AT91CAP9_ID_US0, | ||
71 | .type = CLK_TYPE_PERIPHERAL, | ||
72 | }; | ||
73 | static struct clk usart1_clk = { | ||
74 | .name = "usart1_clk", | ||
75 | .pmc_mask = 1 << AT91CAP9_ID_US1, | ||
76 | .type = CLK_TYPE_PERIPHERAL, | ||
77 | }; | ||
78 | static struct clk usart2_clk = { | ||
79 | .name = "usart2_clk", | ||
80 | .pmc_mask = 1 << AT91CAP9_ID_US2, | ||
81 | .type = CLK_TYPE_PERIPHERAL, | ||
82 | }; | ||
83 | static struct clk mmc0_clk = { | ||
84 | .name = "mci0_clk", | ||
85 | .pmc_mask = 1 << AT91CAP9_ID_MCI0, | ||
86 | .type = CLK_TYPE_PERIPHERAL, | ||
87 | }; | ||
88 | static struct clk mmc1_clk = { | ||
89 | .name = "mci1_clk", | ||
90 | .pmc_mask = 1 << AT91CAP9_ID_MCI1, | ||
91 | .type = CLK_TYPE_PERIPHERAL, | ||
92 | }; | ||
93 | static struct clk can_clk = { | ||
94 | .name = "can_clk", | ||
95 | .pmc_mask = 1 << AT91CAP9_ID_CAN, | ||
96 | .type = CLK_TYPE_PERIPHERAL, | ||
97 | }; | ||
98 | static struct clk twi_clk = { | ||
99 | .name = "twi_clk", | ||
100 | .pmc_mask = 1 << AT91CAP9_ID_TWI, | ||
101 | .type = CLK_TYPE_PERIPHERAL, | ||
102 | }; | ||
103 | static struct clk spi0_clk = { | ||
104 | .name = "spi0_clk", | ||
105 | .pmc_mask = 1 << AT91CAP9_ID_SPI0, | ||
106 | .type = CLK_TYPE_PERIPHERAL, | ||
107 | }; | ||
108 | static struct clk spi1_clk = { | ||
109 | .name = "spi1_clk", | ||
110 | .pmc_mask = 1 << AT91CAP9_ID_SPI1, | ||
111 | .type = CLK_TYPE_PERIPHERAL, | ||
112 | }; | ||
113 | static struct clk ssc0_clk = { | ||
114 | .name = "ssc0_clk", | ||
115 | .pmc_mask = 1 << AT91CAP9_ID_SSC0, | ||
116 | .type = CLK_TYPE_PERIPHERAL, | ||
117 | }; | ||
118 | static struct clk ssc1_clk = { | ||
119 | .name = "ssc1_clk", | ||
120 | .pmc_mask = 1 << AT91CAP9_ID_SSC1, | ||
121 | .type = CLK_TYPE_PERIPHERAL, | ||
122 | }; | ||
123 | static struct clk ac97_clk = { | ||
124 | .name = "ac97_clk", | ||
125 | .pmc_mask = 1 << AT91CAP9_ID_AC97C, | ||
126 | .type = CLK_TYPE_PERIPHERAL, | ||
127 | }; | ||
128 | static struct clk tcb_clk = { | ||
129 | .name = "tcb_clk", | ||
130 | .pmc_mask = 1 << AT91CAP9_ID_TCB, | ||
131 | .type = CLK_TYPE_PERIPHERAL, | ||
132 | }; | ||
133 | static struct clk pwm_clk = { | ||
134 | .name = "pwm_clk", | ||
135 | .pmc_mask = 1 << AT91CAP9_ID_PWMC, | ||
136 | .type = CLK_TYPE_PERIPHERAL, | ||
137 | }; | ||
138 | static struct clk macb_clk = { | ||
139 | .name = "pclk", | ||
140 | .pmc_mask = 1 << AT91CAP9_ID_EMAC, | ||
141 | .type = CLK_TYPE_PERIPHERAL, | ||
142 | }; | ||
143 | static struct clk aestdes_clk = { | ||
144 | .name = "aestdes_clk", | ||
145 | .pmc_mask = 1 << AT91CAP9_ID_AESTDES, | ||
146 | .type = CLK_TYPE_PERIPHERAL, | ||
147 | }; | ||
148 | static struct clk adc_clk = { | ||
149 | .name = "adc_clk", | ||
150 | .pmc_mask = 1 << AT91CAP9_ID_ADC, | ||
151 | .type = CLK_TYPE_PERIPHERAL, | ||
152 | }; | ||
153 | static struct clk isi_clk = { | ||
154 | .name = "isi_clk", | ||
155 | .pmc_mask = 1 << AT91CAP9_ID_ISI, | ||
156 | .type = CLK_TYPE_PERIPHERAL, | ||
157 | }; | ||
158 | static struct clk lcdc_clk = { | ||
159 | .name = "lcdc_clk", | ||
160 | .pmc_mask = 1 << AT91CAP9_ID_LCDC, | ||
161 | .type = CLK_TYPE_PERIPHERAL, | ||
162 | }; | ||
163 | static struct clk dma_clk = { | ||
164 | .name = "dma_clk", | ||
165 | .pmc_mask = 1 << AT91CAP9_ID_DMA, | ||
166 | .type = CLK_TYPE_PERIPHERAL, | ||
167 | }; | ||
168 | static struct clk udphs_clk = { | ||
169 | .name = "udphs_clk", | ||
170 | .pmc_mask = 1 << AT91CAP9_ID_UDPHS, | ||
171 | .type = CLK_TYPE_PERIPHERAL, | ||
172 | }; | ||
173 | static struct clk ohci_clk = { | ||
174 | .name = "ohci_clk", | ||
175 | .pmc_mask = 1 << AT91CAP9_ID_UHP, | ||
176 | .type = CLK_TYPE_PERIPHERAL, | ||
177 | }; | ||
178 | |||
179 | static struct clk *periph_clocks[] __initdata = { | ||
180 | &pioABCD_clk, | ||
181 | &mpb0_clk, | ||
182 | &mpb1_clk, | ||
183 | &mpb2_clk, | ||
184 | &mpb3_clk, | ||
185 | &mpb4_clk, | ||
186 | &usart0_clk, | ||
187 | &usart1_clk, | ||
188 | &usart2_clk, | ||
189 | &mmc0_clk, | ||
190 | &mmc1_clk, | ||
191 | &can_clk, | ||
192 | &twi_clk, | ||
193 | &spi0_clk, | ||
194 | &spi1_clk, | ||
195 | &ssc0_clk, | ||
196 | &ssc1_clk, | ||
197 | &ac97_clk, | ||
198 | &tcb_clk, | ||
199 | &pwm_clk, | ||
200 | &macb_clk, | ||
201 | &aestdes_clk, | ||
202 | &adc_clk, | ||
203 | &isi_clk, | ||
204 | &lcdc_clk, | ||
205 | &dma_clk, | ||
206 | &udphs_clk, | ||
207 | &ohci_clk, | ||
208 | // irq0 .. irq1 | ||
209 | }; | ||
210 | |||
211 | static struct clk_lookup periph_clocks_lookups[] = { | ||
212 | /* One additional fake clock for macb_hclk */ | ||
213 | CLKDEV_CON_ID("hclk", &macb_clk), | ||
214 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), | ||
215 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), | ||
216 | CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), | ||
217 | CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.1", &mmc1_clk), | ||
218 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | ||
219 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), | ||
220 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), | ||
221 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), | ||
222 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), | ||
223 | /* fake hclk clock */ | ||
224 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), | ||
225 | CLKDEV_CON_ID("pioA", &pioABCD_clk), | ||
226 | CLKDEV_CON_ID("pioB", &pioABCD_clk), | ||
227 | CLKDEV_CON_ID("pioC", &pioABCD_clk), | ||
228 | CLKDEV_CON_ID("pioD", &pioABCD_clk), | ||
229 | }; | ||
230 | |||
231 | static struct clk_lookup usart_clocks_lookups[] = { | ||
232 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.0", &mck), | ||
233 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.1", &usart0_clk), | ||
234 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.2", &usart1_clk), | ||
235 | CLKDEV_CON_DEV_ID("usart", "atmel_usart.3", &usart2_clk), | ||
236 | }; | ||
237 | |||
238 | /* | ||
239 | * The four programmable clocks. | ||
240 | * You must configure pin multiplexing to bring these signals out. | ||
241 | */ | ||
242 | static struct clk pck0 = { | ||
243 | .name = "pck0", | ||
244 | .pmc_mask = AT91_PMC_PCK0, | ||
245 | .type = CLK_TYPE_PROGRAMMABLE, | ||
246 | .id = 0, | ||
247 | }; | ||
248 | static struct clk pck1 = { | ||
249 | .name = "pck1", | ||
250 | .pmc_mask = AT91_PMC_PCK1, | ||
251 | .type = CLK_TYPE_PROGRAMMABLE, | ||
252 | .id = 1, | ||
253 | }; | ||
254 | static struct clk pck2 = { | ||
255 | .name = "pck2", | ||
256 | .pmc_mask = AT91_PMC_PCK2, | ||
257 | .type = CLK_TYPE_PROGRAMMABLE, | ||
258 | .id = 2, | ||
259 | }; | ||
260 | static struct clk pck3 = { | ||
261 | .name = "pck3", | ||
262 | .pmc_mask = AT91_PMC_PCK3, | ||
263 | .type = CLK_TYPE_PROGRAMMABLE, | ||
264 | .id = 3, | ||
265 | }; | ||
266 | |||
267 | static void __init at91cap9_register_clocks(void) | ||
268 | { | ||
269 | int i; | ||
270 | |||
271 | for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) | ||
272 | clk_register(periph_clocks[i]); | ||
273 | |||
274 | clkdev_add_table(periph_clocks_lookups, | ||
275 | ARRAY_SIZE(periph_clocks_lookups)); | ||
276 | clkdev_add_table(usart_clocks_lookups, | ||
277 | ARRAY_SIZE(usart_clocks_lookups)); | ||
278 | |||
279 | clk_register(&pck0); | ||
280 | clk_register(&pck1); | ||
281 | clk_register(&pck2); | ||
282 | clk_register(&pck3); | ||
283 | } | ||
284 | |||
285 | static struct clk_lookup console_clock_lookup; | ||
286 | |||
287 | void __init at91cap9_set_console_clock(int id) | ||
288 | { | ||
289 | if (id >= ARRAY_SIZE(usart_clocks_lookups)) | ||
290 | return; | ||
291 | |||
292 | console_clock_lookup.con_id = "usart"; | ||
293 | console_clock_lookup.clk = usart_clocks_lookups[id].clk; | ||
294 | clkdev_add(&console_clock_lookup); | ||
295 | } | ||
296 | |||
297 | /* -------------------------------------------------------------------- | ||
298 | * GPIO | ||
299 | * -------------------------------------------------------------------- */ | ||
300 | |||
301 | static struct at91_gpio_bank at91cap9_gpio[] __initdata = { | ||
302 | { | ||
303 | .id = AT91CAP9_ID_PIOABCD, | ||
304 | .regbase = AT91CAP9_BASE_PIOA, | ||
305 | }, { | ||
306 | .id = AT91CAP9_ID_PIOABCD, | ||
307 | .regbase = AT91CAP9_BASE_PIOB, | ||
308 | }, { | ||
309 | .id = AT91CAP9_ID_PIOABCD, | ||
310 | .regbase = AT91CAP9_BASE_PIOC, | ||
311 | }, { | ||
312 | .id = AT91CAP9_ID_PIOABCD, | ||
313 | .regbase = AT91CAP9_BASE_PIOD, | ||
314 | } | ||
315 | }; | ||
316 | |||
317 | static void at91cap9_idle(void) | ||
318 | { | ||
319 | at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK); | ||
320 | cpu_do_idle(); | ||
321 | } | ||
322 | |||
323 | /* -------------------------------------------------------------------- | ||
324 | * AT91CAP9 processor initialization | ||
325 | * -------------------------------------------------------------------- */ | ||
326 | |||
327 | static void __init at91cap9_map_io(void) | ||
328 | { | ||
329 | at91_init_sram(0, AT91CAP9_SRAM_BASE, AT91CAP9_SRAM_SIZE); | ||
330 | } | ||
331 | |||
332 | static void __init at91cap9_ioremap_registers(void) | ||
333 | { | ||
334 | at91_ioremap_shdwc(AT91CAP9_BASE_SHDWC); | ||
335 | at91_ioremap_rstc(AT91CAP9_BASE_RSTC); | ||
336 | at91sam926x_ioremap_pit(AT91CAP9_BASE_PIT); | ||
337 | at91sam9_ioremap_smc(0, AT91CAP9_BASE_SMC); | ||
338 | } | ||
339 | |||
340 | static void __init at91cap9_initialize(void) | ||
341 | { | ||
342 | arm_pm_idle = at91cap9_idle; | ||
343 | arm_pm_restart = at91sam9g45_restart; | ||
344 | at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1); | ||
345 | |||
346 | /* Register GPIO subsystem */ | ||
347 | at91_gpio_init(at91cap9_gpio, 4); | ||
348 | |||
349 | /* Remember the silicon revision */ | ||
350 | if (cpu_is_at91cap9_revB()) | ||
351 | system_rev = 0xB; | ||
352 | else if (cpu_is_at91cap9_revC()) | ||
353 | system_rev = 0xC; | ||
354 | } | ||
355 | |||
356 | /* -------------------------------------------------------------------- | ||
357 | * Interrupt initialization | ||
358 | * -------------------------------------------------------------------- */ | ||
359 | |||
360 | /* | ||
361 | * The default interrupt priority levels (0 = lowest, 7 = highest). | ||
362 | */ | ||
363 | static unsigned int at91cap9_default_irq_priority[NR_AIC_IRQS] __initdata = { | ||
364 | 7, /* Advanced Interrupt Controller (FIQ) */ | ||
365 | 7, /* System Peripherals */ | ||
366 | 1, /* Parallel IO Controller A, B, C and D */ | ||
367 | 0, /* MP Block Peripheral 0 */ | ||
368 | 0, /* MP Block Peripheral 1 */ | ||
369 | 0, /* MP Block Peripheral 2 */ | ||
370 | 0, /* MP Block Peripheral 3 */ | ||
371 | 0, /* MP Block Peripheral 4 */ | ||
372 | 5, /* USART 0 */ | ||
373 | 5, /* USART 1 */ | ||
374 | 5, /* USART 2 */ | ||
375 | 0, /* Multimedia Card Interface 0 */ | ||
376 | 0, /* Multimedia Card Interface 1 */ | ||
377 | 3, /* CAN */ | ||
378 | 6, /* Two-Wire Interface */ | ||
379 | 5, /* Serial Peripheral Interface 0 */ | ||
380 | 5, /* Serial Peripheral Interface 1 */ | ||
381 | 4, /* Serial Synchronous Controller 0 */ | ||
382 | 4, /* Serial Synchronous Controller 1 */ | ||
383 | 5, /* AC97 Controller */ | ||
384 | 0, /* Timer Counter 0, 1 and 2 */ | ||
385 | 0, /* Pulse Width Modulation Controller */ | ||
386 | 3, /* Ethernet */ | ||
387 | 0, /* Advanced Encryption Standard, Triple DES*/ | ||
388 | 0, /* Analog-to-Digital Converter */ | ||
389 | 0, /* Image Sensor Interface */ | ||
390 | 3, /* LCD Controller */ | ||
391 | 0, /* DMA Controller */ | ||
392 | 2, /* USB Device Port */ | ||
393 | 2, /* USB Host port */ | ||
394 | 0, /* Advanced Interrupt Controller (IRQ0) */ | ||
395 | 0, /* Advanced Interrupt Controller (IRQ1) */ | ||
396 | }; | ||
397 | |||
398 | struct at91_init_soc __initdata at91cap9_soc = { | ||
399 | .map_io = at91cap9_map_io, | ||
400 | .default_irq_priority = at91cap9_default_irq_priority, | ||
401 | .ioremap_registers = at91cap9_ioremap_registers, | ||
402 | .register_clocks = at91cap9_register_clocks, | ||
403 | .init = at91cap9_initialize, | ||
404 | }; | ||
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c deleted file mode 100644 index d298fb7cb210..000000000000 --- a/arch/arm/mach-at91/at91cap9_devices.c +++ /dev/null | |||
@@ -1,1273 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/at91cap9_devices.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> | ||
5 | * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> | ||
6 | * Copyright (C) 2007 Atmel Corporation. | ||
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 <asm/mach/arch.h> | ||
15 | #include <asm/mach/map.h> | ||
16 | #include <asm/mach/irq.h> | ||
17 | |||
18 | #include <linux/dma-mapping.h> | ||
19 | #include <linux/gpio.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/i2c-gpio.h> | ||
22 | |||
23 | #include <video/atmel_lcdc.h> | ||
24 | |||
25 | #include <mach/board.h> | ||
26 | #include <mach/cpu.h> | ||
27 | #include <mach/at91cap9.h> | ||
28 | #include <mach/at91cap9_matrix.h> | ||
29 | #include <mach/at91sam9_smc.h> | ||
30 | |||
31 | #include "generic.h" | ||
32 | |||
33 | |||
34 | /* -------------------------------------------------------------------- | ||
35 | * USB Host | ||
36 | * -------------------------------------------------------------------- */ | ||
37 | |||
38 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
39 | static u64 ohci_dmamask = DMA_BIT_MASK(32); | ||
40 | static struct at91_usbh_data usbh_data; | ||
41 | |||
42 | static struct resource usbh_resources[] = { | ||
43 | [0] = { | ||
44 | .start = AT91CAP9_UHP_BASE, | ||
45 | .end = AT91CAP9_UHP_BASE + SZ_1M - 1, | ||
46 | .flags = IORESOURCE_MEM, | ||
47 | }, | ||
48 | [1] = { | ||
49 | .start = AT91CAP9_ID_UHP, | ||
50 | .end = AT91CAP9_ID_UHP, | ||
51 | .flags = IORESOURCE_IRQ, | ||
52 | }, | ||
53 | }; | ||
54 | |||
55 | static struct platform_device at91_usbh_device = { | ||
56 | .name = "at91_ohci", | ||
57 | .id = -1, | ||
58 | .dev = { | ||
59 | .dma_mask = &ohci_dmamask, | ||
60 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
61 | .platform_data = &usbh_data, | ||
62 | }, | ||
63 | .resource = usbh_resources, | ||
64 | .num_resources = ARRAY_SIZE(usbh_resources), | ||
65 | }; | ||
66 | |||
67 | void __init at91_add_device_usbh(struct at91_usbh_data *data) | ||
68 | { | ||
69 | int i; | ||
70 | |||
71 | if (!data) | ||
72 | return; | ||
73 | |||
74 | if (cpu_is_at91cap9_revB()) | ||
75 | irq_set_irq_type(AT91CAP9_ID_UHP, IRQ_TYPE_LEVEL_HIGH); | ||
76 | |||
77 | /* Enable VBus control for UHP ports */ | ||
78 | for (i = 0; i < data->ports; i++) { | ||
79 | if (gpio_is_valid(data->vbus_pin[i])) | ||
80 | at91_set_gpio_output(data->vbus_pin[i], 0); | ||
81 | } | ||
82 | |||
83 | /* Enable overcurrent notification */ | ||
84 | for (i = 0; i < data->ports; i++) { | ||
85 | if (data->overcurrent_pin[i]) | ||
86 | at91_set_gpio_input(data->overcurrent_pin[i], 1); | ||
87 | } | ||
88 | |||
89 | usbh_data = *data; | ||
90 | platform_device_register(&at91_usbh_device); | ||
91 | } | ||
92 | #else | ||
93 | void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | ||
94 | #endif | ||
95 | |||
96 | |||
97 | /* -------------------------------------------------------------------- | ||
98 | * USB HS Device (Gadget) | ||
99 | * -------------------------------------------------------------------- */ | ||
100 | |||
101 | #if defined(CONFIG_USB_ATMEL_USBA) || defined(CONFIG_USB_ATMEL_USBA_MODULE) | ||
102 | |||
103 | static struct resource usba_udc_resources[] = { | ||
104 | [0] = { | ||
105 | .start = AT91CAP9_UDPHS_FIFO, | ||
106 | .end = AT91CAP9_UDPHS_FIFO + SZ_512K - 1, | ||
107 | .flags = IORESOURCE_MEM, | ||
108 | }, | ||
109 | [1] = { | ||
110 | .start = AT91CAP9_BASE_UDPHS, | ||
111 | .end = AT91CAP9_BASE_UDPHS + SZ_1K - 1, | ||
112 | .flags = IORESOURCE_MEM, | ||
113 | }, | ||
114 | [2] = { | ||
115 | .start = AT91CAP9_ID_UDPHS, | ||
116 | .end = AT91CAP9_ID_UDPHS, | ||
117 | .flags = IORESOURCE_IRQ, | ||
118 | }, | ||
119 | }; | ||
120 | |||
121 | #define EP(nam, idx, maxpkt, maxbk, dma, isoc) \ | ||
122 | [idx] = { \ | ||
123 | .name = nam, \ | ||
124 | .index = idx, \ | ||
125 | .fifo_size = maxpkt, \ | ||
126 | .nr_banks = maxbk, \ | ||
127 | .can_dma = dma, \ | ||
128 | .can_isoc = isoc, \ | ||
129 | } | ||
130 | |||
131 | static struct usba_ep_data usba_udc_ep[] = { | ||
132 | EP("ep0", 0, 64, 1, 0, 0), | ||
133 | EP("ep1", 1, 1024, 3, 1, 1), | ||
134 | EP("ep2", 2, 1024, 3, 1, 1), | ||
135 | EP("ep3", 3, 1024, 2, 1, 1), | ||
136 | EP("ep4", 4, 1024, 2, 1, 1), | ||
137 | EP("ep5", 5, 1024, 2, 1, 0), | ||
138 | EP("ep6", 6, 1024, 2, 1, 0), | ||
139 | EP("ep7", 7, 1024, 2, 0, 0), | ||
140 | }; | ||
141 | |||
142 | #undef EP | ||
143 | |||
144 | /* | ||
145 | * pdata doesn't have room for any endpoints, so we need to | ||
146 | * append room for the ones we need right after it. | ||
147 | */ | ||
148 | static struct { | ||
149 | struct usba_platform_data pdata; | ||
150 | struct usba_ep_data ep[8]; | ||
151 | } usba_udc_data; | ||
152 | |||
153 | static struct platform_device at91_usba_udc_device = { | ||
154 | .name = "atmel_usba_udc", | ||
155 | .id = -1, | ||
156 | .dev = { | ||
157 | .platform_data = &usba_udc_data.pdata, | ||
158 | }, | ||
159 | .resource = usba_udc_resources, | ||
160 | .num_resources = ARRAY_SIZE(usba_udc_resources), | ||
161 | }; | ||
162 | |||
163 | void __init at91_add_device_usba(struct usba_platform_data *data) | ||
164 | { | ||
165 | if (cpu_is_at91cap9_revB()) { | ||
166 | irq_set_irq_type(AT91CAP9_ID_UDPHS, IRQ_TYPE_LEVEL_HIGH); | ||
167 | at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS | | ||
168 | AT91_MATRIX_UDPHS_BYPASS_LOCK); | ||
169 | } | ||
170 | else | ||
171 | at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS); | ||
172 | |||
173 | /* | ||
174 | * Invalid pins are 0 on AT91, but the usba driver is shared | ||
175 | * with AVR32, which use negative values instead. Once/if | ||
176 | * gpio_is_valid() is ported to AT91, revisit this code. | ||
177 | */ | ||
178 | usba_udc_data.pdata.vbus_pin = -EINVAL; | ||
179 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); | ||
180 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); | ||
181 | |||
182 | if (data && gpio_is_valid(data->vbus_pin)) { | ||
183 | at91_set_gpio_input(data->vbus_pin, 0); | ||
184 | at91_set_deglitch(data->vbus_pin, 1); | ||
185 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; | ||
186 | } | ||
187 | |||
188 | /* Pullup pin is handled internally by USB device peripheral */ | ||
189 | |||
190 | platform_device_register(&at91_usba_udc_device); | ||
191 | } | ||
192 | #else | ||
193 | void __init at91_add_device_usba(struct usba_platform_data *data) {} | ||
194 | #endif | ||
195 | |||
196 | |||
197 | /* -------------------------------------------------------------------- | ||
198 | * Ethernet | ||
199 | * -------------------------------------------------------------------- */ | ||
200 | |||
201 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | ||
202 | static u64 eth_dmamask = DMA_BIT_MASK(32); | ||
203 | static struct macb_platform_data eth_data; | ||
204 | |||
205 | static struct resource eth_resources[] = { | ||
206 | [0] = { | ||
207 | .start = AT91CAP9_BASE_EMAC, | ||
208 | .end = AT91CAP9_BASE_EMAC + SZ_16K - 1, | ||
209 | .flags = IORESOURCE_MEM, | ||
210 | }, | ||
211 | [1] = { | ||
212 | .start = AT91CAP9_ID_EMAC, | ||
213 | .end = AT91CAP9_ID_EMAC, | ||
214 | .flags = IORESOURCE_IRQ, | ||
215 | }, | ||
216 | }; | ||
217 | |||
218 | static struct platform_device at91cap9_eth_device = { | ||
219 | .name = "macb", | ||
220 | .id = -1, | ||
221 | .dev = { | ||
222 | .dma_mask = ð_dmamask, | ||
223 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
224 | .platform_data = ð_data, | ||
225 | }, | ||
226 | .resource = eth_resources, | ||
227 | .num_resources = ARRAY_SIZE(eth_resources), | ||
228 | }; | ||
229 | |||
230 | void __init at91_add_device_eth(struct macb_platform_data *data) | ||
231 | { | ||
232 | if (!data) | ||
233 | return; | ||
234 | |||
235 | if (gpio_is_valid(data->phy_irq_pin)) { | ||
236 | at91_set_gpio_input(data->phy_irq_pin, 0); | ||
237 | at91_set_deglitch(data->phy_irq_pin, 1); | ||
238 | } | ||
239 | |||
240 | /* Pins used for MII and RMII */ | ||
241 | at91_set_A_periph(AT91_PIN_PB21, 0); /* ETXCK_EREFCK */ | ||
242 | at91_set_A_periph(AT91_PIN_PB22, 0); /* ERXDV */ | ||
243 | at91_set_A_periph(AT91_PIN_PB25, 0); /* ERX0 */ | ||
244 | at91_set_A_periph(AT91_PIN_PB26, 0); /* ERX1 */ | ||
245 | at91_set_A_periph(AT91_PIN_PB27, 0); /* ERXER */ | ||
246 | at91_set_A_periph(AT91_PIN_PB28, 0); /* ETXEN */ | ||
247 | at91_set_A_periph(AT91_PIN_PB23, 0); /* ETX0 */ | ||
248 | at91_set_A_periph(AT91_PIN_PB24, 0); /* ETX1 */ | ||
249 | at91_set_A_periph(AT91_PIN_PB30, 0); /* EMDIO */ | ||
250 | at91_set_A_periph(AT91_PIN_PB29, 0); /* EMDC */ | ||
251 | |||
252 | if (!data->is_rmii) { | ||
253 | at91_set_B_periph(AT91_PIN_PC25, 0); /* ECRS */ | ||
254 | at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */ | ||
255 | at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */ | ||
256 | at91_set_B_periph(AT91_PIN_PC23, 0); /* ERX3 */ | ||
257 | at91_set_B_periph(AT91_PIN_PC27, 0); /* ERXCK */ | ||
258 | at91_set_B_periph(AT91_PIN_PC20, 0); /* ETX2 */ | ||
259 | at91_set_B_periph(AT91_PIN_PC21, 0); /* ETX3 */ | ||
260 | at91_set_B_periph(AT91_PIN_PC24, 0); /* ETXER */ | ||
261 | } | ||
262 | |||
263 | eth_data = *data; | ||
264 | platform_device_register(&at91cap9_eth_device); | ||
265 | } | ||
266 | #else | ||
267 | void __init at91_add_device_eth(struct macb_platform_data *data) {} | ||
268 | #endif | ||
269 | |||
270 | |||
271 | /* -------------------------------------------------------------------- | ||
272 | * MMC / SD | ||
273 | * -------------------------------------------------------------------- */ | ||
274 | |||
275 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | ||
276 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | ||
277 | static struct at91_mmc_data mmc0_data, mmc1_data; | ||
278 | |||
279 | static struct resource mmc0_resources[] = { | ||
280 | [0] = { | ||
281 | .start = AT91CAP9_BASE_MCI0, | ||
282 | .end = AT91CAP9_BASE_MCI0 + SZ_16K - 1, | ||
283 | .flags = IORESOURCE_MEM, | ||
284 | }, | ||
285 | [1] = { | ||
286 | .start = AT91CAP9_ID_MCI0, | ||
287 | .end = AT91CAP9_ID_MCI0, | ||
288 | .flags = IORESOURCE_IRQ, | ||
289 | }, | ||
290 | }; | ||
291 | |||
292 | static struct platform_device at91cap9_mmc0_device = { | ||
293 | .name = "at91_mci", | ||
294 | .id = 0, | ||
295 | .dev = { | ||
296 | .dma_mask = &mmc_dmamask, | ||
297 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
298 | .platform_data = &mmc0_data, | ||
299 | }, | ||
300 | .resource = mmc0_resources, | ||
301 | .num_resources = ARRAY_SIZE(mmc0_resources), | ||
302 | }; | ||
303 | |||
304 | static struct resource mmc1_resources[] = { | ||
305 | [0] = { | ||
306 | .start = AT91CAP9_BASE_MCI1, | ||
307 | .end = AT91CAP9_BASE_MCI1 + SZ_16K - 1, | ||
308 | .flags = IORESOURCE_MEM, | ||
309 | }, | ||
310 | [1] = { | ||
311 | .start = AT91CAP9_ID_MCI1, | ||
312 | .end = AT91CAP9_ID_MCI1, | ||
313 | .flags = IORESOURCE_IRQ, | ||
314 | }, | ||
315 | }; | ||
316 | |||
317 | static struct platform_device at91cap9_mmc1_device = { | ||
318 | .name = "at91_mci", | ||
319 | .id = 1, | ||
320 | .dev = { | ||
321 | .dma_mask = &mmc_dmamask, | ||
322 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
323 | .platform_data = &mmc1_data, | ||
324 | }, | ||
325 | .resource = mmc1_resources, | ||
326 | .num_resources = ARRAY_SIZE(mmc1_resources), | ||
327 | }; | ||
328 | |||
329 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | ||
330 | { | ||
331 | if (!data) | ||
332 | return; | ||
333 | |||
334 | /* input/irq */ | ||
335 | if (gpio_is_valid(data->det_pin)) { | ||
336 | at91_set_gpio_input(data->det_pin, 1); | ||
337 | at91_set_deglitch(data->det_pin, 1); | ||
338 | } | ||
339 | if (gpio_is_valid(data->wp_pin)) | ||
340 | at91_set_gpio_input(data->wp_pin, 1); | ||
341 | if (gpio_is_valid(data->vcc_pin)) | ||
342 | at91_set_gpio_output(data->vcc_pin, 0); | ||
343 | |||
344 | if (mmc_id == 0) { /* MCI0 */ | ||
345 | /* CLK */ | ||
346 | at91_set_A_periph(AT91_PIN_PA2, 0); | ||
347 | |||
348 | /* CMD */ | ||
349 | at91_set_A_periph(AT91_PIN_PA1, 1); | ||
350 | |||
351 | /* DAT0, maybe DAT1..DAT3 */ | ||
352 | at91_set_A_periph(AT91_PIN_PA0, 1); | ||
353 | if (data->wire4) { | ||
354 | at91_set_A_periph(AT91_PIN_PA3, 1); | ||
355 | at91_set_A_periph(AT91_PIN_PA4, 1); | ||
356 | at91_set_A_periph(AT91_PIN_PA5, 1); | ||
357 | } | ||
358 | |||
359 | mmc0_data = *data; | ||
360 | platform_device_register(&at91cap9_mmc0_device); | ||
361 | } else { /* MCI1 */ | ||
362 | /* CLK */ | ||
363 | at91_set_A_periph(AT91_PIN_PA16, 0); | ||
364 | |||
365 | /* CMD */ | ||
366 | at91_set_A_periph(AT91_PIN_PA17, 1); | ||
367 | |||
368 | /* DAT0, maybe DAT1..DAT3 */ | ||
369 | at91_set_A_periph(AT91_PIN_PA18, 1); | ||
370 | if (data->wire4) { | ||
371 | at91_set_A_periph(AT91_PIN_PA19, 1); | ||
372 | at91_set_A_periph(AT91_PIN_PA20, 1); | ||
373 | at91_set_A_periph(AT91_PIN_PA21, 1); | ||
374 | } | ||
375 | |||
376 | mmc1_data = *data; | ||
377 | platform_device_register(&at91cap9_mmc1_device); | ||
378 | } | ||
379 | } | ||
380 | #else | ||
381 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | ||
382 | #endif | ||
383 | |||
384 | |||
385 | /* -------------------------------------------------------------------- | ||
386 | * NAND / SmartMedia | ||
387 | * -------------------------------------------------------------------- */ | ||
388 | |||
389 | #if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE) | ||
390 | static struct atmel_nand_data nand_data; | ||
391 | |||
392 | #define NAND_BASE AT91_CHIPSELECT_3 | ||
393 | |||
394 | static struct resource nand_resources[] = { | ||
395 | [0] = { | ||
396 | .start = NAND_BASE, | ||
397 | .end = NAND_BASE + SZ_256M - 1, | ||
398 | .flags = IORESOURCE_MEM, | ||
399 | }, | ||
400 | [1] = { | ||
401 | .start = AT91CAP9_BASE_ECC, | ||
402 | .end = AT91CAP9_BASE_ECC + SZ_512 - 1, | ||
403 | .flags = IORESOURCE_MEM, | ||
404 | } | ||
405 | }; | ||
406 | |||
407 | static struct platform_device at91cap9_nand_device = { | ||
408 | .name = "atmel_nand", | ||
409 | .id = -1, | ||
410 | .dev = { | ||
411 | .platform_data = &nand_data, | ||
412 | }, | ||
413 | .resource = nand_resources, | ||
414 | .num_resources = ARRAY_SIZE(nand_resources), | ||
415 | }; | ||
416 | |||
417 | void __init at91_add_device_nand(struct atmel_nand_data *data) | ||
418 | { | ||
419 | unsigned long csa; | ||
420 | |||
421 | if (!data) | ||
422 | return; | ||
423 | |||
424 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | ||
425 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); | ||
426 | |||
427 | /* enable pin */ | ||
428 | if (gpio_is_valid(data->enable_pin)) | ||
429 | at91_set_gpio_output(data->enable_pin, 1); | ||
430 | |||
431 | /* ready/busy pin */ | ||
432 | if (gpio_is_valid(data->rdy_pin)) | ||
433 | at91_set_gpio_input(data->rdy_pin, 1); | ||
434 | |||
435 | /* card detect pin */ | ||
436 | if (gpio_is_valid(data->det_pin)) | ||
437 | at91_set_gpio_input(data->det_pin, 1); | ||
438 | |||
439 | nand_data = *data; | ||
440 | platform_device_register(&at91cap9_nand_device); | ||
441 | } | ||
442 | #else | ||
443 | void __init at91_add_device_nand(struct atmel_nand_data *data) {} | ||
444 | #endif | ||
445 | |||
446 | |||
447 | /* -------------------------------------------------------------------- | ||
448 | * TWI (i2c) | ||
449 | * -------------------------------------------------------------------- */ | ||
450 | |||
451 | /* | ||
452 | * Prefer the GPIO code since the TWI controller isn't robust | ||
453 | * (gets overruns and underruns under load) and can only issue | ||
454 | * repeated STARTs in one scenario (the driver doesn't yet handle them). | ||
455 | */ | ||
456 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) | ||
457 | |||
458 | static struct i2c_gpio_platform_data pdata = { | ||
459 | .sda_pin = AT91_PIN_PB4, | ||
460 | .sda_is_open_drain = 1, | ||
461 | .scl_pin = AT91_PIN_PB5, | ||
462 | .scl_is_open_drain = 1, | ||
463 | .udelay = 2, /* ~100 kHz */ | ||
464 | }; | ||
465 | |||
466 | static struct platform_device at91cap9_twi_device = { | ||
467 | .name = "i2c-gpio", | ||
468 | .id = -1, | ||
469 | .dev.platform_data = &pdata, | ||
470 | }; | ||
471 | |||
472 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | ||
473 | { | ||
474 | at91_set_GPIO_periph(AT91_PIN_PB4, 1); /* TWD (SDA) */ | ||
475 | at91_set_multi_drive(AT91_PIN_PB4, 1); | ||
476 | |||
477 | at91_set_GPIO_periph(AT91_PIN_PB5, 1); /* TWCK (SCL) */ | ||
478 | at91_set_multi_drive(AT91_PIN_PB5, 1); | ||
479 | |||
480 | i2c_register_board_info(0, devices, nr_devices); | ||
481 | platform_device_register(&at91cap9_twi_device); | ||
482 | } | ||
483 | |||
484 | #elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) | ||
485 | |||
486 | static struct resource twi_resources[] = { | ||
487 | [0] = { | ||
488 | .start = AT91CAP9_BASE_TWI, | ||
489 | .end = AT91CAP9_BASE_TWI + SZ_16K - 1, | ||
490 | .flags = IORESOURCE_MEM, | ||
491 | }, | ||
492 | [1] = { | ||
493 | .start = AT91CAP9_ID_TWI, | ||
494 | .end = AT91CAP9_ID_TWI, | ||
495 | .flags = IORESOURCE_IRQ, | ||
496 | }, | ||
497 | }; | ||
498 | |||
499 | static struct platform_device at91cap9_twi_device = { | ||
500 | .name = "at91_i2c", | ||
501 | .id = -1, | ||
502 | .resource = twi_resources, | ||
503 | .num_resources = ARRAY_SIZE(twi_resources), | ||
504 | }; | ||
505 | |||
506 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | ||
507 | { | ||
508 | /* pins used for TWI interface */ | ||
509 | at91_set_B_periph(AT91_PIN_PB4, 0); /* TWD */ | ||
510 | at91_set_multi_drive(AT91_PIN_PB4, 1); | ||
511 | |||
512 | at91_set_B_periph(AT91_PIN_PB5, 0); /* TWCK */ | ||
513 | at91_set_multi_drive(AT91_PIN_PB5, 1); | ||
514 | |||
515 | i2c_register_board_info(0, devices, nr_devices); | ||
516 | platform_device_register(&at91cap9_twi_device); | ||
517 | } | ||
518 | #else | ||
519 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {} | ||
520 | #endif | ||
521 | |||
522 | /* -------------------------------------------------------------------- | ||
523 | * SPI | ||
524 | * -------------------------------------------------------------------- */ | ||
525 | |||
526 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | ||
527 | static u64 spi_dmamask = DMA_BIT_MASK(32); | ||
528 | |||
529 | static struct resource spi0_resources[] = { | ||
530 | [0] = { | ||
531 | .start = AT91CAP9_BASE_SPI0, | ||
532 | .end = AT91CAP9_BASE_SPI0 + SZ_16K - 1, | ||
533 | .flags = IORESOURCE_MEM, | ||
534 | }, | ||
535 | [1] = { | ||
536 | .start = AT91CAP9_ID_SPI0, | ||
537 | .end = AT91CAP9_ID_SPI0, | ||
538 | .flags = IORESOURCE_IRQ, | ||
539 | }, | ||
540 | }; | ||
541 | |||
542 | static struct platform_device at91cap9_spi0_device = { | ||
543 | .name = "atmel_spi", | ||
544 | .id = 0, | ||
545 | .dev = { | ||
546 | .dma_mask = &spi_dmamask, | ||
547 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
548 | }, | ||
549 | .resource = spi0_resources, | ||
550 | .num_resources = ARRAY_SIZE(spi0_resources), | ||
551 | }; | ||
552 | |||
553 | static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA5, AT91_PIN_PA3, AT91_PIN_PD0, AT91_PIN_PD1 }; | ||
554 | |||
555 | static struct resource spi1_resources[] = { | ||
556 | [0] = { | ||
557 | .start = AT91CAP9_BASE_SPI1, | ||
558 | .end = AT91CAP9_BASE_SPI1 + SZ_16K - 1, | ||
559 | .flags = IORESOURCE_MEM, | ||
560 | }, | ||
561 | [1] = { | ||
562 | .start = AT91CAP9_ID_SPI1, | ||
563 | .end = AT91CAP9_ID_SPI1, | ||
564 | .flags = IORESOURCE_IRQ, | ||
565 | }, | ||
566 | }; | ||
567 | |||
568 | static struct platform_device at91cap9_spi1_device = { | ||
569 | .name = "atmel_spi", | ||
570 | .id = 1, | ||
571 | .dev = { | ||
572 | .dma_mask = &spi_dmamask, | ||
573 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
574 | }, | ||
575 | .resource = spi1_resources, | ||
576 | .num_resources = ARRAY_SIZE(spi1_resources), | ||
577 | }; | ||
578 | |||
579 | static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB15, AT91_PIN_PB16, AT91_PIN_PB17, AT91_PIN_PB18 }; | ||
580 | |||
581 | void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | ||
582 | { | ||
583 | int i; | ||
584 | unsigned long cs_pin; | ||
585 | short enable_spi0 = 0; | ||
586 | short enable_spi1 = 0; | ||
587 | |||
588 | /* Choose SPI chip-selects */ | ||
589 | for (i = 0; i < nr_devices; i++) { | ||
590 | if (devices[i].controller_data) | ||
591 | cs_pin = (unsigned long) devices[i].controller_data; | ||
592 | else if (devices[i].bus_num == 0) | ||
593 | cs_pin = spi0_standard_cs[devices[i].chip_select]; | ||
594 | else | ||
595 | cs_pin = spi1_standard_cs[devices[i].chip_select]; | ||
596 | |||
597 | if (devices[i].bus_num == 0) | ||
598 | enable_spi0 = 1; | ||
599 | else | ||
600 | enable_spi1 = 1; | ||
601 | |||
602 | /* enable chip-select pin */ | ||
603 | at91_set_gpio_output(cs_pin, 1); | ||
604 | |||
605 | /* pass chip-select pin to driver */ | ||
606 | devices[i].controller_data = (void *) cs_pin; | ||
607 | } | ||
608 | |||
609 | spi_register_board_info(devices, nr_devices); | ||
610 | |||
611 | /* Configure SPI bus(es) */ | ||
612 | if (enable_spi0) { | ||
613 | at91_set_B_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */ | ||
614 | at91_set_B_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */ | ||
615 | at91_set_B_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */ | ||
616 | |||
617 | platform_device_register(&at91cap9_spi0_device); | ||
618 | } | ||
619 | if (enable_spi1) { | ||
620 | at91_set_A_periph(AT91_PIN_PB12, 0); /* SPI1_MISO */ | ||
621 | at91_set_A_periph(AT91_PIN_PB13, 0); /* SPI1_MOSI */ | ||
622 | at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_SPCK */ | ||
623 | |||
624 | platform_device_register(&at91cap9_spi1_device); | ||
625 | } | ||
626 | } | ||
627 | #else | ||
628 | void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {} | ||
629 | #endif | ||
630 | |||
631 | |||
632 | /* -------------------------------------------------------------------- | ||
633 | * Timer/Counter block | ||
634 | * -------------------------------------------------------------------- */ | ||
635 | |||
636 | #ifdef CONFIG_ATMEL_TCLIB | ||
637 | |||
638 | static struct resource tcb_resources[] = { | ||
639 | [0] = { | ||
640 | .start = AT91CAP9_BASE_TCB0, | ||
641 | .end = AT91CAP9_BASE_TCB0 + SZ_16K - 1, | ||
642 | .flags = IORESOURCE_MEM, | ||
643 | }, | ||
644 | [1] = { | ||
645 | .start = AT91CAP9_ID_TCB, | ||
646 | .end = AT91CAP9_ID_TCB, | ||
647 | .flags = IORESOURCE_IRQ, | ||
648 | }, | ||
649 | }; | ||
650 | |||
651 | static struct platform_device at91cap9_tcb_device = { | ||
652 | .name = "atmel_tcb", | ||
653 | .id = 0, | ||
654 | .resource = tcb_resources, | ||
655 | .num_resources = ARRAY_SIZE(tcb_resources), | ||
656 | }; | ||
657 | |||
658 | static void __init at91_add_device_tc(void) | ||
659 | { | ||
660 | platform_device_register(&at91cap9_tcb_device); | ||
661 | } | ||
662 | #else | ||
663 | static void __init at91_add_device_tc(void) { } | ||
664 | #endif | ||
665 | |||
666 | |||
667 | /* -------------------------------------------------------------------- | ||
668 | * RTT | ||
669 | * -------------------------------------------------------------------- */ | ||
670 | |||
671 | static struct resource rtt_resources[] = { | ||
672 | { | ||
673 | .start = AT91CAP9_BASE_RTT, | ||
674 | .end = AT91CAP9_BASE_RTT + SZ_16 - 1, | ||
675 | .flags = IORESOURCE_MEM, | ||
676 | } | ||
677 | }; | ||
678 | |||
679 | static struct platform_device at91cap9_rtt_device = { | ||
680 | .name = "at91_rtt", | ||
681 | .id = 0, | ||
682 | .resource = rtt_resources, | ||
683 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
684 | }; | ||
685 | |||
686 | static void __init at91_add_device_rtt(void) | ||
687 | { | ||
688 | platform_device_register(&at91cap9_rtt_device); | ||
689 | } | ||
690 | |||
691 | |||
692 | /* -------------------------------------------------------------------- | ||
693 | * Watchdog | ||
694 | * -------------------------------------------------------------------- */ | ||
695 | |||
696 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | ||
697 | static struct resource wdt_resources[] = { | ||
698 | { | ||
699 | .start = AT91CAP9_BASE_WDT, | ||
700 | .end = AT91CAP9_BASE_WDT + SZ_16 - 1, | ||
701 | .flags = IORESOURCE_MEM, | ||
702 | } | ||
703 | }; | ||
704 | |||
705 | static struct platform_device at91cap9_wdt_device = { | ||
706 | .name = "at91_wdt", | ||
707 | .id = -1, | ||
708 | .resource = wdt_resources, | ||
709 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
710 | }; | ||
711 | |||
712 | static void __init at91_add_device_watchdog(void) | ||
713 | { | ||
714 | platform_device_register(&at91cap9_wdt_device); | ||
715 | } | ||
716 | #else | ||
717 | static void __init at91_add_device_watchdog(void) {} | ||
718 | #endif | ||
719 | |||
720 | |||
721 | /* -------------------------------------------------------------------- | ||
722 | * PWM | ||
723 | * --------------------------------------------------------------------*/ | ||
724 | |||
725 | #if defined(CONFIG_ATMEL_PWM) | ||
726 | static u32 pwm_mask; | ||
727 | |||
728 | static struct resource pwm_resources[] = { | ||
729 | [0] = { | ||
730 | .start = AT91CAP9_BASE_PWMC, | ||
731 | .end = AT91CAP9_BASE_PWMC + SZ_16K - 1, | ||
732 | .flags = IORESOURCE_MEM, | ||
733 | }, | ||
734 | [1] = { | ||
735 | .start = AT91CAP9_ID_PWMC, | ||
736 | .end = AT91CAP9_ID_PWMC, | ||
737 | .flags = IORESOURCE_IRQ, | ||
738 | }, | ||
739 | }; | ||
740 | |||
741 | static struct platform_device at91cap9_pwm0_device = { | ||
742 | .name = "atmel_pwm", | ||
743 | .id = -1, | ||
744 | .dev = { | ||
745 | .platform_data = &pwm_mask, | ||
746 | }, | ||
747 | .resource = pwm_resources, | ||
748 | .num_resources = ARRAY_SIZE(pwm_resources), | ||
749 | }; | ||
750 | |||
751 | void __init at91_add_device_pwm(u32 mask) | ||
752 | { | ||
753 | if (mask & (1 << AT91_PWM0)) | ||
754 | at91_set_A_periph(AT91_PIN_PB19, 1); /* enable PWM0 */ | ||
755 | |||
756 | if (mask & (1 << AT91_PWM1)) | ||
757 | at91_set_B_periph(AT91_PIN_PB8, 1); /* enable PWM1 */ | ||
758 | |||
759 | if (mask & (1 << AT91_PWM2)) | ||
760 | at91_set_B_periph(AT91_PIN_PC29, 1); /* enable PWM2 */ | ||
761 | |||
762 | if (mask & (1 << AT91_PWM3)) | ||
763 | at91_set_B_periph(AT91_PIN_PA11, 1); /* enable PWM3 */ | ||
764 | |||
765 | pwm_mask = mask; | ||
766 | |||
767 | platform_device_register(&at91cap9_pwm0_device); | ||
768 | } | ||
769 | #else | ||
770 | void __init at91_add_device_pwm(u32 mask) {} | ||
771 | #endif | ||
772 | |||
773 | |||
774 | |||
775 | /* -------------------------------------------------------------------- | ||
776 | * AC97 | ||
777 | * -------------------------------------------------------------------- */ | ||
778 | |||
779 | #if defined(CONFIG_SND_ATMEL_AC97C) || defined(CONFIG_SND_ATMEL_AC97C_MODULE) | ||
780 | static u64 ac97_dmamask = DMA_BIT_MASK(32); | ||
781 | static struct ac97c_platform_data ac97_data; | ||
782 | |||
783 | static struct resource ac97_resources[] = { | ||
784 | [0] = { | ||
785 | .start = AT91CAP9_BASE_AC97C, | ||
786 | .end = AT91CAP9_BASE_AC97C + SZ_16K - 1, | ||
787 | .flags = IORESOURCE_MEM, | ||
788 | }, | ||
789 | [1] = { | ||
790 | .start = AT91CAP9_ID_AC97C, | ||
791 | .end = AT91CAP9_ID_AC97C, | ||
792 | .flags = IORESOURCE_IRQ, | ||
793 | }, | ||
794 | }; | ||
795 | |||
796 | static struct platform_device at91cap9_ac97_device = { | ||
797 | .name = "atmel_ac97c", | ||
798 | .id = 1, | ||
799 | .dev = { | ||
800 | .dma_mask = &ac97_dmamask, | ||
801 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
802 | .platform_data = &ac97_data, | ||
803 | }, | ||
804 | .resource = ac97_resources, | ||
805 | .num_resources = ARRAY_SIZE(ac97_resources), | ||
806 | }; | ||
807 | |||
808 | void __init at91_add_device_ac97(struct ac97c_platform_data *data) | ||
809 | { | ||
810 | if (!data) | ||
811 | return; | ||
812 | |||
813 | at91_set_A_periph(AT91_PIN_PA6, 0); /* AC97FS */ | ||
814 | at91_set_A_periph(AT91_PIN_PA7, 0); /* AC97CK */ | ||
815 | at91_set_A_periph(AT91_PIN_PA8, 0); /* AC97TX */ | ||
816 | at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */ | ||
817 | |||
818 | /* reset */ | ||
819 | if (gpio_is_valid(data->reset_pin)) | ||
820 | at91_set_gpio_output(data->reset_pin, 0); | ||
821 | |||
822 | ac97_data = *data; | ||
823 | platform_device_register(&at91cap9_ac97_device); | ||
824 | } | ||
825 | #else | ||
826 | void __init at91_add_device_ac97(struct ac97c_platform_data *data) {} | ||
827 | #endif | ||
828 | |||
829 | |||
830 | /* -------------------------------------------------------------------- | ||
831 | * LCD Controller | ||
832 | * -------------------------------------------------------------------- */ | ||
833 | |||
834 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | ||
835 | static u64 lcdc_dmamask = DMA_BIT_MASK(32); | ||
836 | static struct atmel_lcdfb_info lcdc_data; | ||
837 | |||
838 | static struct resource lcdc_resources[] = { | ||
839 | [0] = { | ||
840 | .start = AT91CAP9_LCDC_BASE, | ||
841 | .end = AT91CAP9_LCDC_BASE + SZ_4K - 1, | ||
842 | .flags = IORESOURCE_MEM, | ||
843 | }, | ||
844 | [1] = { | ||
845 | .start = AT91CAP9_ID_LCDC, | ||
846 | .end = AT91CAP9_ID_LCDC, | ||
847 | .flags = IORESOURCE_IRQ, | ||
848 | }, | ||
849 | }; | ||
850 | |||
851 | static struct platform_device at91_lcdc_device = { | ||
852 | .name = "atmel_lcdfb", | ||
853 | .id = 0, | ||
854 | .dev = { | ||
855 | .dma_mask = &lcdc_dmamask, | ||
856 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
857 | .platform_data = &lcdc_data, | ||
858 | }, | ||
859 | .resource = lcdc_resources, | ||
860 | .num_resources = ARRAY_SIZE(lcdc_resources), | ||
861 | }; | ||
862 | |||
863 | void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) | ||
864 | { | ||
865 | if (!data) | ||
866 | return; | ||
867 | |||
868 | if (cpu_is_at91cap9_revB()) | ||
869 | irq_set_irq_type(AT91CAP9_ID_LCDC, IRQ_TYPE_LEVEL_HIGH); | ||
870 | |||
871 | at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */ | ||
872 | at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */ | ||
873 | at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */ | ||
874 | at91_set_B_periph(AT91_PIN_PB9, 0); /* LCDCC */ | ||
875 | at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDD2 */ | ||
876 | at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDD3 */ | ||
877 | at91_set_A_periph(AT91_PIN_PC8, 0); /* LCDD4 */ | ||
878 | at91_set_A_periph(AT91_PIN_PC9, 0); /* LCDD5 */ | ||
879 | at91_set_A_periph(AT91_PIN_PC10, 0); /* LCDD6 */ | ||
880 | at91_set_A_periph(AT91_PIN_PC11, 0); /* LCDD7 */ | ||
881 | at91_set_A_periph(AT91_PIN_PC14, 0); /* LCDD10 */ | ||
882 | at91_set_A_periph(AT91_PIN_PC15, 0); /* LCDD11 */ | ||
883 | at91_set_A_periph(AT91_PIN_PC16, 0); /* LCDD12 */ | ||
884 | at91_set_A_periph(AT91_PIN_PC17, 0); /* LCDD13 */ | ||
885 | at91_set_A_periph(AT91_PIN_PC18, 0); /* LCDD14 */ | ||
886 | at91_set_A_periph(AT91_PIN_PC19, 0); /* LCDD15 */ | ||
887 | at91_set_A_periph(AT91_PIN_PC22, 0); /* LCDD18 */ | ||
888 | at91_set_A_periph(AT91_PIN_PC23, 0); /* LCDD19 */ | ||
889 | at91_set_A_periph(AT91_PIN_PC24, 0); /* LCDD20 */ | ||
890 | at91_set_A_periph(AT91_PIN_PC25, 0); /* LCDD21 */ | ||
891 | at91_set_A_periph(AT91_PIN_PC26, 0); /* LCDD22 */ | ||
892 | at91_set_A_periph(AT91_PIN_PC27, 0); /* LCDD23 */ | ||
893 | |||
894 | lcdc_data = *data; | ||
895 | platform_device_register(&at91_lcdc_device); | ||
896 | } | ||
897 | #else | ||
898 | void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} | ||
899 | #endif | ||
900 | |||
901 | |||
902 | /* -------------------------------------------------------------------- | ||
903 | * SSC -- Synchronous Serial Controller | ||
904 | * -------------------------------------------------------------------- */ | ||
905 | |||
906 | #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) | ||
907 | static u64 ssc0_dmamask = DMA_BIT_MASK(32); | ||
908 | |||
909 | static struct resource ssc0_resources[] = { | ||
910 | [0] = { | ||
911 | .start = AT91CAP9_BASE_SSC0, | ||
912 | .end = AT91CAP9_BASE_SSC0 + SZ_16K - 1, | ||
913 | .flags = IORESOURCE_MEM, | ||
914 | }, | ||
915 | [1] = { | ||
916 | .start = AT91CAP9_ID_SSC0, | ||
917 | .end = AT91CAP9_ID_SSC0, | ||
918 | .flags = IORESOURCE_IRQ, | ||
919 | }, | ||
920 | }; | ||
921 | |||
922 | static struct platform_device at91cap9_ssc0_device = { | ||
923 | .name = "ssc", | ||
924 | .id = 0, | ||
925 | .dev = { | ||
926 | .dma_mask = &ssc0_dmamask, | ||
927 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
928 | }, | ||
929 | .resource = ssc0_resources, | ||
930 | .num_resources = ARRAY_SIZE(ssc0_resources), | ||
931 | }; | ||
932 | |||
933 | static inline void configure_ssc0_pins(unsigned pins) | ||
934 | { | ||
935 | if (pins & ATMEL_SSC_TF) | ||
936 | at91_set_A_periph(AT91_PIN_PB0, 1); | ||
937 | if (pins & ATMEL_SSC_TK) | ||
938 | at91_set_A_periph(AT91_PIN_PB1, 1); | ||
939 | if (pins & ATMEL_SSC_TD) | ||
940 | at91_set_A_periph(AT91_PIN_PB2, 1); | ||
941 | if (pins & ATMEL_SSC_RD) | ||
942 | at91_set_A_periph(AT91_PIN_PB3, 1); | ||
943 | if (pins & ATMEL_SSC_RK) | ||
944 | at91_set_A_periph(AT91_PIN_PB4, 1); | ||
945 | if (pins & ATMEL_SSC_RF) | ||
946 | at91_set_A_periph(AT91_PIN_PB5, 1); | ||
947 | } | ||
948 | |||
949 | static u64 ssc1_dmamask = DMA_BIT_MASK(32); | ||
950 | |||
951 | static struct resource ssc1_resources[] = { | ||
952 | [0] = { | ||
953 | .start = AT91CAP9_BASE_SSC1, | ||
954 | .end = AT91CAP9_BASE_SSC1 + SZ_16K - 1, | ||
955 | .flags = IORESOURCE_MEM, | ||
956 | }, | ||
957 | [1] = { | ||
958 | .start = AT91CAP9_ID_SSC1, | ||
959 | .end = AT91CAP9_ID_SSC1, | ||
960 | .flags = IORESOURCE_IRQ, | ||
961 | }, | ||
962 | }; | ||
963 | |||
964 | static struct platform_device at91cap9_ssc1_device = { | ||
965 | .name = "ssc", | ||
966 | .id = 1, | ||
967 | .dev = { | ||
968 | .dma_mask = &ssc1_dmamask, | ||
969 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
970 | }, | ||
971 | .resource = ssc1_resources, | ||
972 | .num_resources = ARRAY_SIZE(ssc1_resources), | ||
973 | }; | ||
974 | |||
975 | static inline void configure_ssc1_pins(unsigned pins) | ||
976 | { | ||
977 | if (pins & ATMEL_SSC_TF) | ||
978 | at91_set_A_periph(AT91_PIN_PB6, 1); | ||
979 | if (pins & ATMEL_SSC_TK) | ||
980 | at91_set_A_periph(AT91_PIN_PB7, 1); | ||
981 | if (pins & ATMEL_SSC_TD) | ||
982 | at91_set_A_periph(AT91_PIN_PB8, 1); | ||
983 | if (pins & ATMEL_SSC_RD) | ||
984 | at91_set_A_periph(AT91_PIN_PB9, 1); | ||
985 | if (pins & ATMEL_SSC_RK) | ||
986 | at91_set_A_periph(AT91_PIN_PB10, 1); | ||
987 | if (pins & ATMEL_SSC_RF) | ||
988 | at91_set_A_periph(AT91_PIN_PB11, 1); | ||
989 | } | ||
990 | |||
991 | /* | ||
992 | * SSC controllers are accessed through library code, instead of any | ||
993 | * kind of all-singing/all-dancing driver. For example one could be | ||
994 | * used by a particular I2S audio codec's driver, while another one | ||
995 | * on the same system might be used by a custom data capture driver. | ||
996 | */ | ||
997 | void __init at91_add_device_ssc(unsigned id, unsigned pins) | ||
998 | { | ||
999 | struct platform_device *pdev; | ||
1000 | |||
1001 | /* | ||
1002 | * NOTE: caller is responsible for passing information matching | ||
1003 | * "pins" to whatever will be using each particular controller. | ||
1004 | */ | ||
1005 | switch (id) { | ||
1006 | case AT91CAP9_ID_SSC0: | ||
1007 | pdev = &at91cap9_ssc0_device; | ||
1008 | configure_ssc0_pins(pins); | ||
1009 | break; | ||
1010 | case AT91CAP9_ID_SSC1: | ||
1011 | pdev = &at91cap9_ssc1_device; | ||
1012 | configure_ssc1_pins(pins); | ||
1013 | break; | ||
1014 | default: | ||
1015 | return; | ||
1016 | } | ||
1017 | |||
1018 | platform_device_register(pdev); | ||
1019 | } | ||
1020 | |||
1021 | #else | ||
1022 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | ||
1023 | #endif | ||
1024 | |||
1025 | |||
1026 | /* -------------------------------------------------------------------- | ||
1027 | * UART | ||
1028 | * -------------------------------------------------------------------- */ | ||
1029 | |||
1030 | #if defined(CONFIG_SERIAL_ATMEL) | ||
1031 | static struct resource dbgu_resources[] = { | ||
1032 | [0] = { | ||
1033 | .start = AT91CAP9_BASE_DBGU, | ||
1034 | .end = AT91CAP9_BASE_DBGU + SZ_512 - 1, | ||
1035 | .flags = IORESOURCE_MEM, | ||
1036 | }, | ||
1037 | [1] = { | ||
1038 | .start = AT91_ID_SYS, | ||
1039 | .end = AT91_ID_SYS, | ||
1040 | .flags = IORESOURCE_IRQ, | ||
1041 | }, | ||
1042 | }; | ||
1043 | |||
1044 | static struct atmel_uart_data dbgu_data = { | ||
1045 | .use_dma_tx = 0, | ||
1046 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | ||
1047 | }; | ||
1048 | |||
1049 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | ||
1050 | |||
1051 | static struct platform_device at91cap9_dbgu_device = { | ||
1052 | .name = "atmel_usart", | ||
1053 | .id = 0, | ||
1054 | .dev = { | ||
1055 | .dma_mask = &dbgu_dmamask, | ||
1056 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1057 | .platform_data = &dbgu_data, | ||
1058 | }, | ||
1059 | .resource = dbgu_resources, | ||
1060 | .num_resources = ARRAY_SIZE(dbgu_resources), | ||
1061 | }; | ||
1062 | |||
1063 | static inline void configure_dbgu_pins(void) | ||
1064 | { | ||
1065 | at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */ | ||
1066 | at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */ | ||
1067 | } | ||
1068 | |||
1069 | static struct resource uart0_resources[] = { | ||
1070 | [0] = { | ||
1071 | .start = AT91CAP9_BASE_US0, | ||
1072 | .end = AT91CAP9_BASE_US0 + SZ_16K - 1, | ||
1073 | .flags = IORESOURCE_MEM, | ||
1074 | }, | ||
1075 | [1] = { | ||
1076 | .start = AT91CAP9_ID_US0, | ||
1077 | .end = AT91CAP9_ID_US0, | ||
1078 | .flags = IORESOURCE_IRQ, | ||
1079 | }, | ||
1080 | }; | ||
1081 | |||
1082 | static struct atmel_uart_data uart0_data = { | ||
1083 | .use_dma_tx = 1, | ||
1084 | .use_dma_rx = 1, | ||
1085 | }; | ||
1086 | |||
1087 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | ||
1088 | |||
1089 | static struct platform_device at91cap9_uart0_device = { | ||
1090 | .name = "atmel_usart", | ||
1091 | .id = 1, | ||
1092 | .dev = { | ||
1093 | .dma_mask = &uart0_dmamask, | ||
1094 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1095 | .platform_data = &uart0_data, | ||
1096 | }, | ||
1097 | .resource = uart0_resources, | ||
1098 | .num_resources = ARRAY_SIZE(uart0_resources), | ||
1099 | }; | ||
1100 | |||
1101 | static inline void configure_usart0_pins(unsigned pins) | ||
1102 | { | ||
1103 | at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */ | ||
1104 | at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */ | ||
1105 | |||
1106 | if (pins & ATMEL_UART_RTS) | ||
1107 | at91_set_A_periph(AT91_PIN_PA24, 0); /* RTS0 */ | ||
1108 | if (pins & ATMEL_UART_CTS) | ||
1109 | at91_set_A_periph(AT91_PIN_PA25, 0); /* CTS0 */ | ||
1110 | } | ||
1111 | |||
1112 | static struct resource uart1_resources[] = { | ||
1113 | [0] = { | ||
1114 | .start = AT91CAP9_BASE_US1, | ||
1115 | .end = AT91CAP9_BASE_US1 + SZ_16K - 1, | ||
1116 | .flags = IORESOURCE_MEM, | ||
1117 | }, | ||
1118 | [1] = { | ||
1119 | .start = AT91CAP9_ID_US1, | ||
1120 | .end = AT91CAP9_ID_US1, | ||
1121 | .flags = IORESOURCE_IRQ, | ||
1122 | }, | ||
1123 | }; | ||
1124 | |||
1125 | static struct atmel_uart_data uart1_data = { | ||
1126 | .use_dma_tx = 1, | ||
1127 | .use_dma_rx = 1, | ||
1128 | }; | ||
1129 | |||
1130 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | ||
1131 | |||
1132 | static struct platform_device at91cap9_uart1_device = { | ||
1133 | .name = "atmel_usart", | ||
1134 | .id = 2, | ||
1135 | .dev = { | ||
1136 | .dma_mask = &uart1_dmamask, | ||
1137 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1138 | .platform_data = &uart1_data, | ||
1139 | }, | ||
1140 | .resource = uart1_resources, | ||
1141 | .num_resources = ARRAY_SIZE(uart1_resources), | ||
1142 | }; | ||
1143 | |||
1144 | static inline void configure_usart1_pins(unsigned pins) | ||
1145 | { | ||
1146 | at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ | ||
1147 | at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ | ||
1148 | |||
1149 | if (pins & ATMEL_UART_RTS) | ||
1150 | at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */ | ||
1151 | if (pins & ATMEL_UART_CTS) | ||
1152 | at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */ | ||
1153 | } | ||
1154 | |||
1155 | static struct resource uart2_resources[] = { | ||
1156 | [0] = { | ||
1157 | .start = AT91CAP9_BASE_US2, | ||
1158 | .end = AT91CAP9_BASE_US2 + SZ_16K - 1, | ||
1159 | .flags = IORESOURCE_MEM, | ||
1160 | }, | ||
1161 | [1] = { | ||
1162 | .start = AT91CAP9_ID_US2, | ||
1163 | .end = AT91CAP9_ID_US2, | ||
1164 | .flags = IORESOURCE_IRQ, | ||
1165 | }, | ||
1166 | }; | ||
1167 | |||
1168 | static struct atmel_uart_data uart2_data = { | ||
1169 | .use_dma_tx = 1, | ||
1170 | .use_dma_rx = 1, | ||
1171 | }; | ||
1172 | |||
1173 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | ||
1174 | |||
1175 | static struct platform_device at91cap9_uart2_device = { | ||
1176 | .name = "atmel_usart", | ||
1177 | .id = 3, | ||
1178 | .dev = { | ||
1179 | .dma_mask = &uart2_dmamask, | ||
1180 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1181 | .platform_data = &uart2_data, | ||
1182 | }, | ||
1183 | .resource = uart2_resources, | ||
1184 | .num_resources = ARRAY_SIZE(uart2_resources), | ||
1185 | }; | ||
1186 | |||
1187 | static inline void configure_usart2_pins(unsigned pins) | ||
1188 | { | ||
1189 | at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ | ||
1190 | at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ | ||
1191 | |||
1192 | if (pins & ATMEL_UART_RTS) | ||
1193 | at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */ | ||
1194 | if (pins & ATMEL_UART_CTS) | ||
1195 | at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */ | ||
1196 | } | ||
1197 | |||
1198 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | ||
1199 | struct platform_device *atmel_default_console_device; /* the serial console device */ | ||
1200 | |||
1201 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | ||
1202 | { | ||
1203 | struct platform_device *pdev; | ||
1204 | struct atmel_uart_data *pdata; | ||
1205 | |||
1206 | switch (id) { | ||
1207 | case 0: /* DBGU */ | ||
1208 | pdev = &at91cap9_dbgu_device; | ||
1209 | configure_dbgu_pins(); | ||
1210 | break; | ||
1211 | case AT91CAP9_ID_US0: | ||
1212 | pdev = &at91cap9_uart0_device; | ||
1213 | configure_usart0_pins(pins); | ||
1214 | break; | ||
1215 | case AT91CAP9_ID_US1: | ||
1216 | pdev = &at91cap9_uart1_device; | ||
1217 | configure_usart1_pins(pins); | ||
1218 | break; | ||
1219 | case AT91CAP9_ID_US2: | ||
1220 | pdev = &at91cap9_uart2_device; | ||
1221 | configure_usart2_pins(pins); | ||
1222 | break; | ||
1223 | default: | ||
1224 | return; | ||
1225 | } | ||
1226 | pdata = pdev->dev.platform_data; | ||
1227 | pdata->num = portnr; /* update to mapped ID */ | ||
1228 | |||
1229 | if (portnr < ATMEL_MAX_UART) | ||
1230 | at91_uarts[portnr] = pdev; | ||
1231 | } | ||
1232 | |||
1233 | void __init at91_set_serial_console(unsigned portnr) | ||
1234 | { | ||
1235 | if (portnr < ATMEL_MAX_UART) { | ||
1236 | atmel_default_console_device = at91_uarts[portnr]; | ||
1237 | at91cap9_set_console_clock(at91_uarts[portnr]->id); | ||
1238 | } | ||
1239 | } | ||
1240 | |||
1241 | void __init at91_add_device_serial(void) | ||
1242 | { | ||
1243 | int i; | ||
1244 | |||
1245 | for (i = 0; i < ATMEL_MAX_UART; i++) { | ||
1246 | if (at91_uarts[i]) | ||
1247 | platform_device_register(at91_uarts[i]); | ||
1248 | } | ||
1249 | |||
1250 | if (!atmel_default_console_device) | ||
1251 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1252 | } | ||
1253 | #else | ||
1254 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | ||
1255 | void __init at91_set_serial_console(unsigned portnr) {} | ||
1256 | void __init at91_add_device_serial(void) {} | ||
1257 | #endif | ||
1258 | |||
1259 | |||
1260 | /* -------------------------------------------------------------------- */ | ||
1261 | /* | ||
1262 | * These devices are always present and don't need any board-specific | ||
1263 | * setup. | ||
1264 | */ | ||
1265 | static int __init at91_add_standard_devices(void) | ||
1266 | { | ||
1267 | at91_add_device_rtt(); | ||
1268 | at91_add_device_watchdog(); | ||
1269 | at91_add_device_tc(); | ||
1270 | return 0; | ||
1271 | } | ||
1272 | |||
1273 | arch_initcall(at91_add_standard_devices); | ||
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 366a7765635b..70709ab0102a 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -891,7 +891,8 @@ static struct platform_device at91sam9263_isi_device = { | |||
891 | .num_resources = ARRAY_SIZE(isi_resources), | 891 | .num_resources = ARRAY_SIZE(isi_resources), |
892 | }; | 892 | }; |
893 | 893 | ||
894 | void __init at91_add_device_isi(void) | 894 | void __init at91_add_device_isi(struct isi_platform_data *data, |
895 | bool use_pck_as_mck) | ||
895 | { | 896 | { |
896 | at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ | 897 | at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ |
897 | at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ | 898 | at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ |
@@ -904,14 +905,20 @@ void __init at91_add_device_isi(void) | |||
904 | at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ | 905 | at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ |
905 | at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ | 906 | at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ |
906 | at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ | 907 | at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ |
907 | at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ | ||
908 | at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ | 908 | at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ |
909 | at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ | 909 | at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ |
910 | at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ | 910 | at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ |
911 | at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ | 911 | at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ |
912 | |||
913 | if (use_pck_as_mck) { | ||
914 | at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ | ||
915 | |||
916 | /* TODO: register the PCK for ISI_MCK and set its parent */ | ||
917 | } | ||
912 | } | 918 | } |
913 | #else | 919 | #else |
914 | void __init at91_add_device_isi(void) {} | 920 | void __init at91_add_device_isi(struct isi_platform_data *data, |
921 | bool use_pck_as_mck) {} | ||
915 | #endif | 922 | #endif |
916 | 923 | ||
917 | 924 | ||
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index b7582dd10dc3..bd4e68cd3e2f 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
17 | #include <linux/clk.h> | ||
17 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
18 | #include <linux/i2c-gpio.h> | 19 | #include <linux/i2c-gpio.h> |
19 | #include <linux/atmel-mci.h> | 20 | #include <linux/atmel-mci.h> |
@@ -28,7 +29,10 @@ | |||
28 | #include <mach/at_hdmac.h> | 29 | #include <mach/at_hdmac.h> |
29 | #include <mach/atmel-mci.h> | 30 | #include <mach/atmel-mci.h> |
30 | 31 | ||
32 | #include <media/atmel-isi.h> | ||
33 | |||
31 | #include "generic.h" | 34 | #include "generic.h" |
35 | #include "clock.h" | ||
32 | 36 | ||
33 | 37 | ||
34 | /* -------------------------------------------------------------------- | 38 | /* -------------------------------------------------------------------- |
@@ -38,10 +42,6 @@ | |||
38 | #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE) | 42 | #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE) |
39 | static u64 hdmac_dmamask = DMA_BIT_MASK(32); | 43 | static u64 hdmac_dmamask = DMA_BIT_MASK(32); |
40 | 44 | ||
41 | static struct at_dma_platform_data atdma_pdata = { | ||
42 | .nr_channels = 8, | ||
43 | }; | ||
44 | |||
45 | static struct resource hdmac_resources[] = { | 45 | static struct resource hdmac_resources[] = { |
46 | [0] = { | 46 | [0] = { |
47 | .start = AT91SAM9G45_BASE_DMA, | 47 | .start = AT91SAM9G45_BASE_DMA, |
@@ -56,12 +56,11 @@ static struct resource hdmac_resources[] = { | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | static struct platform_device at_hdmac_device = { | 58 | static struct platform_device at_hdmac_device = { |
59 | .name = "at_hdmac", | 59 | .name = "at91sam9g45_dma", |
60 | .id = -1, | 60 | .id = -1, |
61 | .dev = { | 61 | .dev = { |
62 | .dma_mask = &hdmac_dmamask, | 62 | .dma_mask = &hdmac_dmamask, |
63 | .coherent_dma_mask = DMA_BIT_MASK(32), | 63 | .coherent_dma_mask = DMA_BIT_MASK(32), |
64 | .platform_data = &atdma_pdata, | ||
65 | }, | 64 | }, |
66 | .resource = hdmac_resources, | 65 | .resource = hdmac_resources, |
67 | .num_resources = ARRAY_SIZE(hdmac_resources), | 66 | .num_resources = ARRAY_SIZE(hdmac_resources), |
@@ -69,9 +68,15 @@ static struct platform_device at_hdmac_device = { | |||
69 | 68 | ||
70 | void __init at91_add_device_hdmac(void) | 69 | void __init at91_add_device_hdmac(void) |
71 | { | 70 | { |
72 | dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); | 71 | #if defined(CONFIG_OF) |
73 | dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask); | 72 | struct device_node *of_node = |
74 | platform_device_register(&at_hdmac_device); | 73 | of_find_node_by_name(NULL, "dma-controller"); |
74 | |||
75 | if (of_node) | ||
76 | of_node_put(of_node); | ||
77 | else | ||
78 | #endif | ||
79 | platform_device_register(&at_hdmac_device); | ||
75 | } | 80 | } |
76 | #else | 81 | #else |
77 | void __init at91_add_device_hdmac(void) {} | 82 | void __init at91_add_device_hdmac(void) {} |
@@ -869,6 +874,96 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
869 | void __init at91_add_device_ac97(struct ac97c_platform_data *data) {} | 874 | void __init at91_add_device_ac97(struct ac97c_platform_data *data) {} |
870 | #endif | 875 | #endif |
871 | 876 | ||
877 | /* -------------------------------------------------------------------- | ||
878 | * Image Sensor Interface | ||
879 | * -------------------------------------------------------------------- */ | ||
880 | #if defined(CONFIG_VIDEO_ATMEL_ISI) || defined(CONFIG_VIDEO_ATMEL_ISI_MODULE) | ||
881 | static u64 isi_dmamask = DMA_BIT_MASK(32); | ||
882 | static struct isi_platform_data isi_data; | ||
883 | |||
884 | struct resource isi_resources[] = { | ||
885 | [0] = { | ||
886 | .start = AT91SAM9G45_BASE_ISI, | ||
887 | .end = AT91SAM9G45_BASE_ISI + SZ_16K - 1, | ||
888 | .flags = IORESOURCE_MEM, | ||
889 | }, | ||
890 | [1] = { | ||
891 | .start = AT91SAM9G45_ID_ISI, | ||
892 | .end = AT91SAM9G45_ID_ISI, | ||
893 | .flags = IORESOURCE_IRQ, | ||
894 | }, | ||
895 | }; | ||
896 | |||
897 | static struct platform_device at91sam9g45_isi_device = { | ||
898 | .name = "atmel_isi", | ||
899 | .id = 0, | ||
900 | .dev = { | ||
901 | .dma_mask = &isi_dmamask, | ||
902 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
903 | .platform_data = &isi_data, | ||
904 | }, | ||
905 | .resource = isi_resources, | ||
906 | .num_resources = ARRAY_SIZE(isi_resources), | ||
907 | }; | ||
908 | |||
909 | static struct clk_lookup isi_mck_lookups[] = { | ||
910 | CLKDEV_CON_DEV_ID("isi_mck", "atmel_isi.0", NULL), | ||
911 | }; | ||
912 | |||
913 | void __init at91_add_device_isi(struct isi_platform_data *data, | ||
914 | bool use_pck_as_mck) | ||
915 | { | ||
916 | struct clk *pck; | ||
917 | struct clk *parent; | ||
918 | |||
919 | if (!data) | ||
920 | return; | ||
921 | isi_data = *data; | ||
922 | |||
923 | at91_set_A_periph(AT91_PIN_PB20, 0); /* ISI_D0 */ | ||
924 | at91_set_A_periph(AT91_PIN_PB21, 0); /* ISI_D1 */ | ||
925 | at91_set_A_periph(AT91_PIN_PB22, 0); /* ISI_D2 */ | ||
926 | at91_set_A_periph(AT91_PIN_PB23, 0); /* ISI_D3 */ | ||
927 | at91_set_A_periph(AT91_PIN_PB24, 0); /* ISI_D4 */ | ||
928 | at91_set_A_periph(AT91_PIN_PB25, 0); /* ISI_D5 */ | ||
929 | at91_set_A_periph(AT91_PIN_PB26, 0); /* ISI_D6 */ | ||
930 | at91_set_A_periph(AT91_PIN_PB27, 0); /* ISI_D7 */ | ||
931 | at91_set_A_periph(AT91_PIN_PB28, 0); /* ISI_PCK */ | ||
932 | at91_set_A_periph(AT91_PIN_PB30, 0); /* ISI_HSYNC */ | ||
933 | at91_set_A_periph(AT91_PIN_PB29, 0); /* ISI_VSYNC */ | ||
934 | at91_set_B_periph(AT91_PIN_PB8, 0); /* ISI_PD8 */ | ||
935 | at91_set_B_periph(AT91_PIN_PB9, 0); /* ISI_PD9 */ | ||
936 | at91_set_B_periph(AT91_PIN_PB10, 0); /* ISI_PD10 */ | ||
937 | at91_set_B_periph(AT91_PIN_PB11, 0); /* ISI_PD11 */ | ||
938 | |||
939 | platform_device_register(&at91sam9g45_isi_device); | ||
940 | |||
941 | if (use_pck_as_mck) { | ||
942 | at91_set_B_periph(AT91_PIN_PB31, 0); /* ISI_MCK (PCK1) */ | ||
943 | |||
944 | pck = clk_get(NULL, "pck1"); | ||
945 | parent = clk_get(NULL, "plla"); | ||
946 | |||
947 | BUG_ON(IS_ERR(pck) || IS_ERR(parent)); | ||
948 | |||
949 | if (clk_set_parent(pck, parent)) { | ||
950 | pr_err("Failed to set PCK's parent\n"); | ||
951 | } else { | ||
952 | /* Register PCK as ISI_MCK */ | ||
953 | isi_mck_lookups[0].clk = pck; | ||
954 | clkdev_add_table(isi_mck_lookups, | ||
955 | ARRAY_SIZE(isi_mck_lookups)); | ||
956 | } | ||
957 | |||
958 | clk_put(pck); | ||
959 | clk_put(parent); | ||
960 | } | ||
961 | } | ||
962 | #else | ||
963 | void __init at91_add_device_isi(struct isi_platform_data *data, | ||
964 | bool use_pck_as_mck) {} | ||
965 | #endif | ||
966 | |||
872 | 967 | ||
873 | /* -------------------------------------------------------------------- | 968 | /* -------------------------------------------------------------------- |
874 | * LCD Controller | 969 | * LCD Controller |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index 61908dce9784..9be71c11d0f0 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -33,10 +33,6 @@ | |||
33 | #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE) | 33 | #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE) |
34 | static u64 hdmac_dmamask = DMA_BIT_MASK(32); | 34 | static u64 hdmac_dmamask = DMA_BIT_MASK(32); |
35 | 35 | ||
36 | static struct at_dma_platform_data atdma_pdata = { | ||
37 | .nr_channels = 2, | ||
38 | }; | ||
39 | |||
40 | static struct resource hdmac_resources[] = { | 36 | static struct resource hdmac_resources[] = { |
41 | [0] = { | 37 | [0] = { |
42 | .start = AT91SAM9RL_BASE_DMA, | 38 | .start = AT91SAM9RL_BASE_DMA, |
@@ -51,12 +47,11 @@ static struct resource hdmac_resources[] = { | |||
51 | }; | 47 | }; |
52 | 48 | ||
53 | static struct platform_device at_hdmac_device = { | 49 | static struct platform_device at_hdmac_device = { |
54 | .name = "at_hdmac", | 50 | .name = "at91sam9rl_dma", |
55 | .id = -1, | 51 | .id = -1, |
56 | .dev = { | 52 | .dev = { |
57 | .dma_mask = &hdmac_dmamask, | 53 | .dma_mask = &hdmac_dmamask, |
58 | .coherent_dma_mask = DMA_BIT_MASK(32), | 54 | .coherent_dma_mask = DMA_BIT_MASK(32), |
59 | .platform_data = &atdma_pdata, | ||
60 | }, | 55 | }, |
61 | .resource = hdmac_resources, | 56 | .resource = hdmac_resources, |
62 | .num_resources = ARRAY_SIZE(hdmac_resources), | 57 | .num_resources = ARRAY_SIZE(hdmac_resources), |
@@ -64,7 +59,6 @@ static struct platform_device at_hdmac_device = { | |||
64 | 59 | ||
65 | void __init at91_add_device_hdmac(void) | 60 | void __init at91_add_device_hdmac(void) |
66 | { | 61 | { |
67 | dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); | ||
68 | platform_device_register(&at_hdmac_device); | 62 | platform_device_register(&at_hdmac_device); |
69 | } | 63 | } |
70 | #else | 64 | #else |
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c deleted file mode 100644 index ac3de4f7c31d..000000000000 --- a/arch/arm/mach-at91/board-cap9adk.c +++ /dev/null | |||
@@ -1,396 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-at91/board-cap9adk.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> | ||
5 | * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> | ||
6 | * Copyright (C) 2005 SAN People | ||
7 | * Copyright (C) 2007 Atmel Corporation. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/types.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/mm.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | #include <linux/spi/spi.h> | ||
31 | #include <linux/spi/ads7846.h> | ||
32 | #include <linux/fb.h> | ||
33 | #include <linux/mtd/physmap.h> | ||
34 | |||
35 | #include <video/atmel_lcdc.h> | ||
36 | |||
37 | #include <mach/hardware.h> | ||
38 | #include <asm/setup.h> | ||
39 | #include <asm/mach-types.h> | ||
40 | |||
41 | #include <asm/mach/arch.h> | ||
42 | #include <asm/mach/map.h> | ||
43 | |||
44 | #include <mach/board.h> | ||
45 | #include <mach/at91cap9_matrix.h> | ||
46 | #include <mach/at91sam9_smc.h> | ||
47 | #include <mach/system_rev.h> | ||
48 | |||
49 | #include "sam9_smc.h" | ||
50 | #include "generic.h" | ||
51 | |||
52 | |||
53 | static void __init cap9adk_init_early(void) | ||
54 | { | ||
55 | /* Initialize processor: 12 MHz crystal */ | ||
56 | at91_initialize(12000000); | ||
57 | |||
58 | /* Setup the LEDs: USER1 and USER2 LED for cpu/timer... */ | ||
59 | at91_init_leds(AT91_PIN_PA10, AT91_PIN_PA11); | ||
60 | /* ... POWER LED always on */ | ||
61 | at91_set_gpio_output(AT91_PIN_PC29, 1); | ||
62 | |||
63 | /* Setup the serial ports and console */ | ||
64 | at91_register_uart(0, 0, 0); /* DBGU = ttyS0 */ | ||
65 | at91_set_serial_console(0); | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * USB Host port | ||
70 | */ | ||
71 | static struct at91_usbh_data __initdata cap9adk_usbh_data = { | ||
72 | .ports = 2, | ||
73 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
74 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
75 | }; | ||
76 | |||
77 | /* | ||
78 | * USB HS Device port | ||
79 | */ | ||
80 | static struct usba_platform_data __initdata cap9adk_usba_udc_data = { | ||
81 | .vbus_pin = AT91_PIN_PB31, | ||
82 | }; | ||
83 | |||
84 | /* | ||
85 | * ADS7846 Touchscreen | ||
86 | */ | ||
87 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | ||
88 | static int ads7843_pendown_state(void) | ||
89 | { | ||
90 | return !at91_get_gpio_value(AT91_PIN_PC4); /* Touchscreen PENIRQ */ | ||
91 | } | ||
92 | |||
93 | static struct ads7846_platform_data ads_info = { | ||
94 | .model = 7843, | ||
95 | .x_min = 150, | ||
96 | .x_max = 3830, | ||
97 | .y_min = 190, | ||
98 | .y_max = 3830, | ||
99 | .vref_delay_usecs = 100, | ||
100 | .x_plate_ohms = 450, | ||
101 | .y_plate_ohms = 250, | ||
102 | .pressure_max = 15000, | ||
103 | .debounce_max = 1, | ||
104 | .debounce_rep = 0, | ||
105 | .debounce_tol = (~0), | ||
106 | .get_pendown_state = ads7843_pendown_state, | ||
107 | }; | ||
108 | |||
109 | static void __init cap9adk_add_device_ts(void) | ||
110 | { | ||
111 | at91_set_gpio_input(AT91_PIN_PC4, 1); /* Touchscreen PENIRQ */ | ||
112 | at91_set_gpio_input(AT91_PIN_PC5, 1); /* Touchscreen BUSY */ | ||
113 | } | ||
114 | #else | ||
115 | static void __init cap9adk_add_device_ts(void) {} | ||
116 | #endif | ||
117 | |||
118 | |||
119 | /* | ||
120 | * SPI devices. | ||
121 | */ | ||
122 | static struct spi_board_info cap9adk_spi_devices[] = { | ||
123 | #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD) | ||
124 | { /* DataFlash card */ | ||
125 | .modalias = "mtd_dataflash", | ||
126 | .chip_select = 0, | ||
127 | .max_speed_hz = 15 * 1000 * 1000, | ||
128 | .bus_num = 0, | ||
129 | }, | ||
130 | #endif | ||
131 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | ||
132 | { | ||
133 | .modalias = "ads7846", | ||
134 | .chip_select = 3, /* can be 2 or 3, depending on J2 jumper */ | ||
135 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ | ||
136 | .bus_num = 0, | ||
137 | .platform_data = &ads_info, | ||
138 | .irq = AT91_PIN_PC4, | ||
139 | }, | ||
140 | #endif | ||
141 | }; | ||
142 | |||
143 | |||
144 | /* | ||
145 | * MCI (SD/MMC) | ||
146 | */ | ||
147 | static struct at91_mmc_data __initdata cap9adk_mmc_data = { | ||
148 | .wire4 = 1, | ||
149 | .det_pin = -EINVAL, | ||
150 | .wp_pin = -EINVAL, | ||
151 | .vcc_pin = -EINVAL, | ||
152 | }; | ||
153 | |||
154 | |||
155 | /* | ||
156 | * MACB Ethernet device | ||
157 | */ | ||
158 | static struct macb_platform_data __initdata cap9adk_macb_data = { | ||
159 | .phy_irq_pin = -EINVAL, | ||
160 | .is_rmii = 1, | ||
161 | }; | ||
162 | |||
163 | |||
164 | /* | ||
165 | * NAND flash | ||
166 | */ | ||
167 | static struct mtd_partition __initdata cap9adk_nand_partitions[] = { | ||
168 | { | ||
169 | .name = "NAND partition", | ||
170 | .offset = 0, | ||
171 | .size = MTDPART_SIZ_FULL, | ||
172 | }, | ||
173 | }; | ||
174 | |||
175 | static struct atmel_nand_data __initdata cap9adk_nand_data = { | ||
176 | .ale = 21, | ||
177 | .cle = 22, | ||
178 | .det_pin = -EINVAL, | ||
179 | .rdy_pin = -EINVAL, | ||
180 | .enable_pin = AT91_PIN_PD15, | ||
181 | .parts = cap9adk_nand_partitions, | ||
182 | .num_parts = ARRAY_SIZE(cap9adk_nand_partitions), | ||
183 | }; | ||
184 | |||
185 | static struct sam9_smc_config __initdata cap9adk_nand_smc_config = { | ||
186 | .ncs_read_setup = 1, | ||
187 | .nrd_setup = 2, | ||
188 | .ncs_write_setup = 1, | ||
189 | .nwe_setup = 2, | ||
190 | |||
191 | .ncs_read_pulse = 6, | ||
192 | .nrd_pulse = 4, | ||
193 | .ncs_write_pulse = 6, | ||
194 | .nwe_pulse = 4, | ||
195 | |||
196 | .read_cycle = 8, | ||
197 | .write_cycle = 8, | ||
198 | |||
199 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, | ||
200 | .tdf_cycles = 1, | ||
201 | }; | ||
202 | |||
203 | static void __init cap9adk_add_device_nand(void) | ||
204 | { | ||
205 | unsigned long csa; | ||
206 | |||
207 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | ||
208 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); | ||
209 | |||
210 | cap9adk_nand_data.bus_width_16 = board_have_nand_16bit(); | ||
211 | /* setup bus-width (8 or 16) */ | ||
212 | if (cap9adk_nand_data.bus_width_16) | ||
213 | cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_16; | ||
214 | else | ||
215 | cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_8; | ||
216 | |||
217 | /* configure chip-select 3 (NAND) */ | ||
218 | sam9_smc_configure(0, 3, &cap9adk_nand_smc_config); | ||
219 | |||
220 | at91_add_device_nand(&cap9adk_nand_data); | ||
221 | } | ||
222 | |||
223 | |||
224 | /* | ||
225 | * NOR flash | ||
226 | */ | ||
227 | static struct mtd_partition cap9adk_nor_partitions[] = { | ||
228 | { | ||
229 | .name = "NOR partition", | ||
230 | .offset = 0, | ||
231 | .size = MTDPART_SIZ_FULL, | ||
232 | }, | ||
233 | }; | ||
234 | |||
235 | static struct physmap_flash_data cap9adk_nor_data = { | ||
236 | .width = 2, | ||
237 | .parts = cap9adk_nor_partitions, | ||
238 | .nr_parts = ARRAY_SIZE(cap9adk_nor_partitions), | ||
239 | }; | ||
240 | |||
241 | #define NOR_BASE AT91_CHIPSELECT_0 | ||
242 | #define NOR_SIZE SZ_8M | ||
243 | |||
244 | static struct resource nor_flash_resources[] = { | ||
245 | { | ||
246 | .start = NOR_BASE, | ||
247 | .end = NOR_BASE + NOR_SIZE - 1, | ||
248 | .flags = IORESOURCE_MEM, | ||
249 | } | ||
250 | }; | ||
251 | |||
252 | static struct platform_device cap9adk_nor_flash = { | ||
253 | .name = "physmap-flash", | ||
254 | .id = 0, | ||
255 | .dev = { | ||
256 | .platform_data = &cap9adk_nor_data, | ||
257 | }, | ||
258 | .resource = nor_flash_resources, | ||
259 | .num_resources = ARRAY_SIZE(nor_flash_resources), | ||
260 | }; | ||
261 | |||
262 | static struct sam9_smc_config __initdata cap9adk_nor_smc_config = { | ||
263 | .ncs_read_setup = 2, | ||
264 | .nrd_setup = 4, | ||
265 | .ncs_write_setup = 2, | ||
266 | .nwe_setup = 4, | ||
267 | |||
268 | .ncs_read_pulse = 10, | ||
269 | .nrd_pulse = 8, | ||
270 | .ncs_write_pulse = 10, | ||
271 | .nwe_pulse = 8, | ||
272 | |||
273 | .read_cycle = 16, | ||
274 | .write_cycle = 16, | ||
275 | |||
276 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16, | ||
277 | .tdf_cycles = 1, | ||
278 | }; | ||
279 | |||
280 | static __init void cap9adk_add_device_nor(void) | ||
281 | { | ||
282 | unsigned long csa; | ||
283 | |||
284 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | ||
285 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); | ||
286 | |||
287 | /* configure chip-select 0 (NOR) */ | ||
288 | sam9_smc_configure(0, 0, &cap9adk_nor_smc_config); | ||
289 | |||
290 | platform_device_register(&cap9adk_nor_flash); | ||
291 | } | ||
292 | |||
293 | |||
294 | /* | ||
295 | * LCD Controller | ||
296 | */ | ||
297 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | ||
298 | static struct fb_videomode at91_tft_vga_modes[] = { | ||
299 | { | ||
300 | .name = "TX09D50VM1CCA @ 60", | ||
301 | .refresh = 60, | ||
302 | .xres = 240, .yres = 320, | ||
303 | .pixclock = KHZ2PICOS(4965), | ||
304 | |||
305 | .left_margin = 1, .right_margin = 33, | ||
306 | .upper_margin = 1, .lower_margin = 0, | ||
307 | .hsync_len = 5, .vsync_len = 1, | ||
308 | |||
309 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
310 | .vmode = FB_VMODE_NONINTERLACED, | ||
311 | }, | ||
312 | }; | ||
313 | |||
314 | static struct fb_monspecs at91fb_default_monspecs = { | ||
315 | .manufacturer = "HIT", | ||
316 | .monitor = "TX09D70VM1CCA", | ||
317 | |||
318 | .modedb = at91_tft_vga_modes, | ||
319 | .modedb_len = ARRAY_SIZE(at91_tft_vga_modes), | ||
320 | .hfmin = 15000, | ||
321 | .hfmax = 64000, | ||
322 | .vfmin = 50, | ||
323 | .vfmax = 150, | ||
324 | }; | ||
325 | |||
326 | #define AT91CAP9_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ | ||
327 | | ATMEL_LCDC_DISTYPE_TFT \ | ||
328 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) | ||
329 | |||
330 | static void at91_lcdc_power_control(int on) | ||
331 | { | ||
332 | if (on) | ||
333 | at91_set_gpio_value(AT91_PIN_PC0, 0); /* power up */ | ||
334 | else | ||
335 | at91_set_gpio_value(AT91_PIN_PC0, 1); /* power down */ | ||
336 | } | ||
337 | |||
338 | /* Driver datas */ | ||
339 | static struct atmel_lcdfb_info __initdata cap9adk_lcdc_data = { | ||
340 | .default_bpp = 16, | ||
341 | .default_dmacon = ATMEL_LCDC_DMAEN, | ||
342 | .default_lcdcon2 = AT91CAP9_DEFAULT_LCDCON2, | ||
343 | .default_monspecs = &at91fb_default_monspecs, | ||
344 | .atmel_lcdfb_power_control = at91_lcdc_power_control, | ||
345 | .guard_time = 1, | ||
346 | }; | ||
347 | |||
348 | #else | ||
349 | static struct atmel_lcdfb_info __initdata cap9adk_lcdc_data; | ||
350 | #endif | ||
351 | |||
352 | |||
353 | /* | ||
354 | * AC97 | ||
355 | */ | ||
356 | static struct ac97c_platform_data cap9adk_ac97_data = { | ||
357 | .reset_pin = -EINVAL, | ||
358 | }; | ||
359 | |||
360 | |||
361 | static void __init cap9adk_board_init(void) | ||
362 | { | ||
363 | /* Serial */ | ||
364 | at91_add_device_serial(); | ||
365 | /* USB Host */ | ||
366 | at91_add_device_usbh(&cap9adk_usbh_data); | ||
367 | /* USB HS */ | ||
368 | at91_add_device_usba(&cap9adk_usba_udc_data); | ||
369 | /* SPI */ | ||
370 | at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices)); | ||
371 | /* Touchscreen */ | ||
372 | cap9adk_add_device_ts(); | ||
373 | /* MMC */ | ||
374 | at91_add_device_mmc(1, &cap9adk_mmc_data); | ||
375 | /* Ethernet */ | ||
376 | at91_add_device_eth(&cap9adk_macb_data); | ||
377 | /* NAND */ | ||
378 | cap9adk_add_device_nand(); | ||
379 | /* NOR Flash */ | ||
380 | cap9adk_add_device_nor(); | ||
381 | /* I2C */ | ||
382 | at91_add_device_i2c(NULL, 0); | ||
383 | /* LCD Controller */ | ||
384 | at91_add_device_lcdc(&cap9adk_lcdc_data); | ||
385 | /* AC97 */ | ||
386 | at91_add_device_ac97(&cap9adk_ac97_data); | ||
387 | } | ||
388 | |||
389 | MACHINE_START(AT91CAP9ADK, "Atmel AT91CAP9A-DK") | ||
390 | /* Maintainer: Stelian Pop <stelian.pop@leadtechdesign.com> */ | ||
391 | .timer = &at91sam926x_timer, | ||
392 | .map_io = at91_map_io, | ||
393 | .init_early = cap9adk_init_early, | ||
394 | .init_irq = at91_init_irq_default, | ||
395 | .init_machine = cap9adk_board_init, | ||
396 | MACHINE_END | ||
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c index eec02cd57ced..1815152001f7 100644 --- a/arch/arm/mach-at91/board-flexibity.c +++ b/arch/arm/mach-at91/board-flexibity.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-at91/board-flexibity.c | 2 | * linux/arch/arm/mach-at91/board-flexibity.c |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Flexibity | 4 | * Copyright (C) 2010-2011 Flexibity |
5 | * Copyright (C) 2005 SAN People | 5 | * Copyright (C) 2005 SAN People |
6 | * Copyright (C) 2006 Atmel | 6 | * Copyright (C) 2006 Atmel |
7 | * | 7 | * |
@@ -62,6 +62,13 @@ static struct at91_udc_data __initdata flexibity_udc_data = { | |||
62 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ | 62 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
63 | }; | 63 | }; |
64 | 64 | ||
65 | /* I2C devices */ | ||
66 | static struct i2c_board_info __initdata flexibity_i2c_devices[] = { | ||
67 | { | ||
68 | I2C_BOARD_INFO("ds1307", 0x68), | ||
69 | }, | ||
70 | }; | ||
71 | |||
65 | /* SPI devices */ | 72 | /* SPI devices */ |
66 | static struct spi_board_info flexibity_spi_devices[] = { | 73 | static struct spi_board_info flexibity_spi_devices[] = { |
67 | { /* DataFlash chip */ | 74 | { /* DataFlash chip */ |
@@ -141,6 +148,9 @@ static void __init flexibity_board_init(void) | |||
141 | at91_add_device_usbh(&flexibity_usbh_data); | 148 | at91_add_device_usbh(&flexibity_usbh_data); |
142 | /* USB Device */ | 149 | /* USB Device */ |
143 | at91_add_device_udc(&flexibity_udc_data); | 150 | at91_add_device_udc(&flexibity_udc_data); |
151 | /* I2C */ | ||
152 | at91_add_device_i2c(flexibity_i2c_devices, | ||
153 | ARRAY_SIZE(flexibity_i2c_devices)); | ||
144 | /* SPI */ | 154 | /* SPI */ |
145 | at91_add_device_spi(flexibity_spi_devices, | 155 | at91_add_device_spi(flexibity_spi_devices, |
146 | ARRAY_SIZE(flexibity_spi_devices)); | 156 | ARRAY_SIZE(flexibity_spi_devices)); |
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c index ea0d1b9c2b7b..57497e2b8878 100644 --- a/arch/arm/mach-at91/board-sam9m10g45ek.c +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c | |||
@@ -24,11 +24,13 @@ | |||
24 | #include <linux/gpio_keys.h> | 24 | #include <linux/gpio_keys.h> |
25 | #include <linux/input.h> | 25 | #include <linux/input.h> |
26 | #include <linux/leds.h> | 26 | #include <linux/leds.h> |
27 | #include <linux/clk.h> | ||
28 | #include <linux/atmel-mci.h> | 27 | #include <linux/atmel-mci.h> |
28 | #include <linux/delay.h> | ||
29 | 29 | ||
30 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
31 | #include <video/atmel_lcdc.h> | 31 | #include <video/atmel_lcdc.h> |
32 | #include <media/soc_camera.h> | ||
33 | #include <media/atmel-isi.h> | ||
32 | 34 | ||
33 | #include <asm/setup.h> | 35 | #include <asm/setup.h> |
34 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
@@ -185,6 +187,71 @@ static void __init ek_add_device_nand(void) | |||
185 | 187 | ||
186 | 188 | ||
187 | /* | 189 | /* |
190 | * ISI | ||
191 | */ | ||
192 | static struct isi_platform_data __initdata isi_data = { | ||
193 | .frate = ISI_CFG1_FRATE_CAPTURE_ALL, | ||
194 | /* to use codec and preview path simultaneously */ | ||
195 | .full_mode = 1, | ||
196 | .data_width_flags = ISI_DATAWIDTH_8 | ISI_DATAWIDTH_10, | ||
197 | /* ISI_MCK is provided by programmable clock or external clock */ | ||
198 | .mck_hz = 25000000, | ||
199 | }; | ||
200 | |||
201 | |||
202 | /* | ||
203 | * soc-camera OV2640 | ||
204 | */ | ||
205 | #if defined(CONFIG_SOC_CAMERA_OV2640) || \ | ||
206 | defined(CONFIG_SOC_CAMERA_OV2640_MODULE) | ||
207 | static unsigned long isi_camera_query_bus_param(struct soc_camera_link *link) | ||
208 | { | ||
209 | /* ISI board for ek using default 8-bits connection */ | ||
210 | return SOCAM_DATAWIDTH_8; | ||
211 | } | ||
212 | |||
213 | static int i2c_camera_power(struct device *dev, int on) | ||
214 | { | ||
215 | /* enable or disable the camera */ | ||
216 | pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); | ||
217 | at91_set_gpio_output(AT91_PIN_PD13, !on); | ||
218 | |||
219 | if (!on) | ||
220 | goto out; | ||
221 | |||
222 | /* If enabled, give a reset impulse */ | ||
223 | at91_set_gpio_output(AT91_PIN_PD12, 0); | ||
224 | msleep(20); | ||
225 | at91_set_gpio_output(AT91_PIN_PD12, 1); | ||
226 | msleep(100); | ||
227 | |||
228 | out: | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | static struct i2c_board_info i2c_camera = { | ||
233 | I2C_BOARD_INFO("ov2640", 0x30), | ||
234 | }; | ||
235 | |||
236 | static struct soc_camera_link iclink_ov2640 = { | ||
237 | .bus_id = 0, | ||
238 | .board_info = &i2c_camera, | ||
239 | .i2c_adapter_id = 0, | ||
240 | .power = i2c_camera_power, | ||
241 | .query_bus_param = isi_camera_query_bus_param, | ||
242 | }; | ||
243 | |||
244 | static struct platform_device isi_ov2640 = { | ||
245 | .name = "soc-camera-pdrv", | ||
246 | .id = 0, | ||
247 | .dev = { | ||
248 | .platform_data = &iclink_ov2640, | ||
249 | }, | ||
250 | }; | ||
251 | #endif | ||
252 | |||
253 | |||
254 | /* | ||
188 | * LCD Controller | 255 | * LCD Controller |
189 | */ | 256 | */ |
190 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | 257 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) |
@@ -377,7 +444,12 @@ static struct gpio_led ek_pwm_led[] = { | |||
377 | #endif | 444 | #endif |
378 | }; | 445 | }; |
379 | 446 | ||
380 | 447 | static struct platform_device *devices[] __initdata = { | |
448 | #if defined(CONFIG_SOC_CAMERA_OV2640) || \ | ||
449 | defined(CONFIG_SOC_CAMERA_OV2640_MODULE) | ||
450 | &isi_ov2640, | ||
451 | #endif | ||
452 | }; | ||
381 | 453 | ||
382 | static void __init ek_board_init(void) | 454 | static void __init ek_board_init(void) |
383 | { | 455 | { |
@@ -399,6 +471,8 @@ static void __init ek_board_init(void) | |||
399 | ek_add_device_nand(); | 471 | ek_add_device_nand(); |
400 | /* I2C */ | 472 | /* I2C */ |
401 | at91_add_device_i2c(0, NULL, 0); | 473 | at91_add_device_i2c(0, NULL, 0); |
474 | /* ISI, using programmable clock as ISI_MCK */ | ||
475 | at91_add_device_isi(&isi_data, true); | ||
402 | /* LCD Controller */ | 476 | /* LCD Controller */ |
403 | at91_add_device_lcdc(&ek_lcdc_data); | 477 | at91_add_device_lcdc(&ek_lcdc_data); |
404 | /* Touch Screen */ | 478 | /* Touch Screen */ |
@@ -410,6 +484,8 @@ static void __init ek_board_init(void) | |||
410 | /* LEDs */ | 484 | /* LEDs */ |
411 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | 485 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); |
412 | at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); | 486 | at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); |
487 | /* Other platform devices */ | ||
488 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
413 | } | 489 | } |
414 | 490 | ||
415 | MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK") | 491 | MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK") |
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index 61873f3aa92d..aa04e22a9da6 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
@@ -47,8 +47,7 @@ | |||
47 | /* | 47 | /* |
48 | * Chips have some kind of clocks : group them by functionality | 48 | * Chips have some kind of clocks : group them by functionality |
49 | */ | 49 | */ |
50 | #define cpu_has_utmi() ( cpu_is_at91cap9() \ | 50 | #define cpu_has_utmi() ( cpu_is_at91sam9rl() \ |
51 | || cpu_is_at91sam9rl() \ | ||
52 | || cpu_is_at91sam9g45()) | 51 | || cpu_is_at91sam9g45()) |
53 | 52 | ||
54 | #define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \ | 53 | #define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \ |
@@ -602,8 +601,6 @@ static void __init at91_pllb_usbfs_clock_init(unsigned long main_clock) | |||
602 | cpu_is_at91sam9g10()) { | 601 | cpu_is_at91sam9g10()) { |
603 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; | 602 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; |
604 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; | 603 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; |
605 | } else if (cpu_is_at91cap9()) { | ||
606 | uhpck.pmc_mask = AT91CAP9_PMC_UHP; | ||
607 | } | 604 | } |
608 | at91_sys_write(AT91_CKGR_PLLBR, 0); | 605 | at91_sys_write(AT91_CKGR_PLLBR, 0); |
609 | 606 | ||
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 594133451c0c..7e8280e798c1 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
@@ -45,7 +45,6 @@ extern void __init at91sam9261_set_console_clock(int id); | |||
45 | extern void __init at91sam9263_set_console_clock(int id); | 45 | extern void __init at91sam9263_set_console_clock(int id); |
46 | extern void __init at91sam9rl_set_console_clock(int id); | 46 | extern void __init at91sam9rl_set_console_clock(int id); |
47 | extern void __init at91sam9g45_set_console_clock(int id); | 47 | extern void __init at91sam9g45_set_console_clock(int id); |
48 | extern void __init at91cap9_set_console_clock(int id); | ||
49 | #ifdef CONFIG_AT91_PMC_UNIT | 48 | #ifdef CONFIG_AT91_PMC_UNIT |
50 | extern int __init at91_clock_init(unsigned long main_clock); | 49 | extern int __init at91_clock_init(unsigned long main_clock); |
51 | #else | 50 | #else |
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h index e46f93e34aab..dbdd6ae473d5 100644 --- a/arch/arm/mach-at91/include/mach/at91_pmc.h +++ b/arch/arm/mach-at91/include/mach/at91_pmc.h | |||
@@ -23,10 +23,8 @@ | |||
23 | #define AT91_PMC_PCK (1 << 0) /* Processor Clock */ | 23 | #define AT91_PMC_PCK (1 << 0) /* Processor Clock */ |
24 | #define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */ | 24 | #define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */ |
25 | #define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */ | 25 | #define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */ |
26 | #define AT91CAP9_PMC_DDR (1 << 2) /* DDR Clock [CAP9 revC & some SAM9 only] */ | ||
27 | #define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */ | 26 | #define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */ |
28 | #define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */ | 27 | #define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */ |
29 | #define AT91CAP9_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91CAP9 only] */ | ||
30 | #define AT91SAM926x_PMC_UDP (1 << 7) /* USB Devcice Port Clock [AT91SAM926x only] */ | 28 | #define AT91SAM926x_PMC_UDP (1 << 7) /* USB Devcice Port Clock [AT91SAM926x only] */ |
31 | #define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */ | 29 | #define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */ |
32 | #define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */ | 30 | #define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */ |
@@ -40,7 +38,7 @@ | |||
40 | #define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */ | 38 | #define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */ |
41 | #define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */ | 39 | #define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */ |
42 | 40 | ||
43 | #define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [some SAM9, CAP9] */ | 41 | #define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [some SAM9] */ |
44 | #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */ | 42 | #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */ |
45 | #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */ | 43 | #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */ |
46 | #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */ | 44 | #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */ |
@@ -48,7 +46,7 @@ | |||
48 | 46 | ||
49 | #define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */ | 47 | #define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */ |
50 | #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ | 48 | #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ |
51 | #define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass [SAM9x, CAP9] */ | 49 | #define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass [SAM9x] */ |
52 | #define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */ | 50 | #define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */ |
53 | 51 | ||
54 | #define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */ | 52 | #define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */ |
@@ -87,7 +85,7 @@ | |||
87 | #define AT91RM9200_PMC_MDIV_2 (1 << 8) | 85 | #define AT91RM9200_PMC_MDIV_2 (1 << 8) |
88 | #define AT91RM9200_PMC_MDIV_3 (2 << 8) | 86 | #define AT91RM9200_PMC_MDIV_3 (2 << 8) |
89 | #define AT91RM9200_PMC_MDIV_4 (3 << 8) | 87 | #define AT91RM9200_PMC_MDIV_4 (3 << 8) |
90 | #define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9,CAP9 only] */ | 88 | #define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9 only] */ |
91 | #define AT91SAM9_PMC_MDIV_2 (1 << 8) | 89 | #define AT91SAM9_PMC_MDIV_2 (1 << 8) |
92 | #define AT91SAM9_PMC_MDIV_4 (2 << 8) | 90 | #define AT91SAM9_PMC_MDIV_4 (2 << 8) |
93 | #define AT91SAM9_PMC_MDIV_6 (3 << 8) /* [some SAM9 only] */ | 91 | #define AT91SAM9_PMC_MDIV_6 (3 << 8) /* [some SAM9 only] */ |
@@ -117,17 +115,15 @@ | |||
117 | #define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */ | 115 | #define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */ |
118 | #define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ | 116 | #define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ |
119 | #define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */ | 117 | #define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */ |
120 | #define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9, AT91CAP9 only] */ | 118 | #define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9] */ |
121 | #define AT91_PMC_OSCSEL (1 << 7) /* Slow Clock Oscillator [AT91CAP9 revC only] */ | ||
122 | #define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */ | 119 | #define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */ |
123 | #define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */ | 120 | #define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */ |
124 | #define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */ | 121 | #define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */ |
125 | #define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */ | 122 | #define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */ |
126 | #define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */ | 123 | #define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */ |
127 | 124 | ||
128 | #define AT91_PMC_PROT (AT91_PMC + 0xe4) /* Protect Register [AT91CAP9 revC only] */ | 125 | #define AT91_PMC_PROT (AT91_PMC + 0xe4) /* Write Protect Mode Register [some SAM9] */ |
129 | #define AT91_PMC_PROTKEY 0x504d4301 /* Activation Code */ | 126 | #define AT91_PMC_PROTKEY 0x504d4301 /* Activation Code */ |
130 | 127 | ||
131 | #define AT91_PMC_VER (AT91_PMC + 0xfc) /* PMC Module Version [AT91CAP9 only] */ | ||
132 | 128 | ||
133 | #endif | 129 | #endif |
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h deleted file mode 100644 index 61d952902f2b..000000000000 --- a/arch/arm/mach-at91/include/mach/at91cap9.h +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/include/mach/at91cap9.h | ||
3 | * | ||
4 | * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> | ||
5 | * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> | ||
6 | * Copyright (C) 2007 Atmel Corporation. | ||
7 | * | ||
8 | * Common definitions. | ||
9 | * Based on AT91CAP9 datasheet revision B (Preliminary). | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | */ | ||
16 | |||
17 | #ifndef AT91CAP9_H | ||
18 | #define AT91CAP9_H | ||
19 | |||
20 | /* | ||
21 | * Peripheral identifiers/interrupts. | ||
22 | */ | ||
23 | #define AT91CAP9_ID_PIOABCD 2 /* Parallel IO Controller A, B, C and D */ | ||
24 | #define AT91CAP9_ID_MPB0 3 /* MP Block Peripheral 0 */ | ||
25 | #define AT91CAP9_ID_MPB1 4 /* MP Block Peripheral 1 */ | ||
26 | #define AT91CAP9_ID_MPB2 5 /* MP Block Peripheral 2 */ | ||
27 | #define AT91CAP9_ID_MPB3 6 /* MP Block Peripheral 3 */ | ||
28 | #define AT91CAP9_ID_MPB4 7 /* MP Block Peripheral 4 */ | ||
29 | #define AT91CAP9_ID_US0 8 /* USART 0 */ | ||
30 | #define AT91CAP9_ID_US1 9 /* USART 1 */ | ||
31 | #define AT91CAP9_ID_US2 10 /* USART 2 */ | ||
32 | #define AT91CAP9_ID_MCI0 11 /* Multimedia Card Interface 0 */ | ||
33 | #define AT91CAP9_ID_MCI1 12 /* Multimedia Card Interface 1 */ | ||
34 | #define AT91CAP9_ID_CAN 13 /* CAN */ | ||
35 | #define AT91CAP9_ID_TWI 14 /* Two-Wire Interface */ | ||
36 | #define AT91CAP9_ID_SPI0 15 /* Serial Peripheral Interface 0 */ | ||
37 | #define AT91CAP9_ID_SPI1 16 /* Serial Peripheral Interface 0 */ | ||
38 | #define AT91CAP9_ID_SSC0 17 /* Serial Synchronous Controller 0 */ | ||
39 | #define AT91CAP9_ID_SSC1 18 /* Serial Synchronous Controller 1 */ | ||
40 | #define AT91CAP9_ID_AC97C 19 /* AC97 Controller */ | ||
41 | #define AT91CAP9_ID_TCB 20 /* Timer Counter 0, 1 and 2 */ | ||
42 | #define AT91CAP9_ID_PWMC 21 /* Pulse Width Modulation Controller */ | ||
43 | #define AT91CAP9_ID_EMAC 22 /* Ethernet */ | ||
44 | #define AT91CAP9_ID_AESTDES 23 /* Advanced Encryption Standard, Triple DES */ | ||
45 | #define AT91CAP9_ID_ADC 24 /* Analog-to-Digital Converter */ | ||
46 | #define AT91CAP9_ID_ISI 25 /* Image Sensor Interface */ | ||
47 | #define AT91CAP9_ID_LCDC 26 /* LCD Controller */ | ||
48 | #define AT91CAP9_ID_DMA 27 /* DMA Controller */ | ||
49 | #define AT91CAP9_ID_UDPHS 28 /* USB High Speed Device Port */ | ||
50 | #define AT91CAP9_ID_UHP 29 /* USB Host Port */ | ||
51 | #define AT91CAP9_ID_IRQ0 30 /* Advanced Interrupt Controller (IRQ0) */ | ||
52 | #define AT91CAP9_ID_IRQ1 31 /* Advanced Interrupt Controller (IRQ1) */ | ||
53 | |||
54 | /* | ||
55 | * User Peripheral physical base addresses. | ||
56 | */ | ||
57 | #define AT91CAP9_BASE_UDPHS 0xfff78000 | ||
58 | #define AT91CAP9_BASE_TCB0 0xfff7c000 | ||
59 | #define AT91CAP9_BASE_TC0 0xfff7c000 | ||
60 | #define AT91CAP9_BASE_TC1 0xfff7c040 | ||
61 | #define AT91CAP9_BASE_TC2 0xfff7c080 | ||
62 | #define AT91CAP9_BASE_MCI0 0xfff80000 | ||
63 | #define AT91CAP9_BASE_MCI1 0xfff84000 | ||
64 | #define AT91CAP9_BASE_TWI 0xfff88000 | ||
65 | #define AT91CAP9_BASE_US0 0xfff8c000 | ||
66 | #define AT91CAP9_BASE_US1 0xfff90000 | ||
67 | #define AT91CAP9_BASE_US2 0xfff94000 | ||
68 | #define AT91CAP9_BASE_SSC0 0xfff98000 | ||
69 | #define AT91CAP9_BASE_SSC1 0xfff9c000 | ||
70 | #define AT91CAP9_BASE_AC97C 0xfffa0000 | ||
71 | #define AT91CAP9_BASE_SPI0 0xfffa4000 | ||
72 | #define AT91CAP9_BASE_SPI1 0xfffa8000 | ||
73 | #define AT91CAP9_BASE_CAN 0xfffac000 | ||
74 | #define AT91CAP9_BASE_PWMC 0xfffb8000 | ||
75 | #define AT91CAP9_BASE_EMAC 0xfffbc000 | ||
76 | #define AT91CAP9_BASE_ADC 0xfffc0000 | ||
77 | #define AT91CAP9_BASE_ISI 0xfffc4000 | ||
78 | |||
79 | /* | ||
80 | * System Peripherals (offset from AT91_BASE_SYS) | ||
81 | */ | ||
82 | #define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS) | ||
83 | #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) | ||
84 | #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) | ||
85 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | ||
86 | #define AT91_GPBR (cpu_is_at91cap9_revB() ? \ | ||
87 | (0xfffffd50 - AT91_BASE_SYS) : \ | ||
88 | (0xfffffd60 - AT91_BASE_SYS)) | ||
89 | |||
90 | #define AT91CAP9_BASE_ECC 0xffffe200 | ||
91 | #define AT91CAP9_BASE_DMA 0xffffec00 | ||
92 | #define AT91CAP9_BASE_SMC 0xffffe800 | ||
93 | #define AT91CAP9_BASE_DBGU AT91_BASE_DBGU1 | ||
94 | #define AT91CAP9_BASE_PIOA 0xfffff200 | ||
95 | #define AT91CAP9_BASE_PIOB 0xfffff400 | ||
96 | #define AT91CAP9_BASE_PIOC 0xfffff600 | ||
97 | #define AT91CAP9_BASE_PIOD 0xfffff800 | ||
98 | #define AT91CAP9_BASE_RSTC 0xfffffd00 | ||
99 | #define AT91CAP9_BASE_SHDWC 0xfffffd10 | ||
100 | #define AT91CAP9_BASE_RTT 0xfffffd20 | ||
101 | #define AT91CAP9_BASE_PIT 0xfffffd30 | ||
102 | #define AT91CAP9_BASE_WDT 0xfffffd40 | ||
103 | |||
104 | #define AT91_USART0 AT91CAP9_BASE_US0 | ||
105 | #define AT91_USART1 AT91CAP9_BASE_US1 | ||
106 | #define AT91_USART2 AT91CAP9_BASE_US2 | ||
107 | |||
108 | |||
109 | /* | ||
110 | * Internal Memory. | ||
111 | */ | ||
112 | #define AT91CAP9_SRAM_BASE 0x00100000 /* Internal SRAM base address */ | ||
113 | #define AT91CAP9_SRAM_SIZE (32 * SZ_1K) /* Internal SRAM size (32Kb) */ | ||
114 | |||
115 | #define AT91CAP9_ROM_BASE 0x00400000 /* Internal ROM base address */ | ||
116 | #define AT91CAP9_ROM_SIZE (32 * SZ_1K) /* Internal ROM size (32Kb) */ | ||
117 | |||
118 | #define AT91CAP9_LCDC_BASE 0x00500000 /* LCD Controller */ | ||
119 | #define AT91CAP9_UDPHS_FIFO 0x00600000 /* USB High Speed Device Port */ | ||
120 | #define AT91CAP9_UHP_BASE 0x00700000 /* USB Host controller */ | ||
121 | |||
122 | #endif | ||
diff --git a/arch/arm/mach-at91/include/mach/at91cap9_matrix.h b/arch/arm/mach-at91/include/mach/at91cap9_matrix.h deleted file mode 100644 index 4b9d4aff4b4f..000000000000 --- a/arch/arm/mach-at91/include/mach/at91cap9_matrix.h +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/include/mach/at91cap9_matrix.h | ||
3 | * | ||
4 | * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> | ||
5 | * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> | ||
6 | * Copyright (C) 2006 Atmel Corporation. | ||
7 | * | ||
8 | * Memory Controllers (MATRIX, EBI) - System peripherals registers. | ||
9 | * Based on AT91CAP9 datasheet revision B (Preliminary). | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | */ | ||
16 | |||
17 | #ifndef AT91CAP9_MATRIX_H | ||
18 | #define AT91CAP9_MATRIX_H | ||
19 | |||
20 | #define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */ | ||
21 | #define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */ | ||
22 | #define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */ | ||
23 | #define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */ | ||
24 | #define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */ | ||
25 | #define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */ | ||
26 | #define AT91_MATRIX_MCFG6 (AT91_MATRIX + 0x18) /* Master Configuration Register 6 */ | ||
27 | #define AT91_MATRIX_MCFG7 (AT91_MATRIX + 0x1C) /* Master Configuration Register 7 */ | ||
28 | #define AT91_MATRIX_MCFG8 (AT91_MATRIX + 0x20) /* Master Configuration Register 8 */ | ||
29 | #define AT91_MATRIX_MCFG9 (AT91_MATRIX + 0x24) /* Master Configuration Register 9 */ | ||
30 | #define AT91_MATRIX_MCFG10 (AT91_MATRIX + 0x28) /* Master Configuration Register 10 */ | ||
31 | #define AT91_MATRIX_MCFG11 (AT91_MATRIX + 0x2C) /* Master Configuration Register 11 */ | ||
32 | #define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ | ||
33 | #define AT91_MATRIX_ULBT_INFINITE (0 << 0) | ||
34 | #define AT91_MATRIX_ULBT_SINGLE (1 << 0) | ||
35 | #define AT91_MATRIX_ULBT_FOUR (2 << 0) | ||
36 | #define AT91_MATRIX_ULBT_EIGHT (3 << 0) | ||
37 | #define AT91_MATRIX_ULBT_SIXTEEN (4 << 0) | ||
38 | |||
39 | #define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */ | ||
40 | #define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */ | ||
41 | #define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */ | ||
42 | #define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */ | ||
43 | #define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */ | ||
44 | #define AT91_MATRIX_SCFG5 (AT91_MATRIX + 0x54) /* Slave Configuration Register 5 */ | ||
45 | #define AT91_MATRIX_SCFG6 (AT91_MATRIX + 0x58) /* Slave Configuration Register 6 */ | ||
46 | #define AT91_MATRIX_SCFG7 (AT91_MATRIX + 0x5C) /* Slave Configuration Register 7 */ | ||
47 | #define AT91_MATRIX_SCFG8 (AT91_MATRIX + 0x60) /* Slave Configuration Register 8 */ | ||
48 | #define AT91_MATRIX_SCFG9 (AT91_MATRIX + 0x64) /* Slave Configuration Register 9 */ | ||
49 | #define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */ | ||
50 | #define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ | ||
51 | #define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) | ||
52 | #define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16) | ||
53 | #define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16) | ||
54 | #define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */ | ||
55 | #define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */ | ||
56 | #define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24) | ||
57 | #define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24) | ||
58 | |||
59 | #define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */ | ||
60 | #define AT91_MATRIX_PRBS0 (AT91_MATRIX + 0x84) /* Priority Register B for Slave 0 */ | ||
61 | #define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */ | ||
62 | #define AT91_MATRIX_PRBS1 (AT91_MATRIX + 0x8C) /* Priority Register B for Slave 1 */ | ||
63 | #define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */ | ||
64 | #define AT91_MATRIX_PRBS2 (AT91_MATRIX + 0x94) /* Priority Register B for Slave 2 */ | ||
65 | #define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */ | ||
66 | #define AT91_MATRIX_PRBS3 (AT91_MATRIX + 0x9C) /* Priority Register B for Slave 3 */ | ||
67 | #define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */ | ||
68 | #define AT91_MATRIX_PRBS4 (AT91_MATRIX + 0xA4) /* Priority Register B for Slave 4 */ | ||
69 | #define AT91_MATRIX_PRAS5 (AT91_MATRIX + 0xA8) /* Priority Register A for Slave 5 */ | ||
70 | #define AT91_MATRIX_PRBS5 (AT91_MATRIX + 0xAC) /* Priority Register B for Slave 5 */ | ||
71 | #define AT91_MATRIX_PRAS6 (AT91_MATRIX + 0xB0) /* Priority Register A for Slave 6 */ | ||
72 | #define AT91_MATRIX_PRBS6 (AT91_MATRIX + 0xB4) /* Priority Register B for Slave 6 */ | ||
73 | #define AT91_MATRIX_PRAS7 (AT91_MATRIX + 0xB8) /* Priority Register A for Slave 7 */ | ||
74 | #define AT91_MATRIX_PRBS7 (AT91_MATRIX + 0xBC) /* Priority Register B for Slave 7 */ | ||
75 | #define AT91_MATRIX_PRAS8 (AT91_MATRIX + 0xC0) /* Priority Register A for Slave 8 */ | ||
76 | #define AT91_MATRIX_PRBS8 (AT91_MATRIX + 0xC4) /* Priority Register B for Slave 8 */ | ||
77 | #define AT91_MATRIX_PRAS9 (AT91_MATRIX + 0xC8) /* Priority Register A for Slave 9 */ | ||
78 | #define AT91_MATRIX_PRBS9 (AT91_MATRIX + 0xCC) /* Priority Register B for Slave 9 */ | ||
79 | #define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */ | ||
80 | #define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */ | ||
81 | #define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */ | ||
82 | #define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */ | ||
83 | #define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */ | ||
84 | #define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */ | ||
85 | #define AT91_MATRIX_M6PR (3 << 24) /* Master 6 Priority */ | ||
86 | #define AT91_MATRIX_M7PR (3 << 28) /* Master 7 Priority */ | ||
87 | #define AT91_MATRIX_M8PR (3 << 0) /* Master 8 Priority (in Register B) */ | ||
88 | #define AT91_MATRIX_M9PR (3 << 4) /* Master 9 Priority (in Register B) */ | ||
89 | #define AT91_MATRIX_M10PR (3 << 8) /* Master 10 Priority (in Register B) */ | ||
90 | #define AT91_MATRIX_M11PR (3 << 12) /* Master 11 Priority (in Register B) */ | ||
91 | |||
92 | #define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */ | ||
93 | #define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ | ||
94 | #define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ | ||
95 | #define AT91_MATRIX_RCB2 (1 << 2) | ||
96 | #define AT91_MATRIX_RCB3 (1 << 3) | ||
97 | #define AT91_MATRIX_RCB4 (1 << 4) | ||
98 | #define AT91_MATRIX_RCB5 (1 << 5) | ||
99 | #define AT91_MATRIX_RCB6 (1 << 6) | ||
100 | #define AT91_MATRIX_RCB7 (1 << 7) | ||
101 | #define AT91_MATRIX_RCB8 (1 << 8) | ||
102 | #define AT91_MATRIX_RCB9 (1 << 9) | ||
103 | #define AT91_MATRIX_RCB10 (1 << 10) | ||
104 | #define AT91_MATRIX_RCB11 (1 << 11) | ||
105 | |||
106 | #define AT91_MPBS0_SFR (AT91_MATRIX + 0x114) /* MPBlock Slave 0 Special Function Register */ | ||
107 | #define AT91_MPBS1_SFR (AT91_MATRIX + 0x11C) /* MPBlock Slave 1 Special Function Register */ | ||
108 | |||
109 | #define AT91_MATRIX_UDPHS (AT91_MATRIX + 0x118) /* USBHS Special Function Register [AT91CAP9 only] */ | ||
110 | #define AT91_MATRIX_SELECT_UDPHS (0 << 31) /* select High Speed UDP */ | ||
111 | #define AT91_MATRIX_SELECT_UDP (1 << 31) /* select standard UDP */ | ||
112 | #define AT91_MATRIX_UDPHS_BYPASS_LOCK (1 << 30) /* bypass lock bit */ | ||
113 | |||
114 | #define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI Chip Select Assignment Register */ | ||
115 | #define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */ | ||
116 | #define AT91_MATRIX_EBI_CS1A_SMC (0 << 1) | ||
117 | #define AT91_MATRIX_EBI_CS1A_BCRAMC (1 << 1) | ||
118 | #define AT91_MATRIX_EBI_CS3A (1 << 3) /* Chip Select 3 Assignment */ | ||
119 | #define AT91_MATRIX_EBI_CS3A_SMC (0 << 3) | ||
120 | #define AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA (1 << 3) | ||
121 | #define AT91_MATRIX_EBI_CS4A (1 << 4) /* Chip Select 4 Assignment */ | ||
122 | #define AT91_MATRIX_EBI_CS4A_SMC (0 << 4) | ||
123 | #define AT91_MATRIX_EBI_CS4A_SMC_CF1 (1 << 4) | ||
124 | #define AT91_MATRIX_EBI_CS5A (1 << 5) /* Chip Select 5 Assignment */ | ||
125 | #define AT91_MATRIX_EBI_CS5A_SMC (0 << 5) | ||
126 | #define AT91_MATRIX_EBI_CS5A_SMC_CF2 (1 << 5) | ||
127 | #define AT91_MATRIX_EBI_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ | ||
128 | #define AT91_MATRIX_EBI_DQSPDC (1 << 9) /* Data Qualifier Strobe Pull-Down Configuration */ | ||
129 | #define AT91_MATRIX_EBI_VDDIOMSEL (1 << 16) /* Memory voltage selection */ | ||
130 | #define AT91_MATRIX_EBI_VDDIOMSEL_1_8V (0 << 16) | ||
131 | #define AT91_MATRIX_EBI_VDDIOMSEL_3_3V (1 << 16) | ||
132 | |||
133 | #define AT91_MPBS2_SFR (AT91_MATRIX + 0x12C) /* MPBlock Slave 2 Special Function Register */ | ||
134 | #define AT91_MPBS3_SFR (AT91_MATRIX + 0x130) /* MPBlock Slave 3 Special Function Register */ | ||
135 | #define AT91_APB_SFR (AT91_MATRIX + 0x134) /* APB Bridge Special Function Register */ | ||
136 | |||
137 | #endif | ||
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h index e2f8da8ce5bc..5d4a9f846584 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h +++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | |||
@@ -59,7 +59,6 @@ | |||
59 | #define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */ | 59 | #define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */ |
60 | #define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */ | 60 | #define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */ |
61 | #define AT91_DDRSDRC_TWTR (0x7 << 24) /* Internal Write to Read delay */ | 61 | #define AT91_DDRSDRC_TWTR (0x7 << 24) /* Internal Write to Read delay */ |
62 | #define AT91CAP9_DDRSDRC_TWTR (1 << 24) /* Internal Write to Read delay */ | ||
63 | #define AT91_DDRSDRC_RED_WRRD (0x1 << 27) /* Reduce Write to Read Delay [SAM9 Only] */ | 62 | #define AT91_DDRSDRC_RED_WRRD (0x1 << 27) /* Reduce Write to Read Delay [SAM9 Only] */ |
64 | #define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */ | 63 | #define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */ |
65 | 64 | ||
@@ -76,7 +75,6 @@ | |||
76 | #define AT91_DDRSDRC_TRTP (0x7 << 12) /* Read to Precharge delay */ | 75 | #define AT91_DDRSDRC_TRTP (0x7 << 12) /* Read to Precharge delay */ |
77 | 76 | ||
78 | #define AT91_DDRSDRC_LPR 0x1C /* Low Power Register */ | 77 | #define AT91_DDRSDRC_LPR 0x1C /* Low Power Register */ |
79 | #define AT91CAP9_DDRSDRC_LPR 0x18 /* Low Power Register */ | ||
80 | #define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */ | 78 | #define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */ |
81 | #define AT91_DDRSDRC_LPCB_DISABLE 0 | 79 | #define AT91_DDRSDRC_LPCB_DISABLE 0 |
82 | #define AT91_DDRSDRC_LPCB_SELF_REFRESH 1 | 80 | #define AT91_DDRSDRC_LPCB_SELF_REFRESH 1 |
@@ -94,11 +92,9 @@ | |||
94 | #define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */ | 92 | #define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */ |
95 | 93 | ||
96 | #define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */ | 94 | #define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */ |
97 | #define AT91CAP9_DDRSDRC_MDR 0x1C /* Memory Device Register */ | ||
98 | #define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */ | 95 | #define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */ |
99 | #define AT91_DDRSDRC_MD_SDR 0 | 96 | #define AT91_DDRSDRC_MD_SDR 0 |
100 | #define AT91_DDRSDRC_MD_LOW_POWER_SDR 1 | 97 | #define AT91_DDRSDRC_MD_LOW_POWER_SDR 1 |
101 | #define AT91CAP9_DDRSDRC_MD_DDR 2 | ||
102 | #define AT91_DDRSDRC_MD_LOW_POWER_DDR 3 | 98 | #define AT91_DDRSDRC_MD_LOW_POWER_DDR 3 |
103 | #define AT91_DDRSDRC_MD_DDR2 6 /* [SAM9 Only] */ | 99 | #define AT91_DDRSDRC_MD_DDR2 6 /* [SAM9 Only] */ |
104 | #define AT91_DDRSDRC_DBW (1 << 4) /* Data Bus Width */ | 100 | #define AT91_DDRSDRC_DBW (1 << 4) /* Data Bus Width */ |
@@ -106,16 +102,10 @@ | |||
106 | #define AT91_DDRSDRC_DBW_16BITS (1 << 4) | 102 | #define AT91_DDRSDRC_DBW_16BITS (1 << 4) |
107 | 103 | ||
108 | #define AT91_DDRSDRC_DLL 0x24 /* DLL Information Register */ | 104 | #define AT91_DDRSDRC_DLL 0x24 /* DLL Information Register */ |
109 | #define AT91CAP9_DDRSDRC_DLL 0x20 /* DLL Information Register */ | ||
110 | #define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */ | 105 | #define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */ |
111 | #define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */ | 106 | #define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */ |
112 | #define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */ | 107 | #define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */ |
113 | #define AT91CAP9_DDRSDRC_SDCOVF (1 << 3) /* Slave Delay Correction Overflow */ | ||
114 | #define AT91CAP9_DDRSDRC_SDCUDF (1 << 4) /* Slave Delay Correction Underflow */ | ||
115 | #define AT91CAP9_DDRSDRC_SDERF (1 << 5) /* Slave Delay Correction error */ | ||
116 | #define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */ | 108 | #define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */ |
117 | #define AT91CAP9_DDRSDRC_SDVAL (0xff << 16) /* Slave Delay value */ | ||
118 | #define AT91CAP9_DDRSDRC_SDCVAL (0xff << 24) /* Slave Delay Correction value */ | ||
119 | 109 | ||
120 | #define AT91_DDRSDRC_HS 0x2C /* High Speed Register [SAM9 Only] */ | 110 | #define AT91_DDRSDRC_HS 0x2C /* High Speed Register [SAM9 Only] */ |
121 | #define AT91_DDRSDRC_DIS_ATCP_RD (1 << 2) /* Anticip read access is disabled */ | 111 | #define AT91_DDRSDRC_DIS_ATCP_RD (1 << 2) /* Anticip read access is disabled */ |
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index 3b33f07b1e11..dc8d6d4f17cf 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h | |||
@@ -107,6 +107,8 @@ struct atmel_nand_data { | |||
107 | u8 ale; /* address line number connected to ALE */ | 107 | u8 ale; /* address line number connected to ALE */ |
108 | u8 cle; /* address line number connected to CLE */ | 108 | u8 cle; /* address line number connected to CLE */ |
109 | u8 bus_width_16; /* buswidth is 16 bit */ | 109 | u8 bus_width_16; /* buswidth is 16 bit */ |
110 | u8 correction_cap; /* PMECC correction capability */ | ||
111 | u16 sector_size; /* Sector size for PMECC */ | ||
110 | struct mtd_partition *parts; | 112 | struct mtd_partition *parts; |
111 | unsigned int num_parts; | 113 | unsigned int num_parts; |
112 | }; | 114 | }; |
@@ -179,7 +181,9 @@ extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data); | |||
179 | extern void __init at91_add_device_ac97(struct ac97c_platform_data *data); | 181 | extern void __init at91_add_device_ac97(struct ac97c_platform_data *data); |
180 | 182 | ||
181 | /* ISI */ | 183 | /* ISI */ |
182 | extern void __init at91_add_device_isi(void); | 184 | struct isi_platform_data; |
185 | extern void __init at91_add_device_isi(struct isi_platform_data *data, | ||
186 | bool use_pck_as_mck); | ||
183 | 187 | ||
184 | /* Touchscreen Controller */ | 188 | /* Touchscreen Controller */ |
185 | struct at91_tsadcc_data { | 189 | struct at91_tsadcc_data { |
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h index f6ce936dba2b..0118c3338552 100644 --- a/arch/arm/mach-at91/include/mach/cpu.h +++ b/arch/arm/mach-at91/include/mach/cpu.h | |||
@@ -25,7 +25,6 @@ | |||
25 | #define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */ | 25 | #define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */ |
26 | #define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */ | 26 | #define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */ |
27 | #define ARCH_ID_AT91SAM9X5 0x819a05a0 | 27 | #define ARCH_ID_AT91SAM9X5 0x819a05a0 |
28 | #define ARCH_ID_AT91CAP9 0x039A03A0 | ||
29 | 28 | ||
30 | #define ARCH_ID_AT91SAM9XE128 0x329973a0 | 29 | #define ARCH_ID_AT91SAM9XE128 0x329973a0 |
31 | #define ARCH_ID_AT91SAM9XE256 0x329a93a0 | 30 | #define ARCH_ID_AT91SAM9XE256 0x329a93a0 |
@@ -51,10 +50,6 @@ | |||
51 | #define ARCH_FAMILY_AT91SAM9 0x01900000 | 50 | #define ARCH_FAMILY_AT91SAM9 0x01900000 |
52 | #define ARCH_FAMILY_AT91SAM9XE 0x02900000 | 51 | #define ARCH_FAMILY_AT91SAM9XE 0x02900000 |
53 | 52 | ||
54 | /* PMC revision */ | ||
55 | #define ARCH_REVISION_CAP9_B 0x399 | ||
56 | #define ARCH_REVISION_CAP9_C 0x601 | ||
57 | |||
58 | /* RM9200 type */ | 53 | /* RM9200 type */ |
59 | #define ARCH_REVISON_9200_BGA (0 << 0) | 54 | #define ARCH_REVISON_9200_BGA (0 << 0) |
60 | #define ARCH_REVISON_9200_PQFP (1 << 0) | 55 | #define ARCH_REVISON_9200_PQFP (1 << 0) |
@@ -63,9 +58,6 @@ enum at91_soc_type { | |||
63 | /* 920T */ | 58 | /* 920T */ |
64 | AT91_SOC_RM9200, | 59 | AT91_SOC_RM9200, |
65 | 60 | ||
66 | /* CAP */ | ||
67 | AT91_SOC_CAP9, | ||
68 | |||
69 | /* SAM92xx */ | 61 | /* SAM92xx */ |
70 | AT91_SOC_SAM9260, AT91_SOC_SAM9261, AT91_SOC_SAM9263, | 62 | AT91_SOC_SAM9260, AT91_SOC_SAM9261, AT91_SOC_SAM9263, |
71 | 63 | ||
@@ -86,9 +78,6 @@ enum at91_soc_subtype { | |||
86 | /* RM9200 */ | 78 | /* RM9200 */ |
87 | AT91_SOC_RM9200_BGA, AT91_SOC_RM9200_PQFP, | 79 | AT91_SOC_RM9200_BGA, AT91_SOC_RM9200_PQFP, |
88 | 80 | ||
89 | /* CAP9 */ | ||
90 | AT91_SOC_CAP9_REV_B, AT91_SOC_CAP9_REV_C, | ||
91 | |||
92 | /* SAM9260 */ | 81 | /* SAM9260 */ |
93 | AT91_SOC_SAM9XE, | 82 | AT91_SOC_SAM9XE, |
94 | 83 | ||
@@ -195,16 +184,6 @@ static inline int at91_soc_is_detected(void) | |||
195 | #define cpu_is_at91sam9x25() (0) | 184 | #define cpu_is_at91sam9x25() (0) |
196 | #endif | 185 | #endif |
197 | 186 | ||
198 | #ifdef CONFIG_ARCH_AT91CAP9 | ||
199 | #define cpu_is_at91cap9() (at91_soc_initdata.type == AT91_SOC_CAP9) | ||
200 | #define cpu_is_at91cap9_revB() (at91_soc_initdata.subtype == AT91_SOC_CAP9_REV_B) | ||
201 | #define cpu_is_at91cap9_revC() (at91_soc_initdata.subtype == AT91_SOC_CAP9_REV_C) | ||
202 | #else | ||
203 | #define cpu_is_at91cap9() (0) | ||
204 | #define cpu_is_at91cap9_revB() (0) | ||
205 | #define cpu_is_at91cap9_revC() (0) | ||
206 | #endif | ||
207 | |||
208 | /* | 187 | /* |
209 | * Since this is ARM, we will never run on any AVR32 CPU. But these | 188 | * Since this is ARM, we will never run on any AVR32 CPU. But these |
210 | * definitions may reduce clutter in common drivers. | 189 | * definitions may reduce clutter in common drivers. |
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h index 2d0e4e998566..c213f28628c0 100644 --- a/arch/arm/mach-at91/include/mach/hardware.h +++ b/arch/arm/mach-at91/include/mach/hardware.h | |||
@@ -19,7 +19,7 @@ | |||
19 | /* DBGU base */ | 19 | /* DBGU base */ |
20 | /* rm9200, 9260/9g20, 9261/9g10, 9rl */ | 20 | /* rm9200, 9260/9g20, 9261/9g10, 9rl */ |
21 | #define AT91_BASE_DBGU0 0xfffff200 | 21 | #define AT91_BASE_DBGU0 0xfffff200 |
22 | /* 9263, 9g45, cap9 */ | 22 | /* 9263, 9g45 */ |
23 | #define AT91_BASE_DBGU1 0xffffee00 | 23 | #define AT91_BASE_DBGU1 0xffffee00 |
24 | 24 | ||
25 | #if defined(CONFIG_ARCH_AT91RM9200) | 25 | #if defined(CONFIG_ARCH_AT91RM9200) |
@@ -34,8 +34,6 @@ | |||
34 | #include <mach/at91sam9rl.h> | 34 | #include <mach/at91sam9rl.h> |
35 | #elif defined(CONFIG_ARCH_AT91SAM9G45) | 35 | #elif defined(CONFIG_ARCH_AT91SAM9G45) |
36 | #include <mach/at91sam9g45.h> | 36 | #include <mach/at91sam9g45.h> |
37 | #elif defined(CONFIG_ARCH_AT91CAP9) | ||
38 | #include <mach/at91cap9.h> | ||
39 | #elif defined(CONFIG_ARCH_AT91X40) | 37 | #elif defined(CONFIG_ARCH_AT91X40) |
40 | #include <mach/at91x40.h> | 38 | #include <mach/at91x40.h> |
41 | #else | 39 | #else |
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 1606379ac284..87be5aa18753 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -150,11 +150,6 @@ static int at91_pm_verify_clocks(void) | |||
150 | pr_err("AT91: PM - Suspend-to-RAM with USB still active\n"); | 150 | pr_err("AT91: PM - Suspend-to-RAM with USB still active\n"); |
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | } else if (cpu_is_at91cap9()) { | ||
154 | if ((scsr & AT91CAP9_PMC_UHP) != 0) { | ||
155 | pr_err("AT91: PM - Suspend-to-RAM with USB still active\n"); | ||
156 | return 0; | ||
157 | } | ||
158 | } | 153 | } |
159 | 154 | ||
160 | #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS | 155 | #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS |
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index 7eb40d24242f..218d816427c0 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h | |||
@@ -24,24 +24,6 @@ static inline u32 sdram_selfrefresh_enable(void) | |||
24 | #define wait_for_interrupt_enable() asm volatile ("mcr p15, 0, %0, c7, c0, 4" \ | 24 | #define wait_for_interrupt_enable() asm volatile ("mcr p15, 0, %0, c7, c0, 4" \ |
25 | : : "r" (0)) | 25 | : : "r" (0)) |
26 | 26 | ||
27 | #elif defined(CONFIG_ARCH_AT91CAP9) | ||
28 | #include <mach/at91sam9_ddrsdr.h> | ||
29 | |||
30 | |||
31 | static inline u32 sdram_selfrefresh_enable(void) | ||
32 | { | ||
33 | u32 saved_lpr, lpr; | ||
34 | |||
35 | saved_lpr = at91_ramc_read(0, AT91CAP9_DDRSDRC_LPR); | ||
36 | |||
37 | lpr = saved_lpr & ~AT91_DDRSDRC_LPCB; | ||
38 | at91_ramc_write(0, AT91CAP9_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH); | ||
39 | return saved_lpr; | ||
40 | } | ||
41 | |||
42 | #define sdram_selfrefresh_disable(saved_lpr) at91_ramc_write(0, AT91CAP9_DDRSDRC_LPR, saved_lpr) | ||
43 | #define wait_for_interrupt_enable() cpu_do_idle() | ||
44 | |||
45 | #elif defined(CONFIG_ARCH_AT91SAM9G45) | 27 | #elif defined(CONFIG_ARCH_AT91SAM9G45) |
46 | #include <mach/at91sam9_ddrsdr.h> | 28 | #include <mach/at91sam9_ddrsdr.h> |
47 | 29 | ||
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S index 92dfb8461392..f8539a8bcd6c 100644 --- a/arch/arm/mach-at91/pm_slowclock.S +++ b/arch/arm/mach-at91/pm_slowclock.S | |||
@@ -18,8 +18,7 @@ | |||
18 | 18 | ||
19 | #if defined(CONFIG_ARCH_AT91RM9200) | 19 | #if defined(CONFIG_ARCH_AT91RM9200) |
20 | #include <mach/at91rm9200_mc.h> | 20 | #include <mach/at91rm9200_mc.h> |
21 | #elif defined(CONFIG_ARCH_AT91CAP9) \ | 21 | #elif defined(CONFIG_ARCH_AT91SAM9G45) |
22 | || defined(CONFIG_ARCH_AT91SAM9G45) | ||
23 | #include <mach/at91sam9_ddrsdr.h> | 22 | #include <mach/at91sam9_ddrsdr.h> |
24 | #else | 23 | #else |
25 | #include <mach/at91sam9_sdramc.h> | 24 | #include <mach/at91sam9_sdramc.h> |
@@ -130,8 +129,7 @@ ENTRY(at91_slow_clock) | |||
130 | /* Put SDRAM in self-refresh mode */ | 129 | /* Put SDRAM in self-refresh mode */ |
131 | mov r3, #1 | 130 | mov r3, #1 |
132 | str r3, [r2, #AT91_SDRAMC_SRR] | 131 | str r3, [r2, #AT91_SDRAMC_SRR] |
133 | #elif defined(CONFIG_ARCH_AT91CAP9) \ | 132 | #elif defined(CONFIG_ARCH_AT91SAM9G45) |
134 | || defined(CONFIG_ARCH_AT91SAM9G45) | ||
135 | 133 | ||
136 | /* prepare for DDRAM self-refresh mode */ | 134 | /* prepare for DDRAM self-refresh mode */ |
137 | ldr r3, [r2, #AT91_DDRSDRC_LPR] | 135 | ldr r3, [r2, #AT91_DDRSDRC_LPR] |
@@ -263,8 +261,7 @@ ENTRY(at91_slow_clock) | |||
263 | 261 | ||
264 | #ifdef CONFIG_ARCH_AT91RM9200 | 262 | #ifdef CONFIG_ARCH_AT91RM9200 |
265 | /* Do nothing - self-refresh is automatically disabled. */ | 263 | /* Do nothing - self-refresh is automatically disabled. */ |
266 | #elif defined(CONFIG_ARCH_AT91CAP9) \ | 264 | #elif defined(CONFIG_ARCH_AT91SAM9G45) |
267 | || defined(CONFIG_ARCH_AT91SAM9G45) | ||
268 | /* Restore LPR on AT91 with DDRAM */ | 265 | /* Restore LPR on AT91 with DDRAM */ |
269 | ldr r3, .saved_sam9_lpr | 266 | ldr r3, .saved_sam9_lpr |
270 | str r3, [r2, #AT91_DDRSDRC_LPR] | 267 | str r3, [r2, #AT91_DDRSDRC_LPR] |
@@ -305,8 +302,7 @@ ENTRY(at91_slow_clock) | |||
305 | #ifdef CONFIG_ARCH_AT91RM9200 | 302 | #ifdef CONFIG_ARCH_AT91RM9200 |
306 | .at91_va_base_sdramc: | 303 | .at91_va_base_sdramc: |
307 | .word AT91_VA_BASE_SYS | 304 | .word AT91_VA_BASE_SYS |
308 | #elif defined(CONFIG_ARCH_AT91CAP9) \ | 305 | #elif defined(CONFIG_ARCH_AT91SAM9G45) |
309 | || defined(CONFIG_ARCH_AT91SAM9G45) | ||
310 | .at91_va_base_sdramc: | 306 | .at91_va_base_sdramc: |
311 | .word AT91_VA_BASE_SYS + AT91_DDRSDRC0 | 307 | .word AT91_VA_BASE_SYS + AT91_DDRSDRC0 |
312 | #else | 308 | #else |
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 69d3fc4c46f3..620c67e8f814 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -86,20 +86,6 @@ static void __init soc_detect(u32 dbgu_base) | |||
86 | socid = cidr & ~AT91_CIDR_VERSION; | 86 | socid = cidr & ~AT91_CIDR_VERSION; |
87 | 87 | ||
88 | switch (socid) { | 88 | switch (socid) { |
89 | case ARCH_ID_AT91CAP9: { | ||
90 | #ifdef CONFIG_AT91_PMC_UNIT | ||
91 | u32 pmc_ver = at91_sys_read(AT91_PMC_VER); | ||
92 | |||
93 | if (pmc_ver == ARCH_REVISION_CAP9_B) | ||
94 | at91_soc_initdata.subtype = AT91_SOC_CAP9_REV_B; | ||
95 | else if (pmc_ver == ARCH_REVISION_CAP9_C) | ||
96 | at91_soc_initdata.subtype = AT91_SOC_CAP9_REV_C; | ||
97 | #endif | ||
98 | at91_soc_initdata.type = AT91_SOC_CAP9; | ||
99 | at91_boot_soc = at91cap9_soc; | ||
100 | break; | ||
101 | } | ||
102 | |||
103 | case ARCH_ID_AT91RM9200: | 89 | case ARCH_ID_AT91RM9200: |
104 | at91_soc_initdata.type = AT91_SOC_RM9200; | 90 | at91_soc_initdata.type = AT91_SOC_RM9200; |
105 | at91_boot_soc = at91rm9200_soc; | 91 | at91_boot_soc = at91rm9200_soc; |
@@ -200,7 +186,6 @@ static void __init soc_detect(u32 dbgu_base) | |||
200 | 186 | ||
201 | static const char *soc_name[] = { | 187 | static const char *soc_name[] = { |
202 | [AT91_SOC_RM9200] = "at91rm9200", | 188 | [AT91_SOC_RM9200] = "at91rm9200", |
203 | [AT91_SOC_CAP9] = "at91cap9", | ||
204 | [AT91_SOC_SAM9260] = "at91sam9260", | 189 | [AT91_SOC_SAM9260] = "at91sam9260", |
205 | [AT91_SOC_SAM9261] = "at91sam9261", | 190 | [AT91_SOC_SAM9261] = "at91sam9261", |
206 | [AT91_SOC_SAM9263] = "at91sam9263", | 191 | [AT91_SOC_SAM9263] = "at91sam9263", |
@@ -221,8 +206,6 @@ EXPORT_SYMBOL(at91_get_soc_type); | |||
221 | static const char *soc_subtype_name[] = { | 206 | static const char *soc_subtype_name[] = { |
222 | [AT91_SOC_RM9200_BGA] = "at91rm9200 BGA", | 207 | [AT91_SOC_RM9200_BGA] = "at91rm9200 BGA", |
223 | [AT91_SOC_RM9200_PQFP] = "at91rm9200 PQFP", | 208 | [AT91_SOC_RM9200_PQFP] = "at91rm9200 PQFP", |
224 | [AT91_SOC_CAP9_REV_B] = "at91cap9 revB", | ||
225 | [AT91_SOC_CAP9_REV_C] = "at91cap9 revC", | ||
226 | [AT91_SOC_SAM9XE] = "at91sam9xe", | 209 | [AT91_SOC_SAM9XE] = "at91sam9xe", |
227 | [AT91_SOC_SAM9G45ES] = "at91sam9g45es", | 210 | [AT91_SOC_SAM9G45ES] = "at91sam9g45es", |
228 | [AT91_SOC_SAM9M10] = "at91sam9m10", | 211 | [AT91_SOC_SAM9M10] = "at91sam9m10", |
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h index 4588ae6f7acd..5db4aa45404a 100644 --- a/arch/arm/mach-at91/soc.h +++ b/arch/arm/mach-at91/soc.h | |||
@@ -13,7 +13,6 @@ struct at91_init_soc { | |||
13 | }; | 13 | }; |
14 | 14 | ||
15 | extern struct at91_init_soc at91_boot_soc; | 15 | extern struct at91_init_soc at91_boot_soc; |
16 | extern struct at91_init_soc at91cap9_soc; | ||
17 | extern struct at91_init_soc at91rm9200_soc; | 16 | extern struct at91_init_soc at91rm9200_soc; |
18 | extern struct at91_init_soc at91sam9260_soc; | 17 | extern struct at91_init_soc at91sam9260_soc; |
19 | extern struct at91_init_soc at91sam9261_soc; | 18 | extern struct at91_init_soc at91sam9261_soc; |
@@ -27,10 +26,6 @@ static inline int at91_soc_is_enabled(void) | |||
27 | return at91_boot_soc.init != NULL; | 26 | return at91_boot_soc.init != NULL; |
28 | } | 27 | } |
29 | 28 | ||
30 | #if !defined(CONFIG_ARCH_AT91CAP9) | ||
31 | #define at91cap9_soc at91_boot_soc | ||
32 | #endif | ||
33 | |||
34 | #if !defined(CONFIG_ARCH_AT91RM9200) | 29 | #if !defined(CONFIG_ARCH_AT91RM9200) |
35 | #define at91rm9200_soc at91_boot_soc | 30 | #define at91rm9200_soc at91_boot_soc |
36 | #endif | 31 | #endif |
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 34e819068fa4..f494db872c67 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c | |||
@@ -394,7 +394,7 @@ void __init exynos4_init_irq(void) | |||
394 | gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000; | 394 | gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000; |
395 | 395 | ||
396 | if (!of_have_populated_dt()) | 396 | if (!of_have_populated_dt()) |
397 | gic_init_bases(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU, gic_bank_offset); | 397 | gic_init_bases(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU, gic_bank_offset, NULL); |
398 | #ifdef CONFIG_OF | 398 | #ifdef CONFIG_OF |
399 | else | 399 | else |
400 | of_irq_init(exynos4_dt_irq_match); | 400 | of_irq_init(exynos4_dt_irq_match); |
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c index 435261f83f46..685372f38bf1 100644 --- a/arch/arm/mach-exynos/mach-nuri.c +++ b/arch/arm/mach-exynos/mach-nuri.c | |||
@@ -115,7 +115,7 @@ static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = { | |||
115 | }; | 115 | }; |
116 | 116 | ||
117 | static struct regulator_consumer_supply emmc_supplies[] = { | 117 | static struct regulator_consumer_supply emmc_supplies[] = { |
118 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), | 118 | REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"), |
119 | REGULATOR_SUPPLY("vmmc", "dw_mmc"), | 119 | REGULATOR_SUPPLY("vmmc", "dw_mmc"), |
120 | }; | 120 | }; |
121 | 121 | ||
@@ -413,7 +413,7 @@ static struct regulator_consumer_supply __initdata max8997_ldo12_[] = { | |||
413 | REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */ | 413 | REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */ |
414 | }; | 414 | }; |
415 | static struct regulator_consumer_supply __initdata max8997_ldo13_[] = { | 415 | static struct regulator_consumer_supply __initdata max8997_ldo13_[] = { |
416 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */ | 416 | REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */ |
417 | }; | 417 | }; |
418 | static struct regulator_consumer_supply __initdata max8997_ldo14_[] = { | 418 | static struct regulator_consumer_supply __initdata max8997_ldo14_[] = { |
419 | REGULATOR_SUPPLY("inmotor", "max8997-haptic"), | 419 | REGULATOR_SUPPLY("inmotor", "max8997-haptic"), |
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index e00d8e26d525..44553933b144 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c | |||
@@ -741,7 +741,7 @@ static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = { | |||
741 | }; | 741 | }; |
742 | 742 | ||
743 | static struct regulator_consumer_supply mmc0_supplies[] = { | 743 | static struct regulator_consumer_supply mmc0_supplies[] = { |
744 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), | 744 | REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"), |
745 | }; | 745 | }; |
746 | 746 | ||
747 | static struct regulator_init_data mmc0_fixed_voltage_init_data = { | 747 | static struct regulator_init_data mmc0_fixed_voltage_init_data = { |
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 4defb97bbfc8..f7da8724965a 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -304,6 +304,7 @@ config MACH_MX27_3DS | |||
304 | select IMX_HAVE_PLATFORM_IMX_I2C | 304 | select IMX_HAVE_PLATFORM_IMX_I2C |
305 | select IMX_HAVE_PLATFORM_IMX_KEYPAD | 305 | select IMX_HAVE_PLATFORM_IMX_KEYPAD |
306 | select IMX_HAVE_PLATFORM_IMX_UART | 306 | select IMX_HAVE_PLATFORM_IMX_UART |
307 | select IMX_HAVE_PLATFORM_MX2_CAMERA | ||
307 | select IMX_HAVE_PLATFORM_MXC_EHCI | 308 | select IMX_HAVE_PLATFORM_MXC_EHCI |
308 | select IMX_HAVE_PLATFORM_MXC_MMC | 309 | select IMX_HAVE_PLATFORM_MXC_MMC |
309 | select IMX_HAVE_PLATFORM_SPI_IMX | 310 | select IMX_HAVE_PLATFORM_SPI_IMX |
diff --git a/arch/arm/mach-imx/clock-imx6q.c b/arch/arm/mach-imx/clock-imx6q.c index 2d88f8b9a454..111c328f5420 100644 --- a/arch/arm/mach-imx/clock-imx6q.c +++ b/arch/arm/mach-imx/clock-imx6q.c | |||
@@ -329,6 +329,12 @@ | |||
329 | #define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26) | 329 | #define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26) |
330 | #define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27) | 330 | #define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27) |
331 | 331 | ||
332 | #define BP_CCOSR_CKO1_EN 7 | ||
333 | #define BP_CCOSR_CKO1_PODF 4 | ||
334 | #define BM_CCOSR_CKO1_PODF (0x7 << 4) | ||
335 | #define BP_CCOSR_CKO1_SEL 0 | ||
336 | #define BM_CCOSR_CKO1_SEL (0xf << 0) | ||
337 | |||
332 | #define FREQ_480M 480000000 | 338 | #define FREQ_480M 480000000 |
333 | #define FREQ_528M 528000000 | 339 | #define FREQ_528M 528000000 |
334 | #define FREQ_594M 594000000 | 340 | #define FREQ_594M 594000000 |
@@ -393,6 +399,7 @@ static struct clk ipu1_di1_clk; | |||
393 | static struct clk ipu2_di0_clk; | 399 | static struct clk ipu2_di0_clk; |
394 | static struct clk ipu2_di1_clk; | 400 | static struct clk ipu2_di1_clk; |
395 | static struct clk enfc_clk; | 401 | static struct clk enfc_clk; |
402 | static struct clk cko1_clk; | ||
396 | static struct clk dummy_clk = {}; | 403 | static struct clk dummy_clk = {}; |
397 | 404 | ||
398 | static unsigned long external_high_reference; | 405 | static unsigned long external_high_reference; |
@@ -938,6 +945,24 @@ static void _clk_disable(struct clk *clk) | |||
938 | writel_relaxed(reg, clk->enable_reg); | 945 | writel_relaxed(reg, clk->enable_reg); |
939 | } | 946 | } |
940 | 947 | ||
948 | static int _clk_enable_1b(struct clk *clk) | ||
949 | { | ||
950 | u32 reg; | ||
951 | reg = readl_relaxed(clk->enable_reg); | ||
952 | reg |= 0x1 << clk->enable_shift; | ||
953 | writel_relaxed(reg, clk->enable_reg); | ||
954 | |||
955 | return 0; | ||
956 | } | ||
957 | |||
958 | static void _clk_disable_1b(struct clk *clk) | ||
959 | { | ||
960 | u32 reg; | ||
961 | reg = readl_relaxed(clk->enable_reg); | ||
962 | reg &= ~(0x1 << clk->enable_shift); | ||
963 | writel_relaxed(reg, clk->enable_reg); | ||
964 | } | ||
965 | |||
941 | struct divider { | 966 | struct divider { |
942 | struct clk *clk; | 967 | struct clk *clk; |
943 | void __iomem *reg; | 968 | void __iomem *reg; |
@@ -983,6 +1008,7 @@ DEF_CLK_DIV1(ipu2_di0_pre_div, &ipu2_di0_pre_clk, CSCDR2, IPU2_DI0_PRE); | |||
983 | DEF_CLK_DIV1(ipu2_di1_pre_div, &ipu2_di1_pre_clk, CSCDR2, IPU2_DI1_PRE); | 1008 | DEF_CLK_DIV1(ipu2_di1_pre_div, &ipu2_di1_pre_clk, CSCDR2, IPU2_DI1_PRE); |
984 | DEF_CLK_DIV1(ipu1_div, &ipu1_clk, CSCDR3, IPU1_HSP); | 1009 | DEF_CLK_DIV1(ipu1_div, &ipu1_clk, CSCDR3, IPU1_HSP); |
985 | DEF_CLK_DIV1(ipu2_div, &ipu2_clk, CSCDR3, IPU2_HSP); | 1010 | DEF_CLK_DIV1(ipu2_div, &ipu2_clk, CSCDR3, IPU2_HSP); |
1011 | DEF_CLK_DIV1(cko1_div, &cko1_clk, CCOSR, CKO1); | ||
986 | 1012 | ||
987 | #define DEF_CLK_DIV2(d, c, r, b) \ | 1013 | #define DEF_CLK_DIV2(d, c, r, b) \ |
988 | static struct divider d = { \ | 1014 | static struct divider d = { \ |
@@ -1038,6 +1064,7 @@ static struct divider *dividers[] = { | |||
1038 | &enfc_div, | 1064 | &enfc_div, |
1039 | &spdif_div, | 1065 | &spdif_div, |
1040 | &asrc_serial_div, | 1066 | &asrc_serial_div, |
1067 | &cko1_div, | ||
1041 | }; | 1068 | }; |
1042 | 1069 | ||
1043 | static unsigned long ldb_di_clk_get_rate(struct clk *clk) | 1070 | static unsigned long ldb_di_clk_get_rate(struct clk *clk) |
@@ -1625,6 +1652,32 @@ DEF_IPU_DI_MUX(CSCDR2, 2, 1); | |||
1625 | DEF_IPU_MUX(1); | 1652 | DEF_IPU_MUX(1); |
1626 | DEF_IPU_MUX(2); | 1653 | DEF_IPU_MUX(2); |
1627 | 1654 | ||
1655 | static struct multiplexer cko1_mux = { | ||
1656 | .clk = &cko1_clk, | ||
1657 | .reg = CCOSR, | ||
1658 | .bp = BP_CCOSR_CKO1_SEL, | ||
1659 | .bm = BM_CCOSR_CKO1_SEL, | ||
1660 | .parents = { | ||
1661 | &pll3_usb_otg, | ||
1662 | &pll2_bus, | ||
1663 | &pll1_sys, | ||
1664 | &pll5_video, | ||
1665 | &dummy_clk, | ||
1666 | &axi_clk, | ||
1667 | &enfc_clk, | ||
1668 | &ipu1_di0_clk, | ||
1669 | &ipu1_di1_clk, | ||
1670 | &ipu2_di0_clk, | ||
1671 | &ipu2_di1_clk, | ||
1672 | &ahb_clk, | ||
1673 | &ipg_clk, | ||
1674 | &ipg_perclk, | ||
1675 | &ckil_clk, | ||
1676 | &pll4_audio, | ||
1677 | NULL | ||
1678 | }, | ||
1679 | }; | ||
1680 | |||
1628 | static struct multiplexer *multiplexers[] = { | 1681 | static struct multiplexer *multiplexers[] = { |
1629 | &axi_mux, | 1682 | &axi_mux, |
1630 | &periph_mux, | 1683 | &periph_mux, |
@@ -1667,6 +1720,7 @@ static struct multiplexer *multiplexers[] = { | |||
1667 | &ipu2_di1_mux, | 1720 | &ipu2_di1_mux, |
1668 | &ipu1_mux, | 1721 | &ipu1_mux, |
1669 | &ipu2_mux, | 1722 | &ipu2_mux, |
1723 | &cko1_mux, | ||
1670 | }; | 1724 | }; |
1671 | 1725 | ||
1672 | static int _clk_set_parent(struct clk *clk, struct clk *parent) | 1726 | static int _clk_set_parent(struct clk *clk, struct clk *parent) |
@@ -1690,7 +1744,7 @@ static int _clk_set_parent(struct clk *clk, struct clk *parent) | |||
1690 | break; | 1744 | break; |
1691 | i++; | 1745 | i++; |
1692 | } | 1746 | } |
1693 | if (!m->parents[i]) | 1747 | if (!m->parents[i] || m->parents[i] == &dummy_clk) |
1694 | return -EINVAL; | 1748 | return -EINVAL; |
1695 | 1749 | ||
1696 | val = readl_relaxed(m->reg); | 1750 | val = readl_relaxed(m->reg); |
@@ -1745,6 +1799,20 @@ DEF_NG_CLK(asrc_serial_clk, &pll3_usb_otg); | |||
1745 | .secondary = s, \ | 1799 | .secondary = s, \ |
1746 | } | 1800 | } |
1747 | 1801 | ||
1802 | #define DEF_CLK_1B(name, er, es, p, s) \ | ||
1803 | static struct clk name = { \ | ||
1804 | .enable_reg = er, \ | ||
1805 | .enable_shift = es, \ | ||
1806 | .enable = _clk_enable_1b, \ | ||
1807 | .disable = _clk_disable_1b, \ | ||
1808 | .get_rate = _clk_get_rate, \ | ||
1809 | .set_rate = _clk_set_rate, \ | ||
1810 | .round_rate = _clk_round_rate, \ | ||
1811 | .set_parent = _clk_set_parent, \ | ||
1812 | .parent = p, \ | ||
1813 | .secondary = s, \ | ||
1814 | } | ||
1815 | |||
1748 | DEF_CLK(aips_tz1_clk, CCGR0, CG0, &ahb_clk, NULL); | 1816 | DEF_CLK(aips_tz1_clk, CCGR0, CG0, &ahb_clk, NULL); |
1749 | DEF_CLK(aips_tz2_clk, CCGR0, CG1, &ahb_clk, NULL); | 1817 | DEF_CLK(aips_tz2_clk, CCGR0, CG1, &ahb_clk, NULL); |
1750 | DEF_CLK(apbh_dma_clk, CCGR0, CG2, &ahb_clk, NULL); | 1818 | DEF_CLK(apbh_dma_clk, CCGR0, CG2, &ahb_clk, NULL); |
@@ -1811,6 +1879,7 @@ DEF_CLK(usdhc4_clk, CCGR6, CG4, &pll2_pfd_400m, NULL); | |||
1811 | DEF_CLK(emi_slow_clk, CCGR6, CG5, &axi_clk, NULL); | 1879 | DEF_CLK(emi_slow_clk, CCGR6, CG5, &axi_clk, NULL); |
1812 | DEF_CLK(vdo_axi_clk, CCGR6, CG6, &axi_clk, NULL); | 1880 | DEF_CLK(vdo_axi_clk, CCGR6, CG6, &axi_clk, NULL); |
1813 | DEF_CLK(vpu_clk, CCGR6, CG7, &axi_clk, NULL); | 1881 | DEF_CLK(vpu_clk, CCGR6, CG7, &axi_clk, NULL); |
1882 | DEF_CLK_1B(cko1_clk, CCOSR, BP_CCOSR_CKO1_EN, &pll2_bus, NULL); | ||
1814 | 1883 | ||
1815 | static int pcie_clk_enable(struct clk *clk) | 1884 | static int pcie_clk_enable(struct clk *clk) |
1816 | { | 1885 | { |
@@ -1922,6 +1991,7 @@ static struct clk_lookup lookups[] = { | |||
1922 | _REGISTER_CLOCK(NULL, "gpmi_io_clk", gpmi_io_clk), | 1991 | _REGISTER_CLOCK(NULL, "gpmi_io_clk", gpmi_io_clk), |
1923 | _REGISTER_CLOCK(NULL, "usboh3_clk", usboh3_clk), | 1992 | _REGISTER_CLOCK(NULL, "usboh3_clk", usboh3_clk), |
1924 | _REGISTER_CLOCK(NULL, "sata_clk", sata_clk), | 1993 | _REGISTER_CLOCK(NULL, "sata_clk", sata_clk), |
1994 | _REGISTER_CLOCK(NULL, "cko1_clk", cko1_clk), | ||
1925 | }; | 1995 | }; |
1926 | 1996 | ||
1927 | int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode) | 1997 | int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode) |
@@ -2029,6 +2099,8 @@ int __init mx6q_clocks_init(void) | |||
2029 | clk_set_rate(&usdhc3_clk, 49500000); | 2099 | clk_set_rate(&usdhc3_clk, 49500000); |
2030 | clk_set_rate(&usdhc4_clk, 49500000); | 2100 | clk_set_rate(&usdhc4_clk, 49500000); |
2031 | 2101 | ||
2102 | clk_set_parent(&cko1_clk, &ahb_clk); | ||
2103 | |||
2032 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); | 2104 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); |
2033 | base = of_iomap(np, 0); | 2105 | base = of_iomap(np, 0); |
2034 | WARN_ON(!base); | 2106 | WARN_ON(!base); |
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c index e6bad17b908c..1e03ef42faa0 100644 --- a/arch/arm/mach-imx/imx51-dt.c +++ b/arch/arm/mach-imx/imx51-dt.c | |||
@@ -47,7 +47,7 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = { | |||
47 | static int __init imx51_tzic_add_irq_domain(struct device_node *np, | 47 | static int __init imx51_tzic_add_irq_domain(struct device_node *np, |
48 | struct device_node *interrupt_parent) | 48 | struct device_node *interrupt_parent) |
49 | { | 49 | { |
50 | irq_domain_add_simple(np, 0); | 50 | irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL); |
51 | return 0; | 51 | return 0; |
52 | } | 52 | } |
53 | 53 | ||
@@ -57,7 +57,7 @@ static int __init imx51_gpio_add_irq_domain(struct device_node *np, | |||
57 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; | 57 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
58 | 58 | ||
59 | gpio_irq_base -= 32; | 59 | gpio_irq_base -= 32; |
60 | irq_domain_add_simple(np, gpio_irq_base); | 60 | irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, NULL); |
61 | 61 | ||
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
diff --git a/arch/arm/mach-imx/imx53-dt.c b/arch/arm/mach-imx/imx53-dt.c index 05ebb3e68679..fd5be0f20fbb 100644 --- a/arch/arm/mach-imx/imx53-dt.c +++ b/arch/arm/mach-imx/imx53-dt.c | |||
@@ -51,7 +51,7 @@ static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = { | |||
51 | static int __init imx53_tzic_add_irq_domain(struct device_node *np, | 51 | static int __init imx53_tzic_add_irq_domain(struct device_node *np, |
52 | struct device_node *interrupt_parent) | 52 | struct device_node *interrupt_parent) |
53 | { | 53 | { |
54 | irq_domain_add_simple(np, 0); | 54 | irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL); |
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
57 | 57 | ||
@@ -61,7 +61,7 @@ static int __init imx53_gpio_add_irq_domain(struct device_node *np, | |||
61 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; | 61 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
62 | 62 | ||
63 | gpio_irq_base -= 32; | 63 | gpio_irq_base -= 32; |
64 | irq_domain_add_simple(np, gpio_irq_base); | 64 | irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, NULL); |
65 | 65 | ||
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
diff --git a/arch/arm/mach-imx/lluart.c b/arch/arm/mach-imx/lluart.c index d4ab6f29a766..0213f8dcee81 100644 --- a/arch/arm/mach-imx/lluart.c +++ b/arch/arm/mach-imx/lluart.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <mach/hardware.h> | 17 | #include <mach/hardware.h> |
18 | 18 | ||
19 | static struct map_desc imx_lluart_desc = { | 19 | static struct map_desc imx_lluart_desc = { |
20 | #ifdef CONFIG_DEBUG_IMX6Q_UART | 20 | #ifdef CONFIG_DEBUG_IMX6Q_UART4 |
21 | .virtual = MX6Q_IO_P2V(MX6Q_UART4_BASE_ADDR), | 21 | .virtual = MX6Q_IO_P2V(MX6Q_UART4_BASE_ADDR), |
22 | .pfn = __phys_to_pfn(MX6Q_UART4_BASE_ADDR), | 22 | .pfn = __phys_to_pfn(MX6Q_UART4_BASE_ADDR), |
23 | .length = MX6Q_UART4_SIZE, | 23 | .length = MX6Q_UART4_SIZE, |
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index c25728106917..6075d4d62dd6 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c | |||
@@ -97,7 +97,8 @@ static int __init imx6q_gpio_add_irq_domain(struct device_node *np, | |||
97 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; | 97 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
98 | 98 | ||
99 | gpio_irq_base -= 32; | 99 | gpio_irq_base -= 32; |
100 | irq_domain_add_simple(np, gpio_irq_base); | 100 | irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, |
101 | NULL); | ||
101 | 102 | ||
102 | return 0; | 103 | return 0; |
103 | } | 104 | } |
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c index 8d9f95514b1f..e432d4acee1f 100644 --- a/arch/arm/mach-imx/mach-mx21ads.c +++ b/arch/arm/mach-imx/mach-mx21ads.c | |||
@@ -37,8 +37,8 @@ | |||
37 | #define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ | 37 | #define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ |
38 | (MX21ADS_MMIO_BASE_ADDR + (offset)) | 38 | (MX21ADS_MMIO_BASE_ADDR + (offset)) |
39 | 39 | ||
40 | #define MX21ADS_CS8900A_MMIO_SIZE 0x200000 | ||
40 | #define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11) | 41 | #define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11) |
41 | #define MX21ADS_CS8900A_IOBASE_REG MX21ADS_REG_ADDR(0x000000) | ||
42 | #define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) | 42 | #define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) |
43 | #define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000) | 43 | #define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000) |
44 | #define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000) | 44 | #define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000) |
@@ -159,6 +159,18 @@ static struct platform_device mx21ads_nor_mtd_device = { | |||
159 | .resource = &mx21ads_flash_resource, | 159 | .resource = &mx21ads_flash_resource, |
160 | }; | 160 | }; |
161 | 161 | ||
162 | static const struct resource mx21ads_cs8900_resources[] __initconst = { | ||
163 | DEFINE_RES_MEM(MX21_CS1_BASE_ADDR, MX21ADS_CS8900A_MMIO_SIZE), | ||
164 | DEFINE_RES_IRQ(MX21ADS_CS8900A_IRQ), | ||
165 | }; | ||
166 | |||
167 | static const struct platform_device_info mx21ads_cs8900_devinfo __initconst = { | ||
168 | .name = "cs89x0", | ||
169 | .id = 0, | ||
170 | .res = mx21ads_cs8900_resources, | ||
171 | .num_res = ARRAY_SIZE(mx21ads_cs8900_resources), | ||
172 | }; | ||
173 | |||
162 | static const struct imxuart_platform_data uart_pdata_rts __initconst = { | 174 | static const struct imxuart_platform_data uart_pdata_rts __initconst = { |
163 | .flags = IMXUART_HAVE_RTSCTS, | 175 | .flags = IMXUART_HAVE_RTSCTS, |
164 | }; | 176 | }; |
@@ -292,6 +304,8 @@ static void __init mx21ads_board_init(void) | |||
292 | imx21_add_mxc_nand(&mx21ads_nand_board_info); | 304 | imx21_add_mxc_nand(&mx21ads_nand_board_info); |
293 | 305 | ||
294 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 306 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
307 | platform_device_register_full( | ||
308 | (struct platform_device_info *)&mx21ads_cs8900_devinfo); | ||
295 | } | 309 | } |
296 | 310 | ||
297 | static void __init mx21ads_timer_init(void) | 311 | static void __init mx21ads_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index 18f35816706a..c6d385c52257 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include <linux/regulator/machine.h> | 31 | #include <linux/regulator/machine.h> |
32 | #include <linux/spi/l4f00242t03.h> | 32 | #include <linux/spi/l4f00242t03.h> |
33 | 33 | ||
34 | #include <media/soc_camera.h> | ||
35 | |||
34 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
35 | #include <asm/mach/arch.h> | 37 | #include <asm/mach/arch.h> |
36 | #include <asm/mach/time.h> | 38 | #include <asm/mach/time.h> |
@@ -52,6 +54,8 @@ | |||
52 | #define SD1_CD IMX_GPIO_NR(2, 26) | 54 | #define SD1_CD IMX_GPIO_NR(2, 26) |
53 | #define LCD_RESET IMX_GPIO_NR(1, 3) | 55 | #define LCD_RESET IMX_GPIO_NR(1, 3) |
54 | #define LCD_ENABLE IMX_GPIO_NR(1, 31) | 56 | #define LCD_ENABLE IMX_GPIO_NR(1, 31) |
57 | #define CSI_PWRDWN IMX_GPIO_NR(4, 19) | ||
58 | #define CSI_RESET IMX_GPIO_NR(3, 6) | ||
55 | 59 | ||
56 | static const int mx27pdk_pins[] __initconst = { | 60 | static const int mx27pdk_pins[] __initconst = { |
57 | /* UART1 */ | 61 | /* UART1 */ |
@@ -141,6 +145,26 @@ static const int mx27pdk_pins[] __initconst = { | |||
141 | PA30_PF_CONTRAST, | 145 | PA30_PF_CONTRAST, |
142 | LCD_ENABLE | GPIO_GPIO | GPIO_OUT, | 146 | LCD_ENABLE | GPIO_GPIO | GPIO_OUT, |
143 | LCD_RESET | GPIO_GPIO | GPIO_OUT, | 147 | LCD_RESET | GPIO_GPIO | GPIO_OUT, |
148 | /* CSI */ | ||
149 | PB10_PF_CSI_D0, | ||
150 | PB11_PF_CSI_D1, | ||
151 | PB12_PF_CSI_D2, | ||
152 | PB13_PF_CSI_D3, | ||
153 | PB14_PF_CSI_D4, | ||
154 | PB15_PF_CSI_MCLK, | ||
155 | PB16_PF_CSI_PIXCLK, | ||
156 | PB17_PF_CSI_D5, | ||
157 | PB18_PF_CSI_D6, | ||
158 | PB19_PF_CSI_D7, | ||
159 | PB20_PF_CSI_VSYNC, | ||
160 | PB21_PF_CSI_HSYNC, | ||
161 | CSI_PWRDWN | GPIO_GPIO | GPIO_OUT, | ||
162 | CSI_RESET | GPIO_GPIO | GPIO_OUT, | ||
163 | }; | ||
164 | |||
165 | static struct gpio mx27_3ds_camera_gpios[] = { | ||
166 | { CSI_PWRDWN, GPIOF_OUT_INIT_HIGH, "camera-power" }, | ||
167 | { CSI_RESET, GPIOF_OUT_INIT_HIGH, "camera-reset" }, | ||
144 | }; | 168 | }; |
145 | 169 | ||
146 | static const struct imxuart_platform_data uart_pdata __initconst = { | 170 | static const struct imxuart_platform_data uart_pdata __initconst = { |
@@ -242,6 +266,7 @@ static struct regulator_init_data gpo_init = { | |||
242 | 266 | ||
243 | static struct regulator_consumer_supply vmmc1_consumers[] = { | 267 | static struct regulator_consumer_supply vmmc1_consumers[] = { |
244 | REGULATOR_SUPPLY("vcore", "spi0.0"), | 268 | REGULATOR_SUPPLY("vcore", "spi0.0"), |
269 | REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"), | ||
245 | }; | 270 | }; |
246 | 271 | ||
247 | static struct regulator_init_data vmmc1_init = { | 272 | static struct regulator_init_data vmmc1_init = { |
@@ -270,6 +295,22 @@ static struct regulator_init_data vgen_init = { | |||
270 | .consumer_supplies = vgen_consumers, | 295 | .consumer_supplies = vgen_consumers, |
271 | }; | 296 | }; |
272 | 297 | ||
298 | static struct regulator_consumer_supply vvib_consumers[] = { | ||
299 | REGULATOR_SUPPLY("cmos_vcore", "soc-camera-pdrv.0"), | ||
300 | }; | ||
301 | |||
302 | static struct regulator_init_data vvib_init = { | ||
303 | .constraints = { | ||
304 | .min_uV = 1300000, | ||
305 | .max_uV = 1300000, | ||
306 | .apply_uV = 1, | ||
307 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
308 | REGULATOR_CHANGE_STATUS, | ||
309 | }, | ||
310 | .num_consumer_supplies = ARRAY_SIZE(vvib_consumers), | ||
311 | .consumer_supplies = vvib_consumers, | ||
312 | }; | ||
313 | |||
273 | static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { | 314 | static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { |
274 | { | 315 | { |
275 | .id = MC13783_REG_VMMC1, | 316 | .id = MC13783_REG_VMMC1, |
@@ -283,6 +324,9 @@ static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { | |||
283 | }, { | 324 | }, { |
284 | .id = MC13783_REG_GPO3, /* Turn on 3.3V */ | 325 | .id = MC13783_REG_GPO3, /* Turn on 3.3V */ |
285 | .init_data = &gpo_init, | 326 | .init_data = &gpo_init, |
327 | }, { | ||
328 | .id = MC13783_REG_VVIB, /* Power OV2640 */ | ||
329 | .init_data = &vvib_init, | ||
286 | }, | 330 | }, |
287 | }; | 331 | }; |
288 | 332 | ||
@@ -311,6 +355,51 @@ static const struct spi_imx_master spi2_pdata __initconst = { | |||
311 | .num_chipselect = ARRAY_SIZE(spi2_chipselect), | 355 | .num_chipselect = ARRAY_SIZE(spi2_chipselect), |
312 | }; | 356 | }; |
313 | 357 | ||
358 | static int mx27_3ds_camera_power(struct device *dev, int on) | ||
359 | { | ||
360 | /* enable or disable the camera */ | ||
361 | pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); | ||
362 | gpio_set_value(CSI_PWRDWN, on ? 0 : 1); | ||
363 | |||
364 | if (!on) | ||
365 | goto out; | ||
366 | |||
367 | /* If enabled, give a reset impulse */ | ||
368 | gpio_set_value(CSI_RESET, 0); | ||
369 | msleep(20); | ||
370 | gpio_set_value(CSI_RESET, 1); | ||
371 | msleep(100); | ||
372 | |||
373 | out: | ||
374 | return 0; | ||
375 | } | ||
376 | |||
377 | static struct i2c_board_info mx27_3ds_i2c_camera = { | ||
378 | I2C_BOARD_INFO("ov2640", 0x30), | ||
379 | }; | ||
380 | |||
381 | static struct regulator_bulk_data mx27_3ds_camera_regs[] = { | ||
382 | { .supply = "cmos_vcore" }, | ||
383 | { .supply = "cmos_2v8" }, | ||
384 | }; | ||
385 | |||
386 | static struct soc_camera_link iclink_ov2640 = { | ||
387 | .bus_id = 0, | ||
388 | .board_info = &mx27_3ds_i2c_camera, | ||
389 | .i2c_adapter_id = 0, | ||
390 | .power = mx27_3ds_camera_power, | ||
391 | .regulators = mx27_3ds_camera_regs, | ||
392 | .num_regulators = ARRAY_SIZE(mx27_3ds_camera_regs), | ||
393 | }; | ||
394 | |||
395 | static struct platform_device mx27_3ds_ov2640 = { | ||
396 | .name = "soc-camera-pdrv", | ||
397 | .id = 0, | ||
398 | .dev = { | ||
399 | .platform_data = &iclink_ov2640, | ||
400 | }, | ||
401 | }; | ||
402 | |||
314 | static struct imx_fb_videomode mx27_3ds_modes[] = { | 403 | static struct imx_fb_videomode mx27_3ds_modes[] = { |
315 | { /* 480x640 @ 60 Hz */ | 404 | { /* 480x640 @ 60 Hz */ |
316 | .mode = { | 405 | .mode = { |
@@ -367,12 +456,21 @@ static struct spi_board_info mx27_3ds_spi_devs[] __initdata = { | |||
367 | }, | 456 | }, |
368 | }; | 457 | }; |
369 | 458 | ||
459 | static struct platform_device *devices[] __initdata = { | ||
460 | &mx27_3ds_ov2640, | ||
461 | }; | ||
462 | |||
463 | static const struct mx2_camera_platform_data mx27_3ds_cam_pdata __initconst = { | ||
464 | .clk = 26000000, | ||
465 | }; | ||
466 | |||
370 | static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { | 467 | static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { |
371 | .bitrate = 100000, | 468 | .bitrate = 100000, |
372 | }; | 469 | }; |
373 | 470 | ||
374 | static void __init mx27pdk_init(void) | 471 | static void __init mx27pdk_init(void) |
375 | { | 472 | { |
473 | int ret; | ||
376 | imx27_soc_init(); | 474 | imx27_soc_init(); |
377 | 475 | ||
378 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), | 476 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), |
@@ -404,7 +502,17 @@ static void __init mx27pdk_init(void) | |||
404 | if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT)) | 502 | if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT)) |
405 | pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); | 503 | pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); |
406 | imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); | 504 | imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); |
505 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
407 | imx27_add_imx_fb(&mx27_3ds_fb_data); | 506 | imx27_add_imx_fb(&mx27_3ds_fb_data); |
507 | |||
508 | ret = gpio_request_array(mx27_3ds_camera_gpios, | ||
509 | ARRAY_SIZE(mx27_3ds_camera_gpios)); | ||
510 | if (ret) { | ||
511 | pr_err("Failed to request camera gpios"); | ||
512 | iclink_ov2640.power = NULL; | ||
513 | } | ||
514 | |||
515 | imx27_add_mx2_camera(&mx27_3ds_cam_pdata); | ||
408 | } | 516 | } |
409 | 517 | ||
410 | static void __init mx27pdk_timer_init(void) | 518 | static void __init mx27pdk_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c index 4917aab0e253..4518e5448227 100644 --- a/arch/arm/mach-imx/mach-mx31ads.c +++ b/arch/arm/mach-imx/mach-mx31ads.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <asm/memory.h> | 28 | #include <asm/memory.h> |
29 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
30 | #include <mach/common.h> | 30 | #include <mach/common.h> |
31 | #include <mach/board-mx31ads.h> | ||
32 | #include <mach/iomux-mx3.h> | 31 | #include <mach/iomux-mx3.h> |
33 | 32 | ||
34 | #ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 | 33 | #ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 |
@@ -39,6 +38,9 @@ | |||
39 | 38 | ||
40 | #include "devices-imx31.h" | 39 | #include "devices-imx31.h" |
41 | 40 | ||
41 | /* Base address of PBC controller */ | ||
42 | #define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT | ||
43 | |||
42 | /* PBC Board interrupt status register */ | 44 | /* PBC Board interrupt status register */ |
43 | #define PBC_INTSTATUS 0x000016 | 45 | #define PBC_INTSTATUS 0x000016 |
44 | 46 | ||
@@ -62,6 +64,7 @@ | |||
62 | #define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) | 64 | #define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) |
63 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) | 65 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) |
64 | 66 | ||
67 | #define MXC_EXP_IO_BASE MXC_BOARD_IRQ_START | ||
65 | #define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) | 68 | #define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) |
66 | 69 | ||
67 | #define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10) | 70 | #define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10) |
@@ -69,6 +72,10 @@ | |||
69 | 72 | ||
70 | #define MXC_MAX_EXP_IO_LINES 16 | 73 | #define MXC_MAX_EXP_IO_LINES 16 |
71 | 74 | ||
75 | /* CS8900 */ | ||
76 | #define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8) | ||
77 | #define CS4_CS8900_MMIO_START 0x20000 | ||
78 | |||
72 | /* | 79 | /* |
73 | * The serial port definition structure. | 80 | * The serial port definition structure. |
74 | */ | 81 | */ |
@@ -101,11 +108,29 @@ static struct platform_device serial_device = { | |||
101 | }, | 108 | }, |
102 | }; | 109 | }; |
103 | 110 | ||
111 | static const struct resource mx31ads_cs8900_resources[] __initconst = { | ||
112 | DEFINE_RES_MEM(MX31_CS4_BASE_ADDR + CS4_CS8900_MMIO_START, SZ_64K), | ||
113 | DEFINE_RES_IRQ(EXPIO_INT_ENET_INT), | ||
114 | }; | ||
115 | |||
116 | static const struct platform_device_info mx31ads_cs8900_devinfo __initconst = { | ||
117 | .name = "cs89x0", | ||
118 | .id = 0, | ||
119 | .res = mx31ads_cs8900_resources, | ||
120 | .num_res = ARRAY_SIZE(mx31ads_cs8900_resources), | ||
121 | }; | ||
122 | |||
104 | static int __init mxc_init_extuart(void) | 123 | static int __init mxc_init_extuart(void) |
105 | { | 124 | { |
106 | return platform_device_register(&serial_device); | 125 | return platform_device_register(&serial_device); |
107 | } | 126 | } |
108 | 127 | ||
128 | static void __init mxc_init_ext_ethernet(void) | ||
129 | { | ||
130 | platform_device_register_full( | ||
131 | (struct platform_device_info *)&mx31ads_cs8900_devinfo); | ||
132 | } | ||
133 | |||
109 | static const struct imxuart_platform_data uart_pdata __initconst = { | 134 | static const struct imxuart_platform_data uart_pdata __initconst = { |
110 | .flags = IMXUART_HAVE_RTSCTS, | 135 | .flags = IMXUART_HAVE_RTSCTS, |
111 | }; | 136 | }; |
@@ -492,12 +517,15 @@ static void __init mxc_init_audio(void) | |||
492 | mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); | 517 | mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); |
493 | } | 518 | } |
494 | 519 | ||
495 | /* static mappings */ | 520 | /* |
521 | * Static mappings, starting from the CS4 start address up to the start address | ||
522 | * of the CS8900. | ||
523 | */ | ||
496 | static struct map_desc mx31ads_io_desc[] __initdata = { | 524 | static struct map_desc mx31ads_io_desc[] __initdata = { |
497 | { | 525 | { |
498 | .virtual = MX31_CS4_BASE_ADDR_VIRT, | 526 | .virtual = MX31_CS4_BASE_ADDR_VIRT, |
499 | .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), | 527 | .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), |
500 | .length = MX31_CS4_SIZE / 2, | 528 | .length = CS4_CS8900_MMIO_START, |
501 | .type = MT_DEVICE | 529 | .type = MT_DEVICE |
502 | }, | 530 | }, |
503 | }; | 531 | }; |
@@ -522,6 +550,7 @@ static void __init mx31ads_init(void) | |||
522 | mxc_init_imx_uart(); | 550 | mxc_init_imx_uart(); |
523 | mxc_init_i2c(); | 551 | mxc_init_i2c(); |
524 | mxc_init_audio(); | 552 | mxc_init_audio(); |
553 | mxc_init_ext_ethernet(); | ||
525 | } | 554 | } |
526 | 555 | ||
527 | static void __init mx31ads_timer_init(void) | 556 | static void __init mx31ads_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c index f225262b5c38..96e042d0c9a9 100644 --- a/arch/arm/mach-imx/mach-mx31moboard.c +++ b/arch/arm/mach-imx/mach-mx31moboard.c | |||
@@ -507,7 +507,7 @@ static void mx31moboard_poweroff(void) | |||
507 | struct clk *clk = clk_get_sys("imx2-wdt.0", NULL); | 507 | struct clk *clk = clk_get_sys("imx2-wdt.0", NULL); |
508 | 508 | ||
509 | if (!IS_ERR(clk)) | 509 | if (!IS_ERR(clk)) |
510 | clk_enable(clk); | 510 | clk_prepare_enable(clk); |
511 | 511 | ||
512 | mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST); | 512 | mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST); |
513 | 513 | ||
diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c index 6dc093448057..e26a9cb05ed8 100644 --- a/arch/arm/mach-imx/pm-imx5.c +++ b/arch/arm/mach-imx/pm-imx5.c | |||
@@ -89,7 +89,7 @@ void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode) | |||
89 | 89 | ||
90 | static int mx5_suspend_prepare(void) | 90 | static int mx5_suspend_prepare(void) |
91 | { | 91 | { |
92 | return clk_enable(gpc_dvfs_clk); | 92 | return clk_prepare_enable(gpc_dvfs_clk); |
93 | } | 93 | } |
94 | 94 | ||
95 | static int mx5_suspend_enter(suspend_state_t state) | 95 | static int mx5_suspend_enter(suspend_state_t state) |
@@ -119,7 +119,7 @@ static int mx5_suspend_enter(suspend_state_t state) | |||
119 | 119 | ||
120 | static void mx5_suspend_finish(void) | 120 | static void mx5_suspend_finish(void) |
121 | { | 121 | { |
122 | clk_disable(gpc_dvfs_clk); | 122 | clk_disable_unprepare(gpc_dvfs_clk); |
123 | } | 123 | } |
124 | 124 | ||
125 | static int mx5_pm_valid(suspend_state_t state) | 125 | static int mx5_pm_valid(suspend_state_t state) |
diff --git a/arch/arm/mach-lpc32xx/clock.c b/arch/arm/mach-lpc32xx/clock.c index 1e027514096d..473015ac07bd 100644 --- a/arch/arm/mach-lpc32xx/clock.c +++ b/arch/arm/mach-lpc32xx/clock.c | |||
@@ -719,6 +719,41 @@ static struct clk clk_tsc = { | |||
719 | .get_rate = local_return_parent_rate, | 719 | .get_rate = local_return_parent_rate, |
720 | }; | 720 | }; |
721 | 721 | ||
722 | static int adc_onoff_enable(struct clk *clk, int enable) | ||
723 | { | ||
724 | u32 tmp; | ||
725 | u32 divider; | ||
726 | |||
727 | /* Use PERIPH_CLOCK */ | ||
728 | tmp = __raw_readl(LPC32XX_CLKPWR_ADC_CLK_CTRL_1); | ||
729 | tmp |= LPC32XX_CLKPWR_ADCCTRL1_PCLK_SEL; | ||
730 | /* | ||
731 | * Set clock divider so that we have equal to or less than | ||
732 | * 4.5MHz clock at ADC | ||
733 | */ | ||
734 | divider = clk->get_rate(clk) / 4500000 + 1; | ||
735 | tmp |= divider; | ||
736 | __raw_writel(tmp, LPC32XX_CLKPWR_ADC_CLK_CTRL_1); | ||
737 | |||
738 | /* synchronize rate of this clock w/ actual HW setting */ | ||
739 | clk->rate = clk->get_rate(clk->parent) / divider; | ||
740 | |||
741 | if (enable == 0) | ||
742 | __raw_writel(0, clk->enable_reg); | ||
743 | else | ||
744 | __raw_writel(clk->enable_mask, clk->enable_reg); | ||
745 | |||
746 | return 0; | ||
747 | } | ||
748 | |||
749 | static struct clk clk_adc = { | ||
750 | .parent = &clk_pclk, | ||
751 | .enable = adc_onoff_enable, | ||
752 | .enable_reg = LPC32XX_CLKPWR_ADC_CLK_CTRL, | ||
753 | .enable_mask = LPC32XX_CLKPWR_ADC32CLKCTRL_CLK_EN, | ||
754 | .get_rate = local_return_parent_rate, | ||
755 | }; | ||
756 | |||
722 | static int mmc_onoff_enable(struct clk *clk, int enable) | 757 | static int mmc_onoff_enable(struct clk *clk, int enable) |
723 | { | 758 | { |
724 | u32 tmp; | 759 | u32 tmp; |
@@ -1075,6 +1110,7 @@ static struct clk_lookup lookups[] = { | |||
1075 | _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1) | 1110 | _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1) |
1076 | _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan) | 1111 | _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan) |
1077 | _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) | 1112 | _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) |
1113 | _REGISTER_CLOCK("lpc32xx-adc", NULL, clk_adc) | ||
1078 | _REGISTER_CLOCK("tbd", "i2s0_ck", clk_i2s0) | 1114 | _REGISTER_CLOCK("tbd", "i2s0_ck", clk_i2s0) |
1079 | _REGISTER_CLOCK("tbd", "i2s1_ck", clk_i2s1) | 1115 | _REGISTER_CLOCK("tbd", "i2s1_ck", clk_i2s1) |
1080 | _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc) | 1116 | _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc) |
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c index 369b152896cd..6c76bb36559b 100644 --- a/arch/arm/mach-lpc32xx/common.c +++ b/arch/arm/mach-lpc32xx/common.c | |||
@@ -138,6 +138,28 @@ struct platform_device lpc32xx_rtc_device = { | |||
138 | }; | 138 | }; |
139 | 139 | ||
140 | /* | 140 | /* |
141 | * ADC support | ||
142 | */ | ||
143 | static struct resource adc_resources[] = { | ||
144 | { | ||
145 | .start = LPC32XX_ADC_BASE, | ||
146 | .end = LPC32XX_ADC_BASE + SZ_4K - 1, | ||
147 | .flags = IORESOURCE_MEM, | ||
148 | }, { | ||
149 | .start = IRQ_LPC32XX_TS_IRQ, | ||
150 | .end = IRQ_LPC32XX_TS_IRQ, | ||
151 | .flags = IORESOURCE_IRQ, | ||
152 | }, | ||
153 | }; | ||
154 | |||
155 | struct platform_device lpc32xx_adc_device = { | ||
156 | .name = "lpc32xx-adc", | ||
157 | .id = -1, | ||
158 | .num_resources = ARRAY_SIZE(adc_resources), | ||
159 | .resource = adc_resources, | ||
160 | }; | ||
161 | |||
162 | /* | ||
141 | * Returns the unique ID for the device | 163 | * Returns the unique ID for the device |
142 | */ | 164 | */ |
143 | void lpc32xx_get_uid(u32 devid[4]) | 165 | void lpc32xx_get_uid(u32 devid[4]) |
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h index 4b4e700343c1..04b72739eb9c 100644 --- a/arch/arm/mach-lpc32xx/common.h +++ b/arch/arm/mach-lpc32xx/common.h | |||
@@ -29,6 +29,7 @@ extern struct platform_device lpc32xx_i2c0_device; | |||
29 | extern struct platform_device lpc32xx_i2c1_device; | 29 | extern struct platform_device lpc32xx_i2c1_device; |
30 | extern struct platform_device lpc32xx_i2c2_device; | 30 | extern struct platform_device lpc32xx_i2c2_device; |
31 | extern struct platform_device lpc32xx_tsc_device; | 31 | extern struct platform_device lpc32xx_tsc_device; |
32 | extern struct platform_device lpc32xx_adc_device; | ||
32 | extern struct platform_device lpc32xx_rtc_device; | 33 | extern struct platform_device lpc32xx_rtc_device; |
33 | 34 | ||
34 | /* | 35 | /* |
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c index 5d51c102c255..a539f4f72f28 100644 --- a/arch/arm/mach-lpc32xx/phy3250.c +++ b/arch/arm/mach-lpc32xx/phy3250.c | |||
@@ -252,6 +252,7 @@ static struct platform_device *phy3250_devs[] __initdata = { | |||
252 | &lpc32xx_i2c2_device, | 252 | &lpc32xx_i2c2_device, |
253 | &lpc32xx_watchdog_device, | 253 | &lpc32xx_watchdog_device, |
254 | &lpc32xx_gpio_led_device, | 254 | &lpc32xx_gpio_led_device, |
255 | &lpc32xx_adc_device, | ||
255 | }; | 256 | }; |
256 | 257 | ||
257 | static struct amba_device *amba_devs[] __initdata = { | 258 | static struct amba_device *amba_devs[] __initdata = { |
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h index 4de13abef7bb..e2e1f1e5e124 100644 --- a/arch/arm/mach-mmp/include/mach/pxa910.h +++ b/arch/arm/mach-mmp/include/mach/pxa910.h | |||
@@ -22,6 +22,7 @@ extern struct pxa_device_desc pxa910_device_pwm4; | |||
22 | extern struct pxa_device_desc pxa910_device_nand; | 22 | extern struct pxa_device_desc pxa910_device_nand; |
23 | 23 | ||
24 | extern struct platform_device pxa910_device_gpio; | 24 | extern struct platform_device pxa910_device_gpio; |
25 | extern struct platform_device pxa910_device_rtc; | ||
25 | 26 | ||
26 | static inline int pxa910_add_uart(int id) | 27 | static inline int pxa910_add_uart(int id) |
27 | { | 28 | { |
diff --git a/arch/arm/mach-mmp/include/mach/regs-apbc.h b/arch/arm/mach-mmp/include/mach/regs-apbc.h index 1a96585336ba..8a37fb003655 100644 --- a/arch/arm/mach-mmp/include/mach/regs-apbc.h +++ b/arch/arm/mach-mmp/include/mach/regs-apbc.h | |||
@@ -57,6 +57,7 @@ | |||
57 | #define APBC_PXA910_SSP1 APBC_REG(0x01c) | 57 | #define APBC_PXA910_SSP1 APBC_REG(0x01c) |
58 | #define APBC_PXA910_SSP2 APBC_REG(0x020) | 58 | #define APBC_PXA910_SSP2 APBC_REG(0x020) |
59 | #define APBC_PXA910_IPC APBC_REG(0x024) | 59 | #define APBC_PXA910_IPC APBC_REG(0x024) |
60 | #define APBC_PXA910_RTC APBC_REG(0x028) | ||
60 | #define APBC_PXA910_TWSI0 APBC_REG(0x02c) | 61 | #define APBC_PXA910_TWSI0 APBC_REG(0x02c) |
61 | #define APBC_PXA910_KPC APBC_REG(0x030) | 62 | #define APBC_PXA910_KPC APBC_REG(0x030) |
62 | #define APBC_PXA910_TIMERS APBC_REG(0x034) | 63 | #define APBC_PXA910_TIMERS APBC_REG(0x034) |
diff --git a/arch/arm/mach-mmp/include/mach/regs-rtc.h b/arch/arm/mach-mmp/include/mach/regs-rtc.h new file mode 100644 index 000000000000..5bff886a3941 --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/regs-rtc.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __ASM_MACH_REGS_RTC_H | ||
2 | #define __ASM_MACH_REGS_RTC_H | ||
3 | |||
4 | #include <mach/addr-map.h> | ||
5 | |||
6 | #define RTC_VIRT_BASE (APB_VIRT_BASE + 0x10000) | ||
7 | #define RTC_REG(x) (*((volatile u32 __iomem *)(RTC_VIRT_BASE + (x)))) | ||
8 | |||
9 | /* | ||
10 | * Real Time Clock | ||
11 | */ | ||
12 | |||
13 | #define RCNR RTC_REG(0x00) /* RTC Count Register */ | ||
14 | #define RTAR RTC_REG(0x04) /* RTC Alarm Register */ | ||
15 | #define RTSR RTC_REG(0x08) /* RTC Status Register */ | ||
16 | #define RTTR RTC_REG(0x0C) /* RTC Timer Trim Register */ | ||
17 | |||
18 | #define RTSR_HZE (1 << 3) /* HZ interrupt enable */ | ||
19 | #define RTSR_ALE (1 << 2) /* RTC alarm interrupt enable */ | ||
20 | #define RTSR_HZ (1 << 1) /* HZ rising-edge detected */ | ||
21 | #define RTSR_AL (1 << 0) /* RTC alarm detected */ | ||
22 | |||
23 | #endif /* __ASM_MACH_REGS_RTC_H */ | ||
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c index 3241a25784d0..b6e152723974 100644 --- a/arch/arm/mach-mmp/pxa910.c +++ b/arch/arm/mach-mmp/pxa910.c | |||
@@ -92,6 +92,7 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000); | |||
92 | static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000); | 92 | static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000); |
93 | static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000); | 93 | static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000); |
94 | static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000); | 94 | static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000); |
95 | static APBC_CLK(rtc, PXA910_RTC, 8, 32768); | ||
95 | 96 | ||
96 | static APMU_CLK(nand, NAND, 0x19b, 156000000); | 97 | static APMU_CLK(nand, NAND, 0x19b, 156000000); |
97 | static APMU_CLK(u2o, USB, 0x1b, 480000000); | 98 | static APMU_CLK(u2o, USB, 0x1b, 480000000); |
@@ -109,6 +110,7 @@ static struct clk_lookup pxa910_clkregs[] = { | |||
109 | INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), | 110 | INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), |
110 | INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), | 111 | INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), |
111 | INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"), | 112 | INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"), |
113 | INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), | ||
112 | }; | 114 | }; |
113 | 115 | ||
114 | static int __init pxa910_init(void) | 116 | static int __init pxa910_init(void) |
@@ -183,3 +185,28 @@ struct platform_device pxa910_device_gpio = { | |||
183 | .num_resources = ARRAY_SIZE(pxa910_resource_gpio), | 185 | .num_resources = ARRAY_SIZE(pxa910_resource_gpio), |
184 | .resource = pxa910_resource_gpio, | 186 | .resource = pxa910_resource_gpio, |
185 | }; | 187 | }; |
188 | |||
189 | static struct resource pxa910_resource_rtc[] = { | ||
190 | { | ||
191 | .start = 0xd4010000, | ||
192 | .end = 0xd401003f, | ||
193 | .flags = IORESOURCE_MEM, | ||
194 | }, { | ||
195 | .start = IRQ_PXA910_RTC_INT, | ||
196 | .end = IRQ_PXA910_RTC_INT, | ||
197 | .name = "rtc 1Hz", | ||
198 | .flags = IORESOURCE_IRQ, | ||
199 | }, { | ||
200 | .start = IRQ_PXA910_RTC_ALARM, | ||
201 | .end = IRQ_PXA910_RTC_ALARM, | ||
202 | .name = "rtc alarm", | ||
203 | .flags = IORESOURCE_IRQ, | ||
204 | }, | ||
205 | }; | ||
206 | |||
207 | struct platform_device pxa910_device_rtc = { | ||
208 | .name = "sa1100-rtc", | ||
209 | .id = -1, | ||
210 | .num_resources = ARRAY_SIZE(pxa910_resource_rtc), | ||
211 | .resource = pxa910_resource_rtc, | ||
212 | }; | ||
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c index 5ac5d5832e45..e72c709da44f 100644 --- a/arch/arm/mach-mmp/ttc_dkb.c +++ b/arch/arm/mach-mmp/ttc_dkb.c | |||
@@ -124,6 +124,7 @@ static struct platform_device ttc_dkb_device_onenand = { | |||
124 | 124 | ||
125 | static struct platform_device *ttc_dkb_devices[] = { | 125 | static struct platform_device *ttc_dkb_devices[] = { |
126 | &pxa910_device_gpio, | 126 | &pxa910_device_gpio, |
127 | &pxa910_device_rtc, | ||
127 | &ttc_dkb_device_onenand, | 128 | &ttc_dkb_device_onenand, |
128 | }; | 129 | }; |
129 | 130 | ||
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c index 0a113424632c..962e71169750 100644 --- a/arch/arm/mach-msm/board-msm8x60.c +++ b/arch/arm/mach-msm/board-msm8x60.c | |||
@@ -80,12 +80,8 @@ static struct of_device_id msm_dt_gic_match[] __initdata = { | |||
80 | 80 | ||
81 | static void __init msm8x60_dt_init(void) | 81 | static void __init msm8x60_dt_init(void) |
82 | { | 82 | { |
83 | struct device_node *node; | 83 | irq_domain_generate_simple(msm_dt_gic_match, MSM8X60_QGIC_DIST_PHYS, |
84 | 84 | GIC_SPI_START); | |
85 | node = of_find_matching_node_by_address(NULL, msm_dt_gic_match, | ||
86 | MSM8X60_QGIC_DIST_PHYS); | ||
87 | if (node) | ||
88 | irq_domain_add_simple(node, GIC_SPI_START); | ||
89 | 85 | ||
90 | if (of_machine_is_compatible("qcom,msm8660-surf")) { | 86 | if (of_machine_is_compatible("qcom,msm8660-surf")) { |
91 | printk(KERN_INFO "Init surf UART registers\n"); | 87 | printk(KERN_INFO "Init surf UART registers\n"); |
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c index e12e11231dc7..aec34712c321 100644 --- a/arch/arm/mach-mxs/clock-mx23.c +++ b/arch/arm/mach-mxs/clock-mx23.c | |||
@@ -456,6 +456,7 @@ static struct clk_lookup lookups[] = { | |||
456 | _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk) | 456 | _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk) |
457 | _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk) | 457 | _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk) |
458 | _REGISTER_CLOCK("imx23-fb", NULL, lcdif_clk) | 458 | _REGISTER_CLOCK("imx23-fb", NULL, lcdif_clk) |
459 | _REGISTER_CLOCK("imx23-gpmi-nand", NULL, gpmi_clk) | ||
459 | }; | 460 | }; |
460 | 461 | ||
461 | static int clk_misc_init(void) | 462 | static int clk_misc_init(void) |
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c index 5d68e4152220..8dd7b02a4b96 100644 --- a/arch/arm/mach-mxs/clock-mx28.c +++ b/arch/arm/mach-mxs/clock-mx28.c | |||
@@ -643,6 +643,7 @@ static struct clk_lookup lookups[] = { | |||
643 | _REGISTER_CLOCK("duart", NULL, uart_clk) | 643 | _REGISTER_CLOCK("duart", NULL, uart_clk) |
644 | _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk) | 644 | _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk) |
645 | _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk) | 645 | _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk) |
646 | _REGISTER_CLOCK("imx28-gpmi-nand", NULL, gpmi_clk) | ||
646 | _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk) | 647 | _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk) |
647 | _REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk) | 648 | _REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk) |
648 | _REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk) | 649 | _REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk) |
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h index 3fa651d2c994..4d1329d59287 100644 --- a/arch/arm/mach-mxs/devices-mx23.h +++ b/arch/arm/mach-mxs/devices-mx23.h | |||
@@ -21,6 +21,10 @@ extern const struct mxs_auart_data mx23_auart_data[] __initconst; | |||
21 | #define mx23_add_auart0() mx23_add_auart(0) | 21 | #define mx23_add_auart0() mx23_add_auart(0) |
22 | #define mx23_add_auart1() mx23_add_auart(1) | 22 | #define mx23_add_auart1() mx23_add_auart(1) |
23 | 23 | ||
24 | extern const struct mxs_gpmi_nand_data mx23_gpmi_nand_data __initconst; | ||
25 | #define mx23_add_gpmi_nand(pdata) \ | ||
26 | mxs_add_gpmi_nand(pdata, &mx23_gpmi_nand_data) | ||
27 | |||
24 | extern const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst; | 28 | extern const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst; |
25 | #define mx23_add_mxs_mmc(id, pdata) \ | 29 | #define mx23_add_mxs_mmc(id, pdata) \ |
26 | mxs_add_mxs_mmc(&mx23_mxs_mmc_data[id], pdata) | 30 | mxs_add_mxs_mmc(&mx23_mxs_mmc_data[id], pdata) |
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h index 4f50094e293d..9dbeae130842 100644 --- a/arch/arm/mach-mxs/devices-mx28.h +++ b/arch/arm/mach-mxs/devices-mx28.h | |||
@@ -34,6 +34,10 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst; | |||
34 | #define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata) | 34 | #define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata) |
35 | #define mx28_add_flexcan1(pdata) mx28_add_flexcan(1, pdata) | 35 | #define mx28_add_flexcan1(pdata) mx28_add_flexcan(1, pdata) |
36 | 36 | ||
37 | extern const struct mxs_gpmi_nand_data mx28_gpmi_nand_data __initconst; | ||
38 | #define mx28_add_gpmi_nand(pdata) \ | ||
39 | mxs_add_gpmi_nand(pdata, &mx28_gpmi_nand_data) | ||
40 | |||
37 | extern const struct mxs_mxs_i2c_data mx28_mxs_i2c_data[] __initconst; | 41 | extern const struct mxs_mxs_i2c_data mx28_mxs_i2c_data[] __initconst; |
38 | #define mx28_add_mxs_i2c(id) mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id]) | 42 | #define mx28_add_mxs_i2c(id) mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id]) |
39 | 43 | ||
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig index 18b6bf526a27..b8913df4cfa2 100644 --- a/arch/arm/mach-mxs/devices/Kconfig +++ b/arch/arm/mach-mxs/devices/Kconfig | |||
@@ -12,6 +12,9 @@ config MXS_HAVE_PLATFORM_FLEXCAN | |||
12 | select HAVE_CAN_FLEXCAN if CAN | 12 | select HAVE_CAN_FLEXCAN if CAN |
13 | bool | 13 | bool |
14 | 14 | ||
15 | config MXS_HAVE_PLATFORM_GPMI_NAND | ||
16 | bool | ||
17 | |||
15 | config MXS_HAVE_PLATFORM_MXS_I2C | 18 | config MXS_HAVE_PLATFORM_MXS_I2C |
16 | bool | 19 | bool |
17 | 20 | ||
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile index f52e3e53baec..c8f5c9541a30 100644 --- a/arch/arm/mach-mxs/devices/Makefile +++ b/arch/arm/mach-mxs/devices/Makefile | |||
@@ -3,6 +3,7 @@ obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o | |||
3 | obj-y += platform-dma.o | 3 | obj-y += platform-dma.o |
4 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o | 4 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o |
5 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o | 5 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o |
6 | obj-$(CONFIG_MXS_HAVE_PLATFORM_GPMI_NAND) += platform-gpmi-nand.o | ||
6 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o | 7 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o |
7 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o | 8 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o |
8 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o | 9 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o |
diff --git a/arch/arm/mach-mxs/devices/platform-gpmi-nand.c b/arch/arm/mach-mxs/devices/platform-gpmi-nand.c new file mode 100644 index 000000000000..3e22df5944a8 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-gpmi-nand.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
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 along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | */ | ||
18 | #include <asm/sizes.h> | ||
19 | #include <mach/mx23.h> | ||
20 | #include <mach/mx28.h> | ||
21 | #include <mach/devices-common.h> | ||
22 | #include <linux/dma-mapping.h> | ||
23 | |||
24 | #ifdef CONFIG_SOC_IMX23 | ||
25 | const struct mxs_gpmi_nand_data mx23_gpmi_nand_data __initconst = { | ||
26 | .devid = "imx23-gpmi-nand", | ||
27 | .res = { | ||
28 | /* GPMI */ | ||
29 | DEFINE_RES_MEM_NAMED(MX23_GPMI_BASE_ADDR, SZ_8K, | ||
30 | GPMI_NAND_GPMI_REGS_ADDR_RES_NAME), | ||
31 | DEFINE_RES_IRQ_NAMED(MX23_INT_GPMI_ATTENTION, | ||
32 | GPMI_NAND_GPMI_INTERRUPT_RES_NAME), | ||
33 | /* BCH */ | ||
34 | DEFINE_RES_MEM_NAMED(MX23_BCH_BASE_ADDR, SZ_8K, | ||
35 | GPMI_NAND_BCH_REGS_ADDR_RES_NAME), | ||
36 | DEFINE_RES_IRQ_NAMED(MX23_INT_BCH, | ||
37 | GPMI_NAND_BCH_INTERRUPT_RES_NAME), | ||
38 | /* DMA */ | ||
39 | DEFINE_RES_NAMED(MX23_DMA_GPMI0, | ||
40 | MX23_DMA_GPMI3 - MX23_DMA_GPMI0 + 1, | ||
41 | GPMI_NAND_DMA_CHANNELS_RES_NAME, | ||
42 | IORESOURCE_DMA), | ||
43 | DEFINE_RES_IRQ_NAMED(MX23_INT_GPMI_DMA, | ||
44 | GPMI_NAND_DMA_INTERRUPT_RES_NAME), | ||
45 | }, | ||
46 | }; | ||
47 | #endif | ||
48 | |||
49 | #ifdef CONFIG_SOC_IMX28 | ||
50 | const struct mxs_gpmi_nand_data mx28_gpmi_nand_data __initconst = { | ||
51 | .devid = "imx28-gpmi-nand", | ||
52 | .res = { | ||
53 | /* GPMI */ | ||
54 | DEFINE_RES_MEM_NAMED(MX28_GPMI_BASE_ADDR, SZ_8K, | ||
55 | GPMI_NAND_GPMI_REGS_ADDR_RES_NAME), | ||
56 | DEFINE_RES_IRQ_NAMED(MX28_INT_GPMI, | ||
57 | GPMI_NAND_GPMI_INTERRUPT_RES_NAME), | ||
58 | /* BCH */ | ||
59 | DEFINE_RES_MEM_NAMED(MX28_BCH_BASE_ADDR, SZ_8K, | ||
60 | GPMI_NAND_BCH_REGS_ADDR_RES_NAME), | ||
61 | DEFINE_RES_IRQ_NAMED(MX28_INT_BCH, | ||
62 | GPMI_NAND_BCH_INTERRUPT_RES_NAME), | ||
63 | /* DMA */ | ||
64 | DEFINE_RES_NAMED(MX28_DMA_GPMI0, | ||
65 | MX28_DMA_GPMI7 - MX28_DMA_GPMI0 + 1, | ||
66 | GPMI_NAND_DMA_CHANNELS_RES_NAME, | ||
67 | IORESOURCE_DMA), | ||
68 | DEFINE_RES_IRQ_NAMED(MX28_INT_GPMI_DMA, | ||
69 | GPMI_NAND_DMA_INTERRUPT_RES_NAME), | ||
70 | }, | ||
71 | }; | ||
72 | #endif | ||
73 | |||
74 | struct platform_device *__init | ||
75 | mxs_add_gpmi_nand(const struct gpmi_nand_platform_data *pdata, | ||
76 | const struct mxs_gpmi_nand_data *data) | ||
77 | { | ||
78 | return mxs_add_platform_device_dmamask(data->devid, -1, | ||
79 | data->res, GPMI_NAND_RES_SIZE, | ||
80 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); | ||
81 | } | ||
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h index dc369c1239fc..f2e383955d88 100644 --- a/arch/arm/mach-mxs/include/mach/devices-common.h +++ b/arch/arm/mach-mxs/include/mach/devices-common.h | |||
@@ -66,6 +66,16 @@ struct platform_device *__init mxs_add_flexcan( | |||
66 | const struct mxs_flexcan_data *data, | 66 | const struct mxs_flexcan_data *data, |
67 | const struct flexcan_platform_data *pdata); | 67 | const struct flexcan_platform_data *pdata); |
68 | 68 | ||
69 | /* gpmi-nand */ | ||
70 | #include <linux/mtd/gpmi-nand.h> | ||
71 | struct mxs_gpmi_nand_data { | ||
72 | const char *devid; | ||
73 | const struct resource res[GPMI_NAND_RES_SIZE]; | ||
74 | }; | ||
75 | struct platform_device *__init | ||
76 | mxs_add_gpmi_nand(const struct gpmi_nand_platform_data *pdata, | ||
77 | const struct mxs_gpmi_nand_data *data); | ||
78 | |||
69 | /* i2c */ | 79 | /* i2c */ |
70 | struct mxs_mxs_i2c_data { | 80 | struct mxs_mxs_i2c_data { |
71 | int id; | 81 | int id; |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index e20c8ab80b0e..21a4095a1000 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -32,7 +32,7 @@ config ARCH_OMAP3 | |||
32 | depends on ARCH_OMAP2PLUS | 32 | depends on ARCH_OMAP2PLUS |
33 | default y | 33 | default y |
34 | select CPU_V7 | 34 | select CPU_V7 |
35 | select USB_ARCH_HAS_EHCI | 35 | select USB_ARCH_HAS_EHCI if USB_SUPPORT |
36 | select ARCH_HAS_OPP | 36 | select ARCH_HAS_OPP |
37 | select PM_OPP if PM | 37 | select PM_OPP if PM |
38 | select ARM_CPU_SUSPEND if PM | 38 | select ARM_CPU_SUSPEND if PM |
@@ -52,7 +52,7 @@ config ARCH_OMAP4 | |||
52 | select ARM_ERRATA_720789 | 52 | select ARM_ERRATA_720789 |
53 | select ARCH_HAS_OPP | 53 | select ARCH_HAS_OPP |
54 | select PM_OPP if PM | 54 | select PM_OPP if PM |
55 | select USB_ARCH_HAS_EHCI | 55 | select USB_ARCH_HAS_EHCI if USB_SUPPORT |
56 | select ARM_CPU_SUSPEND if PM | 56 | select ARM_CPU_SUSPEND if PM |
57 | 57 | ||
58 | comment "OMAP Core Type" | 58 | comment "OMAP Core Type" |
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index bd76394ccaf8..56a6e98652cc 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | # Common support | 5 | # Common support |
6 | obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ | 6 | obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ |
7 | common.o gpio.o dma.o wd_timer.o display.o | 7 | common.o gpio.o dma.o wd_timer.o display.o i2c.o |
8 | 8 | ||
9 | omap-2-3-common = irq.o sdrc.o | 9 | omap-2-3-common = irq.o sdrc.o |
10 | hwmod-common = omap_hwmod.o \ | 10 | hwmod-common = omap_hwmod.o \ |
@@ -182,9 +182,6 @@ obj-$(CONFIG_OMAP_IOMMU) += iommu2.o | |||
182 | iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o | 182 | iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o |
183 | obj-y += $(iommu-m) $(iommu-y) | 183 | obj-y += $(iommu-m) $(iommu-y) |
184 | 184 | ||
185 | i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o | ||
186 | obj-y += $(i2c-omap-m) $(i2c-omap-y) | ||
187 | |||
188 | ifneq ($(CONFIG_TIDSPBRIDGE),) | 185 | ifneq ($(CONFIG_TIDSPBRIDGE),) |
189 | obj-y += dsp.o | 186 | obj-y += dsp.o |
190 | endif | 187 | endif |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index ad497620539b..45fdfe2bd9d5 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -68,7 +68,7 @@ static void __init omap_generic_init(void) | |||
68 | { | 68 | { |
69 | struct device_node *node = of_find_matching_node(NULL, intc_match); | 69 | struct device_node *node = of_find_matching_node(NULL, intc_match); |
70 | if (node) | 70 | if (node) |
71 | irq_domain_add_simple(node, 0); | 71 | irq_domain_add_legacy(node, 32, 0, 0, &irq_domain_simple_ops, NULL); |
72 | 72 | ||
73 | omap_sdrc_init(NULL, NULL); | 73 | omap_sdrc_init(NULL, NULL); |
74 | 74 | ||
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c index d4683ba5f721..2a13b9f6c61c 100644 --- a/arch/arm/mach-omap2/board-zoom-display.c +++ b/arch/arm/mach-omap2/board-zoom-display.c | |||
@@ -55,6 +55,7 @@ static void zoom_panel_disable_lcd(struct omap_dss_device *dssdev) | |||
55 | 55 | ||
56 | static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level) | 56 | static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level) |
57 | { | 57 | { |
58 | #ifdef CONFIG_TWL4030_CORE | ||
58 | unsigned char c; | 59 | unsigned char c; |
59 | u8 mux_pwm, enb_pwm; | 60 | u8 mux_pwm, enb_pwm; |
60 | 61 | ||
@@ -90,6 +91,9 @@ static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level) | |||
90 | c = ((50 * (100 - level)) / 100) + 1; | 91 | c = ((50 * (100 - level)) / 100) + 1; |
91 | twl_i2c_write_u8(TWL4030_MODULE_PWM1, 0x7F, TWL_LED_PWMOFF); | 92 | twl_i2c_write_u8(TWL4030_MODULE_PWM1, 0x7F, TWL_LED_PWMOFF); |
92 | twl_i2c_write_u8(TWL4030_MODULE_PWM1, c, TWL_LED_PWMON); | 93 | twl_i2c_write_u8(TWL4030_MODULE_PWM1, c, TWL_LED_PWMON); |
94 | #else | ||
95 | pr_warn("Backlight not enabled\n"); | ||
96 | #endif | ||
93 | 97 | ||
94 | return 0; | 98 | return 0; |
95 | } | 99 | } |
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 283d11eae693..3ffefe275ea0 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -654,9 +654,7 @@ void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) | |||
654 | /*-------------------------------------------------------------------------*/ | 654 | /*-------------------------------------------------------------------------*/ |
655 | 655 | ||
656 | #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE) | 656 | #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE) |
657 | #if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) | ||
658 | #define OMAP_HDQ_BASE 0x480B2000 | 657 | #define OMAP_HDQ_BASE 0x480B2000 |
659 | #endif | ||
660 | static struct resource omap_hdq_resources[] = { | 658 | static struct resource omap_hdq_resources[] = { |
661 | { | 659 | { |
662 | .start = OMAP_HDQ_BASE, | 660 | .start = OMAP_HDQ_BASE, |
@@ -679,7 +677,10 @@ static struct platform_device omap_hdq_dev = { | |||
679 | }; | 677 | }; |
680 | static inline void omap_hdq_init(void) | 678 | static inline void omap_hdq_init(void) |
681 | { | 679 | { |
682 | (void) platform_device_register(&omap_hdq_dev); | 680 | if (cpu_is_omap2420()) |
681 | return; | ||
682 | |||
683 | platform_device_register(&omap_hdq_dev); | ||
683 | } | 684 | } |
684 | #else | 685 | #else |
685 | static inline void omap_hdq_init(void) {} | 686 | static inline void omap_hdq_init(void) {} |
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 2132308ad1e4..69fe060a0b75 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h | |||
@@ -246,7 +246,7 @@ static inline void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state) | |||
246 | { | 246 | { |
247 | } | 247 | } |
248 | 248 | ||
249 | static struct omap_board_mux *board_mux __initdata __maybe_unused; | 249 | static struct omap_board_mux *board_mux __maybe_unused; |
250 | 250 | ||
251 | #endif | 251 | #endif |
252 | 252 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 3c8dd928628e..34b9766d1d23 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include "omap_hwmod_common_data.h" | 30 | #include "omap_hwmod_common_data.h" |
31 | 31 | ||
32 | #include "smartreflex.h" | ||
32 | #include "prm-regbits-34xx.h" | 33 | #include "prm-regbits-34xx.h" |
33 | #include "cm-regbits-34xx.h" | 34 | #include "cm-regbits-34xx.h" |
34 | #include "wd_timer.h" | 35 | #include "wd_timer.h" |
@@ -376,6 +377,16 @@ static struct omap_hwmod_ocp_if omap3_l4_core__i2c3 = { | |||
376 | .user = OCP_USER_MPU | OCP_USER_SDMA, | 377 | .user = OCP_USER_MPU | OCP_USER_SDMA, |
377 | }; | 378 | }; |
378 | 379 | ||
380 | static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = { | ||
381 | { .irq = 18}, | ||
382 | { .irq = -1 } | ||
383 | }; | ||
384 | |||
385 | static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = { | ||
386 | { .irq = 19}, | ||
387 | { .irq = -1 } | ||
388 | }; | ||
389 | |||
379 | /* L4 CORE -> SR1 interface */ | 390 | /* L4 CORE -> SR1 interface */ |
380 | static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = { | 391 | static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = { |
381 | { | 392 | { |
@@ -2664,6 +2675,10 @@ static struct omap_hwmod_class omap36xx_smartreflex_hwmod_class = { | |||
2664 | }; | 2675 | }; |
2665 | 2676 | ||
2666 | /* SR1 */ | 2677 | /* SR1 */ |
2678 | static struct omap_smartreflex_dev_attr sr1_dev_attr = { | ||
2679 | .sensor_voltdm_name = "mpu_iva", | ||
2680 | }; | ||
2681 | |||
2667 | static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = { | 2682 | static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = { |
2668 | &omap3_l4_core__sr1, | 2683 | &omap3_l4_core__sr1, |
2669 | }; | 2684 | }; |
@@ -2672,7 +2687,6 @@ static struct omap_hwmod omap34xx_sr1_hwmod = { | |||
2672 | .name = "sr1_hwmod", | 2687 | .name = "sr1_hwmod", |
2673 | .class = &omap34xx_smartreflex_hwmod_class, | 2688 | .class = &omap34xx_smartreflex_hwmod_class, |
2674 | .main_clk = "sr1_fck", | 2689 | .main_clk = "sr1_fck", |
2675 | .vdd_name = "mpu_iva", | ||
2676 | .prcm = { | 2690 | .prcm = { |
2677 | .omap2 = { | 2691 | .omap2 = { |
2678 | .prcm_reg_id = 1, | 2692 | .prcm_reg_id = 1, |
@@ -2684,6 +2698,8 @@ static struct omap_hwmod omap34xx_sr1_hwmod = { | |||
2684 | }, | 2698 | }, |
2685 | .slaves = omap3_sr1_slaves, | 2699 | .slaves = omap3_sr1_slaves, |
2686 | .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), | 2700 | .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), |
2701 | .dev_attr = &sr1_dev_attr, | ||
2702 | .mpu_irqs = omap3_smartreflex_mpu_irqs, | ||
2687 | .flags = HWMOD_SET_DEFAULT_CLOCKACT, | 2703 | .flags = HWMOD_SET_DEFAULT_CLOCKACT, |
2688 | }; | 2704 | }; |
2689 | 2705 | ||
@@ -2691,7 +2707,6 @@ static struct omap_hwmod omap36xx_sr1_hwmod = { | |||
2691 | .name = "sr1_hwmod", | 2707 | .name = "sr1_hwmod", |
2692 | .class = &omap36xx_smartreflex_hwmod_class, | 2708 | .class = &omap36xx_smartreflex_hwmod_class, |
2693 | .main_clk = "sr1_fck", | 2709 | .main_clk = "sr1_fck", |
2694 | .vdd_name = "mpu_iva", | ||
2695 | .prcm = { | 2710 | .prcm = { |
2696 | .omap2 = { | 2711 | .omap2 = { |
2697 | .prcm_reg_id = 1, | 2712 | .prcm_reg_id = 1, |
@@ -2703,9 +2718,15 @@ static struct omap_hwmod omap36xx_sr1_hwmod = { | |||
2703 | }, | 2718 | }, |
2704 | .slaves = omap3_sr1_slaves, | 2719 | .slaves = omap3_sr1_slaves, |
2705 | .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), | 2720 | .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), |
2721 | .dev_attr = &sr1_dev_attr, | ||
2722 | .mpu_irqs = omap3_smartreflex_mpu_irqs, | ||
2706 | }; | 2723 | }; |
2707 | 2724 | ||
2708 | /* SR2 */ | 2725 | /* SR2 */ |
2726 | static struct omap_smartreflex_dev_attr sr2_dev_attr = { | ||
2727 | .sensor_voltdm_name = "core", | ||
2728 | }; | ||
2729 | |||
2709 | static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = { | 2730 | static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = { |
2710 | &omap3_l4_core__sr2, | 2731 | &omap3_l4_core__sr2, |
2711 | }; | 2732 | }; |
@@ -2714,7 +2735,6 @@ static struct omap_hwmod omap34xx_sr2_hwmod = { | |||
2714 | .name = "sr2_hwmod", | 2735 | .name = "sr2_hwmod", |
2715 | .class = &omap34xx_smartreflex_hwmod_class, | 2736 | .class = &omap34xx_smartreflex_hwmod_class, |
2716 | .main_clk = "sr2_fck", | 2737 | .main_clk = "sr2_fck", |
2717 | .vdd_name = "core", | ||
2718 | .prcm = { | 2738 | .prcm = { |
2719 | .omap2 = { | 2739 | .omap2 = { |
2720 | .prcm_reg_id = 1, | 2740 | .prcm_reg_id = 1, |
@@ -2726,6 +2746,8 @@ static struct omap_hwmod omap34xx_sr2_hwmod = { | |||
2726 | }, | 2746 | }, |
2727 | .slaves = omap3_sr2_slaves, | 2747 | .slaves = omap3_sr2_slaves, |
2728 | .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), | 2748 | .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), |
2749 | .dev_attr = &sr2_dev_attr, | ||
2750 | .mpu_irqs = omap3_smartreflex_core_irqs, | ||
2729 | .flags = HWMOD_SET_DEFAULT_CLOCKACT, | 2751 | .flags = HWMOD_SET_DEFAULT_CLOCKACT, |
2730 | }; | 2752 | }; |
2731 | 2753 | ||
@@ -2733,7 +2755,6 @@ static struct omap_hwmod omap36xx_sr2_hwmod = { | |||
2733 | .name = "sr2_hwmod", | 2755 | .name = "sr2_hwmod", |
2734 | .class = &omap36xx_smartreflex_hwmod_class, | 2756 | .class = &omap36xx_smartreflex_hwmod_class, |
2735 | .main_clk = "sr2_fck", | 2757 | .main_clk = "sr2_fck", |
2736 | .vdd_name = "core", | ||
2737 | .prcm = { | 2758 | .prcm = { |
2738 | .omap2 = { | 2759 | .omap2 = { |
2739 | .prcm_reg_id = 1, | 2760 | .prcm_reg_id = 1, |
@@ -2745,6 +2766,8 @@ static struct omap_hwmod omap36xx_sr2_hwmod = { | |||
2745 | }, | 2766 | }, |
2746 | .slaves = omap3_sr2_slaves, | 2767 | .slaves = omap3_sr2_slaves, |
2747 | .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), | 2768 | .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), |
2769 | .dev_attr = &sr2_dev_attr, | ||
2770 | .mpu_irqs = omap3_smartreflex_core_irqs, | ||
2748 | }; | 2771 | }; |
2749 | 2772 | ||
2750 | /* | 2773 | /* |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index ef0524c10a84..ee3624bd1996 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include "omap_hwmod_common_data.h" | 35 | #include "omap_hwmod_common_data.h" |
36 | 36 | ||
37 | #include "smartreflex.h" | ||
37 | #include "cm1_44xx.h" | 38 | #include "cm1_44xx.h" |
38 | #include "cm2_44xx.h" | 39 | #include "cm2_44xx.h" |
39 | #include "prm44xx.h" | 40 | #include "prm44xx.h" |
@@ -3963,6 +3964,10 @@ static struct omap_hwmod_class omap44xx_smartreflex_hwmod_class = { | |||
3963 | }; | 3964 | }; |
3964 | 3965 | ||
3965 | /* smartreflex_core */ | 3966 | /* smartreflex_core */ |
3967 | static struct omap_smartreflex_dev_attr smartreflex_core_dev_attr = { | ||
3968 | .sensor_voltdm_name = "core", | ||
3969 | }; | ||
3970 | |||
3966 | static struct omap_hwmod omap44xx_smartreflex_core_hwmod; | 3971 | static struct omap_hwmod omap44xx_smartreflex_core_hwmod; |
3967 | static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = { | 3972 | static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = { |
3968 | { .irq = 19 + OMAP44XX_IRQ_GIC_START }, | 3973 | { .irq = 19 + OMAP44XX_IRQ_GIC_START }, |
@@ -3999,7 +4004,6 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = { | |||
3999 | .mpu_irqs = omap44xx_smartreflex_core_irqs, | 4004 | .mpu_irqs = omap44xx_smartreflex_core_irqs, |
4000 | 4005 | ||
4001 | .main_clk = "smartreflex_core_fck", | 4006 | .main_clk = "smartreflex_core_fck", |
4002 | .vdd_name = "core", | ||
4003 | .prcm = { | 4007 | .prcm = { |
4004 | .omap4 = { | 4008 | .omap4 = { |
4005 | .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET, | 4009 | .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET, |
@@ -4009,9 +4013,14 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = { | |||
4009 | }, | 4013 | }, |
4010 | .slaves = omap44xx_smartreflex_core_slaves, | 4014 | .slaves = omap44xx_smartreflex_core_slaves, |
4011 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves), | 4015 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves), |
4016 | .dev_attr = &smartreflex_core_dev_attr, | ||
4012 | }; | 4017 | }; |
4013 | 4018 | ||
4014 | /* smartreflex_iva */ | 4019 | /* smartreflex_iva */ |
4020 | static struct omap_smartreflex_dev_attr smartreflex_iva_dev_attr = { | ||
4021 | .sensor_voltdm_name = "iva", | ||
4022 | }; | ||
4023 | |||
4015 | static struct omap_hwmod omap44xx_smartreflex_iva_hwmod; | 4024 | static struct omap_hwmod omap44xx_smartreflex_iva_hwmod; |
4016 | static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = { | 4025 | static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = { |
4017 | { .irq = 102 + OMAP44XX_IRQ_GIC_START }, | 4026 | { .irq = 102 + OMAP44XX_IRQ_GIC_START }, |
@@ -4047,7 +4056,6 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = { | |||
4047 | .clkdm_name = "l4_ao_clkdm", | 4056 | .clkdm_name = "l4_ao_clkdm", |
4048 | .mpu_irqs = omap44xx_smartreflex_iva_irqs, | 4057 | .mpu_irqs = omap44xx_smartreflex_iva_irqs, |
4049 | .main_clk = "smartreflex_iva_fck", | 4058 | .main_clk = "smartreflex_iva_fck", |
4050 | .vdd_name = "iva", | ||
4051 | .prcm = { | 4059 | .prcm = { |
4052 | .omap4 = { | 4060 | .omap4 = { |
4053 | .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET, | 4061 | .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET, |
@@ -4057,9 +4065,14 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = { | |||
4057 | }, | 4065 | }, |
4058 | .slaves = omap44xx_smartreflex_iva_slaves, | 4066 | .slaves = omap44xx_smartreflex_iva_slaves, |
4059 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves), | 4067 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves), |
4068 | .dev_attr = &smartreflex_iva_dev_attr, | ||
4060 | }; | 4069 | }; |
4061 | 4070 | ||
4062 | /* smartreflex_mpu */ | 4071 | /* smartreflex_mpu */ |
4072 | static struct omap_smartreflex_dev_attr smartreflex_mpu_dev_attr = { | ||
4073 | .sensor_voltdm_name = "mpu", | ||
4074 | }; | ||
4075 | |||
4063 | static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod; | 4076 | static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod; |
4064 | static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = { | 4077 | static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = { |
4065 | { .irq = 18 + OMAP44XX_IRQ_GIC_START }, | 4078 | { .irq = 18 + OMAP44XX_IRQ_GIC_START }, |
@@ -4095,7 +4108,6 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = { | |||
4095 | .clkdm_name = "l4_ao_clkdm", | 4108 | .clkdm_name = "l4_ao_clkdm", |
4096 | .mpu_irqs = omap44xx_smartreflex_mpu_irqs, | 4109 | .mpu_irqs = omap44xx_smartreflex_mpu_irqs, |
4097 | .main_clk = "smartreflex_mpu_fck", | 4110 | .main_clk = "smartreflex_mpu_fck", |
4098 | .vdd_name = "mpu", | ||
4099 | .prcm = { | 4111 | .prcm = { |
4100 | .omap4 = { | 4112 | .omap4 = { |
4101 | .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET, | 4113 | .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET, |
@@ -4105,6 +4117,7 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = { | |||
4105 | }, | 4117 | }, |
4106 | .slaves = omap44xx_smartreflex_mpu_slaves, | 4118 | .slaves = omap44xx_smartreflex_mpu_slaves, |
4107 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves), | 4119 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves), |
4120 | .dev_attr = &smartreflex_mpu_dev_attr, | ||
4108 | }; | 4121 | }; |
4109 | 4122 | ||
4110 | /* | 4123 | /* |
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c index 53d9d0a5b39d..955566eefac4 100644 --- a/arch/arm/mach-omap2/smartreflex-class3.c +++ b/arch/arm/mach-omap2/smartreflex-class3.c | |||
@@ -29,6 +29,7 @@ static int sr_class3_enable(struct voltagedomain *voltdm) | |||
29 | 29 | ||
30 | static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset) | 30 | static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset) |
31 | { | 31 | { |
32 | sr_disable_errgen(voltdm); | ||
32 | omap_vp_disable(voltdm); | 33 | omap_vp_disable(voltdm); |
33 | sr_disable(voltdm); | 34 | sr_disable(voltdm); |
34 | if (is_volt_reset) | 35 | if (is_volt_reset) |
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 7e755bb0ffc4..008fbd7b9352 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c | |||
@@ -36,6 +36,12 @@ | |||
36 | #define SR_DISABLE_TIMEOUT 200 | 36 | #define SR_DISABLE_TIMEOUT 200 |
37 | 37 | ||
38 | struct omap_sr { | 38 | struct omap_sr { |
39 | struct list_head node; | ||
40 | struct platform_device *pdev; | ||
41 | struct omap_sr_nvalue_table *nvalue_table; | ||
42 | struct voltagedomain *voltdm; | ||
43 | struct dentry *dbg_dir; | ||
44 | unsigned int irq; | ||
39 | int srid; | 45 | int srid; |
40 | int ip_type; | 46 | int ip_type; |
41 | int nvalue_count; | 47 | int nvalue_count; |
@@ -49,13 +55,7 @@ struct omap_sr { | |||
49 | u32 senp_avgweight; | 55 | u32 senp_avgweight; |
50 | u32 senp_mod; | 56 | u32 senp_mod; |
51 | u32 senn_mod; | 57 | u32 senn_mod; |
52 | unsigned int irq; | ||
53 | void __iomem *base; | 58 | void __iomem *base; |
54 | struct platform_device *pdev; | ||
55 | struct list_head node; | ||
56 | struct omap_sr_nvalue_table *nvalue_table; | ||
57 | struct voltagedomain *voltdm; | ||
58 | struct dentry *dbg_dir; | ||
59 | }; | 59 | }; |
60 | 60 | ||
61 | /* sr_list contains all the instances of smartreflex module */ | 61 | /* sr_list contains all the instances of smartreflex module */ |
@@ -74,10 +74,6 @@ static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask, | |||
74 | u32 value) | 74 | u32 value) |
75 | { | 75 | { |
76 | u32 reg_val; | 76 | u32 reg_val; |
77 | u32 errconfig_offs = 0, errconfig_mask = 0; | ||
78 | |||
79 | reg_val = __raw_readl(sr->base + offset); | ||
80 | reg_val &= ~mask; | ||
81 | 77 | ||
82 | /* | 78 | /* |
83 | * Smartreflex error config register is special as it contains | 79 | * Smartreflex error config register is special as it contains |
@@ -88,16 +84,15 @@ static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask, | |||
88 | * if they are currently set, but does allow the caller to write | 84 | * if they are currently set, but does allow the caller to write |
89 | * those bits. | 85 | * those bits. |
90 | */ | 86 | */ |
91 | if (sr->ip_type == SR_TYPE_V1) { | 87 | if (sr->ip_type == SR_TYPE_V1 && offset == ERRCONFIG_V1) |
92 | errconfig_offs = ERRCONFIG_V1; | 88 | mask |= ERRCONFIG_STATUS_V1_MASK; |
93 | errconfig_mask = ERRCONFIG_STATUS_V1_MASK; | 89 | else if (sr->ip_type == SR_TYPE_V2 && offset == ERRCONFIG_V2) |
94 | } else if (sr->ip_type == SR_TYPE_V2) { | 90 | mask |= ERRCONFIG_VPBOUNDINTST_V2; |
95 | errconfig_offs = ERRCONFIG_V2; | 91 | |
96 | errconfig_mask = ERRCONFIG_VPBOUNDINTST_V2; | 92 | reg_val = __raw_readl(sr->base + offset); |
97 | } | 93 | reg_val &= ~mask; |
98 | 94 | ||
99 | if (offset == errconfig_offs) | 95 | value &= mask; |
100 | reg_val &= ~errconfig_mask; | ||
101 | 96 | ||
102 | reg_val |= value; | 97 | reg_val |= value; |
103 | 98 | ||
@@ -128,21 +123,28 @@ static struct omap_sr *_sr_lookup(struct voltagedomain *voltdm) | |||
128 | 123 | ||
129 | static irqreturn_t sr_interrupt(int irq, void *data) | 124 | static irqreturn_t sr_interrupt(int irq, void *data) |
130 | { | 125 | { |
131 | struct omap_sr *sr_info = (struct omap_sr *)data; | 126 | struct omap_sr *sr_info = data; |
132 | u32 status = 0; | 127 | u32 status = 0; |
133 | 128 | ||
134 | if (sr_info->ip_type == SR_TYPE_V1) { | 129 | switch (sr_info->ip_type) { |
130 | case SR_TYPE_V1: | ||
135 | /* Read the status bits */ | 131 | /* Read the status bits */ |
136 | status = sr_read_reg(sr_info, ERRCONFIG_V1); | 132 | status = sr_read_reg(sr_info, ERRCONFIG_V1); |
137 | 133 | ||
138 | /* Clear them by writing back */ | 134 | /* Clear them by writing back */ |
139 | sr_write_reg(sr_info, ERRCONFIG_V1, status); | 135 | sr_write_reg(sr_info, ERRCONFIG_V1, status); |
140 | } else if (sr_info->ip_type == SR_TYPE_V2) { | 136 | break; |
137 | case SR_TYPE_V2: | ||
141 | /* Read the status bits */ | 138 | /* Read the status bits */ |
142 | status = sr_read_reg(sr_info, IRQSTATUS); | 139 | status = sr_read_reg(sr_info, IRQSTATUS); |
143 | 140 | ||
144 | /* Clear them by writing back */ | 141 | /* Clear them by writing back */ |
145 | sr_write_reg(sr_info, IRQSTATUS, status); | 142 | sr_write_reg(sr_info, IRQSTATUS, status); |
143 | break; | ||
144 | default: | ||
145 | dev_err(&sr_info->pdev->dev, "UNKNOWN IP type %d\n", | ||
146 | sr_info->ip_type); | ||
147 | return IRQ_NONE; | ||
146 | } | 148 | } |
147 | 149 | ||
148 | if (sr_class->notify) | 150 | if (sr_class->notify) |
@@ -166,6 +168,7 @@ static void sr_set_clk_length(struct omap_sr *sr) | |||
166 | __func__); | 168 | __func__); |
167 | return; | 169 | return; |
168 | } | 170 | } |
171 | |||
169 | sys_clk_speed = clk_get_rate(sys_ck); | 172 | sys_clk_speed = clk_get_rate(sys_ck); |
170 | clk_put(sys_ck); | 173 | clk_put(sys_ck); |
171 | 174 | ||
@@ -267,7 +270,7 @@ static int sr_late_init(struct omap_sr *sr_info) | |||
267 | goto error; | 270 | goto error; |
268 | } | 271 | } |
269 | ret = request_irq(sr_info->irq, sr_interrupt, | 272 | ret = request_irq(sr_info->irq, sr_interrupt, |
270 | 0, name, (void *)sr_info); | 273 | 0, name, sr_info); |
271 | if (ret) | 274 | if (ret) |
272 | goto error; | 275 | goto error; |
273 | disable_irq(sr_info->irq); | 276 | disable_irq(sr_info->irq); |
@@ -288,12 +291,15 @@ error: | |||
288 | "not function as desired\n", __func__); | 291 | "not function as desired\n", __func__); |
289 | kfree(name); | 292 | kfree(name); |
290 | kfree(sr_info); | 293 | kfree(sr_info); |
294 | |||
291 | return ret; | 295 | return ret; |
292 | } | 296 | } |
293 | 297 | ||
294 | static void sr_v1_disable(struct omap_sr *sr) | 298 | static void sr_v1_disable(struct omap_sr *sr) |
295 | { | 299 | { |
296 | int timeout = 0; | 300 | int timeout = 0; |
301 | int errconf_val = ERRCONFIG_MCUACCUMINTST | ERRCONFIG_MCUVALIDINTST | | ||
302 | ERRCONFIG_MCUBOUNDINTST; | ||
297 | 303 | ||
298 | /* Enable MCUDisableAcknowledge interrupt */ | 304 | /* Enable MCUDisableAcknowledge interrupt */ |
299 | sr_modify_reg(sr, ERRCONFIG_V1, | 305 | sr_modify_reg(sr, ERRCONFIG_V1, |
@@ -302,13 +308,13 @@ static void sr_v1_disable(struct omap_sr *sr) | |||
302 | /* SRCONFIG - disable SR */ | 308 | /* SRCONFIG - disable SR */ |
303 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); | 309 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); |
304 | 310 | ||
305 | /* Disable all other SR interrupts and clear the status */ | 311 | /* Disable all other SR interrupts and clear the status as needed */ |
312 | if (sr_read_reg(sr, ERRCONFIG_V1) & ERRCONFIG_VPBOUNDINTST_V1) | ||
313 | errconf_val |= ERRCONFIG_VPBOUNDINTST_V1; | ||
306 | sr_modify_reg(sr, ERRCONFIG_V1, | 314 | sr_modify_reg(sr, ERRCONFIG_V1, |
307 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | | 315 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | |
308 | ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_VPBOUNDINTEN_V1), | 316 | ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_VPBOUNDINTEN_V1), |
309 | (ERRCONFIG_MCUACCUMINTST | ERRCONFIG_MCUVALIDINTST | | 317 | errconf_val); |
310 | ERRCONFIG_MCUBOUNDINTST | | ||
311 | ERRCONFIG_VPBOUNDINTST_V1)); | ||
312 | 318 | ||
313 | /* | 319 | /* |
314 | * Wait for SR to be disabled. | 320 | * Wait for SR to be disabled. |
@@ -337,9 +343,17 @@ static void sr_v2_disable(struct omap_sr *sr) | |||
337 | /* SRCONFIG - disable SR */ | 343 | /* SRCONFIG - disable SR */ |
338 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); | 344 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); |
339 | 345 | ||
340 | /* Disable all other SR interrupts and clear the status */ | 346 | /* |
341 | sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, | 347 | * Disable all other SR interrupts and clear the status |
348 | * write to status register ONLY on need basis - only if status | ||
349 | * is set. | ||
350 | */ | ||
351 | if (sr_read_reg(sr, ERRCONFIG_V2) & ERRCONFIG_VPBOUNDINTST_V2) | ||
352 | sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, | ||
342 | ERRCONFIG_VPBOUNDINTST_V2); | 353 | ERRCONFIG_VPBOUNDINTST_V2); |
354 | else | ||
355 | sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, | ||
356 | 0x0); | ||
343 | sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT | | 357 | sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT | |
344 | IRQENABLE_MCUVALIDINT | | 358 | IRQENABLE_MCUVALIDINT | |
345 | IRQENABLE_MCUBOUNDSINT)); | 359 | IRQENABLE_MCUBOUNDSINT)); |
@@ -398,15 +412,16 @@ static u32 sr_retrieve_nvalue(struct omap_sr *sr, u32 efuse_offs) | |||
398 | */ | 412 | */ |
399 | int sr_configure_errgen(struct voltagedomain *voltdm) | 413 | int sr_configure_errgen(struct voltagedomain *voltdm) |
400 | { | 414 | { |
401 | u32 sr_config, sr_errconfig, errconfig_offs, vpboundint_en; | 415 | u32 sr_config, sr_errconfig, errconfig_offs; |
402 | u32 vpboundint_st, senp_en = 0, senn_en = 0; | 416 | u32 vpboundint_en, vpboundint_st; |
417 | u32 senp_en = 0, senn_en = 0; | ||
403 | u8 senp_shift, senn_shift; | 418 | u8 senp_shift, senn_shift; |
404 | struct omap_sr *sr = _sr_lookup(voltdm); | 419 | struct omap_sr *sr = _sr_lookup(voltdm); |
405 | 420 | ||
406 | if (IS_ERR(sr)) { | 421 | if (IS_ERR(sr)) { |
407 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | 422 | pr_warning("%s: omap_sr struct for sr_%s not found\n", |
408 | __func__, voltdm->name); | 423 | __func__, voltdm->name); |
409 | return -EINVAL; | 424 | return PTR_ERR(sr); |
410 | } | 425 | } |
411 | 426 | ||
412 | if (!sr->clk_length) | 427 | if (!sr->clk_length) |
@@ -418,20 +433,23 @@ int sr_configure_errgen(struct voltagedomain *voltdm) | |||
418 | sr_config = (sr->clk_length << SRCONFIG_SRCLKLENGTH_SHIFT) | | 433 | sr_config = (sr->clk_length << SRCONFIG_SRCLKLENGTH_SHIFT) | |
419 | SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN; | 434 | SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN; |
420 | 435 | ||
421 | if (sr->ip_type == SR_TYPE_V1) { | 436 | switch (sr->ip_type) { |
437 | case SR_TYPE_V1: | ||
422 | sr_config |= SRCONFIG_DELAYCTRL; | 438 | sr_config |= SRCONFIG_DELAYCTRL; |
423 | senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; | 439 | senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; |
424 | senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; | 440 | senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; |
425 | errconfig_offs = ERRCONFIG_V1; | 441 | errconfig_offs = ERRCONFIG_V1; |
426 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1; | 442 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1; |
427 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1; | 443 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1; |
428 | } else if (sr->ip_type == SR_TYPE_V2) { | 444 | break; |
445 | case SR_TYPE_V2: | ||
429 | senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; | 446 | senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; |
430 | senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; | 447 | senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; |
431 | errconfig_offs = ERRCONFIG_V2; | 448 | errconfig_offs = ERRCONFIG_V2; |
432 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2; | 449 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2; |
433 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2; | 450 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2; |
434 | } else { | 451 | break; |
452 | default: | ||
435 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" | 453 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" |
436 | "module without specifying the ip\n", __func__); | 454 | "module without specifying the ip\n", __func__); |
437 | return -EINVAL; | 455 | return -EINVAL; |
@@ -447,8 +465,55 @@ int sr_configure_errgen(struct voltagedomain *voltdm) | |||
447 | sr_errconfig); | 465 | sr_errconfig); |
448 | 466 | ||
449 | /* Enabling the interrupts if the ERROR module is used */ | 467 | /* Enabling the interrupts if the ERROR module is used */ |
450 | sr_modify_reg(sr, errconfig_offs, | 468 | sr_modify_reg(sr, errconfig_offs, (vpboundint_en | vpboundint_st), |
451 | vpboundint_en, (vpboundint_en | vpboundint_st)); | 469 | vpboundint_en); |
470 | |||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | /** | ||
475 | * sr_disable_errgen() - Disables SmartReflex AVS module's errgen component | ||
476 | * @voltdm: VDD pointer to which the SR module to be configured belongs to. | ||
477 | * | ||
478 | * This API is to be called from the smartreflex class driver to | ||
479 | * disable the error generator module inside the smartreflex module. | ||
480 | * | ||
481 | * Returns 0 on success and error value in case of failure. | ||
482 | */ | ||
483 | int sr_disable_errgen(struct voltagedomain *voltdm) | ||
484 | { | ||
485 | u32 errconfig_offs; | ||
486 | u32 vpboundint_en, vpboundint_st; | ||
487 | struct omap_sr *sr = _sr_lookup(voltdm); | ||
488 | |||
489 | if (IS_ERR(sr)) { | ||
490 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | ||
491 | __func__, voltdm->name); | ||
492 | return PTR_ERR(sr); | ||
493 | } | ||
494 | |||
495 | switch (sr->ip_type) { | ||
496 | case SR_TYPE_V1: | ||
497 | errconfig_offs = ERRCONFIG_V1; | ||
498 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1; | ||
499 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1; | ||
500 | break; | ||
501 | case SR_TYPE_V2: | ||
502 | errconfig_offs = ERRCONFIG_V2; | ||
503 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2; | ||
504 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2; | ||
505 | break; | ||
506 | default: | ||
507 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" | ||
508 | "module without specifying the ip\n", __func__); | ||
509 | return -EINVAL; | ||
510 | } | ||
511 | |||
512 | /* Disable the interrupts of ERROR module */ | ||
513 | sr_modify_reg(sr, errconfig_offs, vpboundint_en | vpboundint_st, 0); | ||
514 | |||
515 | /* Disable the Sensor and errorgen */ | ||
516 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN, 0); | ||
452 | 517 | ||
453 | return 0; | 518 | return 0; |
454 | } | 519 | } |
@@ -475,7 +540,7 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
475 | if (IS_ERR(sr)) { | 540 | if (IS_ERR(sr)) { |
476 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | 541 | pr_warning("%s: omap_sr struct for sr_%s not found\n", |
477 | __func__, voltdm->name); | 542 | __func__, voltdm->name); |
478 | return -EINVAL; | 543 | return PTR_ERR(sr); |
479 | } | 544 | } |
480 | 545 | ||
481 | if (!sr->clk_length) | 546 | if (!sr->clk_length) |
@@ -488,14 +553,17 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
488 | SRCONFIG_SENENABLE | | 553 | SRCONFIG_SENENABLE | |
489 | (sr->accum_data << SRCONFIG_ACCUMDATA_SHIFT); | 554 | (sr->accum_data << SRCONFIG_ACCUMDATA_SHIFT); |
490 | 555 | ||
491 | if (sr->ip_type == SR_TYPE_V1) { | 556 | switch (sr->ip_type) { |
557 | case SR_TYPE_V1: | ||
492 | sr_config |= SRCONFIG_DELAYCTRL; | 558 | sr_config |= SRCONFIG_DELAYCTRL; |
493 | senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; | 559 | senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; |
494 | senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; | 560 | senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; |
495 | } else if (sr->ip_type == SR_TYPE_V2) { | 561 | break; |
562 | case SR_TYPE_V2: | ||
496 | senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; | 563 | senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; |
497 | senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; | 564 | senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; |
498 | } else { | 565 | break; |
566 | default: | ||
499 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" | 567 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" |
500 | "module without specifying the ip\n", __func__); | 568 | "module without specifying the ip\n", __func__); |
501 | return -EINVAL; | 569 | return -EINVAL; |
@@ -511,20 +579,27 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
511 | * Enabling the interrupts if MINMAXAVG module is used. | 579 | * Enabling the interrupts if MINMAXAVG module is used. |
512 | * TODO: check if all the interrupts are mandatory | 580 | * TODO: check if all the interrupts are mandatory |
513 | */ | 581 | */ |
514 | if (sr->ip_type == SR_TYPE_V1) { | 582 | switch (sr->ip_type) { |
583 | case SR_TYPE_V1: | ||
515 | sr_modify_reg(sr, ERRCONFIG_V1, | 584 | sr_modify_reg(sr, ERRCONFIG_V1, |
516 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | | 585 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | |
517 | ERRCONFIG_MCUBOUNDINTEN), | 586 | ERRCONFIG_MCUBOUNDINTEN), |
518 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUACCUMINTST | | 587 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUACCUMINTST | |
519 | ERRCONFIG_MCUVALIDINTEN | ERRCONFIG_MCUVALIDINTST | | 588 | ERRCONFIG_MCUVALIDINTEN | ERRCONFIG_MCUVALIDINTST | |
520 | ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_MCUBOUNDINTST)); | 589 | ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_MCUBOUNDINTST)); |
521 | } else if (sr->ip_type == SR_TYPE_V2) { | 590 | break; |
591 | case SR_TYPE_V2: | ||
522 | sr_write_reg(sr, IRQSTATUS, | 592 | sr_write_reg(sr, IRQSTATUS, |
523 | IRQSTATUS_MCUACCUMINT | IRQSTATUS_MCVALIDINT | | 593 | IRQSTATUS_MCUACCUMINT | IRQSTATUS_MCVALIDINT | |
524 | IRQSTATUS_MCBOUNDSINT | IRQSTATUS_MCUDISABLEACKINT); | 594 | IRQSTATUS_MCBOUNDSINT | IRQSTATUS_MCUDISABLEACKINT); |
525 | sr_write_reg(sr, IRQENABLE_SET, | 595 | sr_write_reg(sr, IRQENABLE_SET, |
526 | IRQENABLE_MCUACCUMINT | IRQENABLE_MCUVALIDINT | | 596 | IRQENABLE_MCUACCUMINT | IRQENABLE_MCUVALIDINT | |
527 | IRQENABLE_MCUBOUNDSINT | IRQENABLE_MCUDISABLEACKINT); | 597 | IRQENABLE_MCUBOUNDSINT | IRQENABLE_MCUDISABLEACKINT); |
598 | break; | ||
599 | default: | ||
600 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" | ||
601 | "module without specifying the ip\n", __func__); | ||
602 | return -EINVAL; | ||
528 | } | 603 | } |
529 | 604 | ||
530 | return 0; | 605 | return 0; |
@@ -543,15 +618,15 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
543 | */ | 618 | */ |
544 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt) | 619 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt) |
545 | { | 620 | { |
546 | u32 nvalue_reciprocal; | ||
547 | struct omap_volt_data *volt_data; | 621 | struct omap_volt_data *volt_data; |
548 | struct omap_sr *sr = _sr_lookup(voltdm); | 622 | struct omap_sr *sr = _sr_lookup(voltdm); |
623 | u32 nvalue_reciprocal; | ||
549 | int ret; | 624 | int ret; |
550 | 625 | ||
551 | if (IS_ERR(sr)) { | 626 | if (IS_ERR(sr)) { |
552 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | 627 | pr_warning("%s: omap_sr struct for sr_%s not found\n", |
553 | __func__, voltdm->name); | 628 | __func__, voltdm->name); |
554 | return -EINVAL; | 629 | return PTR_ERR(sr); |
555 | } | 630 | } |
556 | 631 | ||
557 | volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); | 632 | volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); |
@@ -559,7 +634,7 @@ int sr_enable(struct voltagedomain *voltdm, unsigned long volt) | |||
559 | if (IS_ERR(volt_data)) { | 634 | if (IS_ERR(volt_data)) { |
560 | dev_warn(&sr->pdev->dev, "%s: Unable to get voltage table" | 635 | dev_warn(&sr->pdev->dev, "%s: Unable to get voltage table" |
561 | "for nominal voltage %ld\n", __func__, volt); | 636 | "for nominal voltage %ld\n", __func__, volt); |
562 | return -ENODATA; | 637 | return PTR_ERR(volt_data); |
563 | } | 638 | } |
564 | 639 | ||
565 | nvalue_reciprocal = sr_retrieve_nvalue(sr, volt_data->sr_efuse_offs); | 640 | nvalue_reciprocal = sr_retrieve_nvalue(sr, volt_data->sr_efuse_offs); |
@@ -617,10 +692,17 @@ void sr_disable(struct voltagedomain *voltdm) | |||
617 | * disable the clocks. | 692 | * disable the clocks. |
618 | */ | 693 | */ |
619 | if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE) { | 694 | if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE) { |
620 | if (sr->ip_type == SR_TYPE_V1) | 695 | switch (sr->ip_type) { |
696 | case SR_TYPE_V1: | ||
621 | sr_v1_disable(sr); | 697 | sr_v1_disable(sr); |
622 | else if (sr->ip_type == SR_TYPE_V2) | 698 | break; |
699 | case SR_TYPE_V2: | ||
623 | sr_v2_disable(sr); | 700 | sr_v2_disable(sr); |
701 | break; | ||
702 | default: | ||
703 | dev_err(&sr->pdev->dev, "UNKNOWN IP type %d\n", | ||
704 | sr->ip_type); | ||
705 | } | ||
624 | } | 706 | } |
625 | 707 | ||
626 | pm_runtime_put_sync_suspend(&sr->pdev->dev); | 708 | pm_runtime_put_sync_suspend(&sr->pdev->dev); |
@@ -779,10 +861,10 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data) | |||
779 | sr_pmic_data = pmic_data; | 861 | sr_pmic_data = pmic_data; |
780 | } | 862 | } |
781 | 863 | ||
782 | /* PM Debug Fs enteries to enable disable smartreflex. */ | 864 | /* PM Debug FS entries to enable and disable smartreflex. */ |
783 | static int omap_sr_autocomp_show(void *data, u64 *val) | 865 | static int omap_sr_autocomp_show(void *data, u64 *val) |
784 | { | 866 | { |
785 | struct omap_sr *sr_info = (struct omap_sr *) data; | 867 | struct omap_sr *sr_info = data; |
786 | 868 | ||
787 | if (!sr_info) { | 869 | if (!sr_info) { |
788 | pr_warning("%s: omap_sr struct not found\n", __func__); | 870 | pr_warning("%s: omap_sr struct not found\n", __func__); |
@@ -796,7 +878,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val) | |||
796 | 878 | ||
797 | static int omap_sr_autocomp_store(void *data, u64 val) | 879 | static int omap_sr_autocomp_store(void *data, u64 val) |
798 | { | 880 | { |
799 | struct omap_sr *sr_info = (struct omap_sr *) data; | 881 | struct omap_sr *sr_info = data; |
800 | 882 | ||
801 | if (!sr_info) { | 883 | if (!sr_info) { |
802 | pr_warning("%s: omap_sr struct not found\n", __func__); | 884 | pr_warning("%s: omap_sr struct not found\n", __func__); |
@@ -804,7 +886,7 @@ static int omap_sr_autocomp_store(void *data, u64 val) | |||
804 | } | 886 | } |
805 | 887 | ||
806 | /* Sanity check */ | 888 | /* Sanity check */ |
807 | if (val && (val != 1)) { | 889 | if (val > 1) { |
808 | pr_warning("%s: Invalid argument %lld\n", __func__, val); | 890 | pr_warning("%s: Invalid argument %lld\n", __func__, val); |
809 | return -EINVAL; | 891 | return -EINVAL; |
810 | } | 892 | } |
@@ -821,11 +903,11 @@ static int omap_sr_autocomp_store(void *data, u64 val) | |||
821 | } | 903 | } |
822 | 904 | ||
823 | DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show, | 905 | DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show, |
824 | omap_sr_autocomp_store, "%llu\n"); | 906 | omap_sr_autocomp_store, "%llu\n"); |
825 | 907 | ||
826 | static int __init omap_sr_probe(struct platform_device *pdev) | 908 | static int __init omap_sr_probe(struct platform_device *pdev) |
827 | { | 909 | { |
828 | struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); | 910 | struct omap_sr *sr_info; |
829 | struct omap_sr_data *pdata = pdev->dev.platform_data; | 911 | struct omap_sr_data *pdata = pdev->dev.platform_data; |
830 | struct resource *mem, *irq; | 912 | struct resource *mem, *irq; |
831 | struct dentry *nvalue_dir; | 913 | struct dentry *nvalue_dir; |
@@ -833,12 +915,15 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
833 | int i, ret = 0; | 915 | int i, ret = 0; |
834 | char *name; | 916 | char *name; |
835 | 917 | ||
918 | sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); | ||
836 | if (!sr_info) { | 919 | if (!sr_info) { |
837 | dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", | 920 | dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", |
838 | __func__); | 921 | __func__); |
839 | return -ENOMEM; | 922 | return -ENOMEM; |
840 | } | 923 | } |
841 | 924 | ||
925 | platform_set_drvdata(pdev, sr_info); | ||
926 | |||
842 | if (!pdata) { | 927 | if (!pdata) { |
843 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); | 928 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); |
844 | ret = -EINVAL; | 929 | ret = -EINVAL; |
@@ -904,7 +989,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
904 | dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__); | 989 | dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__); |
905 | if (!sr_dbg_dir) { | 990 | if (!sr_dbg_dir) { |
906 | sr_dbg_dir = debugfs_create_dir("smartreflex", NULL); | 991 | sr_dbg_dir = debugfs_create_dir("smartreflex", NULL); |
907 | if (!sr_dbg_dir) { | 992 | if (IS_ERR_OR_NULL(sr_dbg_dir)) { |
908 | ret = PTR_ERR(sr_dbg_dir); | 993 | ret = PTR_ERR(sr_dbg_dir); |
909 | pr_err("%s:sr debugfs dir creation failed(%d)\n", | 994 | pr_err("%s:sr debugfs dir creation failed(%d)\n", |
910 | __func__, ret); | 995 | __func__, ret); |
@@ -921,7 +1006,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
921 | } | 1006 | } |
922 | sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir); | 1007 | sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir); |
923 | kfree(name); | 1008 | kfree(name); |
924 | if (IS_ERR(sr_info->dbg_dir)) { | 1009 | if (IS_ERR_OR_NULL(sr_info->dbg_dir)) { |
925 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", | 1010 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", |
926 | __func__); | 1011 | __func__); |
927 | ret = PTR_ERR(sr_info->dbg_dir); | 1012 | ret = PTR_ERR(sr_info->dbg_dir); |
@@ -938,7 +1023,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
938 | &sr_info->err_minlimit); | 1023 | &sr_info->err_minlimit); |
939 | 1024 | ||
940 | nvalue_dir = debugfs_create_dir("nvalue", sr_info->dbg_dir); | 1025 | nvalue_dir = debugfs_create_dir("nvalue", sr_info->dbg_dir); |
941 | if (IS_ERR(nvalue_dir)) { | 1026 | if (IS_ERR_OR_NULL(nvalue_dir)) { |
942 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory" | 1027 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory" |
943 | "for n-values\n", __func__); | 1028 | "for n-values\n", __func__); |
944 | ret = PTR_ERR(nvalue_dir); | 1029 | ret = PTR_ERR(nvalue_dir); |
@@ -994,7 +1079,7 @@ static int __devexit omap_sr_remove(struct platform_device *pdev) | |||
994 | if (IS_ERR(sr_info)) { | 1079 | if (IS_ERR(sr_info)) { |
995 | dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", | 1080 | dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", |
996 | __func__); | 1081 | __func__); |
997 | return -EINVAL; | 1082 | return PTR_ERR(sr_info); |
998 | } | 1083 | } |
999 | 1084 | ||
1000 | if (sr_info->autocomp_active) | 1085 | if (sr_info->autocomp_active) |
@@ -1011,8 +1096,32 @@ static int __devexit omap_sr_remove(struct platform_device *pdev) | |||
1011 | return 0; | 1096 | return 0; |
1012 | } | 1097 | } |
1013 | 1098 | ||
1099 | static void __devexit omap_sr_shutdown(struct platform_device *pdev) | ||
1100 | { | ||
1101 | struct omap_sr_data *pdata = pdev->dev.platform_data; | ||
1102 | struct omap_sr *sr_info; | ||
1103 | |||
1104 | if (!pdata) { | ||
1105 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); | ||
1106 | return; | ||
1107 | } | ||
1108 | |||
1109 | sr_info = _sr_lookup(pdata->voltdm); | ||
1110 | if (IS_ERR(sr_info)) { | ||
1111 | dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", | ||
1112 | __func__); | ||
1113 | return; | ||
1114 | } | ||
1115 | |||
1116 | if (sr_info->autocomp_active) | ||
1117 | sr_stop_vddautocomp(sr_info); | ||
1118 | |||
1119 | return; | ||
1120 | } | ||
1121 | |||
1014 | static struct platform_driver smartreflex_driver = { | 1122 | static struct platform_driver smartreflex_driver = { |
1015 | .remove = omap_sr_remove, | 1123 | .remove = __devexit_p(omap_sr_remove), |
1124 | .shutdown = __devexit_p(omap_sr_shutdown), | ||
1016 | .driver = { | 1125 | .driver = { |
1017 | .name = "smartreflex", | 1126 | .name = "smartreflex", |
1018 | }, | 1127 | }, |
@@ -1042,12 +1151,12 @@ static int __init sr_init(void) | |||
1042 | 1151 | ||
1043 | return 0; | 1152 | return 0; |
1044 | } | 1153 | } |
1154 | late_initcall(sr_init); | ||
1045 | 1155 | ||
1046 | static void __exit sr_exit(void) | 1156 | static void __exit sr_exit(void) |
1047 | { | 1157 | { |
1048 | platform_driver_unregister(&smartreflex_driver); | 1158 | platform_driver_unregister(&smartreflex_driver); |
1049 | } | 1159 | } |
1050 | late_initcall(sr_init); | ||
1051 | module_exit(sr_exit); | 1160 | module_exit(sr_exit); |
1052 | 1161 | ||
1053 | MODULE_DESCRIPTION("OMAP Smartreflex Driver"); | 1162 | MODULE_DESCRIPTION("OMAP Smartreflex Driver"); |
diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h index 5f35b9e25556..5809141171f8 100644 --- a/arch/arm/mach-omap2/smartreflex.h +++ b/arch/arm/mach-omap2/smartreflex.h | |||
@@ -152,6 +152,15 @@ struct omap_sr_pmic_data { | |||
152 | void (*sr_pmic_init) (void); | 152 | void (*sr_pmic_init) (void); |
153 | }; | 153 | }; |
154 | 154 | ||
155 | /** | ||
156 | * struct omap_smartreflex_dev_attr - Smartreflex Device attribute. | ||
157 | * | ||
158 | * @sensor_voltdm_name: Name of voltdomain of SR instance | ||
159 | */ | ||
160 | struct omap_smartreflex_dev_attr { | ||
161 | const char *sensor_voltdm_name; | ||
162 | }; | ||
163 | |||
155 | #ifdef CONFIG_OMAP_SMARTREFLEX | 164 | #ifdef CONFIG_OMAP_SMARTREFLEX |
156 | /* | 165 | /* |
157 | * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR. | 166 | * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR. |
@@ -231,6 +240,7 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data); | |||
231 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt); | 240 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt); |
232 | void sr_disable(struct voltagedomain *voltdm); | 241 | void sr_disable(struct voltagedomain *voltdm); |
233 | int sr_configure_errgen(struct voltagedomain *voltdm); | 242 | int sr_configure_errgen(struct voltagedomain *voltdm); |
243 | int sr_disable_errgen(struct voltagedomain *voltdm); | ||
234 | int sr_configure_minmax(struct voltagedomain *voltdm); | 244 | int sr_configure_minmax(struct voltagedomain *voltdm); |
235 | 245 | ||
236 | /* API to register the smartreflex class driver with the smartreflex driver */ | 246 | /* API to register the smartreflex class driver with the smartreflex driver */ |
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c index 9f43fcc05d3e..60293370a2a7 100644 --- a/arch/arm/mach-omap2/sr_device.c +++ b/arch/arm/mach-omap2/sr_device.c | |||
@@ -74,6 +74,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user) | |||
74 | struct omap_sr_data *sr_data; | 74 | struct omap_sr_data *sr_data; |
75 | struct platform_device *pdev; | 75 | struct platform_device *pdev; |
76 | struct omap_volt_data *volt_data; | 76 | struct omap_volt_data *volt_data; |
77 | struct omap_smartreflex_dev_attr *sr_dev_attr; | ||
77 | char *name = "smartreflex"; | 78 | char *name = "smartreflex"; |
78 | static int i; | 79 | static int i; |
79 | 80 | ||
@@ -84,9 +85,11 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user) | |||
84 | return -ENOMEM; | 85 | return -ENOMEM; |
85 | } | 86 | } |
86 | 87 | ||
87 | if (!oh->vdd_name) { | 88 | sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr; |
89 | if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) { | ||
88 | pr_err("%s: No voltage domain specified for %s." | 90 | pr_err("%s: No voltage domain specified for %s." |
89 | "Cannot initialize\n", __func__, oh->name); | 91 | "Cannot initialize\n", __func__, |
92 | oh->name); | ||
90 | goto exit; | 93 | goto exit; |
91 | } | 94 | } |
92 | 95 | ||
@@ -94,10 +97,10 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user) | |||
94 | sr_data->senn_mod = 0x1; | 97 | sr_data->senn_mod = 0x1; |
95 | sr_data->senp_mod = 0x1; | 98 | sr_data->senp_mod = 0x1; |
96 | 99 | ||
97 | sr_data->voltdm = voltdm_lookup(oh->vdd_name); | 100 | sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); |
98 | if (IS_ERR(sr_data->voltdm)) { | 101 | if (IS_ERR(sr_data->voltdm)) { |
99 | pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", | 102 | pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", |
100 | __func__, oh->vdd_name); | 103 | __func__, sr_dev_attr->sensor_voltdm_name); |
101 | goto exit; | 104 | goto exit; |
102 | } | 105 | } |
103 | 106 | ||
diff --git a/arch/arm/mach-prima2/irq.c b/arch/arm/mach-prima2/irq.c index d93ceef4a50a..37c2de9b6f26 100644 --- a/arch/arm/mach-prima2/irq.c +++ b/arch/arm/mach-prima2/irq.c | |||
@@ -68,7 +68,7 @@ void __init sirfsoc_of_irq_init(void) | |||
68 | if (!sirfsoc_intc_base) | 68 | if (!sirfsoc_intc_base) |
69 | panic("unable to map intc cpu registers\n"); | 69 | panic("unable to map intc cpu registers\n"); |
70 | 70 | ||
71 | irq_domain_add_simple(np, 0); | 71 | irq_domain_add_legacy(np, 32, 0, 0, &irq_domain_simple_ops, NULL); |
72 | 72 | ||
73 | of_node_put(np); | 73 | of_node_put(np); |
74 | 74 | ||
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 5bc13121eac5..84f2d7015cfe 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -406,20 +406,17 @@ static struct resource pxa_rtc_resources[] = { | |||
406 | [1] = { | 406 | [1] = { |
407 | .start = IRQ_RTC1Hz, | 407 | .start = IRQ_RTC1Hz, |
408 | .end = IRQ_RTC1Hz, | 408 | .end = IRQ_RTC1Hz, |
409 | .name = "rtc 1Hz", | ||
409 | .flags = IORESOURCE_IRQ, | 410 | .flags = IORESOURCE_IRQ, |
410 | }, | 411 | }, |
411 | [2] = { | 412 | [2] = { |
412 | .start = IRQ_RTCAlrm, | 413 | .start = IRQ_RTCAlrm, |
413 | .end = IRQ_RTCAlrm, | 414 | .end = IRQ_RTCAlrm, |
415 | .name = "rtc alarm", | ||
414 | .flags = IORESOURCE_IRQ, | 416 | .flags = IORESOURCE_IRQ, |
415 | }, | 417 | }, |
416 | }; | 418 | }; |
417 | 419 | ||
418 | struct platform_device sa1100_device_rtc = { | ||
419 | .name = "sa1100-rtc", | ||
420 | .id = -1, | ||
421 | }; | ||
422 | |||
423 | struct platform_device pxa_device_rtc = { | 420 | struct platform_device pxa_device_rtc = { |
424 | .name = "pxa-rtc", | 421 | .name = "pxa-rtc", |
425 | .id = -1, | 422 | .id = -1, |
@@ -427,6 +424,27 @@ struct platform_device pxa_device_rtc = { | |||
427 | .resource = pxa_rtc_resources, | 424 | .resource = pxa_rtc_resources, |
428 | }; | 425 | }; |
429 | 426 | ||
427 | static struct resource sa1100_rtc_resources[] = { | ||
428 | { | ||
429 | .start = IRQ_RTC1Hz, | ||
430 | .end = IRQ_RTC1Hz, | ||
431 | .name = "rtc 1Hz", | ||
432 | .flags = IORESOURCE_IRQ, | ||
433 | }, { | ||
434 | .start = IRQ_RTCAlrm, | ||
435 | .end = IRQ_RTCAlrm, | ||
436 | .name = "rtc alarm", | ||
437 | .flags = IORESOURCE_IRQ, | ||
438 | }, | ||
439 | }; | ||
440 | |||
441 | struct platform_device sa1100_device_rtc = { | ||
442 | .name = "sa1100-rtc", | ||
443 | .id = -1, | ||
444 | .num_resources = ARRAY_SIZE(sa1100_rtc_resources), | ||
445 | .resource = sa1100_rtc_resources, | ||
446 | }; | ||
447 | |||
430 | static struct resource pxa_ac97_resources[] = { | 448 | static struct resource pxa_ac97_resources[] = { |
431 | [0] = { | 449 | [0] = { |
432 | .start = 0x40500000, | 450 | .start = 0x40500000, |
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c index 208eef1c0485..8a1ef2734d58 100644 --- a/arch/arm/mach-pxa/hx4700.c +++ b/arch/arm/mach-pxa/hx4700.c | |||
@@ -28,7 +28,8 @@ | |||
28 | #include <linux/mtd/physmap.h> | 28 | #include <linux/mtd/physmap.h> |
29 | #include <linux/pda_power.h> | 29 | #include <linux/pda_power.h> |
30 | #include <linux/pwm_backlight.h> | 30 | #include <linux/pwm_backlight.h> |
31 | #include <linux/regulator/bq24022.h> | 31 | #include <linux/regulator/driver.h> |
32 | #include <linux/regulator/gpio-regulator.h> | ||
32 | #include <linux/regulator/machine.h> | 33 | #include <linux/regulator/machine.h> |
33 | #include <linux/regulator/max1586.h> | 34 | #include <linux/regulator/max1586.h> |
34 | #include <linux/spi/ads7846.h> | 35 | #include <linux/spi/ads7846.h> |
@@ -682,14 +683,34 @@ static struct regulator_init_data bq24022_init_data = { | |||
682 | .consumer_supplies = bq24022_consumers, | 683 | .consumer_supplies = bq24022_consumers, |
683 | }; | 684 | }; |
684 | 685 | ||
685 | static struct bq24022_mach_info bq24022_info = { | 686 | static struct gpio bq24022_gpios[] = { |
686 | .gpio_nce = GPIO72_HX4700_BQ24022_nCHARGE_EN, | 687 | { GPIO96_HX4700_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" }, |
687 | .gpio_iset2 = GPIO96_HX4700_BQ24022_ISET2, | 688 | }; |
688 | .init_data = &bq24022_init_data, | 689 | |
690 | static struct gpio_regulator_state bq24022_states[] = { | ||
691 | { .value = 100000, .gpios = (0 << 0) }, | ||
692 | { .value = 500000, .gpios = (1 << 0) }, | ||
693 | }; | ||
694 | |||
695 | static struct gpio_regulator_config bq24022_info = { | ||
696 | .supply_name = "bq24022", | ||
697 | |||
698 | .enable_gpio = GPIO72_HX4700_BQ24022_nCHARGE_EN, | ||
699 | .enable_high = 0, | ||
700 | .enabled_at_boot = 0, | ||
701 | |||
702 | .gpios = bq24022_gpios, | ||
703 | .nr_gpios = ARRAY_SIZE(bq24022_gpios), | ||
704 | |||
705 | .states = bq24022_states, | ||
706 | .nr_states = ARRAY_SIZE(bq24022_states), | ||
707 | |||
708 | .type = REGULATOR_CURRENT, | ||
709 | .init_data = &bq24022_init_data, | ||
689 | }; | 710 | }; |
690 | 711 | ||
691 | static struct platform_device bq24022 = { | 712 | static struct platform_device bq24022 = { |
692 | .name = "bq24022", | 713 | .name = "gpio-regulator", |
693 | .id = -1, | 714 | .id = -1, |
694 | .dev = { | 715 | .dev = { |
695 | .platform_data = &bq24022_info, | 716 | .platform_data = &bq24022_info, |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 3d6baf91396c..5e26f3e93fdd 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -25,7 +25,8 @@ | |||
25 | #include <linux/mtd/physmap.h> | 25 | #include <linux/mtd/physmap.h> |
26 | #include <linux/pda_power.h> | 26 | #include <linux/pda_power.h> |
27 | #include <linux/pwm_backlight.h> | 27 | #include <linux/pwm_backlight.h> |
28 | #include <linux/regulator/bq24022.h> | 28 | #include <linux/regulator/driver.h> |
29 | #include <linux/regulator/gpio-regulator.h> | ||
29 | #include <linux/regulator/machine.h> | 30 | #include <linux/regulator/machine.h> |
30 | #include <linux/usb/gpio_vbus.h> | 31 | #include <linux/usb/gpio_vbus.h> |
31 | #include <linux/i2c/pxa-i2c.h> | 32 | #include <linux/i2c/pxa-i2c.h> |
@@ -596,14 +597,34 @@ static struct regulator_init_data bq24022_init_data = { | |||
596 | .consumer_supplies = bq24022_consumers, | 597 | .consumer_supplies = bq24022_consumers, |
597 | }; | 598 | }; |
598 | 599 | ||
599 | static struct bq24022_mach_info bq24022_info = { | 600 | static struct gpio bq24022_gpios[] = { |
600 | .gpio_nce = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, | 601 | { EGPIO_MAGICIAN_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" }, |
601 | .gpio_iset2 = EGPIO_MAGICIAN_BQ24022_ISET2, | 602 | }; |
602 | .init_data = &bq24022_init_data, | 603 | |
604 | static struct gpio_regulator_state bq24022_states[] = { | ||
605 | { .value = 100000, .gpios = (0 << 0) }, | ||
606 | { .value = 500000, .gpios = (1 << 0) }, | ||
607 | }; | ||
608 | |||
609 | static struct gpio_regulator_config bq24022_info = { | ||
610 | .supply_name = "bq24022", | ||
611 | |||
612 | .enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, | ||
613 | .enable_high = 0, | ||
614 | .enabled_at_boot = 0, | ||
615 | |||
616 | .gpios = bq24022_gpios, | ||
617 | .nr_gpios = ARRAY_SIZE(bq24022_gpios), | ||
618 | |||
619 | .states = bq24022_states, | ||
620 | .nr_states = ARRAY_SIZE(bq24022_states), | ||
621 | |||
622 | .type = REGULATOR_CURRENT, | ||
623 | .init_data = &bq24022_init_data, | ||
603 | }; | 624 | }; |
604 | 625 | ||
605 | static struct platform_device bq24022 = { | 626 | static struct platform_device bq24022 = { |
606 | .name = "bq24022", | 627 | .name = "gpio-regulator", |
607 | .id = -1, | 628 | .id = -1, |
608 | .dev = { | 629 | .dev = { |
609 | .platform_data = &bq24022_info, | 630 | .platform_data = &bq24022_info, |
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index 00d6eacab8e4..e48033eb2be8 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c | |||
@@ -208,6 +208,7 @@ static struct clk_lookup pxa25x_clkregs[] = { | |||
208 | INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"), | 208 | INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"), |
209 | INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), | 209 | INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), |
210 | INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), | 210 | INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), |
211 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
211 | }; | 212 | }; |
212 | 213 | ||
213 | static struct clk_lookup pxa25x_hwuart_clkreg = | 214 | static struct clk_lookup pxa25x_hwuart_clkreg = |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index c1673b3441d4..a70b7e23fa44 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -229,6 +229,7 @@ static struct clk_lookup pxa27x_clkregs[] = { | |||
229 | INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"), | 229 | INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"), |
230 | INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"), | 230 | INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"), |
231 | INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL), | 231 | INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL), |
232 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
232 | }; | 233 | }; |
233 | 234 | ||
234 | #ifdef CONFIG_PM | 235 | #ifdef CONFIG_PM |
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 4f402afa6609..881934899bda 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -89,6 +89,7 @@ static struct clk_lookup pxa3xx_clkregs[] = { | |||
89 | INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), | 89 | INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), |
90 | INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), | 90 | INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), |
91 | INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL), | 91 | INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL), |
92 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
92 | }; | 93 | }; |
93 | 94 | ||
94 | #ifdef CONFIG_PM | 95 | #ifdef CONFIG_PM |
diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c index d082a583df78..35023d7d3cd4 100644 --- a/arch/arm/mach-pxa/pxa95x.c +++ b/arch/arm/mach-pxa/pxa95x.c | |||
@@ -231,6 +231,7 @@ static struct clk_lookup pxa95x_clkregs[] = { | |||
231 | INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL), | 231 | INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL), |
232 | INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL), | 232 | INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL), |
233 | INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL), | 233 | INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL), |
234 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
234 | }; | 235 | }; |
235 | 236 | ||
236 | void __init pxa95x_init_irq(void) | 237 | void __init pxa95x_init_irq(void) |
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c index 08bb0355159d..0e9a71c90ed7 100644 --- a/arch/arm/mach-s3c2416/s3c2416.c +++ b/arch/arm/mach-s3c2416/s3c2416.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <plat/fb-core.h> | 59 | #include <plat/fb-core.h> |
60 | #include <plat/nand-core.h> | 60 | #include <plat/nand-core.h> |
61 | #include <plat/adc-core.h> | 61 | #include <plat/adc-core.h> |
62 | #include <plat/rtc-core.h> | ||
62 | 63 | ||
63 | static struct map_desc s3c2416_iodesc[] __initdata = { | 64 | static struct map_desc s3c2416_iodesc[] __initdata = { |
64 | IODESC_ENT(WATCHDOG), | 65 | IODESC_ENT(WATCHDOG), |
@@ -98,6 +99,7 @@ int __init s3c2416_init(void) | |||
98 | s3c_fb_setname("s3c2443-fb"); | 99 | s3c_fb_setname("s3c2443-fb"); |
99 | 100 | ||
100 | s3c_adc_setname("s3c2416-adc"); | 101 | s3c_adc_setname("s3c2416-adc"); |
102 | s3c_rtc_setname("s3c2416-rtc"); | ||
101 | 103 | ||
102 | #ifdef CONFIG_PM | 104 | #ifdef CONFIG_PM |
103 | register_syscore_ops(&s3c2416_pm_syscore_ops); | 105 | register_syscore_ops(&s3c2416_pm_syscore_ops); |
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c index b9deaeb0dfff..b7778a9dafaf 100644 --- a/arch/arm/mach-s3c2443/s3c2443.c +++ b/arch/arm/mach-s3c2443/s3c2443.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <plat/fb-core.h> | 41 | #include <plat/fb-core.h> |
42 | #include <plat/nand-core.h> | 42 | #include <plat/nand-core.h> |
43 | #include <plat/adc-core.h> | 43 | #include <plat/adc-core.h> |
44 | #include <plat/rtc-core.h> | ||
44 | 45 | ||
45 | static struct map_desc s3c2443_iodesc[] __initdata = { | 46 | static struct map_desc s3c2443_iodesc[] __initdata = { |
46 | IODESC_ENT(WATCHDOG), | 47 | IODESC_ENT(WATCHDOG), |
@@ -73,6 +74,7 @@ int __init s3c2443_init(void) | |||
73 | s3c_fb_setname("s3c2443-fb"); | 74 | s3c_fb_setname("s3c2443-fb"); |
74 | 75 | ||
75 | s3c_adc_setname("s3c2443-adc"); | 76 | s3c_adc_setname("s3c2443-adc"); |
77 | s3c_rtc_setname("s3c2443-rtc"); | ||
76 | 78 | ||
77 | /* change WDT IRQ number */ | 79 | /* change WDT IRQ number */ |
78 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; | 80 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; |
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c index dab3c6347a8f..172ebd0ee0a2 100644 --- a/arch/arm/mach-sa1100/clock.c +++ b/arch/arm/mach-sa1100/clock.c | |||
@@ -11,17 +11,29 @@ | |||
11 | #include <linux/clk.h> | 11 | #include <linux/clk.h> |
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/mutex.h> | 13 | #include <linux/mutex.h> |
14 | #include <linux/io.h> | ||
15 | #include <linux/clkdev.h> | ||
14 | 16 | ||
15 | #include <mach/hardware.h> | 17 | #include <mach/hardware.h> |
16 | 18 | ||
17 | /* | 19 | struct clkops { |
18 | * Very simple clock implementation - we only have one clock to deal with. | 20 | void (*enable)(struct clk *); |
19 | */ | 21 | void (*disable)(struct clk *); |
22 | }; | ||
23 | |||
20 | struct clk { | 24 | struct clk { |
25 | const struct clkops *ops; | ||
21 | unsigned int enabled; | 26 | unsigned int enabled; |
22 | }; | 27 | }; |
23 | 28 | ||
24 | static void clk_gpio27_enable(void) | 29 | #define DEFINE_CLK(_name, _ops) \ |
30 | struct clk clk_##_name = { \ | ||
31 | .ops = _ops, \ | ||
32 | } | ||
33 | |||
34 | static DEFINE_SPINLOCK(clocks_lock); | ||
35 | |||
36 | static void clk_gpio27_enable(struct clk *clk) | ||
25 | { | 37 | { |
26 | /* | 38 | /* |
27 | * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: | 39 | * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: |
@@ -32,38 +44,24 @@ static void clk_gpio27_enable(void) | |||
32 | TUCR = TUCR_3_6864MHz; | 44 | TUCR = TUCR_3_6864MHz; |
33 | } | 45 | } |
34 | 46 | ||
35 | static void clk_gpio27_disable(void) | 47 | static void clk_gpio27_disable(struct clk *clk) |
36 | { | 48 | { |
37 | TUCR = 0; | 49 | TUCR = 0; |
38 | GPDR &= ~GPIO_32_768kHz; | 50 | GPDR &= ~GPIO_32_768kHz; |
39 | GAFR &= ~GPIO_32_768kHz; | 51 | GAFR &= ~GPIO_32_768kHz; |
40 | } | 52 | } |
41 | 53 | ||
42 | static struct clk clk_gpio27; | ||
43 | |||
44 | static DEFINE_SPINLOCK(clocks_lock); | ||
45 | |||
46 | struct clk *clk_get(struct device *dev, const char *id) | ||
47 | { | ||
48 | const char *devname = dev_name(dev); | ||
49 | |||
50 | return strcmp(devname, "sa1111.0") ? ERR_PTR(-ENOENT) : &clk_gpio27; | ||
51 | } | ||
52 | EXPORT_SYMBOL(clk_get); | ||
53 | |||
54 | void clk_put(struct clk *clk) | ||
55 | { | ||
56 | } | ||
57 | EXPORT_SYMBOL(clk_put); | ||
58 | |||
59 | int clk_enable(struct clk *clk) | 54 | int clk_enable(struct clk *clk) |
60 | { | 55 | { |
61 | unsigned long flags; | 56 | unsigned long flags; |
62 | 57 | ||
63 | spin_lock_irqsave(&clocks_lock, flags); | 58 | if (clk) { |
64 | if (clk->enabled++ == 0) | 59 | spin_lock_irqsave(&clocks_lock, flags); |
65 | clk_gpio27_enable(); | 60 | if (clk->enabled++ == 0) |
66 | spin_unlock_irqrestore(&clocks_lock, flags); | 61 | clk->ops->enable(clk); |
62 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
63 | } | ||
64 | |||
67 | return 0; | 65 | return 0; |
68 | } | 66 | } |
69 | EXPORT_SYMBOL(clk_enable); | 67 | EXPORT_SYMBOL(clk_enable); |
@@ -72,17 +70,31 @@ void clk_disable(struct clk *clk) | |||
72 | { | 70 | { |
73 | unsigned long flags; | 71 | unsigned long flags; |
74 | 72 | ||
75 | WARN_ON(clk->enabled == 0); | 73 | if (clk) { |
76 | 74 | WARN_ON(clk->enabled == 0); | |
77 | spin_lock_irqsave(&clocks_lock, flags); | 75 | spin_lock_irqsave(&clocks_lock, flags); |
78 | if (--clk->enabled == 0) | 76 | if (--clk->enabled == 0) |
79 | clk_gpio27_disable(); | 77 | clk->ops->disable(clk); |
80 | spin_unlock_irqrestore(&clocks_lock, flags); | 78 | spin_unlock_irqrestore(&clocks_lock, flags); |
79 | } | ||
81 | } | 80 | } |
82 | EXPORT_SYMBOL(clk_disable); | 81 | EXPORT_SYMBOL(clk_disable); |
83 | 82 | ||
84 | unsigned long clk_get_rate(struct clk *clk) | 83 | const struct clkops clk_gpio27_ops = { |
84 | .enable = clk_gpio27_enable, | ||
85 | .disable = clk_gpio27_disable, | ||
86 | }; | ||
87 | |||
88 | static DEFINE_CLK(gpio27, &clk_gpio27_ops); | ||
89 | |||
90 | static struct clk_lookup sa11xx_clkregs[] = { | ||
91 | CLKDEV_INIT("sa1111.0", NULL, &clk_gpio27), | ||
92 | CLKDEV_INIT("sa1100-rtc", NULL, NULL), | ||
93 | }; | ||
94 | |||
95 | static int __init sa11xx_clk_init(void) | ||
85 | { | 96 | { |
86 | return 3686400; | 97 | clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs)); |
98 | return 0; | ||
87 | } | 99 | } |
88 | EXPORT_SYMBOL(clk_get_rate); | 100 | core_initcall(sa11xx_clk_init); |
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index bb10ee2cb89f..7c1ebf4a7920 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
@@ -345,9 +345,17 @@ void sa11x0_register_irda(struct irda_platform_data *irda) | |||
345 | sa11x0_register_device(&sa11x0ir_device, irda); | 345 | sa11x0_register_device(&sa11x0ir_device, irda); |
346 | } | 346 | } |
347 | 347 | ||
348 | static struct resource sa1100_rtc_resources[] = { | ||
349 | DEFINE_RES_MEM(0x90010000, 0x9001003f), | ||
350 | DEFINE_RES_IRQ_NAMED(IRQ_RTC1Hz, "rtc 1Hz"), | ||
351 | DEFINE_RES_IRQ_NAMED(IRQ_RTCAlrm, "rtc alarm"), | ||
352 | }; | ||
353 | |||
348 | static struct platform_device sa11x0rtc_device = { | 354 | static struct platform_device sa11x0rtc_device = { |
349 | .name = "sa1100-rtc", | 355 | .name = "sa1100-rtc", |
350 | .id = -1, | 356 | .id = -1, |
357 | .num_resources = ARRAY_SIZE(sa1100_rtc_resources), | ||
358 | .resource = sa1100_rtc_resources, | ||
351 | }; | 359 | }; |
352 | 360 | ||
353 | static struct platform_device *sa11x0_devices[] __initdata = { | 361 | static struct platform_device *sa11x0_devices[] __initdata = { |
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index e120ff54f663..e0b7a4d32599 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -7,6 +7,7 @@ obj-y += clock.o | |||
7 | obj-y += timer.o | 7 | obj-y += timer.o |
8 | obj-y += pinmux.o | 8 | obj-y += pinmux.o |
9 | obj-y += fuse.o | 9 | obj-y += fuse.o |
10 | obj-y += pmc.o | ||
10 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o | 11 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o |
11 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o | 12 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o |
12 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o | 13 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o |
@@ -15,7 +16,7 @@ obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pinmux-tegra30-tables.o | |||
15 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o | 16 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o |
16 | obj-$(CONFIG_SMP) += platsmp.o localtimer.o headsmp.o | 17 | obj-$(CONFIG_SMP) += platsmp.o localtimer.o headsmp.o |
17 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 18 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
18 | obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o | 19 | obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o apbio.o |
19 | obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o | 20 | obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o |
20 | obj-$(CONFIG_TEGRA_PCI) += pcie.o | 21 | obj-$(CONFIG_TEGRA_PCI) += pcie.o |
21 | obj-$(CONFIG_USB_SUPPORT) += usb_phy.o | 22 | obj-$(CONFIG_USB_SUPPORT) += usb_phy.o |
diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c new file mode 100644 index 000000000000..e75451e517bd --- /dev/null +++ b/arch/arm/mach-tegra/apbio.c | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 NVIDIA Corporation. | ||
3 | * Copyright (C) 2010 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
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 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/dma-mapping.h> | ||
19 | #include <linux/spinlock.h> | ||
20 | #include <linux/completion.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/mutex.h> | ||
23 | |||
24 | #include <mach/dma.h> | ||
25 | #include <mach/iomap.h> | ||
26 | |||
27 | #include "apbio.h" | ||
28 | |||
29 | static DEFINE_MUTEX(tegra_apb_dma_lock); | ||
30 | |||
31 | static struct tegra_dma_channel *tegra_apb_dma; | ||
32 | static u32 *tegra_apb_bb; | ||
33 | static dma_addr_t tegra_apb_bb_phys; | ||
34 | static DECLARE_COMPLETION(tegra_apb_wait); | ||
35 | |||
36 | bool tegra_apb_init(void) | ||
37 | { | ||
38 | struct tegra_dma_channel *ch; | ||
39 | |||
40 | mutex_lock(&tegra_apb_dma_lock); | ||
41 | |||
42 | /* Check to see if we raced to setup */ | ||
43 | if (tegra_apb_dma) | ||
44 | goto out; | ||
45 | |||
46 | ch = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT | | ||
47 | TEGRA_DMA_SHARED); | ||
48 | |||
49 | if (!ch) | ||
50 | goto out_fail; | ||
51 | |||
52 | tegra_apb_bb = dma_alloc_coherent(NULL, sizeof(u32), | ||
53 | &tegra_apb_bb_phys, GFP_KERNEL); | ||
54 | if (!tegra_apb_bb) { | ||
55 | pr_err("%s: can not allocate bounce buffer\n", __func__); | ||
56 | tegra_dma_free_channel(ch); | ||
57 | goto out_fail; | ||
58 | } | ||
59 | |||
60 | tegra_apb_dma = ch; | ||
61 | out: | ||
62 | mutex_unlock(&tegra_apb_dma_lock); | ||
63 | return true; | ||
64 | |||
65 | out_fail: | ||
66 | mutex_unlock(&tegra_apb_dma_lock); | ||
67 | return false; | ||
68 | } | ||
69 | |||
70 | static void apb_dma_complete(struct tegra_dma_req *req) | ||
71 | { | ||
72 | complete(&tegra_apb_wait); | ||
73 | } | ||
74 | |||
75 | u32 tegra_apb_readl(unsigned long offset) | ||
76 | { | ||
77 | struct tegra_dma_req req; | ||
78 | int ret; | ||
79 | |||
80 | if (!tegra_apb_dma && !tegra_apb_init()) | ||
81 | return readl(IO_TO_VIRT(offset)); | ||
82 | |||
83 | mutex_lock(&tegra_apb_dma_lock); | ||
84 | req.complete = apb_dma_complete; | ||
85 | req.to_memory = 1; | ||
86 | req.dest_addr = tegra_apb_bb_phys; | ||
87 | req.dest_bus_width = 32; | ||
88 | req.dest_wrap = 1; | ||
89 | req.source_addr = offset; | ||
90 | req.source_bus_width = 32; | ||
91 | req.source_wrap = 4; | ||
92 | req.req_sel = TEGRA_DMA_REQ_SEL_CNTR; | ||
93 | req.size = 4; | ||
94 | |||
95 | INIT_COMPLETION(tegra_apb_wait); | ||
96 | |||
97 | tegra_dma_enqueue_req(tegra_apb_dma, &req); | ||
98 | |||
99 | ret = wait_for_completion_timeout(&tegra_apb_wait, | ||
100 | msecs_to_jiffies(50)); | ||
101 | |||
102 | if (WARN(ret == 0, "apb read dma timed out")) { | ||
103 | tegra_dma_dequeue_req(tegra_apb_dma, &req); | ||
104 | *(u32 *)tegra_apb_bb = 0; | ||
105 | } | ||
106 | |||
107 | mutex_unlock(&tegra_apb_dma_lock); | ||
108 | return *((u32 *)tegra_apb_bb); | ||
109 | } | ||
110 | |||
111 | void tegra_apb_writel(u32 value, unsigned long offset) | ||
112 | { | ||
113 | struct tegra_dma_req req; | ||
114 | int ret; | ||
115 | |||
116 | if (!tegra_apb_dma && !tegra_apb_init()) { | ||
117 | writel(value, IO_TO_VIRT(offset)); | ||
118 | return; | ||
119 | } | ||
120 | |||
121 | mutex_lock(&tegra_apb_dma_lock); | ||
122 | *((u32 *)tegra_apb_bb) = value; | ||
123 | req.complete = apb_dma_complete; | ||
124 | req.to_memory = 0; | ||
125 | req.dest_addr = offset; | ||
126 | req.dest_wrap = 4; | ||
127 | req.dest_bus_width = 32; | ||
128 | req.source_addr = tegra_apb_bb_phys; | ||
129 | req.source_bus_width = 32; | ||
130 | req.source_wrap = 1; | ||
131 | req.req_sel = TEGRA_DMA_REQ_SEL_CNTR; | ||
132 | req.size = 4; | ||
133 | |||
134 | INIT_COMPLETION(tegra_apb_wait); | ||
135 | |||
136 | tegra_dma_enqueue_req(tegra_apb_dma, &req); | ||
137 | |||
138 | ret = wait_for_completion_timeout(&tegra_apb_wait, | ||
139 | msecs_to_jiffies(50)); | ||
140 | |||
141 | if (WARN(ret == 0, "apb write dma timed out")) | ||
142 | tegra_dma_dequeue_req(tegra_apb_dma, &req); | ||
143 | |||
144 | mutex_unlock(&tegra_apb_dma_lock); | ||
145 | } | ||
diff --git a/arch/arm/mach-tegra/apbio.h b/arch/arm/mach-tegra/apbio.h new file mode 100644 index 000000000000..8b49e8c89a64 --- /dev/null +++ b/arch/arm/mach-tegra/apbio.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 NVIDIA Corporation. | ||
3 | * Copyright (C) 2010 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
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 | */ | ||
15 | |||
16 | #ifndef __MACH_TEGRA_APBIO_H | ||
17 | #define __MACH_TEGRA_APBIO_H | ||
18 | |||
19 | #ifdef CONFIG_TEGRA_SYSTEM_DMA | ||
20 | |||
21 | u32 tegra_apb_readl(unsigned long offset); | ||
22 | void tegra_apb_writel(u32 value, unsigned long offset); | ||
23 | |||
24 | #else | ||
25 | #include <asm/io.h> | ||
26 | #include <mach/io.h> | ||
27 | |||
28 | static inline u32 tegra_apb_readl(unsigned long offset) | ||
29 | { | ||
30 | return readl(IO_TO_VIRT(offset)); | ||
31 | } | ||
32 | |||
33 | static inline void tegra_apb_writel(u32 value, unsigned long offset) | ||
34 | { | ||
35 | writel(value, IO_TO_VIRT(offset)); | ||
36 | } | ||
37 | #endif | ||
38 | |||
39 | #endif | ||
diff --git a/arch/arm/mach-tegra/board-harmony-power.c b/arch/arm/mach-tegra/board-harmony-power.c index 21d1285731b3..976edfb05912 100644 --- a/arch/arm/mach-tegra/board-harmony-power.c +++ b/arch/arm/mach-tegra/board-harmony-power.c | |||
@@ -18,18 +18,13 @@ | |||
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/io.h> | ||
22 | #include <linux/regulator/machine.h> | 21 | #include <linux/regulator/machine.h> |
23 | #include <linux/mfd/tps6586x.h> | 22 | #include <linux/mfd/tps6586x.h> |
24 | 23 | ||
25 | #include <mach/iomap.h> | ||
26 | #include <mach/irqs.h> | 24 | #include <mach/irqs.h> |
27 | 25 | ||
28 | #include "board-harmony.h" | 26 | #include "board-harmony.h" |
29 | 27 | ||
30 | #define PMC_CTRL 0x0 | ||
31 | #define PMC_CTRL_INTR_LOW (1 << 17) | ||
32 | |||
33 | static struct regulator_consumer_supply tps658621_ldo0_supply[] = { | 28 | static struct regulator_consumer_supply tps658621_ldo0_supply[] = { |
34 | REGULATOR_SUPPLY("pex_clk", NULL), | 29 | REGULATOR_SUPPLY("pex_clk", NULL), |
35 | }; | 30 | }; |
@@ -114,16 +109,6 @@ static struct i2c_board_info __initdata harmony_regulators[] = { | |||
114 | 109 | ||
115 | int __init harmony_regulator_init(void) | 110 | int __init harmony_regulator_init(void) |
116 | { | 111 | { |
117 | void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); | ||
118 | u32 pmc_ctrl; | ||
119 | |||
120 | /* | ||
121 | * Configure the power management controller to trigger PMU | ||
122 | * interrupts when low | ||
123 | */ | ||
124 | pmc_ctrl = readl(pmc + PMC_CTRL); | ||
125 | writel(pmc_ctrl | PMC_CTRL_INTR_LOW, pmc + PMC_CTRL); | ||
126 | |||
127 | i2c_register_board_info(3, harmony_regulators, 1); | 112 | i2c_register_board_info(3, harmony_regulators, 1); |
128 | 113 | ||
129 | return 0; | 114 | return 0; |
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c index 789bdc9e8f91..c00aadb01e09 100644 --- a/arch/arm/mach-tegra/board-harmony.c +++ b/arch/arm/mach-tegra/board-harmony.c | |||
@@ -101,7 +101,6 @@ static struct wm8903_platform_data harmony_wm8903_pdata = { | |||
101 | static struct i2c_board_info __initdata wm8903_board_info = { | 101 | static struct i2c_board_info __initdata wm8903_board_info = { |
102 | I2C_BOARD_INFO("wm8903", 0x1a), | 102 | I2C_BOARD_INFO("wm8903", 0x1a), |
103 | .platform_data = &harmony_wm8903_pdata, | 103 | .platform_data = &harmony_wm8903_pdata, |
104 | .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), | ||
105 | }; | 104 | }; |
106 | 105 | ||
107 | static void __init harmony_i2c_init(void) | 106 | static void __init harmony_i2c_init(void) |
@@ -111,6 +110,7 @@ static void __init harmony_i2c_init(void) | |||
111 | platform_device_register(&tegra_i2c_device3); | 110 | platform_device_register(&tegra_i2c_device3); |
112 | platform_device_register(&tegra_i2c_device4); | 111 | platform_device_register(&tegra_i2c_device4); |
113 | 112 | ||
113 | wm8903_board_info.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ); | ||
114 | i2c_register_board_info(0, &wm8903_board_info, 1); | 114 | i2c_register_board_info(0, &wm8903_board_info, 1); |
115 | } | 115 | } |
116 | 116 | ||
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c index ebac65f52510..d669847f0485 100644 --- a/arch/arm/mach-tegra/board-seaboard.c +++ b/arch/arm/mach-tegra/board-seaboard.c | |||
@@ -159,7 +159,6 @@ static struct platform_device *seaboard_devices[] __initdata = { | |||
159 | 159 | ||
160 | static struct i2c_board_info __initdata isl29018_device = { | 160 | static struct i2c_board_info __initdata isl29018_device = { |
161 | I2C_BOARD_INFO("isl29018", 0x44), | 161 | I2C_BOARD_INFO("isl29018", 0x44), |
162 | .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_ISL29018_IRQ), | ||
163 | }; | 162 | }; |
164 | 163 | ||
165 | static struct i2c_board_info __initdata adt7461_device = { | 164 | static struct i2c_board_info __initdata adt7461_device = { |
@@ -183,7 +182,6 @@ static struct wm8903_platform_data wm8903_pdata = { | |||
183 | static struct i2c_board_info __initdata wm8903_device = { | 182 | static struct i2c_board_info __initdata wm8903_device = { |
184 | I2C_BOARD_INFO("wm8903", 0x1a), | 183 | I2C_BOARD_INFO("wm8903", 0x1a), |
185 | .platform_data = &wm8903_pdata, | 184 | .platform_data = &wm8903_pdata, |
186 | .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), | ||
187 | }; | 185 | }; |
188 | 186 | ||
189 | static int seaboard_ehci_init(void) | 187 | static int seaboard_ehci_init(void) |
@@ -214,7 +212,10 @@ static void __init seaboard_i2c_init(void) | |||
214 | gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018"); | 212 | gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018"); |
215 | gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ); | 213 | gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ); |
216 | 214 | ||
215 | isl29018_device.irq = gpio_to_irq(TEGRA_GPIO_ISL29018_IRQ); | ||
217 | i2c_register_board_info(0, &isl29018_device, 1); | 216 | i2c_register_board_info(0, &isl29018_device, 1); |
217 | |||
218 | wm8903_device.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ); | ||
218 | i2c_register_board_info(0, &wm8903_device, 1); | 219 | i2c_register_board_info(0, &wm8903_device, 1); |
219 | 220 | ||
220 | i2c_register_board_info(3, &adt7461_device, 1); | 221 | i2c_register_board_info(3, &adt7461_device, 1); |
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 2db20da1d585..47ad750209ae 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c | |||
@@ -31,6 +31,24 @@ | |||
31 | #include "board.h" | 31 | #include "board.h" |
32 | #include "clock.h" | 32 | #include "clock.h" |
33 | #include "fuse.h" | 33 | #include "fuse.h" |
34 | #include "pmc.h" | ||
35 | |||
36 | /* | ||
37 | * Storage for debug-macro.S's state. | ||
38 | * | ||
39 | * This must be in .data not .bss so that it gets initialized each time the | ||
40 | * kernel is loaded. The data is declared here rather than debug-macro.S so | ||
41 | * that multiple inclusions of debug-macro.S point at the same data. | ||
42 | */ | ||
43 | #define TEGRA_DEBUG_UART_OFFSET (TEGRA_DEBUG_UART_BASE & 0xFFFF) | ||
44 | u32 tegra_uart_config[3] = { | ||
45 | /* Debug UART initialization required */ | ||
46 | 1, | ||
47 | /* Debug UART physical address */ | ||
48 | (u32)(IO_APB_PHYS + TEGRA_DEBUG_UART_OFFSET), | ||
49 | /* Debug UART virtual address */ | ||
50 | (u32)(IO_APB_VIRT + TEGRA_DEBUG_UART_OFFSET), | ||
51 | }; | ||
34 | 52 | ||
35 | #ifdef CONFIG_OF | 53 | #ifdef CONFIG_OF |
36 | static const struct of_device_id tegra_dt_irq_match[] __initconst = { | 54 | static const struct of_device_id tegra_dt_irq_match[] __initconst = { |
@@ -101,11 +119,13 @@ void __init tegra20_init_early(void) | |||
101 | tegra2_init_clocks(); | 119 | tegra2_init_clocks(); |
102 | tegra_clk_init_from_table(tegra20_clk_init_table); | 120 | tegra_clk_init_from_table(tegra20_clk_init_table); |
103 | tegra_init_cache(0x331, 0x441); | 121 | tegra_init_cache(0x331, 0x441); |
122 | tegra_pmc_init(); | ||
104 | } | 123 | } |
105 | #endif | 124 | #endif |
106 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | 125 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC |
107 | void __init tegra30_init_early(void) | 126 | void __init tegra30_init_early(void) |
108 | { | 127 | { |
109 | tegra_init_cache(0x441, 0x551); | 128 | tegra_init_cache(0x441, 0x551); |
129 | tegra_pmc_init(); | ||
110 | } | 130 | } |
111 | #endif | 131 | #endif |
diff --git a/arch/arm/mach-tegra/dma.c b/arch/arm/mach-tegra/dma.c index c0cf967e47d3..abea4f6e2dd5 100644 --- a/arch/arm/mach-tegra/dma.c +++ b/arch/arm/mach-tegra/dma.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include <mach/iomap.h> | 33 | #include <mach/iomap.h> |
34 | #include <mach/suspend.h> | 34 | #include <mach/suspend.h> |
35 | 35 | ||
36 | #include "apbio.h" | ||
37 | |||
36 | #define APB_DMA_GEN 0x000 | 38 | #define APB_DMA_GEN 0x000 |
37 | #define GEN_ENABLE (1<<31) | 39 | #define GEN_ENABLE (1<<31) |
38 | 40 | ||
@@ -50,8 +52,6 @@ | |||
50 | #define CSR_ONCE (1<<27) | 52 | #define CSR_ONCE (1<<27) |
51 | #define CSR_FLOW (1<<21) | 53 | #define CSR_FLOW (1<<21) |
52 | #define CSR_REQ_SEL_SHIFT 16 | 54 | #define CSR_REQ_SEL_SHIFT 16 |
53 | #define CSR_REQ_SEL_MASK (0x1F<<CSR_REQ_SEL_SHIFT) | ||
54 | #define CSR_REQ_SEL_INVALID (31<<CSR_REQ_SEL_SHIFT) | ||
55 | #define CSR_WCOUNT_SHIFT 2 | 55 | #define CSR_WCOUNT_SHIFT 2 |
56 | #define CSR_WCOUNT_MASK 0xFFFC | 56 | #define CSR_WCOUNT_MASK 0xFFFC |
57 | 57 | ||
@@ -133,6 +133,7 @@ struct tegra_dma_channel { | |||
133 | 133 | ||
134 | static bool tegra_dma_initialized; | 134 | static bool tegra_dma_initialized; |
135 | static DEFINE_MUTEX(tegra_dma_lock); | 135 | static DEFINE_MUTEX(tegra_dma_lock); |
136 | static DEFINE_SPINLOCK(enable_lock); | ||
136 | 137 | ||
137 | static DECLARE_BITMAP(channel_usage, NV_DMA_MAX_CHANNELS); | 138 | static DECLARE_BITMAP(channel_usage, NV_DMA_MAX_CHANNELS); |
138 | static struct tegra_dma_channel dma_channels[NV_DMA_MAX_CHANNELS]; | 139 | static struct tegra_dma_channel dma_channels[NV_DMA_MAX_CHANNELS]; |
@@ -180,36 +181,94 @@ static void tegra_dma_stop(struct tegra_dma_channel *ch) | |||
180 | 181 | ||
181 | static int tegra_dma_cancel(struct tegra_dma_channel *ch) | 182 | static int tegra_dma_cancel(struct tegra_dma_channel *ch) |
182 | { | 183 | { |
183 | u32 csr; | ||
184 | unsigned long irq_flags; | 184 | unsigned long irq_flags; |
185 | 185 | ||
186 | spin_lock_irqsave(&ch->lock, irq_flags); | 186 | spin_lock_irqsave(&ch->lock, irq_flags); |
187 | while (!list_empty(&ch->list)) | 187 | while (!list_empty(&ch->list)) |
188 | list_del(ch->list.next); | 188 | list_del(ch->list.next); |
189 | 189 | ||
190 | csr = readl(ch->addr + APB_DMA_CHAN_CSR); | ||
191 | csr &= ~CSR_REQ_SEL_MASK; | ||
192 | csr |= CSR_REQ_SEL_INVALID; | ||
193 | writel(csr, ch->addr + APB_DMA_CHAN_CSR); | ||
194 | |||
195 | tegra_dma_stop(ch); | 190 | tegra_dma_stop(ch); |
196 | 191 | ||
197 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 192 | spin_unlock_irqrestore(&ch->lock, irq_flags); |
198 | return 0; | 193 | return 0; |
199 | } | 194 | } |
200 | 195 | ||
196 | static unsigned int get_channel_status(struct tegra_dma_channel *ch, | ||
197 | struct tegra_dma_req *req, bool is_stop_dma) | ||
198 | { | ||
199 | void __iomem *addr = IO_ADDRESS(TEGRA_APB_DMA_BASE); | ||
200 | unsigned int status; | ||
201 | |||
202 | if (is_stop_dma) { | ||
203 | /* | ||
204 | * STOP the DMA and get the transfer count. | ||
205 | * Getting the transfer count is tricky. | ||
206 | * - Globally disable DMA on all channels | ||
207 | * - Read the channel's status register to know the number | ||
208 | * of pending bytes to be transfered. | ||
209 | * - Stop the dma channel | ||
210 | * - Globally re-enable DMA to resume other transfers | ||
211 | */ | ||
212 | spin_lock(&enable_lock); | ||
213 | writel(0, addr + APB_DMA_GEN); | ||
214 | udelay(20); | ||
215 | status = readl(ch->addr + APB_DMA_CHAN_STA); | ||
216 | tegra_dma_stop(ch); | ||
217 | writel(GEN_ENABLE, addr + APB_DMA_GEN); | ||
218 | spin_unlock(&enable_lock); | ||
219 | if (status & STA_ISE_EOC) { | ||
220 | pr_err("Got Dma Int here clearing"); | ||
221 | writel(status, ch->addr + APB_DMA_CHAN_STA); | ||
222 | } | ||
223 | req->status = TEGRA_DMA_REQ_ERROR_ABORTED; | ||
224 | } else { | ||
225 | status = readl(ch->addr + APB_DMA_CHAN_STA); | ||
226 | } | ||
227 | return status; | ||
228 | } | ||
229 | |||
230 | /* should be called with the channel lock held */ | ||
231 | static unsigned int dma_active_count(struct tegra_dma_channel *ch, | ||
232 | struct tegra_dma_req *req, unsigned int status) | ||
233 | { | ||
234 | unsigned int to_transfer; | ||
235 | unsigned int req_transfer_count; | ||
236 | unsigned int bytes_transferred; | ||
237 | |||
238 | to_transfer = ((status & STA_COUNT_MASK) >> STA_COUNT_SHIFT) + 1; | ||
239 | req_transfer_count = ch->req_transfer_count + 1; | ||
240 | bytes_transferred = req_transfer_count; | ||
241 | if (status & STA_BUSY) | ||
242 | bytes_transferred -= to_transfer; | ||
243 | /* | ||
244 | * In continuous transfer mode, DMA only tracks the count of the | ||
245 | * half DMA buffer. So, if the DMA already finished half the DMA | ||
246 | * then add the half buffer to the completed count. | ||
247 | */ | ||
248 | if (ch->mode & TEGRA_DMA_MODE_CONTINOUS) { | ||
249 | if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL) | ||
250 | bytes_transferred += req_transfer_count; | ||
251 | if (status & STA_ISE_EOC) | ||
252 | bytes_transferred += req_transfer_count; | ||
253 | } | ||
254 | bytes_transferred *= 4; | ||
255 | return bytes_transferred; | ||
256 | } | ||
257 | |||
201 | int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, | 258 | int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, |
202 | struct tegra_dma_req *_req) | 259 | struct tegra_dma_req *_req) |
203 | { | 260 | { |
204 | unsigned int csr; | ||
205 | unsigned int status; | 261 | unsigned int status; |
206 | struct tegra_dma_req *req = NULL; | 262 | struct tegra_dma_req *req = NULL; |
207 | int found = 0; | 263 | int found = 0; |
208 | unsigned long irq_flags; | 264 | unsigned long irq_flags; |
209 | int to_transfer; | 265 | int stop = 0; |
210 | int req_transfer_count; | ||
211 | 266 | ||
212 | spin_lock_irqsave(&ch->lock, irq_flags); | 267 | spin_lock_irqsave(&ch->lock, irq_flags); |
268 | |||
269 | if (list_entry(ch->list.next, struct tegra_dma_req, node) == _req) | ||
270 | stop = 1; | ||
271 | |||
213 | list_for_each_entry(req, &ch->list, node) { | 272 | list_for_each_entry(req, &ch->list, node) { |
214 | if (req == _req) { | 273 | if (req == _req) { |
215 | list_del(&req->node); | 274 | list_del(&req->node); |
@@ -222,47 +281,12 @@ int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, | |||
222 | return 0; | 281 | return 0; |
223 | } | 282 | } |
224 | 283 | ||
225 | /* STOP the DMA and get the transfer count. | 284 | if (!stop) |
226 | * Getting the transfer count is tricky. | 285 | goto skip_stop_dma; |
227 | * - Change the source selector to invalid to stop the DMA from | ||
228 | * FIFO to memory. | ||
229 | * - Read the status register to know the number of pending | ||
230 | * bytes to be transferred. | ||
231 | * - Finally stop or program the DMA to the next buffer in the | ||
232 | * list. | ||
233 | */ | ||
234 | csr = readl(ch->addr + APB_DMA_CHAN_CSR); | ||
235 | csr &= ~CSR_REQ_SEL_MASK; | ||
236 | csr |= CSR_REQ_SEL_INVALID; | ||
237 | writel(csr, ch->addr + APB_DMA_CHAN_CSR); | ||
238 | |||
239 | /* Get the transfer count */ | ||
240 | status = readl(ch->addr + APB_DMA_CHAN_STA); | ||
241 | to_transfer = (status & STA_COUNT_MASK) >> STA_COUNT_SHIFT; | ||
242 | req_transfer_count = ch->req_transfer_count; | ||
243 | req_transfer_count += 1; | ||
244 | to_transfer += 1; | ||
245 | |||
246 | req->bytes_transferred = req_transfer_count; | ||
247 | |||
248 | if (status & STA_BUSY) | ||
249 | req->bytes_transferred -= to_transfer; | ||
250 | |||
251 | /* In continuous transfer mode, DMA only tracks the count of the | ||
252 | * half DMA buffer. So, if the DMA already finished half the DMA | ||
253 | * then add the half buffer to the completed count. | ||
254 | * | ||
255 | * FIXME: There can be a race here. What if the req to | ||
256 | * dequue happens at the same time as the DMA just moved to | ||
257 | * the new buffer and SW didn't yet received the interrupt? | ||
258 | */ | ||
259 | if (ch->mode & TEGRA_DMA_MODE_CONTINOUS) | ||
260 | if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL) | ||
261 | req->bytes_transferred += req_transfer_count; | ||
262 | 286 | ||
263 | req->bytes_transferred *= 4; | 287 | status = get_channel_status(ch, req, true); |
288 | req->bytes_transferred = dma_active_count(ch, req, status); | ||
264 | 289 | ||
265 | tegra_dma_stop(ch); | ||
266 | if (!list_empty(&ch->list)) { | 290 | if (!list_empty(&ch->list)) { |
267 | /* if the list is not empty, queue the next request */ | 291 | /* if the list is not empty, queue the next request */ |
268 | struct tegra_dma_req *next_req; | 292 | struct tegra_dma_req *next_req; |
@@ -270,6 +294,8 @@ int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, | |||
270 | typeof(*next_req), node); | 294 | typeof(*next_req), node); |
271 | tegra_dma_update_hw(ch, next_req); | 295 | tegra_dma_update_hw(ch, next_req); |
272 | } | 296 | } |
297 | |||
298 | skip_stop_dma: | ||
273 | req->status = -TEGRA_DMA_REQ_ERROR_ABORTED; | 299 | req->status = -TEGRA_DMA_REQ_ERROR_ABORTED; |
274 | 300 | ||
275 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 301 | spin_unlock_irqrestore(&ch->lock, irq_flags); |
@@ -357,7 +383,7 @@ struct tegra_dma_channel *tegra_dma_allocate_channel(int mode) | |||
357 | int channel; | 383 | int channel; |
358 | struct tegra_dma_channel *ch = NULL; | 384 | struct tegra_dma_channel *ch = NULL; |
359 | 385 | ||
360 | if (WARN_ON(!tegra_dma_initialized)) | 386 | if (!tegra_dma_initialized) |
361 | return NULL; | 387 | return NULL; |
362 | 388 | ||
363 | mutex_lock(&tegra_dma_lock); | 389 | mutex_lock(&tegra_dma_lock); |
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c index 1fa26d9a1a68..17fdd4086e6f 100644 --- a/arch/arm/mach-tegra/fuse.c +++ b/arch/arm/mach-tegra/fuse.c | |||
@@ -23,20 +23,70 @@ | |||
23 | #include <mach/iomap.h> | 23 | #include <mach/iomap.h> |
24 | 24 | ||
25 | #include "fuse.h" | 25 | #include "fuse.h" |
26 | #include "apbio.h" | ||
26 | 27 | ||
27 | #define FUSE_UID_LOW 0x108 | 28 | #define FUSE_UID_LOW 0x108 |
28 | #define FUSE_UID_HIGH 0x10c | 29 | #define FUSE_UID_HIGH 0x10c |
29 | #define FUSE_SKU_INFO 0x110 | 30 | #define FUSE_SKU_INFO 0x110 |
30 | #define FUSE_SPARE_BIT 0x200 | 31 | #define FUSE_SPARE_BIT 0x200 |
31 | 32 | ||
32 | static inline u32 fuse_readl(unsigned long offset) | 33 | int tegra_sku_id; |
34 | int tegra_cpu_process_id; | ||
35 | int tegra_core_process_id; | ||
36 | enum tegra_revision tegra_revision; | ||
37 | |||
38 | /* The BCT to use at boot is specified by board straps that can be read | ||
39 | * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs. | ||
40 | */ | ||
41 | int tegra_bct_strapping; | ||
42 | |||
43 | #define STRAP_OPT 0x008 | ||
44 | #define GMI_AD0 (1 << 4) | ||
45 | #define GMI_AD1 (1 << 5) | ||
46 | #define RAM_ID_MASK (GMI_AD0 | GMI_AD1) | ||
47 | #define RAM_CODE_SHIFT 4 | ||
48 | |||
49 | static const char *tegra_revision_name[TEGRA_REVISION_MAX] = { | ||
50 | [TEGRA_REVISION_UNKNOWN] = "unknown", | ||
51 | [TEGRA_REVISION_A01] = "A01", | ||
52 | [TEGRA_REVISION_A02] = "A02", | ||
53 | [TEGRA_REVISION_A03] = "A03", | ||
54 | [TEGRA_REVISION_A03p] = "A03 prime", | ||
55 | [TEGRA_REVISION_A04] = "A04", | ||
56 | }; | ||
57 | |||
58 | static inline u32 tegra_fuse_readl(unsigned long offset) | ||
59 | { | ||
60 | return tegra_apb_readl(TEGRA_FUSE_BASE + offset); | ||
61 | } | ||
62 | |||
63 | static inline bool get_spare_fuse(int bit) | ||
33 | { | 64 | { |
34 | return readl(IO_TO_VIRT(TEGRA_FUSE_BASE + offset)); | 65 | return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4); |
35 | } | 66 | } |
36 | 67 | ||
37 | static inline void fuse_writel(u32 value, unsigned long offset) | 68 | static enum tegra_revision tegra_get_revision(void) |
38 | { | 69 | { |
39 | writel(value, IO_TO_VIRT(TEGRA_FUSE_BASE + offset)); | 70 | void __iomem *chip_id = IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804; |
71 | u32 id = readl(chip_id); | ||
72 | u32 minor_rev = (id >> 16) & 0xf; | ||
73 | u32 chipid = (id >> 8) & 0xff; | ||
74 | |||
75 | switch (minor_rev) { | ||
76 | case 1: | ||
77 | return TEGRA_REVISION_A01; | ||
78 | case 2: | ||
79 | return TEGRA_REVISION_A02; | ||
80 | case 3: | ||
81 | if (chipid == 0x20 && (get_spare_fuse(18) || get_spare_fuse(19))) | ||
82 | return TEGRA_REVISION_A03p; | ||
83 | else | ||
84 | return TEGRA_REVISION_A03; | ||
85 | case 4: | ||
86 | return TEGRA_REVISION_A04; | ||
87 | default: | ||
88 | return TEGRA_REVISION_UNKNOWN; | ||
89 | } | ||
40 | } | 90 | } |
41 | 91 | ||
42 | void tegra_init_fuse(void) | 92 | void tegra_init_fuse(void) |
@@ -45,40 +95,31 @@ void tegra_init_fuse(void) | |||
45 | reg |= 1 << 28; | 95 | reg |= 1 << 28; |
46 | writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); | 96 | writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); |
47 | 97 | ||
48 | pr_info("Tegra SKU: %d CPU Process: %d Core Process: %d\n", | 98 | reg = tegra_fuse_readl(FUSE_SKU_INFO); |
49 | tegra_sku_id(), tegra_cpu_process_id(), | 99 | tegra_sku_id = reg & 0xFF; |
50 | tegra_core_process_id()); | ||
51 | } | ||
52 | 100 | ||
53 | unsigned long long tegra_chip_uid(void) | 101 | reg = tegra_fuse_readl(FUSE_SPARE_BIT); |
54 | { | 102 | tegra_cpu_process_id = (reg >> 6) & 3; |
55 | unsigned long long lo, hi; | ||
56 | 103 | ||
57 | lo = fuse_readl(FUSE_UID_LOW); | 104 | reg = tegra_fuse_readl(FUSE_SPARE_BIT); |
58 | hi = fuse_readl(FUSE_UID_HIGH); | 105 | tegra_core_process_id = (reg >> 12) & 3; |
59 | return (hi << 32ull) | lo; | ||
60 | } | ||
61 | 106 | ||
62 | int tegra_sku_id(void) | 107 | reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT); |
63 | { | 108 | tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT; |
64 | int sku_id; | ||
65 | u32 reg = fuse_readl(FUSE_SKU_INFO); | ||
66 | sku_id = reg & 0xFF; | ||
67 | return sku_id; | ||
68 | } | ||
69 | 109 | ||
70 | int tegra_cpu_process_id(void) | 110 | tegra_revision = tegra_get_revision(); |
71 | { | 111 | |
72 | int cpu_process_id; | 112 | pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n", |
73 | u32 reg = fuse_readl(FUSE_SPARE_BIT); | 113 | tegra_revision_name[tegra_get_revision()], |
74 | cpu_process_id = (reg >> 6) & 3; | 114 | tegra_sku_id, tegra_cpu_process_id, |
75 | return cpu_process_id; | 115 | tegra_core_process_id); |
76 | } | 116 | } |
77 | 117 | ||
78 | int tegra_core_process_id(void) | 118 | unsigned long long tegra_chip_uid(void) |
79 | { | 119 | { |
80 | int core_process_id; | 120 | unsigned long long lo, hi; |
81 | u32 reg = fuse_readl(FUSE_SPARE_BIT); | 121 | |
82 | core_process_id = (reg >> 12) & 3; | 122 | lo = tegra_fuse_readl(FUSE_UID_LOW); |
83 | return core_process_id; | 123 | hi = tegra_fuse_readl(FUSE_UID_HIGH); |
124 | return (hi << 32ull) | lo; | ||
84 | } | 125 | } |
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h index 584b2e27dbda..d65d2abf803b 100644 --- a/arch/arm/mach-tegra/fuse.h +++ b/arch/arm/mach-tegra/fuse.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-tegra/fuse.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | 2 | * Copyright (C) 2010 Google, Inc. |
5 | * | 3 | * |
6 | * Author: | 4 | * Author: |
@@ -17,8 +15,34 @@ | |||
17 | * | 15 | * |
18 | */ | 16 | */ |
19 | 17 | ||
18 | #ifndef __MACH_TEGRA_FUSE_H | ||
19 | #define __MACH_TEGRA_FUSE_H | ||
20 | |||
21 | enum tegra_revision { | ||
22 | TEGRA_REVISION_UNKNOWN = 0, | ||
23 | TEGRA_REVISION_A01, | ||
24 | TEGRA_REVISION_A02, | ||
25 | TEGRA_REVISION_A03, | ||
26 | TEGRA_REVISION_A03p, | ||
27 | TEGRA_REVISION_A04, | ||
28 | TEGRA_REVISION_MAX, | ||
29 | }; | ||
30 | |||
31 | #define SKU_ID_T20 8 | ||
32 | #define SKU_ID_T25SE 20 | ||
33 | #define SKU_ID_AP25 23 | ||
34 | #define SKU_ID_T25 24 | ||
35 | #define SKU_ID_AP25E 27 | ||
36 | #define SKU_ID_T25E 28 | ||
37 | |||
38 | extern int tegra_sku_id; | ||
39 | extern int tegra_cpu_process_id; | ||
40 | extern int tegra_core_process_id; | ||
41 | extern enum tegra_revision tegra_revision; | ||
42 | |||
43 | extern int tegra_bct_strapping; | ||
44 | |||
20 | unsigned long long tegra_chip_uid(void); | 45 | unsigned long long tegra_chip_uid(void); |
21 | int tegra_sku_id(void); | ||
22 | int tegra_cpu_process_id(void); | ||
23 | int tegra_core_process_id(void); | ||
24 | void tegra_init_fuse(void); | 46 | void tegra_init_fuse(void); |
47 | |||
48 | #endif | ||
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S index 619abc63aee8..90069abd37bd 100644 --- a/arch/arm/mach-tegra/include/mach/debug-macro.S +++ b/arch/arm/mach-tegra/include/mach/debug-macro.S | |||
@@ -1,11 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-tegra/include/mach/debug-macro.S | 2 | * arch/arm/mach-tegra/include/mach/debug-macro.S |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Google, Inc. | 4 | * Copyright (C) 2010,2011 Google, Inc. |
5 | * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved. | ||
5 | * | 6 | * |
6 | * Author: | 7 | * Author: |
7 | * Colin Cross <ccross@google.com> | 8 | * Colin Cross <ccross@google.com> |
8 | * Erik Gilling <konkers@google.com> | 9 | * Erik Gilling <konkers@google.com> |
10 | * Doug Anderson <dianders@chromium.org> | ||
11 | * Stephen Warren <swarren@nvidia.com> | ||
12 | * | ||
13 | * Portions based on mach-omap2's debug-macro.S | ||
14 | * Copyright (C) 1994-1999 Russell King | ||
9 | * | 15 | * |
10 | * This software is licensed under the terms of the GNU General Public | 16 | * This software is licensed under the terms of the GNU General Public |
11 | * License version 2, as published by the Free Software Foundation, and | 17 | * License version 2, as published by the Free Software Foundation, and |
@@ -18,18 +24,78 @@ | |||
18 | * | 24 | * |
19 | */ | 25 | */ |
20 | 26 | ||
27 | #include <linux/serial_reg.h> | ||
28 | |||
21 | #include <mach/io.h> | 29 | #include <mach/io.h> |
22 | #include <mach/iomap.h> | 30 | #include <mach/iomap.h> |
31 | #include <mach/irammap.h> | ||
32 | |||
33 | .macro addruart, rp, rv, tmp | ||
34 | adr \rp, 99f @ actual addr of 99f | ||
35 | ldr \rv, [\rp] @ linked addr is stored there | ||
36 | sub \rv, \rv, \rp @ offset between the two | ||
37 | ldr \rp, [\rp, #4] @ linked tegra_uart_config | ||
38 | sub \tmp, \rp, \rv @ actual tegra_uart_config | ||
39 | ldr \rp, [\tmp] @ Load tegra_uart_config | ||
40 | cmp \rp, #1 @ needs intitialization? | ||
41 | bne 100f @ no; go load the addresses | ||
42 | mov \rv, #0 @ yes; record init is done | ||
43 | str \rv, [\tmp] | ||
44 | mov \rp, #TEGRA_IRAM_BASE @ See if cookie is in IRAM | ||
45 | ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET] | ||
46 | movw \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE & 0xffff | ||
47 | movt \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE >> 16 | ||
48 | cmp \rv, \rp @ Cookie present? | ||
49 | bne 100f @ No, use default UART | ||
50 | mov \rp, #TEGRA_IRAM_BASE @ Load UART address from IRAM | ||
51 | ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET + 4] | ||
52 | str \rv, [\tmp, #4] @ Store in tegra_uart_phys | ||
53 | sub \rv, \rv, #IO_APB_PHYS @ Calculate virt address | ||
54 | add \rv, \rv, #IO_APB_VIRT | ||
55 | str \rv, [\tmp, #8] @ Store in tegra_uart_virt | ||
56 | b 100f | ||
57 | |||
58 | .align | ||
59 | 99: .word . | ||
60 | .word tegra_uart_config | ||
61 | .ltorg | ||
62 | |||
63 | 100: ldr \rp, [\tmp, #4] @ Load tegra_uart_phys | ||
64 | ldr \rv, [\tmp, #8] @ Load tegra_uart_virt | ||
65 | .endm | ||
66 | |||
67 | #define UART_SHIFT 2 | ||
68 | |||
69 | /* | ||
70 | * Code below is swiped from <asm/hardware/debug-8250.S>, but add an extra | ||
71 | * check to make sure that we aren't in the CONFIG_TEGRA_DEBUG_UART_NONE case. | ||
72 | * We use the fact that all 5 valid UART addresses all have something in the | ||
73 | * 2nd-to-lowest byte. | ||
74 | */ | ||
23 | 75 | ||
24 | .macro addruart, rp, rv, tmp | 76 | .macro senduart, rd, rx |
25 | ldr \rp, =IO_APB_PHYS @ physical | 77 | tst \rx, #0x0000ff00 |
26 | ldr \rv, =IO_APB_VIRT @ virtual | 78 | strneb \rd, [\rx, #UART_TX << UART_SHIFT] |
27 | orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF) | 79 | 1001: |
28 | orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF00) | 80 | .endm |
29 | orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF) | ||
30 | orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF00) | ||
31 | .endm | ||
32 | 81 | ||
33 | #define UART_SHIFT 2 | 82 | .macro busyuart, rd, rx |
34 | #include <asm/hardware/debug-8250.S> | 83 | tst \rx, #0x0000ff00 |
84 | beq 1002f | ||
85 | 1001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT] | ||
86 | and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
87 | teq \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
88 | bne 1001b | ||
89 | 1002: | ||
90 | .endm | ||
35 | 91 | ||
92 | .macro waituart, rd, rx | ||
93 | #ifdef FLOW_CONTROL | ||
94 | tst \rx, #0x0000ff00 | ||
95 | beq 1002f | ||
96 | 1001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT] | ||
97 | tst \rd, #UART_MSR_CTS | ||
98 | beq 1001b | ||
99 | 1002: | ||
100 | #endif | ||
101 | .endm | ||
diff --git a/arch/arm/mach-tegra/include/mach/gpio-tegra.h b/arch/arm/mach-tegra/include/mach/gpio-tegra.h index 87d37fdf5084..6140820555e1 100644 --- a/arch/arm/mach-tegra/include/mach/gpio-tegra.h +++ b/arch/arm/mach-tegra/include/mach/gpio-tegra.h | |||
@@ -25,8 +25,6 @@ | |||
25 | 25 | ||
26 | #define TEGRA_NR_GPIOS INT_GPIO_NR | 26 | #define TEGRA_NR_GPIOS INT_GPIO_NR |
27 | 27 | ||
28 | #define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio)) | ||
29 | |||
30 | struct tegra_gpio_table { | 28 | struct tegra_gpio_table { |
31 | int gpio; /* GPIO number */ | 29 | int gpio; /* GPIO number */ |
32 | bool enable; /* Enable for GPIO at init? */ | 30 | bool enable; /* Enable for GPIO at init? */ |
diff --git a/arch/arm/mach-tegra/include/mach/irammap.h b/arch/arm/mach-tegra/include/mach/irammap.h new file mode 100644 index 000000000000..0cbe63261854 --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/irammap.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #ifndef __MACH_TEGRA_IRAMMAP_H | ||
18 | #define __MACH_TEGRA_IRAMMAP_H | ||
19 | |||
20 | #include <asm/sizes.h> | ||
21 | |||
22 | /* The first 1K of IRAM is permanently reserved for the CPU reset handler */ | ||
23 | #define TEGRA_IRAM_RESET_HANDLER_OFFSET 0 | ||
24 | #define TEGRA_IRAM_RESET_HANDLER_SIZE SZ_1K | ||
25 | |||
26 | /* | ||
27 | * These locations are written to by uncompress.h, and read by debug-macro.S. | ||
28 | * The first word holds the cookie value if the data is valid. The second | ||
29 | * word holds the UART physical address. | ||
30 | */ | ||
31 | #define TEGRA_IRAM_DEBUG_UART_OFFSET SZ_1K | ||
32 | #define TEGRA_IRAM_DEBUG_UART_SIZE 8 | ||
33 | #define TEGRA_IRAM_DEBUG_UART_COOKIE 0x55415254 | ||
34 | |||
35 | #endif | ||
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h index 4e8323770c79..5a440f315e57 100644 --- a/arch/arm/mach-tegra/include/mach/uncompress.h +++ b/arch/arm/mach-tegra/include/mach/uncompress.h | |||
@@ -2,10 +2,14 @@ | |||
2 | * arch/arm/mach-tegra/include/mach/uncompress.h | 2 | * arch/arm/mach-tegra/include/mach/uncompress.h |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Google, Inc. | 4 | * Copyright (C) 2010 Google, Inc. |
5 | * Copyright (C) 2011 Google, Inc. | ||
6 | * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved. | ||
5 | * | 7 | * |
6 | * Author: | 8 | * Author: |
7 | * Colin Cross <ccross@google.com> | 9 | * Colin Cross <ccross@google.com> |
8 | * Erik Gilling <konkers@google.com> | 10 | * Erik Gilling <konkers@google.com> |
11 | * Doug Anderson <dianders@chromium.org> | ||
12 | * Stephen Warren <swarren@nvidia.com> | ||
9 | * | 13 | * |
10 | * This software is licensed under the terms of the GNU General Public | 14 | * This software is licensed under the terms of the GNU General Public |
11 | * License version 2, as published by the Free Software Foundation, and | 15 | * License version 2, as published by the Free Software Foundation, and |
@@ -25,36 +29,130 @@ | |||
25 | #include <linux/serial_reg.h> | 29 | #include <linux/serial_reg.h> |
26 | 30 | ||
27 | #include <mach/iomap.h> | 31 | #include <mach/iomap.h> |
32 | #include <mach/irammap.h> | ||
33 | |||
34 | #define BIT(x) (1 << (x)) | ||
35 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | ||
36 | |||
37 | #define DEBUG_UART_SHIFT 2 | ||
38 | |||
39 | volatile u8 *uart; | ||
28 | 40 | ||
29 | static void putc(int c) | 41 | static void putc(int c) |
30 | { | 42 | { |
31 | volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; | ||
32 | int shift = 2; | ||
33 | |||
34 | if (uart == NULL) | 43 | if (uart == NULL) |
35 | return; | 44 | return; |
36 | 45 | ||
37 | while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) | 46 | while (!(uart[UART_LSR << DEBUG_UART_SHIFT] & UART_LSR_THRE)) |
38 | barrier(); | 47 | barrier(); |
39 | uart[UART_TX << shift] = c; | 48 | uart[UART_TX << DEBUG_UART_SHIFT] = c; |
40 | } | 49 | } |
41 | 50 | ||
42 | static inline void flush(void) | 51 | static inline void flush(void) |
43 | { | 52 | { |
44 | } | 53 | } |
45 | 54 | ||
55 | static inline void save_uart_address(void) | ||
56 | { | ||
57 | u32 *buf = (u32 *)(TEGRA_IRAM_BASE + TEGRA_IRAM_DEBUG_UART_OFFSET); | ||
58 | |||
59 | if (uart) { | ||
60 | buf[0] = TEGRA_IRAM_DEBUG_UART_COOKIE; | ||
61 | buf[1] = (u32)uart; | ||
62 | } else | ||
63 | buf[0] = 0; | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * Setup before decompression. This is where we do UART selection for | ||
68 | * earlyprintk and init the uart_base register. | ||
69 | */ | ||
46 | static inline void arch_decomp_setup(void) | 70 | static inline void arch_decomp_setup(void) |
47 | { | 71 | { |
48 | volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; | 72 | static const struct { |
49 | int shift = 2; | 73 | u32 base; |
74 | u32 reset_reg; | ||
75 | u32 clock_reg; | ||
76 | u32 bit; | ||
77 | } uarts[] = { | ||
78 | { | ||
79 | TEGRA_UARTA_BASE, | ||
80 | TEGRA_CLK_RESET_BASE + 0x04, | ||
81 | TEGRA_CLK_RESET_BASE + 0x10, | ||
82 | 6, | ||
83 | }, | ||
84 | { | ||
85 | TEGRA_UARTB_BASE, | ||
86 | TEGRA_CLK_RESET_BASE + 0x04, | ||
87 | TEGRA_CLK_RESET_BASE + 0x10, | ||
88 | 7, | ||
89 | }, | ||
90 | { | ||
91 | TEGRA_UARTC_BASE, | ||
92 | TEGRA_CLK_RESET_BASE + 0x08, | ||
93 | TEGRA_CLK_RESET_BASE + 0x14, | ||
94 | 23, | ||
95 | }, | ||
96 | { | ||
97 | TEGRA_UARTD_BASE, | ||
98 | TEGRA_CLK_RESET_BASE + 0x0c, | ||
99 | TEGRA_CLK_RESET_BASE + 0x18, | ||
100 | 1, | ||
101 | }, | ||
102 | { | ||
103 | TEGRA_UARTE_BASE, | ||
104 | TEGRA_CLK_RESET_BASE + 0x0c, | ||
105 | TEGRA_CLK_RESET_BASE + 0x18, | ||
106 | 2, | ||
107 | }, | ||
108 | }; | ||
109 | int i; | ||
110 | volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE; | ||
111 | u32 chip, div; | ||
112 | |||
113 | /* | ||
114 | * Look for the first UART that: | ||
115 | * a) Is not in reset. | ||
116 | * b) Is clocked. | ||
117 | * c) Has a 'D' in the scratchpad register. | ||
118 | * | ||
119 | * Note that on Tegra30, the first two conditions are required, since | ||
120 | * if not true, accesses to the UART scratch register will hang. | ||
121 | * Tegra20 doesn't have this issue. | ||
122 | * | ||
123 | * The intent is that the bootloader will tell the kernel which UART | ||
124 | * to use by setting up those conditions. If nothing found, we'll fall | ||
125 | * back to what's specified in TEGRA_DEBUG_UART_BASE. | ||
126 | */ | ||
127 | for (i = 0; i < ARRAY_SIZE(uarts); i++) { | ||
128 | if (*(u8 *)uarts[i].reset_reg & BIT(uarts[i].bit)) | ||
129 | continue; | ||
50 | 130 | ||
131 | if (!(*(u8 *)uarts[i].clock_reg & BIT(uarts[i].bit))) | ||
132 | continue; | ||
133 | |||
134 | uart = (volatile u8 *)uarts[i].base; | ||
135 | if (uart[UART_SCR << DEBUG_UART_SHIFT] != 'D') | ||
136 | continue; | ||
137 | |||
138 | break; | ||
139 | } | ||
140 | if (i == ARRAY_SIZE(uarts)) | ||
141 | uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; | ||
142 | save_uart_address(); | ||
51 | if (uart == NULL) | 143 | if (uart == NULL) |
52 | return; | 144 | return; |
53 | 145 | ||
54 | uart[UART_LCR << shift] |= UART_LCR_DLAB; | 146 | chip = (apb_misc[0x804 / 4] >> 8) & 0xff; |
55 | uart[UART_DLL << shift] = 0x75; | 147 | if (chip == 0x20) |
56 | uart[UART_DLM << shift] = 0x0; | 148 | div = 0x0075; |
57 | uart[UART_LCR << shift] = 3; | 149 | else |
150 | div = 0x00dd; | ||
151 | |||
152 | uart[UART_LCR << DEBUG_UART_SHIFT] |= UART_LCR_DLAB; | ||
153 | uart[UART_DLL << DEBUG_UART_SHIFT] = div & 0xff; | ||
154 | uart[UART_DLM << DEBUG_UART_SHIFT] = div >> 8; | ||
155 | uart[UART_LCR << DEBUG_UART_SHIFT] = 3; | ||
58 | } | 156 | } |
59 | 157 | ||
60 | static inline void arch_decomp_wdog(void) | 158 | static inline void arch_decomp_wdog(void) |
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c new file mode 100644 index 000000000000..7af6a54404be --- /dev/null +++ b/arch/arm/mach-tegra/pmc.c | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/of.h> | ||
21 | |||
22 | #include <mach/iomap.h> | ||
23 | |||
24 | #define PMC_CTRL 0x0 | ||
25 | #define PMC_CTRL_INTR_LOW (1 << 17) | ||
26 | |||
27 | static inline u32 tegra_pmc_readl(u32 reg) | ||
28 | { | ||
29 | return readl(IO_ADDRESS(TEGRA_PMC_BASE + reg)); | ||
30 | } | ||
31 | |||
32 | static inline void tegra_pmc_writel(u32 val, u32 reg) | ||
33 | { | ||
34 | writel(val, IO_ADDRESS(TEGRA_PMC_BASE + reg)); | ||
35 | } | ||
36 | |||
37 | #ifdef CONFIG_OF | ||
38 | static const struct of_device_id matches[] __initconst = { | ||
39 | { .compatible = "nvidia,tegra20-pmc" }, | ||
40 | { } | ||
41 | }; | ||
42 | #endif | ||
43 | |||
44 | void __init tegra_pmc_init(void) | ||
45 | { | ||
46 | /* | ||
47 | * For now, Harmony is the only board that uses the PMC, and it wants | ||
48 | * the signal inverted. Seaboard would too if it used the PMC. | ||
49 | * Hopefully by the time other boards want to use the PMC, everything | ||
50 | * will be device-tree, or they also want it inverted. | ||
51 | */ | ||
52 | bool invert_interrupt = true; | ||
53 | u32 val; | ||
54 | |||
55 | #ifdef CONFIG_OF | ||
56 | if (of_have_populated_dt()) { | ||
57 | struct device_node *np; | ||
58 | |||
59 | invert_interrupt = false; | ||
60 | |||
61 | np = of_find_matching_node(NULL, matches); | ||
62 | if (np) { | ||
63 | if (of_find_property(np, "nvidia,invert-interrupt", | ||
64 | NULL)) | ||
65 | invert_interrupt = true; | ||
66 | } | ||
67 | } | ||
68 | #endif | ||
69 | |||
70 | val = tegra_pmc_readl(PMC_CTRL); | ||
71 | if (invert_interrupt) | ||
72 | val |= PMC_CTRL_INTR_LOW; | ||
73 | else | ||
74 | val &= ~PMC_CTRL_INTR_LOW; | ||
75 | tegra_pmc_writel(val, PMC_CTRL); | ||
76 | } | ||
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h new file mode 100644 index 000000000000..8995ee4a8768 --- /dev/null +++ b/arch/arm/mach-tegra/pmc.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __MACH_TEGRA_PMC_H | ||
19 | #define __MACH_TEGRA_PMC_H | ||
20 | |||
21 | void tegra_pmc_init(void); | ||
22 | |||
23 | #endif | ||
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c index ff9e6b6c0460..74d314fdf2f9 100644 --- a/arch/arm/mach-tegra/tegra2_clocks.c +++ b/arch/arm/mach-tegra/tegra2_clocks.c | |||
@@ -720,7 +720,7 @@ static void tegra2_pllx_clk_init(struct clk *c) | |||
720 | { | 720 | { |
721 | tegra2_pll_clk_init(c); | 721 | tegra2_pll_clk_init(c); |
722 | 722 | ||
723 | if (tegra_sku_id() == 7) | 723 | if (tegra_sku_id == 7) |
724 | c->max_rate = 750000000; | 724 | c->max_rate = 750000000; |
725 | } | 725 | } |
726 | 726 | ||
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c index 0f7ae6e90b55..5070d833bdd1 100644 --- a/arch/arm/mach-tegra/tegra2_emc.c +++ b/arch/arm/mach-tegra/tegra2_emc.c | |||
@@ -16,14 +16,19 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/device.h> | ||
19 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
20 | #include <linux/err.h> | 21 | #include <linux/err.h> |
21 | #include <linux/io.h> | 22 | #include <linux/io.h> |
22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/of.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/platform_data/tegra_emc.h> | ||
23 | 27 | ||
24 | #include <mach/iomap.h> | 28 | #include <mach/iomap.h> |
25 | 29 | ||
26 | #include "tegra2_emc.h" | 30 | #include "tegra2_emc.h" |
31 | #include "fuse.h" | ||
27 | 32 | ||
28 | #ifdef CONFIG_TEGRA_EMC_SCALING_ENABLE | 33 | #ifdef CONFIG_TEGRA_EMC_SCALING_ENABLE |
29 | static bool emc_enable = true; | 34 | static bool emc_enable = true; |
@@ -32,18 +37,17 @@ static bool emc_enable; | |||
32 | #endif | 37 | #endif |
33 | module_param(emc_enable, bool, 0644); | 38 | module_param(emc_enable, bool, 0644); |
34 | 39 | ||
35 | static void __iomem *emc = IO_ADDRESS(TEGRA_EMC_BASE); | 40 | static struct platform_device *emc_pdev; |
36 | static const struct tegra_emc_table *tegra_emc_table; | 41 | static void __iomem *emc_regbase; |
37 | static int tegra_emc_table_size; | ||
38 | 42 | ||
39 | static inline void emc_writel(u32 val, unsigned long addr) | 43 | static inline void emc_writel(u32 val, unsigned long addr) |
40 | { | 44 | { |
41 | writel(val, emc + addr); | 45 | writel(val, emc_regbase + addr); |
42 | } | 46 | } |
43 | 47 | ||
44 | static inline u32 emc_readl(unsigned long addr) | 48 | static inline u32 emc_readl(unsigned long addr) |
45 | { | 49 | { |
46 | return readl(emc + addr); | 50 | return readl(emc_regbase + addr); |
47 | } | 51 | } |
48 | 52 | ||
49 | static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = { | 53 | static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = { |
@@ -98,15 +102,15 @@ static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = { | |||
98 | /* Select the closest EMC rate that is higher than the requested rate */ | 102 | /* Select the closest EMC rate that is higher than the requested rate */ |
99 | long tegra_emc_round_rate(unsigned long rate) | 103 | long tegra_emc_round_rate(unsigned long rate) |
100 | { | 104 | { |
105 | struct tegra_emc_pdata *pdata; | ||
101 | int i; | 106 | int i; |
102 | int best = -1; | 107 | int best = -1; |
103 | unsigned long distance = ULONG_MAX; | 108 | unsigned long distance = ULONG_MAX; |
104 | 109 | ||
105 | if (!tegra_emc_table) | 110 | if (!emc_pdev) |
106 | return -EINVAL; | 111 | return -EINVAL; |
107 | 112 | ||
108 | if (!emc_enable) | 113 | pdata = emc_pdev->dev.platform_data; |
109 | return -EINVAL; | ||
110 | 114 | ||
111 | pr_debug("%s: %lu\n", __func__, rate); | 115 | pr_debug("%s: %lu\n", __func__, rate); |
112 | 116 | ||
@@ -116,10 +120,10 @@ long tegra_emc_round_rate(unsigned long rate) | |||
116 | */ | 120 | */ |
117 | rate = rate / 2 / 1000; | 121 | rate = rate / 2 / 1000; |
118 | 122 | ||
119 | for (i = 0; i < tegra_emc_table_size; i++) { | 123 | for (i = 0; i < pdata->num_tables; i++) { |
120 | if (tegra_emc_table[i].rate >= rate && | 124 | if (pdata->tables[i].rate >= rate && |
121 | (tegra_emc_table[i].rate - rate) < distance) { | 125 | (pdata->tables[i].rate - rate) < distance) { |
122 | distance = tegra_emc_table[i].rate - rate; | 126 | distance = pdata->tables[i].rate - rate; |
123 | best = i; | 127 | best = i; |
124 | } | 128 | } |
125 | } | 129 | } |
@@ -127,9 +131,9 @@ long tegra_emc_round_rate(unsigned long rate) | |||
127 | if (best < 0) | 131 | if (best < 0) |
128 | return -EINVAL; | 132 | return -EINVAL; |
129 | 133 | ||
130 | pr_debug("%s: using %lu\n", __func__, tegra_emc_table[best].rate); | 134 | pr_debug("%s: using %lu\n", __func__, pdata->tables[best].rate); |
131 | 135 | ||
132 | return tegra_emc_table[best].rate * 2 * 1000; | 136 | return pdata->tables[best].rate * 2 * 1000; |
133 | } | 137 | } |
134 | 138 | ||
135 | /* | 139 | /* |
@@ -142,37 +146,211 @@ long tegra_emc_round_rate(unsigned long rate) | |||
142 | */ | 146 | */ |
143 | int tegra_emc_set_rate(unsigned long rate) | 147 | int tegra_emc_set_rate(unsigned long rate) |
144 | { | 148 | { |
149 | struct tegra_emc_pdata *pdata; | ||
145 | int i; | 150 | int i; |
146 | int j; | 151 | int j; |
147 | 152 | ||
148 | if (!tegra_emc_table) | 153 | if (!emc_pdev) |
149 | return -EINVAL; | 154 | return -EINVAL; |
150 | 155 | ||
156 | pdata = emc_pdev->dev.platform_data; | ||
157 | |||
151 | /* | 158 | /* |
152 | * The EMC clock rate is twice the bus rate, and the bus rate is | 159 | * The EMC clock rate is twice the bus rate, and the bus rate is |
153 | * measured in kHz | 160 | * measured in kHz |
154 | */ | 161 | */ |
155 | rate = rate / 2 / 1000; | 162 | rate = rate / 2 / 1000; |
156 | 163 | ||
157 | for (i = 0; i < tegra_emc_table_size; i++) | 164 | for (i = 0; i < pdata->num_tables; i++) |
158 | if (tegra_emc_table[i].rate == rate) | 165 | if (pdata->tables[i].rate == rate) |
159 | break; | 166 | break; |
160 | 167 | ||
161 | if (i >= tegra_emc_table_size) | 168 | if (i >= pdata->num_tables) |
162 | return -EINVAL; | 169 | return -EINVAL; |
163 | 170 | ||
164 | pr_debug("%s: setting to %lu\n", __func__, rate); | 171 | pr_debug("%s: setting to %lu\n", __func__, rate); |
165 | 172 | ||
166 | for (j = 0; j < TEGRA_EMC_NUM_REGS; j++) | 173 | for (j = 0; j < TEGRA_EMC_NUM_REGS; j++) |
167 | emc_writel(tegra_emc_table[i].regs[j], emc_reg_addr[j]); | 174 | emc_writel(pdata->tables[i].regs[j], emc_reg_addr[j]); |
168 | 175 | ||
169 | emc_readl(tegra_emc_table[i].regs[TEGRA_EMC_NUM_REGS - 1]); | 176 | emc_readl(pdata->tables[i].regs[TEGRA_EMC_NUM_REGS - 1]); |
170 | 177 | ||
171 | return 0; | 178 | return 0; |
172 | } | 179 | } |
173 | 180 | ||
174 | void tegra_init_emc(const struct tegra_emc_table *table, int table_size) | 181 | #ifdef CONFIG_OF |
182 | static struct device_node *tegra_emc_ramcode_devnode(struct device_node *np) | ||
183 | { | ||
184 | struct device_node *iter; | ||
185 | u32 reg; | ||
186 | |||
187 | for_each_child_of_node(np, iter) { | ||
188 | if (of_property_read_u32(np, "nvidia,ram-code", ®)) | ||
189 | continue; | ||
190 | if (reg == tegra_bct_strapping) | ||
191 | return of_node_get(iter); | ||
192 | } | ||
193 | |||
194 | return NULL; | ||
195 | } | ||
196 | |||
197 | static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata( | ||
198 | struct platform_device *pdev) | ||
199 | { | ||
200 | struct device_node *np = pdev->dev.of_node; | ||
201 | struct device_node *tnp, *iter; | ||
202 | struct tegra_emc_pdata *pdata; | ||
203 | int ret, i, num_tables; | ||
204 | |||
205 | if (!np) | ||
206 | return NULL; | ||
207 | |||
208 | if (of_find_property(np, "nvidia,use-ram-code", NULL)) { | ||
209 | tnp = tegra_emc_ramcode_devnode(np); | ||
210 | if (!tnp) | ||
211 | dev_warn(&pdev->dev, | ||
212 | "can't find emc table for ram-code 0x%02x\n", | ||
213 | tegra_bct_strapping); | ||
214 | } else | ||
215 | tnp = of_node_get(np); | ||
216 | |||
217 | if (!tnp) | ||
218 | return NULL; | ||
219 | |||
220 | num_tables = 0; | ||
221 | for_each_child_of_node(tnp, iter) | ||
222 | if (of_device_is_compatible(iter, "nvidia,tegra20-emc-table")) | ||
223 | num_tables++; | ||
224 | |||
225 | if (!num_tables) { | ||
226 | pdata = NULL; | ||
227 | goto out; | ||
228 | } | ||
229 | |||
230 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
231 | pdata->tables = devm_kzalloc(&pdev->dev, | ||
232 | sizeof(*pdata->tables) * num_tables, | ||
233 | GFP_KERNEL); | ||
234 | |||
235 | i = 0; | ||
236 | for_each_child_of_node(tnp, iter) { | ||
237 | u32 prop; | ||
238 | |||
239 | ret = of_property_read_u32(iter, "clock-frequency", &prop); | ||
240 | if (ret) { | ||
241 | dev_err(&pdev->dev, "no clock-frequency in %s\n", | ||
242 | iter->full_name); | ||
243 | continue; | ||
244 | } | ||
245 | pdata->tables[i].rate = prop; | ||
246 | |||
247 | ret = of_property_read_u32_array(iter, "nvidia,emc-registers", | ||
248 | pdata->tables[i].regs, | ||
249 | TEGRA_EMC_NUM_REGS); | ||
250 | if (ret) { | ||
251 | dev_err(&pdev->dev, | ||
252 | "malformed emc-registers property in %s\n", | ||
253 | iter->full_name); | ||
254 | continue; | ||
255 | } | ||
256 | |||
257 | i++; | ||
258 | } | ||
259 | pdata->num_tables = i; | ||
260 | |||
261 | out: | ||
262 | of_node_put(tnp); | ||
263 | return pdata; | ||
264 | } | ||
265 | #else | ||
266 | static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata( | ||
267 | struct platform_device *pdev) | ||
268 | { | ||
269 | return NULL; | ||
270 | } | ||
271 | #endif | ||
272 | |||
273 | static struct tegra_emc_pdata __devinit *tegra_emc_fill_pdata(struct platform_device *pdev) | ||
274 | { | ||
275 | struct clk *c = clk_get_sys(NULL, "emc"); | ||
276 | struct tegra_emc_pdata *pdata; | ||
277 | unsigned long khz; | ||
278 | int i; | ||
279 | |||
280 | WARN_ON(pdev->dev.platform_data); | ||
281 | BUG_ON(IS_ERR_OR_NULL(c)); | ||
282 | |||
283 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
284 | pdata->tables = devm_kzalloc(&pdev->dev, sizeof(*pdata->tables), | ||
285 | GFP_KERNEL); | ||
286 | |||
287 | pdata->tables[0].rate = clk_get_rate(c) / 2 / 1000; | ||
288 | |||
289 | for (i = 0; i < TEGRA_EMC_NUM_REGS; i++) | ||
290 | pdata->tables[0].regs[i] = emc_readl(emc_reg_addr[i]); | ||
291 | |||
292 | pdata->num_tables = 1; | ||
293 | |||
294 | khz = pdata->tables[0].rate; | ||
295 | dev_info(&pdev->dev, "no tables provided, using %ld kHz emc, " | ||
296 | "%ld kHz mem\n", khz * 2, khz); | ||
297 | |||
298 | return pdata; | ||
299 | } | ||
300 | |||
301 | static int __devinit tegra_emc_probe(struct platform_device *pdev) | ||
302 | { | ||
303 | struct tegra_emc_pdata *pdata; | ||
304 | struct resource *res; | ||
305 | |||
306 | if (!emc_enable) { | ||
307 | dev_err(&pdev->dev, "disabled per module parameter\n"); | ||
308 | return -ENODEV; | ||
309 | } | ||
310 | |||
311 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
312 | if (!res) { | ||
313 | dev_err(&pdev->dev, "missing register base\n"); | ||
314 | return -ENOMEM; | ||
315 | } | ||
316 | |||
317 | emc_regbase = devm_request_and_ioremap(&pdev->dev, res); | ||
318 | if (!emc_regbase) { | ||
319 | dev_err(&pdev->dev, "failed to remap registers\n"); | ||
320 | return -ENOMEM; | ||
321 | } | ||
322 | |||
323 | pdata = pdev->dev.platform_data; | ||
324 | |||
325 | if (!pdata) | ||
326 | pdata = tegra_emc_dt_parse_pdata(pdev); | ||
327 | |||
328 | if (!pdata) | ||
329 | pdata = tegra_emc_fill_pdata(pdev); | ||
330 | |||
331 | pdev->dev.platform_data = pdata; | ||
332 | |||
333 | emc_pdev = pdev; | ||
334 | |||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static struct of_device_id tegra_emc_of_match[] __devinitdata = { | ||
339 | { .compatible = "nvidia,tegra20-emc", }, | ||
340 | { }, | ||
341 | }; | ||
342 | |||
343 | static struct platform_driver tegra_emc_driver = { | ||
344 | .driver = { | ||
345 | .name = "tegra-emc", | ||
346 | .owner = THIS_MODULE, | ||
347 | .of_match_table = tegra_emc_of_match, | ||
348 | }, | ||
349 | .probe = tegra_emc_probe, | ||
350 | }; | ||
351 | |||
352 | static int __init tegra_emc_init(void) | ||
175 | { | 353 | { |
176 | tegra_emc_table = table; | 354 | return platform_driver_register(&tegra_emc_driver); |
177 | tegra_emc_table_size = table_size; | ||
178 | } | 355 | } |
356 | device_initcall(tegra_emc_init); | ||
diff --git a/arch/arm/mach-tegra/tegra2_emc.h b/arch/arm/mach-tegra/tegra2_emc.h index 19f08cb31603..f61409b54cb7 100644 --- a/arch/arm/mach-tegra/tegra2_emc.h +++ b/arch/arm/mach-tegra/tegra2_emc.h | |||
@@ -15,13 +15,10 @@ | |||
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define TEGRA_EMC_NUM_REGS 46 | 18 | #ifndef __MACH_TEGRA_TEGRA2_EMC_H_ |
19 | 19 | #define __MACH_TEGRA_TEGRA2_EMC_H | |
20 | struct tegra_emc_table { | ||
21 | unsigned long rate; | ||
22 | u32 regs[TEGRA_EMC_NUM_REGS]; | ||
23 | }; | ||
24 | 20 | ||
25 | int tegra_emc_set_rate(unsigned long rate); | 21 | int tegra_emc_set_rate(unsigned long rate); |
26 | long tegra_emc_round_rate(unsigned long rate); | 22 | long tegra_emc_round_rate(unsigned long rate); |
27 | void tegra_init_emc(const struct tegra_emc_table *table, int table_size); | 23 | |
24 | #endif | ||
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 4f352e45be0a..0968772aedbe 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c | |||
@@ -98,8 +98,11 @@ static const struct of_device_id sic_of_match[] __initconst = { | |||
98 | 98 | ||
99 | void __init versatile_init_irq(void) | 99 | void __init versatile_init_irq(void) |
100 | { | 100 | { |
101 | vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0); | 101 | struct device_node *np; |
102 | irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE, IRQ_VIC_START); | 102 | |
103 | np = of_find_matching_node_by_address(NULL, vic_of_match, | ||
104 | VERSATILE_VIC_BASE); | ||
105 | __vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0, np); | ||
103 | 106 | ||
104 | writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); | 107 | writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); |
105 | 108 | ||
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c index 8cced35009bd..0e51fc36b5be 100644 --- a/arch/arm/plat-mxc/audmux-v2.c +++ b/arch/arm/plat-mxc/audmux-v2.c | |||
@@ -73,13 +73,13 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, | |||
73 | return -ENOMEM; | 73 | return -ENOMEM; |
74 | 74 | ||
75 | if (audmux_clk) | 75 | if (audmux_clk) |
76 | clk_enable(audmux_clk); | 76 | clk_prepare_enable(audmux_clk); |
77 | 77 | ||
78 | ptcr = readl(audmux_base + MXC_AUDMUX_V2_PTCR(port)); | 78 | ptcr = readl(audmux_base + MXC_AUDMUX_V2_PTCR(port)); |
79 | pdcr = readl(audmux_base + MXC_AUDMUX_V2_PDCR(port)); | 79 | pdcr = readl(audmux_base + MXC_AUDMUX_V2_PDCR(port)); |
80 | 80 | ||
81 | if (audmux_clk) | 81 | if (audmux_clk) |
82 | clk_disable(audmux_clk); | 82 | clk_disable_unprepare(audmux_clk); |
83 | 83 | ||
84 | ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n", | 84 | ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n", |
85 | pdcr, ptcr); | 85 | pdcr, ptcr); |
@@ -172,13 +172,13 @@ int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr, | |||
172 | return -ENOSYS; | 172 | return -ENOSYS; |
173 | 173 | ||
174 | if (audmux_clk) | 174 | if (audmux_clk) |
175 | clk_enable(audmux_clk); | 175 | clk_prepare_enable(audmux_clk); |
176 | 176 | ||
177 | writel(ptcr, audmux_base + MXC_AUDMUX_V2_PTCR(port)); | 177 | writel(ptcr, audmux_base + MXC_AUDMUX_V2_PTCR(port)); |
178 | writel(pdcr, audmux_base + MXC_AUDMUX_V2_PDCR(port)); | 178 | writel(pdcr, audmux_base + MXC_AUDMUX_V2_PDCR(port)); |
179 | 179 | ||
180 | if (audmux_clk) | 180 | if (audmux_clk) |
181 | clk_disable(audmux_clk); | 181 | clk_disable_unprepare(audmux_clk); |
182 | 182 | ||
183 | return 0; | 183 | return 0; |
184 | } | 184 | } |
diff --git a/arch/arm/plat-mxc/devices/platform-ahci-imx.c b/arch/arm/plat-mxc/devices/platform-ahci-imx.c index d8a56aee521b..ade4a1c4e2a3 100644 --- a/arch/arm/plat-mxc/devices/platform-ahci-imx.c +++ b/arch/arm/plat-mxc/devices/platform-ahci-imx.c | |||
@@ -60,9 +60,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr) | |||
60 | dev_err(dev, "no sata clock.\n"); | 60 | dev_err(dev, "no sata clock.\n"); |
61 | return PTR_ERR(sata_clk); | 61 | return PTR_ERR(sata_clk); |
62 | } | 62 | } |
63 | ret = clk_enable(sata_clk); | 63 | ret = clk_prepare_enable(sata_clk); |
64 | if (ret) { | 64 | if (ret) { |
65 | dev_err(dev, "can't enable sata clock.\n"); | 65 | dev_err(dev, "can't prepare/enable sata clock.\n"); |
66 | goto put_sata_clk; | 66 | goto put_sata_clk; |
67 | } | 67 | } |
68 | 68 | ||
@@ -73,9 +73,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr) | |||
73 | ret = PTR_ERR(sata_ref_clk); | 73 | ret = PTR_ERR(sata_ref_clk); |
74 | goto release_sata_clk; | 74 | goto release_sata_clk; |
75 | } | 75 | } |
76 | ret = clk_enable(sata_ref_clk); | 76 | ret = clk_prepare_enable(sata_ref_clk); |
77 | if (ret) { | 77 | if (ret) { |
78 | dev_err(dev, "can't enable sata ref clock.\n"); | 78 | dev_err(dev, "can't prepare/enable sata ref clock.\n"); |
79 | goto put_sata_ref_clk; | 79 | goto put_sata_ref_clk; |
80 | } | 80 | } |
81 | 81 | ||
@@ -104,11 +104,11 @@ static int imx_sata_init(struct device *dev, void __iomem *addr) | |||
104 | return 0; | 104 | return 0; |
105 | 105 | ||
106 | release_sata_ref_clk: | 106 | release_sata_ref_clk: |
107 | clk_disable(sata_ref_clk); | 107 | clk_disable_unprepare(sata_ref_clk); |
108 | put_sata_ref_clk: | 108 | put_sata_ref_clk: |
109 | clk_put(sata_ref_clk); | 109 | clk_put(sata_ref_clk); |
110 | release_sata_clk: | 110 | release_sata_clk: |
111 | clk_disable(sata_clk); | 111 | clk_disable_unprepare(sata_clk); |
112 | put_sata_clk: | 112 | put_sata_clk: |
113 | clk_put(sata_clk); | 113 | clk_put(sata_clk); |
114 | 114 | ||
@@ -117,10 +117,10 @@ put_sata_clk: | |||
117 | 117 | ||
118 | static void imx_sata_exit(struct device *dev) | 118 | static void imx_sata_exit(struct device *dev) |
119 | { | 119 | { |
120 | clk_disable(sata_ref_clk); | 120 | clk_disable_unprepare(sata_ref_clk); |
121 | clk_put(sata_ref_clk); | 121 | clk_put(sata_ref_clk); |
122 | 122 | ||
123 | clk_disable(sata_clk); | 123 | clk_disable_unprepare(sata_clk); |
124 | clk_put(sata_clk); | 124 | clk_put(sata_clk); |
125 | 125 | ||
126 | } | 126 | } |
diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/plat-mxc/epit.c index d3467f818c33..9129c9e7d532 100644 --- a/arch/arm/plat-mxc/epit.c +++ b/arch/arm/plat-mxc/epit.c | |||
@@ -203,7 +203,7 @@ static int __init epit_clockevent_init(struct clk *timer_clk) | |||
203 | 203 | ||
204 | void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq) | 204 | void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq) |
205 | { | 205 | { |
206 | clk_enable(timer_clk); | 206 | clk_prepare_enable(timer_clk); |
207 | 207 | ||
208 | timer_base = base; | 208 | timer_base = base; |
209 | 209 | ||
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h deleted file mode 100644 index 94b60dd47137..000000000000 --- a/arch/arm/plat-mxc/include/mach/board-mx31ads.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
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 version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_ARCH_MXC_BOARD_MX31ADS_H__ | ||
12 | #define __ASM_ARCH_MXC_BOARD_MX31ADS_H__ | ||
13 | |||
14 | #include <mach/hardware.h> | ||
15 | |||
16 | /* | ||
17 | * These symbols are used by drivers/net/cs89x0.c. | ||
18 | * This is ugly as hell, but we have to provide them until | ||
19 | * someone fixed the driver. | ||
20 | */ | ||
21 | |||
22 | /* Base address of PBC controller */ | ||
23 | #define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT | ||
24 | /* Offsets for the PBC Controller register */ | ||
25 | |||
26 | /* Ethernet Controller IO base address */ | ||
27 | #define PBC_CS8900A_IOBASE 0x020000 | ||
28 | |||
29 | #define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START) | ||
30 | |||
31 | #define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8) | ||
32 | |||
33 | #endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */ | ||
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S index 6e192c4a391a..8ddda365f1a0 100644 --- a/arch/arm/plat-mxc/include/mach/debug-macro.S +++ b/arch/arm/plat-mxc/include/mach/debug-macro.S | |||
@@ -24,7 +24,7 @@ | |||
24 | #define UART_PADDR MX51_UART1_BASE_ADDR | 24 | #define UART_PADDR MX51_UART1_BASE_ADDR |
25 | #elif defined (CONFIG_DEBUG_IMX50_IMX53_UART) | 25 | #elif defined (CONFIG_DEBUG_IMX50_IMX53_UART) |
26 | #define UART_PADDR MX53_UART1_BASE_ADDR | 26 | #define UART_PADDR MX53_UART1_BASE_ADDR |
27 | #elif defined (CONFIG_DEBUG_IMX6Q_UART) | 27 | #elif defined (CONFIG_DEBUG_IMX6Q_UART4) |
28 | #define UART_PADDR MX6Q_UART4_BASE_ADDR | 28 | #define UART_PADDR MX6Q_UART4_BASE_ADDR |
29 | #endif | 29 | #endif |
30 | 30 | ||
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h index 233d0a5e2d68..1b9080385b46 100644 --- a/arch/arm/plat-mxc/include/mach/dma.h +++ b/arch/arm/plat-mxc/include/mach/dma.h | |||
@@ -60,8 +60,7 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan) | |||
60 | 60 | ||
61 | static inline int imx_dma_is_general_purpose(struct dma_chan *chan) | 61 | static inline int imx_dma_is_general_purpose(struct dma_chan *chan) |
62 | { | 62 | { |
63 | return !strcmp(dev_name(chan->device->dev), "imx31-sdma") || | 63 | return strstr(dev_name(chan->device->dev), "sdma") || |
64 | !strcmp(dev_name(chan->device->dev), "imx35-sdma") || | ||
65 | !strcmp(dev_name(chan->device->dev), "imx-dma"); | 64 | !strcmp(dev_name(chan->device->dev), "imx-dma"); |
66 | } | 65 | } |
67 | 66 | ||
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c index e032717f7d02..c0cab2270dd1 100644 --- a/arch/arm/plat-mxc/pwm.c +++ b/arch/arm/plat-mxc/pwm.c | |||
@@ -132,7 +132,7 @@ int pwm_enable(struct pwm_device *pwm) | |||
132 | int rc = 0; | 132 | int rc = 0; |
133 | 133 | ||
134 | if (!pwm->clk_enabled) { | 134 | if (!pwm->clk_enabled) { |
135 | rc = clk_enable(pwm->clk); | 135 | rc = clk_prepare_enable(pwm->clk); |
136 | if (!rc) | 136 | if (!rc) |
137 | pwm->clk_enabled = 1; | 137 | pwm->clk_enabled = 1; |
138 | } | 138 | } |
@@ -145,7 +145,7 @@ void pwm_disable(struct pwm_device *pwm) | |||
145 | writel(0, pwm->mmio_base + MX3_PWMCR); | 145 | writel(0, pwm->mmio_base + MX3_PWMCR); |
146 | 146 | ||
147 | if (pwm->clk_enabled) { | 147 | if (pwm->clk_enabled) { |
148 | clk_disable(pwm->clk); | 148 | clk_disable_unprepare(pwm->clk); |
149 | pwm->clk_enabled = 0; | 149 | pwm->clk_enabled = 0; |
150 | } | 150 | } |
151 | } | 151 | } |
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c index 3599bf2cfd4f..f30dcacbbd0a 100644 --- a/arch/arm/plat-mxc/system.c +++ b/arch/arm/plat-mxc/system.c | |||
@@ -48,7 +48,7 @@ void mxc_restart(char mode, const char *cmd) | |||
48 | 48 | ||
49 | clk = clk_get_sys("imx2-wdt.0", NULL); | 49 | clk = clk_get_sys("imx2-wdt.0", NULL); |
50 | if (!IS_ERR(clk)) | 50 | if (!IS_ERR(clk)) |
51 | clk_enable(clk); | 51 | clk_prepare_enable(clk); |
52 | wcr_enable = (1 << 2); | 52 | wcr_enable = (1 << 2); |
53 | } | 53 | } |
54 | 54 | ||
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c index 1c96cdb4c35e..7daf7c9a413b 100644 --- a/arch/arm/plat-mxc/time.c +++ b/arch/arm/plat-mxc/time.c | |||
@@ -283,7 +283,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq) | |||
283 | { | 283 | { |
284 | uint32_t tctl_val; | 284 | uint32_t tctl_val; |
285 | 285 | ||
286 | clk_enable(timer_clk); | 286 | clk_prepare_enable(timer_clk); |
287 | 287 | ||
288 | timer_base = base; | 288 | timer_base = base; |
289 | 289 | ||
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 647010109afa..9e8e63d52aab 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -484,7 +484,6 @@ struct omap_hwmod_class { | |||
484 | * @main_clk: main clock: OMAP clock name | 484 | * @main_clk: main clock: OMAP clock name |
485 | * @_clk: pointer to the main struct clk (filled in at runtime) | 485 | * @_clk: pointer to the main struct clk (filled in at runtime) |
486 | * @opt_clks: other device clocks that drivers can request (0..*) | 486 | * @opt_clks: other device clocks that drivers can request (0..*) |
487 | * @vdd_name: voltage domain name | ||
488 | * @voltdm: pointer to voltage domain (filled in at runtime) | 487 | * @voltdm: pointer to voltage domain (filled in at runtime) |
489 | * @masters: ptr to array of OCP ifs that this hwmod can initiate on | 488 | * @masters: ptr to array of OCP ifs that this hwmod can initiate on |
490 | * @slaves: ptr to array of OCP ifs that this hwmod can respond on | 489 | * @slaves: ptr to array of OCP ifs that this hwmod can respond on |
@@ -528,7 +527,6 @@ struct omap_hwmod { | |||
528 | struct omap_hwmod_opt_clk *opt_clks; | 527 | struct omap_hwmod_opt_clk *opt_clks; |
529 | char *clkdm_name; | 528 | char *clkdm_name; |
530 | struct clockdomain *clkdm; | 529 | struct clockdomain *clkdm; |
531 | char *vdd_name; | ||
532 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ | 530 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ |
533 | struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ | 531 | struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ |
534 | void *dev_attr; | 532 | void *dev_attr; |
diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h index 30b7cc14cef5..0f8263e93eea 100644 --- a/arch/arm/plat-samsung/include/plat/regs-rtc.h +++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h | |||
@@ -18,51 +18,54 @@ | |||
18 | #define S3C2410_INTP_ALM (1 << 1) | 18 | #define S3C2410_INTP_ALM (1 << 1) |
19 | #define S3C2410_INTP_TIC (1 << 0) | 19 | #define S3C2410_INTP_TIC (1 << 0) |
20 | 20 | ||
21 | #define S3C2410_RTCCON S3C2410_RTCREG(0x40) | 21 | #define S3C2410_RTCCON S3C2410_RTCREG(0x40) |
22 | #define S3C2410_RTCCON_RTCEN (1<<0) | 22 | #define S3C2410_RTCCON_RTCEN (1 << 0) |
23 | #define S3C2410_RTCCON_CLKSEL (1<<1) | 23 | #define S3C2410_RTCCON_CNTSEL (1 << 2) |
24 | #define S3C2410_RTCCON_CNTSEL (1<<2) | 24 | #define S3C2410_RTCCON_CLKRST (1 << 3) |
25 | #define S3C2410_RTCCON_CLKRST (1<<3) | 25 | #define S3C2443_RTCCON_TICSEL (1 << 4) |
26 | #define S3C64XX_RTCCON_TICEN (1<<8) | 26 | #define S3C64XX_RTCCON_TICEN (1 << 8) |
27 | 27 | ||
28 | #define S3C64XX_RTCCON_TICMSK (0xF<<7) | 28 | #define S3C2410_TICNT S3C2410_RTCREG(0x44) |
29 | #define S3C64XX_RTCCON_TICSHT (7) | 29 | #define S3C2410_TICNT_ENABLE (1 << 7) |
30 | 30 | ||
31 | #define S3C2410_TICNT S3C2410_RTCREG(0x44) | 31 | /* S3C2443: tick count is 15 bit wide |
32 | #define S3C2410_TICNT_ENABLE (1<<7) | 32 | * TICNT[6:0] contains upper 7 bits |
33 | * TICNT1[7:0] contains lower 8 bits | ||
34 | */ | ||
35 | #define S3C2443_TICNT_PART(x) ((x & 0x7f00) >> 8) | ||
36 | #define S3C2443_TICNT1 S3C2410_RTCREG(0x4C) | ||
37 | #define S3C2443_TICNT1_PART(x) (x & 0xff) | ||
33 | 38 | ||
34 | #define S3C2410_RTCALM S3C2410_RTCREG(0x50) | 39 | /* S3C2416: tick count is 32 bit wide |
35 | #define S3C2410_RTCALM_ALMEN (1<<6) | 40 | * TICNT[6:0] contains bits [14:8] |
36 | #define S3C2410_RTCALM_YEAREN (1<<5) | 41 | * TICNT1[7:0] contains lower 8 bits |
37 | #define S3C2410_RTCALM_MONEN (1<<4) | 42 | * TICNT2[16:0] contains upper 17 bits |
38 | #define S3C2410_RTCALM_DAYEN (1<<3) | 43 | */ |
39 | #define S3C2410_RTCALM_HOUREN (1<<2) | 44 | #define S3C2416_TICNT2 S3C2410_RTCREG(0x48) |
40 | #define S3C2410_RTCALM_MINEN (1<<1) | 45 | #define S3C2416_TICNT2_PART(x) ((x & 0xffff8000) >> 15) |
41 | #define S3C2410_RTCALM_SECEN (1<<0) | ||
42 | 46 | ||
43 | #define S3C2410_RTCALM_ALL \ | 47 | #define S3C2410_RTCALM S3C2410_RTCREG(0x50) |
44 | S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\ | 48 | #define S3C2410_RTCALM_ALMEN (1 << 6) |
45 | S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\ | 49 | #define S3C2410_RTCALM_YEAREN (1 << 5) |
46 | S3C2410_RTCALM_SECEN | 50 | #define S3C2410_RTCALM_MONEN (1 << 4) |
51 | #define S3C2410_RTCALM_DAYEN (1 << 3) | ||
52 | #define S3C2410_RTCALM_HOUREN (1 << 2) | ||
53 | #define S3C2410_RTCALM_MINEN (1 << 1) | ||
54 | #define S3C2410_RTCALM_SECEN (1 << 0) | ||
47 | 55 | ||
56 | #define S3C2410_ALMSEC S3C2410_RTCREG(0x54) | ||
57 | #define S3C2410_ALMMIN S3C2410_RTCREG(0x58) | ||
58 | #define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c) | ||
48 | 59 | ||
49 | #define S3C2410_ALMSEC S3C2410_RTCREG(0x54) | 60 | #define S3C2410_ALMDATE S3C2410_RTCREG(0x60) |
50 | #define S3C2410_ALMMIN S3C2410_RTCREG(0x58) | 61 | #define S3C2410_ALMMON S3C2410_RTCREG(0x64) |
51 | #define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c) | 62 | #define S3C2410_ALMYEAR S3C2410_RTCREG(0x68) |
52 | |||
53 | #define S3C2410_ALMDATE S3C2410_RTCREG(0x60) | ||
54 | #define S3C2410_ALMMON S3C2410_RTCREG(0x64) | ||
55 | #define S3C2410_ALMYEAR S3C2410_RTCREG(0x68) | ||
56 | |||
57 | #define S3C2410_RTCRST S3C2410_RTCREG(0x6c) | ||
58 | |||
59 | #define S3C2410_RTCSEC S3C2410_RTCREG(0x70) | ||
60 | #define S3C2410_RTCMIN S3C2410_RTCREG(0x74) | ||
61 | #define S3C2410_RTCHOUR S3C2410_RTCREG(0x78) | ||
62 | #define S3C2410_RTCDATE S3C2410_RTCREG(0x7c) | ||
63 | #define S3C2410_RTCDAY S3C2410_RTCREG(0x80) | ||
64 | #define S3C2410_RTCMON S3C2410_RTCREG(0x84) | ||
65 | #define S3C2410_RTCYEAR S3C2410_RTCREG(0x88) | ||
66 | 63 | ||
64 | #define S3C2410_RTCSEC S3C2410_RTCREG(0x70) | ||
65 | #define S3C2410_RTCMIN S3C2410_RTCREG(0x74) | ||
66 | #define S3C2410_RTCHOUR S3C2410_RTCREG(0x78) | ||
67 | #define S3C2410_RTCDATE S3C2410_RTCREG(0x7c) | ||
68 | #define S3C2410_RTCMON S3C2410_RTCREG(0x84) | ||
69 | #define S3C2410_RTCYEAR S3C2410_RTCREG(0x88) | ||
67 | 70 | ||
68 | #endif /* __ASM_ARCH_REGS_RTC_H */ | 71 | #endif /* __ASM_ARCH_REGS_RTC_H */ |
diff --git a/arch/arm/plat-samsung/include/plat/rtc-core.h b/arch/arm/plat-samsung/include/plat/rtc-core.h new file mode 100644 index 000000000000..21d8594d37ca --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/rtc-core.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/rtc-core.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de> | ||
4 | * | ||
5 | * Samsung RTC Controller core functions | ||
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 version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_PLAT_RTC_CORE_H | ||
13 | #define __ASM_PLAT_RTC_CORE_H __FILE__ | ||
14 | |||
15 | /* These functions are only for use with the core support code, such as | ||
16 | * the cpu specific initialisation code | ||
17 | */ | ||
18 | |||
19 | /* re-define device name depending on support. */ | ||
20 | static inline void s3c_rtc_setname(char *name) | ||
21 | { | ||
22 | #if defined(CONFIG_SAMSUNG_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX) | ||
23 | s3c_device_rtc.name = name; | ||
24 | #endif | ||
25 | } | ||
26 | |||
27 | #endif /* __ASM_PLAT_RTC_CORE_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h index f82f888b91a9..317e246ffc56 100644 --- a/arch/arm/plat-samsung/include/plat/sdhci.h +++ b/arch/arm/plat-samsung/include/plat/sdhci.h | |||
@@ -40,6 +40,7 @@ enum clk_types { | |||
40 | * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI | 40 | * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI |
41 | * @max_width: The maximum number of data bits supported. | 41 | * @max_width: The maximum number of data bits supported. |
42 | * @host_caps: Standard MMC host capabilities bit field. | 42 | * @host_caps: Standard MMC host capabilities bit field. |
43 | * @host_caps2: The second standard MMC host capabilities bit field. | ||
43 | * @cd_type: Type of Card Detection method (see cd_types enum above) | 44 | * @cd_type: Type of Card Detection method (see cd_types enum above) |
44 | * @clk_type: Type of clock divider method (see clk_types enum above) | 45 | * @clk_type: Type of clock divider method (see clk_types enum above) |
45 | * @ext_cd_init: Initialize external card detect subsystem. Called on | 46 | * @ext_cd_init: Initialize external card detect subsystem. Called on |
@@ -63,6 +64,7 @@ enum clk_types { | |||
63 | struct s3c_sdhci_platdata { | 64 | struct s3c_sdhci_platdata { |
64 | unsigned int max_width; | 65 | unsigned int max_width; |
65 | unsigned int host_caps; | 66 | unsigned int host_caps; |
67 | unsigned int host_caps2; | ||
66 | unsigned int pm_caps; | 68 | unsigned int pm_caps; |
67 | enum cd_types cd_type; | 69 | enum cd_types cd_type; |
68 | enum clk_types clk_type; | 70 | enum clk_types clk_type; |
diff --git a/arch/arm/plat-samsung/platformdata.c b/arch/arm/plat-samsung/platformdata.c index 0f707184eae0..fa78aa710ed1 100644 --- a/arch/arm/plat-samsung/platformdata.c +++ b/arch/arm/plat-samsung/platformdata.c | |||
@@ -53,6 +53,8 @@ void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd, | |||
53 | set->cfg_gpio = pd->cfg_gpio; | 53 | set->cfg_gpio = pd->cfg_gpio; |
54 | if (pd->host_caps) | 54 | if (pd->host_caps) |
55 | set->host_caps |= pd->host_caps; | 55 | set->host_caps |= pd->host_caps; |
56 | if (pd->host_caps2) | ||
57 | set->host_caps2 |= pd->host_caps2; | ||
56 | if (pd->pm_caps) | 58 | if (pd->pm_caps) |
57 | set->pm_caps |= pd->pm_caps; | 59 | set->pm_caps |= pd->pm_caps; |
58 | if (pd->clk_type) | 60 | if (pd->clk_type) |
diff --git a/arch/avr32/mach-at32ap/include/mach/cpu.h b/arch/avr32/mach-at32ap/include/mach/cpu.h index 8181293115e4..16a24b14146c 100644 --- a/arch/avr32/mach-at32ap/include/mach/cpu.h +++ b/arch/avr32/mach-at32ap/include/mach/cpu.h | |||
@@ -30,9 +30,6 @@ | |||
30 | #define cpu_is_at91sam9261() (0) | 30 | #define cpu_is_at91sam9261() (0) |
31 | #define cpu_is_at91sam9263() (0) | 31 | #define cpu_is_at91sam9263() (0) |
32 | #define cpu_is_at91sam9rl() (0) | 32 | #define cpu_is_at91sam9rl() (0) |
33 | #define cpu_is_at91cap9() (0) | ||
34 | #define cpu_is_at91cap9_revB() (0) | ||
35 | #define cpu_is_at91cap9_revC() (0) | ||
36 | #define cpu_is_at91sam9g10() (0) | 33 | #define cpu_is_at91sam9g10() (0) |
37 | #define cpu_is_at91sam9g20() (0) | 34 | #define cpu_is_at91sam9g20() (0) |
38 | #define cpu_is_at91sam9g45() (0) | 35 | #define cpu_is_at91sam9g45() (0) |
diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig index 26e67f0f0051..3c64b2894c13 100644 --- a/arch/c6x/Kconfig +++ b/arch/c6x/Kconfig | |||
@@ -12,6 +12,7 @@ config TMS320C6X | |||
12 | select HAVE_GENERIC_HARDIRQS | 12 | select HAVE_GENERIC_HARDIRQS |
13 | select HAVE_MEMBLOCK | 13 | select HAVE_MEMBLOCK |
14 | select HAVE_SPARSE_IRQ | 14 | select HAVE_SPARSE_IRQ |
15 | select IRQ_DOMAIN | ||
15 | select OF | 16 | select OF |
16 | select OF_EARLY_FLATTREE | 17 | select OF_EARLY_FLATTREE |
17 | 18 | ||
diff --git a/arch/c6x/include/asm/irq.h b/arch/c6x/include/asm/irq.h index a6ae3c9d9c40..f13b78d5e1ca 100644 --- a/arch/c6x/include/asm/irq.h +++ b/arch/c6x/include/asm/irq.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #ifndef _ASM_C6X_IRQ_H | 13 | #ifndef _ASM_C6X_IRQ_H |
14 | #define _ASM_C6X_IRQ_H | 14 | #define _ASM_C6X_IRQ_H |
15 | 15 | ||
16 | #include <linux/irqdomain.h> | ||
16 | #include <linux/threads.h> | 17 | #include <linux/threads.h> |
17 | #include <linux/list.h> | 18 | #include <linux/list.h> |
18 | #include <linux/radix-tree.h> | 19 | #include <linux/radix-tree.h> |
@@ -41,253 +42,9 @@ | |||
41 | /* This number is used when no interrupt has been assigned */ | 42 | /* This number is used when no interrupt has been assigned */ |
42 | #define NO_IRQ 0 | 43 | #define NO_IRQ 0 |
43 | 44 | ||
44 | /* This type is the placeholder for a hardware interrupt number. It has to | ||
45 | * be big enough to enclose whatever representation is used by a given | ||
46 | * platform. | ||
47 | */ | ||
48 | typedef unsigned long irq_hw_number_t; | ||
49 | |||
50 | /* Interrupt controller "host" data structure. This could be defined as a | ||
51 | * irq domain controller. That is, it handles the mapping between hardware | ||
52 | * and virtual interrupt numbers for a given interrupt domain. The host | ||
53 | * structure is generally created by the PIC code for a given PIC instance | ||
54 | * (though a host can cover more than one PIC if they have a flat number | ||
55 | * model). It's the host callbacks that are responsible for setting the | ||
56 | * irq_chip on a given irq_desc after it's been mapped. | ||
57 | * | ||
58 | * The host code and data structures are fairly agnostic to the fact that | ||
59 | * we use an open firmware device-tree. We do have references to struct | ||
60 | * device_node in two places: in irq_find_host() to find the host matching | ||
61 | * a given interrupt controller node, and of course as an argument to its | ||
62 | * counterpart host->ops->match() callback. However, those are treated as | ||
63 | * generic pointers by the core and the fact that it's actually a device-node | ||
64 | * pointer is purely a convention between callers and implementation. This | ||
65 | * code could thus be used on other architectures by replacing those two | ||
66 | * by some sort of arch-specific void * "token" used to identify interrupt | ||
67 | * controllers. | ||
68 | */ | ||
69 | struct irq_host; | ||
70 | struct radix_tree_root; | ||
71 | struct device_node; | ||
72 | |||
73 | /* Functions below are provided by the host and called whenever a new mapping | ||
74 | * is created or an old mapping is disposed. The host can then proceed to | ||
75 | * whatever internal data structures management is required. It also needs | ||
76 | * to setup the irq_desc when returning from map(). | ||
77 | */ | ||
78 | struct irq_host_ops { | ||
79 | /* Match an interrupt controller device node to a host, returns | ||
80 | * 1 on a match | ||
81 | */ | ||
82 | int (*match)(struct irq_host *h, struct device_node *node); | ||
83 | |||
84 | /* Create or update a mapping between a virtual irq number and a hw | ||
85 | * irq number. This is called only once for a given mapping. | ||
86 | */ | ||
87 | int (*map)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw); | ||
88 | |||
89 | /* Dispose of such a mapping */ | ||
90 | void (*unmap)(struct irq_host *h, unsigned int virq); | ||
91 | |||
92 | /* Translate device-tree interrupt specifier from raw format coming | ||
93 | * from the firmware to a irq_hw_number_t (interrupt line number) and | ||
94 | * type (sense) that can be passed to set_irq_type(). In the absence | ||
95 | * of this callback, irq_create_of_mapping() and irq_of_parse_and_map() | ||
96 | * will return the hw number in the first cell and IRQ_TYPE_NONE for | ||
97 | * the type (which amount to keeping whatever default value the | ||
98 | * interrupt controller has for that line) | ||
99 | */ | ||
100 | int (*xlate)(struct irq_host *h, struct device_node *ctrler, | ||
101 | const u32 *intspec, unsigned int intsize, | ||
102 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
103 | }; | ||
104 | |||
105 | struct irq_host { | ||
106 | struct list_head link; | ||
107 | |||
108 | /* type of reverse mapping technique */ | ||
109 | unsigned int revmap_type; | ||
110 | #define IRQ_HOST_MAP_PRIORITY 0 /* core priority irqs, get irqs 1..15 */ | ||
111 | #define IRQ_HOST_MAP_NOMAP 1 /* no fast reverse mapping */ | ||
112 | #define IRQ_HOST_MAP_LINEAR 2 /* linear map of interrupts */ | ||
113 | #define IRQ_HOST_MAP_TREE 3 /* radix tree */ | ||
114 | union { | ||
115 | struct { | ||
116 | unsigned int size; | ||
117 | unsigned int *revmap; | ||
118 | } linear; | ||
119 | struct radix_tree_root tree; | ||
120 | } revmap_data; | ||
121 | struct irq_host_ops *ops; | ||
122 | void *host_data; | ||
123 | irq_hw_number_t inval_irq; | ||
124 | |||
125 | /* Optional device node pointer */ | ||
126 | struct device_node *of_node; | ||
127 | }; | ||
128 | |||
129 | struct irq_data; | 45 | struct irq_data; |
130 | extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); | 46 | extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); |
131 | extern irq_hw_number_t virq_to_hw(unsigned int virq); | 47 | extern irq_hw_number_t virq_to_hw(unsigned int virq); |
132 | extern bool virq_is_host(unsigned int virq, struct irq_host *host); | ||
133 | |||
134 | /** | ||
135 | * irq_alloc_host - Allocate a new irq_host data structure | ||
136 | * @of_node: optional device-tree node of the interrupt controller | ||
137 | * @revmap_type: type of reverse mapping to use | ||
138 | * @revmap_arg: for IRQ_HOST_MAP_LINEAR linear only: size of the map | ||
139 | * @ops: map/unmap host callbacks | ||
140 | * @inval_irq: provide a hw number in that host space that is always invalid | ||
141 | * | ||
142 | * Allocates and initialize and irq_host structure. Note that in the case of | ||
143 | * IRQ_HOST_MAP_LEGACY, the map() callback will be called before this returns | ||
144 | * for all legacy interrupts except 0 (which is always the invalid irq for | ||
145 | * a legacy controller). For a IRQ_HOST_MAP_LINEAR, the map is allocated by | ||
146 | * this call as well. For a IRQ_HOST_MAP_TREE, the radix tree will be allocated | ||
147 | * later during boot automatically (the reverse mapping will use the slow path | ||
148 | * until that happens). | ||
149 | */ | ||
150 | extern struct irq_host *irq_alloc_host(struct device_node *of_node, | ||
151 | unsigned int revmap_type, | ||
152 | unsigned int revmap_arg, | ||
153 | struct irq_host_ops *ops, | ||
154 | irq_hw_number_t inval_irq); | ||
155 | |||
156 | |||
157 | /** | ||
158 | * irq_find_host - Locates a host for a given device node | ||
159 | * @node: device-tree node of the interrupt controller | ||
160 | */ | ||
161 | extern struct irq_host *irq_find_host(struct device_node *node); | ||
162 | |||
163 | |||
164 | /** | ||
165 | * irq_set_default_host - Set a "default" host | ||
166 | * @host: default host pointer | ||
167 | * | ||
168 | * For convenience, it's possible to set a "default" host that will be used | ||
169 | * whenever NULL is passed to irq_create_mapping(). It makes life easier for | ||
170 | * platforms that want to manipulate a few hard coded interrupt numbers that | ||
171 | * aren't properly represented in the device-tree. | ||
172 | */ | ||
173 | extern void irq_set_default_host(struct irq_host *host); | ||
174 | |||
175 | |||
176 | /** | ||
177 | * irq_set_virq_count - Set the maximum number of virt irqs | ||
178 | * @count: number of linux virtual irqs, capped with NR_IRQS | ||
179 | * | ||
180 | * This is mainly for use by platforms like iSeries who want to program | ||
181 | * the virtual irq number in the controller to avoid the reverse mapping | ||
182 | */ | ||
183 | extern void irq_set_virq_count(unsigned int count); | ||
184 | |||
185 | |||
186 | /** | ||
187 | * irq_create_mapping - Map a hardware interrupt into linux virq space | ||
188 | * @host: host owning this hardware interrupt or NULL for default host | ||
189 | * @hwirq: hardware irq number in that host space | ||
190 | * | ||
191 | * Only one mapping per hardware interrupt is permitted. Returns a linux | ||
192 | * virq number. | ||
193 | * If the sense/trigger is to be specified, set_irq_type() should be called | ||
194 | * on the number returned from that call. | ||
195 | */ | ||
196 | extern unsigned int irq_create_mapping(struct irq_host *host, | ||
197 | irq_hw_number_t hwirq); | ||
198 | |||
199 | |||
200 | /** | ||
201 | * irq_dispose_mapping - Unmap an interrupt | ||
202 | * @virq: linux virq number of the interrupt to unmap | ||
203 | */ | ||
204 | extern void irq_dispose_mapping(unsigned int virq); | ||
205 | |||
206 | /** | ||
207 | * irq_find_mapping - Find a linux virq from an hw irq number. | ||
208 | * @host: host owning this hardware interrupt | ||
209 | * @hwirq: hardware irq number in that host space | ||
210 | * | ||
211 | * This is a slow path, for use by generic code. It's expected that an | ||
212 | * irq controller implementation directly calls the appropriate low level | ||
213 | * mapping function. | ||
214 | */ | ||
215 | extern unsigned int irq_find_mapping(struct irq_host *host, | ||
216 | irq_hw_number_t hwirq); | ||
217 | |||
218 | /** | ||
219 | * irq_create_direct_mapping - Allocate a virq for direct mapping | ||
220 | * @host: host to allocate the virq for or NULL for default host | ||
221 | * | ||
222 | * This routine is used for irq controllers which can choose the hardware | ||
223 | * interrupt numbers they generate. In such a case it's simplest to use | ||
224 | * the linux virq as the hardware interrupt number. | ||
225 | */ | ||
226 | extern unsigned int irq_create_direct_mapping(struct irq_host *host); | ||
227 | |||
228 | /** | ||
229 | * irq_radix_revmap_insert - Insert a hw irq to linux virq number mapping. | ||
230 | * @host: host owning this hardware interrupt | ||
231 | * @virq: linux irq number | ||
232 | * @hwirq: hardware irq number in that host space | ||
233 | * | ||
234 | * This is for use by irq controllers that use a radix tree reverse | ||
235 | * mapping for fast lookup. | ||
236 | */ | ||
237 | extern void irq_radix_revmap_insert(struct irq_host *host, unsigned int virq, | ||
238 | irq_hw_number_t hwirq); | ||
239 | |||
240 | /** | ||
241 | * irq_radix_revmap_lookup - Find a linux virq from a hw irq number. | ||
242 | * @host: host owning this hardware interrupt | ||
243 | * @hwirq: hardware irq number in that host space | ||
244 | * | ||
245 | * This is a fast path, for use by irq controller code that uses radix tree | ||
246 | * revmaps | ||
247 | */ | ||
248 | extern unsigned int irq_radix_revmap_lookup(struct irq_host *host, | ||
249 | irq_hw_number_t hwirq); | ||
250 | |||
251 | /** | ||
252 | * irq_linear_revmap - Find a linux virq from a hw irq number. | ||
253 | * @host: host owning this hardware interrupt | ||
254 | * @hwirq: hardware irq number in that host space | ||
255 | * | ||
256 | * This is a fast path, for use by irq controller code that uses linear | ||
257 | * revmaps. It does fallback to the slow path if the revmap doesn't exist | ||
258 | * yet and will create the revmap entry with appropriate locking | ||
259 | */ | ||
260 | |||
261 | extern unsigned int irq_linear_revmap(struct irq_host *host, | ||
262 | irq_hw_number_t hwirq); | ||
263 | |||
264 | |||
265 | |||
266 | /** | ||
267 | * irq_alloc_virt - Allocate virtual irq numbers | ||
268 | * @host: host owning these new virtual irqs | ||
269 | * @count: number of consecutive numbers to allocate | ||
270 | * @hint: pass a hint number, the allocator will try to use a 1:1 mapping | ||
271 | * | ||
272 | * This is a low level function that is used internally by irq_create_mapping() | ||
273 | * and that can be used by some irq controllers implementations for things | ||
274 | * like allocating ranges of numbers for MSIs. The revmaps are left untouched. | ||
275 | */ | ||
276 | extern unsigned int irq_alloc_virt(struct irq_host *host, | ||
277 | unsigned int count, | ||
278 | unsigned int hint); | ||
279 | |||
280 | /** | ||
281 | * irq_free_virt - Free virtual irq numbers | ||
282 | * @virq: virtual irq number of the first interrupt to free | ||
283 | * @count: number of interrupts to free | ||
284 | * | ||
285 | * This function is the opposite of irq_alloc_virt. It will not clear reverse | ||
286 | * maps, this should be done previously by unmap'ing the interrupt. In fact, | ||
287 | * all interrupts covered by the range being freed should have been unmapped | ||
288 | * prior to calling this. | ||
289 | */ | ||
290 | extern void irq_free_virt(unsigned int virq, unsigned int count); | ||
291 | 48 | ||
292 | extern void __init init_pic_c64xplus(void); | 49 | extern void __init init_pic_c64xplus(void); |
293 | 50 | ||
diff --git a/arch/c6x/kernel/irq.c b/arch/c6x/kernel/irq.c index 0929e4b2b244..d77bcfdf0d8e 100644 --- a/arch/c6x/kernel/irq.c +++ b/arch/c6x/kernel/irq.c | |||
@@ -73,10 +73,10 @@ asmlinkage void c6x_do_IRQ(unsigned int prio, struct pt_regs *regs) | |||
73 | set_irq_regs(old_regs); | 73 | set_irq_regs(old_regs); |
74 | } | 74 | } |
75 | 75 | ||
76 | static struct irq_host *core_host; | 76 | static struct irq_domain *core_domain; |
77 | 77 | ||
78 | static int core_host_map(struct irq_host *h, unsigned int virq, | 78 | static int core_domain_map(struct irq_domain *h, unsigned int virq, |
79 | irq_hw_number_t hw) | 79 | irq_hw_number_t hw) |
80 | { | 80 | { |
81 | if (hw < 4 || hw >= NR_PRIORITY_IRQS) | 81 | if (hw < 4 || hw >= NR_PRIORITY_IRQS) |
82 | return -EINVAL; | 82 | return -EINVAL; |
@@ -86,8 +86,9 @@ static int core_host_map(struct irq_host *h, unsigned int virq, | |||
86 | return 0; | 86 | return 0; |
87 | } | 87 | } |
88 | 88 | ||
89 | static struct irq_host_ops core_host_ops = { | 89 | static const struct irq_domain_ops core_domain_ops = { |
90 | .map = core_host_map, | 90 | .map = core_domain_map, |
91 | .xlate = irq_domain_xlate_onecell, | ||
91 | }; | 92 | }; |
92 | 93 | ||
93 | void __init init_IRQ(void) | 94 | void __init init_IRQ(void) |
@@ -100,10 +101,11 @@ void __init init_IRQ(void) | |||
100 | np = of_find_compatible_node(NULL, NULL, "ti,c64x+core-pic"); | 101 | np = of_find_compatible_node(NULL, NULL, "ti,c64x+core-pic"); |
101 | if (np != NULL) { | 102 | if (np != NULL) { |
102 | /* create the core host */ | 103 | /* create the core host */ |
103 | core_host = irq_alloc_host(np, IRQ_HOST_MAP_PRIORITY, 0, | 104 | core_domain = irq_domain_add_legacy(np, NR_PRIORITY_IRQS, |
104 | &core_host_ops, 0); | 105 | 0, 0, &core_domain_ops, |
105 | if (core_host) | 106 | NULL); |
106 | irq_set_default_host(core_host); | 107 | if (core_domain) |
108 | irq_set_default_host(core_domain); | ||
107 | of_node_put(np); | 109 | of_node_put(np); |
108 | } | 110 | } |
109 | 111 | ||
@@ -128,601 +130,15 @@ int arch_show_interrupts(struct seq_file *p, int prec) | |||
128 | return 0; | 130 | return 0; |
129 | } | 131 | } |
130 | 132 | ||
131 | /* | ||
132 | * IRQ controller and virtual interrupts | ||
133 | */ | ||
134 | |||
135 | /* The main irq map itself is an array of NR_IRQ entries containing the | ||
136 | * associate host and irq number. An entry with a host of NULL is free. | ||
137 | * An entry can be allocated if it's free, the allocator always then sets | ||
138 | * hwirq first to the host's invalid irq number and then fills ops. | ||
139 | */ | ||
140 | struct irq_map_entry { | ||
141 | irq_hw_number_t hwirq; | ||
142 | struct irq_host *host; | ||
143 | }; | ||
144 | |||
145 | static LIST_HEAD(irq_hosts); | ||
146 | static DEFINE_RAW_SPINLOCK(irq_big_lock); | ||
147 | static DEFINE_MUTEX(revmap_trees_mutex); | ||
148 | static struct irq_map_entry irq_map[NR_IRQS]; | ||
149 | static unsigned int irq_virq_count = NR_IRQS; | ||
150 | static struct irq_host *irq_default_host; | ||
151 | |||
152 | irq_hw_number_t irqd_to_hwirq(struct irq_data *d) | 133 | irq_hw_number_t irqd_to_hwirq(struct irq_data *d) |
153 | { | 134 | { |
154 | return irq_map[d->irq].hwirq; | 135 | return d->hwirq; |
155 | } | 136 | } |
156 | EXPORT_SYMBOL_GPL(irqd_to_hwirq); | 137 | EXPORT_SYMBOL_GPL(irqd_to_hwirq); |
157 | 138 | ||
158 | irq_hw_number_t virq_to_hw(unsigned int virq) | 139 | irq_hw_number_t virq_to_hw(unsigned int virq) |
159 | { | 140 | { |
160 | return irq_map[virq].hwirq; | 141 | struct irq_data *irq_data = irq_get_irq_data(virq); |
142 | return WARN_ON(!irq_data) ? 0 : irq_data->hwirq; | ||
161 | } | 143 | } |
162 | EXPORT_SYMBOL_GPL(virq_to_hw); | 144 | EXPORT_SYMBOL_GPL(virq_to_hw); |
163 | |||
164 | bool virq_is_host(unsigned int virq, struct irq_host *host) | ||
165 | { | ||
166 | return irq_map[virq].host == host; | ||
167 | } | ||
168 | EXPORT_SYMBOL_GPL(virq_is_host); | ||
169 | |||
170 | static int default_irq_host_match(struct irq_host *h, struct device_node *np) | ||
171 | { | ||
172 | return h->of_node != NULL && h->of_node == np; | ||
173 | } | ||
174 | |||
175 | struct irq_host *irq_alloc_host(struct device_node *of_node, | ||
176 | unsigned int revmap_type, | ||
177 | unsigned int revmap_arg, | ||
178 | struct irq_host_ops *ops, | ||
179 | irq_hw_number_t inval_irq) | ||
180 | { | ||
181 | struct irq_host *host; | ||
182 | unsigned int size = sizeof(struct irq_host); | ||
183 | unsigned int i; | ||
184 | unsigned int *rmap; | ||
185 | unsigned long flags; | ||
186 | |||
187 | /* Allocate structure and revmap table if using linear mapping */ | ||
188 | if (revmap_type == IRQ_HOST_MAP_LINEAR) | ||
189 | size += revmap_arg * sizeof(unsigned int); | ||
190 | host = kzalloc(size, GFP_KERNEL); | ||
191 | if (host == NULL) | ||
192 | return NULL; | ||
193 | |||
194 | /* Fill structure */ | ||
195 | host->revmap_type = revmap_type; | ||
196 | host->inval_irq = inval_irq; | ||
197 | host->ops = ops; | ||
198 | host->of_node = of_node_get(of_node); | ||
199 | |||
200 | if (host->ops->match == NULL) | ||
201 | host->ops->match = default_irq_host_match; | ||
202 | |||
203 | raw_spin_lock_irqsave(&irq_big_lock, flags); | ||
204 | |||
205 | /* Check for the priority controller. */ | ||
206 | if (revmap_type == IRQ_HOST_MAP_PRIORITY) { | ||
207 | if (irq_map[0].host != NULL) { | ||
208 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
209 | of_node_put(host->of_node); | ||
210 | kfree(host); | ||
211 | return NULL; | ||
212 | } | ||
213 | irq_map[0].host = host; | ||
214 | } | ||
215 | |||
216 | list_add(&host->link, &irq_hosts); | ||
217 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
218 | |||
219 | /* Additional setups per revmap type */ | ||
220 | switch (revmap_type) { | ||
221 | case IRQ_HOST_MAP_PRIORITY: | ||
222 | /* 0 is always the invalid number for priority */ | ||
223 | host->inval_irq = 0; | ||
224 | /* setup us as the host for all priority interrupts */ | ||
225 | for (i = 1; i < NR_PRIORITY_IRQS; i++) { | ||
226 | irq_map[i].hwirq = i; | ||
227 | smp_wmb(); | ||
228 | irq_map[i].host = host; | ||
229 | smp_wmb(); | ||
230 | |||
231 | ops->map(host, i, i); | ||
232 | } | ||
233 | break; | ||
234 | case IRQ_HOST_MAP_LINEAR: | ||
235 | rmap = (unsigned int *)(host + 1); | ||
236 | for (i = 0; i < revmap_arg; i++) | ||
237 | rmap[i] = NO_IRQ; | ||
238 | host->revmap_data.linear.size = revmap_arg; | ||
239 | smp_wmb(); | ||
240 | host->revmap_data.linear.revmap = rmap; | ||
241 | break; | ||
242 | case IRQ_HOST_MAP_TREE: | ||
243 | INIT_RADIX_TREE(&host->revmap_data.tree, GFP_KERNEL); | ||
244 | break; | ||
245 | default: | ||
246 | break; | ||
247 | } | ||
248 | |||
249 | pr_debug("irq: Allocated host of type %d @0x%p\n", revmap_type, host); | ||
250 | |||
251 | return host; | ||
252 | } | ||
253 | |||
254 | struct irq_host *irq_find_host(struct device_node *node) | ||
255 | { | ||
256 | struct irq_host *h, *found = NULL; | ||
257 | unsigned long flags; | ||
258 | |||
259 | /* We might want to match the legacy controller last since | ||
260 | * it might potentially be set to match all interrupts in | ||
261 | * the absence of a device node. This isn't a problem so far | ||
262 | * yet though... | ||
263 | */ | ||
264 | raw_spin_lock_irqsave(&irq_big_lock, flags); | ||
265 | list_for_each_entry(h, &irq_hosts, link) | ||
266 | if (h->ops->match(h, node)) { | ||
267 | found = h; | ||
268 | break; | ||
269 | } | ||
270 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
271 | return found; | ||
272 | } | ||
273 | EXPORT_SYMBOL_GPL(irq_find_host); | ||
274 | |||
275 | void irq_set_default_host(struct irq_host *host) | ||
276 | { | ||
277 | pr_debug("irq: Default host set to @0x%p\n", host); | ||
278 | |||
279 | irq_default_host = host; | ||
280 | } | ||
281 | |||
282 | void irq_set_virq_count(unsigned int count) | ||
283 | { | ||
284 | pr_debug("irq: Trying to set virq count to %d\n", count); | ||
285 | |||
286 | BUG_ON(count < NR_PRIORITY_IRQS); | ||
287 | if (count < NR_IRQS) | ||
288 | irq_virq_count = count; | ||
289 | } | ||
290 | |||
291 | static int irq_setup_virq(struct irq_host *host, unsigned int virq, | ||
292 | irq_hw_number_t hwirq) | ||
293 | { | ||
294 | int res; | ||
295 | |||
296 | res = irq_alloc_desc_at(virq, 0); | ||
297 | if (res != virq) { | ||
298 | pr_debug("irq: -> allocating desc failed\n"); | ||
299 | goto error; | ||
300 | } | ||
301 | |||
302 | /* map it */ | ||
303 | smp_wmb(); | ||
304 | irq_map[virq].hwirq = hwirq; | ||
305 | smp_mb(); | ||
306 | |||
307 | if (host->ops->map(host, virq, hwirq)) { | ||
308 | pr_debug("irq: -> mapping failed, freeing\n"); | ||
309 | goto errdesc; | ||
310 | } | ||
311 | |||
312 | irq_clear_status_flags(virq, IRQ_NOREQUEST); | ||
313 | |||
314 | return 0; | ||
315 | |||
316 | errdesc: | ||
317 | irq_free_descs(virq, 1); | ||
318 | error: | ||
319 | irq_free_virt(virq, 1); | ||
320 | return -1; | ||
321 | } | ||
322 | |||
323 | unsigned int irq_create_direct_mapping(struct irq_host *host) | ||
324 | { | ||
325 | unsigned int virq; | ||
326 | |||
327 | if (host == NULL) | ||
328 | host = irq_default_host; | ||
329 | |||
330 | BUG_ON(host == NULL); | ||
331 | WARN_ON(host->revmap_type != IRQ_HOST_MAP_NOMAP); | ||
332 | |||
333 | virq = irq_alloc_virt(host, 1, 0); | ||
334 | if (virq == NO_IRQ) { | ||
335 | pr_debug("irq: create_direct virq allocation failed\n"); | ||
336 | return NO_IRQ; | ||
337 | } | ||
338 | |||
339 | pr_debug("irq: create_direct obtained virq %d\n", virq); | ||
340 | |||
341 | if (irq_setup_virq(host, virq, virq)) | ||
342 | return NO_IRQ; | ||
343 | |||
344 | return virq; | ||
345 | } | ||
346 | |||
347 | unsigned int irq_create_mapping(struct irq_host *host, | ||
348 | irq_hw_number_t hwirq) | ||
349 | { | ||
350 | unsigned int virq, hint; | ||
351 | |||
352 | pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", host, hwirq); | ||
353 | |||
354 | /* Look for default host if nececssary */ | ||
355 | if (host == NULL) | ||
356 | host = irq_default_host; | ||
357 | if (host == NULL) { | ||
358 | printk(KERN_WARNING "irq_create_mapping called for" | ||
359 | " NULL host, hwirq=%lx\n", hwirq); | ||
360 | WARN_ON(1); | ||
361 | return NO_IRQ; | ||
362 | } | ||
363 | pr_debug("irq: -> using host @%p\n", host); | ||
364 | |||
365 | /* Check if mapping already exists */ | ||
366 | virq = irq_find_mapping(host, hwirq); | ||
367 | if (virq != NO_IRQ) { | ||
368 | pr_debug("irq: -> existing mapping on virq %d\n", virq); | ||
369 | return virq; | ||
370 | } | ||
371 | |||
372 | /* Allocate a virtual interrupt number */ | ||
373 | hint = hwirq % irq_virq_count; | ||
374 | virq = irq_alloc_virt(host, 1, hint); | ||
375 | if (virq == NO_IRQ) { | ||
376 | pr_debug("irq: -> virq allocation failed\n"); | ||
377 | return NO_IRQ; | ||
378 | } | ||
379 | |||
380 | if (irq_setup_virq(host, virq, hwirq)) | ||
381 | return NO_IRQ; | ||
382 | |||
383 | pr_debug("irq: irq %lu on host %s mapped to virtual irq %u\n", | ||
384 | hwirq, host->of_node ? host->of_node->full_name : "null", virq); | ||
385 | |||
386 | return virq; | ||
387 | } | ||
388 | EXPORT_SYMBOL_GPL(irq_create_mapping); | ||
389 | |||
390 | unsigned int irq_create_of_mapping(struct device_node *controller, | ||
391 | const u32 *intspec, unsigned int intsize) | ||
392 | { | ||
393 | struct irq_host *host; | ||
394 | irq_hw_number_t hwirq; | ||
395 | unsigned int type = IRQ_TYPE_NONE; | ||
396 | unsigned int virq; | ||
397 | |||
398 | if (controller == NULL) | ||
399 | host = irq_default_host; | ||
400 | else | ||
401 | host = irq_find_host(controller); | ||
402 | if (host == NULL) { | ||
403 | printk(KERN_WARNING "irq: no irq host found for %s !\n", | ||
404 | controller->full_name); | ||
405 | return NO_IRQ; | ||
406 | } | ||
407 | |||
408 | /* If host has no translation, then we assume interrupt line */ | ||
409 | if (host->ops->xlate == NULL) | ||
410 | hwirq = intspec[0]; | ||
411 | else { | ||
412 | if (host->ops->xlate(host, controller, intspec, intsize, | ||
413 | &hwirq, &type)) | ||
414 | return NO_IRQ; | ||
415 | } | ||
416 | |||
417 | /* Create mapping */ | ||
418 | virq = irq_create_mapping(host, hwirq); | ||
419 | if (virq == NO_IRQ) | ||
420 | return virq; | ||
421 | |||
422 | /* Set type if specified and different than the current one */ | ||
423 | if (type != IRQ_TYPE_NONE && | ||
424 | type != (irqd_get_trigger_type(irq_get_irq_data(virq)))) | ||
425 | irq_set_irq_type(virq, type); | ||
426 | return virq; | ||
427 | } | ||
428 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | ||
429 | |||
430 | void irq_dispose_mapping(unsigned int virq) | ||
431 | { | ||
432 | struct irq_host *host; | ||
433 | irq_hw_number_t hwirq; | ||
434 | |||
435 | if (virq == NO_IRQ) | ||
436 | return; | ||
437 | |||
438 | /* Never unmap priority interrupts */ | ||
439 | if (virq < NR_PRIORITY_IRQS) | ||
440 | return; | ||
441 | |||
442 | host = irq_map[virq].host; | ||
443 | if (WARN_ON(host == NULL)) | ||
444 | return; | ||
445 | |||
446 | irq_set_status_flags(virq, IRQ_NOREQUEST); | ||
447 | |||
448 | /* remove chip and handler */ | ||
449 | irq_set_chip_and_handler(virq, NULL, NULL); | ||
450 | |||
451 | /* Make sure it's completed */ | ||
452 | synchronize_irq(virq); | ||
453 | |||
454 | /* Tell the PIC about it */ | ||
455 | if (host->ops->unmap) | ||
456 | host->ops->unmap(host, virq); | ||
457 | smp_mb(); | ||
458 | |||
459 | /* Clear reverse map */ | ||
460 | hwirq = irq_map[virq].hwirq; | ||
461 | switch (host->revmap_type) { | ||
462 | case IRQ_HOST_MAP_LINEAR: | ||
463 | if (hwirq < host->revmap_data.linear.size) | ||
464 | host->revmap_data.linear.revmap[hwirq] = NO_IRQ; | ||
465 | break; | ||
466 | case IRQ_HOST_MAP_TREE: | ||
467 | mutex_lock(&revmap_trees_mutex); | ||
468 | radix_tree_delete(&host->revmap_data.tree, hwirq); | ||
469 | mutex_unlock(&revmap_trees_mutex); | ||
470 | break; | ||
471 | } | ||
472 | |||
473 | /* Destroy map */ | ||
474 | smp_mb(); | ||
475 | irq_map[virq].hwirq = host->inval_irq; | ||
476 | |||
477 | irq_free_descs(virq, 1); | ||
478 | /* Free it */ | ||
479 | irq_free_virt(virq, 1); | ||
480 | } | ||
481 | EXPORT_SYMBOL_GPL(irq_dispose_mapping); | ||
482 | |||
483 | unsigned int irq_find_mapping(struct irq_host *host, | ||
484 | irq_hw_number_t hwirq) | ||
485 | { | ||
486 | unsigned int i; | ||
487 | unsigned int hint = hwirq % irq_virq_count; | ||
488 | |||
489 | /* Look for default host if nececssary */ | ||
490 | if (host == NULL) | ||
491 | host = irq_default_host; | ||
492 | if (host == NULL) | ||
493 | return NO_IRQ; | ||
494 | |||
495 | /* Slow path does a linear search of the map */ | ||
496 | i = hint; | ||
497 | do { | ||
498 | if (irq_map[i].host == host && | ||
499 | irq_map[i].hwirq == hwirq) | ||
500 | return i; | ||
501 | i++; | ||
502 | if (i >= irq_virq_count) | ||
503 | i = 4; | ||
504 | } while (i != hint); | ||
505 | return NO_IRQ; | ||
506 | } | ||
507 | EXPORT_SYMBOL_GPL(irq_find_mapping); | ||
508 | |||
509 | unsigned int irq_radix_revmap_lookup(struct irq_host *host, | ||
510 | irq_hw_number_t hwirq) | ||
511 | { | ||
512 | struct irq_map_entry *ptr; | ||
513 | unsigned int virq; | ||
514 | |||
515 | if (WARN_ON_ONCE(host->revmap_type != IRQ_HOST_MAP_TREE)) | ||
516 | return irq_find_mapping(host, hwirq); | ||
517 | |||
518 | /* | ||
519 | * The ptr returned references the static global irq_map. | ||
520 | * but freeing an irq can delete nodes along the path to | ||
521 | * do the lookup via call_rcu. | ||
522 | */ | ||
523 | rcu_read_lock(); | ||
524 | ptr = radix_tree_lookup(&host->revmap_data.tree, hwirq); | ||
525 | rcu_read_unlock(); | ||
526 | |||
527 | /* | ||
528 | * If found in radix tree, then fine. | ||
529 | * Else fallback to linear lookup - this should not happen in practice | ||
530 | * as it means that we failed to insert the node in the radix tree. | ||
531 | */ | ||
532 | if (ptr) | ||
533 | virq = ptr - irq_map; | ||
534 | else | ||
535 | virq = irq_find_mapping(host, hwirq); | ||
536 | |||
537 | return virq; | ||
538 | } | ||
539 | |||
540 | void irq_radix_revmap_insert(struct irq_host *host, unsigned int virq, | ||
541 | irq_hw_number_t hwirq) | ||
542 | { | ||
543 | if (WARN_ON(host->revmap_type != IRQ_HOST_MAP_TREE)) | ||
544 | return; | ||
545 | |||
546 | if (virq != NO_IRQ) { | ||
547 | mutex_lock(&revmap_trees_mutex); | ||
548 | radix_tree_insert(&host->revmap_data.tree, hwirq, | ||
549 | &irq_map[virq]); | ||
550 | mutex_unlock(&revmap_trees_mutex); | ||
551 | } | ||
552 | } | ||
553 | |||
554 | unsigned int irq_linear_revmap(struct irq_host *host, | ||
555 | irq_hw_number_t hwirq) | ||
556 | { | ||
557 | unsigned int *revmap; | ||
558 | |||
559 | if (WARN_ON_ONCE(host->revmap_type != IRQ_HOST_MAP_LINEAR)) | ||
560 | return irq_find_mapping(host, hwirq); | ||
561 | |||
562 | /* Check revmap bounds */ | ||
563 | if (unlikely(hwirq >= host->revmap_data.linear.size)) | ||
564 | return irq_find_mapping(host, hwirq); | ||
565 | |||
566 | /* Check if revmap was allocated */ | ||
567 | revmap = host->revmap_data.linear.revmap; | ||
568 | if (unlikely(revmap == NULL)) | ||
569 | return irq_find_mapping(host, hwirq); | ||
570 | |||
571 | /* Fill up revmap with slow path if no mapping found */ | ||
572 | if (unlikely(revmap[hwirq] == NO_IRQ)) | ||
573 | revmap[hwirq] = irq_find_mapping(host, hwirq); | ||
574 | |||
575 | return revmap[hwirq]; | ||
576 | } | ||
577 | |||
578 | unsigned int irq_alloc_virt(struct irq_host *host, | ||
579 | unsigned int count, | ||
580 | unsigned int hint) | ||
581 | { | ||
582 | unsigned long flags; | ||
583 | unsigned int i, j, found = NO_IRQ; | ||
584 | |||
585 | if (count == 0 || count > (irq_virq_count - NR_PRIORITY_IRQS)) | ||
586 | return NO_IRQ; | ||
587 | |||
588 | raw_spin_lock_irqsave(&irq_big_lock, flags); | ||
589 | |||
590 | /* Use hint for 1 interrupt if any */ | ||
591 | if (count == 1 && hint >= NR_PRIORITY_IRQS && | ||
592 | hint < irq_virq_count && irq_map[hint].host == NULL) { | ||
593 | found = hint; | ||
594 | goto hint_found; | ||
595 | } | ||
596 | |||
597 | /* Look for count consecutive numbers in the allocatable | ||
598 | * (non-legacy) space | ||
599 | */ | ||
600 | for (i = NR_PRIORITY_IRQS, j = 0; i < irq_virq_count; i++) { | ||
601 | if (irq_map[i].host != NULL) | ||
602 | j = 0; | ||
603 | else | ||
604 | j++; | ||
605 | |||
606 | if (j == count) { | ||
607 | found = i - count + 1; | ||
608 | break; | ||
609 | } | ||
610 | } | ||
611 | if (found == NO_IRQ) { | ||
612 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
613 | return NO_IRQ; | ||
614 | } | ||
615 | hint_found: | ||
616 | for (i = found; i < (found + count); i++) { | ||
617 | irq_map[i].hwirq = host->inval_irq; | ||
618 | smp_wmb(); | ||
619 | irq_map[i].host = host; | ||
620 | } | ||
621 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
622 | return found; | ||
623 | } | ||
624 | |||
625 | void irq_free_virt(unsigned int virq, unsigned int count) | ||
626 | { | ||
627 | unsigned long flags; | ||
628 | unsigned int i; | ||
629 | |||
630 | WARN_ON(virq < NR_PRIORITY_IRQS); | ||
631 | WARN_ON(count == 0 || (virq + count) > irq_virq_count); | ||
632 | |||
633 | if (virq < NR_PRIORITY_IRQS) { | ||
634 | if (virq + count < NR_PRIORITY_IRQS) | ||
635 | return; | ||
636 | count -= NR_PRIORITY_IRQS - virq; | ||
637 | virq = NR_PRIORITY_IRQS; | ||
638 | } | ||
639 | |||
640 | if (count > irq_virq_count || virq > irq_virq_count - count) { | ||
641 | if (virq > irq_virq_count) | ||
642 | return; | ||
643 | count = irq_virq_count - virq; | ||
644 | } | ||
645 | |||
646 | raw_spin_lock_irqsave(&irq_big_lock, flags); | ||
647 | for (i = virq; i < (virq + count); i++) { | ||
648 | struct irq_host *host; | ||
649 | |||
650 | host = irq_map[i].host; | ||
651 | irq_map[i].hwirq = host->inval_irq; | ||
652 | smp_wmb(); | ||
653 | irq_map[i].host = NULL; | ||
654 | } | ||
655 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
656 | } | ||
657 | |||
658 | #ifdef CONFIG_VIRQ_DEBUG | ||
659 | static int virq_debug_show(struct seq_file *m, void *private) | ||
660 | { | ||
661 | unsigned long flags; | ||
662 | struct irq_desc *desc; | ||
663 | const char *p; | ||
664 | static const char none[] = "none"; | ||
665 | void *data; | ||
666 | int i; | ||
667 | |||
668 | seq_printf(m, "%-5s %-7s %-15s %-18s %s\n", "virq", "hwirq", | ||
669 | "chip name", "chip data", "host name"); | ||
670 | |||
671 | for (i = 1; i < nr_irqs; i++) { | ||
672 | desc = irq_to_desc(i); | ||
673 | if (!desc) | ||
674 | continue; | ||
675 | |||
676 | raw_spin_lock_irqsave(&desc->lock, flags); | ||
677 | |||
678 | if (desc->action && desc->action->handler) { | ||
679 | struct irq_chip *chip; | ||
680 | |||
681 | seq_printf(m, "%5d ", i); | ||
682 | seq_printf(m, "0x%05lx ", irq_map[i].hwirq); | ||
683 | |||
684 | chip = irq_desc_get_chip(desc); | ||
685 | if (chip && chip->name) | ||
686 | p = chip->name; | ||
687 | else | ||
688 | p = none; | ||
689 | seq_printf(m, "%-15s ", p); | ||
690 | |||
691 | data = irq_desc_get_chip_data(desc); | ||
692 | seq_printf(m, "0x%16p ", data); | ||
693 | |||
694 | if (irq_map[i].host && irq_map[i].host->of_node) | ||
695 | p = irq_map[i].host->of_node->full_name; | ||
696 | else | ||
697 | p = none; | ||
698 | seq_printf(m, "%s\n", p); | ||
699 | } | ||
700 | |||
701 | raw_spin_unlock_irqrestore(&desc->lock, flags); | ||
702 | } | ||
703 | |||
704 | return 0; | ||
705 | } | ||
706 | |||
707 | static int virq_debug_open(struct inode *inode, struct file *file) | ||
708 | { | ||
709 | return single_open(file, virq_debug_show, inode->i_private); | ||
710 | } | ||
711 | |||
712 | static const struct file_operations virq_debug_fops = { | ||
713 | .open = virq_debug_open, | ||
714 | .read = seq_read, | ||
715 | .llseek = seq_lseek, | ||
716 | .release = single_release, | ||
717 | }; | ||
718 | |||
719 | static int __init irq_debugfs_init(void) | ||
720 | { | ||
721 | if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root, | ||
722 | NULL, &virq_debug_fops) == NULL) | ||
723 | return -ENOMEM; | ||
724 | |||
725 | return 0; | ||
726 | } | ||
727 | device_initcall(irq_debugfs_init); | ||
728 | #endif /* CONFIG_VIRQ_DEBUG */ | ||
diff --git a/arch/c6x/platforms/megamod-pic.c b/arch/c6x/platforms/megamod-pic.c index 7c37a947fb1c..c1c4e2ae3f85 100644 --- a/arch/c6x/platforms/megamod-pic.c +++ b/arch/c6x/platforms/megamod-pic.c | |||
@@ -48,7 +48,7 @@ struct megamod_regs { | |||
48 | }; | 48 | }; |
49 | 49 | ||
50 | struct megamod_pic { | 50 | struct megamod_pic { |
51 | struct irq_host *irqhost; | 51 | struct irq_domain *irqhost; |
52 | struct megamod_regs __iomem *regs; | 52 | struct megamod_regs __iomem *regs; |
53 | raw_spinlock_t lock; | 53 | raw_spinlock_t lock; |
54 | 54 | ||
@@ -116,7 +116,7 @@ static void megamod_irq_cascade(unsigned int irq, struct irq_desc *desc) | |||
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | static int megamod_map(struct irq_host *h, unsigned int virq, | 119 | static int megamod_map(struct irq_domain *h, unsigned int virq, |
120 | irq_hw_number_t hw) | 120 | irq_hw_number_t hw) |
121 | { | 121 | { |
122 | struct megamod_pic *pic = h->host_data; | 122 | struct megamod_pic *pic = h->host_data; |
@@ -136,21 +136,9 @@ static int megamod_map(struct irq_host *h, unsigned int virq, | |||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | static int megamod_xlate(struct irq_host *h, struct device_node *ct, | 139 | static const struct irq_domain_ops megamod_domain_ops = { |
140 | const u32 *intspec, unsigned int intsize, | ||
141 | irq_hw_number_t *out_hwirq, unsigned int *out_type) | ||
142 | |||
143 | { | ||
144 | /* megamod intspecs must have 1 cell */ | ||
145 | BUG_ON(intsize != 1); | ||
146 | *out_hwirq = intspec[0]; | ||
147 | *out_type = IRQ_TYPE_NONE; | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | static struct irq_host_ops megamod_host_ops = { | ||
152 | .map = megamod_map, | 140 | .map = megamod_map, |
153 | .xlate = megamod_xlate, | 141 | .xlate = irq_domain_xlate_onecell, |
154 | }; | 142 | }; |
155 | 143 | ||
156 | static void __init set_megamod_mux(struct megamod_pic *pic, int src, int output) | 144 | static void __init set_megamod_mux(struct megamod_pic *pic, int src, int output) |
@@ -223,9 +211,8 @@ static struct megamod_pic * __init init_megamod_pic(struct device_node *np) | |||
223 | return NULL; | 211 | return NULL; |
224 | } | 212 | } |
225 | 213 | ||
226 | pic->irqhost = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, | 214 | pic->irqhost = irq_domain_add_linear(np, NR_COMBINERS * 32, |
227 | NR_COMBINERS * 32, &megamod_host_ops, | 215 | &megamod_domain_ops, pic); |
228 | IRQ_UNMAPPED); | ||
229 | if (!pic->irqhost) { | 216 | if (!pic->irqhost) { |
230 | pr_err("%s: Could not alloc host.\n", np->full_name); | 217 | pr_err("%s: Could not alloc host.\n", np->full_name); |
231 | goto error_free; | 218 | goto error_free; |
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index c8d6efb99dbf..11060fa87da3 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -14,6 +14,7 @@ config MICROBLAZE | |||
14 | select TRACING_SUPPORT | 14 | select TRACING_SUPPORT |
15 | select OF | 15 | select OF |
16 | select OF_EARLY_FLATTREE | 16 | select OF_EARLY_FLATTREE |
17 | select IRQ_DOMAIN | ||
17 | select HAVE_GENERIC_HARDIRQS | 18 | select HAVE_GENERIC_HARDIRQS |
18 | select GENERIC_IRQ_PROBE | 19 | select GENERIC_IRQ_PROBE |
19 | select GENERIC_IRQ_SHOW | 20 | select GENERIC_IRQ_SHOW |
diff --git a/arch/microblaze/include/asm/hardirq.h b/arch/microblaze/include/asm/hardirq.h index cd1ac9aad56c..fb3c05a0cbbf 100644 --- a/arch/microblaze/include/asm/hardirq.h +++ b/arch/microblaze/include/asm/hardirq.h | |||
@@ -1,17 +1 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_HARDIRQ_H | ||
10 | #define _ASM_MICROBLAZE_HARDIRQ_H | ||
11 | |||
12 | /* should be defined in each interrupt controller driver */ | ||
13 | extern unsigned int get_irq(struct pt_regs *regs); | ||
14 | |||
15 | #include <asm-generic/hardirq.h> | #include <asm-generic/hardirq.h> | |
16 | |||
17 | #endif /* _ASM_MICROBLAZE_HARDIRQ_H */ | ||
diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index a175132e4496..bab3b1393ad4 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h | |||
@@ -9,49 +9,13 @@ | |||
9 | #ifndef _ASM_MICROBLAZE_IRQ_H | 9 | #ifndef _ASM_MICROBLAZE_IRQ_H |
10 | #define _ASM_MICROBLAZE_IRQ_H | 10 | #define _ASM_MICROBLAZE_IRQ_H |
11 | 11 | ||
12 | 12 | #define NR_IRQS (32 + 1) | |
13 | /* | ||
14 | * Linux IRQ# is currently offset by one to map to the hardware | ||
15 | * irq number. So hardware IRQ0 maps to Linux irq 1. | ||
16 | */ | ||
17 | #define NO_IRQ_OFFSET 1 | ||
18 | #define IRQ_OFFSET NO_IRQ_OFFSET | ||
19 | #define NR_IRQS (32 + IRQ_OFFSET) | ||
20 | #include <asm-generic/irq.h> | 13 | #include <asm-generic/irq.h> |
21 | 14 | ||
22 | /* This type is the placeholder for a hardware interrupt number. It has to | ||
23 | * be big enough to enclose whatever representation is used by a given | ||
24 | * platform. | ||
25 | */ | ||
26 | typedef unsigned long irq_hw_number_t; | ||
27 | |||
28 | extern unsigned int nr_irq; | ||
29 | |||
30 | struct pt_regs; | 15 | struct pt_regs; |
31 | extern void do_IRQ(struct pt_regs *regs); | 16 | extern void do_IRQ(struct pt_regs *regs); |
32 | 17 | ||
33 | /** FIXME - not implement | 18 | /* should be defined in each interrupt controller driver */ |
34 | * irq_dispose_mapping - Unmap an interrupt | 19 | extern unsigned int get_irq(void); |
35 | * @virq: linux virq number of the interrupt to unmap | ||
36 | */ | ||
37 | static inline void irq_dispose_mapping(unsigned int virq) | ||
38 | { | ||
39 | return; | ||
40 | } | ||
41 | |||
42 | struct irq_host; | ||
43 | |||
44 | /** | ||
45 | * irq_create_mapping - Map a hardware interrupt into linux virq space | ||
46 | * @host: host owning this hardware interrupt or NULL for default host | ||
47 | * @hwirq: hardware irq number in that host space | ||
48 | * | ||
49 | * Only one mapping per hardware interrupt is permitted. Returns a linux | ||
50 | * virq number. | ||
51 | * If the sense/trigger is to be specified, set_irq_type() should be called | ||
52 | * on the number returned from that call. | ||
53 | */ | ||
54 | extern unsigned int irq_create_mapping(struct irq_host *host, | ||
55 | irq_hw_number_t hwirq); | ||
56 | 20 | ||
57 | #endif /* _ASM_MICROBLAZE_IRQ_H */ | 21 | #endif /* _ASM_MICROBLAZE_IRQ_H */ |
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c index 44b177e2ab12..ad120672cee5 100644 --- a/arch/microblaze/kernel/intc.c +++ b/arch/microblaze/kernel/intc.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/irqdomain.h> | ||
12 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
13 | #include <asm/page.h> | 14 | #include <asm/page.h> |
14 | #include <linux/io.h> | 15 | #include <linux/io.h> |
@@ -25,8 +26,6 @@ static unsigned int intc_baseaddr; | |||
25 | #define INTC_BASE intc_baseaddr | 26 | #define INTC_BASE intc_baseaddr |
26 | #endif | 27 | #endif |
27 | 28 | ||
28 | unsigned int nr_irq; | ||
29 | |||
30 | /* No one else should require these constants, so define them locally here. */ | 29 | /* No one else should require these constants, so define them locally here. */ |
31 | #define ISR 0x00 /* Interrupt Status Register */ | 30 | #define ISR 0x00 /* Interrupt Status Register */ |
32 | #define IPR 0x04 /* Interrupt Pending Register */ | 31 | #define IPR 0x04 /* Interrupt Pending Register */ |
@@ -84,24 +83,45 @@ static struct irq_chip intc_dev = { | |||
84 | .irq_mask_ack = intc_mask_ack, | 83 | .irq_mask_ack = intc_mask_ack, |
85 | }; | 84 | }; |
86 | 85 | ||
87 | unsigned int get_irq(struct pt_regs *regs) | 86 | static struct irq_domain *root_domain; |
87 | |||
88 | unsigned int get_irq(void) | ||
88 | { | 89 | { |
89 | int irq; | 90 | unsigned int hwirq, irq = -1; |
90 | 91 | ||
91 | /* | 92 | hwirq = in_be32(INTC_BASE + IVR); |
92 | * NOTE: This function is the one that needs to be improved in | 93 | if (hwirq != -1U) |
93 | * order to handle multiple interrupt controllers. It currently | 94 | irq = irq_find_mapping(root_domain, hwirq); |
94 | * is hardcoded to check for interrupts only on the first INTC. | 95 | |
95 | */ | 96 | pr_debug("get_irq: hwirq=%d, irq=%d\n", hwirq, irq); |
96 | irq = in_be32(INTC_BASE + IVR) + NO_IRQ_OFFSET; | ||
97 | pr_debug("get_irq: %d\n", irq); | ||
98 | 97 | ||
99 | return irq; | 98 | return irq; |
100 | } | 99 | } |
101 | 100 | ||
101 | int xintc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) | ||
102 | { | ||
103 | u32 intr_mask = (u32)d->host_data; | ||
104 | |||
105 | if (intr_mask & (1 << hw)) { | ||
106 | irq_set_chip_and_handler_name(irq, &intc_dev, | ||
107 | handle_edge_irq, "edge"); | ||
108 | irq_clear_status_flags(irq, IRQ_LEVEL); | ||
109 | } else { | ||
110 | irq_set_chip_and_handler_name(irq, &intc_dev, | ||
111 | handle_level_irq, "level"); | ||
112 | irq_set_status_flags(irq, IRQ_LEVEL); | ||
113 | } | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static const struct irq_domain_ops xintc_irq_domain_ops = { | ||
118 | .xlate = irq_domain_xlate_onetwocell, | ||
119 | .map = xintc_map, | ||
120 | }; | ||
121 | |||
102 | void __init init_IRQ(void) | 122 | void __init init_IRQ(void) |
103 | { | 123 | { |
104 | u32 i, intr_mask; | 124 | u32 nr_irq, intr_mask; |
105 | struct device_node *intc = NULL; | 125 | struct device_node *intc = NULL; |
106 | #ifdef CONFIG_SELFMOD_INTC | 126 | #ifdef CONFIG_SELFMOD_INTC |
107 | unsigned int intc_baseaddr = 0; | 127 | unsigned int intc_baseaddr = 0; |
@@ -146,16 +166,9 @@ void __init init_IRQ(void) | |||
146 | /* Turn on the Master Enable. */ | 166 | /* Turn on the Master Enable. */ |
147 | out_be32(intc_baseaddr + MER, MER_HIE | MER_ME); | 167 | out_be32(intc_baseaddr + MER, MER_HIE | MER_ME); |
148 | 168 | ||
149 | for (i = IRQ_OFFSET; i < (nr_irq + IRQ_OFFSET); ++i) { | 169 | /* Yeah, okay, casting the intr_mask to a void* is butt-ugly, but I'm |
150 | if (intr_mask & (0x00000001 << (i - IRQ_OFFSET))) { | 170 | * lazy and Michal can clean it up to something nicer when he tests |
151 | irq_set_chip_and_handler_name(i, &intc_dev, | 171 | * and commits this patch. ~~gcl */ |
152 | handle_edge_irq, "edge"); | 172 | root_domain = irq_domain_add_linear(intc, nr_irq, &xintc_irq_domain_ops, |
153 | irq_clear_status_flags(i, IRQ_LEVEL); | 173 | (void *)intr_mask); |
154 | } else { | ||
155 | irq_set_chip_and_handler_name(i, &intc_dev, | ||
156 | handle_level_irq, "level"); | ||
157 | irq_set_status_flags(i, IRQ_LEVEL); | ||
158 | } | ||
159 | irq_get_irq_data(i)->hwirq = i - IRQ_OFFSET; | ||
160 | } | ||
161 | } | 174 | } |
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c index bbebcae72c02..ace700afbfdf 100644 --- a/arch/microblaze/kernel/irq.c +++ b/arch/microblaze/kernel/irq.c | |||
@@ -31,14 +31,13 @@ void __irq_entry do_IRQ(struct pt_regs *regs) | |||
31 | trace_hardirqs_off(); | 31 | trace_hardirqs_off(); |
32 | 32 | ||
33 | irq_enter(); | 33 | irq_enter(); |
34 | irq = get_irq(regs); | 34 | irq = get_irq(); |
35 | next_irq: | 35 | next_irq: |
36 | BUG_ON(!irq); | 36 | BUG_ON(!irq); |
37 | /* Substract 1 because of get_irq */ | 37 | generic_handle_irq(irq); |
38 | generic_handle_irq(irq + IRQ_OFFSET - NO_IRQ_OFFSET); | ||
39 | 38 | ||
40 | irq = get_irq(regs); | 39 | irq = get_irq(); |
41 | if (irq) { | 40 | if (irq != -1U) { |
42 | pr_debug("next irq: %d\n", irq); | 41 | pr_debug("next irq: %d\n", irq); |
43 | ++concurrent_irq; | 42 | ++concurrent_irq; |
44 | goto next_irq; | 43 | goto next_irq; |
@@ -48,18 +47,3 @@ next_irq: | |||
48 | set_irq_regs(old_regs); | 47 | set_irq_regs(old_regs); |
49 | trace_hardirqs_on(); | 48 | trace_hardirqs_on(); |
50 | } | 49 | } |
51 | |||
52 | /* MS: There is no any advance mapping mechanism. We are using simple 32bit | ||
53 | intc without any cascades or any connection that's why mapping is 1:1 */ | ||
54 | unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq) | ||
55 | { | ||
56 | return hwirq + IRQ_OFFSET; | ||
57 | } | ||
58 | EXPORT_SYMBOL_GPL(irq_create_mapping); | ||
59 | |||
60 | unsigned int irq_create_of_mapping(struct device_node *controller, | ||
61 | const u32 *intspec, unsigned int intsize) | ||
62 | { | ||
63 | return intspec[0] + IRQ_OFFSET; | ||
64 | } | ||
65 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | ||
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c index 604cd9dd1333..70e6d0b41ab4 100644 --- a/arch/microblaze/kernel/setup.c +++ b/arch/microblaze/kernel/setup.c | |||
@@ -51,8 +51,6 @@ void __init setup_arch(char **cmdline_p) | |||
51 | 51 | ||
52 | unflatten_device_tree(); | 52 | unflatten_device_tree(); |
53 | 53 | ||
54 | /* NOTE I think that this function is not necessary to call */ | ||
55 | /* irq_early_init(); */ | ||
56 | setup_cpuinfo(); | 54 | setup_cpuinfo(); |
57 | 55 | ||
58 | microblaze_cache_init(); | 56 | microblaze_cache_init(); |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 5ab6e89603c5..edbbae17e820 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -2327,6 +2327,7 @@ config USE_OF | |||
2327 | bool "Flattened Device Tree support" | 2327 | bool "Flattened Device Tree support" |
2328 | select OF | 2328 | select OF |
2329 | select OF_EARLY_FLATTREE | 2329 | select OF_EARLY_FLATTREE |
2330 | select IRQ_DOMAIN | ||
2330 | help | 2331 | help |
2331 | Include support for flattened device tree machine descriptions. | 2332 | Include support for flattened device tree machine descriptions. |
2332 | 2333 | ||
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h index 2354c870a63a..fb698dc09bc9 100644 --- a/arch/mips/include/asm/irq.h +++ b/arch/mips/include/asm/irq.h | |||
@@ -11,15 +11,12 @@ | |||
11 | 11 | ||
12 | #include <linux/linkage.h> | 12 | #include <linux/linkage.h> |
13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
14 | #include <linux/irqdomain.h> | ||
14 | 15 | ||
15 | #include <asm/mipsmtregs.h> | 16 | #include <asm/mipsmtregs.h> |
16 | 17 | ||
17 | #include <irq.h> | 18 | #include <irq.h> |
18 | 19 | ||
19 | static inline void irq_dispose_mapping(unsigned int virq) | ||
20 | { | ||
21 | } | ||
22 | |||
23 | #ifdef CONFIG_I8259 | 20 | #ifdef CONFIG_I8259 |
24 | static inline int irq_canonicalize(int irq) | 21 | static inline int irq_canonicalize(int irq) |
25 | { | 22 | { |
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c index 6b8b4208481e..558b5395795d 100644 --- a/arch/mips/kernel/prom.c +++ b/arch/mips/kernel/prom.c | |||
@@ -60,20 +60,6 @@ void __init early_init_dt_setup_initrd_arch(unsigned long start, | |||
60 | } | 60 | } |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | /* | ||
64 | * irq_create_of_mapping - Hook to resolve OF irq specifier into a Linux irq# | ||
65 | * | ||
66 | * Currently the mapping mechanism is trivial; simple flat hwirq numbers are | ||
67 | * mapped 1:1 onto Linux irq numbers. Cascaded irq controllers are not | ||
68 | * supported. | ||
69 | */ | ||
70 | unsigned int irq_create_of_mapping(struct device_node *controller, | ||
71 | const u32 *intspec, unsigned int intsize) | ||
72 | { | ||
73 | return intspec[0]; | ||
74 | } | ||
75 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | ||
76 | |||
77 | void __init early_init_devtree(void *params) | 63 | void __init early_init_devtree(void *params) |
78 | { | 64 | { |
79 | /* Setup flat device-tree pointer */ | 65 | /* Setup flat device-tree pointer */ |
diff --git a/arch/openrisc/include/asm/prom.h b/arch/openrisc/include/asm/prom.h index e1f3fe26606c..bbb34e5343a2 100644 --- a/arch/openrisc/include/asm/prom.h +++ b/arch/openrisc/include/asm/prom.h | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
27 | #include <linux/irqdomain.h> | ||
27 | #include <linux/atomic.h> | 28 | #include <linux/atomic.h> |
28 | #include <linux/of_irq.h> | 29 | #include <linux/of_irq.h> |
29 | #include <linux/of_fdt.h> | 30 | #include <linux/of_fdt.h> |
@@ -63,15 +64,6 @@ extern const void *of_get_mac_address(struct device_node *np); | |||
63 | struct pci_dev; | 64 | struct pci_dev; |
64 | extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); | 65 | extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); |
65 | 66 | ||
66 | /* This routine is here to provide compatibility with how powerpc | ||
67 | * handles IRQ mapping for OF device nodes. We precompute and permanently | ||
68 | * register them in the platform_device objects, whereas powerpc computes them | ||
69 | * on request. | ||
70 | */ | ||
71 | static inline void irq_dispose_mapping(unsigned int virq) | ||
72 | { | ||
73 | } | ||
74 | |||
75 | #endif /* __ASSEMBLY__ */ | 67 | #endif /* __ASSEMBLY__ */ |
76 | #endif /* __KERNEL__ */ | 68 | #endif /* __KERNEL__ */ |
77 | #endif /* _ASM_OPENRISC_PROM_H */ | 69 | #endif /* _ASM_OPENRISC_PROM_H */ |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 1919634a9b32..303703d716fe 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -135,6 +135,7 @@ config PPC | |||
135 | select HAVE_GENERIC_HARDIRQS | 135 | select HAVE_GENERIC_HARDIRQS |
136 | select HAVE_SPARSE_IRQ | 136 | select HAVE_SPARSE_IRQ |
137 | select IRQ_PER_CPU | 137 | select IRQ_PER_CPU |
138 | select IRQ_DOMAIN | ||
138 | select GENERIC_IRQ_SHOW | 139 | select GENERIC_IRQ_SHOW |
139 | select GENERIC_IRQ_SHOW_LEVEL | 140 | select GENERIC_IRQ_SHOW_LEVEL |
140 | select IRQ_FORCED_THREADING | 141 | select IRQ_FORCED_THREADING |
diff --git a/arch/powerpc/include/asm/ehv_pic.h b/arch/powerpc/include/asm/ehv_pic.h index a9e1f4f796f6..dc7d48e3ea90 100644 --- a/arch/powerpc/include/asm/ehv_pic.h +++ b/arch/powerpc/include/asm/ehv_pic.h | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | struct ehv_pic { | 26 | struct ehv_pic { |
27 | /* The remapper for this EHV_PIC */ | 27 | /* The remapper for this EHV_PIC */ |
28 | struct irq_host *irqhost; | 28 | struct irq_domain *irqhost; |
29 | 29 | ||
30 | /* The "linux" controller struct */ | 30 | /* The "linux" controller struct */ |
31 | struct irq_chip hc_irq; | 31 | struct irq_chip hc_irq; |
diff --git a/arch/powerpc/include/asm/i8259.h b/arch/powerpc/include/asm/i8259.h index 105ade297aad..c3fdfbd5a673 100644 --- a/arch/powerpc/include/asm/i8259.h +++ b/arch/powerpc/include/asm/i8259.h | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | extern void i8259_init(struct device_node *node, unsigned long intack_addr); | 7 | extern void i8259_init(struct device_node *node, unsigned long intack_addr); |
8 | extern unsigned int i8259_irq(void); | 8 | extern unsigned int i8259_irq(void); |
9 | extern struct irq_host *i8259_get_host(void); | 9 | extern struct irq_domain *i8259_get_host(void); |
10 | 10 | ||
11 | #endif /* __KERNEL__ */ | 11 | #endif /* __KERNEL__ */ |
12 | #endif /* _ASM_POWERPC_I8259_H */ | 12 | #endif /* _ASM_POWERPC_I8259_H */ |
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index c0e1bc319e35..fe0b09dceb7d 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h | |||
@@ -9,6 +9,7 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/irqdomain.h> | ||
12 | #include <linux/threads.h> | 13 | #include <linux/threads.h> |
13 | #include <linux/list.h> | 14 | #include <linux/list.h> |
14 | #include <linux/radix-tree.h> | 15 | #include <linux/radix-tree.h> |
@@ -35,258 +36,12 @@ extern atomic_t ppc_n_lost_interrupts; | |||
35 | /* Total number of virq in the platform */ | 36 | /* Total number of virq in the platform */ |
36 | #define NR_IRQS CONFIG_NR_IRQS | 37 | #define NR_IRQS CONFIG_NR_IRQS |
37 | 38 | ||
38 | /* Number of irqs reserved for the legacy controller */ | ||
39 | #define NUM_ISA_INTERRUPTS 16 | ||
40 | |||
41 | /* Same thing, used by the generic IRQ code */ | 39 | /* Same thing, used by the generic IRQ code */ |
42 | #define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS | 40 | #define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS |
43 | 41 | ||
44 | /* This type is the placeholder for a hardware interrupt number. It has to | ||
45 | * be big enough to enclose whatever representation is used by a given | ||
46 | * platform. | ||
47 | */ | ||
48 | typedef unsigned long irq_hw_number_t; | ||
49 | |||
50 | /* Interrupt controller "host" data structure. This could be defined as a | ||
51 | * irq domain controller. That is, it handles the mapping between hardware | ||
52 | * and virtual interrupt numbers for a given interrupt domain. The host | ||
53 | * structure is generally created by the PIC code for a given PIC instance | ||
54 | * (though a host can cover more than one PIC if they have a flat number | ||
55 | * model). It's the host callbacks that are responsible for setting the | ||
56 | * irq_chip on a given irq_desc after it's been mapped. | ||
57 | * | ||
58 | * The host code and data structures are fairly agnostic to the fact that | ||
59 | * we use an open firmware device-tree. We do have references to struct | ||
60 | * device_node in two places: in irq_find_host() to find the host matching | ||
61 | * a given interrupt controller node, and of course as an argument to its | ||
62 | * counterpart host->ops->match() callback. However, those are treated as | ||
63 | * generic pointers by the core and the fact that it's actually a device-node | ||
64 | * pointer is purely a convention between callers and implementation. This | ||
65 | * code could thus be used on other architectures by replacing those two | ||
66 | * by some sort of arch-specific void * "token" used to identify interrupt | ||
67 | * controllers. | ||
68 | */ | ||
69 | struct irq_host; | ||
70 | struct radix_tree_root; | ||
71 | |||
72 | /* Functions below are provided by the host and called whenever a new mapping | ||
73 | * is created or an old mapping is disposed. The host can then proceed to | ||
74 | * whatever internal data structures management is required. It also needs | ||
75 | * to setup the irq_desc when returning from map(). | ||
76 | */ | ||
77 | struct irq_host_ops { | ||
78 | /* Match an interrupt controller device node to a host, returns | ||
79 | * 1 on a match | ||
80 | */ | ||
81 | int (*match)(struct irq_host *h, struct device_node *node); | ||
82 | |||
83 | /* Create or update a mapping between a virtual irq number and a hw | ||
84 | * irq number. This is called only once for a given mapping. | ||
85 | */ | ||
86 | int (*map)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw); | ||
87 | |||
88 | /* Dispose of such a mapping */ | ||
89 | void (*unmap)(struct irq_host *h, unsigned int virq); | ||
90 | |||
91 | /* Translate device-tree interrupt specifier from raw format coming | ||
92 | * from the firmware to a irq_hw_number_t (interrupt line number) and | ||
93 | * type (sense) that can be passed to set_irq_type(). In the absence | ||
94 | * of this callback, irq_create_of_mapping() and irq_of_parse_and_map() | ||
95 | * will return the hw number in the first cell and IRQ_TYPE_NONE for | ||
96 | * the type (which amount to keeping whatever default value the | ||
97 | * interrupt controller has for that line) | ||
98 | */ | ||
99 | int (*xlate)(struct irq_host *h, struct device_node *ctrler, | ||
100 | const u32 *intspec, unsigned int intsize, | ||
101 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
102 | }; | ||
103 | |||
104 | struct irq_host { | ||
105 | struct list_head link; | ||
106 | |||
107 | /* type of reverse mapping technique */ | ||
108 | unsigned int revmap_type; | ||
109 | #define IRQ_HOST_MAP_LEGACY 0 /* legacy 8259, gets irqs 1..15 */ | ||
110 | #define IRQ_HOST_MAP_NOMAP 1 /* no fast reverse mapping */ | ||
111 | #define IRQ_HOST_MAP_LINEAR 2 /* linear map of interrupts */ | ||
112 | #define IRQ_HOST_MAP_TREE 3 /* radix tree */ | ||
113 | union { | ||
114 | struct { | ||
115 | unsigned int size; | ||
116 | unsigned int *revmap; | ||
117 | } linear; | ||
118 | struct radix_tree_root tree; | ||
119 | } revmap_data; | ||
120 | struct irq_host_ops *ops; | ||
121 | void *host_data; | ||
122 | irq_hw_number_t inval_irq; | ||
123 | |||
124 | /* Optional device node pointer */ | ||
125 | struct device_node *of_node; | ||
126 | }; | ||
127 | |||
128 | struct irq_data; | 42 | struct irq_data; |
129 | extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); | 43 | extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); |
130 | extern irq_hw_number_t virq_to_hw(unsigned int virq); | 44 | extern irq_hw_number_t virq_to_hw(unsigned int virq); |
131 | extern bool virq_is_host(unsigned int virq, struct irq_host *host); | ||
132 | |||
133 | /** | ||
134 | * irq_alloc_host - Allocate a new irq_host data structure | ||
135 | * @of_node: optional device-tree node of the interrupt controller | ||
136 | * @revmap_type: type of reverse mapping to use | ||
137 | * @revmap_arg: for IRQ_HOST_MAP_LINEAR linear only: size of the map | ||
138 | * @ops: map/unmap host callbacks | ||
139 | * @inval_irq: provide a hw number in that host space that is always invalid | ||
140 | * | ||
141 | * Allocates and initialize and irq_host structure. Note that in the case of | ||
142 | * IRQ_HOST_MAP_LEGACY, the map() callback will be called before this returns | ||
143 | * for all legacy interrupts except 0 (which is always the invalid irq for | ||
144 | * a legacy controller). For a IRQ_HOST_MAP_LINEAR, the map is allocated by | ||
145 | * this call as well. For a IRQ_HOST_MAP_TREE, the radix tree will be allocated | ||
146 | * later during boot automatically (the reverse mapping will use the slow path | ||
147 | * until that happens). | ||
148 | */ | ||
149 | extern struct irq_host *irq_alloc_host(struct device_node *of_node, | ||
150 | unsigned int revmap_type, | ||
151 | unsigned int revmap_arg, | ||
152 | struct irq_host_ops *ops, | ||
153 | irq_hw_number_t inval_irq); | ||
154 | |||
155 | |||
156 | /** | ||
157 | * irq_find_host - Locates a host for a given device node | ||
158 | * @node: device-tree node of the interrupt controller | ||
159 | */ | ||
160 | extern struct irq_host *irq_find_host(struct device_node *node); | ||
161 | |||
162 | |||
163 | /** | ||
164 | * irq_set_default_host - Set a "default" host | ||
165 | * @host: default host pointer | ||
166 | * | ||
167 | * For convenience, it's possible to set a "default" host that will be used | ||
168 | * whenever NULL is passed to irq_create_mapping(). It makes life easier for | ||
169 | * platforms that want to manipulate a few hard coded interrupt numbers that | ||
170 | * aren't properly represented in the device-tree. | ||
171 | */ | ||
172 | extern void irq_set_default_host(struct irq_host *host); | ||
173 | |||
174 | |||
175 | /** | ||
176 | * irq_set_virq_count - Set the maximum number of virt irqs | ||
177 | * @count: number of linux virtual irqs, capped with NR_IRQS | ||
178 | * | ||
179 | * This is mainly for use by platforms like iSeries who want to program | ||
180 | * the virtual irq number in the controller to avoid the reverse mapping | ||
181 | */ | ||
182 | extern void irq_set_virq_count(unsigned int count); | ||
183 | |||
184 | |||
185 | /** | ||
186 | * irq_create_mapping - Map a hardware interrupt into linux virq space | ||
187 | * @host: host owning this hardware interrupt or NULL for default host | ||
188 | * @hwirq: hardware irq number in that host space | ||
189 | * | ||
190 | * Only one mapping per hardware interrupt is permitted. Returns a linux | ||
191 | * virq number. | ||
192 | * If the sense/trigger is to be specified, set_irq_type() should be called | ||
193 | * on the number returned from that call. | ||
194 | */ | ||
195 | extern unsigned int irq_create_mapping(struct irq_host *host, | ||
196 | irq_hw_number_t hwirq); | ||
197 | |||
198 | |||
199 | /** | ||
200 | * irq_dispose_mapping - Unmap an interrupt | ||
201 | * @virq: linux virq number of the interrupt to unmap | ||
202 | */ | ||
203 | extern void irq_dispose_mapping(unsigned int virq); | ||
204 | |||
205 | /** | ||
206 | * irq_find_mapping - Find a linux virq from an hw irq number. | ||
207 | * @host: host owning this hardware interrupt | ||
208 | * @hwirq: hardware irq number in that host space | ||
209 | * | ||
210 | * This is a slow path, for use by generic code. It's expected that an | ||
211 | * irq controller implementation directly calls the appropriate low level | ||
212 | * mapping function. | ||
213 | */ | ||
214 | extern unsigned int irq_find_mapping(struct irq_host *host, | ||
215 | irq_hw_number_t hwirq); | ||
216 | |||
217 | /** | ||
218 | * irq_create_direct_mapping - Allocate a virq for direct mapping | ||
219 | * @host: host to allocate the virq for or NULL for default host | ||
220 | * | ||
221 | * This routine is used for irq controllers which can choose the hardware | ||
222 | * interrupt numbers they generate. In such a case it's simplest to use | ||
223 | * the linux virq as the hardware interrupt number. | ||
224 | */ | ||
225 | extern unsigned int irq_create_direct_mapping(struct irq_host *host); | ||
226 | |||
227 | /** | ||
228 | * irq_radix_revmap_insert - Insert a hw irq to linux virq number mapping. | ||
229 | * @host: host owning this hardware interrupt | ||
230 | * @virq: linux irq number | ||
231 | * @hwirq: hardware irq number in that host space | ||
232 | * | ||
233 | * This is for use by irq controllers that use a radix tree reverse | ||
234 | * mapping for fast lookup. | ||
235 | */ | ||
236 | extern void irq_radix_revmap_insert(struct irq_host *host, unsigned int virq, | ||
237 | irq_hw_number_t hwirq); | ||
238 | |||
239 | /** | ||
240 | * irq_radix_revmap_lookup - Find a linux virq from a hw irq number. | ||
241 | * @host: host owning this hardware interrupt | ||
242 | * @hwirq: hardware irq number in that host space | ||
243 | * | ||
244 | * This is a fast path, for use by irq controller code that uses radix tree | ||
245 | * revmaps | ||
246 | */ | ||
247 | extern unsigned int irq_radix_revmap_lookup(struct irq_host *host, | ||
248 | irq_hw_number_t hwirq); | ||
249 | |||
250 | /** | ||
251 | * irq_linear_revmap - Find a linux virq from a hw irq number. | ||
252 | * @host: host owning this hardware interrupt | ||
253 | * @hwirq: hardware irq number in that host space | ||
254 | * | ||
255 | * This is a fast path, for use by irq controller code that uses linear | ||
256 | * revmaps. It does fallback to the slow path if the revmap doesn't exist | ||
257 | * yet and will create the revmap entry with appropriate locking | ||
258 | */ | ||
259 | |||
260 | extern unsigned int irq_linear_revmap(struct irq_host *host, | ||
261 | irq_hw_number_t hwirq); | ||
262 | |||
263 | |||
264 | |||
265 | /** | ||
266 | * irq_alloc_virt - Allocate virtual irq numbers | ||
267 | * @host: host owning these new virtual irqs | ||
268 | * @count: number of consecutive numbers to allocate | ||
269 | * @hint: pass a hint number, the allocator will try to use a 1:1 mapping | ||
270 | * | ||
271 | * This is a low level function that is used internally by irq_create_mapping() | ||
272 | * and that can be used by some irq controllers implementations for things | ||
273 | * like allocating ranges of numbers for MSIs. The revmaps are left untouched. | ||
274 | */ | ||
275 | extern unsigned int irq_alloc_virt(struct irq_host *host, | ||
276 | unsigned int count, | ||
277 | unsigned int hint); | ||
278 | |||
279 | /** | ||
280 | * irq_free_virt - Free virtual irq numbers | ||
281 | * @virq: virtual irq number of the first interrupt to free | ||
282 | * @count: number of interrupts to free | ||
283 | * | ||
284 | * This function is the opposite of irq_alloc_virt. It will not clear reverse | ||
285 | * maps, this should be done previously by unmap'ing the interrupt. In fact, | ||
286 | * all interrupts covered by the range being freed should have been unmapped | ||
287 | * prior to calling this. | ||
288 | */ | ||
289 | extern void irq_free_virt(unsigned int virq, unsigned int count); | ||
290 | 45 | ||
291 | /** | 46 | /** |
292 | * irq_early_init - Init irq remapping subsystem | 47 | * irq_early_init - Init irq remapping subsystem |
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h index 67b4d9837236..a5b7c56237f9 100644 --- a/arch/powerpc/include/asm/mpic.h +++ b/arch/powerpc/include/asm/mpic.h | |||
@@ -255,7 +255,7 @@ struct mpic | |||
255 | struct device_node *node; | 255 | struct device_node *node; |
256 | 256 | ||
257 | /* The remapper for this MPIC */ | 257 | /* The remapper for this MPIC */ |
258 | struct irq_host *irqhost; | 258 | struct irq_domain *irqhost; |
259 | 259 | ||
260 | /* The "linux" controller struct */ | 260 | /* The "linux" controller struct */ |
261 | struct irq_chip hc_irq; | 261 | struct irq_chip hc_irq; |
diff --git a/arch/powerpc/include/asm/xics.h b/arch/powerpc/include/asm/xics.h index c48de98ba94e..4ae9a09c3b89 100644 --- a/arch/powerpc/include/asm/xics.h +++ b/arch/powerpc/include/asm/xics.h | |||
@@ -86,7 +86,7 @@ struct ics { | |||
86 | extern unsigned int xics_default_server; | 86 | extern unsigned int xics_default_server; |
87 | extern unsigned int xics_default_distrib_server; | 87 | extern unsigned int xics_default_distrib_server; |
88 | extern unsigned int xics_interrupt_server_size; | 88 | extern unsigned int xics_interrupt_server_size; |
89 | extern struct irq_host *xics_host; | 89 | extern struct irq_domain *xics_host; |
90 | 90 | ||
91 | struct xics_cppr { | 91 | struct xics_cppr { |
92 | unsigned char stack[MAX_NUM_PRIORITIES]; | 92 | unsigned char stack[MAX_NUM_PRIORITIES]; |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 01e2877e8e04..bdfb3eee3e6f 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -490,409 +490,19 @@ void do_softirq(void) | |||
490 | local_irq_restore(flags); | 490 | local_irq_restore(flags); |
491 | } | 491 | } |
492 | 492 | ||
493 | |||
494 | /* | ||
495 | * IRQ controller and virtual interrupts | ||
496 | */ | ||
497 | |||
498 | /* The main irq map itself is an array of NR_IRQ entries containing the | ||
499 | * associate host and irq number. An entry with a host of NULL is free. | ||
500 | * An entry can be allocated if it's free, the allocator always then sets | ||
501 | * hwirq first to the host's invalid irq number and then fills ops. | ||
502 | */ | ||
503 | struct irq_map_entry { | ||
504 | irq_hw_number_t hwirq; | ||
505 | struct irq_host *host; | ||
506 | }; | ||
507 | |||
508 | static LIST_HEAD(irq_hosts); | ||
509 | static DEFINE_RAW_SPINLOCK(irq_big_lock); | ||
510 | static DEFINE_MUTEX(revmap_trees_mutex); | ||
511 | static struct irq_map_entry irq_map[NR_IRQS]; | ||
512 | static unsigned int irq_virq_count = NR_IRQS; | ||
513 | static struct irq_host *irq_default_host; | ||
514 | |||
515 | irq_hw_number_t irqd_to_hwirq(struct irq_data *d) | 493 | irq_hw_number_t irqd_to_hwirq(struct irq_data *d) |
516 | { | 494 | { |
517 | return irq_map[d->irq].hwirq; | 495 | return d->hwirq; |
518 | } | 496 | } |
519 | EXPORT_SYMBOL_GPL(irqd_to_hwirq); | 497 | EXPORT_SYMBOL_GPL(irqd_to_hwirq); |
520 | 498 | ||
521 | irq_hw_number_t virq_to_hw(unsigned int virq) | 499 | irq_hw_number_t virq_to_hw(unsigned int virq) |
522 | { | 500 | { |
523 | return irq_map[virq].hwirq; | 501 | struct irq_data *irq_data = irq_get_irq_data(virq); |
502 | return WARN_ON(!irq_data) ? 0 : irq_data->hwirq; | ||
524 | } | 503 | } |
525 | EXPORT_SYMBOL_GPL(virq_to_hw); | 504 | EXPORT_SYMBOL_GPL(virq_to_hw); |
526 | 505 | ||
527 | bool virq_is_host(unsigned int virq, struct irq_host *host) | ||
528 | { | ||
529 | return irq_map[virq].host == host; | ||
530 | } | ||
531 | EXPORT_SYMBOL_GPL(virq_is_host); | ||
532 | |||
533 | static int default_irq_host_match(struct irq_host *h, struct device_node *np) | ||
534 | { | ||
535 | return h->of_node != NULL && h->of_node == np; | ||
536 | } | ||
537 | |||
538 | struct irq_host *irq_alloc_host(struct device_node *of_node, | ||
539 | unsigned int revmap_type, | ||
540 | unsigned int revmap_arg, | ||
541 | struct irq_host_ops *ops, | ||
542 | irq_hw_number_t inval_irq) | ||
543 | { | ||
544 | struct irq_host *host; | ||
545 | unsigned int size = sizeof(struct irq_host); | ||
546 | unsigned int i; | ||
547 | unsigned int *rmap; | ||
548 | unsigned long flags; | ||
549 | |||
550 | /* Allocate structure and revmap table if using linear mapping */ | ||
551 | if (revmap_type == IRQ_HOST_MAP_LINEAR) | ||
552 | size += revmap_arg * sizeof(unsigned int); | ||
553 | host = kzalloc(size, GFP_KERNEL); | ||
554 | if (host == NULL) | ||
555 | return NULL; | ||
556 | |||
557 | /* Fill structure */ | ||
558 | host->revmap_type = revmap_type; | ||
559 | host->inval_irq = inval_irq; | ||
560 | host->ops = ops; | ||
561 | host->of_node = of_node_get(of_node); | ||
562 | |||
563 | if (host->ops->match == NULL) | ||
564 | host->ops->match = default_irq_host_match; | ||
565 | |||
566 | raw_spin_lock_irqsave(&irq_big_lock, flags); | ||
567 | |||
568 | /* If it's a legacy controller, check for duplicates and | ||
569 | * mark it as allocated (we use irq 0 host pointer for that | ||
570 | */ | ||
571 | if (revmap_type == IRQ_HOST_MAP_LEGACY) { | ||
572 | if (irq_map[0].host != NULL) { | ||
573 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
574 | of_node_put(host->of_node); | ||
575 | kfree(host); | ||
576 | return NULL; | ||
577 | } | ||
578 | irq_map[0].host = host; | ||
579 | } | ||
580 | |||
581 | list_add(&host->link, &irq_hosts); | ||
582 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
583 | |||
584 | /* Additional setups per revmap type */ | ||
585 | switch(revmap_type) { | ||
586 | case IRQ_HOST_MAP_LEGACY: | ||
587 | /* 0 is always the invalid number for legacy */ | ||
588 | host->inval_irq = 0; | ||
589 | /* setup us as the host for all legacy interrupts */ | ||
590 | for (i = 1; i < NUM_ISA_INTERRUPTS; i++) { | ||
591 | irq_map[i].hwirq = i; | ||
592 | smp_wmb(); | ||
593 | irq_map[i].host = host; | ||
594 | smp_wmb(); | ||
595 | |||
596 | /* Legacy flags are left to default at this point, | ||
597 | * one can then use irq_create_mapping() to | ||
598 | * explicitly change them | ||
599 | */ | ||
600 | ops->map(host, i, i); | ||
601 | |||
602 | /* Clear norequest flags */ | ||
603 | irq_clear_status_flags(i, IRQ_NOREQUEST); | ||
604 | } | ||
605 | break; | ||
606 | case IRQ_HOST_MAP_LINEAR: | ||
607 | rmap = (unsigned int *)(host + 1); | ||
608 | for (i = 0; i < revmap_arg; i++) | ||
609 | rmap[i] = NO_IRQ; | ||
610 | host->revmap_data.linear.size = revmap_arg; | ||
611 | smp_wmb(); | ||
612 | host->revmap_data.linear.revmap = rmap; | ||
613 | break; | ||
614 | case IRQ_HOST_MAP_TREE: | ||
615 | INIT_RADIX_TREE(&host->revmap_data.tree, GFP_KERNEL); | ||
616 | break; | ||
617 | default: | ||
618 | break; | ||
619 | } | ||
620 | |||
621 | pr_debug("irq: Allocated host of type %d @0x%p\n", revmap_type, host); | ||
622 | |||
623 | return host; | ||
624 | } | ||
625 | |||
626 | struct irq_host *irq_find_host(struct device_node *node) | ||
627 | { | ||
628 | struct irq_host *h, *found = NULL; | ||
629 | unsigned long flags; | ||
630 | |||
631 | /* We might want to match the legacy controller last since | ||
632 | * it might potentially be set to match all interrupts in | ||
633 | * the absence of a device node. This isn't a problem so far | ||
634 | * yet though... | ||
635 | */ | ||
636 | raw_spin_lock_irqsave(&irq_big_lock, flags); | ||
637 | list_for_each_entry(h, &irq_hosts, link) | ||
638 | if (h->ops->match(h, node)) { | ||
639 | found = h; | ||
640 | break; | ||
641 | } | ||
642 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
643 | return found; | ||
644 | } | ||
645 | EXPORT_SYMBOL_GPL(irq_find_host); | ||
646 | |||
647 | void irq_set_default_host(struct irq_host *host) | ||
648 | { | ||
649 | pr_debug("irq: Default host set to @0x%p\n", host); | ||
650 | |||
651 | irq_default_host = host; | ||
652 | } | ||
653 | |||
654 | void irq_set_virq_count(unsigned int count) | ||
655 | { | ||
656 | pr_debug("irq: Trying to set virq count to %d\n", count); | ||
657 | |||
658 | BUG_ON(count < NUM_ISA_INTERRUPTS); | ||
659 | if (count < NR_IRQS) | ||
660 | irq_virq_count = count; | ||
661 | } | ||
662 | |||
663 | static int irq_setup_virq(struct irq_host *host, unsigned int virq, | ||
664 | irq_hw_number_t hwirq) | ||
665 | { | ||
666 | int res; | ||
667 | |||
668 | res = irq_alloc_desc_at(virq, 0); | ||
669 | if (res != virq) { | ||
670 | pr_debug("irq: -> allocating desc failed\n"); | ||
671 | goto error; | ||
672 | } | ||
673 | |||
674 | /* map it */ | ||
675 | smp_wmb(); | ||
676 | irq_map[virq].hwirq = hwirq; | ||
677 | smp_mb(); | ||
678 | |||
679 | if (host->ops->map(host, virq, hwirq)) { | ||
680 | pr_debug("irq: -> mapping failed, freeing\n"); | ||
681 | goto errdesc; | ||
682 | } | ||
683 | |||
684 | irq_clear_status_flags(virq, IRQ_NOREQUEST); | ||
685 | |||
686 | return 0; | ||
687 | |||
688 | errdesc: | ||
689 | irq_free_descs(virq, 1); | ||
690 | error: | ||
691 | irq_free_virt(virq, 1); | ||
692 | return -1; | ||
693 | } | ||
694 | |||
695 | unsigned int irq_create_direct_mapping(struct irq_host *host) | ||
696 | { | ||
697 | unsigned int virq; | ||
698 | |||
699 | if (host == NULL) | ||
700 | host = irq_default_host; | ||
701 | |||
702 | BUG_ON(host == NULL); | ||
703 | WARN_ON(host->revmap_type != IRQ_HOST_MAP_NOMAP); | ||
704 | |||
705 | virq = irq_alloc_virt(host, 1, 0); | ||
706 | if (virq == NO_IRQ) { | ||
707 | pr_debug("irq: create_direct virq allocation failed\n"); | ||
708 | return NO_IRQ; | ||
709 | } | ||
710 | |||
711 | pr_debug("irq: create_direct obtained virq %d\n", virq); | ||
712 | |||
713 | if (irq_setup_virq(host, virq, virq)) | ||
714 | return NO_IRQ; | ||
715 | |||
716 | return virq; | ||
717 | } | ||
718 | |||
719 | unsigned int irq_create_mapping(struct irq_host *host, | ||
720 | irq_hw_number_t hwirq) | ||
721 | { | ||
722 | unsigned int virq, hint; | ||
723 | |||
724 | pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", host, hwirq); | ||
725 | |||
726 | /* Look for default host if nececssary */ | ||
727 | if (host == NULL) | ||
728 | host = irq_default_host; | ||
729 | if (host == NULL) { | ||
730 | printk(KERN_WARNING "irq_create_mapping called for" | ||
731 | " NULL host, hwirq=%lx\n", hwirq); | ||
732 | WARN_ON(1); | ||
733 | return NO_IRQ; | ||
734 | } | ||
735 | pr_debug("irq: -> using host @%p\n", host); | ||
736 | |||
737 | /* Check if mapping already exists */ | ||
738 | virq = irq_find_mapping(host, hwirq); | ||
739 | if (virq != NO_IRQ) { | ||
740 | pr_debug("irq: -> existing mapping on virq %d\n", virq); | ||
741 | return virq; | ||
742 | } | ||
743 | |||
744 | /* Get a virtual interrupt number */ | ||
745 | if (host->revmap_type == IRQ_HOST_MAP_LEGACY) { | ||
746 | /* Handle legacy */ | ||
747 | virq = (unsigned int)hwirq; | ||
748 | if (virq == 0 || virq >= NUM_ISA_INTERRUPTS) | ||
749 | return NO_IRQ; | ||
750 | return virq; | ||
751 | } else { | ||
752 | /* Allocate a virtual interrupt number */ | ||
753 | hint = hwirq % irq_virq_count; | ||
754 | virq = irq_alloc_virt(host, 1, hint); | ||
755 | if (virq == NO_IRQ) { | ||
756 | pr_debug("irq: -> virq allocation failed\n"); | ||
757 | return NO_IRQ; | ||
758 | } | ||
759 | } | ||
760 | |||
761 | if (irq_setup_virq(host, virq, hwirq)) | ||
762 | return NO_IRQ; | ||
763 | |||
764 | pr_debug("irq: irq %lu on host %s mapped to virtual irq %u\n", | ||
765 | hwirq, host->of_node ? host->of_node->full_name : "null", virq); | ||
766 | |||
767 | return virq; | ||
768 | } | ||
769 | EXPORT_SYMBOL_GPL(irq_create_mapping); | ||
770 | |||
771 | unsigned int irq_create_of_mapping(struct device_node *controller, | ||
772 | const u32 *intspec, unsigned int intsize) | ||
773 | { | ||
774 | struct irq_host *host; | ||
775 | irq_hw_number_t hwirq; | ||
776 | unsigned int type = IRQ_TYPE_NONE; | ||
777 | unsigned int virq; | ||
778 | |||
779 | if (controller == NULL) | ||
780 | host = irq_default_host; | ||
781 | else | ||
782 | host = irq_find_host(controller); | ||
783 | if (host == NULL) { | ||
784 | printk(KERN_WARNING "irq: no irq host found for %s !\n", | ||
785 | controller->full_name); | ||
786 | return NO_IRQ; | ||
787 | } | ||
788 | |||
789 | /* If host has no translation, then we assume interrupt line */ | ||
790 | if (host->ops->xlate == NULL) | ||
791 | hwirq = intspec[0]; | ||
792 | else { | ||
793 | if (host->ops->xlate(host, controller, intspec, intsize, | ||
794 | &hwirq, &type)) | ||
795 | return NO_IRQ; | ||
796 | } | ||
797 | |||
798 | /* Create mapping */ | ||
799 | virq = irq_create_mapping(host, hwirq); | ||
800 | if (virq == NO_IRQ) | ||
801 | return virq; | ||
802 | |||
803 | /* Set type if specified and different than the current one */ | ||
804 | if (type != IRQ_TYPE_NONE && | ||
805 | type != (irqd_get_trigger_type(irq_get_irq_data(virq)))) | ||
806 | irq_set_irq_type(virq, type); | ||
807 | return virq; | ||
808 | } | ||
809 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | ||
810 | |||
811 | void irq_dispose_mapping(unsigned int virq) | ||
812 | { | ||
813 | struct irq_host *host; | ||
814 | irq_hw_number_t hwirq; | ||
815 | |||
816 | if (virq == NO_IRQ) | ||
817 | return; | ||
818 | |||
819 | host = irq_map[virq].host; | ||
820 | if (WARN_ON(host == NULL)) | ||
821 | return; | ||
822 | |||
823 | /* Never unmap legacy interrupts */ | ||
824 | if (host->revmap_type == IRQ_HOST_MAP_LEGACY) | ||
825 | return; | ||
826 | |||
827 | irq_set_status_flags(virq, IRQ_NOREQUEST); | ||
828 | |||
829 | /* remove chip and handler */ | ||
830 | irq_set_chip_and_handler(virq, NULL, NULL); | ||
831 | |||
832 | /* Make sure it's completed */ | ||
833 | synchronize_irq(virq); | ||
834 | |||
835 | /* Tell the PIC about it */ | ||
836 | if (host->ops->unmap) | ||
837 | host->ops->unmap(host, virq); | ||
838 | smp_mb(); | ||
839 | |||
840 | /* Clear reverse map */ | ||
841 | hwirq = irq_map[virq].hwirq; | ||
842 | switch(host->revmap_type) { | ||
843 | case IRQ_HOST_MAP_LINEAR: | ||
844 | if (hwirq < host->revmap_data.linear.size) | ||
845 | host->revmap_data.linear.revmap[hwirq] = NO_IRQ; | ||
846 | break; | ||
847 | case IRQ_HOST_MAP_TREE: | ||
848 | mutex_lock(&revmap_trees_mutex); | ||
849 | radix_tree_delete(&host->revmap_data.tree, hwirq); | ||
850 | mutex_unlock(&revmap_trees_mutex); | ||
851 | break; | ||
852 | } | ||
853 | |||
854 | /* Destroy map */ | ||
855 | smp_mb(); | ||
856 | irq_map[virq].hwirq = host->inval_irq; | ||
857 | |||
858 | irq_free_descs(virq, 1); | ||
859 | /* Free it */ | ||
860 | irq_free_virt(virq, 1); | ||
861 | } | ||
862 | EXPORT_SYMBOL_GPL(irq_dispose_mapping); | ||
863 | |||
864 | unsigned int irq_find_mapping(struct irq_host *host, | ||
865 | irq_hw_number_t hwirq) | ||
866 | { | ||
867 | unsigned int i; | ||
868 | unsigned int hint = hwirq % irq_virq_count; | ||
869 | |||
870 | /* Look for default host if nececssary */ | ||
871 | if (host == NULL) | ||
872 | host = irq_default_host; | ||
873 | if (host == NULL) | ||
874 | return NO_IRQ; | ||
875 | |||
876 | /* legacy -> bail early */ | ||
877 | if (host->revmap_type == IRQ_HOST_MAP_LEGACY) | ||
878 | return hwirq; | ||
879 | |||
880 | /* Slow path does a linear search of the map */ | ||
881 | if (hint < NUM_ISA_INTERRUPTS) | ||
882 | hint = NUM_ISA_INTERRUPTS; | ||
883 | i = hint; | ||
884 | do { | ||
885 | if (irq_map[i].host == host && | ||
886 | irq_map[i].hwirq == hwirq) | ||
887 | return i; | ||
888 | i++; | ||
889 | if (i >= irq_virq_count) | ||
890 | i = NUM_ISA_INTERRUPTS; | ||
891 | } while(i != hint); | ||
892 | return NO_IRQ; | ||
893 | } | ||
894 | EXPORT_SYMBOL_GPL(irq_find_mapping); | ||
895 | |||
896 | #ifdef CONFIG_SMP | 506 | #ifdef CONFIG_SMP |
897 | int irq_choose_cpu(const struct cpumask *mask) | 507 | int irq_choose_cpu(const struct cpumask *mask) |
898 | { | 508 | { |
@@ -929,232 +539,11 @@ int irq_choose_cpu(const struct cpumask *mask) | |||
929 | } | 539 | } |
930 | #endif | 540 | #endif |
931 | 541 | ||
932 | unsigned int irq_radix_revmap_lookup(struct irq_host *host, | ||
933 | irq_hw_number_t hwirq) | ||
934 | { | ||
935 | struct irq_map_entry *ptr; | ||
936 | unsigned int virq; | ||
937 | |||
938 | if (WARN_ON_ONCE(host->revmap_type != IRQ_HOST_MAP_TREE)) | ||
939 | return irq_find_mapping(host, hwirq); | ||
940 | |||
941 | /* | ||
942 | * The ptr returned references the static global irq_map. | ||
943 | * but freeing an irq can delete nodes along the path to | ||
944 | * do the lookup via call_rcu. | ||
945 | */ | ||
946 | rcu_read_lock(); | ||
947 | ptr = radix_tree_lookup(&host->revmap_data.tree, hwirq); | ||
948 | rcu_read_unlock(); | ||
949 | |||
950 | /* | ||
951 | * If found in radix tree, then fine. | ||
952 | * Else fallback to linear lookup - this should not happen in practice | ||
953 | * as it means that we failed to insert the node in the radix tree. | ||
954 | */ | ||
955 | if (ptr) | ||
956 | virq = ptr - irq_map; | ||
957 | else | ||
958 | virq = irq_find_mapping(host, hwirq); | ||
959 | |||
960 | return virq; | ||
961 | } | ||
962 | |||
963 | void irq_radix_revmap_insert(struct irq_host *host, unsigned int virq, | ||
964 | irq_hw_number_t hwirq) | ||
965 | { | ||
966 | if (WARN_ON(host->revmap_type != IRQ_HOST_MAP_TREE)) | ||
967 | return; | ||
968 | |||
969 | if (virq != NO_IRQ) { | ||
970 | mutex_lock(&revmap_trees_mutex); | ||
971 | radix_tree_insert(&host->revmap_data.tree, hwirq, | ||
972 | &irq_map[virq]); | ||
973 | mutex_unlock(&revmap_trees_mutex); | ||
974 | } | ||
975 | } | ||
976 | |||
977 | unsigned int irq_linear_revmap(struct irq_host *host, | ||
978 | irq_hw_number_t hwirq) | ||
979 | { | ||
980 | unsigned int *revmap; | ||
981 | |||
982 | if (WARN_ON_ONCE(host->revmap_type != IRQ_HOST_MAP_LINEAR)) | ||
983 | return irq_find_mapping(host, hwirq); | ||
984 | |||
985 | /* Check revmap bounds */ | ||
986 | if (unlikely(hwirq >= host->revmap_data.linear.size)) | ||
987 | return irq_find_mapping(host, hwirq); | ||
988 | |||
989 | /* Check if revmap was allocated */ | ||
990 | revmap = host->revmap_data.linear.revmap; | ||
991 | if (unlikely(revmap == NULL)) | ||
992 | return irq_find_mapping(host, hwirq); | ||
993 | |||
994 | /* Fill up revmap with slow path if no mapping found */ | ||
995 | if (unlikely(revmap[hwirq] == NO_IRQ)) | ||
996 | revmap[hwirq] = irq_find_mapping(host, hwirq); | ||
997 | |||
998 | return revmap[hwirq]; | ||
999 | } | ||
1000 | |||
1001 | unsigned int irq_alloc_virt(struct irq_host *host, | ||
1002 | unsigned int count, | ||
1003 | unsigned int hint) | ||
1004 | { | ||
1005 | unsigned long flags; | ||
1006 | unsigned int i, j, found = NO_IRQ; | ||
1007 | |||
1008 | if (count == 0 || count > (irq_virq_count - NUM_ISA_INTERRUPTS)) | ||
1009 | return NO_IRQ; | ||
1010 | |||
1011 | raw_spin_lock_irqsave(&irq_big_lock, flags); | ||
1012 | |||
1013 | /* Use hint for 1 interrupt if any */ | ||
1014 | if (count == 1 && hint >= NUM_ISA_INTERRUPTS && | ||
1015 | hint < irq_virq_count && irq_map[hint].host == NULL) { | ||
1016 | found = hint; | ||
1017 | goto hint_found; | ||
1018 | } | ||
1019 | |||
1020 | /* Look for count consecutive numbers in the allocatable | ||
1021 | * (non-legacy) space | ||
1022 | */ | ||
1023 | for (i = NUM_ISA_INTERRUPTS, j = 0; i < irq_virq_count; i++) { | ||
1024 | if (irq_map[i].host != NULL) | ||
1025 | j = 0; | ||
1026 | else | ||
1027 | j++; | ||
1028 | |||
1029 | if (j == count) { | ||
1030 | found = i - count + 1; | ||
1031 | break; | ||
1032 | } | ||
1033 | } | ||
1034 | if (found == NO_IRQ) { | ||
1035 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
1036 | return NO_IRQ; | ||
1037 | } | ||
1038 | hint_found: | ||
1039 | for (i = found; i < (found + count); i++) { | ||
1040 | irq_map[i].hwirq = host->inval_irq; | ||
1041 | smp_wmb(); | ||
1042 | irq_map[i].host = host; | ||
1043 | } | ||
1044 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
1045 | return found; | ||
1046 | } | ||
1047 | |||
1048 | void irq_free_virt(unsigned int virq, unsigned int count) | ||
1049 | { | ||
1050 | unsigned long flags; | ||
1051 | unsigned int i; | ||
1052 | |||
1053 | WARN_ON (virq < NUM_ISA_INTERRUPTS); | ||
1054 | WARN_ON (count == 0 || (virq + count) > irq_virq_count); | ||
1055 | |||
1056 | if (virq < NUM_ISA_INTERRUPTS) { | ||
1057 | if (virq + count < NUM_ISA_INTERRUPTS) | ||
1058 | return; | ||
1059 | count =- NUM_ISA_INTERRUPTS - virq; | ||
1060 | virq = NUM_ISA_INTERRUPTS; | ||
1061 | } | ||
1062 | |||
1063 | if (count > irq_virq_count || virq > irq_virq_count - count) { | ||
1064 | if (virq > irq_virq_count) | ||
1065 | return; | ||
1066 | count = irq_virq_count - virq; | ||
1067 | } | ||
1068 | |||
1069 | raw_spin_lock_irqsave(&irq_big_lock, flags); | ||
1070 | for (i = virq; i < (virq + count); i++) { | ||
1071 | struct irq_host *host; | ||
1072 | |||
1073 | host = irq_map[i].host; | ||
1074 | irq_map[i].hwirq = host->inval_irq; | ||
1075 | smp_wmb(); | ||
1076 | irq_map[i].host = NULL; | ||
1077 | } | ||
1078 | raw_spin_unlock_irqrestore(&irq_big_lock, flags); | ||
1079 | } | ||
1080 | |||
1081 | int arch_early_irq_init(void) | 542 | int arch_early_irq_init(void) |
1082 | { | 543 | { |
1083 | return 0; | 544 | return 0; |
1084 | } | 545 | } |
1085 | 546 | ||
1086 | #ifdef CONFIG_VIRQ_DEBUG | ||
1087 | static int virq_debug_show(struct seq_file *m, void *private) | ||
1088 | { | ||
1089 | unsigned long flags; | ||
1090 | struct irq_desc *desc; | ||
1091 | const char *p; | ||
1092 | static const char none[] = "none"; | ||
1093 | void *data; | ||
1094 | int i; | ||
1095 | |||
1096 | seq_printf(m, "%-5s %-7s %-15s %-18s %s\n", "virq", "hwirq", | ||
1097 | "chip name", "chip data", "host name"); | ||
1098 | |||
1099 | for (i = 1; i < nr_irqs; i++) { | ||
1100 | desc = irq_to_desc(i); | ||
1101 | if (!desc) | ||
1102 | continue; | ||
1103 | |||
1104 | raw_spin_lock_irqsave(&desc->lock, flags); | ||
1105 | |||
1106 | if (desc->action && desc->action->handler) { | ||
1107 | struct irq_chip *chip; | ||
1108 | |||
1109 | seq_printf(m, "%5d ", i); | ||
1110 | seq_printf(m, "0x%05lx ", irq_map[i].hwirq); | ||
1111 | |||
1112 | chip = irq_desc_get_chip(desc); | ||
1113 | if (chip && chip->name) | ||
1114 | p = chip->name; | ||
1115 | else | ||
1116 | p = none; | ||
1117 | seq_printf(m, "%-15s ", p); | ||
1118 | |||
1119 | data = irq_desc_get_chip_data(desc); | ||
1120 | seq_printf(m, "0x%16p ", data); | ||
1121 | |||
1122 | if (irq_map[i].host && irq_map[i].host->of_node) | ||
1123 | p = irq_map[i].host->of_node->full_name; | ||
1124 | else | ||
1125 | p = none; | ||
1126 | seq_printf(m, "%s\n", p); | ||
1127 | } | ||
1128 | |||
1129 | raw_spin_unlock_irqrestore(&desc->lock, flags); | ||
1130 | } | ||
1131 | |||
1132 | return 0; | ||
1133 | } | ||
1134 | |||
1135 | static int virq_debug_open(struct inode *inode, struct file *file) | ||
1136 | { | ||
1137 | return single_open(file, virq_debug_show, inode->i_private); | ||
1138 | } | ||
1139 | |||
1140 | static const struct file_operations virq_debug_fops = { | ||
1141 | .open = virq_debug_open, | ||
1142 | .read = seq_read, | ||
1143 | .llseek = seq_lseek, | ||
1144 | .release = single_release, | ||
1145 | }; | ||
1146 | |||
1147 | static int __init irq_debugfs_init(void) | ||
1148 | { | ||
1149 | if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root, | ||
1150 | NULL, &virq_debug_fops) == NULL) | ||
1151 | return -ENOMEM; | ||
1152 | |||
1153 | return 0; | ||
1154 | } | ||
1155 | __initcall(irq_debugfs_init); | ||
1156 | #endif /* CONFIG_VIRQ_DEBUG */ | ||
1157 | |||
1158 | #ifdef CONFIG_PPC64 | 547 | #ifdef CONFIG_PPC64 |
1159 | static int __init setup_noirqdistrib(char *str) | 548 | static int __init setup_noirqdistrib(char *str) |
1160 | { | 549 | { |
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c index 9f09319352c0..ca3a062ed1b9 100644 --- a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c +++ b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <asm/prom.h> | 21 | #include <asm/prom.h> |
22 | 22 | ||
23 | static struct device_node *cpld_pic_node; | 23 | static struct device_node *cpld_pic_node; |
24 | static struct irq_host *cpld_pic_host; | 24 | static struct irq_domain *cpld_pic_host; |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * Bits to ignore in the misc_status register | 27 | * Bits to ignore in the misc_status register |
@@ -123,13 +123,13 @@ cpld_pic_cascade(unsigned int irq, struct irq_desc *desc) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | static int | 125 | static int |
126 | cpld_pic_host_match(struct irq_host *h, struct device_node *node) | 126 | cpld_pic_host_match(struct irq_domain *h, struct device_node *node) |
127 | { | 127 | { |
128 | return cpld_pic_node == node; | 128 | return cpld_pic_node == node; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int | 131 | static int |
132 | cpld_pic_host_map(struct irq_host *h, unsigned int virq, | 132 | cpld_pic_host_map(struct irq_domain *h, unsigned int virq, |
133 | irq_hw_number_t hw) | 133 | irq_hw_number_t hw) |
134 | { | 134 | { |
135 | irq_set_status_flags(virq, IRQ_LEVEL); | 135 | irq_set_status_flags(virq, IRQ_LEVEL); |
@@ -137,8 +137,7 @@ cpld_pic_host_map(struct irq_host *h, unsigned int virq, | |||
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
139 | 139 | ||
140 | static struct | 140 | static const struct irq_domain_ops cpld_pic_host_ops = { |
141 | irq_host_ops cpld_pic_host_ops = { | ||
142 | .match = cpld_pic_host_match, | 141 | .match = cpld_pic_host_match, |
143 | .map = cpld_pic_host_map, | 142 | .map = cpld_pic_host_map, |
144 | }; | 143 | }; |
@@ -191,8 +190,7 @@ mpc5121_ads_cpld_pic_init(void) | |||
191 | 190 | ||
192 | cpld_pic_node = of_node_get(np); | 191 | cpld_pic_node = of_node_get(np); |
193 | 192 | ||
194 | cpld_pic_host = | 193 | cpld_pic_host = irq_domain_add_linear(np, 16, &cpld_pic_host_ops, NULL); |
195 | irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, 16, &cpld_pic_host_ops, 16); | ||
196 | if (!cpld_pic_host) { | 194 | if (!cpld_pic_host) { |
197 | printk(KERN_ERR "CPLD PIC: failed to allocate irq host!\n"); | 195 | printk(KERN_ERR "CPLD PIC: failed to allocate irq host!\n"); |
198 | goto end; | 196 | goto end; |
diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c index 96f85e5e0cd3..17d91b7da315 100644 --- a/arch/powerpc/platforms/52xx/media5200.c +++ b/arch/powerpc/platforms/52xx/media5200.c | |||
@@ -45,7 +45,7 @@ static struct of_device_id mpc5200_gpio_ids[] __initdata = { | |||
45 | struct media5200_irq { | 45 | struct media5200_irq { |
46 | void __iomem *regs; | 46 | void __iomem *regs; |
47 | spinlock_t lock; | 47 | spinlock_t lock; |
48 | struct irq_host *irqhost; | 48 | struct irq_domain *irqhost; |
49 | }; | 49 | }; |
50 | struct media5200_irq media5200_irq; | 50 | struct media5200_irq media5200_irq; |
51 | 51 | ||
@@ -112,7 +112,7 @@ void media5200_irq_cascade(unsigned int virq, struct irq_desc *desc) | |||
112 | raw_spin_unlock(&desc->lock); | 112 | raw_spin_unlock(&desc->lock); |
113 | } | 113 | } |
114 | 114 | ||
115 | static int media5200_irq_map(struct irq_host *h, unsigned int virq, | 115 | static int media5200_irq_map(struct irq_domain *h, unsigned int virq, |
116 | irq_hw_number_t hw) | 116 | irq_hw_number_t hw) |
117 | { | 117 | { |
118 | pr_debug("%s: h=%p, virq=%i, hwirq=%i\n", __func__, h, virq, (int)hw); | 118 | pr_debug("%s: h=%p, virq=%i, hwirq=%i\n", __func__, h, virq, (int)hw); |
@@ -122,7 +122,7 @@ static int media5200_irq_map(struct irq_host *h, unsigned int virq, | |||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | static int media5200_irq_xlate(struct irq_host *h, struct device_node *ct, | 125 | static int media5200_irq_xlate(struct irq_domain *h, struct device_node *ct, |
126 | const u32 *intspec, unsigned int intsize, | 126 | const u32 *intspec, unsigned int intsize, |
127 | irq_hw_number_t *out_hwirq, | 127 | irq_hw_number_t *out_hwirq, |
128 | unsigned int *out_flags) | 128 | unsigned int *out_flags) |
@@ -136,7 +136,7 @@ static int media5200_irq_xlate(struct irq_host *h, struct device_node *ct, | |||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | static struct irq_host_ops media5200_irq_ops = { | 139 | static const struct irq_domain_ops media5200_irq_ops = { |
140 | .map = media5200_irq_map, | 140 | .map = media5200_irq_map, |
141 | .xlate = media5200_irq_xlate, | 141 | .xlate = media5200_irq_xlate, |
142 | }; | 142 | }; |
@@ -173,15 +173,12 @@ static void __init media5200_init_irq(void) | |||
173 | 173 | ||
174 | spin_lock_init(&media5200_irq.lock); | 174 | spin_lock_init(&media5200_irq.lock); |
175 | 175 | ||
176 | media5200_irq.irqhost = irq_alloc_host(fpga_np, IRQ_HOST_MAP_LINEAR, | 176 | media5200_irq.irqhost = irq_domain_add_linear(fpga_np, |
177 | MEDIA5200_NUM_IRQS, | 177 | MEDIA5200_NUM_IRQS, &media5200_irq_ops, &media5200_irq); |
178 | &media5200_irq_ops, -1); | ||
179 | if (!media5200_irq.irqhost) | 178 | if (!media5200_irq.irqhost) |
180 | goto out; | 179 | goto out; |
181 | pr_debug("%s: allocated irqhost\n", __func__); | 180 | pr_debug("%s: allocated irqhost\n", __func__); |
182 | 181 | ||
183 | media5200_irq.irqhost->host_data = &media5200_irq; | ||
184 | |||
185 | irq_set_handler_data(cascade_virq, &media5200_irq); | 182 | irq_set_handler_data(cascade_virq, &media5200_irq); |
186 | irq_set_chained_handler(cascade_virq, media5200_irq_cascade); | 183 | irq_set_chained_handler(cascade_virq, media5200_irq_cascade); |
187 | 184 | ||
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c index f94f06e52762..028470b95886 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c | |||
@@ -81,7 +81,7 @@ MODULE_LICENSE("GPL"); | |||
81 | * @regs: virtual address of GPT registers | 81 | * @regs: virtual address of GPT registers |
82 | * @lock: spinlock to coordinate between different functions. | 82 | * @lock: spinlock to coordinate between different functions. |
83 | * @gc: gpio_chip instance structure; used when GPIO is enabled | 83 | * @gc: gpio_chip instance structure; used when GPIO is enabled |
84 | * @irqhost: Pointer to irq_host instance; used when IRQ mode is supported | 84 | * @irqhost: Pointer to irq_domain instance; used when IRQ mode is supported |
85 | * @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicates | 85 | * @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicates |
86 | * if the gpt may be used as wdt, bit 1 (MPC52xx_GPT_IS_WDT) indicates | 86 | * if the gpt may be used as wdt, bit 1 (MPC52xx_GPT_IS_WDT) indicates |
87 | * if the timer is actively used as wdt which blocks gpt functions | 87 | * if the timer is actively used as wdt which blocks gpt functions |
@@ -91,7 +91,7 @@ struct mpc52xx_gpt_priv { | |||
91 | struct device *dev; | 91 | struct device *dev; |
92 | struct mpc52xx_gpt __iomem *regs; | 92 | struct mpc52xx_gpt __iomem *regs; |
93 | spinlock_t lock; | 93 | spinlock_t lock; |
94 | struct irq_host *irqhost; | 94 | struct irq_domain *irqhost; |
95 | u32 ipb_freq; | 95 | u32 ipb_freq; |
96 | u8 wdt_mode; | 96 | u8 wdt_mode; |
97 | 97 | ||
@@ -204,7 +204,7 @@ void mpc52xx_gpt_irq_cascade(unsigned int virq, struct irq_desc *desc) | |||
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||
207 | static int mpc52xx_gpt_irq_map(struct irq_host *h, unsigned int virq, | 207 | static int mpc52xx_gpt_irq_map(struct irq_domain *h, unsigned int virq, |
208 | irq_hw_number_t hw) | 208 | irq_hw_number_t hw) |
209 | { | 209 | { |
210 | struct mpc52xx_gpt_priv *gpt = h->host_data; | 210 | struct mpc52xx_gpt_priv *gpt = h->host_data; |
@@ -216,7 +216,7 @@ static int mpc52xx_gpt_irq_map(struct irq_host *h, unsigned int virq, | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
219 | static int mpc52xx_gpt_irq_xlate(struct irq_host *h, struct device_node *ct, | 219 | static int mpc52xx_gpt_irq_xlate(struct irq_domain *h, struct device_node *ct, |
220 | const u32 *intspec, unsigned int intsize, | 220 | const u32 *intspec, unsigned int intsize, |
221 | irq_hw_number_t *out_hwirq, | 221 | irq_hw_number_t *out_hwirq, |
222 | unsigned int *out_flags) | 222 | unsigned int *out_flags) |
@@ -236,7 +236,7 @@ static int mpc52xx_gpt_irq_xlate(struct irq_host *h, struct device_node *ct, | |||
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
238 | 238 | ||
239 | static struct irq_host_ops mpc52xx_gpt_irq_ops = { | 239 | static const struct irq_domain_ops mpc52xx_gpt_irq_ops = { |
240 | .map = mpc52xx_gpt_irq_map, | 240 | .map = mpc52xx_gpt_irq_map, |
241 | .xlate = mpc52xx_gpt_irq_xlate, | 241 | .xlate = mpc52xx_gpt_irq_xlate, |
242 | }; | 242 | }; |
@@ -252,14 +252,12 @@ mpc52xx_gpt_irq_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node) | |||
252 | if (!cascade_virq) | 252 | if (!cascade_virq) |
253 | return; | 253 | return; |
254 | 254 | ||
255 | gpt->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, 1, | 255 | gpt->irqhost = irq_domain_add_linear(node, 1, &mpc52xx_gpt_irq_ops, gpt); |
256 | &mpc52xx_gpt_irq_ops, -1); | ||
257 | if (!gpt->irqhost) { | 256 | if (!gpt->irqhost) { |
258 | dev_err(gpt->dev, "irq_alloc_host() failed\n"); | 257 | dev_err(gpt->dev, "irq_domain_add_linear() failed\n"); |
259 | return; | 258 | return; |
260 | } | 259 | } |
261 | 260 | ||
262 | gpt->irqhost->host_data = gpt; | ||
263 | irq_set_handler_data(cascade_virq, gpt); | 261 | irq_set_handler_data(cascade_virq, gpt); |
264 | irq_set_chained_handler(cascade_virq, mpc52xx_gpt_irq_cascade); | 262 | irq_set_chained_handler(cascade_virq, mpc52xx_gpt_irq_cascade); |
265 | 263 | ||
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c index 1a9a49570579..8520b58a5e9a 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c | |||
@@ -132,7 +132,7 @@ static struct of_device_id mpc52xx_sdma_ids[] __initdata = { | |||
132 | 132 | ||
133 | static struct mpc52xx_intr __iomem *intr; | 133 | static struct mpc52xx_intr __iomem *intr; |
134 | static struct mpc52xx_sdma __iomem *sdma; | 134 | static struct mpc52xx_sdma __iomem *sdma; |
135 | static struct irq_host *mpc52xx_irqhost = NULL; | 135 | static struct irq_domain *mpc52xx_irqhost = NULL; |
136 | 136 | ||
137 | static unsigned char mpc52xx_map_senses[4] = { | 137 | static unsigned char mpc52xx_map_senses[4] = { |
138 | IRQ_TYPE_LEVEL_HIGH, | 138 | IRQ_TYPE_LEVEL_HIGH, |
@@ -301,7 +301,7 @@ static int mpc52xx_is_extirq(int l1, int l2) | |||
301 | /** | 301 | /** |
302 | * mpc52xx_irqhost_xlate - translate virq# from device tree interrupts property | 302 | * mpc52xx_irqhost_xlate - translate virq# from device tree interrupts property |
303 | */ | 303 | */ |
304 | static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct, | 304 | static int mpc52xx_irqhost_xlate(struct irq_domain *h, struct device_node *ct, |
305 | const u32 *intspec, unsigned int intsize, | 305 | const u32 *intspec, unsigned int intsize, |
306 | irq_hw_number_t *out_hwirq, | 306 | irq_hw_number_t *out_hwirq, |
307 | unsigned int *out_flags) | 307 | unsigned int *out_flags) |
@@ -335,7 +335,7 @@ static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct, | |||
335 | /** | 335 | /** |
336 | * mpc52xx_irqhost_map - Hook to map from virq to an irq_chip structure | 336 | * mpc52xx_irqhost_map - Hook to map from virq to an irq_chip structure |
337 | */ | 337 | */ |
338 | static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq, | 338 | static int mpc52xx_irqhost_map(struct irq_domain *h, unsigned int virq, |
339 | irq_hw_number_t irq) | 339 | irq_hw_number_t irq) |
340 | { | 340 | { |
341 | int l1irq; | 341 | int l1irq; |
@@ -384,7 +384,7 @@ static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq, | |||
384 | return 0; | 384 | return 0; |
385 | } | 385 | } |
386 | 386 | ||
387 | static struct irq_host_ops mpc52xx_irqhost_ops = { | 387 | static const struct irq_domain_ops mpc52xx_irqhost_ops = { |
388 | .xlate = mpc52xx_irqhost_xlate, | 388 | .xlate = mpc52xx_irqhost_xlate, |
389 | .map = mpc52xx_irqhost_map, | 389 | .map = mpc52xx_irqhost_map, |
390 | }; | 390 | }; |
@@ -444,9 +444,9 @@ void __init mpc52xx_init_irq(void) | |||
444 | * As last step, add an irq host to translate the real | 444 | * As last step, add an irq host to translate the real |
445 | * hw irq information provided by the ofw to linux virq | 445 | * hw irq information provided by the ofw to linux virq |
446 | */ | 446 | */ |
447 | mpc52xx_irqhost = irq_alloc_host(picnode, IRQ_HOST_MAP_LINEAR, | 447 | mpc52xx_irqhost = irq_domain_add_linear(picnode, |
448 | MPC52xx_IRQ_HIGHTESTHWIRQ, | 448 | MPC52xx_IRQ_HIGHTESTHWIRQ, |
449 | &mpc52xx_irqhost_ops, -1); | 449 | &mpc52xx_irqhost_ops, NULL); |
450 | 450 | ||
451 | if (!mpc52xx_irqhost) | 451 | if (!mpc52xx_irqhost) |
452 | panic(__FILE__ ": Cannot allocate the IRQ host\n"); | 452 | panic(__FILE__ ": Cannot allocate the IRQ host\n"); |
diff --git a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c index 8ccf9ed62fe2..328d221fd1c0 100644 --- a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c +++ b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c | |||
@@ -29,7 +29,7 @@ static DEFINE_RAW_SPINLOCK(pci_pic_lock); | |||
29 | 29 | ||
30 | struct pq2ads_pci_pic { | 30 | struct pq2ads_pci_pic { |
31 | struct device_node *node; | 31 | struct device_node *node; |
32 | struct irq_host *host; | 32 | struct irq_domain *host; |
33 | 33 | ||
34 | struct { | 34 | struct { |
35 | u32 stat; | 35 | u32 stat; |
@@ -103,7 +103,7 @@ static void pq2ads_pci_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | static int pci_pic_host_map(struct irq_host *h, unsigned int virq, | 106 | static int pci_pic_host_map(struct irq_domain *h, unsigned int virq, |
107 | irq_hw_number_t hw) | 107 | irq_hw_number_t hw) |
108 | { | 108 | { |
109 | irq_set_status_flags(virq, IRQ_LEVEL); | 109 | irq_set_status_flags(virq, IRQ_LEVEL); |
@@ -112,14 +112,14 @@ static int pci_pic_host_map(struct irq_host *h, unsigned int virq, | |||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | static struct irq_host_ops pci_pic_host_ops = { | 115 | static const struct irq_domain_ops pci_pic_host_ops = { |
116 | .map = pci_pic_host_map, | 116 | .map = pci_pic_host_map, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | int __init pq2ads_pci_init_irq(void) | 119 | int __init pq2ads_pci_init_irq(void) |
120 | { | 120 | { |
121 | struct pq2ads_pci_pic *priv; | 121 | struct pq2ads_pci_pic *priv; |
122 | struct irq_host *host; | 122 | struct irq_domain *host; |
123 | struct device_node *np; | 123 | struct device_node *np; |
124 | int ret = -ENODEV; | 124 | int ret = -ENODEV; |
125 | int irq; | 125 | int irq; |
@@ -156,17 +156,13 @@ int __init pq2ads_pci_init_irq(void) | |||
156 | out_be32(&priv->regs->mask, ~0); | 156 | out_be32(&priv->regs->mask, ~0); |
157 | mb(); | 157 | mb(); |
158 | 158 | ||
159 | host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, NUM_IRQS, | 159 | host = irq_domain_add_linear(np, NUM_IRQS, &pci_pic_host_ops, priv); |
160 | &pci_pic_host_ops, NUM_IRQS); | ||
161 | if (!host) { | 160 | if (!host) { |
162 | ret = -ENOMEM; | 161 | ret = -ENOMEM; |
163 | goto out_unmap_regs; | 162 | goto out_unmap_regs; |
164 | } | 163 | } |
165 | 164 | ||
166 | host->host_data = priv; | ||
167 | |||
168 | priv->host = host; | 165 | priv->host = host; |
169 | host->host_data = priv; | ||
170 | irq_set_handler_data(irq, priv); | 166 | irq_set_handler_data(irq, priv); |
171 | irq_set_chained_handler(irq, pq2ads_pci_irq_demux); | 167 | irq_set_chained_handler(irq, pq2ads_pci_irq_demux); |
172 | 168 | ||
diff --git a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c index 12cb9bb2cc68..3bbbf7489487 100644 --- a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c +++ b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c | |||
@@ -51,7 +51,7 @@ static struct socrates_fpga_irq_info fpga_irqs[SOCRATES_FPGA_NUM_IRQS] = { | |||
51 | static DEFINE_RAW_SPINLOCK(socrates_fpga_pic_lock); | 51 | static DEFINE_RAW_SPINLOCK(socrates_fpga_pic_lock); |
52 | 52 | ||
53 | static void __iomem *socrates_fpga_pic_iobase; | 53 | static void __iomem *socrates_fpga_pic_iobase; |
54 | static struct irq_host *socrates_fpga_pic_irq_host; | 54 | static struct irq_domain *socrates_fpga_pic_irq_host; |
55 | static unsigned int socrates_fpga_irqs[3]; | 55 | static unsigned int socrates_fpga_irqs[3]; |
56 | 56 | ||
57 | static inline uint32_t socrates_fpga_pic_read(int reg) | 57 | static inline uint32_t socrates_fpga_pic_read(int reg) |
@@ -227,7 +227,7 @@ static struct irq_chip socrates_fpga_pic_chip = { | |||
227 | .irq_set_type = socrates_fpga_pic_set_type, | 227 | .irq_set_type = socrates_fpga_pic_set_type, |
228 | }; | 228 | }; |
229 | 229 | ||
230 | static int socrates_fpga_pic_host_map(struct irq_host *h, unsigned int virq, | 230 | static int socrates_fpga_pic_host_map(struct irq_domain *h, unsigned int virq, |
231 | irq_hw_number_t hwirq) | 231 | irq_hw_number_t hwirq) |
232 | { | 232 | { |
233 | /* All interrupts are LEVEL sensitive */ | 233 | /* All interrupts are LEVEL sensitive */ |
@@ -238,7 +238,7 @@ static int socrates_fpga_pic_host_map(struct irq_host *h, unsigned int virq, | |||
238 | return 0; | 238 | return 0; |
239 | } | 239 | } |
240 | 240 | ||
241 | static int socrates_fpga_pic_host_xlate(struct irq_host *h, | 241 | static int socrates_fpga_pic_host_xlate(struct irq_domain *h, |
242 | struct device_node *ct, const u32 *intspec, unsigned int intsize, | 242 | struct device_node *ct, const u32 *intspec, unsigned int intsize, |
243 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 243 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
244 | { | 244 | { |
@@ -269,7 +269,7 @@ static int socrates_fpga_pic_host_xlate(struct irq_host *h, | |||
269 | return 0; | 269 | return 0; |
270 | } | 270 | } |
271 | 271 | ||
272 | static struct irq_host_ops socrates_fpga_pic_host_ops = { | 272 | static const struct irq_domain_ops socrates_fpga_pic_host_ops = { |
273 | .map = socrates_fpga_pic_host_map, | 273 | .map = socrates_fpga_pic_host_map, |
274 | .xlate = socrates_fpga_pic_host_xlate, | 274 | .xlate = socrates_fpga_pic_host_xlate, |
275 | }; | 275 | }; |
@@ -279,10 +279,9 @@ void socrates_fpga_pic_init(struct device_node *pic) | |||
279 | unsigned long flags; | 279 | unsigned long flags; |
280 | int i; | 280 | int i; |
281 | 281 | ||
282 | /* Setup an irq_host structure */ | 282 | /* Setup an irq_domain structure */ |
283 | socrates_fpga_pic_irq_host = irq_alloc_host(pic, IRQ_HOST_MAP_LINEAR, | 283 | socrates_fpga_pic_irq_host = irq_domain_add_linear(pic, |
284 | SOCRATES_FPGA_NUM_IRQS, &socrates_fpga_pic_host_ops, | 284 | SOCRATES_FPGA_NUM_IRQS, &socrates_fpga_pic_host_ops, NULL); |
285 | SOCRATES_FPGA_NUM_IRQS); | ||
286 | if (socrates_fpga_pic_irq_host == NULL) { | 285 | if (socrates_fpga_pic_irq_host == NULL) { |
287 | pr_err("FPGA PIC: Unable to allocate host\n"); | 286 | pr_err("FPGA PIC: Unable to allocate host\n"); |
288 | return; | 287 | return; |
diff --git a/arch/powerpc/platforms/86xx/gef_pic.c b/arch/powerpc/platforms/86xx/gef_pic.c index 94594e58594c..af3fd697de82 100644 --- a/arch/powerpc/platforms/86xx/gef_pic.c +++ b/arch/powerpc/platforms/86xx/gef_pic.c | |||
@@ -50,7 +50,7 @@ | |||
50 | static DEFINE_RAW_SPINLOCK(gef_pic_lock); | 50 | static DEFINE_RAW_SPINLOCK(gef_pic_lock); |
51 | 51 | ||
52 | static void __iomem *gef_pic_irq_reg_base; | 52 | static void __iomem *gef_pic_irq_reg_base; |
53 | static struct irq_host *gef_pic_irq_host; | 53 | static struct irq_domain *gef_pic_irq_host; |
54 | static int gef_pic_cascade_irq; | 54 | static int gef_pic_cascade_irq; |
55 | 55 | ||
56 | /* | 56 | /* |
@@ -153,7 +153,7 @@ static struct irq_chip gef_pic_chip = { | |||
153 | /* When an interrupt is being configured, this call allows some flexibilty | 153 | /* When an interrupt is being configured, this call allows some flexibilty |
154 | * in deciding which irq_chip structure is used | 154 | * in deciding which irq_chip structure is used |
155 | */ | 155 | */ |
156 | static int gef_pic_host_map(struct irq_host *h, unsigned int virq, | 156 | static int gef_pic_host_map(struct irq_domain *h, unsigned int virq, |
157 | irq_hw_number_t hwirq) | 157 | irq_hw_number_t hwirq) |
158 | { | 158 | { |
159 | /* All interrupts are LEVEL sensitive */ | 159 | /* All interrupts are LEVEL sensitive */ |
@@ -163,7 +163,7 @@ static int gef_pic_host_map(struct irq_host *h, unsigned int virq, | |||
163 | return 0; | 163 | return 0; |
164 | } | 164 | } |
165 | 165 | ||
166 | static int gef_pic_host_xlate(struct irq_host *h, struct device_node *ct, | 166 | static int gef_pic_host_xlate(struct irq_domain *h, struct device_node *ct, |
167 | const u32 *intspec, unsigned int intsize, | 167 | const u32 *intspec, unsigned int intsize, |
168 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 168 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
169 | { | 169 | { |
@@ -177,7 +177,7 @@ static int gef_pic_host_xlate(struct irq_host *h, struct device_node *ct, | |||
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
180 | static struct irq_host_ops gef_pic_host_ops = { | 180 | static const struct irq_domain_ops gef_pic_host_ops = { |
181 | .map = gef_pic_host_map, | 181 | .map = gef_pic_host_map, |
182 | .xlate = gef_pic_host_xlate, | 182 | .xlate = gef_pic_host_xlate, |
183 | }; | 183 | }; |
@@ -211,10 +211,9 @@ void __init gef_pic_init(struct device_node *np) | |||
211 | return; | 211 | return; |
212 | } | 212 | } |
213 | 213 | ||
214 | /* Setup an irq_host structure */ | 214 | /* Setup an irq_domain structure */ |
215 | gef_pic_irq_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, | 215 | gef_pic_irq_host = irq_domain_add_linear(np, GEF_PIC_NUM_IRQS, |
216 | GEF_PIC_NUM_IRQS, | 216 | &gef_pic_host_ops, NULL); |
217 | &gef_pic_host_ops, NO_IRQ); | ||
218 | if (gef_pic_irq_host == NULL) | 217 | if (gef_pic_irq_host == NULL) |
219 | return; | 218 | return; |
220 | 219 | ||
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index 40a6e34793b4..db360fc4cf0e 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c | |||
@@ -67,7 +67,7 @@ | |||
67 | 67 | ||
68 | 68 | ||
69 | struct axon_msic { | 69 | struct axon_msic { |
70 | struct irq_host *irq_host; | 70 | struct irq_domain *irq_domain; |
71 | __le32 *fifo_virt; | 71 | __le32 *fifo_virt; |
72 | dma_addr_t fifo_phys; | 72 | dma_addr_t fifo_phys; |
73 | dcr_host_t dcr_host; | 73 | dcr_host_t dcr_host; |
@@ -152,7 +152,7 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc) | |||
152 | 152 | ||
153 | static struct axon_msic *find_msi_translator(struct pci_dev *dev) | 153 | static struct axon_msic *find_msi_translator(struct pci_dev *dev) |
154 | { | 154 | { |
155 | struct irq_host *irq_host; | 155 | struct irq_domain *irq_domain; |
156 | struct device_node *dn, *tmp; | 156 | struct device_node *dn, *tmp; |
157 | const phandle *ph; | 157 | const phandle *ph; |
158 | struct axon_msic *msic = NULL; | 158 | struct axon_msic *msic = NULL; |
@@ -184,14 +184,14 @@ static struct axon_msic *find_msi_translator(struct pci_dev *dev) | |||
184 | goto out_error; | 184 | goto out_error; |
185 | } | 185 | } |
186 | 186 | ||
187 | irq_host = irq_find_host(dn); | 187 | irq_domain = irq_find_host(dn); |
188 | if (!irq_host) { | 188 | if (!irq_domain) { |
189 | dev_dbg(&dev->dev, "axon_msi: no irq_host found for node %s\n", | 189 | dev_dbg(&dev->dev, "axon_msi: no irq_domain found for node %s\n", |
190 | dn->full_name); | 190 | dn->full_name); |
191 | goto out_error; | 191 | goto out_error; |
192 | } | 192 | } |
193 | 193 | ||
194 | msic = irq_host->host_data; | 194 | msic = irq_domain->host_data; |
195 | 195 | ||
196 | out_error: | 196 | out_error: |
197 | of_node_put(dn); | 197 | of_node_put(dn); |
@@ -280,7 +280,7 @@ static int axon_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | |||
280 | BUILD_BUG_ON(NR_IRQS > 65536); | 280 | BUILD_BUG_ON(NR_IRQS > 65536); |
281 | 281 | ||
282 | list_for_each_entry(entry, &dev->msi_list, list) { | 282 | list_for_each_entry(entry, &dev->msi_list, list) { |
283 | virq = irq_create_direct_mapping(msic->irq_host); | 283 | virq = irq_create_direct_mapping(msic->irq_domain); |
284 | if (virq == NO_IRQ) { | 284 | if (virq == NO_IRQ) { |
285 | dev_warn(&dev->dev, | 285 | dev_warn(&dev->dev, |
286 | "axon_msi: virq allocation failed!\n"); | 286 | "axon_msi: virq allocation failed!\n"); |
@@ -318,7 +318,7 @@ static struct irq_chip msic_irq_chip = { | |||
318 | .name = "AXON-MSI", | 318 | .name = "AXON-MSI", |
319 | }; | 319 | }; |
320 | 320 | ||
321 | static int msic_host_map(struct irq_host *h, unsigned int virq, | 321 | static int msic_host_map(struct irq_domain *h, unsigned int virq, |
322 | irq_hw_number_t hw) | 322 | irq_hw_number_t hw) |
323 | { | 323 | { |
324 | irq_set_chip_data(virq, h->host_data); | 324 | irq_set_chip_data(virq, h->host_data); |
@@ -327,7 +327,7 @@ static int msic_host_map(struct irq_host *h, unsigned int virq, | |||
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | 329 | ||
330 | static struct irq_host_ops msic_host_ops = { | 330 | static const struct irq_domain_ops msic_host_ops = { |
331 | .map = msic_host_map, | 331 | .map = msic_host_map, |
332 | }; | 332 | }; |
333 | 333 | ||
@@ -337,7 +337,7 @@ static void axon_msi_shutdown(struct platform_device *device) | |||
337 | u32 tmp; | 337 | u32 tmp; |
338 | 338 | ||
339 | pr_devel("axon_msi: disabling %s\n", | 339 | pr_devel("axon_msi: disabling %s\n", |
340 | msic->irq_host->of_node->full_name); | 340 | msic->irq_domain->of_node->full_name); |
341 | tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG); | 341 | tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG); |
342 | tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE; | 342 | tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE; |
343 | msic_dcr_write(msic, MSIC_CTRL_REG, tmp); | 343 | msic_dcr_write(msic, MSIC_CTRL_REG, tmp); |
@@ -392,16 +392,13 @@ static int axon_msi_probe(struct platform_device *device) | |||
392 | } | 392 | } |
393 | memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); | 393 | memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); |
394 | 394 | ||
395 | msic->irq_host = irq_alloc_host(dn, IRQ_HOST_MAP_NOMAP, | 395 | msic->irq_domain = irq_domain_add_nomap(dn, &msic_host_ops, msic); |
396 | NR_IRQS, &msic_host_ops, 0); | 396 | if (!msic->irq_domain) { |
397 | if (!msic->irq_host) { | 397 | printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n", |
398 | printk(KERN_ERR "axon_msi: couldn't allocate irq_host for %s\n", | ||
399 | dn->full_name); | 398 | dn->full_name); |
400 | goto out_free_fifo; | 399 | goto out_free_fifo; |
401 | } | 400 | } |
402 | 401 | ||
403 | msic->irq_host->host_data = msic; | ||
404 | |||
405 | irq_set_handler_data(virq, msic); | 402 | irq_set_handler_data(virq, msic); |
406 | irq_set_chained_handler(virq, axon_msi_cascade); | 403 | irq_set_chained_handler(virq, axon_msi_cascade); |
407 | pr_devel("axon_msi: irq 0x%x setup for axon_msi\n", virq); | 404 | pr_devel("axon_msi: irq 0x%x setup for axon_msi\n", virq); |
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c index 55015e1f6939..e5c3a2c6090d 100644 --- a/arch/powerpc/platforms/cell/beat_interrupt.c +++ b/arch/powerpc/platforms/cell/beat_interrupt.c | |||
@@ -34,7 +34,7 @@ static DEFINE_RAW_SPINLOCK(beatic_irq_mask_lock); | |||
34 | static uint64_t beatic_irq_mask_enable[(MAX_IRQS+255)/64]; | 34 | static uint64_t beatic_irq_mask_enable[(MAX_IRQS+255)/64]; |
35 | static uint64_t beatic_irq_mask_ack[(MAX_IRQS+255)/64]; | 35 | static uint64_t beatic_irq_mask_ack[(MAX_IRQS+255)/64]; |
36 | 36 | ||
37 | static struct irq_host *beatic_host; | 37 | static struct irq_domain *beatic_host; |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * In this implementation, "virq" == "IRQ plug number", | 40 | * In this implementation, "virq" == "IRQ plug number", |
@@ -122,7 +122,7 @@ static struct irq_chip beatic_pic = { | |||
122 | * | 122 | * |
123 | * Note that the number (virq) is already assigned at upper layer. | 123 | * Note that the number (virq) is already assigned at upper layer. |
124 | */ | 124 | */ |
125 | static void beatic_pic_host_unmap(struct irq_host *h, unsigned int virq) | 125 | static void beatic_pic_host_unmap(struct irq_domain *h, unsigned int virq) |
126 | { | 126 | { |
127 | beat_destruct_irq_plug(virq); | 127 | beat_destruct_irq_plug(virq); |
128 | } | 128 | } |
@@ -133,7 +133,7 @@ static void beatic_pic_host_unmap(struct irq_host *h, unsigned int virq) | |||
133 | * | 133 | * |
134 | * Note that the number (virq) is already assigned at upper layer. | 134 | * Note that the number (virq) is already assigned at upper layer. |
135 | */ | 135 | */ |
136 | static int beatic_pic_host_map(struct irq_host *h, unsigned int virq, | 136 | static int beatic_pic_host_map(struct irq_domain *h, unsigned int virq, |
137 | irq_hw_number_t hw) | 137 | irq_hw_number_t hw) |
138 | { | 138 | { |
139 | int64_t err; | 139 | int64_t err; |
@@ -154,7 +154,7 @@ static int beatic_pic_host_map(struct irq_host *h, unsigned int virq, | |||
154 | * Called from irq_create_of_mapping() only. | 154 | * Called from irq_create_of_mapping() only. |
155 | * Note: We have only 1 entry to translate. | 155 | * Note: We have only 1 entry to translate. |
156 | */ | 156 | */ |
157 | static int beatic_pic_host_xlate(struct irq_host *h, struct device_node *ct, | 157 | static int beatic_pic_host_xlate(struct irq_domain *h, struct device_node *ct, |
158 | const u32 *intspec, unsigned int intsize, | 158 | const u32 *intspec, unsigned int intsize, |
159 | irq_hw_number_t *out_hwirq, | 159 | irq_hw_number_t *out_hwirq, |
160 | unsigned int *out_flags) | 160 | unsigned int *out_flags) |
@@ -166,13 +166,13 @@ static int beatic_pic_host_xlate(struct irq_host *h, struct device_node *ct, | |||
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
169 | static int beatic_pic_host_match(struct irq_host *h, struct device_node *np) | 169 | static int beatic_pic_host_match(struct irq_domain *h, struct device_node *np) |
170 | { | 170 | { |
171 | /* Match all */ | 171 | /* Match all */ |
172 | return 1; | 172 | return 1; |
173 | } | 173 | } |
174 | 174 | ||
175 | static struct irq_host_ops beatic_pic_host_ops = { | 175 | static const struct irq_domain_ops beatic_pic_host_ops = { |
176 | .map = beatic_pic_host_map, | 176 | .map = beatic_pic_host_map, |
177 | .unmap = beatic_pic_host_unmap, | 177 | .unmap = beatic_pic_host_unmap, |
178 | .xlate = beatic_pic_host_xlate, | 178 | .xlate = beatic_pic_host_xlate, |
@@ -239,9 +239,7 @@ void __init beatic_init_IRQ(void) | |||
239 | ppc_md.get_irq = beatic_get_irq; | 239 | ppc_md.get_irq = beatic_get_irq; |
240 | 240 | ||
241 | /* Allocate an irq host */ | 241 | /* Allocate an irq host */ |
242 | beatic_host = irq_alloc_host(NULL, IRQ_HOST_MAP_NOMAP, 0, | 242 | beatic_host = irq_domain_add_nomap(NULL, &beatic_pic_host_ops, NULL); |
243 | &beatic_pic_host_ops, | ||
244 | 0); | ||
245 | BUG_ON(beatic_host == NULL); | 243 | BUG_ON(beatic_host == NULL); |
246 | irq_set_default_host(beatic_host); | 244 | irq_set_default_host(beatic_host); |
247 | } | 245 | } |
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c index 96a433dd2d64..2d42f3bb66d6 100644 --- a/arch/powerpc/platforms/cell/interrupt.c +++ b/arch/powerpc/platforms/cell/interrupt.c | |||
@@ -56,7 +56,7 @@ struct iic { | |||
56 | 56 | ||
57 | static DEFINE_PER_CPU(struct iic, cpu_iic); | 57 | static DEFINE_PER_CPU(struct iic, cpu_iic); |
58 | #define IIC_NODE_COUNT 2 | 58 | #define IIC_NODE_COUNT 2 |
59 | static struct irq_host *iic_host; | 59 | static struct irq_domain *iic_host; |
60 | 60 | ||
61 | /* Convert between "pending" bits and hw irq number */ | 61 | /* Convert between "pending" bits and hw irq number */ |
62 | static irq_hw_number_t iic_pending_to_hwnum(struct cbe_iic_pending_bits bits) | 62 | static irq_hw_number_t iic_pending_to_hwnum(struct cbe_iic_pending_bits bits) |
@@ -186,7 +186,7 @@ void iic_message_pass(int cpu, int msg) | |||
186 | out_be64(&per_cpu(cpu_iic, cpu).regs->generate, (0xf - msg) << 4); | 186 | out_be64(&per_cpu(cpu_iic, cpu).regs->generate, (0xf - msg) << 4); |
187 | } | 187 | } |
188 | 188 | ||
189 | struct irq_host *iic_get_irq_host(int node) | 189 | struct irq_domain *iic_get_irq_host(int node) |
190 | { | 190 | { |
191 | return iic_host; | 191 | return iic_host; |
192 | } | 192 | } |
@@ -222,13 +222,13 @@ void iic_request_IPIs(void) | |||
222 | #endif /* CONFIG_SMP */ | 222 | #endif /* CONFIG_SMP */ |
223 | 223 | ||
224 | 224 | ||
225 | static int iic_host_match(struct irq_host *h, struct device_node *node) | 225 | static int iic_host_match(struct irq_domain *h, struct device_node *node) |
226 | { | 226 | { |
227 | return of_device_is_compatible(node, | 227 | return of_device_is_compatible(node, |
228 | "IBM,CBEA-Internal-Interrupt-Controller"); | 228 | "IBM,CBEA-Internal-Interrupt-Controller"); |
229 | } | 229 | } |
230 | 230 | ||
231 | static int iic_host_map(struct irq_host *h, unsigned int virq, | 231 | static int iic_host_map(struct irq_domain *h, unsigned int virq, |
232 | irq_hw_number_t hw) | 232 | irq_hw_number_t hw) |
233 | { | 233 | { |
234 | switch (hw & IIC_IRQ_TYPE_MASK) { | 234 | switch (hw & IIC_IRQ_TYPE_MASK) { |
@@ -245,7 +245,7 @@ static int iic_host_map(struct irq_host *h, unsigned int virq, | |||
245 | return 0; | 245 | return 0; |
246 | } | 246 | } |
247 | 247 | ||
248 | static int iic_host_xlate(struct irq_host *h, struct device_node *ct, | 248 | static int iic_host_xlate(struct irq_domain *h, struct device_node *ct, |
249 | const u32 *intspec, unsigned int intsize, | 249 | const u32 *intspec, unsigned int intsize, |
250 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 250 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
251 | 251 | ||
@@ -285,7 +285,7 @@ static int iic_host_xlate(struct irq_host *h, struct device_node *ct, | |||
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | static struct irq_host_ops iic_host_ops = { | 288 | static const struct irq_domain_ops iic_host_ops = { |
289 | .match = iic_host_match, | 289 | .match = iic_host_match, |
290 | .map = iic_host_map, | 290 | .map = iic_host_map, |
291 | .xlate = iic_host_xlate, | 291 | .xlate = iic_host_xlate, |
@@ -378,8 +378,8 @@ static int __init setup_iic(void) | |||
378 | void __init iic_init_IRQ(void) | 378 | void __init iic_init_IRQ(void) |
379 | { | 379 | { |
380 | /* Setup an irq host data structure */ | 380 | /* Setup an irq host data structure */ |
381 | iic_host = irq_alloc_host(NULL, IRQ_HOST_MAP_LINEAR, IIC_SOURCE_COUNT, | 381 | iic_host = irq_domain_add_linear(NULL, IIC_SOURCE_COUNT, &iic_host_ops, |
382 | &iic_host_ops, IIC_IRQ_INVALID); | 382 | NULL); |
383 | BUG_ON(iic_host == NULL); | 383 | BUG_ON(iic_host == NULL); |
384 | irq_set_default_host(iic_host); | 384 | irq_set_default_host(iic_host); |
385 | 385 | ||
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c index 442c28c00f88..d8b7cc8a66ca 100644 --- a/arch/powerpc/platforms/cell/spider-pic.c +++ b/arch/powerpc/platforms/cell/spider-pic.c | |||
@@ -62,7 +62,7 @@ enum { | |||
62 | #define SPIDER_IRQ_INVALID 63 | 62 | #define SPIDER_IRQ_INVALID 63 |
63 | 63 | ||
64 | struct spider_pic { | 64 | struct spider_pic { |
65 | struct irq_host *host; | 65 | struct irq_domain *host; |
66 | void __iomem *regs; | 66 | void __iomem *regs; |
67 | unsigned int node_id; | 67 | unsigned int node_id; |
68 | }; | 68 | }; |
@@ -168,7 +168,7 @@ static struct irq_chip spider_pic = { | |||
168 | .irq_set_type = spider_set_irq_type, | 168 | .irq_set_type = spider_set_irq_type, |
169 | }; | 169 | }; |
170 | 170 | ||
171 | static int spider_host_map(struct irq_host *h, unsigned int virq, | 171 | static int spider_host_map(struct irq_domain *h, unsigned int virq, |
172 | irq_hw_number_t hw) | 172 | irq_hw_number_t hw) |
173 | { | 173 | { |
174 | irq_set_chip_data(virq, h->host_data); | 174 | irq_set_chip_data(virq, h->host_data); |
@@ -180,7 +180,7 @@ static int spider_host_map(struct irq_host *h, unsigned int virq, | |||
180 | return 0; | 180 | return 0; |
181 | } | 181 | } |
182 | 182 | ||
183 | static int spider_host_xlate(struct irq_host *h, struct device_node *ct, | 183 | static int spider_host_xlate(struct irq_domain *h, struct device_node *ct, |
184 | const u32 *intspec, unsigned int intsize, | 184 | const u32 *intspec, unsigned int intsize, |
185 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 185 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
186 | 186 | ||
@@ -194,7 +194,7 @@ static int spider_host_xlate(struct irq_host *h, struct device_node *ct, | |||
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
197 | static struct irq_host_ops spider_host_ops = { | 197 | static const struct irq_domain_ops spider_host_ops = { |
198 | .map = spider_host_map, | 198 | .map = spider_host_map, |
199 | .xlate = spider_host_xlate, | 199 | .xlate = spider_host_xlate, |
200 | }; | 200 | }; |
@@ -299,12 +299,10 @@ static void __init spider_init_one(struct device_node *of_node, int chip, | |||
299 | panic("spider_pic: can't map registers !"); | 299 | panic("spider_pic: can't map registers !"); |
300 | 300 | ||
301 | /* Allocate a host */ | 301 | /* Allocate a host */ |
302 | pic->host = irq_alloc_host(of_node, IRQ_HOST_MAP_LINEAR, | 302 | pic->host = irq_domain_add_linear(of_node, SPIDER_SRC_COUNT, |
303 | SPIDER_SRC_COUNT, &spider_host_ops, | 303 | &spider_host_ops, pic); |
304 | SPIDER_IRQ_INVALID); | ||
305 | if (pic->host == NULL) | 304 | if (pic->host == NULL) |
306 | panic("spider_pic: can't allocate irq host !"); | 305 | panic("spider_pic: can't allocate irq host !"); |
307 | pic->host->host_data = pic; | ||
308 | 306 | ||
309 | /* Go through all sources and disable them */ | 307 | /* Go through all sources and disable them */ |
310 | for (i = 0; i < SPIDER_SRC_COUNT; i++) { | 308 | for (i = 0; i < SPIDER_SRC_COUNT; i++) { |
diff --git a/arch/powerpc/platforms/embedded6xx/flipper-pic.c b/arch/powerpc/platforms/embedded6xx/flipper-pic.c index f61a2dd96b99..53d6eee01963 100644 --- a/arch/powerpc/platforms/embedded6xx/flipper-pic.c +++ b/arch/powerpc/platforms/embedded6xx/flipper-pic.c | |||
@@ -96,9 +96,9 @@ static struct irq_chip flipper_pic = { | |||
96 | * | 96 | * |
97 | */ | 97 | */ |
98 | 98 | ||
99 | static struct irq_host *flipper_irq_host; | 99 | static struct irq_domain *flipper_irq_host; |
100 | 100 | ||
101 | static int flipper_pic_map(struct irq_host *h, unsigned int virq, | 101 | static int flipper_pic_map(struct irq_domain *h, unsigned int virq, |
102 | irq_hw_number_t hwirq) | 102 | irq_hw_number_t hwirq) |
103 | { | 103 | { |
104 | irq_set_chip_data(virq, h->host_data); | 104 | irq_set_chip_data(virq, h->host_data); |
@@ -107,13 +107,13 @@ static int flipper_pic_map(struct irq_host *h, unsigned int virq, | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | static int flipper_pic_match(struct irq_host *h, struct device_node *np) | 110 | static int flipper_pic_match(struct irq_domain *h, struct device_node *np) |
111 | { | 111 | { |
112 | return 1; | 112 | return 1; |
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
116 | static struct irq_host_ops flipper_irq_host_ops = { | 116 | static const struct irq_domain_ops flipper_irq_domain_ops = { |
117 | .map = flipper_pic_map, | 117 | .map = flipper_pic_map, |
118 | .match = flipper_pic_match, | 118 | .match = flipper_pic_match, |
119 | }; | 119 | }; |
@@ -130,10 +130,10 @@ static void __flipper_quiesce(void __iomem *io_base) | |||
130 | out_be32(io_base + FLIPPER_ICR, 0xffffffff); | 130 | out_be32(io_base + FLIPPER_ICR, 0xffffffff); |
131 | } | 131 | } |
132 | 132 | ||
133 | struct irq_host * __init flipper_pic_init(struct device_node *np) | 133 | struct irq_domain * __init flipper_pic_init(struct device_node *np) |
134 | { | 134 | { |
135 | struct device_node *pi; | 135 | struct device_node *pi; |
136 | struct irq_host *irq_host = NULL; | 136 | struct irq_domain *irq_domain = NULL; |
137 | struct resource res; | 137 | struct resource res; |
138 | void __iomem *io_base; | 138 | void __iomem *io_base; |
139 | int retval; | 139 | int retval; |
@@ -159,17 +159,15 @@ struct irq_host * __init flipper_pic_init(struct device_node *np) | |||
159 | 159 | ||
160 | __flipper_quiesce(io_base); | 160 | __flipper_quiesce(io_base); |
161 | 161 | ||
162 | irq_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, FLIPPER_NR_IRQS, | 162 | irq_domain = irq_domain_add_linear(np, FLIPPER_NR_IRQS, |
163 | &flipper_irq_host_ops, -1); | 163 | &flipper_irq_domain_ops, io_base); |
164 | if (!irq_host) { | 164 | if (!irq_domain) { |
165 | pr_err("failed to allocate irq_host\n"); | 165 | pr_err("failed to allocate irq_domain\n"); |
166 | return NULL; | 166 | return NULL; |
167 | } | 167 | } |
168 | 168 | ||
169 | irq_host->host_data = io_base; | ||
170 | |||
171 | out: | 169 | out: |
172 | return irq_host; | 170 | return irq_domain; |
173 | } | 171 | } |
174 | 172 | ||
175 | unsigned int flipper_pic_get_irq(void) | 173 | unsigned int flipper_pic_get_irq(void) |
diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c index e4919170c6bc..3006b5117ec6 100644 --- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c | |||
@@ -89,9 +89,9 @@ static struct irq_chip hlwd_pic = { | |||
89 | * | 89 | * |
90 | */ | 90 | */ |
91 | 91 | ||
92 | static struct irq_host *hlwd_irq_host; | 92 | static struct irq_domain *hlwd_irq_host; |
93 | 93 | ||
94 | static int hlwd_pic_map(struct irq_host *h, unsigned int virq, | 94 | static int hlwd_pic_map(struct irq_domain *h, unsigned int virq, |
95 | irq_hw_number_t hwirq) | 95 | irq_hw_number_t hwirq) |
96 | { | 96 | { |
97 | irq_set_chip_data(virq, h->host_data); | 97 | irq_set_chip_data(virq, h->host_data); |
@@ -100,11 +100,11 @@ static int hlwd_pic_map(struct irq_host *h, unsigned int virq, | |||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | static struct irq_host_ops hlwd_irq_host_ops = { | 103 | static const struct irq_domain_ops hlwd_irq_domain_ops = { |
104 | .map = hlwd_pic_map, | 104 | .map = hlwd_pic_map, |
105 | }; | 105 | }; |
106 | 106 | ||
107 | static unsigned int __hlwd_pic_get_irq(struct irq_host *h) | 107 | static unsigned int __hlwd_pic_get_irq(struct irq_domain *h) |
108 | { | 108 | { |
109 | void __iomem *io_base = h->host_data; | 109 | void __iomem *io_base = h->host_data; |
110 | int irq; | 110 | int irq; |
@@ -123,14 +123,14 @@ static void hlwd_pic_irq_cascade(unsigned int cascade_virq, | |||
123 | struct irq_desc *desc) | 123 | struct irq_desc *desc) |
124 | { | 124 | { |
125 | struct irq_chip *chip = irq_desc_get_chip(desc); | 125 | struct irq_chip *chip = irq_desc_get_chip(desc); |
126 | struct irq_host *irq_host = irq_get_handler_data(cascade_virq); | 126 | struct irq_domain *irq_domain = irq_get_handler_data(cascade_virq); |
127 | unsigned int virq; | 127 | unsigned int virq; |
128 | 128 | ||
129 | raw_spin_lock(&desc->lock); | 129 | raw_spin_lock(&desc->lock); |
130 | chip->irq_mask(&desc->irq_data); /* IRQ_LEVEL */ | 130 | chip->irq_mask(&desc->irq_data); /* IRQ_LEVEL */ |
131 | raw_spin_unlock(&desc->lock); | 131 | raw_spin_unlock(&desc->lock); |
132 | 132 | ||
133 | virq = __hlwd_pic_get_irq(irq_host); | 133 | virq = __hlwd_pic_get_irq(irq_domain); |
134 | if (virq != NO_IRQ) | 134 | if (virq != NO_IRQ) |
135 | generic_handle_irq(virq); | 135 | generic_handle_irq(virq); |
136 | else | 136 | else |
@@ -155,9 +155,9 @@ static void __hlwd_quiesce(void __iomem *io_base) | |||
155 | out_be32(io_base + HW_BROADWAY_ICR, 0xffffffff); | 155 | out_be32(io_base + HW_BROADWAY_ICR, 0xffffffff); |
156 | } | 156 | } |
157 | 157 | ||
158 | struct irq_host *hlwd_pic_init(struct device_node *np) | 158 | struct irq_domain *hlwd_pic_init(struct device_node *np) |
159 | { | 159 | { |
160 | struct irq_host *irq_host; | 160 | struct irq_domain *irq_domain; |
161 | struct resource res; | 161 | struct resource res; |
162 | void __iomem *io_base; | 162 | void __iomem *io_base; |
163 | int retval; | 163 | int retval; |
@@ -177,15 +177,14 @@ struct irq_host *hlwd_pic_init(struct device_node *np) | |||
177 | 177 | ||
178 | __hlwd_quiesce(io_base); | 178 | __hlwd_quiesce(io_base); |
179 | 179 | ||
180 | irq_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, HLWD_NR_IRQS, | 180 | irq_domain = irq_domain_add_linear(np, HLWD_NR_IRQS, |
181 | &hlwd_irq_host_ops, -1); | 181 | &hlwd_irq_domain_ops, io_base); |
182 | if (!irq_host) { | 182 | if (!irq_domain) { |
183 | pr_err("failed to allocate irq_host\n"); | 183 | pr_err("failed to allocate irq_domain\n"); |
184 | return NULL; | 184 | return NULL; |
185 | } | 185 | } |
186 | irq_host->host_data = io_base; | ||
187 | 186 | ||
188 | return irq_host; | 187 | return irq_domain; |
189 | } | 188 | } |
190 | 189 | ||
191 | unsigned int hlwd_pic_get_irq(void) | 190 | unsigned int hlwd_pic_get_irq(void) |
@@ -200,7 +199,7 @@ unsigned int hlwd_pic_get_irq(void) | |||
200 | 199 | ||
201 | void hlwd_pic_probe(void) | 200 | void hlwd_pic_probe(void) |
202 | { | 201 | { |
203 | struct irq_host *host; | 202 | struct irq_domain *host; |
204 | struct device_node *np; | 203 | struct device_node *np; |
205 | const u32 *interrupts; | 204 | const u32 *interrupts; |
206 | int cascade_virq; | 205 | int cascade_virq; |
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c index b2103453eb01..05ce5164cafc 100644 --- a/arch/powerpc/platforms/iseries/irq.c +++ b/arch/powerpc/platforms/iseries/irq.c | |||
@@ -342,7 +342,7 @@ unsigned int iSeries_get_irq(void) | |||
342 | 342 | ||
343 | #ifdef CONFIG_PCI | 343 | #ifdef CONFIG_PCI |
344 | 344 | ||
345 | static int iseries_irq_host_map(struct irq_host *h, unsigned int virq, | 345 | static int iseries_irq_host_map(struct irq_domain *h, unsigned int virq, |
346 | irq_hw_number_t hw) | 346 | irq_hw_number_t hw) |
347 | { | 347 | { |
348 | irq_set_chip_and_handler(virq, &iseries_pic, handle_fasteoi_irq); | 348 | irq_set_chip_and_handler(virq, &iseries_pic, handle_fasteoi_irq); |
@@ -350,13 +350,13 @@ static int iseries_irq_host_map(struct irq_host *h, unsigned int virq, | |||
350 | return 0; | 350 | return 0; |
351 | } | 351 | } |
352 | 352 | ||
353 | static int iseries_irq_host_match(struct irq_host *h, struct device_node *np) | 353 | static int iseries_irq_host_match(struct irq_domain *h, struct device_node *np) |
354 | { | 354 | { |
355 | /* Match all */ | 355 | /* Match all */ |
356 | return 1; | 356 | return 1; |
357 | } | 357 | } |
358 | 358 | ||
359 | static struct irq_host_ops iseries_irq_host_ops = { | 359 | static const struct irq_domain_ops iseries_irq_domain_ops = { |
360 | .map = iseries_irq_host_map, | 360 | .map = iseries_irq_host_map, |
361 | .match = iseries_irq_host_match, | 361 | .match = iseries_irq_host_match, |
362 | }; | 362 | }; |
@@ -368,7 +368,7 @@ static struct irq_host_ops iseries_irq_host_ops = { | |||
368 | void __init iSeries_init_IRQ(void) | 368 | void __init iSeries_init_IRQ(void) |
369 | { | 369 | { |
370 | /* Register PCI event handler and open an event path */ | 370 | /* Register PCI event handler and open an event path */ |
371 | struct irq_host *host; | 371 | struct irq_domain *host; |
372 | int ret; | 372 | int ret; |
373 | 373 | ||
374 | /* | 374 | /* |
@@ -380,8 +380,7 @@ void __init iSeries_init_IRQ(void) | |||
380 | /* Create irq host. No need for a revmap since HV will give us | 380 | /* Create irq host. No need for a revmap since HV will give us |
381 | * back our virtual irq number | 381 | * back our virtual irq number |
382 | */ | 382 | */ |
383 | host = irq_alloc_host(NULL, IRQ_HOST_MAP_NOMAP, 0, | 383 | host = irq_domain_add_nomap(NULL, &iseries_irq_domain_ops, NULL); |
384 | &iseries_irq_host_ops, 0); | ||
385 | BUG_ON(host == NULL); | 384 | BUG_ON(host == NULL); |
386 | irq_set_default_host(host); | 385 | irq_set_default_host(host); |
387 | 386 | ||
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index 7761aabfc293..92afc382a49e 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c | |||
@@ -61,7 +61,7 @@ static DEFINE_RAW_SPINLOCK(pmac_pic_lock); | |||
61 | static unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; | 61 | static unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; |
62 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | 62 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; |
63 | static int pmac_irq_cascade = -1; | 63 | static int pmac_irq_cascade = -1; |
64 | static struct irq_host *pmac_pic_host; | 64 | static struct irq_domain *pmac_pic_host; |
65 | 65 | ||
66 | static void __pmac_retrigger(unsigned int irq_nr) | 66 | static void __pmac_retrigger(unsigned int irq_nr) |
67 | { | 67 | { |
@@ -268,13 +268,13 @@ static struct irqaction gatwick_cascade_action = { | |||
268 | .name = "cascade", | 268 | .name = "cascade", |
269 | }; | 269 | }; |
270 | 270 | ||
271 | static int pmac_pic_host_match(struct irq_host *h, struct device_node *node) | 271 | static int pmac_pic_host_match(struct irq_domain *h, struct device_node *node) |
272 | { | 272 | { |
273 | /* We match all, we don't always have a node anyway */ | 273 | /* We match all, we don't always have a node anyway */ |
274 | return 1; | 274 | return 1; |
275 | } | 275 | } |
276 | 276 | ||
277 | static int pmac_pic_host_map(struct irq_host *h, unsigned int virq, | 277 | static int pmac_pic_host_map(struct irq_domain *h, unsigned int virq, |
278 | irq_hw_number_t hw) | 278 | irq_hw_number_t hw) |
279 | { | 279 | { |
280 | if (hw >= max_irqs) | 280 | if (hw >= max_irqs) |
@@ -288,21 +288,10 @@ static int pmac_pic_host_map(struct irq_host *h, unsigned int virq, | |||
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
290 | 290 | ||
291 | static int pmac_pic_host_xlate(struct irq_host *h, struct device_node *ct, | 291 | static const struct irq_domain_ops pmac_pic_host_ops = { |
292 | const u32 *intspec, unsigned int intsize, | ||
293 | irq_hw_number_t *out_hwirq, | ||
294 | unsigned int *out_flags) | ||
295 | |||
296 | { | ||
297 | *out_flags = IRQ_TYPE_NONE; | ||
298 | *out_hwirq = *intspec; | ||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | static struct irq_host_ops pmac_pic_host_ops = { | ||
303 | .match = pmac_pic_host_match, | 292 | .match = pmac_pic_host_match, |
304 | .map = pmac_pic_host_map, | 293 | .map = pmac_pic_host_map, |
305 | .xlate = pmac_pic_host_xlate, | 294 | .xlate = irq_domain_xlate_onecell, |
306 | }; | 295 | }; |
307 | 296 | ||
308 | static void __init pmac_pic_probe_oldstyle(void) | 297 | static void __init pmac_pic_probe_oldstyle(void) |
@@ -352,9 +341,8 @@ static void __init pmac_pic_probe_oldstyle(void) | |||
352 | /* | 341 | /* |
353 | * Allocate an irq host | 342 | * Allocate an irq host |
354 | */ | 343 | */ |
355 | pmac_pic_host = irq_alloc_host(master, IRQ_HOST_MAP_LINEAR, max_irqs, | 344 | pmac_pic_host = irq_domain_add_linear(master, max_irqs, |
356 | &pmac_pic_host_ops, | 345 | &pmac_pic_host_ops, NULL); |
357 | max_irqs); | ||
358 | BUG_ON(pmac_pic_host == NULL); | 346 | BUG_ON(pmac_pic_host == NULL); |
359 | irq_set_default_host(pmac_pic_host); | 347 | irq_set_default_host(pmac_pic_host); |
360 | 348 | ||
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index 44d769258ebf..a81e5a88fbdf 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -125,7 +125,7 @@ static volatile u32 __iomem *psurge_start; | |||
125 | static int psurge_type = PSURGE_NONE; | 125 | static int psurge_type = PSURGE_NONE; |
126 | 126 | ||
127 | /* irq for secondary cpus to report */ | 127 | /* irq for secondary cpus to report */ |
128 | static struct irq_host *psurge_host; | 128 | static struct irq_domain *psurge_host; |
129 | int psurge_secondary_virq; | 129 | int psurge_secondary_virq; |
130 | 130 | ||
131 | /* | 131 | /* |
@@ -176,7 +176,7 @@ static void smp_psurge_cause_ipi(int cpu, unsigned long data) | |||
176 | psurge_set_ipi(cpu); | 176 | psurge_set_ipi(cpu); |
177 | } | 177 | } |
178 | 178 | ||
179 | static int psurge_host_map(struct irq_host *h, unsigned int virq, | 179 | static int psurge_host_map(struct irq_domain *h, unsigned int virq, |
180 | irq_hw_number_t hw) | 180 | irq_hw_number_t hw) |
181 | { | 181 | { |
182 | irq_set_chip_and_handler(virq, &dummy_irq_chip, handle_percpu_irq); | 182 | irq_set_chip_and_handler(virq, &dummy_irq_chip, handle_percpu_irq); |
@@ -184,7 +184,7 @@ static int psurge_host_map(struct irq_host *h, unsigned int virq, | |||
184 | return 0; | 184 | return 0; |
185 | } | 185 | } |
186 | 186 | ||
187 | struct irq_host_ops psurge_host_ops = { | 187 | static const struct irq_domain_ops psurge_host_ops = { |
188 | .map = psurge_host_map, | 188 | .map = psurge_host_map, |
189 | }; | 189 | }; |
190 | 190 | ||
@@ -192,8 +192,7 @@ static int psurge_secondary_ipi_init(void) | |||
192 | { | 192 | { |
193 | int rc = -ENOMEM; | 193 | int rc = -ENOMEM; |
194 | 194 | ||
195 | psurge_host = irq_alloc_host(NULL, IRQ_HOST_MAP_NOMAP, 0, | 195 | psurge_host = irq_domain_add_nomap(NULL, &psurge_host_ops, NULL); |
196 | &psurge_host_ops, 0); | ||
197 | 196 | ||
198 | if (psurge_host) | 197 | if (psurge_host) |
199 | psurge_secondary_virq = irq_create_direct_mapping(psurge_host); | 198 | psurge_secondary_virq = irq_create_direct_mapping(psurge_host); |
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c index 617efa12a3a5..2a4ff86cc21f 100644 --- a/arch/powerpc/platforms/ps3/interrupt.c +++ b/arch/powerpc/platforms/ps3/interrupt.c | |||
@@ -667,7 +667,7 @@ static void __maybe_unused _dump_mask(struct ps3_private *pd, | |||
667 | static void dump_bmp(struct ps3_private* pd) {}; | 667 | static void dump_bmp(struct ps3_private* pd) {}; |
668 | #endif /* defined(DEBUG) */ | 668 | #endif /* defined(DEBUG) */ |
669 | 669 | ||
670 | static int ps3_host_map(struct irq_host *h, unsigned int virq, | 670 | static int ps3_host_map(struct irq_domain *h, unsigned int virq, |
671 | irq_hw_number_t hwirq) | 671 | irq_hw_number_t hwirq) |
672 | { | 672 | { |
673 | DBG("%s:%d: hwirq %lu, virq %u\n", __func__, __LINE__, hwirq, | 673 | DBG("%s:%d: hwirq %lu, virq %u\n", __func__, __LINE__, hwirq, |
@@ -678,13 +678,13 @@ static int ps3_host_map(struct irq_host *h, unsigned int virq, | |||
678 | return 0; | 678 | return 0; |
679 | } | 679 | } |
680 | 680 | ||
681 | static int ps3_host_match(struct irq_host *h, struct device_node *np) | 681 | static int ps3_host_match(struct irq_domain *h, struct device_node *np) |
682 | { | 682 | { |
683 | /* Match all */ | 683 | /* Match all */ |
684 | return 1; | 684 | return 1; |
685 | } | 685 | } |
686 | 686 | ||
687 | static struct irq_host_ops ps3_host_ops = { | 687 | static const struct irq_domain_ops ps3_host_ops = { |
688 | .map = ps3_host_map, | 688 | .map = ps3_host_map, |
689 | .match = ps3_host_match, | 689 | .match = ps3_host_match, |
690 | }; | 690 | }; |
@@ -751,10 +751,9 @@ void __init ps3_init_IRQ(void) | |||
751 | { | 751 | { |
752 | int result; | 752 | int result; |
753 | unsigned cpu; | 753 | unsigned cpu; |
754 | struct irq_host *host; | 754 | struct irq_domain *host; |
755 | 755 | ||
756 | host = irq_alloc_host(NULL, IRQ_HOST_MAP_NOMAP, 0, &ps3_host_ops, | 756 | host = irq_domain_add_nomap(NULL, &ps3_host_ops, NULL); |
757 | PS3_INVALID_OUTLET); | ||
758 | irq_set_default_host(host); | 757 | irq_set_default_host(host); |
759 | irq_set_virq_count(PS3_PLUG_MAX + 1); | 758 | irq_set_virq_count(PS3_PLUG_MAX + 1); |
760 | 759 | ||
diff --git a/arch/powerpc/platforms/wsp/opb_pic.c b/arch/powerpc/platforms/wsp/opb_pic.c index 19f353dfcd03..cb565bf93650 100644 --- a/arch/powerpc/platforms/wsp/opb_pic.c +++ b/arch/powerpc/platforms/wsp/opb_pic.c | |||
@@ -30,7 +30,7 @@ | |||
30 | static int opb_index = 0; | 30 | static int opb_index = 0; |
31 | 31 | ||
32 | struct opb_pic { | 32 | struct opb_pic { |
33 | struct irq_host *host; | 33 | struct irq_domain *host; |
34 | void *regs; | 34 | void *regs; |
35 | int index; | 35 | int index; |
36 | spinlock_t lock; | 36 | spinlock_t lock; |
@@ -179,7 +179,7 @@ static struct irq_chip opb_irq_chip = { | |||
179 | .irq_set_type = opb_set_irq_type | 179 | .irq_set_type = opb_set_irq_type |
180 | }; | 180 | }; |
181 | 181 | ||
182 | static int opb_host_map(struct irq_host *host, unsigned int virq, | 182 | static int opb_host_map(struct irq_domain *host, unsigned int virq, |
183 | irq_hw_number_t hwirq) | 183 | irq_hw_number_t hwirq) |
184 | { | 184 | { |
185 | struct opb_pic *opb; | 185 | struct opb_pic *opb; |
@@ -196,20 +196,9 @@ static int opb_host_map(struct irq_host *host, unsigned int virq, | |||
196 | return 0; | 196 | return 0; |
197 | } | 197 | } |
198 | 198 | ||
199 | static int opb_host_xlate(struct irq_host *host, struct device_node *dn, | 199 | static const struct irq_domain_ops opb_host_ops = { |
200 | const u32 *intspec, unsigned int intsize, | ||
201 | irq_hw_number_t *out_hwirq, unsigned int *out_type) | ||
202 | { | ||
203 | /* Interrupt size must == 2 */ | ||
204 | BUG_ON(intsize != 2); | ||
205 | *out_hwirq = intspec[0]; | ||
206 | *out_type = intspec[1]; | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static struct irq_host_ops opb_host_ops = { | ||
211 | .map = opb_host_map, | 200 | .map = opb_host_map, |
212 | .xlate = opb_host_xlate, | 201 | .xlate = irq_domain_xlate_twocell, |
213 | }; | 202 | }; |
214 | 203 | ||
215 | irqreturn_t opb_irq_handler(int irq, void *private) | 204 | irqreturn_t opb_irq_handler(int irq, void *private) |
@@ -263,13 +252,11 @@ struct opb_pic *opb_pic_init_one(struct device_node *dn) | |||
263 | goto free_opb; | 252 | goto free_opb; |
264 | } | 253 | } |
265 | 254 | ||
266 | /* Allocate an irq host so that Linux knows that despite only | 255 | /* Allocate an irq domain so that Linux knows that despite only |
267 | * having one interrupt to issue, we're the controller for multiple | 256 | * having one interrupt to issue, we're the controller for multiple |
268 | * hardware IRQs, so later we can lookup their virtual IRQs. */ | 257 | * hardware IRQs, so later we can lookup their virtual IRQs. */ |
269 | 258 | ||
270 | opb->host = irq_alloc_host(dn, IRQ_HOST_MAP_LINEAR, | 259 | opb->host = irq_domain_add_linear(dn, OPB_NR_IRQS, &opb_host_ops, opb); |
271 | OPB_NR_IRQS, &opb_host_ops, -1); | ||
272 | |||
273 | if (!opb->host) { | 260 | if (!opb->host) { |
274 | printk(KERN_ERR "opb: Failed to allocate IRQ host!\n"); | 261 | printk(KERN_ERR "opb: Failed to allocate IRQ host!\n"); |
275 | goto free_regs; | 262 | goto free_regs; |
@@ -277,7 +264,6 @@ struct opb_pic *opb_pic_init_one(struct device_node *dn) | |||
277 | 264 | ||
278 | opb->index = opb_index++; | 265 | opb->index = opb_index++; |
279 | spin_lock_init(&opb->lock); | 266 | spin_lock_init(&opb->lock); |
280 | opb->host->host_data = opb; | ||
281 | 267 | ||
282 | /* Disable all interrupts by default */ | 268 | /* Disable all interrupts by default */ |
283 | opb_out(opb, OPB_MLSASIER, 0); | 269 | opb_out(opb, OPB_MLSASIER, 0); |
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c index 5d7d59a43c4c..d4fa03f2b6ac 100644 --- a/arch/powerpc/sysdev/cpm1.c +++ b/arch/powerpc/sysdev/cpm1.c | |||
@@ -54,7 +54,7 @@ cpm8xx_t __iomem *cpmp; /* Pointer to comm processor space */ | |||
54 | immap_t __iomem *mpc8xx_immr; | 54 | immap_t __iomem *mpc8xx_immr; |
55 | static cpic8xx_t __iomem *cpic_reg; | 55 | static cpic8xx_t __iomem *cpic_reg; |
56 | 56 | ||
57 | static struct irq_host *cpm_pic_host; | 57 | static struct irq_domain *cpm_pic_host; |
58 | 58 | ||
59 | static void cpm_mask_irq(struct irq_data *d) | 59 | static void cpm_mask_irq(struct irq_data *d) |
60 | { | 60 | { |
@@ -98,7 +98,7 @@ int cpm_get_irq(void) | |||
98 | return irq_linear_revmap(cpm_pic_host, cpm_vec); | 98 | return irq_linear_revmap(cpm_pic_host, cpm_vec); |
99 | } | 99 | } |
100 | 100 | ||
101 | static int cpm_pic_host_map(struct irq_host *h, unsigned int virq, | 101 | static int cpm_pic_host_map(struct irq_domain *h, unsigned int virq, |
102 | irq_hw_number_t hw) | 102 | irq_hw_number_t hw) |
103 | { | 103 | { |
104 | pr_debug("cpm_pic_host_map(%d, 0x%lx)\n", virq, hw); | 104 | pr_debug("cpm_pic_host_map(%d, 0x%lx)\n", virq, hw); |
@@ -123,7 +123,7 @@ static struct irqaction cpm_error_irqaction = { | |||
123 | .name = "error", | 123 | .name = "error", |
124 | }; | 124 | }; |
125 | 125 | ||
126 | static struct irq_host_ops cpm_pic_host_ops = { | 126 | static const struct irq_domain_ops cpm_pic_host_ops = { |
127 | .map = cpm_pic_host_map, | 127 | .map = cpm_pic_host_map, |
128 | }; | 128 | }; |
129 | 129 | ||
@@ -164,8 +164,7 @@ unsigned int cpm_pic_init(void) | |||
164 | 164 | ||
165 | out_be32(&cpic_reg->cpic_cimr, 0); | 165 | out_be32(&cpic_reg->cpic_cimr, 0); |
166 | 166 | ||
167 | cpm_pic_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, | 167 | cpm_pic_host = irq_domain_add_linear(np, 64, &cpm_pic_host_ops, NULL); |
168 | 64, &cpm_pic_host_ops, 64); | ||
169 | if (cpm_pic_host == NULL) { | 168 | if (cpm_pic_host == NULL) { |
170 | printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n"); | 169 | printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n"); |
171 | sirq = NO_IRQ; | 170 | sirq = NO_IRQ; |
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c index bcab50e2a9eb..d3be961e2ae7 100644 --- a/arch/powerpc/sysdev/cpm2_pic.c +++ b/arch/powerpc/sysdev/cpm2_pic.c | |||
@@ -50,7 +50,7 @@ | |||
50 | 50 | ||
51 | static intctl_cpm2_t __iomem *cpm2_intctl; | 51 | static intctl_cpm2_t __iomem *cpm2_intctl; |
52 | 52 | ||
53 | static struct irq_host *cpm2_pic_host; | 53 | static struct irq_domain *cpm2_pic_host; |
54 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 54 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) |
55 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | 55 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; |
56 | 56 | ||
@@ -214,7 +214,7 @@ unsigned int cpm2_get_irq(void) | |||
214 | return irq_linear_revmap(cpm2_pic_host, irq); | 214 | return irq_linear_revmap(cpm2_pic_host, irq); |
215 | } | 215 | } |
216 | 216 | ||
217 | static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq, | 217 | static int cpm2_pic_host_map(struct irq_domain *h, unsigned int virq, |
218 | irq_hw_number_t hw) | 218 | irq_hw_number_t hw) |
219 | { | 219 | { |
220 | pr_debug("cpm2_pic_host_map(%d, 0x%lx)\n", virq, hw); | 220 | pr_debug("cpm2_pic_host_map(%d, 0x%lx)\n", virq, hw); |
@@ -224,21 +224,9 @@ static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq, | |||
224 | return 0; | 224 | return 0; |
225 | } | 225 | } |
226 | 226 | ||
227 | static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct, | 227 | static const struct irq_domain_ops cpm2_pic_host_ops = { |
228 | const u32 *intspec, unsigned int intsize, | ||
229 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | ||
230 | { | ||
231 | *out_hwirq = intspec[0]; | ||
232 | if (intsize > 1) | ||
233 | *out_flags = intspec[1]; | ||
234 | else | ||
235 | *out_flags = IRQ_TYPE_NONE; | ||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | static struct irq_host_ops cpm2_pic_host_ops = { | ||
240 | .map = cpm2_pic_host_map, | 228 | .map = cpm2_pic_host_map, |
241 | .xlate = cpm2_pic_host_xlate, | 229 | .xlate = irq_domain_xlate_onetwocell, |
242 | }; | 230 | }; |
243 | 231 | ||
244 | void cpm2_pic_init(struct device_node *node) | 232 | void cpm2_pic_init(struct device_node *node) |
@@ -275,8 +263,7 @@ void cpm2_pic_init(struct device_node *node) | |||
275 | out_be32(&cpm2_intctl->ic_scprrl, 0x05309770); | 263 | out_be32(&cpm2_intctl->ic_scprrl, 0x05309770); |
276 | 264 | ||
277 | /* create a legacy host */ | 265 | /* create a legacy host */ |
278 | cpm2_pic_host = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, | 266 | cpm2_pic_host = irq_domain_add_linear(node, 64, &cpm2_pic_host_ops, NULL); |
279 | 64, &cpm2_pic_host_ops, 64); | ||
280 | if (cpm2_pic_host == NULL) { | 267 | if (cpm2_pic_host == NULL) { |
281 | printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n"); | 268 | printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n"); |
282 | return; | 269 | return; |
diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c index b6731e4a6646..6e0e1005227f 100644 --- a/arch/powerpc/sysdev/ehv_pic.c +++ b/arch/powerpc/sysdev/ehv_pic.c | |||
@@ -182,13 +182,13 @@ unsigned int ehv_pic_get_irq(void) | |||
182 | return irq_linear_revmap(global_ehv_pic->irqhost, irq); | 182 | return irq_linear_revmap(global_ehv_pic->irqhost, irq); |
183 | } | 183 | } |
184 | 184 | ||
185 | static int ehv_pic_host_match(struct irq_host *h, struct device_node *node) | 185 | static int ehv_pic_host_match(struct irq_domain *h, struct device_node *node) |
186 | { | 186 | { |
187 | /* Exact match, unless ehv_pic node is NULL */ | 187 | /* Exact match, unless ehv_pic node is NULL */ |
188 | return h->of_node == NULL || h->of_node == node; | 188 | return h->of_node == NULL || h->of_node == node; |
189 | } | 189 | } |
190 | 190 | ||
191 | static int ehv_pic_host_map(struct irq_host *h, unsigned int virq, | 191 | static int ehv_pic_host_map(struct irq_domain *h, unsigned int virq, |
192 | irq_hw_number_t hw) | 192 | irq_hw_number_t hw) |
193 | { | 193 | { |
194 | struct ehv_pic *ehv_pic = h->host_data; | 194 | struct ehv_pic *ehv_pic = h->host_data; |
@@ -217,7 +217,7 @@ static int ehv_pic_host_map(struct irq_host *h, unsigned int virq, | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | static int ehv_pic_host_xlate(struct irq_host *h, struct device_node *ct, | 220 | static int ehv_pic_host_xlate(struct irq_domain *h, struct device_node *ct, |
221 | const u32 *intspec, unsigned int intsize, | 221 | const u32 *intspec, unsigned int intsize, |
222 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 222 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
223 | 223 | ||
@@ -248,7 +248,7 @@ static int ehv_pic_host_xlate(struct irq_host *h, struct device_node *ct, | |||
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ||
251 | static struct irq_host_ops ehv_pic_host_ops = { | 251 | static const struct irq_domain_ops ehv_pic_host_ops = { |
252 | .match = ehv_pic_host_match, | 252 | .match = ehv_pic_host_match, |
253 | .map = ehv_pic_host_map, | 253 | .map = ehv_pic_host_map, |
254 | .xlate = ehv_pic_host_xlate, | 254 | .xlate = ehv_pic_host_xlate, |
@@ -275,9 +275,8 @@ void __init ehv_pic_init(void) | |||
275 | return; | 275 | return; |
276 | } | 276 | } |
277 | 277 | ||
278 | ehv_pic->irqhost = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, | 278 | ehv_pic->irqhost = irq_domain_add_linear(np, NR_EHV_PIC_INTS, |
279 | NR_EHV_PIC_INTS, &ehv_pic_host_ops, 0); | 279 | &ehv_pic_host_ops, ehv_pic); |
280 | |||
281 | if (!ehv_pic->irqhost) { | 280 | if (!ehv_pic->irqhost) { |
282 | of_node_put(np); | 281 | of_node_put(np); |
283 | kfree(ehv_pic); | 282 | kfree(ehv_pic); |
@@ -293,7 +292,6 @@ void __init ehv_pic_init(void) | |||
293 | of_node_put(np2); | 292 | of_node_put(np2); |
294 | } | 293 | } |
295 | 294 | ||
296 | ehv_pic->irqhost->host_data = ehv_pic; | ||
297 | ehv_pic->hc_irq = ehv_pic_irq_chip; | 295 | ehv_pic->hc_irq = ehv_pic_irq_chip; |
298 | ehv_pic->hc_irq.irq_set_affinity = ehv_pic_set_affinity; | 296 | ehv_pic->hc_irq.irq_set_affinity = ehv_pic_set_affinity; |
299 | ehv_pic->coreint_flag = coreint_flag; | 297 | ehv_pic->coreint_flag = coreint_flag; |
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index ecb5c1946d22..0c01debe963b 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c | |||
@@ -60,7 +60,7 @@ static struct irq_chip fsl_msi_chip = { | |||
60 | .name = "FSL-MSI", | 60 | .name = "FSL-MSI", |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static int fsl_msi_host_map(struct irq_host *h, unsigned int virq, | 63 | static int fsl_msi_host_map(struct irq_domain *h, unsigned int virq, |
64 | irq_hw_number_t hw) | 64 | irq_hw_number_t hw) |
65 | { | 65 | { |
66 | struct fsl_msi *msi_data = h->host_data; | 66 | struct fsl_msi *msi_data = h->host_data; |
@@ -74,7 +74,7 @@ static int fsl_msi_host_map(struct irq_host *h, unsigned int virq, | |||
74 | return 0; | 74 | return 0; |
75 | } | 75 | } |
76 | 76 | ||
77 | static struct irq_host_ops fsl_msi_host_ops = { | 77 | static const struct irq_domain_ops fsl_msi_host_ops = { |
78 | .map = fsl_msi_host_map, | 78 | .map = fsl_msi_host_map, |
79 | }; | 79 | }; |
80 | 80 | ||
@@ -387,8 +387,8 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev) | |||
387 | } | 387 | } |
388 | platform_set_drvdata(dev, msi); | 388 | platform_set_drvdata(dev, msi); |
389 | 389 | ||
390 | msi->irqhost = irq_alloc_host(dev->dev.of_node, IRQ_HOST_MAP_LINEAR, | 390 | msi->irqhost = irq_domain_add_linear(dev->dev.of_node, |
391 | NR_MSI_IRQS, &fsl_msi_host_ops, 0); | 391 | NR_MSI_IRQS, &fsl_msi_host_ops, msi); |
392 | 392 | ||
393 | if (msi->irqhost == NULL) { | 393 | if (msi->irqhost == NULL) { |
394 | dev_err(&dev->dev, "No memory for MSI irqhost\n"); | 394 | dev_err(&dev->dev, "No memory for MSI irqhost\n"); |
@@ -420,8 +420,6 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev) | |||
420 | 420 | ||
421 | msi->feature = features->fsl_pic_ip; | 421 | msi->feature = features->fsl_pic_ip; |
422 | 422 | ||
423 | msi->irqhost->host_data = msi; | ||
424 | |||
425 | /* | 423 | /* |
426 | * Remember the phandle, so that we can match with any PCI nodes | 424 | * Remember the phandle, so that we can match with any PCI nodes |
427 | * that have an "fsl,msi" property. | 425 | * that have an "fsl,msi" property. |
diff --git a/arch/powerpc/sysdev/fsl_msi.h b/arch/powerpc/sysdev/fsl_msi.h index f6c646a52541..8225f8653f78 100644 --- a/arch/powerpc/sysdev/fsl_msi.h +++ b/arch/powerpc/sysdev/fsl_msi.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #define FSL_PIC_IP_VMPIC 0x00000003 | 26 | #define FSL_PIC_IP_VMPIC 0x00000003 |
27 | 27 | ||
28 | struct fsl_msi { | 28 | struct fsl_msi { |
29 | struct irq_host *irqhost; | 29 | struct irq_domain *irqhost; |
30 | 30 | ||
31 | unsigned long cascade_irq; | 31 | unsigned long cascade_irq; |
32 | 32 | ||
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c index d18bb27e4df9..997df6a7ab5d 100644 --- a/arch/powerpc/sysdev/i8259.c +++ b/arch/powerpc/sysdev/i8259.c | |||
@@ -25,7 +25,7 @@ static unsigned char cached_8259[2] = { 0xff, 0xff }; | |||
25 | 25 | ||
26 | static DEFINE_RAW_SPINLOCK(i8259_lock); | 26 | static DEFINE_RAW_SPINLOCK(i8259_lock); |
27 | 27 | ||
28 | static struct irq_host *i8259_host; | 28 | static struct irq_domain *i8259_host; |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * Acknowledge the IRQ using either the PCI host bridge's interrupt | 31 | * Acknowledge the IRQ using either the PCI host bridge's interrupt |
@@ -163,12 +163,12 @@ static struct resource pic_edgectrl_iores = { | |||
163 | .flags = IORESOURCE_BUSY, | 163 | .flags = IORESOURCE_BUSY, |
164 | }; | 164 | }; |
165 | 165 | ||
166 | static int i8259_host_match(struct irq_host *h, struct device_node *node) | 166 | static int i8259_host_match(struct irq_domain *h, struct device_node *node) |
167 | { | 167 | { |
168 | return h->of_node == NULL || h->of_node == node; | 168 | return h->of_node == NULL || h->of_node == node; |
169 | } | 169 | } |
170 | 170 | ||
171 | static int i8259_host_map(struct irq_host *h, unsigned int virq, | 171 | static int i8259_host_map(struct irq_domain *h, unsigned int virq, |
172 | irq_hw_number_t hw) | 172 | irq_hw_number_t hw) |
173 | { | 173 | { |
174 | pr_debug("i8259_host_map(%d, 0x%lx)\n", virq, hw); | 174 | pr_debug("i8259_host_map(%d, 0x%lx)\n", virq, hw); |
@@ -185,7 +185,7 @@ static int i8259_host_map(struct irq_host *h, unsigned int virq, | |||
185 | return 0; | 185 | return 0; |
186 | } | 186 | } |
187 | 187 | ||
188 | static int i8259_host_xlate(struct irq_host *h, struct device_node *ct, | 188 | static int i8259_host_xlate(struct irq_domain *h, struct device_node *ct, |
189 | const u32 *intspec, unsigned int intsize, | 189 | const u32 *intspec, unsigned int intsize, |
190 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 190 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
191 | { | 191 | { |
@@ -205,13 +205,13 @@ static int i8259_host_xlate(struct irq_host *h, struct device_node *ct, | |||
205 | return 0; | 205 | return 0; |
206 | } | 206 | } |
207 | 207 | ||
208 | static struct irq_host_ops i8259_host_ops = { | 208 | static struct irq_domain_ops i8259_host_ops = { |
209 | .match = i8259_host_match, | 209 | .match = i8259_host_match, |
210 | .map = i8259_host_map, | 210 | .map = i8259_host_map, |
211 | .xlate = i8259_host_xlate, | 211 | .xlate = i8259_host_xlate, |
212 | }; | 212 | }; |
213 | 213 | ||
214 | struct irq_host *i8259_get_host(void) | 214 | struct irq_domain *i8259_get_host(void) |
215 | { | 215 | { |
216 | return i8259_host; | 216 | return i8259_host; |
217 | } | 217 | } |
@@ -263,8 +263,7 @@ void i8259_init(struct device_node *node, unsigned long intack_addr) | |||
263 | raw_spin_unlock_irqrestore(&i8259_lock, flags); | 263 | raw_spin_unlock_irqrestore(&i8259_lock, flags); |
264 | 264 | ||
265 | /* create a legacy host */ | 265 | /* create a legacy host */ |
266 | i8259_host = irq_alloc_host(node, IRQ_HOST_MAP_LEGACY, | 266 | i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops, NULL); |
267 | 0, &i8259_host_ops, 0); | ||
268 | if (i8259_host == NULL) { | 267 | if (i8259_host == NULL) { |
269 | printk(KERN_ERR "i8259: failed to allocate irq host !\n"); | 268 | printk(KERN_ERR "i8259: failed to allocate irq host !\n"); |
270 | return; | 269 | return; |
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c index 95da897f05a7..b50f97811c25 100644 --- a/arch/powerpc/sysdev/ipic.c +++ b/arch/powerpc/sysdev/ipic.c | |||
@@ -672,13 +672,13 @@ static struct irq_chip ipic_edge_irq_chip = { | |||
672 | .irq_set_type = ipic_set_irq_type, | 672 | .irq_set_type = ipic_set_irq_type, |
673 | }; | 673 | }; |
674 | 674 | ||
675 | static int ipic_host_match(struct irq_host *h, struct device_node *node) | 675 | static int ipic_host_match(struct irq_domain *h, struct device_node *node) |
676 | { | 676 | { |
677 | /* Exact match, unless ipic node is NULL */ | 677 | /* Exact match, unless ipic node is NULL */ |
678 | return h->of_node == NULL || h->of_node == node; | 678 | return h->of_node == NULL || h->of_node == node; |
679 | } | 679 | } |
680 | 680 | ||
681 | static int ipic_host_map(struct irq_host *h, unsigned int virq, | 681 | static int ipic_host_map(struct irq_domain *h, unsigned int virq, |
682 | irq_hw_number_t hw) | 682 | irq_hw_number_t hw) |
683 | { | 683 | { |
684 | struct ipic *ipic = h->host_data; | 684 | struct ipic *ipic = h->host_data; |
@@ -692,26 +692,10 @@ static int ipic_host_map(struct irq_host *h, unsigned int virq, | |||
692 | return 0; | 692 | return 0; |
693 | } | 693 | } |
694 | 694 | ||
695 | static int ipic_host_xlate(struct irq_host *h, struct device_node *ct, | 695 | static struct irq_domain_ops ipic_host_ops = { |
696 | const u32 *intspec, unsigned int intsize, | ||
697 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | ||
698 | |||
699 | { | ||
700 | /* interrupt sense values coming from the device tree equal either | ||
701 | * LEVEL_LOW (low assertion) or EDGE_FALLING (high-to-low change) | ||
702 | */ | ||
703 | *out_hwirq = intspec[0]; | ||
704 | if (intsize > 1) | ||
705 | *out_flags = intspec[1]; | ||
706 | else | ||
707 | *out_flags = IRQ_TYPE_NONE; | ||
708 | return 0; | ||
709 | } | ||
710 | |||
711 | static struct irq_host_ops ipic_host_ops = { | ||
712 | .match = ipic_host_match, | 696 | .match = ipic_host_match, |
713 | .map = ipic_host_map, | 697 | .map = ipic_host_map, |
714 | .xlate = ipic_host_xlate, | 698 | .xlate = irq_domain_xlate_onetwocell, |
715 | }; | 699 | }; |
716 | 700 | ||
717 | struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) | 701 | struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) |
@@ -728,9 +712,8 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) | |||
728 | if (ipic == NULL) | 712 | if (ipic == NULL) |
729 | return NULL; | 713 | return NULL; |
730 | 714 | ||
731 | ipic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, | 715 | ipic->irqhost = irq_domain_add_linear(node, NR_IPIC_INTS, |
732 | NR_IPIC_INTS, | 716 | &ipic_host_ops, ipic); |
733 | &ipic_host_ops, 0); | ||
734 | if (ipic->irqhost == NULL) { | 717 | if (ipic->irqhost == NULL) { |
735 | kfree(ipic); | 718 | kfree(ipic); |
736 | return NULL; | 719 | return NULL; |
@@ -738,8 +721,6 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) | |||
738 | 721 | ||
739 | ipic->regs = ioremap(res.start, resource_size(&res)); | 722 | ipic->regs = ioremap(res.start, resource_size(&res)); |
740 | 723 | ||
741 | ipic->irqhost->host_data = ipic; | ||
742 | |||
743 | /* init hw */ | 724 | /* init hw */ |
744 | ipic_write(ipic->regs, IPIC_SICNR, 0x0); | 725 | ipic_write(ipic->regs, IPIC_SICNR, 0x0); |
745 | 726 | ||
diff --git a/arch/powerpc/sysdev/ipic.h b/arch/powerpc/sysdev/ipic.h index 9391c57b0c51..90031d1282e1 100644 --- a/arch/powerpc/sysdev/ipic.h +++ b/arch/powerpc/sysdev/ipic.h | |||
@@ -43,7 +43,7 @@ struct ipic { | |||
43 | volatile u32 __iomem *regs; | 43 | volatile u32 __iomem *regs; |
44 | 44 | ||
45 | /* The remapper for this IPIC */ | 45 | /* The remapper for this IPIC */ |
46 | struct irq_host *irqhost; | 46 | struct irq_domain *irqhost; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | struct ipic_info { | 49 | struct ipic_info { |
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c index 2ca0a85fcce9..d5f5416be310 100644 --- a/arch/powerpc/sysdev/mpc8xx_pic.c +++ b/arch/powerpc/sysdev/mpc8xx_pic.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | extern int cpm_get_irq(struct pt_regs *regs); | 18 | extern int cpm_get_irq(struct pt_regs *regs); |
19 | 19 | ||
20 | static struct irq_host *mpc8xx_pic_host; | 20 | static struct irq_domain *mpc8xx_pic_host; |
21 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 21 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) |
22 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | 22 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; |
23 | static sysconf8xx_t __iomem *siu_reg; | 23 | static sysconf8xx_t __iomem *siu_reg; |
@@ -110,7 +110,7 @@ unsigned int mpc8xx_get_irq(void) | |||
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | static int mpc8xx_pic_host_map(struct irq_host *h, unsigned int virq, | 113 | static int mpc8xx_pic_host_map(struct irq_domain *h, unsigned int virq, |
114 | irq_hw_number_t hw) | 114 | irq_hw_number_t hw) |
115 | { | 115 | { |
116 | pr_debug("mpc8xx_pic_host_map(%d, 0x%lx)\n", virq, hw); | 116 | pr_debug("mpc8xx_pic_host_map(%d, 0x%lx)\n", virq, hw); |
@@ -121,7 +121,7 @@ static int mpc8xx_pic_host_map(struct irq_host *h, unsigned int virq, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | static int mpc8xx_pic_host_xlate(struct irq_host *h, struct device_node *ct, | 124 | static int mpc8xx_pic_host_xlate(struct irq_domain *h, struct device_node *ct, |
125 | const u32 *intspec, unsigned int intsize, | 125 | const u32 *intspec, unsigned int intsize, |
126 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 126 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
127 | { | 127 | { |
@@ -142,7 +142,7 @@ static int mpc8xx_pic_host_xlate(struct irq_host *h, struct device_node *ct, | |||
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | static struct irq_host_ops mpc8xx_pic_host_ops = { | 145 | static struct irq_domain_ops mpc8xx_pic_host_ops = { |
146 | .map = mpc8xx_pic_host_map, | 146 | .map = mpc8xx_pic_host_map, |
147 | .xlate = mpc8xx_pic_host_xlate, | 147 | .xlate = mpc8xx_pic_host_xlate, |
148 | }; | 148 | }; |
@@ -171,8 +171,7 @@ int mpc8xx_pic_init(void) | |||
171 | goto out; | 171 | goto out; |
172 | } | 172 | } |
173 | 173 | ||
174 | mpc8xx_pic_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, | 174 | mpc8xx_pic_host = irq_domain_add_linear(np, 64, &mpc8xx_pic_host_ops, NULL); |
175 | 64, &mpc8xx_pic_host_ops, 64); | ||
176 | if (mpc8xx_pic_host == NULL) { | 175 | if (mpc8xx_pic_host == NULL) { |
177 | printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n"); | 176 | printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n"); |
178 | ret = -ENOMEM; | 177 | ret = -ENOMEM; |
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 4e9ccb1015de..c83a512fa175 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -965,13 +965,13 @@ static struct irq_chip mpic_irq_ht_chip = { | |||
965 | #endif /* CONFIG_MPIC_U3_HT_IRQS */ | 965 | #endif /* CONFIG_MPIC_U3_HT_IRQS */ |
966 | 966 | ||
967 | 967 | ||
968 | static int mpic_host_match(struct irq_host *h, struct device_node *node) | 968 | static int mpic_host_match(struct irq_domain *h, struct device_node *node) |
969 | { | 969 | { |
970 | /* Exact match, unless mpic node is NULL */ | 970 | /* Exact match, unless mpic node is NULL */ |
971 | return h->of_node == NULL || h->of_node == node; | 971 | return h->of_node == NULL || h->of_node == node; |
972 | } | 972 | } |
973 | 973 | ||
974 | static int mpic_host_map(struct irq_host *h, unsigned int virq, | 974 | static int mpic_host_map(struct irq_domain *h, unsigned int virq, |
975 | irq_hw_number_t hw) | 975 | irq_hw_number_t hw) |
976 | { | 976 | { |
977 | struct mpic *mpic = h->host_data; | 977 | struct mpic *mpic = h->host_data; |
@@ -1041,7 +1041,7 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq, | |||
1041 | return 0; | 1041 | return 0; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | static int mpic_host_xlate(struct irq_host *h, struct device_node *ct, | 1044 | static int mpic_host_xlate(struct irq_domain *h, struct device_node *ct, |
1045 | const u32 *intspec, unsigned int intsize, | 1045 | const u32 *intspec, unsigned int intsize, |
1046 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 1046 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
1047 | 1047 | ||
@@ -1121,13 +1121,13 @@ static void mpic_cascade(unsigned int irq, struct irq_desc *desc) | |||
1121 | BUG_ON(!(mpic->flags & MPIC_SECONDARY)); | 1121 | BUG_ON(!(mpic->flags & MPIC_SECONDARY)); |
1122 | 1122 | ||
1123 | virq = mpic_get_one_irq(mpic); | 1123 | virq = mpic_get_one_irq(mpic); |
1124 | if (virq != NO_IRQ) | 1124 | if (virq) |
1125 | generic_handle_irq(virq); | 1125 | generic_handle_irq(virq); |
1126 | 1126 | ||
1127 | chip->irq_eoi(&desc->irq_data); | 1127 | chip->irq_eoi(&desc->irq_data); |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | static struct irq_host_ops mpic_host_ops = { | 1130 | static struct irq_domain_ops mpic_host_ops = { |
1131 | .match = mpic_host_match, | 1131 | .match = mpic_host_match, |
1132 | .map = mpic_host_map, | 1132 | .map = mpic_host_map, |
1133 | .xlate = mpic_host_xlate, | 1133 | .xlate = mpic_host_xlate, |
@@ -1345,10 +1345,9 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1345 | mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1); | 1345 | mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1); |
1346 | mpic->isu_mask = (1 << mpic->isu_shift) - 1; | 1346 | mpic->isu_mask = (1 << mpic->isu_shift) - 1; |
1347 | 1347 | ||
1348 | mpic->irqhost = irq_alloc_host(mpic->node, IRQ_HOST_MAP_LINEAR, | 1348 | mpic->irqhost = irq_domain_add_linear(mpic->node, |
1349 | isu_size ? isu_size : mpic->num_sources, | 1349 | isu_size ? isu_size : mpic->num_sources, |
1350 | &mpic_host_ops, | 1350 | &mpic_host_ops, mpic); |
1351 | flags & MPIC_LARGE_VECTORS ? 2048 : 256); | ||
1352 | 1351 | ||
1353 | /* | 1352 | /* |
1354 | * FIXME: The code leaks the MPIC object and mappings here; this | 1353 | * FIXME: The code leaks the MPIC object and mappings here; this |
@@ -1357,8 +1356,6 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1357 | if (mpic->irqhost == NULL) | 1356 | if (mpic->irqhost == NULL) |
1358 | return NULL; | 1357 | return NULL; |
1359 | 1358 | ||
1360 | mpic->irqhost->host_data = mpic; | ||
1361 | |||
1362 | /* Display version */ | 1359 | /* Display version */ |
1363 | switch (greg_feature & MPIC_GREG_FEATURE_VERSION_MASK) { | 1360 | switch (greg_feature & MPIC_GREG_FEATURE_VERSION_MASK) { |
1364 | case 1: | 1361 | case 1: |
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c index 0f67cd79d481..0622aa91b18a 100644 --- a/arch/powerpc/sysdev/mpic_msi.c +++ b/arch/powerpc/sysdev/mpic_msi.c | |||
@@ -32,7 +32,7 @@ void mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq) | |||
32 | static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic) | 32 | static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic) |
33 | { | 33 | { |
34 | irq_hw_number_t hwirq; | 34 | irq_hw_number_t hwirq; |
35 | struct irq_host_ops *ops = mpic->irqhost->ops; | 35 | const struct irq_domain_ops *ops = mpic->irqhost->ops; |
36 | struct device_node *np; | 36 | struct device_node *np; |
37 | int flags, index, i; | 37 | int flags, index, i; |
38 | struct of_irq oirq; | 38 | struct of_irq oirq; |
diff --git a/arch/powerpc/sysdev/mv64x60_pic.c b/arch/powerpc/sysdev/mv64x60_pic.c index 14d130268e7a..8848e99a83f2 100644 --- a/arch/powerpc/sysdev/mv64x60_pic.c +++ b/arch/powerpc/sysdev/mv64x60_pic.c | |||
@@ -70,7 +70,7 @@ static u32 mv64x60_cached_low_mask; | |||
70 | static u32 mv64x60_cached_high_mask = MV64X60_HIGH_GPP_GROUPS; | 70 | static u32 mv64x60_cached_high_mask = MV64X60_HIGH_GPP_GROUPS; |
71 | static u32 mv64x60_cached_gpp_mask; | 71 | static u32 mv64x60_cached_gpp_mask; |
72 | 72 | ||
73 | static struct irq_host *mv64x60_irq_host; | 73 | static struct irq_domain *mv64x60_irq_host; |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * mv64x60_chip_low functions | 76 | * mv64x60_chip_low functions |
@@ -208,7 +208,7 @@ static struct irq_chip *mv64x60_chips[] = { | |||
208 | [MV64x60_LEVEL1_GPP] = &mv64x60_chip_gpp, | 208 | [MV64x60_LEVEL1_GPP] = &mv64x60_chip_gpp, |
209 | }; | 209 | }; |
210 | 210 | ||
211 | static int mv64x60_host_map(struct irq_host *h, unsigned int virq, | 211 | static int mv64x60_host_map(struct irq_domain *h, unsigned int virq, |
212 | irq_hw_number_t hwirq) | 212 | irq_hw_number_t hwirq) |
213 | { | 213 | { |
214 | int level1; | 214 | int level1; |
@@ -223,7 +223,7 @@ static int mv64x60_host_map(struct irq_host *h, unsigned int virq, | |||
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
225 | 225 | ||
226 | static struct irq_host_ops mv64x60_host_ops = { | 226 | static struct irq_domain_ops mv64x60_host_ops = { |
227 | .map = mv64x60_host_map, | 227 | .map = mv64x60_host_map, |
228 | }; | 228 | }; |
229 | 229 | ||
@@ -250,9 +250,8 @@ void __init mv64x60_init_irq(void) | |||
250 | paddr = of_translate_address(np, reg); | 250 | paddr = of_translate_address(np, reg); |
251 | mv64x60_irq_reg_base = ioremap(paddr, reg[1]); | 251 | mv64x60_irq_reg_base = ioremap(paddr, reg[1]); |
252 | 252 | ||
253 | mv64x60_irq_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, | 253 | mv64x60_irq_host = irq_domain_add_linear(np, MV64x60_NUM_IRQS, |
254 | MV64x60_NUM_IRQS, | 254 | &mv64x60_host_ops, NULL); |
255 | &mv64x60_host_ops, MV64x60_NUM_IRQS); | ||
256 | 255 | ||
257 | spin_lock_irqsave(&mv64x60_lock, flags); | 256 | spin_lock_irqsave(&mv64x60_lock, flags); |
258 | out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_INTR_MASK, | 257 | out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_INTR_MASK, |
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c index 73034bd203c4..2fba6ef2f95e 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_ic.c +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c | |||
@@ -245,13 +245,13 @@ static struct irq_chip qe_ic_irq_chip = { | |||
245 | .irq_mask_ack = qe_ic_mask_irq, | 245 | .irq_mask_ack = qe_ic_mask_irq, |
246 | }; | 246 | }; |
247 | 247 | ||
248 | static int qe_ic_host_match(struct irq_host *h, struct device_node *node) | 248 | static int qe_ic_host_match(struct irq_domain *h, struct device_node *node) |
249 | { | 249 | { |
250 | /* Exact match, unless qe_ic node is NULL */ | 250 | /* Exact match, unless qe_ic node is NULL */ |
251 | return h->of_node == NULL || h->of_node == node; | 251 | return h->of_node == NULL || h->of_node == node; |
252 | } | 252 | } |
253 | 253 | ||
254 | static int qe_ic_host_map(struct irq_host *h, unsigned int virq, | 254 | static int qe_ic_host_map(struct irq_domain *h, unsigned int virq, |
255 | irq_hw_number_t hw) | 255 | irq_hw_number_t hw) |
256 | { | 256 | { |
257 | struct qe_ic *qe_ic = h->host_data; | 257 | struct qe_ic *qe_ic = h->host_data; |
@@ -272,23 +272,10 @@ static int qe_ic_host_map(struct irq_host *h, unsigned int virq, | |||
272 | return 0; | 272 | return 0; |
273 | } | 273 | } |
274 | 274 | ||
275 | static int qe_ic_host_xlate(struct irq_host *h, struct device_node *ct, | 275 | static struct irq_domain_ops qe_ic_host_ops = { |
276 | const u32 * intspec, unsigned int intsize, | ||
277 | irq_hw_number_t * out_hwirq, | ||
278 | unsigned int *out_flags) | ||
279 | { | ||
280 | *out_hwirq = intspec[0]; | ||
281 | if (intsize > 1) | ||
282 | *out_flags = intspec[1]; | ||
283 | else | ||
284 | *out_flags = IRQ_TYPE_NONE; | ||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | static struct irq_host_ops qe_ic_host_ops = { | ||
289 | .match = qe_ic_host_match, | 276 | .match = qe_ic_host_match, |
290 | .map = qe_ic_host_map, | 277 | .map = qe_ic_host_map, |
291 | .xlate = qe_ic_host_xlate, | 278 | .xlate = irq_domain_xlate_onetwocell, |
292 | }; | 279 | }; |
293 | 280 | ||
294 | /* Return an interrupt vector or NO_IRQ if no interrupt is pending. */ | 281 | /* Return an interrupt vector or NO_IRQ if no interrupt is pending. */ |
@@ -339,8 +326,8 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags, | |||
339 | if (qe_ic == NULL) | 326 | if (qe_ic == NULL) |
340 | return; | 327 | return; |
341 | 328 | ||
342 | qe_ic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, | 329 | qe_ic->irqhost = irq_domain_add_linear(node, NR_QE_IC_INTS, |
343 | NR_QE_IC_INTS, &qe_ic_host_ops, 0); | 330 | &qe_ic_host_ops, qe_ic); |
344 | if (qe_ic->irqhost == NULL) { | 331 | if (qe_ic->irqhost == NULL) { |
345 | kfree(qe_ic); | 332 | kfree(qe_ic); |
346 | return; | 333 | return; |
@@ -348,7 +335,6 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags, | |||
348 | 335 | ||
349 | qe_ic->regs = ioremap(res.start, resource_size(&res)); | 336 | qe_ic->regs = ioremap(res.start, resource_size(&res)); |
350 | 337 | ||
351 | qe_ic->irqhost->host_data = qe_ic; | ||
352 | qe_ic->hc_irq = qe_ic_irq_chip; | 338 | qe_ic->hc_irq = qe_ic_irq_chip; |
353 | 339 | ||
354 | qe_ic->virq_high = irq_of_parse_and_map(node, 0); | 340 | qe_ic->virq_high = irq_of_parse_and_map(node, 0); |
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.h b/arch/powerpc/sysdev/qe_lib/qe_ic.h index c1361d005a8a..c327872ed35c 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_ic.h +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.h | |||
@@ -79,7 +79,7 @@ struct qe_ic { | |||
79 | volatile u32 __iomem *regs; | 79 | volatile u32 __iomem *regs; |
80 | 80 | ||
81 | /* The remapper for this QEIC */ | 81 | /* The remapper for this QEIC */ |
82 | struct irq_host *irqhost; | 82 | struct irq_domain *irqhost; |
83 | 83 | ||
84 | /* The "linux" controller struct */ | 84 | /* The "linux" controller struct */ |
85 | struct irq_chip hc_irq; | 85 | struct irq_chip hc_irq; |
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c index 4d18658116e5..188012c58f7f 100644 --- a/arch/powerpc/sysdev/tsi108_pci.c +++ b/arch/powerpc/sysdev/tsi108_pci.c | |||
@@ -51,7 +51,7 @@ | |||
51 | u32 tsi108_pci_cfg_base; | 51 | u32 tsi108_pci_cfg_base; |
52 | static u32 tsi108_pci_cfg_phys; | 52 | static u32 tsi108_pci_cfg_phys; |
53 | u32 tsi108_csr_vir_base; | 53 | u32 tsi108_csr_vir_base; |
54 | static struct irq_host *pci_irq_host; | 54 | static struct irq_domain *pci_irq_host; |
55 | 55 | ||
56 | extern u32 get_vir_csrbase(void); | 56 | extern u32 get_vir_csrbase(void); |
57 | extern u32 tsi108_read_reg(u32 reg_offset); | 57 | extern u32 tsi108_read_reg(u32 reg_offset); |
@@ -376,7 +376,7 @@ static struct irq_chip tsi108_pci_irq = { | |||
376 | .irq_unmask = tsi108_pci_irq_unmask, | 376 | .irq_unmask = tsi108_pci_irq_unmask, |
377 | }; | 377 | }; |
378 | 378 | ||
379 | static int pci_irq_host_xlate(struct irq_host *h, struct device_node *ct, | 379 | static int pci_irq_host_xlate(struct irq_domain *h, struct device_node *ct, |
380 | const u32 *intspec, unsigned int intsize, | 380 | const u32 *intspec, unsigned int intsize, |
381 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 381 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
382 | { | 382 | { |
@@ -385,7 +385,7 @@ static int pci_irq_host_xlate(struct irq_host *h, struct device_node *ct, | |||
385 | return 0; | 385 | return 0; |
386 | } | 386 | } |
387 | 387 | ||
388 | static int pci_irq_host_map(struct irq_host *h, unsigned int virq, | 388 | static int pci_irq_host_map(struct irq_domain *h, unsigned int virq, |
389 | irq_hw_number_t hw) | 389 | irq_hw_number_t hw) |
390 | { unsigned int irq; | 390 | { unsigned int irq; |
391 | DBG("%s(%d, 0x%lx)\n", __func__, virq, hw); | 391 | DBG("%s(%d, 0x%lx)\n", __func__, virq, hw); |
@@ -397,7 +397,7 @@ static int pci_irq_host_map(struct irq_host *h, unsigned int virq, | |||
397 | return 0; | 397 | return 0; |
398 | } | 398 | } |
399 | 399 | ||
400 | static struct irq_host_ops pci_irq_host_ops = { | 400 | static struct irq_domain_ops pci_irq_domain_ops = { |
401 | .map = pci_irq_host_map, | 401 | .map = pci_irq_host_map, |
402 | .xlate = pci_irq_host_xlate, | 402 | .xlate = pci_irq_host_xlate, |
403 | }; | 403 | }; |
@@ -419,10 +419,9 @@ void __init tsi108_pci_int_init(struct device_node *node) | |||
419 | { | 419 | { |
420 | DBG("Tsi108_pci_int_init: initializing PCI interrupts\n"); | 420 | DBG("Tsi108_pci_int_init: initializing PCI interrupts\n"); |
421 | 421 | ||
422 | pci_irq_host = irq_alloc_host(node, IRQ_HOST_MAP_LEGACY, | 422 | pci_irq_host = irq_domain_add_legacy_isa(node, &pci_irq_domain_ops, NULL); |
423 | 0, &pci_irq_host_ops, 0); | ||
424 | if (pci_irq_host == NULL) { | 423 | if (pci_irq_host == NULL) { |
425 | printk(KERN_ERR "pci_irq_host: failed to allocate irq host !\n"); | 424 | printk(KERN_ERR "pci_irq_host: failed to allocate irq domain!\n"); |
426 | return; | 425 | return; |
427 | } | 426 | } |
428 | 427 | ||
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c index 063c901b1265..92033936a8f7 100644 --- a/arch/powerpc/sysdev/uic.c +++ b/arch/powerpc/sysdev/uic.c | |||
@@ -49,7 +49,7 @@ struct uic { | |||
49 | raw_spinlock_t lock; | 49 | raw_spinlock_t lock; |
50 | 50 | ||
51 | /* The remapper for this UIC */ | 51 | /* The remapper for this UIC */ |
52 | struct irq_host *irqhost; | 52 | struct irq_domain *irqhost; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static void uic_unmask_irq(struct irq_data *d) | 55 | static void uic_unmask_irq(struct irq_data *d) |
@@ -174,7 +174,7 @@ static struct irq_chip uic_irq_chip = { | |||
174 | .irq_set_type = uic_set_irq_type, | 174 | .irq_set_type = uic_set_irq_type, |
175 | }; | 175 | }; |
176 | 176 | ||
177 | static int uic_host_map(struct irq_host *h, unsigned int virq, | 177 | static int uic_host_map(struct irq_domain *h, unsigned int virq, |
178 | irq_hw_number_t hw) | 178 | irq_hw_number_t hw) |
179 | { | 179 | { |
180 | struct uic *uic = h->host_data; | 180 | struct uic *uic = h->host_data; |
@@ -190,21 +190,9 @@ static int uic_host_map(struct irq_host *h, unsigned int virq, | |||
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
192 | 192 | ||
193 | static int uic_host_xlate(struct irq_host *h, struct device_node *ct, | 193 | static struct irq_domain_ops uic_host_ops = { |
194 | const u32 *intspec, unsigned int intsize, | ||
195 | irq_hw_number_t *out_hwirq, unsigned int *out_type) | ||
196 | |||
197 | { | ||
198 | /* UIC intspecs must have 2 cells */ | ||
199 | BUG_ON(intsize != 2); | ||
200 | *out_hwirq = intspec[0]; | ||
201 | *out_type = intspec[1]; | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static struct irq_host_ops uic_host_ops = { | ||
206 | .map = uic_host_map, | 194 | .map = uic_host_map, |
207 | .xlate = uic_host_xlate, | 195 | .xlate = irq_domain_xlate_twocell, |
208 | }; | 196 | }; |
209 | 197 | ||
210 | void uic_irq_cascade(unsigned int virq, struct irq_desc *desc) | 198 | void uic_irq_cascade(unsigned int virq, struct irq_desc *desc) |
@@ -270,13 +258,11 @@ static struct uic * __init uic_init_one(struct device_node *node) | |||
270 | } | 258 | } |
271 | uic->dcrbase = *dcrreg; | 259 | uic->dcrbase = *dcrreg; |
272 | 260 | ||
273 | uic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, | 261 | uic->irqhost = irq_domain_add_linear(node, NR_UIC_INTS, &uic_host_ops, |
274 | NR_UIC_INTS, &uic_host_ops, -1); | 262 | uic); |
275 | if (! uic->irqhost) | 263 | if (! uic->irqhost) |
276 | return NULL; /* FIXME: panic? */ | 264 | return NULL; /* FIXME: panic? */ |
277 | 265 | ||
278 | uic->irqhost->host_data = uic; | ||
279 | |||
280 | /* Start with all interrupts disabled, level and non-critical */ | 266 | /* Start with all interrupts disabled, level and non-critical */ |
281 | mtdcr(uic->dcrbase + UIC_ER, 0); | 267 | mtdcr(uic->dcrbase + UIC_ER, 0); |
282 | mtdcr(uic->dcrbase + UIC_CR, 0); | 268 | mtdcr(uic->dcrbase + UIC_CR, 0); |
diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c index d72eda6a4c05..ea5e204e3450 100644 --- a/arch/powerpc/sysdev/xics/xics-common.c +++ b/arch/powerpc/sysdev/xics/xics-common.c | |||
@@ -40,7 +40,7 @@ unsigned int xics_interrupt_server_size = 8; | |||
40 | 40 | ||
41 | DEFINE_PER_CPU(struct xics_cppr, xics_cppr); | 41 | DEFINE_PER_CPU(struct xics_cppr, xics_cppr); |
42 | 42 | ||
43 | struct irq_host *xics_host; | 43 | struct irq_domain *xics_host; |
44 | 44 | ||
45 | static LIST_HEAD(ics_list); | 45 | static LIST_HEAD(ics_list); |
46 | 46 | ||
@@ -212,16 +212,16 @@ void xics_migrate_irqs_away(void) | |||
212 | /* We can't set affinity on ISA interrupts */ | 212 | /* We can't set affinity on ISA interrupts */ |
213 | if (virq < NUM_ISA_INTERRUPTS) | 213 | if (virq < NUM_ISA_INTERRUPTS) |
214 | continue; | 214 | continue; |
215 | if (!virq_is_host(virq, xics_host)) | ||
216 | continue; | ||
217 | irq = (unsigned int)virq_to_hw(virq); | ||
218 | /* We need to get IPIs still. */ | ||
219 | if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS) | ||
220 | continue; | ||
221 | desc = irq_to_desc(virq); | 215 | desc = irq_to_desc(virq); |
222 | /* We only need to migrate enabled IRQS */ | 216 | /* We only need to migrate enabled IRQS */ |
223 | if (!desc || !desc->action) | 217 | if (!desc || !desc->action) |
224 | continue; | 218 | continue; |
219 | if (desc->irq_data.domain != xics_host) | ||
220 | continue; | ||
221 | irq = desc->irq_data.hwirq; | ||
222 | /* We need to get IPIs still. */ | ||
223 | if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS) | ||
224 | continue; | ||
225 | chip = irq_desc_get_chip(desc); | 225 | chip = irq_desc_get_chip(desc); |
226 | if (!chip || !chip->irq_set_affinity) | 226 | if (!chip || !chip->irq_set_affinity) |
227 | continue; | 227 | continue; |
@@ -301,7 +301,7 @@ int xics_get_irq_server(unsigned int virq, const struct cpumask *cpumask, | |||
301 | } | 301 | } |
302 | #endif /* CONFIG_SMP */ | 302 | #endif /* CONFIG_SMP */ |
303 | 303 | ||
304 | static int xics_host_match(struct irq_host *h, struct device_node *node) | 304 | static int xics_host_match(struct irq_domain *h, struct device_node *node) |
305 | { | 305 | { |
306 | struct ics *ics; | 306 | struct ics *ics; |
307 | 307 | ||
@@ -323,7 +323,7 @@ static struct irq_chip xics_ipi_chip = { | |||
323 | .irq_unmask = xics_ipi_unmask, | 323 | .irq_unmask = xics_ipi_unmask, |
324 | }; | 324 | }; |
325 | 325 | ||
326 | static int xics_host_map(struct irq_host *h, unsigned int virq, | 326 | static int xics_host_map(struct irq_domain *h, unsigned int virq, |
327 | irq_hw_number_t hw) | 327 | irq_hw_number_t hw) |
328 | { | 328 | { |
329 | struct ics *ics; | 329 | struct ics *ics; |
@@ -351,7 +351,7 @@ static int xics_host_map(struct irq_host *h, unsigned int virq, | |||
351 | return -EINVAL; | 351 | return -EINVAL; |
352 | } | 352 | } |
353 | 353 | ||
354 | static int xics_host_xlate(struct irq_host *h, struct device_node *ct, | 354 | static int xics_host_xlate(struct irq_domain *h, struct device_node *ct, |
355 | const u32 *intspec, unsigned int intsize, | 355 | const u32 *intspec, unsigned int intsize, |
356 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | 356 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) |
357 | 357 | ||
@@ -366,7 +366,7 @@ static int xics_host_xlate(struct irq_host *h, struct device_node *ct, | |||
366 | return 0; | 366 | return 0; |
367 | } | 367 | } |
368 | 368 | ||
369 | static struct irq_host_ops xics_host_ops = { | 369 | static struct irq_domain_ops xics_host_ops = { |
370 | .match = xics_host_match, | 370 | .match = xics_host_match, |
371 | .map = xics_host_map, | 371 | .map = xics_host_map, |
372 | .xlate = xics_host_xlate, | 372 | .xlate = xics_host_xlate, |
@@ -374,8 +374,7 @@ static struct irq_host_ops xics_host_ops = { | |||
374 | 374 | ||
375 | static void __init xics_init_host(void) | 375 | static void __init xics_init_host(void) |
376 | { | 376 | { |
377 | xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, &xics_host_ops, | 377 | xics_host = irq_domain_add_tree(NULL, &xics_host_ops, NULL); |
378 | XICS_IRQ_SPURIOUS); | ||
379 | BUG_ON(xics_host == NULL); | 378 | BUG_ON(xics_host == NULL); |
380 | irq_set_default_host(xics_host); | 379 | irq_set_default_host(xics_host); |
381 | } | 380 | } |
diff --git a/arch/powerpc/sysdev/xilinx_intc.c b/arch/powerpc/sysdev/xilinx_intc.c index 6183799754af..8d73c3c0bee6 100644 --- a/arch/powerpc/sysdev/xilinx_intc.c +++ b/arch/powerpc/sysdev/xilinx_intc.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #define XINTC_IVR 24 /* Interrupt Vector */ | 40 | #define XINTC_IVR 24 /* Interrupt Vector */ |
41 | #define XINTC_MER 28 /* Master Enable */ | 41 | #define XINTC_MER 28 /* Master Enable */ |
42 | 42 | ||
43 | static struct irq_host *master_irqhost; | 43 | static struct irq_domain *master_irqhost; |
44 | 44 | ||
45 | #define XILINX_INTC_MAXIRQS (32) | 45 | #define XILINX_INTC_MAXIRQS (32) |
46 | 46 | ||
@@ -141,7 +141,7 @@ static struct irq_chip xilinx_intc_edge_irqchip = { | |||
141 | /** | 141 | /** |
142 | * xilinx_intc_xlate - translate virq# from device tree interrupts property | 142 | * xilinx_intc_xlate - translate virq# from device tree interrupts property |
143 | */ | 143 | */ |
144 | static int xilinx_intc_xlate(struct irq_host *h, struct device_node *ct, | 144 | static int xilinx_intc_xlate(struct irq_domain *h, struct device_node *ct, |
145 | const u32 *intspec, unsigned int intsize, | 145 | const u32 *intspec, unsigned int intsize, |
146 | irq_hw_number_t *out_hwirq, | 146 | irq_hw_number_t *out_hwirq, |
147 | unsigned int *out_flags) | 147 | unsigned int *out_flags) |
@@ -161,7 +161,7 @@ static int xilinx_intc_xlate(struct irq_host *h, struct device_node *ct, | |||
161 | 161 | ||
162 | return 0; | 162 | return 0; |
163 | } | 163 | } |
164 | static int xilinx_intc_map(struct irq_host *h, unsigned int virq, | 164 | static int xilinx_intc_map(struct irq_domain *h, unsigned int virq, |
165 | irq_hw_number_t irq) | 165 | irq_hw_number_t irq) |
166 | { | 166 | { |
167 | irq_set_chip_data(virq, h->host_data); | 167 | irq_set_chip_data(virq, h->host_data); |
@@ -177,15 +177,15 @@ static int xilinx_intc_map(struct irq_host *h, unsigned int virq, | |||
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
180 | static struct irq_host_ops xilinx_intc_ops = { | 180 | static struct irq_domain_ops xilinx_intc_ops = { |
181 | .map = xilinx_intc_map, | 181 | .map = xilinx_intc_map, |
182 | .xlate = xilinx_intc_xlate, | 182 | .xlate = xilinx_intc_xlate, |
183 | }; | 183 | }; |
184 | 184 | ||
185 | struct irq_host * __init | 185 | struct irq_domain * __init |
186 | xilinx_intc_init(struct device_node *np) | 186 | xilinx_intc_init(struct device_node *np) |
187 | { | 187 | { |
188 | struct irq_host * irq; | 188 | struct irq_domain * irq; |
189 | void * regs; | 189 | void * regs; |
190 | 190 | ||
191 | /* Find and map the intc registers */ | 191 | /* Find and map the intc registers */ |
@@ -200,12 +200,11 @@ xilinx_intc_init(struct device_node *np) | |||
200 | out_be32(regs + XINTC_IAR, ~(u32) 0); /* Acknowledge pending irqs */ | 200 | out_be32(regs + XINTC_IAR, ~(u32) 0); /* Acknowledge pending irqs */ |
201 | out_be32(regs + XINTC_MER, 0x3UL); /* Turn on the Master Enable. */ | 201 | out_be32(regs + XINTC_MER, 0x3UL); /* Turn on the Master Enable. */ |
202 | 202 | ||
203 | /* Allocate and initialize an irq_host structure. */ | 203 | /* Allocate and initialize an irq_domain structure. */ |
204 | irq = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, XILINX_INTC_MAXIRQS, | 204 | irq = irq_domain_add_linear(np, XILINX_INTC_MAXIRQS, &xilinx_intc_ops, |
205 | &xilinx_intc_ops, -1); | 205 | regs); |
206 | if (!irq) | 206 | if (!irq) |
207 | panic(__FILE__ ": Cannot allocate IRQ host\n"); | 207 | panic(__FILE__ ": Cannot allocate IRQ host\n"); |
208 | irq->host_data = regs; | ||
209 | 208 | ||
210 | return irq; | 209 | return irq; |
211 | } | 210 | } |
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h index edd3d3cde460..c28765110706 100644 --- a/arch/sparc/include/asm/prom.h +++ b/arch/sparc/include/asm/prom.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/proc_fs.h> | 22 | #include <linux/proc_fs.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/atomic.h> | 24 | #include <linux/atomic.h> |
25 | #include <linux/irqdomain.h> | ||
25 | 26 | ||
26 | #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2 | 27 | #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2 |
27 | #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 | 28 | #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 |
@@ -55,15 +56,6 @@ struct resource; | |||
55 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); | 56 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); |
56 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); | 57 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); |
57 | 58 | ||
58 | /* These routines are here to provide compatibility with how powerpc | ||
59 | * handles IRQ mapping for OF device nodes. We precompute and permanently | ||
60 | * register them in the platform_device objects, whereas powerpc computes them | ||
61 | * on request. | ||
62 | */ | ||
63 | static inline void irq_dispose_mapping(unsigned int virq) | ||
64 | { | ||
65 | } | ||
66 | |||
67 | extern struct device_node *of_console_device; | 59 | extern struct device_node *of_console_device; |
68 | extern char *of_console_path; | 60 | extern char *of_console_path; |
69 | extern char *of_console_options; | 61 | extern char *of_console_options; |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5bed94e189fa..e0829a6a4660 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -398,6 +398,7 @@ config X86_INTEL_CE | |||
398 | select X86_REBOOTFIXUPS | 398 | select X86_REBOOTFIXUPS |
399 | select OF | 399 | select OF |
400 | select OF_EARLY_FLATTREE | 400 | select OF_EARLY_FLATTREE |
401 | select IRQ_DOMAIN | ||
401 | ---help--- | 402 | ---help--- |
402 | Select for the Intel CE media processor (CE4100) SOC. | 403 | Select for the Intel CE media processor (CE4100) SOC. |
403 | This option compiles in support for the CE4100 SOC for settop | 404 | This option compiles in support for the CE4100 SOC for settop |
@@ -2076,6 +2077,7 @@ config OLPC | |||
2076 | select GPIOLIB | 2077 | select GPIOLIB |
2077 | select OF | 2078 | select OF |
2078 | select OF_PROMTREE | 2079 | select OF_PROMTREE |
2080 | select IRQ_DOMAIN | ||
2079 | ---help--- | 2081 | ---help--- |
2080 | Add support for detecting the unique features of the OLPC | 2082 | Add support for detecting the unique features of the OLPC |
2081 | XO hardware. | 2083 | XO hardware. |
diff --git a/arch/x86/include/asm/irq_controller.h b/arch/x86/include/asm/irq_controller.h deleted file mode 100644 index 423bbbddf36d..000000000000 --- a/arch/x86/include/asm/irq_controller.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #ifndef __IRQ_CONTROLLER__ | ||
2 | #define __IRQ_CONTROLLER__ | ||
3 | |||
4 | struct irq_domain { | ||
5 | int (*xlate)(struct irq_domain *h, const u32 *intspec, u32 intsize, | ||
6 | u32 *out_hwirq, u32 *out_type); | ||
7 | void *priv; | ||
8 | struct device_node *controller; | ||
9 | struct list_head l; | ||
10 | }; | ||
11 | |||
12 | #endif | ||
diff --git a/arch/x86/include/asm/prom.h b/arch/x86/include/asm/prom.h index 644dd885f05a..60bef663609a 100644 --- a/arch/x86/include/asm/prom.h +++ b/arch/x86/include/asm/prom.h | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
22 | #include <linux/atomic.h> | 22 | #include <linux/atomic.h> |
23 | #include <asm/setup.h> | 23 | #include <asm/setup.h> |
24 | #include <asm/irq_controller.h> | ||
25 | 24 | ||
26 | #ifdef CONFIG_OF | 25 | #ifdef CONFIG_OF |
27 | extern int of_ioapic; | 26 | extern int of_ioapic; |
@@ -43,15 +42,6 @@ extern char cmd_line[COMMAND_LINE_SIZE]; | |||
43 | #define pci_address_to_pio pci_address_to_pio | 42 | #define pci_address_to_pio pci_address_to_pio |
44 | unsigned long pci_address_to_pio(phys_addr_t addr); | 43 | unsigned long pci_address_to_pio(phys_addr_t addr); |
45 | 44 | ||
46 | /** | ||
47 | * irq_dispose_mapping - Unmap an interrupt | ||
48 | * @virq: linux virq number of the interrupt to unmap | ||
49 | * | ||
50 | * FIXME: We really should implement proper virq handling like power, | ||
51 | * but that's going to be major surgery. | ||
52 | */ | ||
53 | static inline void irq_dispose_mapping(unsigned int virq) { } | ||
54 | |||
55 | #define HAVE_ARCH_DEVTREE_FIXUPS | 45 | #define HAVE_ARCH_DEVTREE_FIXUPS |
56 | 46 | ||
57 | #endif /* __ASSEMBLY__ */ | 47 | #endif /* __ASSEMBLY__ */ |
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index 52821799a702..3ae2ced4a874 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/bootmem.h> | 4 | #include <linux/bootmem.h> |
5 | #include <linux/export.h> | 5 | #include <linux/export.h> |
6 | #include <linux/io.h> | 6 | #include <linux/io.h> |
7 | #include <linux/irqdomain.h> | ||
7 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
8 | #include <linux/list.h> | 9 | #include <linux/list.h> |
9 | #include <linux/of.h> | 10 | #include <linux/of.h> |
@@ -17,64 +18,14 @@ | |||
17 | #include <linux/initrd.h> | 18 | #include <linux/initrd.h> |
18 | 19 | ||
19 | #include <asm/hpet.h> | 20 | #include <asm/hpet.h> |
20 | #include <asm/irq_controller.h> | ||
21 | #include <asm/apic.h> | 21 | #include <asm/apic.h> |
22 | #include <asm/pci_x86.h> | 22 | #include <asm/pci_x86.h> |
23 | 23 | ||
24 | __initdata u64 initial_dtb; | 24 | __initdata u64 initial_dtb; |
25 | char __initdata cmd_line[COMMAND_LINE_SIZE]; | 25 | char __initdata cmd_line[COMMAND_LINE_SIZE]; |
26 | static LIST_HEAD(irq_domains); | ||
27 | static DEFINE_RAW_SPINLOCK(big_irq_lock); | ||
28 | 26 | ||
29 | int __initdata of_ioapic; | 27 | int __initdata of_ioapic; |
30 | 28 | ||
31 | #ifdef CONFIG_X86_IO_APIC | ||
32 | static void add_interrupt_host(struct irq_domain *ih) | ||
33 | { | ||
34 | unsigned long flags; | ||
35 | |||
36 | raw_spin_lock_irqsave(&big_irq_lock, flags); | ||
37 | list_add(&ih->l, &irq_domains); | ||
38 | raw_spin_unlock_irqrestore(&big_irq_lock, flags); | ||
39 | } | ||
40 | #endif | ||
41 | |||
42 | static struct irq_domain *get_ih_from_node(struct device_node *controller) | ||
43 | { | ||
44 | struct irq_domain *ih, *found = NULL; | ||
45 | unsigned long flags; | ||
46 | |||
47 | raw_spin_lock_irqsave(&big_irq_lock, flags); | ||
48 | list_for_each_entry(ih, &irq_domains, l) { | ||
49 | if (ih->controller == controller) { | ||
50 | found = ih; | ||
51 | break; | ||
52 | } | ||
53 | } | ||
54 | raw_spin_unlock_irqrestore(&big_irq_lock, flags); | ||
55 | return found; | ||
56 | } | ||
57 | |||
58 | unsigned int irq_create_of_mapping(struct device_node *controller, | ||
59 | const u32 *intspec, unsigned int intsize) | ||
60 | { | ||
61 | struct irq_domain *ih; | ||
62 | u32 virq, type; | ||
63 | int ret; | ||
64 | |||
65 | ih = get_ih_from_node(controller); | ||
66 | if (!ih) | ||
67 | return 0; | ||
68 | ret = ih->xlate(ih, intspec, intsize, &virq, &type); | ||
69 | if (ret) | ||
70 | return 0; | ||
71 | if (type == IRQ_TYPE_NONE) | ||
72 | return virq; | ||
73 | irq_set_irq_type(virq, type); | ||
74 | return virq; | ||
75 | } | ||
76 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | ||
77 | |||
78 | unsigned long pci_address_to_pio(phys_addr_t address) | 29 | unsigned long pci_address_to_pio(phys_addr_t address) |
79 | { | 30 | { |
80 | /* | 31 | /* |
@@ -354,36 +305,43 @@ static struct of_ioapic_type of_ioapic_type[] = | |||
354 | }, | 305 | }, |
355 | }; | 306 | }; |
356 | 307 | ||
357 | static int ioapic_xlate(struct irq_domain *id, const u32 *intspec, u32 intsize, | 308 | static int ioapic_xlate(struct irq_domain *domain, |
358 | u32 *out_hwirq, u32 *out_type) | 309 | struct device_node *controller, |
310 | const u32 *intspec, u32 intsize, | ||
311 | irq_hw_number_t *out_hwirq, u32 *out_type) | ||
359 | { | 312 | { |
360 | struct mp_ioapic_gsi *gsi_cfg; | ||
361 | struct io_apic_irq_attr attr; | 313 | struct io_apic_irq_attr attr; |
362 | struct of_ioapic_type *it; | 314 | struct of_ioapic_type *it; |
363 | u32 line, idx, type; | 315 | u32 line, idx; |
316 | int rc; | ||
364 | 317 | ||
365 | if (intsize < 2) | 318 | if (WARN_ON(intsize < 2)) |
366 | return -EINVAL; | 319 | return -EINVAL; |
367 | 320 | ||
368 | line = *intspec; | 321 | line = intspec[0]; |
369 | idx = (u32) id->priv; | ||
370 | gsi_cfg = mp_ioapic_gsi_routing(idx); | ||
371 | *out_hwirq = line + gsi_cfg->gsi_base; | ||
372 | |||
373 | intspec++; | ||
374 | type = *intspec; | ||
375 | 322 | ||
376 | if (type >= ARRAY_SIZE(of_ioapic_type)) | 323 | if (intspec[1] >= ARRAY_SIZE(of_ioapic_type)) |
377 | return -EINVAL; | 324 | return -EINVAL; |
378 | 325 | ||
379 | it = of_ioapic_type + type; | 326 | it = &of_ioapic_type[intspec[1]]; |
380 | *out_type = it->out_type; | ||
381 | 327 | ||
328 | idx = (u32) domain->host_data; | ||
382 | set_io_apic_irq_attr(&attr, idx, line, it->trigger, it->polarity); | 329 | set_io_apic_irq_attr(&attr, idx, line, it->trigger, it->polarity); |
383 | 330 | ||
384 | return io_apic_setup_irq_pin_once(*out_hwirq, cpu_to_node(0), &attr); | 331 | rc = io_apic_setup_irq_pin_once(irq_find_mapping(domain, line), |
332 | cpu_to_node(0), &attr); | ||
333 | if (rc) | ||
334 | return rc; | ||
335 | |||
336 | *out_hwirq = line; | ||
337 | *out_type = it->out_type; | ||
338 | return 0; | ||
385 | } | 339 | } |
386 | 340 | ||
341 | const struct irq_domain_ops ioapic_irq_domain_ops = { | ||
342 | .xlate = ioapic_xlate, | ||
343 | }; | ||
344 | |||
387 | static void __init ioapic_add_ofnode(struct device_node *np) | 345 | static void __init ioapic_add_ofnode(struct device_node *np) |
388 | { | 346 | { |
389 | struct resource r; | 347 | struct resource r; |
@@ -399,13 +357,14 @@ static void __init ioapic_add_ofnode(struct device_node *np) | |||
399 | for (i = 0; i < nr_ioapics; i++) { | 357 | for (i = 0; i < nr_ioapics; i++) { |
400 | if (r.start == mpc_ioapic_addr(i)) { | 358 | if (r.start == mpc_ioapic_addr(i)) { |
401 | struct irq_domain *id; | 359 | struct irq_domain *id; |
360 | struct mp_ioapic_gsi *gsi_cfg; | ||
361 | |||
362 | gsi_cfg = mp_ioapic_gsi_routing(i); | ||
402 | 363 | ||
403 | id = kzalloc(sizeof(*id), GFP_KERNEL); | 364 | id = irq_domain_add_legacy(np, 32, gsi_cfg->gsi_base, 0, |
365 | &ioapic_irq_domain_ops, | ||
366 | (void*)i); | ||
404 | BUG_ON(!id); | 367 | BUG_ON(!id); |
405 | id->controller = np; | ||
406 | id->xlate = ioapic_xlate; | ||
407 | id->priv = (void *)i; | ||
408 | add_interrupt_host(id); | ||
409 | return; | 368 | return; |
410 | } | 369 | } |
411 | } | 370 | } |
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index 5cd04b65c556..e6568c19c939 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c | |||
@@ -37,7 +37,7 @@ struct mpc8xxx_gpio_chip { | |||
37 | * open drain mode safely | 37 | * open drain mode safely |
38 | */ | 38 | */ |
39 | u32 data; | 39 | u32 data; |
40 | struct irq_host *irq; | 40 | struct irq_domain *irq; |
41 | void *of_dev_id_data; | 41 | void *of_dev_id_data; |
42 | }; | 42 | }; |
43 | 43 | ||
@@ -281,7 +281,7 @@ static struct irq_chip mpc8xxx_irq_chip = { | |||
281 | .irq_set_type = mpc8xxx_irq_set_type, | 281 | .irq_set_type = mpc8xxx_irq_set_type, |
282 | }; | 282 | }; |
283 | 283 | ||
284 | static int mpc8xxx_gpio_irq_map(struct irq_host *h, unsigned int virq, | 284 | static int mpc8xxx_gpio_irq_map(struct irq_domain *h, unsigned int virq, |
285 | irq_hw_number_t hw) | 285 | irq_hw_number_t hw) |
286 | { | 286 | { |
287 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = h->host_data; | 287 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = h->host_data; |
@@ -296,24 +296,9 @@ static int mpc8xxx_gpio_irq_map(struct irq_host *h, unsigned int virq, | |||
296 | return 0; | 296 | return 0; |
297 | } | 297 | } |
298 | 298 | ||
299 | static int mpc8xxx_gpio_irq_xlate(struct irq_host *h, struct device_node *ct, | 299 | static struct irq_domain_ops mpc8xxx_gpio_irq_ops = { |
300 | const u32 *intspec, unsigned int intsize, | ||
301 | irq_hw_number_t *out_hwirq, | ||
302 | unsigned int *out_flags) | ||
303 | |||
304 | { | ||
305 | /* interrupt sense values coming from the device tree equal either | ||
306 | * EDGE_FALLING or EDGE_BOTH | ||
307 | */ | ||
308 | *out_hwirq = intspec[0]; | ||
309 | *out_flags = intspec[1]; | ||
310 | |||
311 | return 0; | ||
312 | } | ||
313 | |||
314 | static struct irq_host_ops mpc8xxx_gpio_irq_ops = { | ||
315 | .map = mpc8xxx_gpio_irq_map, | 300 | .map = mpc8xxx_gpio_irq_map, |
316 | .xlate = mpc8xxx_gpio_irq_xlate, | 301 | .xlate = irq_domain_xlate_twocell, |
317 | }; | 302 | }; |
318 | 303 | ||
319 | static struct of_device_id mpc8xxx_gpio_ids[] __initdata = { | 304 | static struct of_device_id mpc8xxx_gpio_ids[] __initdata = { |
@@ -364,9 +349,8 @@ static void __init mpc8xxx_add_controller(struct device_node *np) | |||
364 | if (hwirq == NO_IRQ) | 349 | if (hwirq == NO_IRQ) |
365 | goto skip_irq; | 350 | goto skip_irq; |
366 | 351 | ||
367 | mpc8xxx_gc->irq = | 352 | mpc8xxx_gc->irq = irq_domain_add_linear(np, MPC8XXX_GPIO_PINS, |
368 | irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, MPC8XXX_GPIO_PINS, | 353 | &mpc8xxx_gpio_irq_ops, mpc8xxx_gc); |
369 | &mpc8xxx_gpio_irq_ops, MPC8XXX_GPIO_PINS); | ||
370 | if (!mpc8xxx_gc->irq) | 354 | if (!mpc8xxx_gc->irq) |
371 | goto skip_irq; | 355 | goto skip_irq; |
372 | 356 | ||
@@ -374,8 +358,6 @@ static void __init mpc8xxx_add_controller(struct device_node *np) | |||
374 | if (id) | 358 | if (id) |
375 | mpc8xxx_gc->of_dev_id_data = id->data; | 359 | mpc8xxx_gc->of_dev_id_data = id->data; |
376 | 360 | ||
377 | mpc8xxx_gc->irq->host_data = mpc8xxx_gc; | ||
378 | |||
379 | /* ack and mask all irqs */ | 361 | /* ack and mask all irqs */ |
380 | out_be32(mm_gc->regs + GPIO_IER, 0xffffffff); | 362 | out_be32(mm_gc->regs + GPIO_IER, 0xffffffff); |
381 | out_be32(mm_gc->regs + GPIO_IMR, 0); | 363 | out_be32(mm_gc->regs + GPIO_IMR, 0); |
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index bdc293791590..6f17671260e1 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/of.h> | 25 | #include <linux/of.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/irqdomain.h> | ||
28 | 29 | ||
29 | #include <asm/mach/irq.h> | 30 | #include <asm/mach/irq.h> |
30 | 31 | ||
@@ -74,9 +75,10 @@ struct tegra_gpio_bank { | |||
74 | #endif | 75 | #endif |
75 | }; | 76 | }; |
76 | 77 | ||
77 | 78 | static struct irq_domain *irq_domain; | |
78 | static void __iomem *regs; | 79 | static void __iomem *regs; |
79 | static struct tegra_gpio_bank tegra_gpio_banks[7]; | 80 | static u32 tegra_gpio_bank_count; |
81 | static struct tegra_gpio_bank *tegra_gpio_banks; | ||
80 | 82 | ||
81 | static inline void tegra_gpio_writel(u32 val, u32 reg) | 83 | static inline void tegra_gpio_writel(u32 val, u32 reg) |
82 | { | 84 | { |
@@ -139,7 +141,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | |||
139 | 141 | ||
140 | static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 142 | static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
141 | { | 143 | { |
142 | return TEGRA_GPIO_TO_IRQ(offset); | 144 | return irq_find_mapping(irq_domain, offset); |
143 | } | 145 | } |
144 | 146 | ||
145 | static struct gpio_chip tegra_gpio_chip = { | 147 | static struct gpio_chip tegra_gpio_chip = { |
@@ -155,28 +157,28 @@ static struct gpio_chip tegra_gpio_chip = { | |||
155 | 157 | ||
156 | static void tegra_gpio_irq_ack(struct irq_data *d) | 158 | static void tegra_gpio_irq_ack(struct irq_data *d) |
157 | { | 159 | { |
158 | int gpio = d->irq - INT_GPIO_BASE; | 160 | int gpio = d->hwirq; |
159 | 161 | ||
160 | tegra_gpio_writel(1 << GPIO_BIT(gpio), GPIO_INT_CLR(gpio)); | 162 | tegra_gpio_writel(1 << GPIO_BIT(gpio), GPIO_INT_CLR(gpio)); |
161 | } | 163 | } |
162 | 164 | ||
163 | static void tegra_gpio_irq_mask(struct irq_data *d) | 165 | static void tegra_gpio_irq_mask(struct irq_data *d) |
164 | { | 166 | { |
165 | int gpio = d->irq - INT_GPIO_BASE; | 167 | int gpio = d->hwirq; |
166 | 168 | ||
167 | tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 0); | 169 | tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 0); |
168 | } | 170 | } |
169 | 171 | ||
170 | static void tegra_gpio_irq_unmask(struct irq_data *d) | 172 | static void tegra_gpio_irq_unmask(struct irq_data *d) |
171 | { | 173 | { |
172 | int gpio = d->irq - INT_GPIO_BASE; | 174 | int gpio = d->hwirq; |
173 | 175 | ||
174 | tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 1); | 176 | tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 1); |
175 | } | 177 | } |
176 | 178 | ||
177 | static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type) | 179 | static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
178 | { | 180 | { |
179 | int gpio = d->irq - INT_GPIO_BASE; | 181 | int gpio = d->hwirq; |
180 | struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d); | 182 | struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d); |
181 | int port = GPIO_PORT(gpio); | 183 | int port = GPIO_PORT(gpio); |
182 | int lvl_type; | 184 | int lvl_type; |
@@ -273,7 +275,7 @@ void tegra_gpio_resume(void) | |||
273 | 275 | ||
274 | local_irq_save(flags); | 276 | local_irq_save(flags); |
275 | 277 | ||
276 | for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) { | 278 | for (b = 0; b < tegra_gpio_bank_count; b++) { |
277 | struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; | 279 | struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; |
278 | 280 | ||
279 | for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { | 281 | for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { |
@@ -296,7 +298,7 @@ void tegra_gpio_suspend(void) | |||
296 | int p; | 298 | int p; |
297 | 299 | ||
298 | local_irq_save(flags); | 300 | local_irq_save(flags); |
299 | for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) { | 301 | for (b = 0; b < tegra_gpio_bank_count; b++) { |
300 | struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; | 302 | struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; |
301 | 303 | ||
302 | for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { | 304 | for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { |
@@ -337,13 +339,44 @@ static struct lock_class_key gpio_lock_class; | |||
337 | 339 | ||
338 | static int __devinit tegra_gpio_probe(struct platform_device *pdev) | 340 | static int __devinit tegra_gpio_probe(struct platform_device *pdev) |
339 | { | 341 | { |
342 | int irq_base; | ||
340 | struct resource *res; | 343 | struct resource *res; |
341 | struct tegra_gpio_bank *bank; | 344 | struct tegra_gpio_bank *bank; |
342 | int gpio; | 345 | int gpio; |
343 | int i; | 346 | int i; |
344 | int j; | 347 | int j; |
345 | 348 | ||
346 | for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) { | 349 | for (;;) { |
350 | res = platform_get_resource(pdev, IORESOURCE_IRQ, tegra_gpio_bank_count); | ||
351 | if (!res) | ||
352 | break; | ||
353 | tegra_gpio_bank_count++; | ||
354 | } | ||
355 | if (!tegra_gpio_bank_count) { | ||
356 | dev_err(&pdev->dev, "Missing IRQ resource\n"); | ||
357 | return -ENODEV; | ||
358 | } | ||
359 | |||
360 | tegra_gpio_chip.ngpio = tegra_gpio_bank_count * 32; | ||
361 | |||
362 | tegra_gpio_banks = devm_kzalloc(&pdev->dev, | ||
363 | tegra_gpio_bank_count * sizeof(*tegra_gpio_banks), | ||
364 | GFP_KERNEL); | ||
365 | if (!tegra_gpio_banks) { | ||
366 | dev_err(&pdev->dev, "Couldn't allocate bank structure\n"); | ||
367 | return -ENODEV; | ||
368 | } | ||
369 | |||
370 | irq_base = irq_alloc_descs(-1, 0, tegra_gpio_chip.ngpio, 0); | ||
371 | if (irq_base < 0) { | ||
372 | dev_err(&pdev->dev, "Couldn't allocate IRQ numbers\n"); | ||
373 | return -ENODEV; | ||
374 | } | ||
375 | irq_domain = irq_domain_add_legacy(pdev->dev.of_node, | ||
376 | tegra_gpio_chip.ngpio, irq_base, 0, | ||
377 | &irq_domain_simple_ops, NULL); | ||
378 | |||
379 | for (i = 0; i < tegra_gpio_bank_count; i++) { | ||
347 | res = platform_get_resource(pdev, IORESOURCE_IRQ, i); | 380 | res = platform_get_resource(pdev, IORESOURCE_IRQ, i); |
348 | if (!res) { | 381 | if (!res) { |
349 | dev_err(&pdev->dev, "Missing IRQ resource\n"); | 382 | dev_err(&pdev->dev, "Missing IRQ resource\n"); |
@@ -380,8 +413,8 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
380 | 413 | ||
381 | gpiochip_add(&tegra_gpio_chip); | 414 | gpiochip_add(&tegra_gpio_chip); |
382 | 415 | ||
383 | for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) { | 416 | for (gpio = 0; gpio < tegra_gpio_chip.ngpio; gpio++) { |
384 | int irq = TEGRA_GPIO_TO_IRQ(gpio); | 417 | int irq = irq_find_mapping(irq_domain, gpio); |
385 | /* No validity check; all Tegra GPIOs are valid IRQs */ | 418 | /* No validity check; all Tegra GPIOs are valid IRQs */ |
386 | 419 | ||
387 | bank = &tegra_gpio_banks[GPIO_BANK(gpio)]; | 420 | bank = &tegra_gpio_banks[GPIO_BANK(gpio)]; |
@@ -393,7 +426,7 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
393 | set_irq_flags(irq, IRQF_VALID); | 426 | set_irq_flags(irq, IRQF_VALID); |
394 | } | 427 | } |
395 | 428 | ||
396 | for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) { | 429 | for (i = 0; i < tegra_gpio_bank_count; i++) { |
397 | bank = &tegra_gpio_banks[i]; | 430 | bank = &tegra_gpio_banks[i]; |
398 | 431 | ||
399 | irq_set_chained_handler(bank->irq, tegra_gpio_irq_handler); | 432 | irq_set_chained_handler(bank->irq, tegra_gpio_irq_handler); |
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 58832e578fff..8d1ab6fa88e1 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -196,7 +196,7 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx) | |||
196 | 196 | ||
197 | dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); | 197 | dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); |
198 | 198 | ||
199 | clk_enable(i2c_imx->clk); | 199 | clk_prepare_enable(i2c_imx->clk); |
200 | writeb(i2c_imx->ifdr, i2c_imx->base + IMX_I2C_IFDR); | 200 | writeb(i2c_imx->ifdr, i2c_imx->base + IMX_I2C_IFDR); |
201 | /* Enable I2C controller */ | 201 | /* Enable I2C controller */ |
202 | writeb(0, i2c_imx->base + IMX_I2C_I2SR); | 202 | writeb(0, i2c_imx->base + IMX_I2C_I2SR); |
@@ -245,7 +245,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) | |||
245 | 245 | ||
246 | /* Disable I2C controller */ | 246 | /* Disable I2C controller */ |
247 | writeb(0, i2c_imx->base + IMX_I2C_I2CR); | 247 | writeb(0, i2c_imx->base + IMX_I2C_I2CR); |
248 | clk_disable(i2c_imx->clk); | 248 | clk_disable_unprepare(i2c_imx->clk); |
249 | } | 249 | } |
250 | 250 | ||
251 | static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, | 251 | static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index f147395bac9a..1489c3540f96 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -201,6 +201,7 @@ config MENELAUS | |||
201 | config TWL4030_CORE | 201 | config TWL4030_CORE |
202 | bool "Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support" | 202 | bool "Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support" |
203 | depends on I2C=y && GENERIC_HARDIRQS | 203 | depends on I2C=y && GENERIC_HARDIRQS |
204 | select IRQ_DOMAIN | ||
204 | help | 205 | help |
205 | Say yes here if you have TWL4030 / TWL6030 family chip on your board. | 206 | Say yes here if you have TWL4030 / TWL6030 family chip on your board. |
206 | This core driver provides register access and IRQ handling | 207 | This core driver provides register access and IRQ handling |
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 8ce3959c6919..4970d43952db 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
@@ -149,7 +149,7 @@ | |||
149 | 149 | ||
150 | #define TWL_MODULE_LAST TWL4030_MODULE_LAST | 150 | #define TWL_MODULE_LAST TWL4030_MODULE_LAST |
151 | 151 | ||
152 | #define TWL4030_NR_IRQS 8 | 152 | #define TWL4030_NR_IRQS 34 /* core:8, power:8, gpio: 18 */ |
153 | #define TWL6030_NR_IRQS 20 | 153 | #define TWL6030_NR_IRQS 20 |
154 | 154 | ||
155 | /* Base Address defns for twl4030_map[] */ | 155 | /* Base Address defns for twl4030_map[] */ |
@@ -263,10 +263,6 @@ struct twl_client { | |||
263 | 263 | ||
264 | static struct twl_client twl_modules[TWL_NUM_SLAVES]; | 264 | static struct twl_client twl_modules[TWL_NUM_SLAVES]; |
265 | 265 | ||
266 | #ifdef CONFIG_IRQ_DOMAIN | ||
267 | static struct irq_domain domain; | ||
268 | #endif | ||
269 | |||
270 | /* mapping the module id to slave id and base address */ | 266 | /* mapping the module id to slave id and base address */ |
271 | struct twl_mapping { | 267 | struct twl_mapping { |
272 | unsigned char sid; /* Slave ID */ | 268 | unsigned char sid; /* Slave ID */ |
@@ -1227,14 +1223,8 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1227 | 1223 | ||
1228 | pdata->irq_base = status; | 1224 | pdata->irq_base = status; |
1229 | pdata->irq_end = pdata->irq_base + nr_irqs; | 1225 | pdata->irq_end = pdata->irq_base + nr_irqs; |
1230 | 1226 | irq_domain_add_legacy(node, nr_irqs, pdata->irq_base, 0, | |
1231 | #ifdef CONFIG_IRQ_DOMAIN | 1227 | &irq_domain_simple_ops, NULL); |
1232 | domain.irq_base = pdata->irq_base; | ||
1233 | domain.nr_irq = nr_irqs; | ||
1234 | domain.of_node = of_node_get(node); | ||
1235 | domain.ops = &irq_domain_simple_ops; | ||
1236 | irq_domain_add(&domain); | ||
1237 | #endif | ||
1238 | 1228 | ||
1239 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) { | 1229 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) { |
1240 | dev_dbg(&client->dev, "can't talk I2C?\n"); | 1230 | dev_dbg(&client->dev, "can't talk I2C?\n"); |
@@ -1315,11 +1305,10 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1315 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1); | 1305 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1); |
1316 | } | 1306 | } |
1317 | 1307 | ||
1318 | #ifdef CONFIG_OF_DEVICE | 1308 | status = -ENODEV; |
1319 | if (node) | 1309 | if (node) |
1320 | status = of_platform_populate(node, NULL, NULL, &client->dev); | 1310 | status = of_platform_populate(node, NULL, NULL, &client->dev); |
1321 | else | 1311 | if (status) |
1322 | #endif | ||
1323 | status = add_children(pdata, id->driver_data); | 1312 | status = add_children(pdata, id->driver_data); |
1324 | 1313 | ||
1325 | fail: | 1314 | fail: |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 947faa5d2ce4..efdb81d21c44 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -86,7 +86,6 @@ static inline int at91mci_is_mci1rev2xx(void) | |||
86 | { | 86 | { |
87 | return ( cpu_is_at91sam9260() | 87 | return ( cpu_is_at91sam9260() |
88 | || cpu_is_at91sam9263() | 88 | || cpu_is_at91sam9263() |
89 | || cpu_is_at91cap9() | ||
90 | || cpu_is_at91sam9rl() | 89 | || cpu_is_at91sam9rl() |
91 | || cpu_is_at91sam9g10() | 90 | || cpu_is_at91sam9g10() |
92 | || cpu_is_at91sam9g20() | 91 | || cpu_is_at91sam9g20() |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index d601e41af282..f4e82d45cafa 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -463,7 +463,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
463 | err = PTR_ERR(clk); | 463 | err = PTR_ERR(clk); |
464 | goto err_clk_get; | 464 | goto err_clk_get; |
465 | } | 465 | } |
466 | clk_enable(clk); | 466 | clk_prepare_enable(clk); |
467 | pltfm_host->clk = clk; | 467 | pltfm_host->clk = clk; |
468 | 468 | ||
469 | if (!is_imx25_esdhc(imx_data)) | 469 | if (!is_imx25_esdhc(imx_data)) |
@@ -558,7 +558,7 @@ no_card_detect_irq: | |||
558 | gpio_free(boarddata->wp_gpio); | 558 | gpio_free(boarddata->wp_gpio); |
559 | no_card_detect_pin: | 559 | no_card_detect_pin: |
560 | no_board_data: | 560 | no_board_data: |
561 | clk_disable(pltfm_host->clk); | 561 | clk_disable_unprepare(pltfm_host->clk); |
562 | clk_put(pltfm_host->clk); | 562 | clk_put(pltfm_host->clk); |
563 | err_clk_get: | 563 | err_clk_get: |
564 | kfree(imx_data); | 564 | kfree(imx_data); |
@@ -585,7 +585,7 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev) | |||
585 | gpio_free(boarddata->cd_gpio); | 585 | gpio_free(boarddata->cd_gpio); |
586 | } | 586 | } |
587 | 587 | ||
588 | clk_disable(pltfm_host->clk); | 588 | clk_disable_unprepare(pltfm_host->clk); |
589 | clk_put(pltfm_host->clk); | 589 | clk_put(pltfm_host->clk); |
590 | kfree(imx_data); | 590 | kfree(imx_data); |
591 | 591 | ||
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 1af756ee0f9a..b19e7d435f8d 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
@@ -518,9 +518,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
518 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) | 518 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) |
519 | host->mmc->caps = MMC_CAP_NONREMOVABLE; | 519 | host->mmc->caps = MMC_CAP_NONREMOVABLE; |
520 | 520 | ||
521 | if (pdata->host_caps) | ||
522 | host->mmc->caps |= pdata->host_caps; | ||
523 | |||
524 | if (pdata->pm_caps) | 521 | if (pdata->pm_caps) |
525 | host->mmc->pm_caps |= pdata->pm_caps; | 522 | host->mmc->pm_caps |= pdata->pm_caps; |
526 | 523 | ||
@@ -544,6 +541,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
544 | if (pdata->host_caps) | 541 | if (pdata->host_caps) |
545 | host->mmc->caps |= pdata->host_caps; | 542 | host->mmc->caps |= pdata->host_caps; |
546 | 543 | ||
544 | if (pdata->host_caps2) | ||
545 | host->mmc->caps2 |= pdata->host_caps2; | ||
546 | |||
547 | ret = sdhci_add_host(host); | 547 | ret = sdhci_add_host(host); |
548 | if (ret) { | 548 | if (ret) { |
549 | dev_err(dev, "sdhci_add_host() failed\n"); | 549 | dev_err(dev, "sdhci_add_host() failed\n"); |
diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 068c3563e00f..88bbd8ffa7fe 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c | |||
@@ -190,8 +190,10 @@ static struct devprobe2 isa_probes[] __initdata = { | |||
190 | {seeq8005_probe, 0}, | 190 | {seeq8005_probe, 0}, |
191 | #endif | 191 | #endif |
192 | #ifdef CONFIG_CS89x0 | 192 | #ifdef CONFIG_CS89x0 |
193 | #ifndef CONFIG_CS89x0_PLATFORM | ||
193 | {cs89x0_probe, 0}, | 194 | {cs89x0_probe, 0}, |
194 | #endif | 195 | #endif |
196 | #endif | ||
195 | #ifdef CONFIG_AT1700 | 197 | #ifdef CONFIG_AT1700 |
196 | {at1700_probe, 0}, | 198 | {at1700_probe, 0}, |
197 | #endif | 199 | #endif |
diff --git a/drivers/net/ethernet/cirrus/Kconfig b/drivers/net/ethernet/cirrus/Kconfig index 1f8648f099c7..8388e36cf08f 100644 --- a/drivers/net/ethernet/cirrus/Kconfig +++ b/drivers/net/ethernet/cirrus/Kconfig | |||
@@ -5,8 +5,7 @@ | |||
5 | config NET_VENDOR_CIRRUS | 5 | config NET_VENDOR_CIRRUS |
6 | bool "Cirrus devices" | 6 | bool "Cirrus devices" |
7 | default y | 7 | default y |
8 | depends on ISA || EISA || MACH_IXDP2351 || ARCH_IXDP2X01 \ | 8 | depends on ISA || EISA || ARM || MAC |
9 | || MACH_MX31ADS || MACH_QQ2440 || (ARM && ARCH_EP93XX) || MAC | ||
10 | ---help--- | 9 | ---help--- |
11 | If you have a network (Ethernet) card belonging to this class, say Y | 10 | If you have a network (Ethernet) card belonging to this class, say Y |
12 | and read the Ethernet-HOWTO, available from | 11 | and read the Ethernet-HOWTO, available from |
@@ -21,8 +20,7 @@ if NET_VENDOR_CIRRUS | |||
21 | 20 | ||
22 | config CS89x0 | 21 | config CS89x0 |
23 | tristate "CS89x0 support" | 22 | tristate "CS89x0 support" |
24 | depends on (ISA || EISA || MACH_IXDP2351 \ | 23 | depends on ISA || EISA || ARM |
25 | || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440) | ||
26 | ---help--- | 24 | ---help--- |
27 | Support for CS89x0 chipset based Ethernet cards. If you have a | 25 | Support for CS89x0 chipset based Ethernet cards. If you have a |
28 | network (Ethernet) card of this type, say Y and read the | 26 | network (Ethernet) card of this type, say Y and read the |
@@ -33,10 +31,15 @@ config CS89x0 | |||
33 | To compile this driver as a module, choose M here. The module | 31 | To compile this driver as a module, choose M here. The module |
34 | will be called cs89x0. | 32 | will be called cs89x0. |
35 | 33 | ||
36 | config CS89x0_NONISA_IRQ | 34 | config CS89x0_PLATFORM |
37 | def_bool y | 35 | bool "CS89x0 platform driver support" |
38 | depends on CS89x0 != n | 36 | depends on CS89x0 |
39 | depends on MACH_IXDP2351 || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440 | 37 | help |
38 | Say Y to compile the cs89x0 driver as a platform driver. This | ||
39 | makes this driver suitable for use on certain evaluation boards | ||
40 | such as the iMX21ADS. | ||
41 | |||
42 | If you are unsure, say N. | ||
40 | 43 | ||
41 | config EP93XX_ETH | 44 | config EP93XX_ETH |
42 | tristate "EP93xx Ethernet support" | 45 | tristate "EP93xx Ethernet support" |
diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c index f328da24c8fa..7202ca951bf3 100644 --- a/drivers/net/ethernet/cirrus/cs89x0.c +++ b/drivers/net/ethernet/cirrus/cs89x0.c | |||
@@ -100,9 +100,6 @@ | |||
100 | 100 | ||
101 | */ | 101 | */ |
102 | 102 | ||
103 | /* Always include 'config.h' first in case the user wants to turn on | ||
104 | or override something. */ | ||
105 | #include <linux/module.h> | ||
106 | 103 | ||
107 | /* | 104 | /* |
108 | * Set this to zero to disable DMA code | 105 | * Set this to zero to disable DMA code |
@@ -131,9 +128,12 @@ | |||
131 | 128 | ||
132 | */ | 129 | */ |
133 | 130 | ||
131 | #include <linux/module.h> | ||
132 | #include <linux/printk.h> | ||
134 | #include <linux/errno.h> | 133 | #include <linux/errno.h> |
135 | #include <linux/netdevice.h> | 134 | #include <linux/netdevice.h> |
136 | #include <linux/etherdevice.h> | 135 | #include <linux/etherdevice.h> |
136 | #include <linux/platform_device.h> | ||
137 | #include <linux/kernel.h> | 137 | #include <linux/kernel.h> |
138 | #include <linux/types.h> | 138 | #include <linux/types.h> |
139 | #include <linux/fcntl.h> | 139 | #include <linux/fcntl.h> |
@@ -151,6 +151,7 @@ | |||
151 | #include <asm/system.h> | 151 | #include <asm/system.h> |
152 | #include <asm/io.h> | 152 | #include <asm/io.h> |
153 | #include <asm/irq.h> | 153 | #include <asm/irq.h> |
154 | #include <linux/atomic.h> | ||
154 | #if ALLOW_DMA | 155 | #if ALLOW_DMA |
155 | #include <asm/dma.h> | 156 | #include <asm/dma.h> |
156 | #endif | 157 | #endif |
@@ -174,26 +175,20 @@ static char version[] __initdata = | |||
174 | them to system IRQ numbers. This mapping is card specific and is set to | 175 | them to system IRQ numbers. This mapping is card specific and is set to |
175 | the configuration of the Cirrus Eval board for this chip. */ | 176 | the configuration of the Cirrus Eval board for this chip. */ |
176 | #if defined(CONFIG_MACH_IXDP2351) | 177 | #if defined(CONFIG_MACH_IXDP2351) |
178 | #define CS89x0_NONISA_IRQ | ||
177 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; | 179 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; |
178 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; | 180 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; |
179 | #elif defined(CONFIG_ARCH_IXDP2X01) | 181 | #elif defined(CONFIG_ARCH_IXDP2X01) |
182 | #define CS89x0_NONISA_IRQ | ||
180 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; | 183 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; |
181 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; | 184 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; |
182 | #elif defined(CONFIG_MACH_QQ2440) | ||
183 | #include <mach/qq2440.h> | ||
184 | static unsigned int netcard_portlist[] __used __initdata = { QQ2440_CS8900_VIRT_BASE + 0x300, 0 }; | ||
185 | static unsigned int cs8900_irq_map[] = { QQ2440_CS8900_IRQ, 0, 0, 0 }; | ||
186 | #elif defined(CONFIG_MACH_MX31ADS) | ||
187 | #include <mach/board-mx31ads.h> | ||
188 | static unsigned int netcard_portlist[] __used __initdata = { | ||
189 | PBC_BASE_ADDRESS + PBC_CS8900A_IOBASE + 0x300, 0 | ||
190 | }; | ||
191 | static unsigned cs8900_irq_map[] = {EXPIO_INT_ENET_INT, 0, 0, 0}; | ||
192 | #else | 185 | #else |
186 | #ifndef CONFIG_CS89x0_PLATFORM | ||
193 | static unsigned int netcard_portlist[] __used __initdata = | 187 | static unsigned int netcard_portlist[] __used __initdata = |
194 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; | 188 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; |
195 | static unsigned int cs8900_irq_map[] = {10,11,12,5}; | 189 | static unsigned int cs8900_irq_map[] = {10,11,12,5}; |
196 | #endif | 190 | #endif |
191 | #endif | ||
197 | 192 | ||
198 | #if DEBUGGING | 193 | #if DEBUGGING |
199 | static unsigned int net_debug = DEBUGGING; | 194 | static unsigned int net_debug = DEBUGGING; |
@@ -236,11 +231,16 @@ struct net_local { | |||
236 | unsigned char *end_dma_buff; /* points to the end of the buffer */ | 231 | unsigned char *end_dma_buff; /* points to the end of the buffer */ |
237 | unsigned char *rx_dma_ptr; /* points to the next packet */ | 232 | unsigned char *rx_dma_ptr; /* points to the next packet */ |
238 | #endif | 233 | #endif |
234 | #ifdef CONFIG_CS89x0_PLATFORM | ||
235 | void __iomem *virt_addr;/* Virtual address for accessing the CS89x0. */ | ||
236 | unsigned long phys_addr;/* Physical address for accessing the CS89x0. */ | ||
237 | unsigned long size; /* Length of CS89x0 memory region. */ | ||
238 | #endif | ||
239 | }; | 239 | }; |
240 | 240 | ||
241 | /* Index to functions, as function prototypes. */ | 241 | /* Index to functions, as function prototypes. */ |
242 | 242 | ||
243 | static int cs89x0_probe1(struct net_device *dev, int ioaddr, int modular); | 243 | static int cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular); |
244 | static int net_open(struct net_device *dev); | 244 | static int net_open(struct net_device *dev); |
245 | static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev); | 245 | static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev); |
246 | static irqreturn_t net_interrupt(int irq, void *dev_id); | 246 | static irqreturn_t net_interrupt(int irq, void *dev_id); |
@@ -294,6 +294,7 @@ static int __init media_fn(char *str) | |||
294 | __setup("cs89x0_media=", media_fn); | 294 | __setup("cs89x0_media=", media_fn); |
295 | 295 | ||
296 | 296 | ||
297 | #ifndef CONFIG_CS89x0_PLATFORM | ||
297 | /* Check for a network adaptor of this type, and return '0' iff one exists. | 298 | /* Check for a network adaptor of this type, and return '0' iff one exists. |
298 | If dev->base_addr == 0, probe all likely locations. | 299 | If dev->base_addr == 0, probe all likely locations. |
299 | If dev->base_addr == 1, always return failure. | 300 | If dev->base_addr == 1, always return failure. |
@@ -343,6 +344,7 @@ out: | |||
343 | return ERR_PTR(err); | 344 | return ERR_PTR(err); |
344 | } | 345 | } |
345 | #endif | 346 | #endif |
347 | #endif | ||
346 | 348 | ||
347 | #if defined(CONFIG_MACH_IXDP2351) | 349 | #if defined(CONFIG_MACH_IXDP2351) |
348 | static u16 | 350 | static u16 |
@@ -504,7 +506,7 @@ static const struct net_device_ops net_ops = { | |||
504 | */ | 506 | */ |
505 | 507 | ||
506 | static int __init | 508 | static int __init |
507 | cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | 509 | cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular) |
508 | { | 510 | { |
509 | struct net_local *lp = netdev_priv(dev); | 511 | struct net_local *lp = netdev_priv(dev); |
510 | static unsigned version_printed; | 512 | static unsigned version_printed; |
@@ -529,15 +531,12 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
529 | lp->force = g_cs89x0_media__force; | 531 | lp->force = g_cs89x0_media__force; |
530 | #endif | 532 | #endif |
531 | 533 | ||
532 | #if defined(CONFIG_MACH_QQ2440) | ||
533 | lp->force |= FORCE_RJ45 | FORCE_FULL; | ||
534 | #endif | ||
535 | } | 534 | } |
536 | 535 | ||
537 | /* Grab the region so we can find another board if autoIRQ fails. */ | 536 | /* Grab the region so we can find another board if autoIRQ fails. */ |
538 | /* WTF is going on here? */ | 537 | /* WTF is going on here? */ |
539 | if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { | 538 | if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { |
540 | printk(KERN_ERR "%s: request_region(0x%x, 0x%x) failed\n", | 539 | printk(KERN_ERR "%s: request_region(0x%lx, 0x%x) failed\n", |
541 | DRV_NAME, ioaddr, NETCARD_IO_EXTENT); | 540 | DRV_NAME, ioaddr, NETCARD_IO_EXTENT); |
542 | retval = -EBUSY; | 541 | retval = -EBUSY; |
543 | goto out1; | 542 | goto out1; |
@@ -549,7 +548,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
549 | will skip the test for the ADD_PORT. */ | 548 | will skip the test for the ADD_PORT. */ |
550 | if (ioaddr & 1) { | 549 | if (ioaddr & 1) { |
551 | if (net_debug > 1) | 550 | if (net_debug > 1) |
552 | printk(KERN_INFO "%s: odd ioaddr 0x%x\n", dev->name, ioaddr); | 551 | printk(KERN_INFO "%s: odd ioaddr 0x%lx\n", dev->name, ioaddr); |
553 | if ((ioaddr & 2) != 2) | 552 | if ((ioaddr & 2) != 2) |
554 | if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { | 553 | if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { |
555 | printk(KERN_ERR "%s: bad signature 0x%x\n", | 554 | printk(KERN_ERR "%s: bad signature 0x%x\n", |
@@ -560,13 +559,13 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
560 | } | 559 | } |
561 | 560 | ||
562 | ioaddr &= ~3; | 561 | ioaddr &= ~3; |
563 | printk(KERN_DEBUG "PP_addr at %x[%x]: 0x%x\n", | 562 | printk(KERN_DEBUG "PP_addr at %lx[%x]: 0x%x\n", |
564 | ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); | 563 | ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); |
565 | writeword(ioaddr, ADD_PORT, PP_ChipID); | 564 | writeword(ioaddr, ADD_PORT, PP_ChipID); |
566 | 565 | ||
567 | tmp = readword(ioaddr, DATA_PORT); | 566 | tmp = readword(ioaddr, DATA_PORT); |
568 | if (tmp != CHIP_EISA_ID_SIG) { | 567 | if (tmp != CHIP_EISA_ID_SIG) { |
569 | printk(KERN_DEBUG "%s: incorrect signature at %x[%x]: 0x%x!=" | 568 | printk(KERN_DEBUG "%s: incorrect signature at %lx[%x]: 0x%x!=" |
570 | CHIP_EISA_ID_SIG_STR "\n", | 569 | CHIP_EISA_ID_SIG_STR "\n", |
571 | dev->name, ioaddr, DATA_PORT, tmp); | 570 | dev->name, ioaddr, DATA_PORT, tmp); |
572 | retval = -ENODEV; | 571 | retval = -ENODEV; |
@@ -736,8 +735,9 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
736 | dev->irq = i; | 735 | dev->irq = i; |
737 | } else { | 736 | } else { |
738 | i = lp->isa_config & INT_NO_MASK; | 737 | i = lp->isa_config & INT_NO_MASK; |
738 | #ifndef CONFIG_CS89x0_PLATFORM | ||
739 | if (lp->chip_type == CS8900) { | 739 | if (lp->chip_type == CS8900) { |
740 | #ifdef CONFIG_CS89x0_NONISA_IRQ | 740 | #ifdef CS89x0_NONISA_IRQ |
741 | i = cs8900_irq_map[0]; | 741 | i = cs8900_irq_map[0]; |
742 | #else | 742 | #else |
743 | /* Translate the IRQ using the IRQ mapping table. */ | 743 | /* Translate the IRQ using the IRQ mapping table. */ |
@@ -758,6 +758,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
758 | } | 758 | } |
759 | #endif | 759 | #endif |
760 | } | 760 | } |
761 | #endif | ||
761 | if (!dev->irq) | 762 | if (!dev->irq) |
762 | dev->irq = i; | 763 | dev->irq = i; |
763 | } | 764 | } |
@@ -1168,6 +1169,7 @@ write_irq(struct net_device *dev, int chip_type, int irq) | |||
1168 | int i; | 1169 | int i; |
1169 | 1170 | ||
1170 | if (chip_type == CS8900) { | 1171 | if (chip_type == CS8900) { |
1172 | #ifndef CONFIG_CS89x0_PLATFORM | ||
1171 | /* Search the mapping table for the corresponding IRQ pin. */ | 1173 | /* Search the mapping table for the corresponding IRQ pin. */ |
1172 | for (i = 0; i != ARRAY_SIZE(cs8900_irq_map); i++) | 1174 | for (i = 0; i != ARRAY_SIZE(cs8900_irq_map); i++) |
1173 | if (cs8900_irq_map[i] == irq) | 1175 | if (cs8900_irq_map[i] == irq) |
@@ -1175,6 +1177,10 @@ write_irq(struct net_device *dev, int chip_type, int irq) | |||
1175 | /* Not found */ | 1177 | /* Not found */ |
1176 | if (i == ARRAY_SIZE(cs8900_irq_map)) | 1178 | if (i == ARRAY_SIZE(cs8900_irq_map)) |
1177 | i = 3; | 1179 | i = 3; |
1180 | #else | ||
1181 | /* INTRQ0 pin is used for interrupt generation. */ | ||
1182 | i = 0; | ||
1183 | #endif | ||
1178 | writereg(dev, PP_CS8900_ISAINT, i); | 1184 | writereg(dev, PP_CS8900_ISAINT, i); |
1179 | } else { | 1185 | } else { |
1180 | writereg(dev, PP_CS8920_ISAINT, irq); | 1186 | writereg(dev, PP_CS8920_ISAINT, irq); |
@@ -1228,7 +1234,7 @@ net_open(struct net_device *dev) | |||
1228 | } | 1234 | } |
1229 | else | 1235 | else |
1230 | { | 1236 | { |
1231 | #ifndef CONFIG_CS89x0_NONISA_IRQ | 1237 | #if !defined(CS89x0_NONISA_IRQ) && !defined(CONFIG_CS89x0_PLATFORM) |
1232 | if (((1 << dev->irq) & lp->irq_map) == 0) { | 1238 | if (((1 << dev->irq) & lp->irq_map) == 0) { |
1233 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", | 1239 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", |
1234 | dev->name, dev->irq, lp->irq_map); | 1240 | dev->name, dev->irq, lp->irq_map); |
@@ -1746,7 +1752,7 @@ static int set_mac_address(struct net_device *dev, void *p) | |||
1746 | return 0; | 1752 | return 0; |
1747 | } | 1753 | } |
1748 | 1754 | ||
1749 | #ifdef MODULE | 1755 | #if defined(MODULE) && !defined(CONFIG_CS89x0_PLATFORM) |
1750 | 1756 | ||
1751 | static struct net_device *dev_cs89x0; | 1757 | static struct net_device *dev_cs89x0; |
1752 | 1758 | ||
@@ -1900,7 +1906,97 @@ cleanup_module(void) | |||
1900 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); | 1906 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); |
1901 | free_netdev(dev_cs89x0); | 1907 | free_netdev(dev_cs89x0); |
1902 | } | 1908 | } |
1903 | #endif /* MODULE */ | 1909 | #endif /* MODULE && !CONFIG_CS89x0_PLATFORM */ |
1910 | |||
1911 | #ifdef CONFIG_CS89x0_PLATFORM | ||
1912 | static int __init cs89x0_platform_probe(struct platform_device *pdev) | ||
1913 | { | ||
1914 | struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); | ||
1915 | struct net_local *lp; | ||
1916 | struct resource *mem_res; | ||
1917 | int err; | ||
1918 | |||
1919 | if (!dev) | ||
1920 | return -ENOMEM; | ||
1921 | |||
1922 | lp = netdev_priv(dev); | ||
1923 | |||
1924 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1925 | dev->irq = platform_get_irq(pdev, 0); | ||
1926 | if (mem_res == NULL || dev->irq <= 0) { | ||
1927 | dev_warn(&dev->dev, "memory/interrupt resource missing.\n"); | ||
1928 | err = -ENXIO; | ||
1929 | goto free; | ||
1930 | } | ||
1931 | |||
1932 | lp->phys_addr = mem_res->start; | ||
1933 | lp->size = resource_size(mem_res); | ||
1934 | if (!request_mem_region(lp->phys_addr, lp->size, DRV_NAME)) { | ||
1935 | dev_warn(&dev->dev, "request_mem_region() failed.\n"); | ||
1936 | err = -EBUSY; | ||
1937 | goto free; | ||
1938 | } | ||
1939 | |||
1940 | lp->virt_addr = ioremap(lp->phys_addr, lp->size); | ||
1941 | if (!lp->virt_addr) { | ||
1942 | dev_warn(&dev->dev, "ioremap() failed.\n"); | ||
1943 | err = -ENOMEM; | ||
1944 | goto release; | ||
1945 | } | ||
1946 | |||
1947 | err = cs89x0_probe1(dev, (unsigned long)lp->virt_addr, 0); | ||
1948 | if (err) { | ||
1949 | dev_warn(&dev->dev, "no cs8900 or cs8920 detected.\n"); | ||
1950 | goto unmap; | ||
1951 | } | ||
1952 | |||
1953 | platform_set_drvdata(pdev, dev); | ||
1954 | return 0; | ||
1955 | |||
1956 | unmap: | ||
1957 | iounmap(lp->virt_addr); | ||
1958 | release: | ||
1959 | release_mem_region(lp->phys_addr, lp->size); | ||
1960 | free: | ||
1961 | free_netdev(dev); | ||
1962 | return err; | ||
1963 | } | ||
1964 | |||
1965 | static int cs89x0_platform_remove(struct platform_device *pdev) | ||
1966 | { | ||
1967 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1968 | struct net_local *lp = netdev_priv(dev); | ||
1969 | |||
1970 | unregister_netdev(dev); | ||
1971 | iounmap(lp->virt_addr); | ||
1972 | release_mem_region(lp->phys_addr, lp->size); | ||
1973 | free_netdev(dev); | ||
1974 | return 0; | ||
1975 | } | ||
1976 | |||
1977 | static struct platform_driver cs89x0_driver = { | ||
1978 | .driver = { | ||
1979 | .name = DRV_NAME, | ||
1980 | .owner = THIS_MODULE, | ||
1981 | }, | ||
1982 | .remove = cs89x0_platform_remove, | ||
1983 | }; | ||
1984 | |||
1985 | static int __init cs89x0_init(void) | ||
1986 | { | ||
1987 | return platform_driver_probe(&cs89x0_driver, cs89x0_platform_probe); | ||
1988 | } | ||
1989 | |||
1990 | module_init(cs89x0_init); | ||
1991 | |||
1992 | static void __exit cs89x0_cleanup(void) | ||
1993 | { | ||
1994 | platform_driver_unregister(&cs89x0_driver); | ||
1995 | } | ||
1996 | |||
1997 | module_exit(cs89x0_cleanup); | ||
1998 | |||
1999 | #endif /* CONFIG_CS89x0_PLATFORM */ | ||
1904 | 2000 | ||
1905 | /* | 2001 | /* |
1906 | * Local variables: | 2002 | * Local variables: |
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c index 50e8e5e74465..7189adf54bd1 100644 --- a/drivers/net/phy/mdio-gpio.c +++ b/drivers/net/phy/mdio-gpio.c | |||
@@ -255,13 +255,13 @@ static inline int __init mdio_ofgpio_init(void) | |||
255 | return platform_driver_register(&mdio_ofgpio_driver); | 255 | return platform_driver_register(&mdio_ofgpio_driver); |
256 | } | 256 | } |
257 | 257 | ||
258 | static inline void __exit mdio_ofgpio_exit(void) | 258 | static inline void mdio_ofgpio_exit(void) |
259 | { | 259 | { |
260 | platform_driver_unregister(&mdio_ofgpio_driver); | 260 | platform_driver_unregister(&mdio_ofgpio_driver); |
261 | } | 261 | } |
262 | #else | 262 | #else |
263 | static inline int __init mdio_ofgpio_init(void) { return 0; } | 263 | static inline int __init mdio_ofgpio_init(void) { return 0; } |
264 | static inline void __exit mdio_ofgpio_exit(void) { } | 264 | static inline void mdio_ofgpio_exit(void) { } |
265 | #endif /* CONFIG_OF_GPIO */ | 265 | #endif /* CONFIG_OF_GPIO */ |
266 | 266 | ||
267 | static struct platform_driver mdio_gpio_driver = { | 267 | static struct platform_driver mdio_gpio_driver = { |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index cae9477a6ed3..343ad29e211c 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -55,7 +55,7 @@ EXPORT_SYMBOL(of_find_device_by_node); | |||
55 | #include <asm/dcr.h> | 55 | #include <asm/dcr.h> |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #if !defined(CONFIG_SPARC) | 58 | #ifdef CONFIG_OF_ADDRESS |
59 | /* | 59 | /* |
60 | * The following routines scan a subtree and registers a device for | 60 | * The following routines scan a subtree and registers a device for |
61 | * each applicable node. | 61 | * each applicable node. |
@@ -462,4 +462,4 @@ int of_platform_populate(struct device_node *root, | |||
462 | of_node_put(root); | 462 | of_node_put(root); |
463 | return rc; | 463 | return rc; |
464 | } | 464 | } |
465 | #endif /* !CONFIG_SPARC */ | 465 | #endif /* CONFIG_OF_ADDRESS */ |
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 7a61b17ddd04..740f468ba65f 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -74,14 +74,6 @@ config REGULATOR_GPIO | |||
74 | and the platform has to provide a mapping of GPIO-states | 74 | and the platform has to provide a mapping of GPIO-states |
75 | to target volts/amps. | 75 | to target volts/amps. |
76 | 76 | ||
77 | config REGULATOR_BQ24022 | ||
78 | tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" | ||
79 | help | ||
80 | This driver controls a TI bq24022 Charger attached via | ||
81 | GPIOs. The provided current regulator can enable/disable | ||
82 | charging select between 100 mA and 500 mA charging current | ||
83 | limit. | ||
84 | |||
85 | config REGULATOR_MAX1586 | 77 | config REGULATOR_MAX1586 |
86 | tristate "Maxim 1586/1587 voltage regulator" | 78 | tristate "Maxim 1586/1587 voltage regulator" |
87 | depends on I2C | 79 | depends on I2C |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 503bac87715e..f53cf8082c62 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
@@ -11,7 +11,6 @@ obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o | |||
11 | 11 | ||
12 | obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o | 12 | obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o |
13 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o | 13 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o |
14 | obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o | ||
15 | obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o | 14 | obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o |
16 | obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o | 15 | obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o |
17 | obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o | 16 | obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o |
diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c deleted file mode 100644 index 9fab6d1bbe80..000000000000 --- a/drivers/regulator/bq24022.c +++ /dev/null | |||
@@ -1,162 +0,0 @@ | |||
1 | /* | ||
2 | * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater) | ||
3 | * 1-Cell Li-Ion Charger connected via GPIOs. | ||
4 | * | ||
5 | * Copyright (c) 2008 Philipp Zabel | ||
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 version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <linux/regulator/bq24022.h> | ||
20 | #include <linux/regulator/driver.h> | ||
21 | |||
22 | |||
23 | static int bq24022_set_current_limit(struct regulator_dev *rdev, | ||
24 | int min_uA, int max_uA) | ||
25 | { | ||
26 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
27 | |||
28 | dev_dbg(rdev_get_dev(rdev), "setting current limit to %s mA\n", | ||
29 | max_uA >= 500000 ? "500" : "100"); | ||
30 | |||
31 | /* REVISIT: maybe return error if min_uA != 0 ? */ | ||
32 | gpio_set_value(pdata->gpio_iset2, max_uA >= 500000); | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static int bq24022_get_current_limit(struct regulator_dev *rdev) | ||
37 | { | ||
38 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
39 | |||
40 | return gpio_get_value(pdata->gpio_iset2) ? 500000 : 100000; | ||
41 | } | ||
42 | |||
43 | static int bq24022_enable(struct regulator_dev *rdev) | ||
44 | { | ||
45 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
46 | |||
47 | dev_dbg(rdev_get_dev(rdev), "enabling charger\n"); | ||
48 | |||
49 | gpio_set_value(pdata->gpio_nce, 0); | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | static int bq24022_disable(struct regulator_dev *rdev) | ||
54 | { | ||
55 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
56 | |||
57 | dev_dbg(rdev_get_dev(rdev), "disabling charger\n"); | ||
58 | |||
59 | gpio_set_value(pdata->gpio_nce, 1); | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static int bq24022_is_enabled(struct regulator_dev *rdev) | ||
64 | { | ||
65 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
66 | |||
67 | return !gpio_get_value(pdata->gpio_nce); | ||
68 | } | ||
69 | |||
70 | static struct regulator_ops bq24022_ops = { | ||
71 | .set_current_limit = bq24022_set_current_limit, | ||
72 | .get_current_limit = bq24022_get_current_limit, | ||
73 | .enable = bq24022_enable, | ||
74 | .disable = bq24022_disable, | ||
75 | .is_enabled = bq24022_is_enabled, | ||
76 | }; | ||
77 | |||
78 | static struct regulator_desc bq24022_desc = { | ||
79 | .name = "bq24022", | ||
80 | .ops = &bq24022_ops, | ||
81 | .type = REGULATOR_CURRENT, | ||
82 | .owner = THIS_MODULE, | ||
83 | }; | ||
84 | |||
85 | static int __init bq24022_probe(struct platform_device *pdev) | ||
86 | { | ||
87 | struct bq24022_mach_info *pdata = pdev->dev.platform_data; | ||
88 | struct regulator_dev *bq24022; | ||
89 | int ret; | ||
90 | |||
91 | if (!pdata || !pdata->gpio_nce || !pdata->gpio_iset2) | ||
92 | return -EINVAL; | ||
93 | |||
94 | ret = gpio_request(pdata->gpio_nce, "ncharge_en"); | ||
95 | if (ret) { | ||
96 | dev_dbg(&pdev->dev, "couldn't request nCE GPIO: %d\n", | ||
97 | pdata->gpio_nce); | ||
98 | goto err_ce; | ||
99 | } | ||
100 | ret = gpio_request(pdata->gpio_iset2, "charge_mode"); | ||
101 | if (ret) { | ||
102 | dev_dbg(&pdev->dev, "couldn't request ISET2 GPIO: %d\n", | ||
103 | pdata->gpio_iset2); | ||
104 | goto err_iset2; | ||
105 | } | ||
106 | ret = gpio_direction_output(pdata->gpio_iset2, 0); | ||
107 | ret = gpio_direction_output(pdata->gpio_nce, 1); | ||
108 | |||
109 | bq24022 = regulator_register(&bq24022_desc, &pdev->dev, | ||
110 | pdata->init_data, pdata, NULL); | ||
111 | if (IS_ERR(bq24022)) { | ||
112 | dev_dbg(&pdev->dev, "couldn't register regulator\n"); | ||
113 | ret = PTR_ERR(bq24022); | ||
114 | goto err_reg; | ||
115 | } | ||
116 | platform_set_drvdata(pdev, bq24022); | ||
117 | dev_dbg(&pdev->dev, "registered regulator\n"); | ||
118 | |||
119 | return 0; | ||
120 | err_reg: | ||
121 | gpio_free(pdata->gpio_iset2); | ||
122 | err_iset2: | ||
123 | gpio_free(pdata->gpio_nce); | ||
124 | err_ce: | ||
125 | return ret; | ||
126 | } | ||
127 | |||
128 | static int __devexit bq24022_remove(struct platform_device *pdev) | ||
129 | { | ||
130 | struct bq24022_mach_info *pdata = pdev->dev.platform_data; | ||
131 | struct regulator_dev *bq24022 = platform_get_drvdata(pdev); | ||
132 | |||
133 | regulator_unregister(bq24022); | ||
134 | gpio_free(pdata->gpio_iset2); | ||
135 | gpio_free(pdata->gpio_nce); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static struct platform_driver bq24022_driver = { | ||
141 | .driver = { | ||
142 | .name = "bq24022", | ||
143 | }, | ||
144 | .remove = __devexit_p(bq24022_remove), | ||
145 | }; | ||
146 | |||
147 | static int __init bq24022_init(void) | ||
148 | { | ||
149 | return platform_driver_probe(&bq24022_driver, bq24022_probe); | ||
150 | } | ||
151 | |||
152 | static void __exit bq24022_exit(void) | ||
153 | { | ||
154 | platform_driver_unregister(&bq24022_driver); | ||
155 | } | ||
156 | |||
157 | module_init(bq24022_init); | ||
158 | module_exit(bq24022_exit); | ||
159 | |||
160 | MODULE_AUTHOR("Philipp Zabel"); | ||
161 | MODULE_DESCRIPTION("TI bq24022 Li-Ion Charger driver"); | ||
162 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 3a125b835546..59efc63c4e48 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -773,8 +773,8 @@ config RTC_DRV_EP93XX | |||
773 | will be called rtc-ep93xx. | 773 | will be called rtc-ep93xx. |
774 | 774 | ||
775 | config RTC_DRV_SA1100 | 775 | config RTC_DRV_SA1100 |
776 | tristate "SA11x0/PXA2xx" | 776 | tristate "SA11x0/PXA2xx/PXA910" |
777 | depends on ARCH_SA1100 || ARCH_PXA | 777 | depends on ARCH_SA1100 || ARCH_PXA || ARCH_MMP |
778 | help | 778 | help |
779 | If you say Y here you will get access to the real time clock | 779 | If you say Y here you will get access to the real time clock |
780 | built into your SA11x0 or PXA2xx CPU. | 780 | built into your SA11x0 or PXA2xx CPU. |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index aef40bd2957b..78951866f8ab 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | enum s3c_cpu_type { | 36 | enum s3c_cpu_type { |
37 | TYPE_S3C2410, | 37 | TYPE_S3C2410, |
38 | TYPE_S3C2416, | ||
39 | TYPE_S3C2443, | ||
38 | TYPE_S3C64XX, | 40 | TYPE_S3C64XX, |
39 | }; | 41 | }; |
40 | 42 | ||
@@ -132,6 +134,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq) | |||
132 | struct platform_device *pdev = to_platform_device(dev); | 134 | struct platform_device *pdev = to_platform_device(dev); |
133 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); | 135 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); |
134 | unsigned int tmp = 0; | 136 | unsigned int tmp = 0; |
137 | int val; | ||
135 | 138 | ||
136 | if (!is_power_of_2(freq)) | 139 | if (!is_power_of_2(freq)) |
137 | return -EINVAL; | 140 | return -EINVAL; |
@@ -139,12 +142,22 @@ static int s3c_rtc_setfreq(struct device *dev, int freq) | |||
139 | clk_enable(rtc_clk); | 142 | clk_enable(rtc_clk); |
140 | spin_lock_irq(&s3c_rtc_pie_lock); | 143 | spin_lock_irq(&s3c_rtc_pie_lock); |
141 | 144 | ||
142 | if (s3c_rtc_cpu_type == TYPE_S3C2410) { | 145 | if (s3c_rtc_cpu_type != TYPE_S3C64XX) { |
143 | tmp = readb(s3c_rtc_base + S3C2410_TICNT); | 146 | tmp = readb(s3c_rtc_base + S3C2410_TICNT); |
144 | tmp &= S3C2410_TICNT_ENABLE; | 147 | tmp &= S3C2410_TICNT_ENABLE; |
145 | } | 148 | } |
146 | 149 | ||
147 | tmp |= (rtc_dev->max_user_freq / freq)-1; | 150 | val = (rtc_dev->max_user_freq / freq) - 1; |
151 | |||
152 | if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) { | ||
153 | tmp |= S3C2443_TICNT_PART(val); | ||
154 | writel(S3C2443_TICNT1_PART(val), s3c_rtc_base + S3C2443_TICNT1); | ||
155 | |||
156 | if (s3c_rtc_cpu_type == TYPE_S3C2416) | ||
157 | writel(S3C2416_TICNT2_PART(val), s3c_rtc_base + S3C2416_TICNT2); | ||
158 | } else { | ||
159 | tmp |= val; | ||
160 | } | ||
148 | 161 | ||
149 | writel(tmp, s3c_rtc_base + S3C2410_TICNT); | 162 | writel(tmp, s3c_rtc_base + S3C2410_TICNT); |
150 | spin_unlock_irq(&s3c_rtc_pie_lock); | 163 | spin_unlock_irq(&s3c_rtc_pie_lock); |
@@ -371,7 +384,7 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en) | |||
371 | tmp &= ~S3C2410_RTCCON_RTCEN; | 384 | tmp &= ~S3C2410_RTCCON_RTCEN; |
372 | writew(tmp, base + S3C2410_RTCCON); | 385 | writew(tmp, base + S3C2410_RTCCON); |
373 | 386 | ||
374 | if (s3c_rtc_cpu_type == TYPE_S3C2410) { | 387 | if (s3c_rtc_cpu_type != TYPE_S3C64XX) { |
375 | tmp = readb(base + S3C2410_TICNT); | 388 | tmp = readb(base + S3C2410_TICNT); |
376 | tmp &= ~S3C2410_TICNT_ENABLE; | 389 | tmp &= ~S3C2410_TICNT_ENABLE; |
377 | writeb(tmp, base + S3C2410_TICNT); | 390 | writeb(tmp, base + S3C2410_TICNT); |
@@ -428,12 +441,27 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
428 | return 0; | 441 | return 0; |
429 | } | 442 | } |
430 | 443 | ||
444 | static const struct of_device_id s3c_rtc_dt_match[]; | ||
445 | |||
446 | static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) | ||
447 | { | ||
448 | #ifdef CONFIG_OF | ||
449 | if (pdev->dev.of_node) { | ||
450 | const struct of_device_id *match; | ||
451 | match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); | ||
452 | return match->data; | ||
453 | } | ||
454 | #endif | ||
455 | return platform_get_device_id(pdev)->driver_data; | ||
456 | } | ||
457 | |||
431 | static int __devinit s3c_rtc_probe(struct platform_device *pdev) | 458 | static int __devinit s3c_rtc_probe(struct platform_device *pdev) |
432 | { | 459 | { |
433 | struct rtc_device *rtc; | 460 | struct rtc_device *rtc; |
434 | struct rtc_time rtc_tm; | 461 | struct rtc_time rtc_tm; |
435 | struct resource *res; | 462 | struct resource *res; |
436 | int ret; | 463 | int ret; |
464 | int tmp; | ||
437 | 465 | ||
438 | pr_debug("%s: probe=%p\n", __func__, pdev); | 466 | pr_debug("%s: probe=%p\n", __func__, pdev); |
439 | 467 | ||
@@ -508,13 +536,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
508 | goto err_nortc; | 536 | goto err_nortc; |
509 | } | 537 | } |
510 | 538 | ||
511 | #ifdef CONFIG_OF | 539 | s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev); |
512 | if (pdev->dev.of_node) | ||
513 | s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node, | ||
514 | "samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410; | ||
515 | else | ||
516 | #endif | ||
517 | s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; | ||
518 | 540 | ||
519 | /* Check RTC Time */ | 541 | /* Check RTC Time */ |
520 | 542 | ||
@@ -533,11 +555,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
533 | dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n"); | 555 | dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n"); |
534 | } | 556 | } |
535 | 557 | ||
536 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) | 558 | if (s3c_rtc_cpu_type != TYPE_S3C2410) |
537 | rtc->max_user_freq = 32768; | 559 | rtc->max_user_freq = 32768; |
538 | else | 560 | else |
539 | rtc->max_user_freq = 128; | 561 | rtc->max_user_freq = 128; |
540 | 562 | ||
563 | if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) { | ||
564 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); | ||
565 | tmp |= S3C2443_RTCCON_TICSEL; | ||
566 | writew(tmp, s3c_rtc_base + S3C2410_RTCCON); | ||
567 | } | ||
568 | |||
541 | platform_set_drvdata(pdev, rtc); | 569 | platform_set_drvdata(pdev, rtc); |
542 | 570 | ||
543 | s3c_rtc_setfreq(&pdev->dev, 1); | 571 | s3c_rtc_setfreq(&pdev->dev, 1); |
@@ -638,8 +666,19 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
638 | 666 | ||
639 | #ifdef CONFIG_OF | 667 | #ifdef CONFIG_OF |
640 | static const struct of_device_id s3c_rtc_dt_match[] = { | 668 | static const struct of_device_id s3c_rtc_dt_match[] = { |
641 | { .compatible = "samsung,s3c2410-rtc" }, | 669 | { |
642 | { .compatible = "samsung,s3c6410-rtc" }, | 670 | .compatible = "samsung,s3c2410-rtc" |
671 | .data = TYPE_S3C2410, | ||
672 | }, { | ||
673 | .compatible = "samsung,s3c2416-rtc" | ||
674 | .data = TYPE_S3C2416, | ||
675 | }, { | ||
676 | .compatible = "samsung,s3c2443-rtc" | ||
677 | .data = TYPE_S3C2443, | ||
678 | }, { | ||
679 | .compatible = "samsung,s3c6410-rtc" | ||
680 | .data = TYPE_S3C64XX, | ||
681 | }, | ||
643 | {}, | 682 | {}, |
644 | }; | 683 | }; |
645 | MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match); | 684 | MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match); |
@@ -652,6 +691,12 @@ static struct platform_device_id s3c_rtc_driver_ids[] = { | |||
652 | .name = "s3c2410-rtc", | 691 | .name = "s3c2410-rtc", |
653 | .driver_data = TYPE_S3C2410, | 692 | .driver_data = TYPE_S3C2410, |
654 | }, { | 693 | }, { |
694 | .name = "s3c2416-rtc", | ||
695 | .driver_data = TYPE_S3C2416, | ||
696 | }, { | ||
697 | .name = "s3c2443-rtc", | ||
698 | .driver_data = TYPE_S3C2443, | ||
699 | }, { | ||
655 | .name = "s3c64xx-rtc", | 700 | .name = "s3c64xx-rtc", |
656 | .driver_data = TYPE_S3C64XX, | 701 | .driver_data = TYPE_S3C64XX, |
657 | }, | 702 | }, |
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index cb9a585312cc..e443b7850ede 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -23,94 +23,44 @@ | |||
23 | 23 | ||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/clk.h> | ||
26 | #include <linux/rtc.h> | 27 | #include <linux/rtc.h> |
27 | #include <linux/init.h> | 28 | #include <linux/init.h> |
28 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
29 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/slab.h> | ||
30 | #include <linux/string.h> | 32 | #include <linux/string.h> |
33 | #include <linux/of.h> | ||
31 | #include <linux/pm.h> | 34 | #include <linux/pm.h> |
32 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
33 | 36 | ||
34 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
35 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
36 | 39 | ||
37 | #ifdef CONFIG_ARCH_PXA | 40 | #if defined(CONFIG_ARCH_PXA) || defined(CONFIG_ARCH_MMP) |
38 | #include <mach/regs-rtc.h> | 41 | #include <mach/regs-rtc.h> |
39 | #endif | 42 | #endif |
40 | 43 | ||
41 | #define RTC_DEF_DIVIDER (32768 - 1) | 44 | #define RTC_DEF_DIVIDER (32768 - 1) |
42 | #define RTC_DEF_TRIM 0 | 45 | #define RTC_DEF_TRIM 0 |
43 | 46 | #define RTC_FREQ 1024 | |
44 | static const unsigned long RTC_FREQ = 1024; | 47 | |
45 | static struct rtc_time rtc_alarm; | 48 | struct sa1100_rtc { |
46 | static DEFINE_SPINLOCK(sa1100_rtc_lock); | 49 | spinlock_t lock; |
47 | 50 | int irq_1hz; | |
48 | static inline int rtc_periodic_alarm(struct rtc_time *tm) | 51 | int irq_alarm; |
49 | { | 52 | struct rtc_device *rtc; |
50 | return (tm->tm_year == -1) || | 53 | struct clk *clk; |
51 | ((unsigned)tm->tm_mon >= 12) || | 54 | }; |
52 | ((unsigned)(tm->tm_mday - 1) >= 31) || | ||
53 | ((unsigned)tm->tm_hour > 23) || | ||
54 | ((unsigned)tm->tm_min > 59) || | ||
55 | ((unsigned)tm->tm_sec > 59); | ||
56 | } | ||
57 | |||
58 | /* | ||
59 | * Calculate the next alarm time given the requested alarm time mask | ||
60 | * and the current time. | ||
61 | */ | ||
62 | static void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, | ||
63 | struct rtc_time *alrm) | ||
64 | { | ||
65 | unsigned long next_time; | ||
66 | unsigned long now_time; | ||
67 | |||
68 | next->tm_year = now->tm_year; | ||
69 | next->tm_mon = now->tm_mon; | ||
70 | next->tm_mday = now->tm_mday; | ||
71 | next->tm_hour = alrm->tm_hour; | ||
72 | next->tm_min = alrm->tm_min; | ||
73 | next->tm_sec = alrm->tm_sec; | ||
74 | |||
75 | rtc_tm_to_time(now, &now_time); | ||
76 | rtc_tm_to_time(next, &next_time); | ||
77 | |||
78 | if (next_time < now_time) { | ||
79 | /* Advance one day */ | ||
80 | next_time += 60 * 60 * 24; | ||
81 | rtc_time_to_tm(next_time, next); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | static int rtc_update_alarm(struct rtc_time *alrm) | ||
86 | { | ||
87 | struct rtc_time alarm_tm, now_tm; | ||
88 | unsigned long now, time; | ||
89 | int ret; | ||
90 | |||
91 | do { | ||
92 | now = RCNR; | ||
93 | rtc_time_to_tm(now, &now_tm); | ||
94 | rtc_next_alarm_time(&alarm_tm, &now_tm, alrm); | ||
95 | ret = rtc_tm_to_time(&alarm_tm, &time); | ||
96 | if (ret != 0) | ||
97 | break; | ||
98 | |||
99 | RTSR = RTSR & (RTSR_HZE|RTSR_ALE|RTSR_AL); | ||
100 | RTAR = time; | ||
101 | } while (now != RCNR); | ||
102 | |||
103 | return ret; | ||
104 | } | ||
105 | 55 | ||
106 | static irqreturn_t sa1100_rtc_interrupt(int irq, void *dev_id) | 56 | static irqreturn_t sa1100_rtc_interrupt(int irq, void *dev_id) |
107 | { | 57 | { |
108 | struct platform_device *pdev = to_platform_device(dev_id); | 58 | struct sa1100_rtc *info = dev_get_drvdata(dev_id); |
109 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 59 | struct rtc_device *rtc = info->rtc; |
110 | unsigned int rtsr; | 60 | unsigned int rtsr; |
111 | unsigned long events = 0; | 61 | unsigned long events = 0; |
112 | 62 | ||
113 | spin_lock(&sa1100_rtc_lock); | 63 | spin_lock(&info->lock); |
114 | 64 | ||
115 | rtsr = RTSR; | 65 | rtsr = RTSR; |
116 | /* clear interrupt sources */ | 66 | /* clear interrupt sources */ |
@@ -146,30 +96,30 @@ static irqreturn_t sa1100_rtc_interrupt(int irq, void *dev_id) | |||
146 | 96 | ||
147 | rtc_update_irq(rtc, 1, events); | 97 | rtc_update_irq(rtc, 1, events); |
148 | 98 | ||
149 | if (rtsr & RTSR_AL && rtc_periodic_alarm(&rtc_alarm)) | 99 | spin_unlock(&info->lock); |
150 | rtc_update_alarm(&rtc_alarm); | ||
151 | |||
152 | spin_unlock(&sa1100_rtc_lock); | ||
153 | 100 | ||
154 | return IRQ_HANDLED; | 101 | return IRQ_HANDLED; |
155 | } | 102 | } |
156 | 103 | ||
157 | static int sa1100_rtc_open(struct device *dev) | 104 | static int sa1100_rtc_open(struct device *dev) |
158 | { | 105 | { |
106 | struct sa1100_rtc *info = dev_get_drvdata(dev); | ||
107 | struct rtc_device *rtc = info->rtc; | ||
159 | int ret; | 108 | int ret; |
160 | struct platform_device *plat_dev = to_platform_device(dev); | ||
161 | struct rtc_device *rtc = platform_get_drvdata(plat_dev); | ||
162 | 109 | ||
163 | ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, IRQF_DISABLED, | 110 | ret = clk_prepare_enable(info->clk); |
111 | if (ret) | ||
112 | goto fail_clk; | ||
113 | ret = request_irq(info->irq_1hz, sa1100_rtc_interrupt, IRQF_DISABLED, | ||
164 | "rtc 1Hz", dev); | 114 | "rtc 1Hz", dev); |
165 | if (ret) { | 115 | if (ret) { |
166 | dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz); | 116 | dev_err(dev, "IRQ %d already in use.\n", info->irq_1hz); |
167 | goto fail_ui; | 117 | goto fail_ui; |
168 | } | 118 | } |
169 | ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, IRQF_DISABLED, | 119 | ret = request_irq(info->irq_alarm, sa1100_rtc_interrupt, IRQF_DISABLED, |
170 | "rtc Alrm", dev); | 120 | "rtc Alrm", dev); |
171 | if (ret) { | 121 | if (ret) { |
172 | dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm); | 122 | dev_err(dev, "IRQ %d already in use.\n", info->irq_alarm); |
173 | goto fail_ai; | 123 | goto fail_ai; |
174 | } | 124 | } |
175 | rtc->max_user_freq = RTC_FREQ; | 125 | rtc->max_user_freq = RTC_FREQ; |
@@ -178,29 +128,36 @@ static int sa1100_rtc_open(struct device *dev) | |||
178 | return 0; | 128 | return 0; |
179 | 129 | ||
180 | fail_ai: | 130 | fail_ai: |
181 | free_irq(IRQ_RTC1Hz, dev); | 131 | free_irq(info->irq_1hz, dev); |
182 | fail_ui: | 132 | fail_ui: |
133 | clk_disable_unprepare(info->clk); | ||
134 | fail_clk: | ||
183 | return ret; | 135 | return ret; |
184 | } | 136 | } |
185 | 137 | ||
186 | static void sa1100_rtc_release(struct device *dev) | 138 | static void sa1100_rtc_release(struct device *dev) |
187 | { | 139 | { |
188 | spin_lock_irq(&sa1100_rtc_lock); | 140 | struct sa1100_rtc *info = dev_get_drvdata(dev); |
141 | |||
142 | spin_lock_irq(&info->lock); | ||
189 | RTSR = 0; | 143 | RTSR = 0; |
190 | spin_unlock_irq(&sa1100_rtc_lock); | 144 | spin_unlock_irq(&info->lock); |
191 | 145 | ||
192 | free_irq(IRQ_RTCAlrm, dev); | 146 | free_irq(info->irq_alarm, dev); |
193 | free_irq(IRQ_RTC1Hz, dev); | 147 | free_irq(info->irq_1hz, dev); |
148 | clk_disable_unprepare(info->clk); | ||
194 | } | 149 | } |
195 | 150 | ||
196 | static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | 151 | static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
197 | { | 152 | { |
198 | spin_lock_irq(&sa1100_rtc_lock); | 153 | struct sa1100_rtc *info = dev_get_drvdata(dev); |
154 | |||
155 | spin_lock_irq(&info->lock); | ||
199 | if (enabled) | 156 | if (enabled) |
200 | RTSR |= RTSR_ALE; | 157 | RTSR |= RTSR_ALE; |
201 | else | 158 | else |
202 | RTSR &= ~RTSR_ALE; | 159 | RTSR &= ~RTSR_ALE; |
203 | spin_unlock_irq(&sa1100_rtc_lock); | 160 | spin_unlock_irq(&info->lock); |
204 | return 0; | 161 | return 0; |
205 | } | 162 | } |
206 | 163 | ||
@@ -225,7 +182,6 @@ static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
225 | { | 182 | { |
226 | u32 rtsr; | 183 | u32 rtsr; |
227 | 184 | ||
228 | memcpy(&alrm->time, &rtc_alarm, sizeof(struct rtc_time)); | ||
229 | rtsr = RTSR; | 185 | rtsr = RTSR; |
230 | alrm->enabled = (rtsr & RTSR_ALE) ? 1 : 0; | 186 | alrm->enabled = (rtsr & RTSR_ALE) ? 1 : 0; |
231 | alrm->pending = (rtsr & RTSR_AL) ? 1 : 0; | 187 | alrm->pending = (rtsr & RTSR_AL) ? 1 : 0; |
@@ -234,17 +190,22 @@ static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
234 | 190 | ||
235 | static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | 191 | static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
236 | { | 192 | { |
193 | struct sa1100_rtc *info = dev_get_drvdata(dev); | ||
194 | unsigned long time; | ||
237 | int ret; | 195 | int ret; |
238 | 196 | ||
239 | spin_lock_irq(&sa1100_rtc_lock); | 197 | spin_lock_irq(&info->lock); |
240 | ret = rtc_update_alarm(&alrm->time); | 198 | ret = rtc_tm_to_time(&alrm->time, &time); |
241 | if (ret == 0) { | 199 | if (ret != 0) |
242 | if (alrm->enabled) | 200 | goto out; |
243 | RTSR |= RTSR_ALE; | 201 | RTSR = RTSR & (RTSR_HZE|RTSR_ALE|RTSR_AL); |
244 | else | 202 | RTAR = time; |
245 | RTSR &= ~RTSR_ALE; | 203 | if (alrm->enabled) |
246 | } | 204 | RTSR |= RTSR_ALE; |
247 | spin_unlock_irq(&sa1100_rtc_lock); | 205 | else |
206 | RTSR &= ~RTSR_ALE; | ||
207 | out: | ||
208 | spin_unlock_irq(&info->lock); | ||
248 | 209 | ||
249 | return ret; | 210 | return ret; |
250 | } | 211 | } |
@@ -271,6 +232,27 @@ static const struct rtc_class_ops sa1100_rtc_ops = { | |||
271 | static int sa1100_rtc_probe(struct platform_device *pdev) | 232 | static int sa1100_rtc_probe(struct platform_device *pdev) |
272 | { | 233 | { |
273 | struct rtc_device *rtc; | 234 | struct rtc_device *rtc; |
235 | struct sa1100_rtc *info; | ||
236 | int irq_1hz, irq_alarm, ret = 0; | ||
237 | |||
238 | irq_1hz = platform_get_irq_byname(pdev, "rtc 1Hz"); | ||
239 | irq_alarm = platform_get_irq_byname(pdev, "rtc alarm"); | ||
240 | if (irq_1hz < 0 || irq_alarm < 0) | ||
241 | return -ENODEV; | ||
242 | |||
243 | info = kzalloc(sizeof(struct sa1100_rtc), GFP_KERNEL); | ||
244 | if (!info) | ||
245 | return -ENOMEM; | ||
246 | info->clk = clk_get(&pdev->dev, NULL); | ||
247 | if (IS_ERR(info->clk)) { | ||
248 | dev_err(&pdev->dev, "failed to find rtc clock source\n"); | ||
249 | ret = PTR_ERR(info->clk); | ||
250 | goto err_clk; | ||
251 | } | ||
252 | info->irq_1hz = irq_1hz; | ||
253 | info->irq_alarm = irq_alarm; | ||
254 | spin_lock_init(&info->lock); | ||
255 | platform_set_drvdata(pdev, info); | ||
274 | 256 | ||
275 | /* | 257 | /* |
276 | * According to the manual we should be able to let RTTR be zero | 258 | * According to the manual we should be able to let RTTR be zero |
@@ -292,10 +274,11 @@ static int sa1100_rtc_probe(struct platform_device *pdev) | |||
292 | rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops, | 274 | rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops, |
293 | THIS_MODULE); | 275 | THIS_MODULE); |
294 | 276 | ||
295 | if (IS_ERR(rtc)) | 277 | if (IS_ERR(rtc)) { |
296 | return PTR_ERR(rtc); | 278 | ret = PTR_ERR(rtc); |
297 | 279 | goto err_dev; | |
298 | platform_set_drvdata(pdev, rtc); | 280 | } |
281 | info->rtc = rtc; | ||
299 | 282 | ||
300 | /* Fix for a nasty initialization problem the in SA11xx RTSR register. | 283 | /* Fix for a nasty initialization problem the in SA11xx RTSR register. |
301 | * See also the comments in sa1100_rtc_interrupt(). | 284 | * See also the comments in sa1100_rtc_interrupt(). |
@@ -322,14 +305,24 @@ static int sa1100_rtc_probe(struct platform_device *pdev) | |||
322 | RTSR = RTSR_AL | RTSR_HZ; | 305 | RTSR = RTSR_AL | RTSR_HZ; |
323 | 306 | ||
324 | return 0; | 307 | return 0; |
308 | err_dev: | ||
309 | platform_set_drvdata(pdev, NULL); | ||
310 | clk_put(info->clk); | ||
311 | err_clk: | ||
312 | kfree(info); | ||
313 | return ret; | ||
325 | } | 314 | } |
326 | 315 | ||
327 | static int sa1100_rtc_remove(struct platform_device *pdev) | 316 | static int sa1100_rtc_remove(struct platform_device *pdev) |
328 | { | 317 | { |
329 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 318 | struct sa1100_rtc *info = platform_get_drvdata(pdev); |
330 | 319 | ||
331 | if (rtc) | 320 | if (info) { |
332 | rtc_device_unregister(rtc); | 321 | rtc_device_unregister(info->rtc); |
322 | clk_put(info->clk); | ||
323 | platform_set_drvdata(pdev, NULL); | ||
324 | kfree(info); | ||
325 | } | ||
333 | 326 | ||
334 | return 0; | 327 | return 0; |
335 | } | 328 | } |
@@ -337,15 +330,17 @@ static int sa1100_rtc_remove(struct platform_device *pdev) | |||
337 | #ifdef CONFIG_PM | 330 | #ifdef CONFIG_PM |
338 | static int sa1100_rtc_suspend(struct device *dev) | 331 | static int sa1100_rtc_suspend(struct device *dev) |
339 | { | 332 | { |
333 | struct sa1100_rtc *info = dev_get_drvdata(dev); | ||
340 | if (device_may_wakeup(dev)) | 334 | if (device_may_wakeup(dev)) |
341 | enable_irq_wake(IRQ_RTCAlrm); | 335 | enable_irq_wake(info->irq_alarm); |
342 | return 0; | 336 | return 0; |
343 | } | 337 | } |
344 | 338 | ||
345 | static int sa1100_rtc_resume(struct device *dev) | 339 | static int sa1100_rtc_resume(struct device *dev) |
346 | { | 340 | { |
341 | struct sa1100_rtc *info = dev_get_drvdata(dev); | ||
347 | if (device_may_wakeup(dev)) | 342 | if (device_may_wakeup(dev)) |
348 | disable_irq_wake(IRQ_RTCAlrm); | 343 | disable_irq_wake(info->irq_alarm); |
349 | return 0; | 344 | return 0; |
350 | } | 345 | } |
351 | 346 | ||
@@ -355,6 +350,13 @@ static const struct dev_pm_ops sa1100_rtc_pm_ops = { | |||
355 | }; | 350 | }; |
356 | #endif | 351 | #endif |
357 | 352 | ||
353 | static struct of_device_id sa1100_rtc_dt_ids[] = { | ||
354 | { .compatible = "mrvl,sa1100-rtc", }, | ||
355 | { .compatible = "mrvl,mmp-rtc", }, | ||
356 | {} | ||
357 | }; | ||
358 | MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids); | ||
359 | |||
358 | static struct platform_driver sa1100_rtc_driver = { | 360 | static struct platform_driver sa1100_rtc_driver = { |
359 | .probe = sa1100_rtc_probe, | 361 | .probe = sa1100_rtc_probe, |
360 | .remove = sa1100_rtc_remove, | 362 | .remove = sa1100_rtc_remove, |
@@ -363,6 +365,7 @@ static struct platform_driver sa1100_rtc_driver = { | |||
363 | #ifdef CONFIG_PM | 365 | #ifdef CONFIG_PM |
364 | .pm = &sa1100_rtc_pm_ops, | 366 | .pm = &sa1100_rtc_pm_ops, |
365 | #endif | 367 | #endif |
368 | .of_match_table = sa1100_rtc_dt_ids, | ||
366 | }, | 369 | }, |
367 | }; | 370 | }; |
368 | 371 | ||
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 0b7fed746b27..e7feceeebc2f 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -1508,7 +1508,7 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
1508 | ret = PTR_ERR(sport->clk); | 1508 | ret = PTR_ERR(sport->clk); |
1509 | goto unmap; | 1509 | goto unmap; |
1510 | } | 1510 | } |
1511 | clk_enable(sport->clk); | 1511 | clk_prepare_enable(sport->clk); |
1512 | 1512 | ||
1513 | sport->port.uartclk = clk_get_rate(sport->clk); | 1513 | sport->port.uartclk = clk_get_rate(sport->clk); |
1514 | 1514 | ||
@@ -1531,8 +1531,8 @@ deinit: | |||
1531 | if (pdata && pdata->exit) | 1531 | if (pdata && pdata->exit) |
1532 | pdata->exit(pdev); | 1532 | pdata->exit(pdev); |
1533 | clkput: | 1533 | clkput: |
1534 | clk_disable_unprepare(sport->clk); | ||
1534 | clk_put(sport->clk); | 1535 | clk_put(sport->clk); |
1535 | clk_disable(sport->clk); | ||
1536 | unmap: | 1536 | unmap: |
1537 | iounmap(sport->port.membase); | 1537 | iounmap(sport->port.membase); |
1538 | free: | 1538 | free: |
@@ -1552,11 +1552,10 @@ static int serial_imx_remove(struct platform_device *pdev) | |||
1552 | 1552 | ||
1553 | if (sport) { | 1553 | if (sport) { |
1554 | uart_remove_one_port(&imx_reg, &sport->port); | 1554 | uart_remove_one_port(&imx_reg, &sport->port); |
1555 | clk_disable_unprepare(sport->clk); | ||
1555 | clk_put(sport->clk); | 1556 | clk_put(sport->clk); |
1556 | } | 1557 | } |
1557 | 1558 | ||
1558 | clk_disable(sport->clk); | ||
1559 | |||
1560 | if (pdata && pdata->exit) | 1559 | if (pdata && pdata->exit) |
1561 | pdata->exit(pdev); | 1560 | pdata->exit(pdev); |
1562 | 1561 | ||
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 7ecb68a67411..85ae4b46bb68 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -137,7 +137,7 @@ choice | |||
137 | 137 | ||
138 | config USB_AT91 | 138 | config USB_AT91 |
139 | tristate "Atmel AT91 USB Device Port" | 139 | tristate "Atmel AT91 USB Device Port" |
140 | depends on ARCH_AT91 && !ARCH_AT91SAM9RL && !ARCH_AT91CAP9 && !ARCH_AT91SAM9G45 | 140 | depends on ARCH_AT91 && !ARCH_AT91SAM9RL && !ARCH_AT91SAM9G45 |
141 | help | 141 | help |
142 | Many Atmel AT91 processors (such as the AT91RM2000) have a | 142 | Many Atmel AT91 processors (such as the AT91RM2000) have a |
143 | full speed USB Device Port with support for five configurable | 143 | full speed USB Device Port with support for five configurable |
@@ -150,7 +150,7 @@ config USB_AT91 | |||
150 | config USB_ATMEL_USBA | 150 | config USB_ATMEL_USBA |
151 | tristate "Atmel USBA" | 151 | tristate "Atmel USBA" |
152 | select USB_GADGET_DUALSPEED | 152 | select USB_GADGET_DUALSPEED |
153 | depends on AVR32 || ARCH_AT91CAP9 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 | 153 | depends on AVR32 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 |
154 | help | 154 | help |
155 | USBA is the integrated high-speed USB Device controller on | 155 | USBA is the integrated high-speed USB Device controller on |
156 | the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel. | 156 | the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel. |
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index bd4272b61a14..ead4a4215797 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h | |||
@@ -9,99 +9,182 @@ | |||
9 | * representation into a hardware irq number that can be mapped back to a | 9 | * representation into a hardware irq number that can be mapped back to a |
10 | * Linux irq number without any extra platform support code. | 10 | * Linux irq number without any extra platform support code. |
11 | * | 11 | * |
12 | * irq_domain is expected to be embedded in an interrupt controller's private | 12 | * Interrupt controller "domain" data structure. This could be defined as a |
13 | * data structure. | 13 | * irq domain controller. That is, it handles the mapping between hardware |
14 | * and virtual interrupt numbers for a given interrupt domain. The domain | ||
15 | * structure is generally created by the PIC code for a given PIC instance | ||
16 | * (though a domain can cover more than one PIC if they have a flat number | ||
17 | * model). It's the domain callbacks that are responsible for setting the | ||
18 | * irq_chip on a given irq_desc after it's been mapped. | ||
19 | * | ||
20 | * The host code and data structures are agnostic to whether or not | ||
21 | * we use an open firmware device-tree. We do have references to struct | ||
22 | * device_node in two places: in irq_find_host() to find the host matching | ||
23 | * a given interrupt controller node, and of course as an argument to its | ||
24 | * counterpart domain->ops->match() callback. However, those are treated as | ||
25 | * generic pointers by the core and the fact that it's actually a device-node | ||
26 | * pointer is purely a convention between callers and implementation. This | ||
27 | * code could thus be used on other architectures by replacing those two | ||
28 | * by some sort of arch-specific void * "token" used to identify interrupt | ||
29 | * controllers. | ||
14 | */ | 30 | */ |
31 | |||
15 | #ifndef _LINUX_IRQDOMAIN_H | 32 | #ifndef _LINUX_IRQDOMAIN_H |
16 | #define _LINUX_IRQDOMAIN_H | 33 | #define _LINUX_IRQDOMAIN_H |
17 | 34 | ||
18 | #include <linux/irq.h> | 35 | #include <linux/types.h> |
19 | #include <linux/mod_devicetable.h> | 36 | #include <linux/radix-tree.h> |
20 | 37 | ||
21 | #ifdef CONFIG_IRQ_DOMAIN | ||
22 | struct device_node; | 38 | struct device_node; |
23 | struct irq_domain; | 39 | struct irq_domain; |
40 | struct of_device_id; | ||
41 | |||
42 | /* Number of irqs reserved for a legacy isa controller */ | ||
43 | #define NUM_ISA_INTERRUPTS 16 | ||
44 | |||
45 | /* This type is the placeholder for a hardware interrupt number. It has to | ||
46 | * be big enough to enclose whatever representation is used by a given | ||
47 | * platform. | ||
48 | */ | ||
49 | typedef unsigned long irq_hw_number_t; | ||
24 | 50 | ||
25 | /** | 51 | /** |
26 | * struct irq_domain_ops - Methods for irq_domain objects | 52 | * struct irq_domain_ops - Methods for irq_domain objects |
27 | * @to_irq: (optional) given a local hardware irq number, return the linux | 53 | * @match: Match an interrupt controller device node to a host, returns |
28 | * irq number. If to_irq is not implemented, then the irq_domain | 54 | * 1 on a match |
29 | * will use this translation: irq = (domain->irq_base + hwirq) | 55 | * @map: Create or update a mapping between a virtual irq number and a hw |
30 | * @dt_translate: Given a device tree node and interrupt specifier, decode | 56 | * irq number. This is called only once for a given mapping. |
31 | * the hardware irq number and linux irq type value. | 57 | * @unmap: Dispose of such a mapping |
58 | * @xlate: Given a device tree node and interrupt specifier, decode | ||
59 | * the hardware irq number and linux irq type value. | ||
60 | * | ||
61 | * Functions below are provided by the driver and called whenever a new mapping | ||
62 | * is created or an old mapping is disposed. The driver can then proceed to | ||
63 | * whatever internal data structures management is required. It also needs | ||
64 | * to setup the irq_desc when returning from map(). | ||
32 | */ | 65 | */ |
33 | struct irq_domain_ops { | 66 | struct irq_domain_ops { |
34 | unsigned int (*to_irq)(struct irq_domain *d, unsigned long hwirq); | 67 | int (*match)(struct irq_domain *d, struct device_node *node); |
35 | 68 | int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw); | |
36 | #ifdef CONFIG_OF | 69 | void (*unmap)(struct irq_domain *d, unsigned int virq); |
37 | int (*dt_translate)(struct irq_domain *d, struct device_node *node, | 70 | int (*xlate)(struct irq_domain *d, struct device_node *node, |
38 | const u32 *intspec, unsigned int intsize, | 71 | const u32 *intspec, unsigned int intsize, |
39 | unsigned long *out_hwirq, unsigned int *out_type); | 72 | unsigned long *out_hwirq, unsigned int *out_type); |
40 | #endif /* CONFIG_OF */ | ||
41 | }; | 73 | }; |
42 | 74 | ||
43 | /** | 75 | /** |
44 | * struct irq_domain - Hardware interrupt number translation object | 76 | * struct irq_domain - Hardware interrupt number translation object |
45 | * @list: Element in global irq_domain list. | 77 | * @link: Element in global irq_domain list. |
78 | * @revmap_type: Method used for reverse mapping hwirq numbers to linux irq. This | ||
79 | * will be one of the IRQ_DOMAIN_MAP_* values. | ||
80 | * @revmap_data: Revmap method specific data. | ||
81 | * @ops: pointer to irq_domain methods | ||
82 | * @host_data: private data pointer for use by owner. Not touched by irq_domain | ||
83 | * core code. | ||
46 | * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator | 84 | * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator |
47 | * of the irq_domain is responsible for allocating the array of | 85 | * of the irq_domain is responsible for allocating the array of |
48 | * irq_desc structures. | 86 | * irq_desc structures. |
49 | * @nr_irq: Number of irqs managed by the irq domain | 87 | * @nr_irq: Number of irqs managed by the irq domain |
50 | * @hwirq_base: Starting number for hwirqs managed by the irq domain | 88 | * @hwirq_base: Starting number for hwirqs managed by the irq domain |
51 | * @ops: pointer to irq_domain methods | ||
52 | * @priv: private data pointer for use by owner. Not touched by irq_domain | ||
53 | * core code. | ||
54 | * @of_node: (optional) Pointer to device tree nodes associated with the | 89 | * @of_node: (optional) Pointer to device tree nodes associated with the |
55 | * irq_domain. Used when decoding device tree interrupt specifiers. | 90 | * irq_domain. Used when decoding device tree interrupt specifiers. |
56 | */ | 91 | */ |
57 | struct irq_domain { | 92 | struct irq_domain { |
58 | struct list_head list; | 93 | struct list_head link; |
59 | unsigned int irq_base; | 94 | |
60 | unsigned int nr_irq; | 95 | /* type of reverse mapping_technique */ |
61 | unsigned int hwirq_base; | 96 | unsigned int revmap_type; |
97 | union { | ||
98 | struct { | ||
99 | unsigned int size; | ||
100 | unsigned int first_irq; | ||
101 | irq_hw_number_t first_hwirq; | ||
102 | } legacy; | ||
103 | struct { | ||
104 | unsigned int size; | ||
105 | unsigned int *revmap; | ||
106 | } linear; | ||
107 | struct radix_tree_root tree; | ||
108 | } revmap_data; | ||
62 | const struct irq_domain_ops *ops; | 109 | const struct irq_domain_ops *ops; |
63 | void *priv; | 110 | void *host_data; |
111 | irq_hw_number_t inval_irq; | ||
112 | |||
113 | /* Optional device node pointer */ | ||
64 | struct device_node *of_node; | 114 | struct device_node *of_node; |
65 | }; | 115 | }; |
66 | 116 | ||
67 | /** | 117 | #ifdef CONFIG_IRQ_DOMAIN |
68 | * irq_domain_to_irq() - Translate from a hardware irq to a linux irq number | 118 | struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, |
69 | * | 119 | unsigned int size, |
70 | * Returns the linux irq number associated with a hardware irq. By default, | 120 | unsigned int first_irq, |
71 | * the mapping is irq == domain->irq_base + hwirq, but this mapping can | 121 | irq_hw_number_t first_hwirq, |
72 | * be overridden if the irq_domain implements a .to_irq() hook. | 122 | const struct irq_domain_ops *ops, |
73 | */ | 123 | void *host_data); |
74 | static inline unsigned int irq_domain_to_irq(struct irq_domain *d, | 124 | struct irq_domain *irq_domain_add_linear(struct device_node *of_node, |
75 | unsigned long hwirq) | 125 | unsigned int size, |
126 | const struct irq_domain_ops *ops, | ||
127 | void *host_data); | ||
128 | struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, | ||
129 | const struct irq_domain_ops *ops, | ||
130 | void *host_data); | ||
131 | struct irq_domain *irq_domain_add_tree(struct device_node *of_node, | ||
132 | const struct irq_domain_ops *ops, | ||
133 | void *host_data); | ||
134 | |||
135 | extern struct irq_domain *irq_find_host(struct device_node *node); | ||
136 | extern void irq_set_default_host(struct irq_domain *host); | ||
137 | extern void irq_set_virq_count(unsigned int count); | ||
138 | |||
139 | static inline struct irq_domain *irq_domain_add_legacy_isa( | ||
140 | struct device_node *of_node, | ||
141 | const struct irq_domain_ops *ops, | ||
142 | void *host_data) | ||
76 | { | 143 | { |
77 | if (d->ops->to_irq) | 144 | return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, |
78 | return d->ops->to_irq(d, hwirq); | 145 | host_data); |
79 | if (WARN_ON(hwirq < d->hwirq_base)) | ||
80 | return 0; | ||
81 | return d->irq_base + hwirq - d->hwirq_base; | ||
82 | } | 146 | } |
147 | extern struct irq_domain *irq_find_host(struct device_node *node); | ||
148 | extern void irq_set_default_host(struct irq_domain *host); | ||
149 | extern void irq_set_virq_count(unsigned int count); | ||
83 | 150 | ||
84 | #define irq_domain_for_each_hwirq(d, hw) \ | ||
85 | for (hw = d->hwirq_base; hw < d->hwirq_base + d->nr_irq; hw++) | ||
86 | 151 | ||
87 | #define irq_domain_for_each_irq(d, hw, irq) \ | 152 | extern unsigned int irq_create_mapping(struct irq_domain *host, |
88 | for (hw = d->hwirq_base, irq = irq_domain_to_irq(d, hw); \ | 153 | irq_hw_number_t hwirq); |
89 | hw < d->hwirq_base + d->nr_irq; \ | 154 | extern void irq_dispose_mapping(unsigned int virq); |
90 | hw++, irq = irq_domain_to_irq(d, hw)) | 155 | extern unsigned int irq_find_mapping(struct irq_domain *host, |
156 | irq_hw_number_t hwirq); | ||
157 | extern unsigned int irq_create_direct_mapping(struct irq_domain *host); | ||
158 | extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq, | ||
159 | irq_hw_number_t hwirq); | ||
160 | extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host, | ||
161 | irq_hw_number_t hwirq); | ||
162 | extern unsigned int irq_linear_revmap(struct irq_domain *host, | ||
163 | irq_hw_number_t hwirq); | ||
91 | 164 | ||
92 | extern void irq_domain_add(struct irq_domain *domain); | 165 | extern const struct irq_domain_ops irq_domain_simple_ops; |
93 | extern void irq_domain_del(struct irq_domain *domain); | ||
94 | 166 | ||
95 | extern struct irq_domain_ops irq_domain_simple_ops; | 167 | /* stock xlate functions */ |
96 | #endif /* CONFIG_IRQ_DOMAIN */ | 168 | int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr, |
169 | const u32 *intspec, unsigned int intsize, | ||
170 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
171 | int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr, | ||
172 | const u32 *intspec, unsigned int intsize, | ||
173 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
174 | int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr, | ||
175 | const u32 *intspec, unsigned int intsize, | ||
176 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
97 | 177 | ||
98 | #if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) | 178 | #if defined(CONFIG_OF_IRQ) |
99 | extern void irq_domain_add_simple(struct device_node *controller, int irq_base); | ||
100 | extern void irq_domain_generate_simple(const struct of_device_id *match, | 179 | extern void irq_domain_generate_simple(const struct of_device_id *match, |
101 | u64 phys_base, unsigned int irq_start); | 180 | u64 phys_base, unsigned int irq_start); |
102 | #else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ | 181 | #else /* CONFIG_OF_IRQ */ |
103 | static inline void irq_domain_generate_simple(const struct of_device_id *match, | 182 | static inline void irq_domain_generate_simple(const struct of_device_id *match, |
104 | u64 phys_base, unsigned int irq_start) { } | 183 | u64 phys_base, unsigned int irq_start) { } |
105 | #endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ | 184 | #endif /* !CONFIG_OF_IRQ */ |
185 | |||
186 | #else /* CONFIG_IRQ_DOMAIN */ | ||
187 | static inline void irq_dispose_mapping(unsigned int virq) { } | ||
188 | #endif /* !CONFIG_IRQ_DOMAIN */ | ||
106 | 189 | ||
107 | #endif /* _LINUX_IRQDOMAIN_H */ | 190 | #endif /* _LINUX_IRQDOMAIN_H */ |
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 3118623c2c1f..01b925ad8d78 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/errno.h> | 4 | #include <linux/errno.h> |
5 | #include <linux/of.h> | 5 | #include <linux/of.h> |
6 | 6 | ||
7 | #ifdef CONFIG_OF_ADDRESS | ||
7 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); | 8 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); |
8 | extern int of_address_to_resource(struct device_node *dev, int index, | 9 | extern int of_address_to_resource(struct device_node *dev, int index, |
9 | struct resource *r); | 10 | struct resource *r); |
@@ -25,12 +26,37 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } | |||
25 | #define pci_address_to_pio pci_address_to_pio | 26 | #define pci_address_to_pio pci_address_to_pio |
26 | #endif | 27 | #endif |
27 | 28 | ||
28 | #ifdef CONFIG_PCI | 29 | #else /* CONFIG_OF_ADDRESS */ |
30 | static inline int of_address_to_resource(struct device_node *dev, int index, | ||
31 | struct resource *r) | ||
32 | { | ||
33 | return -EINVAL; | ||
34 | } | ||
35 | static inline struct device_node *of_find_matching_node_by_address( | ||
36 | struct device_node *from, | ||
37 | const struct of_device_id *matches, | ||
38 | u64 base_address) | ||
39 | { | ||
40 | return NULL; | ||
41 | } | ||
42 | static inline void __iomem *of_iomap(struct device_node *device, int index) | ||
43 | { | ||
44 | return NULL; | ||
45 | } | ||
46 | static inline const u32 *of_get_address(struct device_node *dev, int index, | ||
47 | u64 *size, unsigned int *flags) | ||
48 | { | ||
49 | return NULL; | ||
50 | } | ||
51 | #endif /* CONFIG_OF_ADDRESS */ | ||
52 | |||
53 | |||
54 | #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) | ||
29 | extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, | 55 | extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, |
30 | u64 *size, unsigned int *flags); | 56 | u64 *size, unsigned int *flags); |
31 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | 57 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, |
32 | struct resource *r); | 58 | struct resource *r); |
33 | #else /* CONFIG_PCI */ | 59 | #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
34 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, | 60 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, |
35 | struct resource *r) | 61 | struct resource *r) |
36 | { | 62 | { |
@@ -42,8 +68,7 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev, | |||
42 | { | 68 | { |
43 | return NULL; | 69 | return NULL; |
44 | } | 70 | } |
45 | #endif /* CONFIG_PCI */ | 71 | #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
46 | |||
47 | 72 | ||
48 | #endif /* __OF_ADDRESS_H */ | 73 | #endif /* __OF_ADDRESS_H */ |
49 | 74 | ||
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index d0307eed20c9..d229ad3edee0 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h | |||
@@ -6,6 +6,7 @@ struct of_irq; | |||
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/errno.h> | 7 | #include <linux/errno.h> |
8 | #include <linux/irq.h> | 8 | #include <linux/irq.h> |
9 | #include <linux/irqdomain.h> | ||
9 | #include <linux/ioport.h> | 10 | #include <linux/ioport.h> |
10 | #include <linux/of.h> | 11 | #include <linux/of.h> |
11 | 12 | ||
@@ -65,9 +66,6 @@ extern int of_irq_map_one(struct device_node *device, int index, | |||
65 | extern unsigned int irq_create_of_mapping(struct device_node *controller, | 66 | extern unsigned int irq_create_of_mapping(struct device_node *controller, |
66 | const u32 *intspec, | 67 | const u32 *intspec, |
67 | unsigned int intsize); | 68 | unsigned int intsize); |
68 | #ifdef CONFIG_IRQ_DOMAIN | ||
69 | extern void irq_dispose_mapping(unsigned int irq); | ||
70 | #endif | ||
71 | extern int of_irq_to_resource(struct device_node *dev, int index, | 69 | extern int of_irq_to_resource(struct device_node *dev, int index, |
72 | struct resource *r); | 70 | struct resource *r); |
73 | extern int of_irq_count(struct device_node *dev); | 71 | extern int of_irq_count(struct device_node *dev); |
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 040ce2f6e8de..242fa3563e2e 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h | |||
@@ -81,7 +81,7 @@ extern struct platform_device *of_device_alloc(struct device_node *np, | |||
81 | struct device *parent); | 81 | struct device *parent); |
82 | extern struct platform_device *of_find_device_by_node(struct device_node *np); | 82 | extern struct platform_device *of_find_device_by_node(struct device_node *np); |
83 | 83 | ||
84 | #if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ | 84 | #ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */ |
85 | /* Platform devices and busses creation */ | 85 | /* Platform devices and busses creation */ |
86 | extern struct platform_device *of_platform_device_create(struct device_node *np, | 86 | extern struct platform_device *of_platform_device_create(struct device_node *np, |
87 | const char *bus_id, | 87 | const char *bus_id, |
@@ -94,7 +94,15 @@ extern int of_platform_populate(struct device_node *root, | |||
94 | const struct of_device_id *matches, | 94 | const struct of_device_id *matches, |
95 | const struct of_dev_auxdata *lookup, | 95 | const struct of_dev_auxdata *lookup, |
96 | struct device *parent); | 96 | struct device *parent); |
97 | #endif /* !CONFIG_SPARC */ | 97 | #else |
98 | static inline int of_platform_populate(struct device_node *root, | ||
99 | const struct of_device_id *matches, | ||
100 | const struct of_dev_auxdata *lookup, | ||
101 | struct device *parent) | ||
102 | { | ||
103 | return -ENODEV; | ||
104 | } | ||
105 | #endif /* !CONFIG_OF_ADDRESS */ | ||
98 | 106 | ||
99 | #endif /* CONFIG_OF_DEVICE */ | 107 | #endif /* CONFIG_OF_DEVICE */ |
100 | 108 | ||
diff --git a/include/linux/platform_data/tegra_emc.h b/include/linux/platform_data/tegra_emc.h new file mode 100644 index 000000000000..df67505e98f8 --- /dev/null +++ b/include/linux/platform_data/tegra_emc.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Google, Inc. | ||
3 | * | ||
4 | * Author: | ||
5 | * Colin Cross <ccross@android.com> | ||
6 | * Olof Johansson <olof@lixom.net> | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
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 | */ | ||
18 | |||
19 | #ifndef __TEGRA_EMC_H_ | ||
20 | #define __TEGRA_EMC_H_ | ||
21 | |||
22 | #define TEGRA_EMC_NUM_REGS 46 | ||
23 | |||
24 | struct tegra_emc_table { | ||
25 | unsigned long rate; | ||
26 | u32 regs[TEGRA_EMC_NUM_REGS]; | ||
27 | }; | ||
28 | |||
29 | struct tegra_emc_pdata { | ||
30 | int num_tables; | ||
31 | struct tegra_emc_table *tables; | ||
32 | }; | ||
33 | |||
34 | #endif | ||
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h deleted file mode 100644 index a6d014005d49..000000000000 --- a/include/linux/regulator/bq24022.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater) | ||
3 | * 1-Cell Li-Ion Charger connected via GPIOs. | ||
4 | * | ||
5 | * Copyright (c) 2008 Philipp Zabel | ||
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 version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | struct regulator_init_data; | ||
14 | |||
15 | /** | ||
16 | * bq24022_mach_info - platform data for bq24022 | ||
17 | * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging | ||
18 | * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA | ||
19 | */ | ||
20 | struct bq24022_mach_info { | ||
21 | int gpio_nce; | ||
22 | int gpio_iset2; | ||
23 | struct regulator_init_data *init_data; | ||
24 | }; | ||
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 1f9e26526b69..af48e59bc2ff 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
@@ -1,189 +1,793 @@ | |||
1 | #include <linux/debugfs.h> | ||
2 | #include <linux/hardirq.h> | ||
3 | #include <linux/interrupt.h> | ||
1 | #include <linux/irq.h> | 4 | #include <linux/irq.h> |
5 | #include <linux/irqdesc.h> | ||
2 | #include <linux/irqdomain.h> | 6 | #include <linux/irqdomain.h> |
3 | #include <linux/module.h> | 7 | #include <linux/module.h> |
4 | #include <linux/mutex.h> | 8 | #include <linux/mutex.h> |
5 | #include <linux/of.h> | 9 | #include <linux/of.h> |
6 | #include <linux/of_address.h> | 10 | #include <linux/of_address.h> |
11 | #include <linux/seq_file.h> | ||
7 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/smp.h> | ||
14 | #include <linux/fs.h> | ||
15 | |||
16 | #define IRQ_DOMAIN_MAP_LEGACY 0 /* driver allocated fixed range of irqs. | ||
17 | * ie. legacy 8259, gets irqs 1..15 */ | ||
18 | #define IRQ_DOMAIN_MAP_NOMAP 1 /* no fast reverse mapping */ | ||
19 | #define IRQ_DOMAIN_MAP_LINEAR 2 /* linear map of interrupts */ | ||
20 | #define IRQ_DOMAIN_MAP_TREE 3 /* radix tree */ | ||
8 | 21 | ||
9 | static LIST_HEAD(irq_domain_list); | 22 | static LIST_HEAD(irq_domain_list); |
10 | static DEFINE_MUTEX(irq_domain_mutex); | 23 | static DEFINE_MUTEX(irq_domain_mutex); |
11 | 24 | ||
25 | static DEFINE_MUTEX(revmap_trees_mutex); | ||
26 | static unsigned int irq_virq_count = NR_IRQS; | ||
27 | static struct irq_domain *irq_default_domain; | ||
28 | |||
12 | /** | 29 | /** |
13 | * irq_domain_add() - Register an irq_domain | 30 | * irq_domain_alloc() - Allocate a new irq_domain data structure |
14 | * @domain: ptr to initialized irq_domain structure | 31 | * @of_node: optional device-tree node of the interrupt controller |
32 | * @revmap_type: type of reverse mapping to use | ||
33 | * @ops: map/unmap domain callbacks | ||
34 | * @host_data: Controller private data pointer | ||
15 | * | 35 | * |
16 | * Registers an irq_domain structure. The irq_domain must at a minimum be | 36 | * Allocates and initialize and irq_domain structure. Caller is expected to |
17 | * initialized with an ops structure pointer, and either a ->to_irq hook or | 37 | * register allocated irq_domain with irq_domain_register(). Returns pointer |
18 | * a valid irq_base value. Everything else is optional. | 38 | * to IRQ domain, or NULL on failure. |
19 | */ | 39 | */ |
20 | void irq_domain_add(struct irq_domain *domain) | 40 | static struct irq_domain *irq_domain_alloc(struct device_node *of_node, |
41 | unsigned int revmap_type, | ||
42 | const struct irq_domain_ops *ops, | ||
43 | void *host_data) | ||
21 | { | 44 | { |
22 | struct irq_data *d; | 45 | struct irq_domain *domain; |
23 | int hwirq, irq; | ||
24 | 46 | ||
25 | /* | 47 | domain = kzalloc(sizeof(*domain), GFP_KERNEL); |
26 | * This assumes that the irq_domain owner has already allocated | 48 | if (WARN_ON(!domain)) |
27 | * the irq_descs. This block will be removed when support for dynamic | 49 | return NULL; |
28 | * allocation of irq_descs is added to irq_domain. | 50 | |
29 | */ | 51 | /* Fill structure */ |
30 | irq_domain_for_each_irq(domain, hwirq, irq) { | 52 | domain->revmap_type = revmap_type; |
31 | d = irq_get_irq_data(irq); | 53 | domain->ops = ops; |
32 | if (!d) { | 54 | domain->host_data = host_data; |
33 | WARN(1, "error: assigning domain to non existant irq_desc"); | 55 | domain->of_node = of_node_get(of_node); |
34 | return; | 56 | |
35 | } | 57 | return domain; |
36 | if (d->domain) { | 58 | } |
37 | /* things are broken; just report, don't clean up */ | 59 | |
38 | WARN(1, "error: irq_desc already assigned to a domain"); | 60 | static void irq_domain_add(struct irq_domain *domain) |
39 | return; | 61 | { |
62 | mutex_lock(&irq_domain_mutex); | ||
63 | list_add(&domain->link, &irq_domain_list); | ||
64 | mutex_unlock(&irq_domain_mutex); | ||
65 | pr_debug("irq: Allocated domain of type %d @0x%p\n", | ||
66 | domain->revmap_type, domain); | ||
67 | } | ||
68 | |||
69 | static unsigned int irq_domain_legacy_revmap(struct irq_domain *domain, | ||
70 | irq_hw_number_t hwirq) | ||
71 | { | ||
72 | irq_hw_number_t first_hwirq = domain->revmap_data.legacy.first_hwirq; | ||
73 | int size = domain->revmap_data.legacy.size; | ||
74 | |||
75 | if (WARN_ON(hwirq < first_hwirq || hwirq >= first_hwirq + size)) | ||
76 | return 0; | ||
77 | return hwirq - first_hwirq + domain->revmap_data.legacy.first_irq; | ||
78 | } | ||
79 | |||
80 | /** | ||
81 | * irq_domain_add_legacy() - Allocate and register a legacy revmap irq_domain. | ||
82 | * @of_node: pointer to interrupt controller's device tree node. | ||
83 | * @size: total number of irqs in legacy mapping | ||
84 | * @first_irq: first number of irq block assigned to the domain | ||
85 | * @first_hwirq: first hwirq number to use for the translation. Should normally | ||
86 | * be '0', but a positive integer can be used if the effective | ||
87 | * hwirqs numbering does not begin at zero. | ||
88 | * @ops: map/unmap domain callbacks | ||
89 | * @host_data: Controller private data pointer | ||
90 | * | ||
91 | * Note: the map() callback will be called before this function returns | ||
92 | * for all legacy interrupts except 0 (which is always the invalid irq for | ||
93 | * a legacy controller). | ||
94 | */ | ||
95 | struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, | ||
96 | unsigned int size, | ||
97 | unsigned int first_irq, | ||
98 | irq_hw_number_t first_hwirq, | ||
99 | const struct irq_domain_ops *ops, | ||
100 | void *host_data) | ||
101 | { | ||
102 | struct irq_domain *domain; | ||
103 | unsigned int i; | ||
104 | |||
105 | domain = irq_domain_alloc(of_node, IRQ_DOMAIN_MAP_LEGACY, ops, host_data); | ||
106 | if (!domain) | ||
107 | return NULL; | ||
108 | |||
109 | domain->revmap_data.legacy.first_irq = first_irq; | ||
110 | domain->revmap_data.legacy.first_hwirq = first_hwirq; | ||
111 | domain->revmap_data.legacy.size = size; | ||
112 | |||
113 | mutex_lock(&irq_domain_mutex); | ||
114 | /* Verify that all the irqs are available */ | ||
115 | for (i = 0; i < size; i++) { | ||
116 | int irq = first_irq + i; | ||
117 | struct irq_data *irq_data = irq_get_irq_data(irq); | ||
118 | |||
119 | if (WARN_ON(!irq_data || irq_data->domain)) { | ||
120 | mutex_unlock(&irq_domain_mutex); | ||
121 | of_node_put(domain->of_node); | ||
122 | kfree(domain); | ||
123 | return NULL; | ||
40 | } | 124 | } |
41 | d->domain = domain; | ||
42 | d->hwirq = hwirq; | ||
43 | } | 125 | } |
44 | 126 | ||
45 | mutex_lock(&irq_domain_mutex); | 127 | /* Claim all of the irqs before registering a legacy domain */ |
46 | list_add(&domain->list, &irq_domain_list); | 128 | for (i = 0; i < size; i++) { |
129 | struct irq_data *irq_data = irq_get_irq_data(first_irq + i); | ||
130 | irq_data->hwirq = first_hwirq + i; | ||
131 | irq_data->domain = domain; | ||
132 | } | ||
47 | mutex_unlock(&irq_domain_mutex); | 133 | mutex_unlock(&irq_domain_mutex); |
134 | |||
135 | for (i = 0; i < size; i++) { | ||
136 | int irq = first_irq + i; | ||
137 | int hwirq = first_hwirq + i; | ||
138 | |||
139 | /* IRQ0 gets ignored */ | ||
140 | if (!irq) | ||
141 | continue; | ||
142 | |||
143 | /* Legacy flags are left to default at this point, | ||
144 | * one can then use irq_create_mapping() to | ||
145 | * explicitly change them | ||
146 | */ | ||
147 | ops->map(domain, irq, hwirq); | ||
148 | |||
149 | /* Clear norequest flags */ | ||
150 | irq_clear_status_flags(irq, IRQ_NOREQUEST); | ||
151 | } | ||
152 | |||
153 | irq_domain_add(domain); | ||
154 | return domain; | ||
155 | } | ||
156 | |||
157 | /** | ||
158 | * irq_domain_add_linear() - Allocate and register a legacy revmap irq_domain. | ||
159 | * @of_node: pointer to interrupt controller's device tree node. | ||
160 | * @ops: map/unmap domain callbacks | ||
161 | * @host_data: Controller private data pointer | ||
162 | */ | ||
163 | struct irq_domain *irq_domain_add_linear(struct device_node *of_node, | ||
164 | unsigned int size, | ||
165 | const struct irq_domain_ops *ops, | ||
166 | void *host_data) | ||
167 | { | ||
168 | struct irq_domain *domain; | ||
169 | unsigned int *revmap; | ||
170 | |||
171 | revmap = kzalloc(sizeof(*revmap) * size, GFP_KERNEL); | ||
172 | if (WARN_ON(!revmap)) | ||
173 | return NULL; | ||
174 | |||
175 | domain = irq_domain_alloc(of_node, IRQ_DOMAIN_MAP_LINEAR, ops, host_data); | ||
176 | if (!domain) { | ||
177 | kfree(revmap); | ||
178 | return NULL; | ||
179 | } | ||
180 | domain->revmap_data.linear.size = size; | ||
181 | domain->revmap_data.linear.revmap = revmap; | ||
182 | irq_domain_add(domain); | ||
183 | return domain; | ||
184 | } | ||
185 | |||
186 | struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, | ||
187 | const struct irq_domain_ops *ops, | ||
188 | void *host_data) | ||
189 | { | ||
190 | struct irq_domain *domain = irq_domain_alloc(of_node, | ||
191 | IRQ_DOMAIN_MAP_NOMAP, ops, host_data); | ||
192 | if (domain) | ||
193 | irq_domain_add(domain); | ||
194 | return domain; | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * irq_domain_add_tree() | ||
199 | * @of_node: pointer to interrupt controller's device tree node. | ||
200 | * @ops: map/unmap domain callbacks | ||
201 | * | ||
202 | * Note: The radix tree will be allocated later during boot automatically | ||
203 | * (the reverse mapping will use the slow path until that happens). | ||
204 | */ | ||
205 | struct irq_domain *irq_domain_add_tree(struct device_node *of_node, | ||
206 | const struct irq_domain_ops *ops, | ||
207 | void *host_data) | ||
208 | { | ||
209 | struct irq_domain *domain = irq_domain_alloc(of_node, | ||
210 | IRQ_DOMAIN_MAP_TREE, ops, host_data); | ||
211 | if (domain) { | ||
212 | INIT_RADIX_TREE(&domain->revmap_data.tree, GFP_KERNEL); | ||
213 | irq_domain_add(domain); | ||
214 | } | ||
215 | return domain; | ||
48 | } | 216 | } |
49 | 217 | ||
50 | /** | 218 | /** |
51 | * irq_domain_del() - Unregister an irq_domain | 219 | * irq_find_host() - Locates a domain for a given device node |
52 | * @domain: ptr to registered irq_domain. | 220 | * @node: device-tree node of the interrupt controller |
53 | */ | 221 | */ |
54 | void irq_domain_del(struct irq_domain *domain) | 222 | struct irq_domain *irq_find_host(struct device_node *node) |
55 | { | 223 | { |
56 | struct irq_data *d; | 224 | struct irq_domain *h, *found = NULL; |
57 | int hwirq, irq; | 225 | int rc; |
58 | 226 | ||
227 | /* We might want to match the legacy controller last since | ||
228 | * it might potentially be set to match all interrupts in | ||
229 | * the absence of a device node. This isn't a problem so far | ||
230 | * yet though... | ||
231 | */ | ||
59 | mutex_lock(&irq_domain_mutex); | 232 | mutex_lock(&irq_domain_mutex); |
60 | list_del(&domain->list); | 233 | list_for_each_entry(h, &irq_domain_list, link) { |
234 | if (h->ops->match) | ||
235 | rc = h->ops->match(h, node); | ||
236 | else | ||
237 | rc = (h->of_node != NULL) && (h->of_node == node); | ||
238 | |||
239 | if (rc) { | ||
240 | found = h; | ||
241 | break; | ||
242 | } | ||
243 | } | ||
61 | mutex_unlock(&irq_domain_mutex); | 244 | mutex_unlock(&irq_domain_mutex); |
245 | return found; | ||
246 | } | ||
247 | EXPORT_SYMBOL_GPL(irq_find_host); | ||
248 | |||
249 | /** | ||
250 | * irq_set_default_host() - Set a "default" irq domain | ||
251 | * @domain: default domain pointer | ||
252 | * | ||
253 | * For convenience, it's possible to set a "default" domain that will be used | ||
254 | * whenever NULL is passed to irq_create_mapping(). It makes life easier for | ||
255 | * platforms that want to manipulate a few hard coded interrupt numbers that | ||
256 | * aren't properly represented in the device-tree. | ||
257 | */ | ||
258 | void irq_set_default_host(struct irq_domain *domain) | ||
259 | { | ||
260 | pr_debug("irq: Default domain set to @0x%p\n", domain); | ||
261 | |||
262 | irq_default_domain = domain; | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * irq_set_virq_count() - Set the maximum number of linux irqs | ||
267 | * @count: number of linux irqs, capped with NR_IRQS | ||
268 | * | ||
269 | * This is mainly for use by platforms like iSeries who want to program | ||
270 | * the virtual irq number in the controller to avoid the reverse mapping | ||
271 | */ | ||
272 | void irq_set_virq_count(unsigned int count) | ||
273 | { | ||
274 | pr_debug("irq: Trying to set virq count to %d\n", count); | ||
62 | 275 | ||
63 | /* Clear the irq_domain assignments */ | 276 | BUG_ON(count < NUM_ISA_INTERRUPTS); |
64 | irq_domain_for_each_irq(domain, hwirq, irq) { | 277 | if (count < NR_IRQS) |
65 | d = irq_get_irq_data(irq); | 278 | irq_virq_count = count; |
66 | d->domain = NULL; | 279 | } |
280 | |||
281 | static int irq_setup_virq(struct irq_domain *domain, unsigned int virq, | ||
282 | irq_hw_number_t hwirq) | ||
283 | { | ||
284 | struct irq_data *irq_data = irq_get_irq_data(virq); | ||
285 | |||
286 | irq_data->hwirq = hwirq; | ||
287 | irq_data->domain = domain; | ||
288 | if (domain->ops->map(domain, virq, hwirq)) { | ||
289 | pr_debug("irq: -> mapping failed, freeing\n"); | ||
290 | irq_data->domain = NULL; | ||
291 | irq_data->hwirq = 0; | ||
292 | return -1; | ||
67 | } | 293 | } |
294 | |||
295 | irq_clear_status_flags(virq, IRQ_NOREQUEST); | ||
296 | |||
297 | return 0; | ||
68 | } | 298 | } |
69 | 299 | ||
70 | #if defined(CONFIG_OF_IRQ) | ||
71 | /** | 300 | /** |
72 | * irq_create_of_mapping() - Map a linux irq number from a DT interrupt spec | 301 | * irq_create_direct_mapping() - Allocate an irq for direct mapping |
302 | * @domain: domain to allocate the irq for or NULL for default domain | ||
73 | * | 303 | * |
74 | * Used by the device tree interrupt mapping code to translate a device tree | 304 | * This routine is used for irq controllers which can choose the hardware |
75 | * interrupt specifier to a valid linux irq number. Returns either a valid | 305 | * interrupt numbers they generate. In such a case it's simplest to use |
76 | * linux IRQ number or 0. | 306 | * the linux irq as the hardware interrupt number. |
307 | */ | ||
308 | unsigned int irq_create_direct_mapping(struct irq_domain *domain) | ||
309 | { | ||
310 | unsigned int virq; | ||
311 | |||
312 | if (domain == NULL) | ||
313 | domain = irq_default_domain; | ||
314 | |||
315 | BUG_ON(domain == NULL); | ||
316 | WARN_ON(domain->revmap_type != IRQ_DOMAIN_MAP_NOMAP); | ||
317 | |||
318 | virq = irq_alloc_desc_from(1, 0); | ||
319 | if (!virq) { | ||
320 | pr_debug("irq: create_direct virq allocation failed\n"); | ||
321 | return 0; | ||
322 | } | ||
323 | if (virq >= irq_virq_count) { | ||
324 | pr_err("ERROR: no free irqs available below %i maximum\n", | ||
325 | irq_virq_count); | ||
326 | irq_free_desc(virq); | ||
327 | return 0; | ||
328 | } | ||
329 | |||
330 | pr_debug("irq: create_direct obtained virq %d\n", virq); | ||
331 | |||
332 | if (irq_setup_virq(domain, virq, virq)) { | ||
333 | irq_free_desc(virq); | ||
334 | return 0; | ||
335 | } | ||
336 | |||
337 | return virq; | ||
338 | } | ||
339 | |||
340 | /** | ||
341 | * irq_create_mapping() - Map a hardware interrupt into linux irq space | ||
342 | * @domain: domain owning this hardware interrupt or NULL for default domain | ||
343 | * @hwirq: hardware irq number in that domain space | ||
77 | * | 344 | * |
78 | * When the caller no longer need the irq number returned by this function it | 345 | * Only one mapping per hardware interrupt is permitted. Returns a linux |
79 | * should arrange to call irq_dispose_mapping(). | 346 | * irq number. |
347 | * If the sense/trigger is to be specified, set_irq_type() should be called | ||
348 | * on the number returned from that call. | ||
80 | */ | 349 | */ |
350 | unsigned int irq_create_mapping(struct irq_domain *domain, | ||
351 | irq_hw_number_t hwirq) | ||
352 | { | ||
353 | unsigned int virq, hint; | ||
354 | |||
355 | pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq); | ||
356 | |||
357 | /* Look for default domain if nececssary */ | ||
358 | if (domain == NULL) | ||
359 | domain = irq_default_domain; | ||
360 | if (domain == NULL) { | ||
361 | printk(KERN_WARNING "irq_create_mapping called for" | ||
362 | " NULL domain, hwirq=%lx\n", hwirq); | ||
363 | WARN_ON(1); | ||
364 | return 0; | ||
365 | } | ||
366 | pr_debug("irq: -> using domain @%p\n", domain); | ||
367 | |||
368 | /* Check if mapping already exists */ | ||
369 | virq = irq_find_mapping(domain, hwirq); | ||
370 | if (virq) { | ||
371 | pr_debug("irq: -> existing mapping on virq %d\n", virq); | ||
372 | return virq; | ||
373 | } | ||
374 | |||
375 | /* Get a virtual interrupt number */ | ||
376 | if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) | ||
377 | return irq_domain_legacy_revmap(domain, hwirq); | ||
378 | |||
379 | /* Allocate a virtual interrupt number */ | ||
380 | hint = hwirq % irq_virq_count; | ||
381 | if (hint == 0) | ||
382 | hint++; | ||
383 | virq = irq_alloc_desc_from(hint, 0); | ||
384 | if (!virq) | ||
385 | virq = irq_alloc_desc_from(1, 0); | ||
386 | if (!virq) { | ||
387 | pr_debug("irq: -> virq allocation failed\n"); | ||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | if (irq_setup_virq(domain, virq, hwirq)) { | ||
392 | if (domain->revmap_type != IRQ_DOMAIN_MAP_LEGACY) | ||
393 | irq_free_desc(virq); | ||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | pr_debug("irq: irq %lu on domain %s mapped to virtual irq %u\n", | ||
398 | hwirq, domain->of_node ? domain->of_node->full_name : "null", virq); | ||
399 | |||
400 | return virq; | ||
401 | } | ||
402 | EXPORT_SYMBOL_GPL(irq_create_mapping); | ||
403 | |||
81 | unsigned int irq_create_of_mapping(struct device_node *controller, | 404 | unsigned int irq_create_of_mapping(struct device_node *controller, |
82 | const u32 *intspec, unsigned int intsize) | 405 | const u32 *intspec, unsigned int intsize) |
83 | { | 406 | { |
84 | struct irq_domain *domain; | 407 | struct irq_domain *domain; |
85 | unsigned long hwirq; | 408 | irq_hw_number_t hwirq; |
86 | unsigned int irq, type; | 409 | unsigned int type = IRQ_TYPE_NONE; |
87 | int rc = -EINVAL; | 410 | unsigned int virq; |
88 | 411 | ||
89 | /* Find a domain which can translate the irq spec */ | 412 | domain = controller ? irq_find_host(controller) : irq_default_domain; |
90 | mutex_lock(&irq_domain_mutex); | 413 | if (!domain) { |
91 | list_for_each_entry(domain, &irq_domain_list, list) { | 414 | #ifdef CONFIG_MIPS |
92 | if (!domain->ops->dt_translate) | 415 | /* |
93 | continue; | 416 | * Workaround to avoid breaking interrupt controller drivers |
94 | rc = domain->ops->dt_translate(domain, controller, | 417 | * that don't yet register an irq_domain. This is temporary |
95 | intspec, intsize, &hwirq, &type); | 418 | * code. ~~~gcl, Feb 24, 2012 |
96 | if (rc == 0) | 419 | * |
97 | break; | 420 | * Scheduled for removal in Linux v3.6. That should be enough |
421 | * time. | ||
422 | */ | ||
423 | if (intsize > 0) | ||
424 | return intspec[0]; | ||
425 | #endif | ||
426 | printk(KERN_WARNING "irq: no irq domain found for %s !\n", | ||
427 | controller->full_name); | ||
428 | return 0; | ||
98 | } | 429 | } |
99 | mutex_unlock(&irq_domain_mutex); | ||
100 | 430 | ||
101 | if (rc != 0) | 431 | /* If domain has no translation, then we assume interrupt line */ |
102 | return 0; | 432 | if (domain->ops->xlate == NULL) |
433 | hwirq = intspec[0]; | ||
434 | else { | ||
435 | if (domain->ops->xlate(domain, controller, intspec, intsize, | ||
436 | &hwirq, &type)) | ||
437 | return 0; | ||
438 | } | ||
439 | |||
440 | /* Create mapping */ | ||
441 | virq = irq_create_mapping(domain, hwirq); | ||
442 | if (!virq) | ||
443 | return virq; | ||
103 | 444 | ||
104 | irq = irq_domain_to_irq(domain, hwirq); | 445 | /* Set type if specified and different than the current one */ |
105 | if (type != IRQ_TYPE_NONE) | 446 | if (type != IRQ_TYPE_NONE && |
106 | irq_set_irq_type(irq, type); | 447 | type != (irqd_get_trigger_type(irq_get_irq_data(virq)))) |
107 | pr_debug("%s: mapped hwirq=%i to irq=%i, flags=%x\n", | 448 | irq_set_irq_type(virq, type); |
108 | controller->full_name, (int)hwirq, irq, type); | 449 | return virq; |
109 | return irq; | ||
110 | } | 450 | } |
111 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | 451 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); |
112 | 452 | ||
113 | /** | 453 | /** |
114 | * irq_dispose_mapping() - Discard a mapping created by irq_create_of_mapping() | 454 | * irq_dispose_mapping() - Unmap an interrupt |
115 | * @irq: linux irq number to be discarded | 455 | * @virq: linux irq number of the interrupt to unmap |
456 | */ | ||
457 | void irq_dispose_mapping(unsigned int virq) | ||
458 | { | ||
459 | struct irq_data *irq_data = irq_get_irq_data(virq); | ||
460 | struct irq_domain *domain; | ||
461 | irq_hw_number_t hwirq; | ||
462 | |||
463 | if (!virq || !irq_data) | ||
464 | return; | ||
465 | |||
466 | domain = irq_data->domain; | ||
467 | if (WARN_ON(domain == NULL)) | ||
468 | return; | ||
469 | |||
470 | /* Never unmap legacy interrupts */ | ||
471 | if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) | ||
472 | return; | ||
473 | |||
474 | irq_set_status_flags(virq, IRQ_NOREQUEST); | ||
475 | |||
476 | /* remove chip and handler */ | ||
477 | irq_set_chip_and_handler(virq, NULL, NULL); | ||
478 | |||
479 | /* Make sure it's completed */ | ||
480 | synchronize_irq(virq); | ||
481 | |||
482 | /* Tell the PIC about it */ | ||
483 | if (domain->ops->unmap) | ||
484 | domain->ops->unmap(domain, virq); | ||
485 | smp_mb(); | ||
486 | |||
487 | /* Clear reverse map */ | ||
488 | hwirq = irq_data->hwirq; | ||
489 | switch(domain->revmap_type) { | ||
490 | case IRQ_DOMAIN_MAP_LINEAR: | ||
491 | if (hwirq < domain->revmap_data.linear.size) | ||
492 | domain->revmap_data.linear.revmap[hwirq] = 0; | ||
493 | break; | ||
494 | case IRQ_DOMAIN_MAP_TREE: | ||
495 | mutex_lock(&revmap_trees_mutex); | ||
496 | radix_tree_delete(&domain->revmap_data.tree, hwirq); | ||
497 | mutex_unlock(&revmap_trees_mutex); | ||
498 | break; | ||
499 | } | ||
500 | |||
501 | irq_free_desc(virq); | ||
502 | } | ||
503 | EXPORT_SYMBOL_GPL(irq_dispose_mapping); | ||
504 | |||
505 | /** | ||
506 | * irq_find_mapping() - Find a linux irq from an hw irq number. | ||
507 | * @domain: domain owning this hardware interrupt | ||
508 | * @hwirq: hardware irq number in that domain space | ||
509 | * | ||
510 | * This is a slow path, for use by generic code. It's expected that an | ||
511 | * irq controller implementation directly calls the appropriate low level | ||
512 | * mapping function. | ||
513 | */ | ||
514 | unsigned int irq_find_mapping(struct irq_domain *domain, | ||
515 | irq_hw_number_t hwirq) | ||
516 | { | ||
517 | unsigned int i; | ||
518 | unsigned int hint = hwirq % irq_virq_count; | ||
519 | |||
520 | /* Look for default domain if nececssary */ | ||
521 | if (domain == NULL) | ||
522 | domain = irq_default_domain; | ||
523 | if (domain == NULL) | ||
524 | return 0; | ||
525 | |||
526 | /* legacy -> bail early */ | ||
527 | if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) | ||
528 | return irq_domain_legacy_revmap(domain, hwirq); | ||
529 | |||
530 | /* Slow path does a linear search of the map */ | ||
531 | if (hint == 0) | ||
532 | hint = 1; | ||
533 | i = hint; | ||
534 | do { | ||
535 | struct irq_data *data = irq_get_irq_data(i); | ||
536 | if (data && (data->domain == domain) && (data->hwirq == hwirq)) | ||
537 | return i; | ||
538 | i++; | ||
539 | if (i >= irq_virq_count) | ||
540 | i = 1; | ||
541 | } while(i != hint); | ||
542 | return 0; | ||
543 | } | ||
544 | EXPORT_SYMBOL_GPL(irq_find_mapping); | ||
545 | |||
546 | /** | ||
547 | * irq_radix_revmap_lookup() - Find a linux irq from a hw irq number. | ||
548 | * @domain: domain owning this hardware interrupt | ||
549 | * @hwirq: hardware irq number in that domain space | ||
116 | * | 550 | * |
117 | * Calling this function indicates the caller no longer needs a reference to | 551 | * This is a fast path, for use by irq controller code that uses radix tree |
118 | * the linux irq number returned by a prior call to irq_create_of_mapping(). | 552 | * revmaps |
119 | */ | 553 | */ |
120 | void irq_dispose_mapping(unsigned int irq) | 554 | unsigned int irq_radix_revmap_lookup(struct irq_domain *domain, |
555 | irq_hw_number_t hwirq) | ||
121 | { | 556 | { |
557 | struct irq_data *irq_data; | ||
558 | |||
559 | if (WARN_ON_ONCE(domain->revmap_type != IRQ_DOMAIN_MAP_TREE)) | ||
560 | return irq_find_mapping(domain, hwirq); | ||
561 | |||
562 | /* | ||
563 | * Freeing an irq can delete nodes along the path to | ||
564 | * do the lookup via call_rcu. | ||
565 | */ | ||
566 | rcu_read_lock(); | ||
567 | irq_data = radix_tree_lookup(&domain->revmap_data.tree, hwirq); | ||
568 | rcu_read_unlock(); | ||
569 | |||
122 | /* | 570 | /* |
123 | * nothing yet; will be filled when support for dynamic allocation of | 571 | * If found in radix tree, then fine. |
124 | * irq_descs is added to irq_domain | 572 | * Else fallback to linear lookup - this should not happen in practice |
573 | * as it means that we failed to insert the node in the radix tree. | ||
125 | */ | 574 | */ |
575 | return irq_data ? irq_data->irq : irq_find_mapping(domain, hwirq); | ||
126 | } | 576 | } |
127 | EXPORT_SYMBOL_GPL(irq_dispose_mapping); | ||
128 | 577 | ||
129 | int irq_domain_simple_dt_translate(struct irq_domain *d, | 578 | /** |
130 | struct device_node *controller, | 579 | * irq_radix_revmap_insert() - Insert a hw irq to linux irq number mapping. |
131 | const u32 *intspec, unsigned int intsize, | 580 | * @domain: domain owning this hardware interrupt |
132 | unsigned long *out_hwirq, unsigned int *out_type) | 581 | * @virq: linux irq number |
582 | * @hwirq: hardware irq number in that domain space | ||
583 | * | ||
584 | * This is for use by irq controllers that use a radix tree reverse | ||
585 | * mapping for fast lookup. | ||
586 | */ | ||
587 | void irq_radix_revmap_insert(struct irq_domain *domain, unsigned int virq, | ||
588 | irq_hw_number_t hwirq) | ||
133 | { | 589 | { |
134 | if (d->of_node != controller) | 590 | struct irq_data *irq_data = irq_get_irq_data(virq); |
135 | return -EINVAL; | 591 | |
136 | if (intsize < 1) | 592 | if (WARN_ON(domain->revmap_type != IRQ_DOMAIN_MAP_TREE)) |
137 | return -EINVAL; | 593 | return; |
138 | if (d->nr_irq && ((intspec[0] < d->hwirq_base) || | 594 | |
139 | (intspec[0] >= d->hwirq_base + d->nr_irq))) | 595 | if (virq) { |
140 | return -EINVAL; | 596 | mutex_lock(&revmap_trees_mutex); |
597 | radix_tree_insert(&domain->revmap_data.tree, hwirq, irq_data); | ||
598 | mutex_unlock(&revmap_trees_mutex); | ||
599 | } | ||
600 | } | ||
601 | |||
602 | /** | ||
603 | * irq_linear_revmap() - Find a linux irq from a hw irq number. | ||
604 | * @domain: domain owning this hardware interrupt | ||
605 | * @hwirq: hardware irq number in that domain space | ||
606 | * | ||
607 | * This is a fast path, for use by irq controller code that uses linear | ||
608 | * revmaps. It does fallback to the slow path if the revmap doesn't exist | ||
609 | * yet and will create the revmap entry with appropriate locking | ||
610 | */ | ||
611 | unsigned int irq_linear_revmap(struct irq_domain *domain, | ||
612 | irq_hw_number_t hwirq) | ||
613 | { | ||
614 | unsigned int *revmap; | ||
615 | |||
616 | if (WARN_ON_ONCE(domain->revmap_type != IRQ_DOMAIN_MAP_LINEAR)) | ||
617 | return irq_find_mapping(domain, hwirq); | ||
618 | |||
619 | /* Check revmap bounds */ | ||
620 | if (unlikely(hwirq >= domain->revmap_data.linear.size)) | ||
621 | return irq_find_mapping(domain, hwirq); | ||
622 | |||
623 | /* Check if revmap was allocated */ | ||
624 | revmap = domain->revmap_data.linear.revmap; | ||
625 | if (unlikely(revmap == NULL)) | ||
626 | return irq_find_mapping(domain, hwirq); | ||
627 | |||
628 | /* Fill up revmap with slow path if no mapping found */ | ||
629 | if (unlikely(!revmap[hwirq])) | ||
630 | revmap[hwirq] = irq_find_mapping(domain, hwirq); | ||
631 | |||
632 | return revmap[hwirq]; | ||
633 | } | ||
634 | |||
635 | #ifdef CONFIG_VIRQ_DEBUG | ||
636 | static int virq_debug_show(struct seq_file *m, void *private) | ||
637 | { | ||
638 | unsigned long flags; | ||
639 | struct irq_desc *desc; | ||
640 | const char *p; | ||
641 | static const char none[] = "none"; | ||
642 | void *data; | ||
643 | int i; | ||
644 | |||
645 | seq_printf(m, "%-5s %-7s %-15s %-18s %s\n", "virq", "hwirq", | ||
646 | "chip name", "chip data", "domain name"); | ||
647 | |||
648 | for (i = 1; i < nr_irqs; i++) { | ||
649 | desc = irq_to_desc(i); | ||
650 | if (!desc) | ||
651 | continue; | ||
652 | |||
653 | raw_spin_lock_irqsave(&desc->lock, flags); | ||
654 | |||
655 | if (desc->action && desc->action->handler) { | ||
656 | struct irq_chip *chip; | ||
657 | |||
658 | seq_printf(m, "%5d ", i); | ||
659 | seq_printf(m, "0x%05lx ", desc->irq_data.hwirq); | ||
660 | |||
661 | chip = irq_desc_get_chip(desc); | ||
662 | if (chip && chip->name) | ||
663 | p = chip->name; | ||
664 | else | ||
665 | p = none; | ||
666 | seq_printf(m, "%-15s ", p); | ||
667 | |||
668 | data = irq_desc_get_chip_data(desc); | ||
669 | seq_printf(m, "0x%16p ", data); | ||
670 | |||
671 | if (desc->irq_data.domain->of_node) | ||
672 | p = desc->irq_data.domain->of_node->full_name; | ||
673 | else | ||
674 | p = none; | ||
675 | seq_printf(m, "%s\n", p); | ||
676 | } | ||
677 | |||
678 | raw_spin_unlock_irqrestore(&desc->lock, flags); | ||
679 | } | ||
680 | |||
681 | return 0; | ||
682 | } | ||
141 | 683 | ||
684 | static int virq_debug_open(struct inode *inode, struct file *file) | ||
685 | { | ||
686 | return single_open(file, virq_debug_show, inode->i_private); | ||
687 | } | ||
688 | |||
689 | static const struct file_operations virq_debug_fops = { | ||
690 | .open = virq_debug_open, | ||
691 | .read = seq_read, | ||
692 | .llseek = seq_lseek, | ||
693 | .release = single_release, | ||
694 | }; | ||
695 | |||
696 | static int __init irq_debugfs_init(void) | ||
697 | { | ||
698 | if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root, | ||
699 | NULL, &virq_debug_fops) == NULL) | ||
700 | return -ENOMEM; | ||
701 | |||
702 | return 0; | ||
703 | } | ||
704 | __initcall(irq_debugfs_init); | ||
705 | #endif /* CONFIG_VIRQ_DEBUG */ | ||
706 | |||
707 | int irq_domain_simple_map(struct irq_domain *d, unsigned int irq, | ||
708 | irq_hw_number_t hwirq) | ||
709 | { | ||
710 | return 0; | ||
711 | } | ||
712 | |||
713 | /** | ||
714 | * irq_domain_xlate_onecell() - Generic xlate for direct one cell bindings | ||
715 | * | ||
716 | * Device Tree IRQ specifier translation function which works with one cell | ||
717 | * bindings where the cell value maps directly to the hwirq number. | ||
718 | */ | ||
719 | int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr, | ||
720 | const u32 *intspec, unsigned int intsize, | ||
721 | unsigned long *out_hwirq, unsigned int *out_type) | ||
722 | { | ||
723 | if (WARN_ON(intsize < 1)) | ||
724 | return -EINVAL; | ||
142 | *out_hwirq = intspec[0]; | 725 | *out_hwirq = intspec[0]; |
143 | *out_type = IRQ_TYPE_NONE; | 726 | *out_type = IRQ_TYPE_NONE; |
144 | if (intsize > 1) | ||
145 | *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; | ||
146 | return 0; | 727 | return 0; |
147 | } | 728 | } |
729 | EXPORT_SYMBOL_GPL(irq_domain_xlate_onecell); | ||
148 | 730 | ||
149 | /** | 731 | /** |
150 | * irq_domain_create_simple() - Set up a 'simple' translation range | 732 | * irq_domain_xlate_twocell() - Generic xlate for direct two cell bindings |
733 | * | ||
734 | * Device Tree IRQ specifier translation function which works with two cell | ||
735 | * bindings where the cell values map directly to the hwirq number | ||
736 | * and linux irq flags. | ||
151 | */ | 737 | */ |
152 | void irq_domain_add_simple(struct device_node *controller, int irq_base) | 738 | int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr, |
739 | const u32 *intspec, unsigned int intsize, | ||
740 | irq_hw_number_t *out_hwirq, unsigned int *out_type) | ||
153 | { | 741 | { |
154 | struct irq_domain *domain; | 742 | if (WARN_ON(intsize < 2)) |
155 | 743 | return -EINVAL; | |
156 | domain = kzalloc(sizeof(*domain), GFP_KERNEL); | 744 | *out_hwirq = intspec[0]; |
157 | if (!domain) { | 745 | *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; |
158 | WARN_ON(1); | 746 | return 0; |
159 | return; | 747 | } |
160 | } | 748 | EXPORT_SYMBOL_GPL(irq_domain_xlate_twocell); |
161 | 749 | ||
162 | domain->irq_base = irq_base; | 750 | /** |
163 | domain->of_node = of_node_get(controller); | 751 | * irq_domain_xlate_onetwocell() - Generic xlate for one or two cell bindings |
164 | domain->ops = &irq_domain_simple_ops; | 752 | * |
165 | irq_domain_add(domain); | 753 | * Device Tree IRQ specifier translation function which works with either one |
754 | * or two cell bindings where the cell values map directly to the hwirq number | ||
755 | * and linux irq flags. | ||
756 | * | ||
757 | * Note: don't use this function unless your interrupt controller explicitly | ||
758 | * supports both one and two cell bindings. For the majority of controllers | ||
759 | * the _onecell() or _twocell() variants above should be used. | ||
760 | */ | ||
761 | int irq_domain_xlate_onetwocell(struct irq_domain *d, | ||
762 | struct device_node *ctrlr, | ||
763 | const u32 *intspec, unsigned int intsize, | ||
764 | unsigned long *out_hwirq, unsigned int *out_type) | ||
765 | { | ||
766 | if (WARN_ON(intsize < 1)) | ||
767 | return -EINVAL; | ||
768 | *out_hwirq = intspec[0]; | ||
769 | *out_type = (intsize > 1) ? intspec[1] : IRQ_TYPE_NONE; | ||
770 | return 0; | ||
166 | } | 771 | } |
167 | EXPORT_SYMBOL_GPL(irq_domain_add_simple); | 772 | EXPORT_SYMBOL_GPL(irq_domain_xlate_onetwocell); |
168 | 773 | ||
774 | const struct irq_domain_ops irq_domain_simple_ops = { | ||
775 | .map = irq_domain_simple_map, | ||
776 | .xlate = irq_domain_xlate_onetwocell, | ||
777 | }; | ||
778 | EXPORT_SYMBOL_GPL(irq_domain_simple_ops); | ||
779 | |||
780 | #ifdef CONFIG_OF_IRQ | ||
169 | void irq_domain_generate_simple(const struct of_device_id *match, | 781 | void irq_domain_generate_simple(const struct of_device_id *match, |
170 | u64 phys_base, unsigned int irq_start) | 782 | u64 phys_base, unsigned int irq_start) |
171 | { | 783 | { |
172 | struct device_node *node; | 784 | struct device_node *node; |
173 | pr_info("looking for phys_base=%llx, irq_start=%i\n", | 785 | pr_debug("looking for phys_base=%llx, irq_start=%i\n", |
174 | (unsigned long long) phys_base, (int) irq_start); | 786 | (unsigned long long) phys_base, (int) irq_start); |
175 | node = of_find_matching_node_by_address(NULL, match, phys_base); | 787 | node = of_find_matching_node_by_address(NULL, match, phys_base); |
176 | if (node) | 788 | if (node) |
177 | irq_domain_add_simple(node, irq_start); | 789 | irq_domain_add_legacy(node, 32, irq_start, 0, |
178 | else | 790 | &irq_domain_simple_ops, NULL); |
179 | pr_info("no node found\n"); | ||
180 | } | 791 | } |
181 | EXPORT_SYMBOL_GPL(irq_domain_generate_simple); | 792 | EXPORT_SYMBOL_GPL(irq_domain_generate_simple); |
182 | #endif /* CONFIG_OF_IRQ */ | 793 | #endif |
183 | |||
184 | struct irq_domain_ops irq_domain_simple_ops = { | ||
185 | #ifdef CONFIG_OF_IRQ | ||
186 | .dt_translate = irq_domain_simple_dt_translate, | ||
187 | #endif /* CONFIG_OF_IRQ */ | ||
188 | }; | ||
189 | EXPORT_SYMBOL_GPL(irq_domain_simple_ops); | ||