Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull "ARM: driver specific updates" from Arnd Bergmann:
"These are all specific to some driver. They are typically the
platform side of a change in the drivers directory, such as adding a
new driver or extending the interface to the platform. In cases where
there is no maintainer for the driver, or the maintainer prefers to
have the platform changes in the same branch as the driver changes,
the patches to the drivers are included as well.

A much smaller set of driver updates that depend on other branches
getting merged first will be sent later.

The new export of tegra_chip_uid conflicts with other changes in
fuse.c. In rtc-sa1100.c, the global removal of IRQF_DISABLED
conflicts with the cleanup of the interrupt handling of that driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>"

Fixed up aforementioned trivial conflicts.

* tag 'drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (94 commits)
ARM: SAMSUNG: change the name from s3c-sdhci to exynos4-sdhci
mmc: sdhci-s3c: add platform data for the second capability
ARM: SAMSUNG: support the second capability for samsung-soc
ARM: EXYNOS: add support DMA for EXYNOS4X12 SoC
ARM: EXYNOS: Add apb_pclk clkdev entry for mdma1
ARM: EXYNOS: Enable MDMA driver
regulator: Remove bq24022 regulator driver
rtc: sa1100: add OF support
pxa: magician/hx4700: Convert to gpio-regulator from bq24022
ARM: OMAP3+: SmartReflex: fix error handling
ARM: OMAP3+: SmartReflex: fix the use of debugfs_create_* API
ARM: OMAP3+: SmartReflex: micro-optimization for sanity check
ARM: OMAP3+: SmartReflex: misc cleanups
ARM: OMAP3+: SmartReflex: move late_initcall() closer to its argument
ARM: OMAP3+: SmartReflex: add missing platform_set_drvdata()
ARM: OMAP3+: hwmod: add SmartReflex IRQs
ARM: OMAP3+: SmartReflex: clear ERRCONFIG_VPBOUNDINTST only on a need
ARM: OMAP3+: SmartReflex: Fix status masking in ERRCONFIG register
ARM: OMAP3+: SmartReflex: Add a shutdown hook
ARM: OMAP3+: SmartReflex Class3: disable errorgen before disable VP
...

Conflicts:
arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/fuse.c
drivers/rtc/rtc-sa1100.c

+3077 -732
+100
Documentation/devicetree/bindings/arm/tegra/emc.txt
··· 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 + };
+19
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt
··· 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 + };
+30
Documentation/devicetree/bindings/dma/tegra20-apbdma.txt
··· 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 + };
+34 -2
Documentation/devicetree/bindings/gpio/gpio_nvidia.txt
··· 1 - NVIDIA Tegra 2 GPIO controller 1 + NVIDIA Tegra GPIO controller 2 2 3 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 9 - #gpio-cells : Should be two. The first cell is the pin number and the 6 10 second cell is used to specify optional parameters: 7 11 - bit 0 specifies polarity (0 for normal, 1 for inverted) 8 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 + };
+1 -1
arch/arm/Kconfig
··· 760 760 select ARCH_HAS_CPUFREQ 761 761 select CPU_FREQ 762 762 select GENERIC_CLOCKEVENTS 763 - select HAVE_CLK 763 + select CLKDEV_LOOKUP 764 764 select HAVE_SCHED_CLOCK 765 765 select TICK_ONESHOT 766 766 select ARCH_REQUIRE_GPIOLIB
+3 -3
arch/arm/Kconfig.debug
··· 180 180 Say Y here if you want kernel low-level debugging support 181 181 on i.MX50 or i.MX53. 182 182 183 - config DEBUG_IMX6Q_UART 184 - bool "i.MX6Q Debug UART" 183 + config DEBUG_IMX6Q_UART4 184 + bool "i.MX6Q Debug UART4" 185 185 depends on SOC_IMX6Q 186 186 help 187 187 Say Y here if you want kernel low-level debugging support 188 - on i.MX6Q. 188 + on i.MX6Q UART4. 189 189 190 190 config DEBUG_MSM_UART1 191 191 bool "Kernel low-level debugging messages via MSM UART1"
+35 -10
arch/arm/boot/dts/tegra-harmony.dts
··· 10 10 reg = < 0x00000000 0x40000000 >; 11 11 }; 12 12 13 + pmc@7000f400 { 14 + nvidia,invert-interrupt; 15 + }; 16 + 13 17 i2c@7000c000 { 14 18 clock-frequency = <400000>; 15 19 16 - codec: wm8903@1a { 20 + wm8903: wm8903@1a { 17 21 compatible = "wlf,wm8903"; 18 22 reg = <0x1a>; 19 - interrupts = < 347 >; 23 + interrupt-parent = <&gpio>; 24 + interrupts = < 187 0x04 >; 20 25 21 26 gpio-controller; 22 27 #gpio-cells = <2>; 23 28 24 - /* 0x8000 = Not configured */ 25 - gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >; 29 + micdet-cfg = <0>; 30 + micdet-delay = <100>; 31 + gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >; 26 32 }; 27 33 }; 28 34 ··· 44 38 clock-frequency = <400000>; 45 39 }; 46 40 47 - sound { 48 - compatible = "nvidia,harmony-sound", "nvidia,tegra-wm8903"; 41 + i2s@70002a00 { 42 + status = "disable"; 43 + }; 49 44 50 - spkr-en-gpios = <&codec 2 0>; 51 - hp-det-gpios = <&gpio 178 0>; 52 - int-mic-en-gpios = <&gpio 184 0>; 53 - ext-mic-en-gpios = <&gpio 185 0>; 45 + sound { 46 + compatible = "nvidia,tegra-audio-wm8903-harmony", 47 + "nvidia,tegra-audio-wm8903"; 48 + nvidia,model = "NVIDIA Tegra Harmony"; 49 + 50 + nvidia,audio-routing = 51 + "Headphone Jack", "HPOUTR", 52 + "Headphone Jack", "HPOUTL", 53 + "Int Spk", "ROP", 54 + "Int Spk", "RON", 55 + "Int Spk", "LOP", 56 + "Int Spk", "LON", 57 + "Mic Jack", "MICBIAS", 58 + "IN1L", "Mic Jack"; 59 + 60 + nvidia,i2s-controller = <&tegra_i2s1>; 61 + nvidia,audio-codec = <&wm8903>; 62 + 63 + nvidia,spkr-en-gpios = <&wm8903 2 0>; 64 + nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 65 + nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */ 66 + nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ 54 67 }; 55 68 56 69 serial@70006000 {
+30
arch/arm/boot/dts/tegra-paz00.dts
··· 12 12 13 13 i2c@7000c000 { 14 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 24 i2c@7000c400 { ··· 47 40 compatible = "adi,adt7461"; 48 41 reg = <0x4c>; 49 42 }; 43 + }; 44 + 45 + i2s@70002a00 { 46 + status = "disable"; 47 + }; 48 + 49 + sound { 50 + compatible = "nvidia,tegra-audio-alc5632-paz00", 51 + "nvidia,tegra-audio-alc5632"; 52 + 53 + nvidia,model = "Compal PAZ00"; 54 + 55 + nvidia,audio-routing = 56 + "Int Spk", "SPKOUT", 57 + "Int Spk", "SPKOUTN", 58 + "Headset Mic", "MICBIAS1", 59 + "MIC1", "Headset Mic", 60 + "Headset Stereophone", "HPR", 61 + "Headset Stereophone", "HPL"; 62 + 63 + nvidia,audio-codec = <&alc5632>; 64 + nvidia,i2s-controller = <&tegra_i2s1>; 65 + nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 50 66 }; 51 67 52 68 serial@70006000 {
+78
arch/arm/boot/dts/tegra-seaboard.dts
··· 13 13 14 14 i2c@7000c000 { 15 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 32 i2c@7000c400 { ··· 44 30 compatible = "adt7461"; 45 31 reg = <0x4c>; 46 32 }; 33 + }; 34 + 35 + i2s@70002a00 { 36 + status = "disable"; 37 + }; 38 + 39 + sound { 40 + compatible = "nvidia,tegra-audio-wm8903-seaboard", 41 + "nvidia,tegra-audio-wm8903"; 42 + nvidia,model = "NVIDIA Tegra Seaboard"; 43 + 44 + nvidia,audio-routing = 45 + "Headphone Jack", "HPOUTR", 46 + "Headphone Jack", "HPOUTL", 47 + "Int Spk", "ROP", 48 + "Int Spk", "RON", 49 + "Int Spk", "LOP", 50 + "Int Spk", "LON", 51 + "Mic Jack", "MICBIAS", 52 + "IN1R", "Mic Jack"; 53 + 54 + nvidia,i2s-controller = <&tegra_i2s1>; 55 + nvidia,audio-codec = <&wm8903>; 56 + 57 + nvidia,spkr-en-gpios = <&wm8903 2 0>; 58 + nvidia,hp-det-gpios = <&gpio 185 0>; /* gpio PX1 */ 47 59 }; 48 60 49 61 serial@70006000 { ··· 131 91 linux,code = <0>; /* SW_LID */ 132 92 debounce-interval = <1>; 133 93 gpio-key,wakeup; 94 + }; 95 + }; 96 + 97 + emc@7000f400 { 98 + emc-table@190000 { 99 + reg = < 190000 >; 100 + compatible = "nvidia,tegra20-emc-table"; 101 + clock-frequency = < 190000 >; 102 + nvidia,emc-registers = < 0x0000000c 0x00000026 103 + 0x00000009 0x00000003 0x00000004 0x00000004 104 + 0x00000002 0x0000000c 0x00000003 0x00000003 105 + 0x00000002 0x00000001 0x00000004 0x00000005 106 + 0x00000004 0x00000009 0x0000000d 0x0000059f 107 + 0x00000000 0x00000003 0x00000003 0x00000003 108 + 0x00000003 0x00000001 0x0000000b 0x000000c8 109 + 0x00000003 0x00000007 0x00000004 0x0000000f 110 + 0x00000002 0x00000000 0x00000000 0x00000002 111 + 0x00000000 0x00000000 0x00000083 0xa06204ae 112 + 0x007dc010 0x00000000 0x00000000 0x00000000 113 + 0x00000000 0x00000000 0x00000000 0x00000000 >; 114 + }; 115 + 116 + emc-table@380000 { 117 + reg = < 380000 >; 118 + compatible = "nvidia,tegra20-emc-table"; 119 + clock-frequency = < 380000 >; 120 + nvidia,emc-registers = < 0x00000017 0x0000004b 121 + 0x00000012 0x00000006 0x00000004 0x00000005 122 + 0x00000003 0x0000000c 0x00000006 0x00000006 123 + 0x00000003 0x00000001 0x00000004 0x00000005 124 + 0x00000004 0x00000009 0x0000000d 0x00000b5f 125 + 0x00000000 0x00000003 0x00000003 0x00000006 126 + 0x00000006 0x00000001 0x00000011 0x000000c8 127 + 0x00000003 0x0000000e 0x00000007 0x0000000f 128 + 0x00000002 0x00000000 0x00000000 0x00000002 129 + 0x00000000 0x00000000 0x00000083 0xe044048b 130 + 0x007d8010 0x00000000 0x00000000 0x00000000 131 + 0x00000000 0x00000000 0x00000000 0x00000000 >; 134 132 }; 135 133 }; 136 134 };
+12
arch/arm/boot/dts/tegra-trimslice.dts
··· 26 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 41 serial@70006000 { 30 42 clock-frequency = < 216000000 >; 31 43 };
+42
arch/arm/boot/dts/tegra-ventana.dts
··· 12 12 13 13 i2c@7000c000 { 14 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 31 i2c@7000c400 { ··· 38 24 39 25 i2c@7000d000 { 40 26 clock-frequency = <400000>; 27 + }; 28 + 29 + i2s@70002a00 { 30 + status = "disable"; 31 + }; 32 + 33 + sound { 34 + compatible = "nvidia,tegra-audio-wm8903-ventana", 35 + "nvidia,tegra-audio-wm8903"; 36 + nvidia,model = "NVIDIA Tegra Ventana"; 37 + 38 + nvidia,audio-routing = 39 + "Headphone Jack", "HPOUTR", 40 + "Headphone Jack", "HPOUTL", 41 + "Int Spk", "ROP", 42 + "Int Spk", "RON", 43 + "Int Spk", "LOP", 44 + "Int Spk", "LON", 45 + "Mic Jack", "MICBIAS", 46 + "IN1L", "Mic Jack"; 47 + 48 + nvidia,i2s-controller = <&tegra_i2s1>; 49 + nvidia,audio-codec = <&wm8903>; 50 + 51 + nvidia,spkr-en-gpios = <&wm8903 2 0>; 52 + nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 53 + nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */ 54 + nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ 41 55 }; 42 56 43 57 serial@70006000 {
+39 -4
arch/arm/boot/dts/tegra20.dtsi
··· 4 4 compatible = "nvidia,tegra20"; 5 5 interrupt-parent = <&intc>; 6 6 7 + pmc@7000f400 { 8 + compatible = "nvidia,tegra20-pmc"; 9 + reg = <0x7000e400 0x400>; 10 + }; 11 + 7 12 intc: interrupt-controller@50041000 { 8 13 compatible = "arm,cortex-a9-gic"; 9 14 interrupt-controller; 10 15 #interrupt-cells = <3>; 11 16 reg = < 0x50041000 0x1000 >, 12 17 < 0x50040100 0x0100 >; 18 + }; 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 >; 13 39 }; 14 40 15 41 i2c@7000c000 { ··· 70 44 interrupts = < 0 53 0x04 >; 71 45 }; 72 46 73 - i2s@70002800 { 47 + tegra_i2s1: i2s@70002800 { 74 48 compatible = "nvidia,tegra20-i2s"; 75 49 reg = <0x70002800 0x200>; 76 50 interrupts = < 0 13 0x04 >; 77 - dma-channel = < 2 >; 51 + nvidia,dma-request-selector = < &apbdma 2 >; 78 52 }; 79 53 80 - i2s@70002a00 { 54 + tegra_i2s2: i2s@70002a00 { 81 55 compatible = "nvidia,tegra20-i2s"; 82 56 reg = <0x70002a00 0x200>; 83 57 interrupts = < 0 3 0x04 >; 84 - dma-channel = < 1 >; 58 + nvidia,dma-request-selector = < &apbdma 1 >; 85 59 }; 86 60 87 61 das@70000c00 { ··· 101 75 0 89 0x04 >; 102 76 #gpio-cells = <2>; 103 77 gpio-controller; 78 + #interrupt-cells = <2>; 79 + interrupt-controller; 104 80 }; 105 81 106 82 pinmux: pinmux@70000000 { ··· 146 118 reg = <0x70006400 0x100>; 147 119 reg-shift = <2>; 148 120 interrupts = < 0 91 0x04 >; 121 + }; 122 + 123 + emc@7000f400 { 124 + #address-cells = <1>; 125 + #size-cells = <0>; 126 + compatible = "nvidia,tegra20-emc"; 127 + reg = <0x7000f400 0x200>; 149 128 }; 150 129 151 130 sdhci@c8000000 {
+52 -1
arch/arm/boot/dts/tegra30.dtsi
··· 4 4 compatible = "nvidia,tegra30"; 5 5 interrupt-parent = <&intc>; 6 6 7 + pmc@7000f400 { 8 + compatible = "nvidia,tegra20-pmc", "nvidia,tegra30-pmc"; 9 + reg = <0x7000e400 0x400>; 10 + }; 11 + 7 12 intc: interrupt-controller@50041000 { 8 13 compatible = "arm,cortex-a9-gic"; 9 14 interrupt-controller; 10 15 #interrupt-cells = <3>; 11 16 reg = < 0x50041000 0x1000 >, 12 17 < 0x50040100 0x0100 >; 18 + }; 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 >; 13 55 }; 14 56 15 57 i2c@7000c000 { ··· 97 55 gpio: gpio@6000d000 { 98 56 compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio"; 99 57 reg = < 0x6000d000 0x1000 >; 100 - interrupts = < 0 32 0x04 0 33 0x04 0 34 0x04 0 35 0x04 0 55 0x04 0 87 0x04 0 89 0x04 >; 58 + interrupts = < 0 32 0x04 59 + 0 33 0x04 60 + 0 34 0x04 61 + 0 35 0x04 62 + 0 55 0x04 63 + 0 87 0x04 64 + 0 89 0x04 65 + 0 125 0x04 >; 101 66 #gpio-cells = <2>; 102 67 gpio-controller; 68 + #interrupt-cells = <2>; 69 + interrupt-controller; 103 70 }; 104 71 105 72 serial@70006000 {
+18
arch/arm/configs/imx_v4_v5_defconfig
··· 45 45 CONFIG_FPE_NWFPE_XP=y 46 46 CONFIG_PM_DEBUG=y 47 47 CONFIG_NET=y 48 + CONFIG_SMSC911X=y 48 49 CONFIG_PACKET=y 49 50 CONFIG_UNIX=y 50 51 CONFIG_INET=y ··· 80 79 CONFIG_EEPROM_AT24=y 81 80 CONFIG_EEPROM_AT25=y 82 81 CONFIG_NETDEVICES=y 82 + CONFIG_CS89x0=y 83 + CONFIG_CS89x0_PLATFORM=y 83 84 CONFIG_DM9000=y 84 85 CONFIG_SMC91X=y 85 86 CONFIG_SMC911X=y ··· 119 116 CONFIG_BACKLIGHT_LCD_SUPPORT=y 120 117 CONFIG_LCD_CLASS_DEVICE=y 121 118 CONFIG_BACKLIGHT_CLASS_DEVICE=y 119 + CONFIG_LCD_L4F00242T03=y 120 + CONFIG_MEDIA_SUPPORT=y 121 + CONFIG_VIDEO_DEV=y 122 + CONFIG_VIDEO_V4L2_COMMON=y 123 + CONFIG_VIDEO_MEDIA=y 124 + CONFIG_VIDEO_V4L2=y 125 + CONFIG_VIDEOBUF_GEN=y 126 + CONFIG_VIDEOBUF_DMA_CONTIG=y 127 + CONFIG_VIDEOBUF2_CORE=y 128 + CONFIG_VIDEO_CAPTURE_DRIVERS=y 129 + CONFIG_V4L_PLATFORM_DRIVERS=y 130 + CONFIG_SOC_CAMERA=y 131 + CONFIG_SOC_CAMERA_OV2640=y 132 + CONFIG_VIDEO_MX2_HOSTSUPPORT=y 133 + CONFIG_VIDEO_MX2=y 122 134 CONFIG_BACKLIGHT_PWM=y 123 135 CONFIG_FRAMEBUFFER_CONSOLE=y 124 136 CONFIG_FONTS=y
+34
arch/arm/configs/imx_v6_v7_defconfig
··· 81 81 CONFIG_NETDEVICES=y 82 82 # CONFIG_NET_VENDOR_BROADCOM is not set 83 83 # CONFIG_NET_VENDOR_CHELSIO is not set 84 + CONFIG_CS89x0=y 85 + CONFIG_CS89x0_PLATFORM=y 84 86 # CONFIG_NET_VENDOR_FARADAY is not set 85 87 # CONFIG_NET_VENDOR_INTEL is not set 86 88 # CONFIG_NET_VENDOR_MARVELL is not set ··· 127 125 CONFIG_MFD_MC13XXX=y 128 126 CONFIG_REGULATOR=y 129 127 CONFIG_REGULATOR_FIXED_VOLTAGE=y 128 + CONFIG_REGULATOR_MC13783=y 130 129 CONFIG_REGULATOR_MC13892=y 130 + CONFIG_MEDIA_SUPPORT=y 131 + CONFIG_VIDEO_V4L2=y 132 + CONFIG_VIDEO_DEV=y 133 + CONFIG_VIDEO_V4L2_COMMON=y 134 + CONFIG_VIDEOBUF_GEN=y 135 + CONFIG_VIDEOBUF2_CORE=y 136 + CONFIG_VIDEOBUF2_MEMOPS=y 137 + CONFIG_VIDEOBUF2_DMA_CONTIG=y 138 + CONFIG_VIDEO_CAPTURE_DRIVERS=y 139 + CONFIG_V4L_PLATFORM_DRIVERS=y 140 + CONFIG_SOC_CAMERA=y 141 + CONFIG_SOC_CAMERA_OV2640=y 142 + CONFIG_MX3_VIDEO=y 143 + CONFIG_VIDEO_MX3=y 144 + CONFIG_FB=y 145 + CONFIG_FB_MX3=y 146 + CONFIG_BACKLIGHT_LCD_SUPPORT=y 147 + CONFIG_LCD_CLASS_DEVICE=y 148 + CONFIG_LCD_L4F00242T03=y 149 + CONFIG_BACKLIGHT_CLASS_DEVICE=y 150 + CONFIG_BACKLIGHT_GENERIC=y 151 + CONFIG_DUMMY_CONSOLE=y 152 + CONFIG_FRAMEBUFFER_CONSOLE=y 153 + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 154 + CONFIG_FONTS=y 155 + CONFIG_FONT_8x8=y 156 + CONFIG_FONT_8x16=y 157 + CONFIG_LOGO=y 158 + CONFIG_LOGO_LINUX_MONO=y 159 + CONFIG_LOGO_LINUX_VGA16=y 160 + CONFIG_LOGO_LINUX_CLUT224=y 131 161 CONFIG_USB=y 132 162 CONFIG_USB_EHCI_HCD=y 133 163 CONFIG_USB_EHCI_MXC=y
+1 -1
arch/arm/configs/magician_defconfig
··· 101 101 CONFIG_HTC_EGPIO=y 102 102 CONFIG_HTC_PASIC3=y 103 103 CONFIG_REGULATOR=y 104 - CONFIG_REGULATOR_BQ24022=y 104 + CONFIG_REGULATOR_GPIO=y 105 105 CONFIG_FB=y 106 106 CONFIG_FB_PXA=y 107 107 CONFIG_FB_PXA_OVERLAY=y
+10 -3
arch/arm/mach-at91/at91sam9263_devices.c
··· 891 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 897 at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ 897 898 at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ ··· 905 904 at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ 906 905 at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ 907 906 at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ 908 - at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ 909 907 at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ 910 908 at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ 911 909 at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ 912 910 at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ 911 + 912 + if (use_pck_as_mck) { 913 + at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ 914 + 915 + /* TODO: register the PCK for ISI_MCK and set its parent */ 916 + } 913 917 } 914 918 #else 915 - void __init at91_add_device_isi(void) {} 919 + void __init at91_add_device_isi(struct isi_platform_data *data, 920 + bool use_pck_as_mck) {} 916 921 #endif 917 922 918 923
+94
arch/arm/mach-at91/at91sam9g45_devices.c
··· 14 14 15 15 #include <linux/dma-mapping.h> 16 16 #include <linux/gpio.h> 17 + #include <linux/clk.h> 17 18 #include <linux/platform_device.h> 18 19 #include <linux/i2c-gpio.h> 19 20 #include <linux/atmel-mci.h> ··· 29 28 #include <mach/at_hdmac.h> 30 29 #include <mach/atmel-mci.h> 31 30 31 + #include <media/atmel-isi.h> 32 + 32 33 #include "generic.h" 34 + #include "clock.h" 33 35 34 36 35 37 /* -------------------------------------------------------------------- ··· 872 868 } 873 869 #else 874 870 void __init at91_add_device_ac97(struct ac97c_platform_data *data) {} 871 + #endif 872 + 873 + /* -------------------------------------------------------------------- 874 + * Image Sensor Interface 875 + * -------------------------------------------------------------------- */ 876 + #if defined(CONFIG_VIDEO_ATMEL_ISI) || defined(CONFIG_VIDEO_ATMEL_ISI_MODULE) 877 + static u64 isi_dmamask = DMA_BIT_MASK(32); 878 + static struct isi_platform_data isi_data; 879 + 880 + struct resource isi_resources[] = { 881 + [0] = { 882 + .start = AT91SAM9G45_BASE_ISI, 883 + .end = AT91SAM9G45_BASE_ISI + SZ_16K - 1, 884 + .flags = IORESOURCE_MEM, 885 + }, 886 + [1] = { 887 + .start = AT91SAM9G45_ID_ISI, 888 + .end = AT91SAM9G45_ID_ISI, 889 + .flags = IORESOURCE_IRQ, 890 + }, 891 + }; 892 + 893 + static struct platform_device at91sam9g45_isi_device = { 894 + .name = "atmel_isi", 895 + .id = 0, 896 + .dev = { 897 + .dma_mask = &isi_dmamask, 898 + .coherent_dma_mask = DMA_BIT_MASK(32), 899 + .platform_data = &isi_data, 900 + }, 901 + .resource = isi_resources, 902 + .num_resources = ARRAY_SIZE(isi_resources), 903 + }; 904 + 905 + static struct clk_lookup isi_mck_lookups[] = { 906 + CLKDEV_CON_DEV_ID("isi_mck", "atmel_isi.0", NULL), 907 + }; 908 + 909 + void __init at91_add_device_isi(struct isi_platform_data *data, 910 + bool use_pck_as_mck) 911 + { 912 + struct clk *pck; 913 + struct clk *parent; 914 + 915 + if (!data) 916 + return; 917 + isi_data = *data; 918 + 919 + at91_set_A_periph(AT91_PIN_PB20, 0); /* ISI_D0 */ 920 + at91_set_A_periph(AT91_PIN_PB21, 0); /* ISI_D1 */ 921 + at91_set_A_periph(AT91_PIN_PB22, 0); /* ISI_D2 */ 922 + at91_set_A_periph(AT91_PIN_PB23, 0); /* ISI_D3 */ 923 + at91_set_A_periph(AT91_PIN_PB24, 0); /* ISI_D4 */ 924 + at91_set_A_periph(AT91_PIN_PB25, 0); /* ISI_D5 */ 925 + at91_set_A_periph(AT91_PIN_PB26, 0); /* ISI_D6 */ 926 + at91_set_A_periph(AT91_PIN_PB27, 0); /* ISI_D7 */ 927 + at91_set_A_periph(AT91_PIN_PB28, 0); /* ISI_PCK */ 928 + at91_set_A_periph(AT91_PIN_PB30, 0); /* ISI_HSYNC */ 929 + at91_set_A_periph(AT91_PIN_PB29, 0); /* ISI_VSYNC */ 930 + at91_set_B_periph(AT91_PIN_PB8, 0); /* ISI_PD8 */ 931 + at91_set_B_periph(AT91_PIN_PB9, 0); /* ISI_PD9 */ 932 + at91_set_B_periph(AT91_PIN_PB10, 0); /* ISI_PD10 */ 933 + at91_set_B_periph(AT91_PIN_PB11, 0); /* ISI_PD11 */ 934 + 935 + platform_device_register(&at91sam9g45_isi_device); 936 + 937 + if (use_pck_as_mck) { 938 + at91_set_B_periph(AT91_PIN_PB31, 0); /* ISI_MCK (PCK1) */ 939 + 940 + pck = clk_get(NULL, "pck1"); 941 + parent = clk_get(NULL, "plla"); 942 + 943 + BUG_ON(IS_ERR(pck) || IS_ERR(parent)); 944 + 945 + if (clk_set_parent(pck, parent)) { 946 + pr_err("Failed to set PCK's parent\n"); 947 + } else { 948 + /* Register PCK as ISI_MCK */ 949 + isi_mck_lookups[0].clk = pck; 950 + clkdev_add_table(isi_mck_lookups, 951 + ARRAY_SIZE(isi_mck_lookups)); 952 + } 953 + 954 + clk_put(pck); 955 + clk_put(parent); 956 + } 957 + } 958 + #else 959 + void __init at91_add_device_isi(struct isi_platform_data *data, 960 + bool use_pck_as_mck) {} 875 961 #endif 876 962 877 963
+11 -1
arch/arm/mach-at91/board-flexibity.c
··· 1 1 /* 2 2 * linux/arch/arm/mach-at91/board-flexibity.c 3 3 * 4 - * Copyright (C) 2010 Flexibity 4 + * Copyright (C) 2010-2011 Flexibity 5 5 * Copyright (C) 2005 SAN People 6 6 * Copyright (C) 2006 Atmel 7 7 * ··· 60 60 static struct at91_udc_data __initdata flexibity_udc_data = { 61 61 .vbus_pin = AT91_PIN_PC5, 62 62 .pullup_pin = -EINVAL, /* pull-up driven by UDC */ 63 + }; 64 + 65 + /* I2C devices */ 66 + static struct i2c_board_info __initdata flexibity_i2c_devices[] = { 67 + { 68 + I2C_BOARD_INFO("ds1307", 0x68), 69 + }, 63 70 }; 64 71 65 72 /* SPI devices */ ··· 148 141 at91_add_device_usbh(&flexibity_usbh_data); 149 142 /* USB Device */ 150 143 at91_add_device_udc(&flexibity_udc_data); 144 + /* I2C */ 145 + at91_add_device_i2c(flexibity_i2c_devices, 146 + ARRAY_SIZE(flexibity_i2c_devices)); 151 147 /* SPI */ 152 148 at91_add_device_spi(flexibity_spi_devices, 153 149 ARRAY_SIZE(flexibity_spi_devices));
+78 -2
arch/arm/mach-at91/board-sam9m10g45ek.c
··· 24 24 #include <linux/gpio_keys.h> 25 25 #include <linux/input.h> 26 26 #include <linux/leds.h> 27 - #include <linux/clk.h> 28 27 #include <linux/atmel-mci.h> 28 + #include <linux/delay.h> 29 29 30 30 #include <mach/hardware.h> 31 31 #include <video/atmel_lcdc.h> 32 + #include <media/soc_camera.h> 33 + #include <media/atmel-isi.h> 32 34 33 35 #include <asm/setup.h> 34 36 #include <asm/mach-types.h> ··· 184 182 185 183 at91_add_device_nand(&ek_nand_data); 186 184 } 185 + 186 + 187 + /* 188 + * ISI 189 + */ 190 + static struct isi_platform_data __initdata isi_data = { 191 + .frate = ISI_CFG1_FRATE_CAPTURE_ALL, 192 + /* to use codec and preview path simultaneously */ 193 + .full_mode = 1, 194 + .data_width_flags = ISI_DATAWIDTH_8 | ISI_DATAWIDTH_10, 195 + /* ISI_MCK is provided by programmable clock or external clock */ 196 + .mck_hz = 25000000, 197 + }; 198 + 199 + 200 + /* 201 + * soc-camera OV2640 202 + */ 203 + #if defined(CONFIG_SOC_CAMERA_OV2640) || \ 204 + defined(CONFIG_SOC_CAMERA_OV2640_MODULE) 205 + static unsigned long isi_camera_query_bus_param(struct soc_camera_link *link) 206 + { 207 + /* ISI board for ek using default 8-bits connection */ 208 + return SOCAM_DATAWIDTH_8; 209 + } 210 + 211 + static int i2c_camera_power(struct device *dev, int on) 212 + { 213 + /* enable or disable the camera */ 214 + pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); 215 + at91_set_gpio_output(AT91_PIN_PD13, !on); 216 + 217 + if (!on) 218 + goto out; 219 + 220 + /* If enabled, give a reset impulse */ 221 + at91_set_gpio_output(AT91_PIN_PD12, 0); 222 + msleep(20); 223 + at91_set_gpio_output(AT91_PIN_PD12, 1); 224 + msleep(100); 225 + 226 + out: 227 + return 0; 228 + } 229 + 230 + static struct i2c_board_info i2c_camera = { 231 + I2C_BOARD_INFO("ov2640", 0x30), 232 + }; 233 + 234 + static struct soc_camera_link iclink_ov2640 = { 235 + .bus_id = 0, 236 + .board_info = &i2c_camera, 237 + .i2c_adapter_id = 0, 238 + .power = i2c_camera_power, 239 + .query_bus_param = isi_camera_query_bus_param, 240 + }; 241 + 242 + static struct platform_device isi_ov2640 = { 243 + .name = "soc-camera-pdrv", 244 + .id = 0, 245 + .dev = { 246 + .platform_data = &iclink_ov2640, 247 + }, 248 + }; 249 + #endif 187 250 188 251 189 252 /* ··· 444 377 #endif 445 378 }; 446 379 447 - 380 + static struct platform_device *devices[] __initdata = { 381 + #if defined(CONFIG_SOC_CAMERA_OV2640) || \ 382 + defined(CONFIG_SOC_CAMERA_OV2640_MODULE) 383 + &isi_ov2640, 384 + #endif 385 + }; 448 386 449 387 static void __init ek_board_init(void) 450 388 { ··· 471 399 ek_add_device_nand(); 472 400 /* I2C */ 473 401 at91_add_device_i2c(0, NULL, 0); 402 + /* ISI, using programmable clock as ISI_MCK */ 403 + at91_add_device_isi(&isi_data, true); 474 404 /* LCD Controller */ 475 405 at91_add_device_lcdc(&ek_lcdc_data); 476 406 /* Touch Screen */ ··· 484 410 /* LEDs */ 485 411 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 486 412 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); 413 + /* Other platform devices */ 414 + platform_add_devices(devices, ARRAY_SIZE(devices)); 487 415 } 488 416 489 417 MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK")
+5 -1
arch/arm/mach-at91/include/mach/board.h
··· 107 107 u8 ale; /* address line number connected to ALE */ 108 108 u8 cle; /* address line number connected to CLE */ 109 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 112 struct mtd_partition *parts; 111 113 unsigned int num_parts; 112 114 }; ··· 181 179 extern void __init at91_add_device_ac97(struct ac97c_platform_data *data); 182 180 183 181 /* ISI */ 184 - extern void __init at91_add_device_isi(void); 182 + struct isi_platform_data; 183 + extern void __init at91_add_device_isi(struct isi_platform_data *data, 184 + bool use_pck_as_mck); 185 185 186 186 /* Touchscreen Controller */ 187 187 struct at91_tsadcc_data {
+3
arch/arm/mach-exynos/Kconfig
··· 42 42 bool "SAMSUNG EXYNOS4212" 43 43 default y 44 44 depends on ARCH_EXYNOS4 45 + select SAMSUNG_DMADEV 45 46 select S5P_PM if PM 46 47 select S5P_SLEEP if PM 47 48 help ··· 52 51 bool "SAMSUNG EXYNOS4412" 53 52 default y 54 53 depends on ARCH_EXYNOS4 54 + select SAMSUNG_DMADEV 55 55 help 56 56 Enable EXYNOS4412 SoC support 57 57 ··· 337 335 select SAMSUNG_DEV_BACKLIGHT 338 336 select SAMSUNG_DEV_KEYPAD 339 337 select SAMSUNG_DEV_PWM 338 + select EXYNOS4_DEV_DMA 340 339 select EXYNOS4_SETUP_I2C1 341 340 select EXYNOS4_SETUP_I2C3 342 341 select EXYNOS4_SETUP_I2C7
+9
arch/arm/mach-exynos/clock-exynos4.c
··· 789 789 .ctrlbit = (1 << 1), 790 790 }; 791 791 792 + static struct clk exynos4_clk_mdma1 = { 793 + .name = "dma", 794 + .devname = "dma-pl330.2", 795 + .enable = exynos4_clk_ip_image_ctrl, 796 + .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)), 797 + }; 798 + 792 799 struct clk *exynos4_clkset_group_list[] = { 793 800 [0] = &clk_ext_xtal_mux, 794 801 [1] = &clk_xusbxti, ··· 1314 1307 static struct clk *exynos4_clk_cdev[] = { 1315 1308 &exynos4_clk_pdma0, 1316 1309 &exynos4_clk_pdma1, 1310 + &exynos4_clk_mdma1, 1317 1311 }; 1318 1312 1319 1313 static struct clksrc_clk *exynos4_clksrc_cdev[] = { ··· 1343 1335 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk), 1344 1336 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), 1345 1337 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), 1338 + CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1), 1346 1339 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk), 1347 1340 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk), 1348 1341 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk),
+109 -8
arch/arm/mach-exynos/dma.c
··· 29 29 #include <asm/irq.h> 30 30 #include <plat/devs.h> 31 31 #include <plat/irqs.h> 32 + #include <plat/cpu.h> 32 33 33 34 #include <mach/map.h> 34 35 #include <mach/irqs.h> ··· 37 36 38 37 static u64 dma_dmamask = DMA_BIT_MASK(32); 39 38 40 - static u8 pdma0_peri[] = { 39 + static u8 exynos4210_pdma0_peri[] = { 41 40 DMACH_PCM0_RX, 42 41 DMACH_PCM0_TX, 43 42 DMACH_PCM2_RX, ··· 70 69 DMACH_AC97_PCMOUT, 71 70 }; 72 71 73 - static struct dma_pl330_platdata exynos4_pdma0_pdata = { 74 - .nr_valid_peri = ARRAY_SIZE(pdma0_peri), 75 - .peri_id = pdma0_peri, 72 + static u8 exynos4212_pdma0_peri[] = { 73 + DMACH_PCM0_RX, 74 + DMACH_PCM0_TX, 75 + DMACH_PCM2_RX, 76 + DMACH_PCM2_TX, 77 + DMACH_MIPI_HSI0, 78 + DMACH_MIPI_HSI1, 79 + DMACH_SPI0_RX, 80 + DMACH_SPI0_TX, 81 + DMACH_SPI2_RX, 82 + DMACH_SPI2_TX, 83 + DMACH_I2S0S_TX, 84 + DMACH_I2S0_RX, 85 + DMACH_I2S0_TX, 86 + DMACH_I2S2_RX, 87 + DMACH_I2S2_TX, 88 + DMACH_UART0_RX, 89 + DMACH_UART0_TX, 90 + DMACH_UART2_RX, 91 + DMACH_UART2_TX, 92 + DMACH_UART4_RX, 93 + DMACH_UART4_TX, 94 + DMACH_SLIMBUS0_RX, 95 + DMACH_SLIMBUS0_TX, 96 + DMACH_SLIMBUS2_RX, 97 + DMACH_SLIMBUS2_TX, 98 + DMACH_SLIMBUS4_RX, 99 + DMACH_SLIMBUS4_TX, 100 + DMACH_AC97_MICIN, 101 + DMACH_AC97_PCMIN, 102 + DMACH_AC97_PCMOUT, 103 + DMACH_MIPI_HSI4, 104 + DMACH_MIPI_HSI5, 76 105 }; 106 + 107 + struct dma_pl330_platdata exynos4_pdma0_pdata; 77 108 78 109 static AMBA_AHB_DEVICE(exynos4_pdma0, "dma-pl330.0", 0x00041330, 79 110 EXYNOS4_PA_PDMA0, {IRQ_PDMA0}, &exynos4_pdma0_pdata); 80 111 81 - static u8 pdma1_peri[] = { 112 + static u8 exynos4210_pdma1_peri[] = { 82 113 DMACH_PCM0_RX, 83 114 DMACH_PCM0_TX, 84 115 DMACH_PCM1_RX, ··· 138 105 DMACH_SLIMBUS5_TX, 139 106 }; 140 107 141 - static struct dma_pl330_platdata exynos4_pdma1_pdata = { 142 - .nr_valid_peri = ARRAY_SIZE(pdma1_peri), 143 - .peri_id = pdma1_peri, 108 + static u8 exynos4212_pdma1_peri[] = { 109 + DMACH_PCM0_RX, 110 + DMACH_PCM0_TX, 111 + DMACH_PCM1_RX, 112 + DMACH_PCM1_TX, 113 + DMACH_MIPI_HSI2, 114 + DMACH_MIPI_HSI3, 115 + DMACH_SPI1_RX, 116 + DMACH_SPI1_TX, 117 + DMACH_I2S0S_TX, 118 + DMACH_I2S0_RX, 119 + DMACH_I2S0_TX, 120 + DMACH_I2S1_RX, 121 + DMACH_I2S1_TX, 122 + DMACH_UART0_RX, 123 + DMACH_UART0_TX, 124 + DMACH_UART1_RX, 125 + DMACH_UART1_TX, 126 + DMACH_UART3_RX, 127 + DMACH_UART3_TX, 128 + DMACH_SLIMBUS1_RX, 129 + DMACH_SLIMBUS1_TX, 130 + DMACH_SLIMBUS3_RX, 131 + DMACH_SLIMBUS3_TX, 132 + DMACH_SLIMBUS5_RX, 133 + DMACH_SLIMBUS5_TX, 134 + DMACH_SLIMBUS0AUX_RX, 135 + DMACH_SLIMBUS0AUX_TX, 136 + DMACH_SPDIF, 137 + DMACH_MIPI_HSI6, 138 + DMACH_MIPI_HSI7, 144 139 }; 140 + 141 + static struct dma_pl330_platdata exynos4_pdma1_pdata; 145 142 146 143 static AMBA_AHB_DEVICE(exynos4_pdma1, "dma-pl330.1", 0x00041330, 147 144 EXYNOS4_PA_PDMA1, {IRQ_PDMA1}, &exynos4_pdma1_pdata); 145 + 146 + static u8 mdma_peri[] = { 147 + DMACH_MTOM_0, 148 + DMACH_MTOM_1, 149 + DMACH_MTOM_2, 150 + DMACH_MTOM_3, 151 + DMACH_MTOM_4, 152 + DMACH_MTOM_5, 153 + DMACH_MTOM_6, 154 + DMACH_MTOM_7, 155 + }; 156 + 157 + static struct dma_pl330_platdata exynos4_mdma1_pdata = { 158 + .nr_valid_peri = ARRAY_SIZE(mdma_peri), 159 + .peri_id = mdma_peri, 160 + }; 161 + 162 + static AMBA_AHB_DEVICE(exynos4_mdma1, "dma-pl330.2", 0x00041330, 163 + EXYNOS4_PA_MDMA1, {IRQ_MDMA1}, &exynos4_mdma1_pdata); 148 164 149 165 static int __init exynos4_dma_init(void) 150 166 { 151 167 if (of_have_populated_dt()) 152 168 return 0; 169 + 170 + if (soc_is_exynos4210()) { 171 + exynos4_pdma0_pdata.nr_valid_peri = 172 + ARRAY_SIZE(exynos4210_pdma0_peri); 173 + exynos4_pdma0_pdata.peri_id = exynos4210_pdma0_peri; 174 + exynos4_pdma1_pdata.nr_valid_peri = 175 + ARRAY_SIZE(exynos4210_pdma1_peri); 176 + exynos4_pdma1_pdata.peri_id = exynos4210_pdma1_peri; 177 + } else if (soc_is_exynos4212() || soc_is_exynos4412()) { 178 + exynos4_pdma0_pdata.nr_valid_peri = 179 + ARRAY_SIZE(exynos4212_pdma0_peri); 180 + exynos4_pdma0_pdata.peri_id = exynos4212_pdma0_peri; 181 + exynos4_pdma1_pdata.nr_valid_peri = 182 + ARRAY_SIZE(exynos4212_pdma1_peri); 183 + exynos4_pdma1_pdata.peri_id = exynos4212_pdma1_peri; 184 + } 153 185 154 186 dma_cap_set(DMA_SLAVE, exynos4_pdma0_pdata.cap_mask); 155 187 dma_cap_set(DMA_CYCLIC, exynos4_pdma0_pdata.cap_mask); ··· 223 125 dma_cap_set(DMA_SLAVE, exynos4_pdma1_pdata.cap_mask); 224 126 dma_cap_set(DMA_CYCLIC, exynos4_pdma1_pdata.cap_mask); 225 127 amba_device_register(&exynos4_pdma1_device, &iomem_resource); 128 + 129 + dma_cap_set(DMA_MEMCPY, exynos4_mdma1_pdata.cap_mask); 130 + amba_device_register(&exynos4_mdma1_device, &iomem_resource); 226 131 227 132 return 0; 228 133 }
+2
arch/arm/mach-exynos/include/mach/irqs.h
··· 43 43 #define IRQ_EINT15 IRQ_SPI(31) 44 44 #define IRQ_EINT16_31 IRQ_SPI(32) 45 45 46 + #define IRQ_MDMA0 IRQ_SPI(33) 47 + #define IRQ_MDMA1 IRQ_SPI(34) 46 48 #define IRQ_PDMA0 IRQ_SPI(35) 47 49 #define IRQ_PDMA1 IRQ_SPI(36) 48 50 #define IRQ_TIMER0_VIC IRQ_SPI(37)
+2 -1
arch/arm/mach-exynos/include/mach/map.h
··· 72 72 #define EXYNOS4_PA_TWD 0x10500600 73 73 #define EXYNOS4_PA_L2CC 0x10502000 74 74 75 - #define EXYNOS4_PA_MDMA 0x10810000 75 + #define EXYNOS4_PA_MDMA0 0x10810000 76 + #define EXYNOS4_PA_MDMA1 0x12840000 76 77 #define EXYNOS4_PA_PDMA0 0x12680000 77 78 #define EXYNOS4_PA_PDMA1 0x12690000 78 79
+2 -2
arch/arm/mach-exynos/mach-nuri.c
··· 117 117 }; 118 118 119 119 static struct regulator_consumer_supply emmc_supplies[] = { 120 - REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), 120 + REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"), 121 121 REGULATOR_SUPPLY("vmmc", "dw_mmc"), 122 122 }; 123 123 ··· 418 418 REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */ 419 419 }; 420 420 static struct regulator_consumer_supply __initdata max8997_ldo13_[] = { 421 - REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */ 421 + REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */ 422 422 }; 423 423 static struct regulator_consumer_supply __initdata max8997_ldo14_[] = { 424 424 REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
+1 -1
arch/arm/mach-exynos/mach-universal_c210.c
··· 752 752 }; 753 753 754 754 static struct regulator_consumer_supply mmc0_supplies[] = { 755 - REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), 755 + REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"), 756 756 }; 757 757 758 758 static struct regulator_init_data mmc0_fixed_voltage_init_data = {
+1
arch/arm/mach-imx/Kconfig
··· 298 298 select IMX_HAVE_PLATFORM_IMX_I2C 299 299 select IMX_HAVE_PLATFORM_IMX_KEYPAD 300 300 select IMX_HAVE_PLATFORM_IMX_UART 301 + select IMX_HAVE_PLATFORM_MX2_CAMERA 301 302 select IMX_HAVE_PLATFORM_MXC_EHCI 302 303 select IMX_HAVE_PLATFORM_MXC_MMC 303 304 select IMX_HAVE_PLATFORM_SPI_IMX
+73 -1
arch/arm/mach-imx/clock-imx6q.c
··· 329 329 #define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26) 330 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 338 #define FREQ_480M 480000000 333 339 #define FREQ_528M 528000000 334 340 #define FREQ_594M 594000000 ··· 399 393 static struct clk ipu2_di0_clk; 400 394 static struct clk ipu2_di1_clk; 401 395 static struct clk enfc_clk; 396 + static struct clk cko1_clk; 402 397 static struct clk dummy_clk = {}; 403 398 404 399 static unsigned long external_high_reference; ··· 945 938 writel_relaxed(reg, clk->enable_reg); 946 939 } 947 940 941 + static int _clk_enable_1b(struct clk *clk) 942 + { 943 + u32 reg; 944 + reg = readl_relaxed(clk->enable_reg); 945 + reg |= 0x1 << clk->enable_shift; 946 + writel_relaxed(reg, clk->enable_reg); 947 + 948 + return 0; 949 + } 950 + 951 + static void _clk_disable_1b(struct clk *clk) 952 + { 953 + u32 reg; 954 + reg = readl_relaxed(clk->enable_reg); 955 + reg &= ~(0x1 << clk->enable_shift); 956 + writel_relaxed(reg, clk->enable_reg); 957 + } 958 + 948 959 struct divider { 949 960 struct clk *clk; 950 961 void __iomem *reg; ··· 1008 983 DEF_CLK_DIV1(ipu2_di1_pre_div, &ipu2_di1_pre_clk, CSCDR2, IPU2_DI1_PRE); 1009 984 DEF_CLK_DIV1(ipu1_div, &ipu1_clk, CSCDR3, IPU1_HSP); 1010 985 DEF_CLK_DIV1(ipu2_div, &ipu2_clk, CSCDR3, IPU2_HSP); 986 + DEF_CLK_DIV1(cko1_div, &cko1_clk, CCOSR, CKO1); 1011 987 1012 988 #define DEF_CLK_DIV2(d, c, r, b) \ 1013 989 static struct divider d = { \ ··· 1064 1038 &enfc_div, 1065 1039 &spdif_div, 1066 1040 &asrc_serial_div, 1041 + &cko1_div, 1067 1042 }; 1068 1043 1069 1044 static unsigned long ldb_di_clk_get_rate(struct clk *clk) ··· 1652 1625 DEF_IPU_MUX(1); 1653 1626 DEF_IPU_MUX(2); 1654 1627 1628 + static struct multiplexer cko1_mux = { 1629 + .clk = &cko1_clk, 1630 + .reg = CCOSR, 1631 + .bp = BP_CCOSR_CKO1_SEL, 1632 + .bm = BM_CCOSR_CKO1_SEL, 1633 + .parents = { 1634 + &pll3_usb_otg, 1635 + &pll2_bus, 1636 + &pll1_sys, 1637 + &pll5_video, 1638 + &dummy_clk, 1639 + &axi_clk, 1640 + &enfc_clk, 1641 + &ipu1_di0_clk, 1642 + &ipu1_di1_clk, 1643 + &ipu2_di0_clk, 1644 + &ipu2_di1_clk, 1645 + &ahb_clk, 1646 + &ipg_clk, 1647 + &ipg_perclk, 1648 + &ckil_clk, 1649 + &pll4_audio, 1650 + NULL 1651 + }, 1652 + }; 1653 + 1655 1654 static struct multiplexer *multiplexers[] = { 1656 1655 &axi_mux, 1657 1656 &periph_mux, ··· 1720 1667 &ipu2_di1_mux, 1721 1668 &ipu1_mux, 1722 1669 &ipu2_mux, 1670 + &cko1_mux, 1723 1671 }; 1724 1672 1725 1673 static int _clk_set_parent(struct clk *clk, struct clk *parent) ··· 1744 1690 break; 1745 1691 i++; 1746 1692 } 1747 - if (!m->parents[i]) 1693 + if (!m->parents[i] || m->parents[i] == &dummy_clk) 1748 1694 return -EINVAL; 1749 1695 1750 1696 val = readl_relaxed(m->reg); ··· 1791 1737 .enable_shift = es, \ 1792 1738 .enable = _clk_enable, \ 1793 1739 .disable = _clk_disable, \ 1740 + .get_rate = _clk_get_rate, \ 1741 + .set_rate = _clk_set_rate, \ 1742 + .round_rate = _clk_round_rate, \ 1743 + .set_parent = _clk_set_parent, \ 1744 + .parent = p, \ 1745 + .secondary = s, \ 1746 + } 1747 + 1748 + #define DEF_CLK_1B(name, er, es, p, s) \ 1749 + static struct clk name = { \ 1750 + .enable_reg = er, \ 1751 + .enable_shift = es, \ 1752 + .enable = _clk_enable_1b, \ 1753 + .disable = _clk_disable_1b, \ 1794 1754 .get_rate = _clk_get_rate, \ 1795 1755 .set_rate = _clk_set_rate, \ 1796 1756 .round_rate = _clk_round_rate, \ ··· 1879 1811 DEF_CLK(emi_slow_clk, CCGR6, CG5, &axi_clk, NULL); 1880 1812 DEF_CLK(vdo_axi_clk, CCGR6, CG6, &axi_clk, NULL); 1881 1813 DEF_CLK(vpu_clk, CCGR6, CG7, &axi_clk, NULL); 1814 + DEF_CLK_1B(cko1_clk, CCOSR, BP_CCOSR_CKO1_EN, &pll2_bus, NULL); 1882 1815 1883 1816 static int pcie_clk_enable(struct clk *clk) 1884 1817 { ··· 1991 1922 _REGISTER_CLOCK(NULL, "gpmi_io_clk", gpmi_io_clk), 1992 1923 _REGISTER_CLOCK(NULL, "usboh3_clk", usboh3_clk), 1993 1924 _REGISTER_CLOCK(NULL, "sata_clk", sata_clk), 1925 + _REGISTER_CLOCK(NULL, "cko1_clk", cko1_clk), 1994 1926 }; 1995 1927 1996 1928 int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode) ··· 2098 2028 clk_set_rate(&usdhc2_clk, 49500000); 2099 2029 clk_set_rate(&usdhc3_clk, 49500000); 2100 2030 clk_set_rate(&usdhc4_clk, 49500000); 2031 + 2032 + clk_set_parent(&cko1_clk, &ahb_clk); 2101 2033 2102 2034 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); 2103 2035 base = of_iomap(np, 0);
+1 -1
arch/arm/mach-imx/lluart.c
··· 17 17 #include <mach/hardware.h> 18 18 19 19 static struct map_desc imx_lluart_desc = { 20 - #ifdef CONFIG_DEBUG_IMX6Q_UART 20 + #ifdef CONFIG_DEBUG_IMX6Q_UART4 21 21 .virtual = MX6Q_IO_P2V(MX6Q_UART4_BASE_ADDR), 22 22 .pfn = __phys_to_pfn(MX6Q_UART4_BASE_ADDR), 23 23 .length = MX6Q_UART4_SIZE,
+15 -1
arch/arm/mach-imx/mach-mx21ads.c
··· 37 37 #define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ 38 38 (MX21ADS_MMIO_BASE_ADDR + (offset)) 39 39 40 + #define MX21ADS_CS8900A_MMIO_SIZE 0x200000 40 41 #define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11) 41 - #define MX21ADS_CS8900A_IOBASE_REG MX21ADS_REG_ADDR(0x000000) 42 42 #define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) 43 43 #define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000) 44 44 #define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000) ··· 157 157 }, 158 158 .num_resources = 1, 159 159 .resource = &mx21ads_flash_resource, 160 + }; 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), 160 172 }; 161 173 162 174 static const struct imxuart_platform_data uart_pdata_rts __initconst = { ··· 304 292 imx21_add_mxc_nand(&mx21ads_nand_board_info); 305 293 306 294 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 295 + platform_device_register_full( 296 + (struct platform_device_info *)&mx21ads_cs8900_devinfo); 307 297 } 308 298 309 299 static void __init mx21ads_timer_init(void)
+108
arch/arm/mach-imx/mach-mx27_3ds.c
··· 31 31 #include <linux/regulator/machine.h> 32 32 #include <linux/spi/l4f00242t03.h> 33 33 34 + #include <media/soc_camera.h> 35 + 34 36 #include <asm/mach-types.h> 35 37 #include <asm/mach/arch.h> 36 38 #include <asm/mach/time.h> ··· 54 52 #define SD1_CD IMX_GPIO_NR(2, 26) 55 53 #define LCD_RESET IMX_GPIO_NR(1, 3) 56 54 #define LCD_ENABLE IMX_GPIO_NR(1, 31) 55 + #define CSI_PWRDWN IMX_GPIO_NR(4, 19) 56 + #define CSI_RESET IMX_GPIO_NR(3, 6) 57 57 58 58 static const int mx27pdk_pins[] __initconst = { 59 59 /* UART1 */ ··· 145 141 PA30_PF_CONTRAST, 146 142 LCD_ENABLE | GPIO_GPIO | GPIO_OUT, 147 143 LCD_RESET | GPIO_GPIO | GPIO_OUT, 144 + /* CSI */ 145 + PB10_PF_CSI_D0, 146 + PB11_PF_CSI_D1, 147 + PB12_PF_CSI_D2, 148 + PB13_PF_CSI_D3, 149 + PB14_PF_CSI_D4, 150 + PB15_PF_CSI_MCLK, 151 + PB16_PF_CSI_PIXCLK, 152 + PB17_PF_CSI_D5, 153 + PB18_PF_CSI_D6, 154 + PB19_PF_CSI_D7, 155 + PB20_PF_CSI_VSYNC, 156 + PB21_PF_CSI_HSYNC, 157 + CSI_PWRDWN | GPIO_GPIO | GPIO_OUT, 158 + CSI_RESET | GPIO_GPIO | GPIO_OUT, 159 + }; 160 + 161 + static struct gpio mx27_3ds_camera_gpios[] = { 162 + { CSI_PWRDWN, GPIOF_OUT_INIT_HIGH, "camera-power" }, 163 + { CSI_RESET, GPIOF_OUT_INIT_HIGH, "camera-reset" }, 148 164 }; 149 165 150 166 static const struct imxuart_platform_data uart_pdata __initconst = { ··· 266 242 267 243 static struct regulator_consumer_supply vmmc1_consumers[] = { 268 244 REGULATOR_SUPPLY("vcore", "spi0.0"), 245 + REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"), 269 246 }; 270 247 271 248 static struct regulator_init_data vmmc1_init = { ··· 295 270 .consumer_supplies = vgen_consumers, 296 271 }; 297 272 273 + static struct regulator_consumer_supply vvib_consumers[] = { 274 + REGULATOR_SUPPLY("cmos_vcore", "soc-camera-pdrv.0"), 275 + }; 276 + 277 + static struct regulator_init_data vvib_init = { 278 + .constraints = { 279 + .min_uV = 1300000, 280 + .max_uV = 1300000, 281 + .apply_uV = 1, 282 + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 283 + REGULATOR_CHANGE_STATUS, 284 + }, 285 + .num_consumer_supplies = ARRAY_SIZE(vvib_consumers), 286 + .consumer_supplies = vvib_consumers, 287 + }; 288 + 298 289 static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { 299 290 { 300 291 .id = MC13783_REG_VMMC1, ··· 324 283 }, { 325 284 .id = MC13783_REG_GPO3, /* Turn on 3.3V */ 326 285 .init_data = &gpo_init, 286 + }, { 287 + .id = MC13783_REG_VVIB, /* Power OV2640 */ 288 + .init_data = &vvib_init, 327 289 }, 328 290 }; 329 291 ··· 353 309 static const struct spi_imx_master spi2_pdata __initconst = { 354 310 .chipselect = spi2_chipselect, 355 311 .num_chipselect = ARRAY_SIZE(spi2_chipselect), 312 + }; 313 + 314 + static int mx27_3ds_camera_power(struct device *dev, int on) 315 + { 316 + /* enable or disable the camera */ 317 + pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); 318 + gpio_set_value(CSI_PWRDWN, on ? 0 : 1); 319 + 320 + if (!on) 321 + goto out; 322 + 323 + /* If enabled, give a reset impulse */ 324 + gpio_set_value(CSI_RESET, 0); 325 + msleep(20); 326 + gpio_set_value(CSI_RESET, 1); 327 + msleep(100); 328 + 329 + out: 330 + return 0; 331 + } 332 + 333 + static struct i2c_board_info mx27_3ds_i2c_camera = { 334 + I2C_BOARD_INFO("ov2640", 0x30), 335 + }; 336 + 337 + static struct regulator_bulk_data mx27_3ds_camera_regs[] = { 338 + { .supply = "cmos_vcore" }, 339 + { .supply = "cmos_2v8" }, 340 + }; 341 + 342 + static struct soc_camera_link iclink_ov2640 = { 343 + .bus_id = 0, 344 + .board_info = &mx27_3ds_i2c_camera, 345 + .i2c_adapter_id = 0, 346 + .power = mx27_3ds_camera_power, 347 + .regulators = mx27_3ds_camera_regs, 348 + .num_regulators = ARRAY_SIZE(mx27_3ds_camera_regs), 349 + }; 350 + 351 + static struct platform_device mx27_3ds_ov2640 = { 352 + .name = "soc-camera-pdrv", 353 + .id = 0, 354 + .dev = { 355 + .platform_data = &iclink_ov2640, 356 + }, 356 357 }; 357 358 358 359 static struct imx_fb_videomode mx27_3ds_modes[] = { ··· 456 367 }, 457 368 }; 458 369 370 + static struct platform_device *devices[] __initdata = { 371 + &mx27_3ds_ov2640, 372 + }; 373 + 374 + static const struct mx2_camera_platform_data mx27_3ds_cam_pdata __initconst = { 375 + .clk = 26000000, 376 + }; 377 + 459 378 static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { 460 379 .bitrate = 100000, 461 380 }; 462 381 463 382 static void __init mx27pdk_init(void) 464 383 { 384 + int ret; 465 385 imx27_soc_init(); 466 386 467 387 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), ··· 502 404 if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT)) 503 405 pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); 504 406 imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); 407 + platform_add_devices(devices, ARRAY_SIZE(devices)); 505 408 imx27_add_imx_fb(&mx27_3ds_fb_data); 409 + 410 + ret = gpio_request_array(mx27_3ds_camera_gpios, 411 + ARRAY_SIZE(mx27_3ds_camera_gpios)); 412 + if (ret) { 413 + pr_err("Failed to request camera gpios"); 414 + iclink_ov2640.power = NULL; 415 + } 416 + 417 + imx27_add_mx2_camera(&mx27_3ds_cam_pdata); 506 418 } 507 419 508 420 static void __init mx27pdk_timer_init(void)
+32 -3
arch/arm/mach-imx/mach-mx31ads.c
··· 28 28 #include <asm/memory.h> 29 29 #include <asm/mach/map.h> 30 30 #include <mach/common.h> 31 - #include <mach/board-mx31ads.h> 32 31 #include <mach/iomux-mx3.h> 33 32 34 33 #ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 ··· 37 38 #endif 38 39 39 40 #include "devices-imx31.h" 41 + 42 + /* Base address of PBC controller */ 43 + #define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT 40 44 41 45 /* PBC Board interrupt status register */ 42 46 #define PBC_INTSTATUS 0x000016 ··· 64 62 #define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) 65 63 #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) 66 64 65 + #define MXC_EXP_IO_BASE MXC_BOARD_IRQ_START 67 66 #define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) 68 67 69 68 #define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10) 70 69 #define EXPIO_INT_XUART_INTB (MXC_EXP_IO_BASE + 11) 71 70 72 71 #define MXC_MAX_EXP_IO_LINES 16 72 + 73 + /* CS8900 */ 74 + #define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8) 75 + #define CS4_CS8900_MMIO_START 0x20000 73 76 74 77 /* 75 78 * The serial port definition structure. ··· 108 101 }, 109 102 }; 110 103 104 + static const struct resource mx31ads_cs8900_resources[] __initconst = { 105 + DEFINE_RES_MEM(MX31_CS4_BASE_ADDR + CS4_CS8900_MMIO_START, SZ_64K), 106 + DEFINE_RES_IRQ(EXPIO_INT_ENET_INT), 107 + }; 108 + 109 + static const struct platform_device_info mx31ads_cs8900_devinfo __initconst = { 110 + .name = "cs89x0", 111 + .id = 0, 112 + .res = mx31ads_cs8900_resources, 113 + .num_res = ARRAY_SIZE(mx31ads_cs8900_resources), 114 + }; 115 + 111 116 static int __init mxc_init_extuart(void) 112 117 { 113 118 return platform_device_register(&serial_device); 119 + } 120 + 121 + static void __init mxc_init_ext_ethernet(void) 122 + { 123 + platform_device_register_full( 124 + (struct platform_device_info *)&mx31ads_cs8900_devinfo); 114 125 } 115 126 116 127 static const struct imxuart_platform_data uart_pdata __initconst = { ··· 517 492 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); 518 493 } 519 494 520 - /* static mappings */ 495 + /* 496 + * Static mappings, starting from the CS4 start address up to the start address 497 + * of the CS8900. 498 + */ 521 499 static struct map_desc mx31ads_io_desc[] __initdata = { 522 500 { 523 501 .virtual = MX31_CS4_BASE_ADDR_VIRT, 524 502 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), 525 - .length = MX31_CS4_SIZE / 2, 503 + .length = CS4_CS8900_MMIO_START, 526 504 .type = MT_DEVICE 527 505 }, 528 506 }; ··· 550 522 mxc_init_imx_uart(); 551 523 mxc_init_i2c(); 552 524 mxc_init_audio(); 525 + mxc_init_ext_ethernet(); 553 526 } 554 527 555 528 static void __init mx31ads_timer_init(void)
+1 -1
arch/arm/mach-imx/mach-mx31moboard.c
··· 507 507 struct clk *clk = clk_get_sys("imx2-wdt.0", NULL); 508 508 509 509 if (!IS_ERR(clk)) 510 - clk_enable(clk); 510 + clk_prepare_enable(clk); 511 511 512 512 mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST); 513 513
+2 -2
arch/arm/mach-imx/pm-imx5.c
··· 89 89 90 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 95 static int mx5_suspend_enter(suspend_state_t state) ··· 119 119 120 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 125 static int mx5_pm_valid(suspend_state_t state)
+36
arch/arm/mach-lpc32xx/clock.c
··· 721 721 .get_rate = local_return_parent_rate, 722 722 }; 723 723 724 + static int adc_onoff_enable(struct clk *clk, int enable) 725 + { 726 + u32 tmp; 727 + u32 divider; 728 + 729 + /* Use PERIPH_CLOCK */ 730 + tmp = __raw_readl(LPC32XX_CLKPWR_ADC_CLK_CTRL_1); 731 + tmp |= LPC32XX_CLKPWR_ADCCTRL1_PCLK_SEL; 732 + /* 733 + * Set clock divider so that we have equal to or less than 734 + * 4.5MHz clock at ADC 735 + */ 736 + divider = clk->get_rate(clk) / 4500000 + 1; 737 + tmp |= divider; 738 + __raw_writel(tmp, LPC32XX_CLKPWR_ADC_CLK_CTRL_1); 739 + 740 + /* synchronize rate of this clock w/ actual HW setting */ 741 + clk->rate = clk->get_rate(clk->parent) / divider; 742 + 743 + if (enable == 0) 744 + __raw_writel(0, clk->enable_reg); 745 + else 746 + __raw_writel(clk->enable_mask, clk->enable_reg); 747 + 748 + return 0; 749 + } 750 + 751 + static struct clk clk_adc = { 752 + .parent = &clk_pclk, 753 + .enable = adc_onoff_enable, 754 + .enable_reg = LPC32XX_CLKPWR_ADC_CLK_CTRL, 755 + .enable_mask = LPC32XX_CLKPWR_ADC32CLKCTRL_CLK_EN, 756 + .get_rate = local_return_parent_rate, 757 + }; 758 + 724 759 static int mmc_onoff_enable(struct clk *clk, int enable) 725 760 { 726 761 u32 tmp; ··· 1090 1055 _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1) 1091 1056 _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan) 1092 1057 _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) 1058 + _REGISTER_CLOCK("lpc32xx-adc", NULL, clk_adc) 1093 1059 _REGISTER_CLOCK(NULL, "i2s0_ck", clk_i2s0) 1094 1060 _REGISTER_CLOCK(NULL, "i2s1_ck", clk_i2s1) 1095 1061 _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc)
+22
arch/arm/mach-lpc32xx/common.c
··· 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 163 * Returns the unique ID for the device 142 164 */ 143 165 void lpc32xx_get_uid(u32 devid[4])
+1
arch/arm/mach-lpc32xx/common.h
··· 29 29 extern struct platform_device lpc32xx_i2c1_device; 30 30 extern struct platform_device lpc32xx_i2c2_device; 31 31 extern struct platform_device lpc32xx_tsc_device; 32 + extern struct platform_device lpc32xx_adc_device; 32 33 extern struct platform_device lpc32xx_rtc_device; 33 34 34 35 /*
+1
arch/arm/mach-lpc32xx/phy3250.c
··· 254 254 &lpc32xx_i2c2_device, 255 255 &lpc32xx_watchdog_device, 256 256 &lpc32xx_gpio_led_device, 257 + &lpc32xx_adc_device, 257 258 }; 258 259 259 260 static struct amba_device *amba_devs[] __initdata = {
+1
arch/arm/mach-mmp/include/mach/pxa910.h
··· 22 22 extern struct pxa_device_desc pxa910_device_nand; 23 23 24 24 extern struct platform_device pxa910_device_gpio; 25 + extern struct platform_device pxa910_device_rtc; 25 26 26 27 static inline int pxa910_add_uart(int id) 27 28 {
+1
arch/arm/mach-mmp/include/mach/regs-apbc.h
··· 57 57 #define APBC_PXA910_SSP1 APBC_REG(0x01c) 58 58 #define APBC_PXA910_SSP2 APBC_REG(0x020) 59 59 #define APBC_PXA910_IPC APBC_REG(0x024) 60 + #define APBC_PXA910_RTC APBC_REG(0x028) 60 61 #define APBC_PXA910_TWSI0 APBC_REG(0x02c) 61 62 #define APBC_PXA910_KPC APBC_REG(0x030) 62 63 #define APBC_PXA910_TIMERS APBC_REG(0x034)
+23
arch/arm/mach-mmp/include/mach/regs-rtc.h
··· 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 */
+27
arch/arm/mach-mmp/pxa910.c
··· 92 92 static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000); 93 93 static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000); 94 94 static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000); 95 + static APBC_CLK(rtc, PXA910_RTC, 8, 32768); 95 96 96 97 static APMU_CLK(nand, NAND, 0x19b, 156000000); 97 98 static APMU_CLK(u2o, USB, 0x1b, 480000000); ··· 110 109 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 111 110 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 112 111 INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"), 112 + INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), 113 113 }; 114 114 115 115 static int __init pxa910_init(void) ··· 185 183 .id = -1, 186 184 .num_resources = ARRAY_SIZE(pxa910_resource_gpio), 187 185 .resource = pxa910_resource_gpio, 186 + }; 187 + 188 + static struct resource pxa910_resource_rtc[] = { 189 + { 190 + .start = 0xd4010000, 191 + .end = 0xd401003f, 192 + .flags = IORESOURCE_MEM, 193 + }, { 194 + .start = IRQ_PXA910_RTC_INT, 195 + .end = IRQ_PXA910_RTC_INT, 196 + .name = "rtc 1Hz", 197 + .flags = IORESOURCE_IRQ, 198 + }, { 199 + .start = IRQ_PXA910_RTC_ALARM, 200 + .end = IRQ_PXA910_RTC_ALARM, 201 + .name = "rtc alarm", 202 + .flags = IORESOURCE_IRQ, 203 + }, 204 + }; 205 + 206 + struct platform_device pxa910_device_rtc = { 207 + .name = "sa1100-rtc", 208 + .id = -1, 209 + .num_resources = ARRAY_SIZE(pxa910_resource_rtc), 210 + .resource = pxa910_resource_rtc, 188 211 };
+1
arch/arm/mach-mmp/ttc_dkb.c
··· 124 124 125 125 static struct platform_device *ttc_dkb_devices[] = { 126 126 &pxa910_device_gpio, 127 + &pxa910_device_rtc, 127 128 &ttc_dkb_device_onenand, 128 129 }; 129 130
+1
arch/arm/mach-mxs/clock-mx23.c
··· 439 439 _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk) 440 440 _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk) 441 441 _REGISTER_CLOCK("imx23-fb", NULL, lcdif_clk) 442 + _REGISTER_CLOCK("imx23-gpmi-nand", NULL, gpmi_clk) 442 443 }; 443 444 444 445 static int clk_misc_init(void)
+1
arch/arm/mach-mxs/clock-mx28.c
··· 617 617 _REGISTER_CLOCK("duart", NULL, uart_clk) 618 618 _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk) 619 619 _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk) 620 + _REGISTER_CLOCK("imx28-gpmi-nand", NULL, gpmi_clk) 620 621 _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk) 621 622 _REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk) 622 623 _REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk)
+4
arch/arm/mach-mxs/devices-mx23.h
··· 21 21 #define mx23_add_auart0() mx23_add_auart(0) 22 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 28 extern const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst; 25 29 #define mx23_add_mxs_mmc(id, pdata) \ 26 30 mxs_add_mxs_mmc(&mx23_mxs_mmc_data[id], pdata)
+4
arch/arm/mach-mxs/devices-mx28.h
··· 34 34 #define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata) 35 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 41 extern const struct mxs_mxs_i2c_data mx28_mxs_i2c_data[] __initconst; 38 42 #define mx28_add_mxs_i2c(id) mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id]) 39 43
+3
arch/arm/mach-mxs/devices/Kconfig
··· 12 12 select HAVE_CAN_FLEXCAN if CAN 13 13 bool 14 14 15 + config MXS_HAVE_PLATFORM_GPMI_NAND 16 + bool 17 + 15 18 config MXS_HAVE_PLATFORM_MXS_I2C 16 19 bool 17 20
+1
arch/arm/mach-mxs/devices/Makefile
··· 3 3 obj-y += platform-dma.o 4 4 obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o 5 5 obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o 6 + obj-$(CONFIG_MXS_HAVE_PLATFORM_GPMI_NAND) += platform-gpmi-nand.o 6 7 obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o 7 8 obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o 8 9 obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o
+81
arch/arm/mach-mxs/devices/platform-gpmi-nand.c
··· 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 + }
+10
arch/arm/mach-mxs/include/mach/devices-common.h
··· 66 66 const struct mxs_flexcan_data *data, 67 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 79 /* i2c */ 70 80 struct mxs_mxs_i2c_data { 71 81 int id;
+27 -4
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
··· 29 29 30 30 #include "omap_hwmod_common_data.h" 31 31 32 + #include "smartreflex.h" 32 33 #include "prm-regbits-34xx.h" 33 34 #include "cm-regbits-34xx.h" 34 35 #include "wd_timer.h" ··· 375 374 } 376 375 }, 377 376 .user = OCP_USER_MPU | OCP_USER_SDMA, 377 + }; 378 + 379 + static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = { 380 + { .irq = 18}, 381 + { .irq = -1 } 382 + }; 383 + 384 + static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = { 385 + { .irq = 19}, 386 + { .irq = -1 } 378 387 }; 379 388 380 389 /* L4 CORE -> SR1 interface */ ··· 2675 2664 }; 2676 2665 2677 2666 /* SR1 */ 2667 + static struct omap_smartreflex_dev_attr sr1_dev_attr = { 2668 + .sensor_voltdm_name = "mpu_iva", 2669 + }; 2670 + 2678 2671 static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = { 2679 2672 &omap3_l4_core__sr1, 2680 2673 }; ··· 2687 2672 .name = "sr1_hwmod", 2688 2673 .class = &omap34xx_smartreflex_hwmod_class, 2689 2674 .main_clk = "sr1_fck", 2690 - .vdd_name = "mpu_iva", 2691 2675 .prcm = { 2692 2676 .omap2 = { 2693 2677 .prcm_reg_id = 1, ··· 2698 2684 }, 2699 2685 .slaves = omap3_sr1_slaves, 2700 2686 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), 2687 + .dev_attr = &sr1_dev_attr, 2688 + .mpu_irqs = omap3_smartreflex_mpu_irqs, 2701 2689 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2702 2690 }; 2703 2691 ··· 2707 2691 .name = "sr1_hwmod", 2708 2692 .class = &omap36xx_smartreflex_hwmod_class, 2709 2693 .main_clk = "sr1_fck", 2710 - .vdd_name = "mpu_iva", 2711 2694 .prcm = { 2712 2695 .omap2 = { 2713 2696 .prcm_reg_id = 1, ··· 2718 2703 }, 2719 2704 .slaves = omap3_sr1_slaves, 2720 2705 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), 2706 + .dev_attr = &sr1_dev_attr, 2707 + .mpu_irqs = omap3_smartreflex_mpu_irqs, 2721 2708 }; 2722 2709 2723 2710 /* SR2 */ 2711 + static struct omap_smartreflex_dev_attr sr2_dev_attr = { 2712 + .sensor_voltdm_name = "core", 2713 + }; 2714 + 2724 2715 static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = { 2725 2716 &omap3_l4_core__sr2, 2726 2717 }; ··· 2735 2714 .name = "sr2_hwmod", 2736 2715 .class = &omap34xx_smartreflex_hwmod_class, 2737 2716 .main_clk = "sr2_fck", 2738 - .vdd_name = "core", 2739 2717 .prcm = { 2740 2718 .omap2 = { 2741 2719 .prcm_reg_id = 1, ··· 2746 2726 }, 2747 2727 .slaves = omap3_sr2_slaves, 2748 2728 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), 2729 + .dev_attr = &sr2_dev_attr, 2730 + .mpu_irqs = omap3_smartreflex_core_irqs, 2749 2731 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2750 2732 }; 2751 2733 ··· 2755 2733 .name = "sr2_hwmod", 2756 2734 .class = &omap36xx_smartreflex_hwmod_class, 2757 2735 .main_clk = "sr2_fck", 2758 - .vdd_name = "core", 2759 2736 .prcm = { 2760 2737 .omap2 = { 2761 2738 .prcm_reg_id = 1, ··· 2766 2745 }, 2767 2746 .slaves = omap3_sr2_slaves, 2768 2747 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), 2748 + .dev_attr = &sr2_dev_attr, 2749 + .mpu_irqs = omap3_smartreflex_core_irqs, 2769 2750 }; 2770 2751 2771 2752 /*
+16 -3
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
··· 33 33 34 34 #include "omap_hwmod_common_data.h" 35 35 36 + #include "smartreflex.h" 36 37 #include "cm1_44xx.h" 37 38 #include "cm2_44xx.h" 38 39 #include "prm44xx.h" ··· 3963 3962 }; 3964 3963 3965 3964 /* smartreflex_core */ 3965 + static struct omap_smartreflex_dev_attr smartreflex_core_dev_attr = { 3966 + .sensor_voltdm_name = "core", 3967 + }; 3968 + 3966 3969 static struct omap_hwmod omap44xx_smartreflex_core_hwmod; 3967 3970 static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = { 3968 3971 { .irq = 19 + OMAP44XX_IRQ_GIC_START }, ··· 4003 3998 .mpu_irqs = omap44xx_smartreflex_core_irqs, 4004 3999 4005 4000 .main_clk = "smartreflex_core_fck", 4006 - .vdd_name = "core", 4007 4001 .prcm = { 4008 4002 .omap4 = { 4009 4003 .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET, ··· 4012 4008 }, 4013 4009 .slaves = omap44xx_smartreflex_core_slaves, 4014 4010 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves), 4011 + .dev_attr = &smartreflex_core_dev_attr, 4015 4012 }; 4016 4013 4017 4014 /* smartreflex_iva */ 4015 + static struct omap_smartreflex_dev_attr smartreflex_iva_dev_attr = { 4016 + .sensor_voltdm_name = "iva", 4017 + }; 4018 + 4018 4019 static struct omap_hwmod omap44xx_smartreflex_iva_hwmod; 4019 4020 static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = { 4020 4021 { .irq = 102 + OMAP44XX_IRQ_GIC_START }, ··· 4055 4046 .clkdm_name = "l4_ao_clkdm", 4056 4047 .mpu_irqs = omap44xx_smartreflex_iva_irqs, 4057 4048 .main_clk = "smartreflex_iva_fck", 4058 - .vdd_name = "iva", 4059 4049 .prcm = { 4060 4050 .omap4 = { 4061 4051 .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET, ··· 4064 4056 }, 4065 4057 .slaves = omap44xx_smartreflex_iva_slaves, 4066 4058 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves), 4059 + .dev_attr = &smartreflex_iva_dev_attr, 4067 4060 }; 4068 4061 4069 4062 /* smartreflex_mpu */ 4063 + static struct omap_smartreflex_dev_attr smartreflex_mpu_dev_attr = { 4064 + .sensor_voltdm_name = "mpu", 4065 + }; 4066 + 4070 4067 static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod; 4071 4068 static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = { 4072 4069 { .irq = 18 + OMAP44XX_IRQ_GIC_START }, ··· 4107 4094 .clkdm_name = "l4_ao_clkdm", 4108 4095 .mpu_irqs = omap44xx_smartreflex_mpu_irqs, 4109 4096 .main_clk = "smartreflex_mpu_fck", 4110 - .vdd_name = "mpu", 4111 4097 .prcm = { 4112 4098 .omap4 = { 4113 4099 .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET, ··· 4116 4104 }, 4117 4105 .slaves = omap44xx_smartreflex_mpu_slaves, 4118 4106 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves), 4107 + .dev_attr = &smartreflex_mpu_dev_attr, 4119 4108 }; 4120 4109 4121 4110 /*
+1
arch/arm/mach-omap2/smartreflex-class3.c
··· 29 29 30 30 static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset) 31 31 { 32 + sr_disable_errgen(voltdm); 32 33 omap_vp_disable(voltdm); 33 34 sr_disable(voltdm); 34 35 if (is_volt_reset)
+168 -59
arch/arm/mach-omap2/smartreflex.c
··· 36 36 #define SR_DISABLE_TIMEOUT 200 37 37 38 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 45 int srid; 40 46 int ip_type; 41 47 int nvalue_count; ··· 55 49 u32 senp_avgweight; 56 50 u32 senp_mod; 57 51 u32 senn_mod; 58 - unsigned int irq; 59 52 void __iomem *base; 60 - struct platform_device *pdev; 61 - struct list_head node; 62 - struct omap_sr_nvalue_table *nvalue_table; 63 - struct voltagedomain *voltdm; 64 - struct dentry *dbg_dir; 65 53 }; 66 54 67 55 /* sr_list contains all the instances of smartreflex module */ ··· 74 74 u32 value) 75 75 { 76 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 79 * Smartreflex error config register is special as it contains ··· 84 88 * if they are currently set, but does allow the caller to write 85 89 * those bits. 86 90 */ 87 - if (sr->ip_type == SR_TYPE_V1) { 88 - errconfig_offs = ERRCONFIG_V1; 89 - errconfig_mask = ERRCONFIG_STATUS_V1_MASK; 90 - } else if (sr->ip_type == SR_TYPE_V2) { 91 - errconfig_offs = ERRCONFIG_V2; 92 - errconfig_mask = ERRCONFIG_VPBOUNDINTST_V2; 93 - } 91 + if (sr->ip_type == SR_TYPE_V1 && offset == ERRCONFIG_V1) 92 + mask |= ERRCONFIG_STATUS_V1_MASK; 93 + else if (sr->ip_type == SR_TYPE_V2 && offset == ERRCONFIG_V2) 94 + mask |= ERRCONFIG_VPBOUNDINTST_V2; 94 95 95 - if (offset == errconfig_offs) 96 - reg_val &= ~errconfig_mask; 96 + reg_val = __raw_readl(sr->base + offset); 97 + reg_val &= ~mask; 98 + 99 + value &= mask; 97 100 98 101 reg_val |= value; 99 102 ··· 123 128 124 129 static irqreturn_t sr_interrupt(int irq, void *data) 125 130 { 126 - struct omap_sr *sr_info = (struct omap_sr *)data; 131 + struct omap_sr *sr_info = data; 127 132 u32 status = 0; 128 133 129 - if (sr_info->ip_type == SR_TYPE_V1) { 134 + switch (sr_info->ip_type) { 135 + case SR_TYPE_V1: 130 136 /* Read the status bits */ 131 137 status = sr_read_reg(sr_info, ERRCONFIG_V1); 132 138 133 139 /* Clear them by writing back */ 134 140 sr_write_reg(sr_info, ERRCONFIG_V1, status); 135 - } else if (sr_info->ip_type == SR_TYPE_V2) { 141 + break; 142 + case SR_TYPE_V2: 136 143 /* Read the status bits */ 137 144 status = sr_read_reg(sr_info, IRQSTATUS); 138 145 139 146 /* Clear them by writing back */ 140 147 sr_write_reg(sr_info, IRQSTATUS, status); 148 + break; 149 + default: 150 + dev_err(&sr_info->pdev->dev, "UNKNOWN IP type %d\n", 151 + sr_info->ip_type); 152 + return IRQ_NONE; 141 153 } 142 154 143 155 if (sr_class->notify) ··· 168 166 __func__); 169 167 return; 170 168 } 169 + 171 170 sys_clk_speed = clk_get_rate(sys_ck); 172 171 clk_put(sys_ck); 173 172 ··· 270 267 goto error; 271 268 } 272 269 ret = request_irq(sr_info->irq, sr_interrupt, 273 - 0, name, (void *)sr_info); 270 + 0, name, sr_info); 274 271 if (ret) 275 272 goto error; 276 273 disable_irq(sr_info->irq); ··· 291 288 "not function as desired\n", __func__); 292 289 kfree(name); 293 290 kfree(sr_info); 291 + 294 292 return ret; 295 293 } 296 294 297 295 static void sr_v1_disable(struct omap_sr *sr) 298 296 { 299 297 int timeout = 0; 298 + int errconf_val = ERRCONFIG_MCUACCUMINTST | ERRCONFIG_MCUVALIDINTST | 299 + ERRCONFIG_MCUBOUNDINTST; 300 300 301 301 /* Enable MCUDisableAcknowledge interrupt */ 302 302 sr_modify_reg(sr, ERRCONFIG_V1, ··· 308 302 /* SRCONFIG - disable SR */ 309 303 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); 310 304 311 - /* Disable all other SR interrupts and clear the status */ 305 + /* Disable all other SR interrupts and clear the status as needed */ 306 + if (sr_read_reg(sr, ERRCONFIG_V1) & ERRCONFIG_VPBOUNDINTST_V1) 307 + errconf_val |= ERRCONFIG_VPBOUNDINTST_V1; 312 308 sr_modify_reg(sr, ERRCONFIG_V1, 313 309 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | 314 310 ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_VPBOUNDINTEN_V1), 315 - (ERRCONFIG_MCUACCUMINTST | ERRCONFIG_MCUVALIDINTST | 316 - ERRCONFIG_MCUBOUNDINTST | 317 - ERRCONFIG_VPBOUNDINTST_V1)); 311 + errconf_val); 318 312 319 313 /* 320 314 * Wait for SR to be disabled. ··· 343 337 /* SRCONFIG - disable SR */ 344 338 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); 345 339 346 - /* Disable all other SR interrupts and clear the status */ 347 - sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, 340 + /* 341 + * Disable all other SR interrupts and clear the status 342 + * write to status register ONLY on need basis - only if status 343 + * is set. 344 + */ 345 + if (sr_read_reg(sr, ERRCONFIG_V2) & ERRCONFIG_VPBOUNDINTST_V2) 346 + sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, 348 347 ERRCONFIG_VPBOUNDINTST_V2); 348 + else 349 + sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, 350 + 0x0); 349 351 sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT | 350 352 IRQENABLE_MCUVALIDINT | 351 353 IRQENABLE_MCUBOUNDSINT)); ··· 412 398 */ 413 399 int sr_configure_errgen(struct voltagedomain *voltdm) 414 400 { 415 - u32 sr_config, sr_errconfig, errconfig_offs, vpboundint_en; 416 - u32 vpboundint_st, senp_en = 0, senn_en = 0; 401 + u32 sr_config, sr_errconfig, errconfig_offs; 402 + u32 vpboundint_en, vpboundint_st; 403 + u32 senp_en = 0, senn_en = 0; 417 404 u8 senp_shift, senn_shift; 418 405 struct omap_sr *sr = _sr_lookup(voltdm); 419 406 420 407 if (IS_ERR(sr)) { 421 408 pr_warning("%s: omap_sr struct for sr_%s not found\n", 422 409 __func__, voltdm->name); 423 - return -EINVAL; 410 + return PTR_ERR(sr); 424 411 } 425 412 426 413 if (!sr->clk_length) ··· 433 418 sr_config = (sr->clk_length << SRCONFIG_SRCLKLENGTH_SHIFT) | 434 419 SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN; 435 420 436 - if (sr->ip_type == SR_TYPE_V1) { 421 + switch (sr->ip_type) { 422 + case SR_TYPE_V1: 437 423 sr_config |= SRCONFIG_DELAYCTRL; 438 424 senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; 439 425 senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; 440 426 errconfig_offs = ERRCONFIG_V1; 441 427 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1; 442 428 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1; 443 - } else if (sr->ip_type == SR_TYPE_V2) { 429 + break; 430 + case SR_TYPE_V2: 444 431 senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; 445 432 senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; 446 433 errconfig_offs = ERRCONFIG_V2; 447 434 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2; 448 435 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2; 449 - } else { 436 + break; 437 + default: 450 438 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" 451 439 "module without specifying the ip\n", __func__); 452 440 return -EINVAL; ··· 465 447 sr_errconfig); 466 448 467 449 /* Enabling the interrupts if the ERROR module is used */ 468 - sr_modify_reg(sr, errconfig_offs, 469 - vpboundint_en, (vpboundint_en | vpboundint_st)); 450 + sr_modify_reg(sr, errconfig_offs, (vpboundint_en | vpboundint_st), 451 + vpboundint_en); 452 + 453 + return 0; 454 + } 455 + 456 + /** 457 + * sr_disable_errgen() - Disables SmartReflex AVS module's errgen component 458 + * @voltdm: VDD pointer to which the SR module to be configured belongs to. 459 + * 460 + * This API is to be called from the smartreflex class driver to 461 + * disable the error generator module inside the smartreflex module. 462 + * 463 + * Returns 0 on success and error value in case of failure. 464 + */ 465 + int sr_disable_errgen(struct voltagedomain *voltdm) 466 + { 467 + u32 errconfig_offs; 468 + u32 vpboundint_en, vpboundint_st; 469 + struct omap_sr *sr = _sr_lookup(voltdm); 470 + 471 + if (IS_ERR(sr)) { 472 + pr_warning("%s: omap_sr struct for sr_%s not found\n", 473 + __func__, voltdm->name); 474 + return PTR_ERR(sr); 475 + } 476 + 477 + switch (sr->ip_type) { 478 + case SR_TYPE_V1: 479 + errconfig_offs = ERRCONFIG_V1; 480 + vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1; 481 + vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1; 482 + break; 483 + case SR_TYPE_V2: 484 + errconfig_offs = ERRCONFIG_V2; 485 + vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2; 486 + vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2; 487 + break; 488 + default: 489 + dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" 490 + "module without specifying the ip\n", __func__); 491 + return -EINVAL; 492 + } 493 + 494 + /* Disable the interrupts of ERROR module */ 495 + sr_modify_reg(sr, errconfig_offs, vpboundint_en | vpboundint_st, 0); 496 + 497 + /* Disable the Sensor and errorgen */ 498 + sr_modify_reg(sr, SRCONFIG, SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN, 0); 470 499 471 500 return 0; 472 501 } ··· 540 475 if (IS_ERR(sr)) { 541 476 pr_warning("%s: omap_sr struct for sr_%s not found\n", 542 477 __func__, voltdm->name); 543 - return -EINVAL; 478 + return PTR_ERR(sr); 544 479 } 545 480 546 481 if (!sr->clk_length) ··· 553 488 SRCONFIG_SENENABLE | 554 489 (sr->accum_data << SRCONFIG_ACCUMDATA_SHIFT); 555 490 556 - if (sr->ip_type == SR_TYPE_V1) { 491 + switch (sr->ip_type) { 492 + case SR_TYPE_V1: 557 493 sr_config |= SRCONFIG_DELAYCTRL; 558 494 senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; 559 495 senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; 560 - } else if (sr->ip_type == SR_TYPE_V2) { 496 + break; 497 + case SR_TYPE_V2: 561 498 senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; 562 499 senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; 563 - } else { 500 + break; 501 + default: 564 502 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" 565 503 "module without specifying the ip\n", __func__); 566 504 return -EINVAL; ··· 579 511 * Enabling the interrupts if MINMAXAVG module is used. 580 512 * TODO: check if all the interrupts are mandatory 581 513 */ 582 - if (sr->ip_type == SR_TYPE_V1) { 514 + switch (sr->ip_type) { 515 + case SR_TYPE_V1: 583 516 sr_modify_reg(sr, ERRCONFIG_V1, 584 517 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | 585 518 ERRCONFIG_MCUBOUNDINTEN), 586 519 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUACCUMINTST | 587 520 ERRCONFIG_MCUVALIDINTEN | ERRCONFIG_MCUVALIDINTST | 588 521 ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_MCUBOUNDINTST)); 589 - } else if (sr->ip_type == SR_TYPE_V2) { 522 + break; 523 + case SR_TYPE_V2: 590 524 sr_write_reg(sr, IRQSTATUS, 591 525 IRQSTATUS_MCUACCUMINT | IRQSTATUS_MCVALIDINT | 592 526 IRQSTATUS_MCBOUNDSINT | IRQSTATUS_MCUDISABLEACKINT); 593 527 sr_write_reg(sr, IRQENABLE_SET, 594 528 IRQENABLE_MCUACCUMINT | IRQENABLE_MCUVALIDINT | 595 529 IRQENABLE_MCUBOUNDSINT | IRQENABLE_MCUDISABLEACKINT); 530 + break; 531 + default: 532 + dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" 533 + "module without specifying the ip\n", __func__); 534 + return -EINVAL; 596 535 } 597 536 598 537 return 0; ··· 618 543 */ 619 544 int sr_enable(struct voltagedomain *voltdm, unsigned long volt) 620 545 { 621 - u32 nvalue_reciprocal; 622 546 struct omap_volt_data *volt_data; 623 547 struct omap_sr *sr = _sr_lookup(voltdm); 548 + u32 nvalue_reciprocal; 624 549 int ret; 625 550 626 551 if (IS_ERR(sr)) { 627 552 pr_warning("%s: omap_sr struct for sr_%s not found\n", 628 553 __func__, voltdm->name); 629 - return -EINVAL; 554 + return PTR_ERR(sr); 630 555 } 631 556 632 557 volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); ··· 634 559 if (IS_ERR(volt_data)) { 635 560 dev_warn(&sr->pdev->dev, "%s: Unable to get voltage table" 636 561 "for nominal voltage %ld\n", __func__, volt); 637 - return -ENODATA; 562 + return PTR_ERR(volt_data); 638 563 } 639 564 640 565 nvalue_reciprocal = sr_retrieve_nvalue(sr, volt_data->sr_efuse_offs); ··· 692 617 * disable the clocks. 693 618 */ 694 619 if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE) { 695 - if (sr->ip_type == SR_TYPE_V1) 620 + switch (sr->ip_type) { 621 + case SR_TYPE_V1: 696 622 sr_v1_disable(sr); 697 - else if (sr->ip_type == SR_TYPE_V2) 623 + break; 624 + case SR_TYPE_V2: 698 625 sr_v2_disable(sr); 626 + break; 627 + default: 628 + dev_err(&sr->pdev->dev, "UNKNOWN IP type %d\n", 629 + sr->ip_type); 630 + } 699 631 } 700 632 701 633 pm_runtime_put_sync_suspend(&sr->pdev->dev); ··· 861 779 sr_pmic_data = pmic_data; 862 780 } 863 781 864 - /* PM Debug Fs enteries to enable disable smartreflex. */ 782 + /* PM Debug FS entries to enable and disable smartreflex. */ 865 783 static int omap_sr_autocomp_show(void *data, u64 *val) 866 784 { 867 - struct omap_sr *sr_info = (struct omap_sr *) data; 785 + struct omap_sr *sr_info = data; 868 786 869 787 if (!sr_info) { 870 788 pr_warning("%s: omap_sr struct not found\n", __func__); ··· 878 796 879 797 static int omap_sr_autocomp_store(void *data, u64 val) 880 798 { 881 - struct omap_sr *sr_info = (struct omap_sr *) data; 799 + struct omap_sr *sr_info = data; 882 800 883 801 if (!sr_info) { 884 802 pr_warning("%s: omap_sr struct not found\n", __func__); ··· 886 804 } 887 805 888 806 /* Sanity check */ 889 - if (val && (val != 1)) { 807 + if (val > 1) { 890 808 pr_warning("%s: Invalid argument %lld\n", __func__, val); 891 809 return -EINVAL; 892 810 } ··· 903 821 } 904 822 905 823 DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show, 906 - omap_sr_autocomp_store, "%llu\n"); 824 + omap_sr_autocomp_store, "%llu\n"); 907 825 908 826 static int __init omap_sr_probe(struct platform_device *pdev) 909 827 { 910 - struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); 828 + struct omap_sr *sr_info; 911 829 struct omap_sr_data *pdata = pdev->dev.platform_data; 912 830 struct resource *mem, *irq; 913 831 struct dentry *nvalue_dir; ··· 915 833 int i, ret = 0; 916 834 char *name; 917 835 836 + sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); 918 837 if (!sr_info) { 919 838 dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", 920 839 __func__); 921 840 return -ENOMEM; 922 841 } 842 + 843 + platform_set_drvdata(pdev, sr_info); 923 844 924 845 if (!pdata) { 925 846 dev_err(&pdev->dev, "%s: platform data missing\n", __func__); ··· 989 904 dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__); 990 905 if (!sr_dbg_dir) { 991 906 sr_dbg_dir = debugfs_create_dir("smartreflex", NULL); 992 - if (!sr_dbg_dir) { 907 + if (IS_ERR_OR_NULL(sr_dbg_dir)) { 993 908 ret = PTR_ERR(sr_dbg_dir); 994 909 pr_err("%s:sr debugfs dir creation failed(%d)\n", 995 910 __func__, ret); ··· 1006 921 } 1007 922 sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir); 1008 923 kfree(name); 1009 - if (IS_ERR(sr_info->dbg_dir)) { 924 + if (IS_ERR_OR_NULL(sr_info->dbg_dir)) { 1010 925 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", 1011 926 __func__); 1012 927 ret = PTR_ERR(sr_info->dbg_dir); ··· 1023 938 &sr_info->err_minlimit); 1024 939 1025 940 nvalue_dir = debugfs_create_dir("nvalue", sr_info->dbg_dir); 1026 - if (IS_ERR(nvalue_dir)) { 941 + if (IS_ERR_OR_NULL(nvalue_dir)) { 1027 942 dev_err(&pdev->dev, "%s: Unable to create debugfs directory" 1028 943 "for n-values\n", __func__); 1029 944 ret = PTR_ERR(nvalue_dir); ··· 1079 994 if (IS_ERR(sr_info)) { 1080 995 dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", 1081 996 __func__); 1082 - return -EINVAL; 997 + return PTR_ERR(sr_info); 1083 998 } 1084 999 1085 1000 if (sr_info->autocomp_active) ··· 1096 1011 return 0; 1097 1012 } 1098 1013 1014 + static void __devexit omap_sr_shutdown(struct platform_device *pdev) 1015 + { 1016 + struct omap_sr_data *pdata = pdev->dev.platform_data; 1017 + struct omap_sr *sr_info; 1018 + 1019 + if (!pdata) { 1020 + dev_err(&pdev->dev, "%s: platform data missing\n", __func__); 1021 + return; 1022 + } 1023 + 1024 + sr_info = _sr_lookup(pdata->voltdm); 1025 + if (IS_ERR(sr_info)) { 1026 + dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", 1027 + __func__); 1028 + return; 1029 + } 1030 + 1031 + if (sr_info->autocomp_active) 1032 + sr_stop_vddautocomp(sr_info); 1033 + 1034 + return; 1035 + } 1036 + 1099 1037 static struct platform_driver smartreflex_driver = { 1100 1038 .remove = __devexit_p(omap_sr_remove), 1039 + .shutdown = __devexit_p(omap_sr_shutdown), 1101 1040 .driver = { 1102 1041 .name = "smartreflex", 1103 1042 }, ··· 1151 1042 1152 1043 return 0; 1153 1044 } 1045 + late_initcall(sr_init); 1154 1046 1155 1047 static void __exit sr_exit(void) 1156 1048 { 1157 1049 platform_driver_unregister(&smartreflex_driver); 1158 1050 } 1159 - late_initcall(sr_init); 1160 1051 module_exit(sr_exit); 1161 1052 1162 1053 MODULE_DESCRIPTION("OMAP Smartreflex Driver");
+10
arch/arm/mach-omap2/smartreflex.h
··· 152 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 164 #ifdef CONFIG_OMAP_SMARTREFLEX 156 165 /* 157 166 * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR. ··· 240 231 int sr_enable(struct voltagedomain *voltdm, unsigned long volt); 241 232 void sr_disable(struct voltagedomain *voltdm); 242 233 int sr_configure_errgen(struct voltagedomain *voltdm); 234 + int sr_disable_errgen(struct voltagedomain *voltdm); 243 235 int sr_configure_minmax(struct voltagedomain *voltdm); 244 236 245 237 /* API to register the smartreflex class driver with the smartreflex driver */
+7 -4
arch/arm/mach-omap2/sr_device.c
··· 74 74 struct omap_sr_data *sr_data; 75 75 struct platform_device *pdev; 76 76 struct omap_volt_data *volt_data; 77 + struct omap_smartreflex_dev_attr *sr_dev_attr; 77 78 char *name = "smartreflex"; 78 79 static int i; 79 80 ··· 85 84 return -ENOMEM; 86 85 } 87 86 88 - if (!oh->vdd_name) { 87 + sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr; 88 + if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) { 89 89 pr_err("%s: No voltage domain specified for %s." 90 - "Cannot initialize\n", __func__, oh->name); 90 + "Cannot initialize\n", __func__, 91 + oh->name); 91 92 goto exit; 92 93 } 93 94 ··· 97 94 sr_data->senn_mod = 0x1; 98 95 sr_data->senp_mod = 0x1; 99 96 100 - sr_data->voltdm = voltdm_lookup(oh->vdd_name); 97 + sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); 101 98 if (IS_ERR(sr_data->voltdm)) { 102 99 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", 103 - __func__, oh->vdd_name); 100 + __func__, sr_dev_attr->sensor_voltdm_name); 104 101 goto exit; 105 102 } 106 103
+23 -5
arch/arm/mach-pxa/devices.c
··· 406 406 [1] = { 407 407 .start = IRQ_RTC1Hz, 408 408 .end = IRQ_RTC1Hz, 409 + .name = "rtc 1Hz", 409 410 .flags = IORESOURCE_IRQ, 410 411 }, 411 412 [2] = { 412 413 .start = IRQ_RTCAlrm, 413 414 .end = IRQ_RTCAlrm, 415 + .name = "rtc alarm", 414 416 .flags = IORESOURCE_IRQ, 415 417 }, 416 - }; 417 - 418 - struct platform_device sa1100_device_rtc = { 419 - .name = "sa1100-rtc", 420 - .id = -1, 421 418 }; 422 419 423 420 struct platform_device pxa_device_rtc = { ··· 422 425 .id = -1, 423 426 .num_resources = ARRAY_SIZE(pxa_rtc_resources), 424 427 .resource = pxa_rtc_resources, 428 + }; 429 + 430 + static struct resource sa1100_rtc_resources[] = { 431 + { 432 + .start = IRQ_RTC1Hz, 433 + .end = IRQ_RTC1Hz, 434 + .name = "rtc 1Hz", 435 + .flags = IORESOURCE_IRQ, 436 + }, { 437 + .start = IRQ_RTCAlrm, 438 + .end = IRQ_RTCAlrm, 439 + .name = "rtc alarm", 440 + .flags = IORESOURCE_IRQ, 441 + }, 442 + }; 443 + 444 + struct platform_device sa1100_device_rtc = { 445 + .name = "sa1100-rtc", 446 + .id = -1, 447 + .num_resources = ARRAY_SIZE(sa1100_rtc_resources), 448 + .resource = sa1100_rtc_resources, 425 449 }; 426 450 427 451 static struct resource pxa_ac97_resources[] = {
+27 -6
arch/arm/mach-pxa/hx4700.c
··· 28 28 #include <linux/mtd/physmap.h> 29 29 #include <linux/pda_power.h> 30 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 33 #include <linux/regulator/machine.h> 33 34 #include <linux/regulator/max1586.h> 34 35 #include <linux/spi/ads7846.h> ··· 699 698 .consumer_supplies = bq24022_consumers, 700 699 }; 701 700 702 - static struct bq24022_mach_info bq24022_info = { 703 - .gpio_nce = GPIO72_HX4700_BQ24022_nCHARGE_EN, 704 - .gpio_iset2 = GPIO96_HX4700_BQ24022_ISET2, 705 - .init_data = &bq24022_init_data, 701 + static struct gpio bq24022_gpios[] = { 702 + { GPIO96_HX4700_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" }, 703 + }; 704 + 705 + static struct gpio_regulator_state bq24022_states[] = { 706 + { .value = 100000, .gpios = (0 << 0) }, 707 + { .value = 500000, .gpios = (1 << 0) }, 708 + }; 709 + 710 + static struct gpio_regulator_config bq24022_info = { 711 + .supply_name = "bq24022", 712 + 713 + .enable_gpio = GPIO72_HX4700_BQ24022_nCHARGE_EN, 714 + .enable_high = 0, 715 + .enabled_at_boot = 0, 716 + 717 + .gpios = bq24022_gpios, 718 + .nr_gpios = ARRAY_SIZE(bq24022_gpios), 719 + 720 + .states = bq24022_states, 721 + .nr_states = ARRAY_SIZE(bq24022_states), 722 + 723 + .type = REGULATOR_CURRENT, 724 + .init_data = &bq24022_init_data, 706 725 }; 707 726 708 727 static struct platform_device bq24022 = { 709 - .name = "bq24022", 728 + .name = "gpio-regulator", 710 729 .id = -1, 711 730 .dev = { 712 731 .platform_data = &bq24022_info,
+27 -6
arch/arm/mach-pxa/magician.c
··· 25 25 #include <linux/mtd/physmap.h> 26 26 #include <linux/pda_power.h> 27 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 30 #include <linux/regulator/machine.h> 30 31 #include <linux/usb/gpio_vbus.h> 31 32 #include <linux/i2c/pxa-i2c.h> ··· 597 596 .consumer_supplies = bq24022_consumers, 598 597 }; 599 598 600 - static struct bq24022_mach_info bq24022_info = { 601 - .gpio_nce = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, 602 - .gpio_iset2 = EGPIO_MAGICIAN_BQ24022_ISET2, 603 - .init_data = &bq24022_init_data, 599 + static struct gpio bq24022_gpios[] = { 600 + { EGPIO_MAGICIAN_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" }, 601 + }; 602 + 603 + static struct gpio_regulator_state bq24022_states[] = { 604 + { .value = 100000, .gpios = (0 << 0) }, 605 + { .value = 500000, .gpios = (1 << 0) }, 606 + }; 607 + 608 + static struct gpio_regulator_config bq24022_info = { 609 + .supply_name = "bq24022", 610 + 611 + .enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, 612 + .enable_high = 0, 613 + .enabled_at_boot = 0, 614 + 615 + .gpios = bq24022_gpios, 616 + .nr_gpios = ARRAY_SIZE(bq24022_gpios), 617 + 618 + .states = bq24022_states, 619 + .nr_states = ARRAY_SIZE(bq24022_states), 620 + 621 + .type = REGULATOR_CURRENT, 622 + .init_data = &bq24022_init_data, 604 623 }; 605 624 606 625 static struct platform_device bq24022 = { 607 - .name = "bq24022", 626 + .name = "gpio-regulator", 608 627 .id = -1, 609 628 .dev = { 610 629 .platform_data = &bq24022_info,
+1
arch/arm/mach-pxa/pxa3xx.c
··· 89 89 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), 90 90 INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), 91 91 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL), 92 + INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), 92 93 }; 93 94 94 95 #ifdef CONFIG_PM
+1
arch/arm/mach-pxa/pxa95x.c
··· 231 231 INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL), 232 232 INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL), 233 233 INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL), 234 + INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), 234 235 }; 235 236 236 237 void __init pxa95x_init_irq(void)
+2
arch/arm/mach-s3c24xx/s3c2416.c
··· 59 59 #include <plat/fb-core.h> 60 60 #include <plat/nand-core.h> 61 61 #include <plat/adc-core.h> 62 + #include <plat/rtc-core.h> 62 63 63 64 static struct map_desc s3c2416_iodesc[] __initdata = { 64 65 IODESC_ENT(WATCHDOG), ··· 99 98 s3c_fb_setname("s3c2443-fb"); 100 99 101 100 s3c_adc_setname("s3c2416-adc"); 101 + s3c_rtc_setname("s3c2416-rtc"); 102 102 103 103 #ifdef CONFIG_PM 104 104 register_syscore_ops(&s3c2416_pm_syscore_ops);
+2
arch/arm/mach-s3c24xx/s3c2443.c
··· 41 41 #include <plat/fb-core.h> 42 42 #include <plat/nand-core.h> 43 43 #include <plat/adc-core.h> 44 + #include <plat/rtc-core.h> 44 45 45 46 static struct map_desc s3c2443_iodesc[] __initdata = { 46 47 IODESC_ENT(WATCHDOG), ··· 74 73 s3c_fb_setname("s3c2443-fb"); 75 74 76 75 s3c_adc_setname("s3c2443-adc"); 76 + s3c_rtc_setname("s3c2443-rtc"); 77 77 78 78 /* change WDT IRQ number */ 79 79 s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
+47 -35
arch/arm/mach-sa1100/clock.c
··· 11 11 #include <linux/clk.h> 12 12 #include <linux/spinlock.h> 13 13 #include <linux/mutex.h> 14 + #include <linux/io.h> 15 + #include <linux/clkdev.h> 14 16 15 17 #include <mach/hardware.h> 16 18 17 - /* 18 - * Very simple clock implementation - we only have one clock to deal with. 19 - */ 19 + struct clkops { 20 + void (*enable)(struct clk *); 21 + void (*disable)(struct clk *); 22 + }; 23 + 20 24 struct clk { 25 + const struct clkops *ops; 21 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 39 * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: ··· 44 32 TUCR = TUCR_3_6864MHz; 45 33 } 46 34 47 - static void clk_gpio27_disable(void) 35 + static void clk_gpio27_disable(struct clk *clk) 48 36 { 49 37 TUCR = 0; 50 38 GPDR &= ~GPIO_32_768kHz; 51 39 GAFR &= ~GPIO_32_768kHz; 52 40 } 53 41 54 - static struct clk clk_gpio27; 55 - 56 - static DEFINE_SPINLOCK(clocks_lock); 57 - 58 - struct clk *clk_get(struct device *dev, const char *id) 59 - { 60 - const char *devname = dev_name(dev); 61 - 62 - return strcmp(devname, "sa1111.0") ? ERR_PTR(-ENOENT) : &clk_gpio27; 63 - } 64 - EXPORT_SYMBOL(clk_get); 65 - 66 - void clk_put(struct clk *clk) 67 - { 68 - } 69 - EXPORT_SYMBOL(clk_put); 70 - 71 42 int clk_enable(struct clk *clk) 72 43 { 73 44 unsigned long flags; 74 45 75 - spin_lock_irqsave(&clocks_lock, flags); 76 - if (clk->enabled++ == 0) 77 - clk_gpio27_enable(); 78 - spin_unlock_irqrestore(&clocks_lock, flags); 46 + if (clk) { 47 + spin_lock_irqsave(&clocks_lock, flags); 48 + if (clk->enabled++ == 0) 49 + clk->ops->enable(clk); 50 + spin_unlock_irqrestore(&clocks_lock, flags); 51 + } 52 + 79 53 return 0; 80 54 } 81 55 EXPORT_SYMBOL(clk_enable); ··· 70 72 { 71 73 unsigned long flags; 72 74 73 - WARN_ON(clk->enabled == 0); 74 - 75 - spin_lock_irqsave(&clocks_lock, flags); 76 - if (--clk->enabled == 0) 77 - clk_gpio27_disable(); 78 - spin_unlock_irqrestore(&clocks_lock, flags); 75 + if (clk) { 76 + WARN_ON(clk->enabled == 0); 77 + spin_lock_irqsave(&clocks_lock, flags); 78 + if (--clk->enabled == 0) 79 + clk->ops->disable(clk); 80 + spin_unlock_irqrestore(&clocks_lock, flags); 81 + } 79 82 } 80 83 EXPORT_SYMBOL(clk_disable); 81 84 82 - unsigned long clk_get_rate(struct clk *clk) 85 + const struct clkops clk_gpio27_ops = { 86 + .enable = clk_gpio27_enable, 87 + .disable = clk_gpio27_disable, 88 + }; 89 + 90 + static DEFINE_CLK(gpio27, &clk_gpio27_ops); 91 + 92 + static struct clk_lookup sa11xx_clkregs[] = { 93 + CLKDEV_INIT("sa1111.0", NULL, &clk_gpio27), 94 + CLKDEV_INIT("sa1100-rtc", NULL, NULL), 95 + }; 96 + 97 + static int __init sa11xx_clk_init(void) 83 98 { 84 - return 3686400; 99 + clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs)); 100 + return 0; 85 101 } 86 - EXPORT_SYMBOL(clk_get_rate); 102 + core_initcall(sa11xx_clk_init);
+8
arch/arm/mach-sa1100/generic.c
··· 345 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 354 static struct platform_device sa11x0rtc_device = { 349 355 .name = "sa1100-rtc", 350 356 .id = -1, 357 + .num_resources = ARRAY_SIZE(sa1100_rtc_resources), 358 + .resource = sa1100_rtc_resources, 351 359 }; 352 360 353 361 static struct platform_device *sa11x0_devices[] __initdata = {
+2 -1
arch/arm/mach-tegra/Makefile
··· 7 7 obj-y += timer.o 8 8 obj-y += pinmux.o 9 9 obj-y += fuse.o 10 + obj-y += pmc.o 10 11 obj-$(CONFIG_CPU_IDLE) += cpuidle.o 11 12 obj-$(CONFIG_CPU_IDLE) += sleep.o 12 13 obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o ··· 19 18 obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o 20 19 obj-$(CONFIG_SMP) += platsmp.o headsmp.o 21 20 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 22 - obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o 21 + obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o apbio.o 23 22 obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o 24 23 obj-$(CONFIG_TEGRA_PCI) += pcie.o 25 24 obj-$(CONFIG_USB_SUPPORT) += usb_phy.o
+145
arch/arm/mach-tegra/apbio.c
··· 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 + }
+39
arch/arm/mach-tegra/apbio.h
··· 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
-15
arch/arm/mach-tegra/board-harmony-power.c
··· 18 18 #include <linux/i2c.h> 19 19 #include <linux/platform_device.h> 20 20 #include <linux/gpio.h> 21 - #include <linux/io.h> 22 21 #include <linux/regulator/machine.h> 23 22 #include <linux/mfd/tps6586x.h> 24 23 25 - #include <mach/iomap.h> 26 24 #include <mach/irqs.h> 27 25 28 26 #include "board-harmony.h" 29 - 30 - #define PMC_CTRL 0x0 31 - #define PMC_CTRL_INTR_LOW (1 << 17) 32 27 33 28 static struct regulator_consumer_supply tps658621_ldo0_supply[] = { 34 29 REGULATOR_SUPPLY("pex_clk", NULL), ··· 110 115 111 116 int __init harmony_regulator_init(void) 112 117 { 113 - void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); 114 - u32 pmc_ctrl; 115 - 116 - /* 117 - * Configure the power management controller to trigger PMU 118 - * interrupts when low 119 - */ 120 - pmc_ctrl = readl(pmc + PMC_CTRL); 121 - writel(pmc_ctrl | PMC_CTRL_INTR_LOW, pmc + PMC_CTRL); 122 - 123 118 i2c_register_board_info(3, harmony_regulators, 1); 124 119 125 120 return 0;
+1 -1
arch/arm/mach-tegra/board-harmony.c
··· 101 101 static struct i2c_board_info __initdata wm8903_board_info = { 102 102 I2C_BOARD_INFO("wm8903", 0x1a), 103 103 .platform_data = &harmony_wm8903_pdata, 104 - .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), 105 104 }; 106 105 107 106 static void __init harmony_i2c_init(void) ··· 110 111 platform_device_register(&tegra_i2c_device3); 111 112 platform_device_register(&tegra_i2c_device4); 112 113 114 + wm8903_board_info.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ); 113 115 i2c_register_board_info(0, &wm8903_board_info, 1); 114 116 } 115 117
+3 -2
arch/arm/mach-tegra/board-seaboard.c
··· 159 159 160 160 static struct i2c_board_info __initdata isl29018_device = { 161 161 I2C_BOARD_INFO("isl29018", 0x44), 162 - .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_ISL29018_IRQ), 163 162 }; 164 163 165 164 static struct i2c_board_info __initdata adt7461_device = { ··· 182 183 static struct i2c_board_info __initdata wm8903_device = { 183 184 I2C_BOARD_INFO("wm8903", 0x1a), 184 185 .platform_data = &wm8903_pdata, 185 - .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), 186 186 }; 187 187 188 188 static int seaboard_ehci_init(void) ··· 212 214 gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018"); 213 215 gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ); 214 216 217 + isl29018_device.irq = gpio_to_irq(TEGRA_GPIO_ISL29018_IRQ); 215 218 i2c_register_board_info(0, &isl29018_device, 1); 219 + 220 + wm8903_device.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ); 216 221 i2c_register_board_info(0, &wm8903_device, 1); 217 222 218 223 i2c_register_board_info(3, &adt7461_device, 1);
+20
arch/arm/mach-tegra/common.c
··· 31 31 #include "board.h" 32 32 #include "clock.h" 33 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 53 #ifdef CONFIG_OF 36 54 static const struct of_device_id tegra_dt_irq_match[] __initconst = { ··· 117 99 tegra2_init_clocks(); 118 100 tegra_clk_init_from_table(tegra20_clk_init_table); 119 101 tegra_init_cache(0x331, 0x441); 102 + tegra_pmc_init(); 120 103 } 121 104 #endif 122 105 #ifdef CONFIG_ARCH_TEGRA_3x_SOC ··· 125 106 { 126 107 tegra30_init_clocks(); 127 108 tegra_init_cache(0x441, 0x551); 109 + tegra_pmc_init(); 128 110 } 129 111 #endif
+77 -51
arch/arm/mach-tegra/dma.c
··· 33 33 #include <mach/iomap.h> 34 34 #include <mach/suspend.h> 35 35 36 + #include "apbio.h" 37 + 36 38 #define APB_DMA_GEN 0x000 37 39 #define GEN_ENABLE (1<<31) 38 40 ··· 52 50 #define CSR_ONCE (1<<27) 53 51 #define CSR_FLOW (1<<21) 54 52 #define CSR_REQ_SEL_SHIFT 16 55 - #define CSR_REQ_SEL_MASK (0x1F<<CSR_REQ_SEL_SHIFT) 56 - #define CSR_REQ_SEL_INVALID (31<<CSR_REQ_SEL_SHIFT) 57 53 #define CSR_WCOUNT_SHIFT 2 58 54 #define CSR_WCOUNT_MASK 0xFFFC 59 55 ··· 133 133 134 134 static bool tegra_dma_initialized; 135 135 static DEFINE_MUTEX(tegra_dma_lock); 136 + static DEFINE_SPINLOCK(enable_lock); 136 137 137 138 static DECLARE_BITMAP(channel_usage, NV_DMA_MAX_CHANNELS); 138 139 static struct tegra_dma_channel dma_channels[NV_DMA_MAX_CHANNELS]; ··· 181 180 182 181 static int tegra_dma_cancel(struct tegra_dma_channel *ch) 183 182 { 184 - u32 csr; 185 183 unsigned long irq_flags; 186 184 187 185 spin_lock_irqsave(&ch->lock, irq_flags); 188 186 while (!list_empty(&ch->list)) 189 187 list_del(ch->list.next); 190 - 191 - csr = readl(ch->addr + APB_DMA_CHAN_CSR); 192 - csr &= ~CSR_REQ_SEL_MASK; 193 - csr |= CSR_REQ_SEL_INVALID; 194 - writel(csr, ch->addr + APB_DMA_CHAN_CSR); 195 188 196 189 tegra_dma_stop(ch); 197 190 ··· 193 198 return 0; 194 199 } 195 200 201 + static unsigned int get_channel_status(struct tegra_dma_channel *ch, 202 + struct tegra_dma_req *req, bool is_stop_dma) 203 + { 204 + void __iomem *addr = IO_ADDRESS(TEGRA_APB_DMA_BASE); 205 + unsigned int status; 206 + 207 + if (is_stop_dma) { 208 + /* 209 + * STOP the DMA and get the transfer count. 210 + * Getting the transfer count is tricky. 211 + * - Globally disable DMA on all channels 212 + * - Read the channel's status register to know the number 213 + * of pending bytes to be transfered. 214 + * - Stop the dma channel 215 + * - Globally re-enable DMA to resume other transfers 216 + */ 217 + spin_lock(&enable_lock); 218 + writel(0, addr + APB_DMA_GEN); 219 + udelay(20); 220 + status = readl(ch->addr + APB_DMA_CHAN_STA); 221 + tegra_dma_stop(ch); 222 + writel(GEN_ENABLE, addr + APB_DMA_GEN); 223 + spin_unlock(&enable_lock); 224 + if (status & STA_ISE_EOC) { 225 + pr_err("Got Dma Int here clearing"); 226 + writel(status, ch->addr + APB_DMA_CHAN_STA); 227 + } 228 + req->status = TEGRA_DMA_REQ_ERROR_ABORTED; 229 + } else { 230 + status = readl(ch->addr + APB_DMA_CHAN_STA); 231 + } 232 + return status; 233 + } 234 + 235 + /* should be called with the channel lock held */ 236 + static unsigned int dma_active_count(struct tegra_dma_channel *ch, 237 + struct tegra_dma_req *req, unsigned int status) 238 + { 239 + unsigned int to_transfer; 240 + unsigned int req_transfer_count; 241 + unsigned int bytes_transferred; 242 + 243 + to_transfer = ((status & STA_COUNT_MASK) >> STA_COUNT_SHIFT) + 1; 244 + req_transfer_count = ch->req_transfer_count + 1; 245 + bytes_transferred = req_transfer_count; 246 + if (status & STA_BUSY) 247 + bytes_transferred -= to_transfer; 248 + /* 249 + * In continuous transfer mode, DMA only tracks the count of the 250 + * half DMA buffer. So, if the DMA already finished half the DMA 251 + * then add the half buffer to the completed count. 252 + */ 253 + if (ch->mode & TEGRA_DMA_MODE_CONTINOUS) { 254 + if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL) 255 + bytes_transferred += req_transfer_count; 256 + if (status & STA_ISE_EOC) 257 + bytes_transferred += req_transfer_count; 258 + } 259 + bytes_transferred *= 4; 260 + return bytes_transferred; 261 + } 262 + 196 263 int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, 197 264 struct tegra_dma_req *_req) 198 265 { 199 - unsigned int csr; 200 266 unsigned int status; 201 267 struct tegra_dma_req *req = NULL; 202 268 int found = 0; 203 269 unsigned long irq_flags; 204 - int to_transfer; 205 - int req_transfer_count; 270 + int stop = 0; 206 271 207 272 spin_lock_irqsave(&ch->lock, irq_flags); 273 + 274 + if (list_entry(ch->list.next, struct tegra_dma_req, node) == _req) 275 + stop = 1; 276 + 208 277 list_for_each_entry(req, &ch->list, node) { 209 278 if (req == _req) { 210 279 list_del(&req->node); ··· 281 222 return 0; 282 223 } 283 224 284 - /* STOP the DMA and get the transfer count. 285 - * Getting the transfer count is tricky. 286 - * - Change the source selector to invalid to stop the DMA from 287 - * FIFO to memory. 288 - * - Read the status register to know the number of pending 289 - * bytes to be transferred. 290 - * - Finally stop or program the DMA to the next buffer in the 291 - * list. 292 - */ 293 - csr = readl(ch->addr + APB_DMA_CHAN_CSR); 294 - csr &= ~CSR_REQ_SEL_MASK; 295 - csr |= CSR_REQ_SEL_INVALID; 296 - writel(csr, ch->addr + APB_DMA_CHAN_CSR); 225 + if (!stop) 226 + goto skip_stop_dma; 297 227 298 - /* Get the transfer count */ 299 - status = readl(ch->addr + APB_DMA_CHAN_STA); 300 - to_transfer = (status & STA_COUNT_MASK) >> STA_COUNT_SHIFT; 301 - req_transfer_count = ch->req_transfer_count; 302 - req_transfer_count += 1; 303 - to_transfer += 1; 228 + status = get_channel_status(ch, req, true); 229 + req->bytes_transferred = dma_active_count(ch, req, status); 304 230 305 - req->bytes_transferred = req_transfer_count; 306 - 307 - if (status & STA_BUSY) 308 - req->bytes_transferred -= to_transfer; 309 - 310 - /* In continuous transfer mode, DMA only tracks the count of the 311 - * half DMA buffer. So, if the DMA already finished half the DMA 312 - * then add the half buffer to the completed count. 313 - * 314 - * FIXME: There can be a race here. What if the req to 315 - * dequue happens at the same time as the DMA just moved to 316 - * the new buffer and SW didn't yet received the interrupt? 317 - */ 318 - if (ch->mode & TEGRA_DMA_MODE_CONTINOUS) 319 - if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL) 320 - req->bytes_transferred += req_transfer_count; 321 - 322 - req->bytes_transferred *= 4; 323 - 324 - tegra_dma_stop(ch); 325 231 if (!list_empty(&ch->list)) { 326 232 /* if the list is not empty, queue the next request */ 327 233 struct tegra_dma_req *next_req; ··· 294 270 typeof(*next_req), node); 295 271 tegra_dma_update_hw(ch, next_req); 296 272 } 273 + 274 + skip_stop_dma: 297 275 req->status = -TEGRA_DMA_REQ_ERROR_ABORTED; 298 276 299 277 spin_unlock_irqrestore(&ch->lock, irq_flags); ··· 383 357 int channel; 384 358 struct tegra_dma_channel *ch = NULL; 385 359 386 - if (WARN_ON(!tegra_dma_initialized)) 360 + if (!tegra_dma_initialized) 387 361 return NULL; 388 362 389 363 mutex_lock(&tegra_dma_lock);
+75 -34
arch/arm/mach-tegra/fuse.c
··· 19 19 20 20 #include <linux/kernel.h> 21 21 #include <linux/io.h> 22 - #include <linux/module.h> 22 + #include <linux/export.h> 23 23 24 24 #include <mach/iomap.h> 25 25 26 26 #include "fuse.h" 27 + #include "apbio.h" 27 28 28 29 #define FUSE_UID_LOW 0x108 29 30 #define FUSE_UID_HIGH 0x10c 30 31 #define FUSE_SKU_INFO 0x110 31 32 #define FUSE_SPARE_BIT 0x200 32 33 33 - static inline u32 fuse_readl(unsigned long offset) 34 + int tegra_sku_id; 35 + int tegra_cpu_process_id; 36 + int tegra_core_process_id; 37 + enum tegra_revision tegra_revision; 38 + 39 + /* The BCT to use at boot is specified by board straps that can be read 40 + * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs. 41 + */ 42 + int tegra_bct_strapping; 43 + 44 + #define STRAP_OPT 0x008 45 + #define GMI_AD0 (1 << 4) 46 + #define GMI_AD1 (1 << 5) 47 + #define RAM_ID_MASK (GMI_AD0 | GMI_AD1) 48 + #define RAM_CODE_SHIFT 4 49 + 50 + static const char *tegra_revision_name[TEGRA_REVISION_MAX] = { 51 + [TEGRA_REVISION_UNKNOWN] = "unknown", 52 + [TEGRA_REVISION_A01] = "A01", 53 + [TEGRA_REVISION_A02] = "A02", 54 + [TEGRA_REVISION_A03] = "A03", 55 + [TEGRA_REVISION_A03p] = "A03 prime", 56 + [TEGRA_REVISION_A04] = "A04", 57 + }; 58 + 59 + static inline u32 tegra_fuse_readl(unsigned long offset) 34 60 { 35 - return readl(IO_TO_VIRT(TEGRA_FUSE_BASE + offset)); 61 + return tegra_apb_readl(TEGRA_FUSE_BASE + offset); 36 62 } 37 63 38 - static inline void fuse_writel(u32 value, unsigned long offset) 64 + static inline bool get_spare_fuse(int bit) 39 65 { 40 - writel(value, IO_TO_VIRT(TEGRA_FUSE_BASE + offset)); 66 + return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4); 67 + } 68 + 69 + static enum tegra_revision tegra_get_revision(void) 70 + { 71 + void __iomem *chip_id = IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804; 72 + u32 id = readl(chip_id); 73 + u32 minor_rev = (id >> 16) & 0xf; 74 + u32 chipid = (id >> 8) & 0xff; 75 + 76 + switch (minor_rev) { 77 + case 1: 78 + return TEGRA_REVISION_A01; 79 + case 2: 80 + return TEGRA_REVISION_A02; 81 + case 3: 82 + if (chipid == 0x20 && (get_spare_fuse(18) || get_spare_fuse(19))) 83 + return TEGRA_REVISION_A03p; 84 + else 85 + return TEGRA_REVISION_A03; 86 + case 4: 87 + return TEGRA_REVISION_A04; 88 + default: 89 + return TEGRA_REVISION_UNKNOWN; 90 + } 41 91 } 42 92 43 93 void tegra_init_fuse(void) ··· 96 46 reg |= 1 << 28; 97 47 writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); 98 48 99 - pr_info("Tegra SKU: %d CPU Process: %d Core Process: %d\n", 100 - tegra_sku_id(), tegra_cpu_process_id(), 101 - tegra_core_process_id()); 49 + reg = tegra_fuse_readl(FUSE_SKU_INFO); 50 + tegra_sku_id = reg & 0xFF; 51 + 52 + reg = tegra_fuse_readl(FUSE_SPARE_BIT); 53 + tegra_cpu_process_id = (reg >> 6) & 3; 54 + 55 + reg = tegra_fuse_readl(FUSE_SPARE_BIT); 56 + tegra_core_process_id = (reg >> 12) & 3; 57 + 58 + reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT); 59 + tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT; 60 + 61 + tegra_revision = tegra_get_revision(); 62 + 63 + pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n", 64 + tegra_revision_name[tegra_get_revision()], 65 + tegra_sku_id, tegra_cpu_process_id, 66 + tegra_core_process_id); 102 67 } 103 68 104 69 unsigned long long tegra_chip_uid(void) 105 70 { 106 71 unsigned long long lo, hi; 107 72 108 - lo = fuse_readl(FUSE_UID_LOW); 109 - hi = fuse_readl(FUSE_UID_HIGH); 73 + lo = tegra_fuse_readl(FUSE_UID_LOW); 74 + hi = tegra_fuse_readl(FUSE_UID_HIGH); 110 75 return (hi << 32ull) | lo; 111 76 } 112 77 EXPORT_SYMBOL(tegra_chip_uid); 113 - 114 - int tegra_sku_id(void) 115 - { 116 - int sku_id; 117 - u32 reg = fuse_readl(FUSE_SKU_INFO); 118 - sku_id = reg & 0xFF; 119 - return sku_id; 120 - } 121 - 122 - int tegra_cpu_process_id(void) 123 - { 124 - int cpu_process_id; 125 - u32 reg = fuse_readl(FUSE_SPARE_BIT); 126 - cpu_process_id = (reg >> 6) & 3; 127 - return cpu_process_id; 128 - } 129 - 130 - int tegra_core_process_id(void) 131 - { 132 - int core_process_id; 133 - u32 reg = fuse_readl(FUSE_SPARE_BIT); 134 - core_process_id = (reg >> 12) & 3; 135 - return core_process_id; 136 - }
+29 -5
arch/arm/mach-tegra/fuse.h
··· 1 1 /* 2 - * arch/arm/mach-tegra/fuse.c 3 - * 4 2 * Copyright (C) 2010 Google, Inc. 5 3 * 6 4 * Author: ··· 15 17 * 16 18 */ 17 19 20 + #ifndef __MACH_TEGRA_FUSE_H 21 + #define __MACH_TEGRA_FUSE_H 22 + 23 + enum tegra_revision { 24 + TEGRA_REVISION_UNKNOWN = 0, 25 + TEGRA_REVISION_A01, 26 + TEGRA_REVISION_A02, 27 + TEGRA_REVISION_A03, 28 + TEGRA_REVISION_A03p, 29 + TEGRA_REVISION_A04, 30 + TEGRA_REVISION_MAX, 31 + }; 32 + 33 + #define SKU_ID_T20 8 34 + #define SKU_ID_T25SE 20 35 + #define SKU_ID_AP25 23 36 + #define SKU_ID_T25 24 37 + #define SKU_ID_AP25E 27 38 + #define SKU_ID_T25E 28 39 + 40 + extern int tegra_sku_id; 41 + extern int tegra_cpu_process_id; 42 + extern int tegra_core_process_id; 43 + extern enum tegra_revision tegra_revision; 44 + 45 + extern int tegra_bct_strapping; 46 + 18 47 unsigned long long tegra_chip_uid(void); 19 - int tegra_sku_id(void); 20 - int tegra_cpu_process_id(void); 21 - int tegra_core_process_id(void); 22 48 void tegra_init_fuse(void); 49 + 50 + #endif
+77 -11
arch/arm/mach-tegra/include/mach/debug-macro.S
··· 1 1 /* 2 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 7 * Author: 7 8 * Colin Cross <ccross@google.com> 8 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 16 * This software is licensed under the terms of the GNU General Public 11 17 * License version 2, as published by the Free Software Foundation, and ··· 24 18 * 25 19 */ 26 20 21 + #include <linux/serial_reg.h> 22 + 27 23 #include <mach/io.h> 28 24 #include <mach/iomap.h> 25 + #include <mach/irammap.h> 29 26 30 - .macro addruart, rp, rv, tmp 31 - ldr \rp, =IO_APB_PHYS @ physical 32 - ldr \rv, =IO_APB_VIRT @ virtual 33 - orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF) 34 - orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF00) 35 - orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF) 36 - orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF00) 37 - .endm 27 + .macro addruart, rp, rv, tmp 28 + adr \rp, 99f @ actual addr of 99f 29 + ldr \rv, [\rp] @ linked addr is stored there 30 + sub \rv, \rv, \rp @ offset between the two 31 + ldr \rp, [\rp, #4] @ linked tegra_uart_config 32 + sub \tmp, \rp, \rv @ actual tegra_uart_config 33 + ldr \rp, [\tmp] @ Load tegra_uart_config 34 + cmp \rp, #1 @ needs intitialization? 35 + bne 100f @ no; go load the addresses 36 + mov \rv, #0 @ yes; record init is done 37 + str \rv, [\tmp] 38 + mov \rp, #TEGRA_IRAM_BASE @ See if cookie is in IRAM 39 + ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET] 40 + movw \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE & 0xffff 41 + movt \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE >> 16 42 + cmp \rv, \rp @ Cookie present? 43 + bne 100f @ No, use default UART 44 + mov \rp, #TEGRA_IRAM_BASE @ Load UART address from IRAM 45 + ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET + 4] 46 + str \rv, [\tmp, #4] @ Store in tegra_uart_phys 47 + sub \rv, \rv, #IO_APB_PHYS @ Calculate virt address 48 + add \rv, \rv, #IO_APB_VIRT 49 + str \rv, [\tmp, #8] @ Store in tegra_uart_virt 50 + b 100f 38 51 39 - #define UART_SHIFT 2 40 - #include <asm/hardware/debug-8250.S> 52 + .align 53 + 99: .word . 54 + .word tegra_uart_config 55 + .ltorg 41 56 57 + 100: ldr \rp, [\tmp, #4] @ Load tegra_uart_phys 58 + ldr \rv, [\tmp, #8] @ Load tegra_uart_virt 59 + .endm 60 + 61 + #define UART_SHIFT 2 62 + 63 + /* 64 + * Code below is swiped from <asm/hardware/debug-8250.S>, but add an extra 65 + * check to make sure that we aren't in the CONFIG_TEGRA_DEBUG_UART_NONE case. 66 + * We use the fact that all 5 valid UART addresses all have something in the 67 + * 2nd-to-lowest byte. 68 + */ 69 + 70 + .macro senduart, rd, rx 71 + tst \rx, #0x0000ff00 72 + strneb \rd, [\rx, #UART_TX << UART_SHIFT] 73 + 1001: 74 + .endm 75 + 76 + .macro busyuart, rd, rx 77 + tst \rx, #0x0000ff00 78 + beq 1002f 79 + 1001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT] 80 + and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE 81 + teq \rd, #UART_LSR_TEMT | UART_LSR_THRE 82 + bne 1001b 83 + 1002: 84 + .endm 85 + 86 + .macro waituart, rd, rx 87 + #ifdef FLOW_CONTROL 88 + tst \rx, #0x0000ff00 89 + beq 1002f 90 + 1001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT] 91 + tst \rd, #UART_MSR_CTS 92 + beq 1001b 93 + 1002: 94 + #endif 95 + .endm
-2
arch/arm/mach-tegra/include/mach/gpio-tegra.h
··· 25 25 26 26 #define TEGRA_NR_GPIOS INT_GPIO_NR 27 27 28 - #define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio)) 29 - 30 28 struct tegra_gpio_table { 31 29 int gpio; /* GPIO number */ 32 30 bool enable; /* Enable for GPIO at init? */
+35
arch/arm/mach-tegra/include/mach/irammap.h
··· 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
+109 -11
arch/arm/mach-tegra/include/mach/uncompress.h
··· 2 2 * arch/arm/mach-tegra/include/mach/uncompress.h 3 3 * 4 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 8 * Author: 7 9 * Colin Cross <ccross@google.com> 8 10 * Erik Gilling <konkers@google.com> 11 + * Doug Anderson <dianders@chromium.org> 12 + * Stephen Warren <swarren@nvidia.com> 9 13 * 10 14 * This software is licensed under the terms of the GNU General Public 11 15 * License version 2, as published by the Free Software Foundation, and ··· 29 25 #include <linux/serial_reg.h> 30 26 31 27 #include <mach/iomap.h> 28 + #include <mach/irammap.h> 29 + 30 + #define BIT(x) (1 << (x)) 31 + #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 32 + 33 + #define DEBUG_UART_SHIFT 2 34 + 35 + volatile u8 *uart; 32 36 33 37 static void putc(int c) 34 38 { 35 - volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; 36 - int shift = 2; 37 - 38 39 if (uart == NULL) 39 40 return; 40 41 41 - while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) 42 + while (!(uart[UART_LSR << DEBUG_UART_SHIFT] & UART_LSR_THRE)) 42 43 barrier(); 43 - uart[UART_TX << shift] = c; 44 + uart[UART_TX << DEBUG_UART_SHIFT] = c; 44 45 } 45 46 46 47 static inline void flush(void) 47 48 { 48 49 } 49 50 51 + static inline void save_uart_address(void) 52 + { 53 + u32 *buf = (u32 *)(TEGRA_IRAM_BASE + TEGRA_IRAM_DEBUG_UART_OFFSET); 54 + 55 + if (uart) { 56 + buf[0] = TEGRA_IRAM_DEBUG_UART_COOKIE; 57 + buf[1] = (u32)uart; 58 + } else 59 + buf[0] = 0; 60 + } 61 + 62 + /* 63 + * Setup before decompression. This is where we do UART selection for 64 + * earlyprintk and init the uart_base register. 65 + */ 50 66 static inline void arch_decomp_setup(void) 51 67 { 52 - volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; 53 - int shift = 2; 68 + static const struct { 69 + u32 base; 70 + u32 reset_reg; 71 + u32 clock_reg; 72 + u32 bit; 73 + } uarts[] = { 74 + { 75 + TEGRA_UARTA_BASE, 76 + TEGRA_CLK_RESET_BASE + 0x04, 77 + TEGRA_CLK_RESET_BASE + 0x10, 78 + 6, 79 + }, 80 + { 81 + TEGRA_UARTB_BASE, 82 + TEGRA_CLK_RESET_BASE + 0x04, 83 + TEGRA_CLK_RESET_BASE + 0x10, 84 + 7, 85 + }, 86 + { 87 + TEGRA_UARTC_BASE, 88 + TEGRA_CLK_RESET_BASE + 0x08, 89 + TEGRA_CLK_RESET_BASE + 0x14, 90 + 23, 91 + }, 92 + { 93 + TEGRA_UARTD_BASE, 94 + TEGRA_CLK_RESET_BASE + 0x0c, 95 + TEGRA_CLK_RESET_BASE + 0x18, 96 + 1, 97 + }, 98 + { 99 + TEGRA_UARTE_BASE, 100 + TEGRA_CLK_RESET_BASE + 0x0c, 101 + TEGRA_CLK_RESET_BASE + 0x18, 102 + 2, 103 + }, 104 + }; 105 + int i; 106 + volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE; 107 + u32 chip, div; 54 108 109 + /* 110 + * Look for the first UART that: 111 + * a) Is not in reset. 112 + * b) Is clocked. 113 + * c) Has a 'D' in the scratchpad register. 114 + * 115 + * Note that on Tegra30, the first two conditions are required, since 116 + * if not true, accesses to the UART scratch register will hang. 117 + * Tegra20 doesn't have this issue. 118 + * 119 + * The intent is that the bootloader will tell the kernel which UART 120 + * to use by setting up those conditions. If nothing found, we'll fall 121 + * back to what's specified in TEGRA_DEBUG_UART_BASE. 122 + */ 123 + for (i = 0; i < ARRAY_SIZE(uarts); i++) { 124 + if (*(u8 *)uarts[i].reset_reg & BIT(uarts[i].bit)) 125 + continue; 126 + 127 + if (!(*(u8 *)uarts[i].clock_reg & BIT(uarts[i].bit))) 128 + continue; 129 + 130 + uart = (volatile u8 *)uarts[i].base; 131 + if (uart[UART_SCR << DEBUG_UART_SHIFT] != 'D') 132 + continue; 133 + 134 + break; 135 + } 136 + if (i == ARRAY_SIZE(uarts)) 137 + uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; 138 + save_uart_address(); 55 139 if (uart == NULL) 56 140 return; 57 141 58 - uart[UART_LCR << shift] |= UART_LCR_DLAB; 59 - uart[UART_DLL << shift] = 0x75; 60 - uart[UART_DLM << shift] = 0x0; 61 - uart[UART_LCR << shift] = 3; 142 + chip = (apb_misc[0x804 / 4] >> 8) & 0xff; 143 + if (chip == 0x20) 144 + div = 0x0075; 145 + else 146 + div = 0x00dd; 147 + 148 + uart[UART_LCR << DEBUG_UART_SHIFT] |= UART_LCR_DLAB; 149 + uart[UART_DLL << DEBUG_UART_SHIFT] = div & 0xff; 150 + uart[UART_DLM << DEBUG_UART_SHIFT] = div >> 8; 151 + uart[UART_LCR << DEBUG_UART_SHIFT] = 3; 62 152 } 63 153 64 154 static inline void arch_decomp_wdog(void)
+76
arch/arm/mach-tegra/pmc.c
··· 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 + }
+23
arch/arm/mach-tegra/pmc.h
··· 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
+1 -1
arch/arm/mach-tegra/tegra2_clocks.c
··· 720 720 { 721 721 tegra2_pll_clk_init(c); 722 722 723 - if (tegra_sku_id() == 7) 723 + if (tegra_sku_id == 7) 724 724 c->max_rate = 750000000; 725 725 } 726 726
+201 -23
arch/arm/mach-tegra/tegra2_emc.c
··· 16 16 */ 17 17 18 18 #include <linux/kernel.h> 19 + #include <linux/device.h> 19 20 #include <linux/clk.h> 20 21 #include <linux/err.h> 21 22 #include <linux/io.h> 22 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 28 #include <mach/iomap.h> 25 29 26 30 #include "tegra2_emc.h" 31 + #include "fuse.h" 27 32 28 33 #ifdef CONFIG_TEGRA_EMC_SCALING_ENABLE 29 34 static bool emc_enable = true; ··· 37 32 #endif 38 33 module_param(emc_enable, bool, 0644); 39 34 40 - static void __iomem *emc = IO_ADDRESS(TEGRA_EMC_BASE); 41 - static const struct tegra_emc_table *tegra_emc_table; 42 - static int tegra_emc_table_size; 35 + static struct platform_device *emc_pdev; 36 + static void __iomem *emc_regbase; 43 37 44 38 static inline void emc_writel(u32 val, unsigned long addr) 45 39 { 46 - writel(val, emc + addr); 40 + writel(val, emc_regbase + addr); 47 41 } 48 42 49 43 static inline u32 emc_readl(unsigned long addr) 50 44 { 51 - return readl(emc + addr); 45 + return readl(emc_regbase + addr); 52 46 } 53 47 54 48 static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = { ··· 102 98 /* Select the closest EMC rate that is higher than the requested rate */ 103 99 long tegra_emc_round_rate(unsigned long rate) 104 100 { 101 + struct tegra_emc_pdata *pdata; 105 102 int i; 106 103 int best = -1; 107 104 unsigned long distance = ULONG_MAX; 108 105 109 - if (!tegra_emc_table) 106 + if (!emc_pdev) 110 107 return -EINVAL; 111 108 112 - if (!emc_enable) 113 - return -EINVAL; 109 + pdata = emc_pdev->dev.platform_data; 114 110 115 111 pr_debug("%s: %lu\n", __func__, rate); 116 112 ··· 120 116 */ 121 117 rate = rate / 2 / 1000; 122 118 123 - for (i = 0; i < tegra_emc_table_size; i++) { 124 - if (tegra_emc_table[i].rate >= rate && 125 - (tegra_emc_table[i].rate - rate) < distance) { 126 - distance = tegra_emc_table[i].rate - rate; 119 + for (i = 0; i < pdata->num_tables; i++) { 120 + if (pdata->tables[i].rate >= rate && 121 + (pdata->tables[i].rate - rate) < distance) { 122 + distance = pdata->tables[i].rate - rate; 127 123 best = i; 128 124 } 129 125 } ··· 131 127 if (best < 0) 132 128 return -EINVAL; 133 129 134 - pr_debug("%s: using %lu\n", __func__, tegra_emc_table[best].rate); 130 + pr_debug("%s: using %lu\n", __func__, pdata->tables[best].rate); 135 131 136 - return tegra_emc_table[best].rate * 2 * 1000; 132 + return pdata->tables[best].rate * 2 * 1000; 137 133 } 138 134 139 135 /* ··· 146 142 */ 147 143 int tegra_emc_set_rate(unsigned long rate) 148 144 { 145 + struct tegra_emc_pdata *pdata; 149 146 int i; 150 147 int j; 151 148 152 - if (!tegra_emc_table) 149 + if (!emc_pdev) 153 150 return -EINVAL; 151 + 152 + pdata = emc_pdev->dev.platform_data; 154 153 155 154 /* 156 155 * The EMC clock rate is twice the bus rate, and the bus rate is ··· 161 154 */ 162 155 rate = rate / 2 / 1000; 163 156 164 - for (i = 0; i < tegra_emc_table_size; i++) 165 - if (tegra_emc_table[i].rate == rate) 157 + for (i = 0; i < pdata->num_tables; i++) 158 + if (pdata->tables[i].rate == rate) 166 159 break; 167 160 168 - if (i >= tegra_emc_table_size) 161 + if (i >= pdata->num_tables) 169 162 return -EINVAL; 170 163 171 164 pr_debug("%s: setting to %lu\n", __func__, rate); 172 165 173 166 for (j = 0; j < TEGRA_EMC_NUM_REGS; j++) 174 - emc_writel(tegra_emc_table[i].regs[j], emc_reg_addr[j]); 167 + emc_writel(pdata->tables[i].regs[j], emc_reg_addr[j]); 175 168 176 - emc_readl(tegra_emc_table[i].regs[TEGRA_EMC_NUM_REGS - 1]); 169 + emc_readl(pdata->tables[i].regs[TEGRA_EMC_NUM_REGS - 1]); 177 170 178 171 return 0; 179 172 } 180 173 181 - void tegra_init_emc(const struct tegra_emc_table *table, int table_size) 174 + #ifdef CONFIG_OF 175 + static struct device_node *tegra_emc_ramcode_devnode(struct device_node *np) 182 176 { 183 - tegra_emc_table = table; 184 - tegra_emc_table_size = table_size; 177 + struct device_node *iter; 178 + u32 reg; 179 + 180 + for_each_child_of_node(np, iter) { 181 + if (of_property_read_u32(np, "nvidia,ram-code", &reg)) 182 + continue; 183 + if (reg == tegra_bct_strapping) 184 + return of_node_get(iter); 185 + } 186 + 187 + return NULL; 185 188 } 189 + 190 + static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata( 191 + struct platform_device *pdev) 192 + { 193 + struct device_node *np = pdev->dev.of_node; 194 + struct device_node *tnp, *iter; 195 + struct tegra_emc_pdata *pdata; 196 + int ret, i, num_tables; 197 + 198 + if (!np) 199 + return NULL; 200 + 201 + if (of_find_property(np, "nvidia,use-ram-code", NULL)) { 202 + tnp = tegra_emc_ramcode_devnode(np); 203 + if (!tnp) 204 + dev_warn(&pdev->dev, 205 + "can't find emc table for ram-code 0x%02x\n", 206 + tegra_bct_strapping); 207 + } else 208 + tnp = of_node_get(np); 209 + 210 + if (!tnp) 211 + return NULL; 212 + 213 + num_tables = 0; 214 + for_each_child_of_node(tnp, iter) 215 + if (of_device_is_compatible(iter, "nvidia,tegra20-emc-table")) 216 + num_tables++; 217 + 218 + if (!num_tables) { 219 + pdata = NULL; 220 + goto out; 221 + } 222 + 223 + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 224 + pdata->tables = devm_kzalloc(&pdev->dev, 225 + sizeof(*pdata->tables) * num_tables, 226 + GFP_KERNEL); 227 + 228 + i = 0; 229 + for_each_child_of_node(tnp, iter) { 230 + u32 prop; 231 + 232 + ret = of_property_read_u32(iter, "clock-frequency", &prop); 233 + if (ret) { 234 + dev_err(&pdev->dev, "no clock-frequency in %s\n", 235 + iter->full_name); 236 + continue; 237 + } 238 + pdata->tables[i].rate = prop; 239 + 240 + ret = of_property_read_u32_array(iter, "nvidia,emc-registers", 241 + pdata->tables[i].regs, 242 + TEGRA_EMC_NUM_REGS); 243 + if (ret) { 244 + dev_err(&pdev->dev, 245 + "malformed emc-registers property in %s\n", 246 + iter->full_name); 247 + continue; 248 + } 249 + 250 + i++; 251 + } 252 + pdata->num_tables = i; 253 + 254 + out: 255 + of_node_put(tnp); 256 + return pdata; 257 + } 258 + #else 259 + static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata( 260 + struct platform_device *pdev) 261 + { 262 + return NULL; 263 + } 264 + #endif 265 + 266 + static struct tegra_emc_pdata __devinit *tegra_emc_fill_pdata(struct platform_device *pdev) 267 + { 268 + struct clk *c = clk_get_sys(NULL, "emc"); 269 + struct tegra_emc_pdata *pdata; 270 + unsigned long khz; 271 + int i; 272 + 273 + WARN_ON(pdev->dev.platform_data); 274 + BUG_ON(IS_ERR_OR_NULL(c)); 275 + 276 + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 277 + pdata->tables = devm_kzalloc(&pdev->dev, sizeof(*pdata->tables), 278 + GFP_KERNEL); 279 + 280 + pdata->tables[0].rate = clk_get_rate(c) / 2 / 1000; 281 + 282 + for (i = 0; i < TEGRA_EMC_NUM_REGS; i++) 283 + pdata->tables[0].regs[i] = emc_readl(emc_reg_addr[i]); 284 + 285 + pdata->num_tables = 1; 286 + 287 + khz = pdata->tables[0].rate; 288 + dev_info(&pdev->dev, "no tables provided, using %ld kHz emc, " 289 + "%ld kHz mem\n", khz * 2, khz); 290 + 291 + return pdata; 292 + } 293 + 294 + static int __devinit tegra_emc_probe(struct platform_device *pdev) 295 + { 296 + struct tegra_emc_pdata *pdata; 297 + struct resource *res; 298 + 299 + if (!emc_enable) { 300 + dev_err(&pdev->dev, "disabled per module parameter\n"); 301 + return -ENODEV; 302 + } 303 + 304 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 305 + if (!res) { 306 + dev_err(&pdev->dev, "missing register base\n"); 307 + return -ENOMEM; 308 + } 309 + 310 + emc_regbase = devm_request_and_ioremap(&pdev->dev, res); 311 + if (!emc_regbase) { 312 + dev_err(&pdev->dev, "failed to remap registers\n"); 313 + return -ENOMEM; 314 + } 315 + 316 + pdata = pdev->dev.platform_data; 317 + 318 + if (!pdata) 319 + pdata = tegra_emc_dt_parse_pdata(pdev); 320 + 321 + if (!pdata) 322 + pdata = tegra_emc_fill_pdata(pdev); 323 + 324 + pdev->dev.platform_data = pdata; 325 + 326 + emc_pdev = pdev; 327 + 328 + return 0; 329 + } 330 + 331 + static struct of_device_id tegra_emc_of_match[] __devinitdata = { 332 + { .compatible = "nvidia,tegra20-emc", }, 333 + { }, 334 + }; 335 + 336 + static struct platform_driver tegra_emc_driver = { 337 + .driver = { 338 + .name = "tegra-emc", 339 + .owner = THIS_MODULE, 340 + .of_match_table = tegra_emc_of_match, 341 + }, 342 + .probe = tegra_emc_probe, 343 + }; 344 + 345 + static int __init tegra_emc_init(void) 346 + { 347 + return platform_driver_register(&tegra_emc_driver); 348 + } 349 + device_initcall(tegra_emc_init);
+4 -7
arch/arm/mach-tegra/tegra2_emc.h
··· 15 15 * 16 16 */ 17 17 18 - #define TEGRA_EMC_NUM_REGS 46 19 - 20 - struct tegra_emc_table { 21 - unsigned long rate; 22 - u32 regs[TEGRA_EMC_NUM_REGS]; 23 - }; 18 + #ifndef __MACH_TEGRA_TEGRA2_EMC_H_ 19 + #define __MACH_TEGRA_TEGRA2_EMC_H 24 20 25 21 int tegra_emc_set_rate(unsigned long rate); 26 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
+8 -8
arch/arm/plat-mxc/devices/platform-ahci-imx.c
··· 60 60 dev_err(dev, "no sata clock.\n"); 61 61 return PTR_ERR(sata_clk); 62 62 } 63 - ret = clk_enable(sata_clk); 63 + ret = clk_prepare_enable(sata_clk); 64 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 66 goto put_sata_clk; 67 67 } 68 68 ··· 73 73 ret = PTR_ERR(sata_ref_clk); 74 74 goto release_sata_clk; 75 75 } 76 - ret = clk_enable(sata_ref_clk); 76 + ret = clk_prepare_enable(sata_ref_clk); 77 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 79 goto put_sata_ref_clk; 80 80 } 81 81 ··· 104 104 return 0; 105 105 106 106 release_sata_ref_clk: 107 - clk_disable(sata_ref_clk); 107 + clk_disable_unprepare(sata_ref_clk); 108 108 put_sata_ref_clk: 109 109 clk_put(sata_ref_clk); 110 110 release_sata_clk: 111 - clk_disable(sata_clk); 111 + clk_disable_unprepare(sata_clk); 112 112 put_sata_clk: 113 113 clk_put(sata_clk); 114 114 ··· 117 117 118 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 121 clk_put(sata_ref_clk); 122 122 123 - clk_disable(sata_clk); 123 + clk_disable_unprepare(sata_clk); 124 124 clk_put(sata_clk); 125 125 126 126 }
+1 -1
arch/arm/plat-mxc/epit.c
··· 203 203 204 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 208 timer_base = base; 209 209
-33
arch/arm/plat-mxc/include/mach/board-mx31ads.h
··· 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__ */
+1 -1
arch/arm/plat-mxc/include/mach/debug-macro.S
··· 24 24 #define UART_PADDR MX51_UART1_BASE_ADDR 25 25 #elif defined (CONFIG_DEBUG_IMX50_IMX53_UART) 26 26 #define UART_PADDR MX53_UART1_BASE_ADDR 27 - #elif defined (CONFIG_DEBUG_IMX6Q_UART) 27 + #elif defined (CONFIG_DEBUG_IMX6Q_UART4) 28 28 #define UART_PADDR MX6Q_UART4_BASE_ADDR 29 29 #endif 30 30
+1 -2
arch/arm/plat-mxc/include/mach/dma.h
··· 60 60 61 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") || 64 - !strcmp(dev_name(chan->device->dev), "imx35-sdma") || 63 + return strstr(dev_name(chan->device->dev), "sdma") || 65 64 !strcmp(dev_name(chan->device->dev), "imx-dma"); 66 65 } 67 66
+2 -2
arch/arm/plat-mxc/pwm.c
··· 132 132 int rc = 0; 133 133 134 134 if (!pwm->clk_enabled) { 135 - rc = clk_enable(pwm->clk); 135 + rc = clk_prepare_enable(pwm->clk); 136 136 if (!rc) 137 137 pwm->clk_enabled = 1; 138 138 } ··· 145 145 writel(0, pwm->mmio_base + MX3_PWMCR); 146 146 147 147 if (pwm->clk_enabled) { 148 - clk_disable(pwm->clk); 148 + clk_disable_unprepare(pwm->clk); 149 149 pwm->clk_enabled = 0; 150 150 } 151 151 }
+1 -1
arch/arm/plat-mxc/system.c
··· 48 48 49 49 clk = clk_get_sys("imx2-wdt.0", NULL); 50 50 if (!IS_ERR(clk)) 51 - clk_enable(clk); 51 + clk_prepare_enable(clk); 52 52 wcr_enable = (1 << 2); 53 53 } 54 54
+1 -1
arch/arm/plat-mxc/time.c
··· 283 283 { 284 284 uint32_t tctl_val; 285 285 286 - clk_enable(timer_clk); 286 + clk_prepare_enable(timer_clk); 287 287 288 288 timer_base = base; 289 289
-2
arch/arm/plat-omap/include/plat/omap_hwmod.h
··· 484 484 * @main_clk: main clock: OMAP clock name 485 485 * @_clk: pointer to the main struct clk (filled in at runtime) 486 486 * @opt_clks: other device clocks that drivers can request (0..*) 487 - * @vdd_name: voltage domain name 488 487 * @voltdm: pointer to voltage domain (filled in at runtime) 489 488 * @masters: ptr to array of OCP ifs that this hwmod can initiate on 490 489 * @slaves: ptr to array of OCP ifs that this hwmod can respond on ··· 527 528 struct omap_hwmod_opt_clk *opt_clks; 528 529 char *clkdm_name; 529 530 struct clockdomain *clkdm; 530 - char *vdd_name; 531 531 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ 532 532 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ 533 533 void *dev_attr;
+16
arch/arm/plat-samsung/include/plat/dma-pl330.h
··· 82 82 DMACH_SLIMBUS4_TX, 83 83 DMACH_SLIMBUS5_RX, 84 84 DMACH_SLIMBUS5_TX, 85 + DMACH_MIPI_HSI0, 86 + DMACH_MIPI_HSI1, 87 + DMACH_MIPI_HSI2, 88 + DMACH_MIPI_HSI3, 89 + DMACH_MIPI_HSI4, 90 + DMACH_MIPI_HSI5, 91 + DMACH_MIPI_HSI6, 92 + DMACH_MIPI_HSI7, 93 + DMACH_MTOM_0, 94 + DMACH_MTOM_1, 95 + DMACH_MTOM_2, 96 + DMACH_MTOM_3, 97 + DMACH_MTOM_4, 98 + DMACH_MTOM_5, 99 + DMACH_MTOM_6, 100 + DMACH_MTOM_7, 85 101 /* END Marker, also used to denote a reserved channel */ 86 102 DMACH_MAX, 87 103 };
+42 -39
arch/arm/plat-samsung/include/plat/regs-rtc.h
··· 18 18 #define S3C2410_INTP_ALM (1 << 1) 19 19 #define S3C2410_INTP_TIC (1 << 0) 20 20 21 - #define S3C2410_RTCCON S3C2410_RTCREG(0x40) 22 - #define S3C2410_RTCCON_RTCEN (1<<0) 23 - #define S3C2410_RTCCON_CLKSEL (1<<1) 24 - #define S3C2410_RTCCON_CNTSEL (1<<2) 25 - #define S3C2410_RTCCON_CLKRST (1<<3) 26 - #define S3C64XX_RTCCON_TICEN (1<<8) 21 + #define S3C2410_RTCCON S3C2410_RTCREG(0x40) 22 + #define S3C2410_RTCCON_RTCEN (1 << 0) 23 + #define S3C2410_RTCCON_CNTSEL (1 << 2) 24 + #define S3C2410_RTCCON_CLKRST (1 << 3) 25 + #define S3C2443_RTCCON_TICSEL (1 << 4) 26 + #define S3C64XX_RTCCON_TICEN (1 << 8) 27 27 28 - #define S3C64XX_RTCCON_TICMSK (0xF<<7) 29 - #define S3C64XX_RTCCON_TICSHT (7) 28 + #define S3C2410_TICNT S3C2410_RTCREG(0x44) 29 + #define S3C2410_TICNT_ENABLE (1 << 7) 30 30 31 - #define S3C2410_TICNT S3C2410_RTCREG(0x44) 32 - #define S3C2410_TICNT_ENABLE (1<<7) 31 + /* S3C2443: tick count is 15 bit wide 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) 35 - #define S3C2410_RTCALM_ALMEN (1<<6) 36 - #define S3C2410_RTCALM_YEAREN (1<<5) 37 - #define S3C2410_RTCALM_MONEN (1<<4) 38 - #define S3C2410_RTCALM_DAYEN (1<<3) 39 - #define S3C2410_RTCALM_HOUREN (1<<2) 40 - #define S3C2410_RTCALM_MINEN (1<<1) 41 - #define S3C2410_RTCALM_SECEN (1<<0) 39 + /* S3C2416: tick count is 32 bit wide 40 + * TICNT[6:0] contains bits [14:8] 41 + * TICNT1[7:0] contains lower 8 bits 42 + * TICNT2[16:0] contains upper 17 bits 43 + */ 44 + #define S3C2416_TICNT2 S3C2410_RTCREG(0x48) 45 + #define S3C2416_TICNT2_PART(x) ((x & 0xffff8000) >> 15) 42 46 43 - #define S3C2410_RTCALM_ALL \ 44 - S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\ 45 - S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\ 46 - S3C2410_RTCALM_SECEN 47 + #define S3C2410_RTCALM S3C2410_RTCREG(0x50) 48 + #define S3C2410_RTCALM_ALMEN (1 << 6) 49 + #define S3C2410_RTCALM_YEAREN (1 << 5) 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) 50 - #define S3C2410_ALMMIN S3C2410_RTCREG(0x58) 51 - #define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c) 60 + #define S3C2410_ALMDATE S3C2410_RTCREG(0x60) 61 + #define S3C2410_ALMMON S3C2410_RTCREG(0x64) 62 + #define S3C2410_ALMYEAR S3C2410_RTCREG(0x68) 52 63 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 - 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 71 #endif /* __ASM_ARCH_REGS_RTC_H */
+27
arch/arm/plat-samsung/include/plat/rtc-core.h
··· 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 */
+2
arch/arm/plat-samsung/include/plat/sdhci.h
··· 40 40 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI 41 41 * @max_width: The maximum number of data bits supported. 42 42 * @host_caps: Standard MMC host capabilities bit field. 43 + * @host_caps2: The second standard MMC host capabilities bit field. 43 44 * @cd_type: Type of Card Detection method (see cd_types enum above) 44 45 * @clk_type: Type of clock divider method (see clk_types enum above) 45 46 * @ext_cd_init: Initialize external card detect subsystem. Called on ··· 64 63 struct s3c_sdhci_platdata { 65 64 unsigned int max_width; 66 65 unsigned int host_caps; 66 + unsigned int host_caps2; 67 67 unsigned int pm_caps; 68 68 enum cd_types cd_type; 69 69 enum clk_types clk_type;
+2
arch/arm/plat-samsung/platformdata.c
··· 53 53 set->cfg_gpio = pd->cfg_gpio; 54 54 if (pd->host_caps) 55 55 set->host_caps |= pd->host_caps; 56 + if (pd->host_caps2) 57 + set->host_caps2 |= pd->host_caps2; 56 58 if (pd->pm_caps) 57 59 set->pm_caps |= pd->pm_caps; 58 60 if (pd->clk_type)
+46 -13
drivers/gpio/gpio-tegra.c
··· 25 25 #include <linux/of.h> 26 26 #include <linux/platform_device.h> 27 27 #include <linux/module.h> 28 + #include <linux/irqdomain.h> 28 29 29 30 #include <asm/mach/irq.h> 30 31 ··· 75 74 #endif 76 75 }; 77 76 78 - 77 + static struct irq_domain *irq_domain; 79 78 static void __iomem *regs; 80 - static struct tegra_gpio_bank tegra_gpio_banks[7]; 79 + static u32 tegra_gpio_bank_count; 80 + static struct tegra_gpio_bank *tegra_gpio_banks; 81 81 82 82 static inline void tegra_gpio_writel(u32 val, u32 reg) 83 83 { ··· 141 139 142 140 static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 143 141 { 144 - return TEGRA_GPIO_TO_IRQ(offset); 142 + return irq_find_mapping(irq_domain, offset); 145 143 } 146 144 147 145 static struct gpio_chip tegra_gpio_chip = { ··· 157 155 158 156 static void tegra_gpio_irq_ack(struct irq_data *d) 159 157 { 160 - int gpio = d->irq - INT_GPIO_BASE; 158 + int gpio = d->hwirq; 161 159 162 160 tegra_gpio_writel(1 << GPIO_BIT(gpio), GPIO_INT_CLR(gpio)); 163 161 } 164 162 165 163 static void tegra_gpio_irq_mask(struct irq_data *d) 166 164 { 167 - int gpio = d->irq - INT_GPIO_BASE; 165 + int gpio = d->hwirq; 168 166 169 167 tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 0); 170 168 } 171 169 172 170 static void tegra_gpio_irq_unmask(struct irq_data *d) 173 171 { 174 - int gpio = d->irq - INT_GPIO_BASE; 172 + int gpio = d->hwirq; 175 173 176 174 tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 1); 177 175 } 178 176 179 177 static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type) 180 178 { 181 - int gpio = d->irq - INT_GPIO_BASE; 179 + int gpio = d->hwirq; 182 180 struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d); 183 181 int port = GPIO_PORT(gpio); 184 182 int lvl_type; ··· 275 273 276 274 local_irq_save(flags); 277 275 278 - for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) { 276 + for (b = 0; b < tegra_gpio_bank_count; b++) { 279 277 struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; 280 278 281 279 for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { ··· 298 296 int p; 299 297 300 298 local_irq_save(flags); 301 - for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) { 299 + for (b = 0; b < tegra_gpio_bank_count; b++) { 302 300 struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; 303 301 304 302 for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { ··· 339 337 340 338 static int __devinit tegra_gpio_probe(struct platform_device *pdev) 341 339 { 340 + int irq_base; 342 341 struct resource *res; 343 342 struct tegra_gpio_bank *bank; 344 343 int gpio; 345 344 int i; 346 345 int j; 347 346 348 - for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) { 347 + for (;;) { 348 + res = platform_get_resource(pdev, IORESOURCE_IRQ, tegra_gpio_bank_count); 349 + if (!res) 350 + break; 351 + tegra_gpio_bank_count++; 352 + } 353 + if (!tegra_gpio_bank_count) { 354 + dev_err(&pdev->dev, "Missing IRQ resource\n"); 355 + return -ENODEV; 356 + } 357 + 358 + tegra_gpio_chip.ngpio = tegra_gpio_bank_count * 32; 359 + 360 + tegra_gpio_banks = devm_kzalloc(&pdev->dev, 361 + tegra_gpio_bank_count * sizeof(*tegra_gpio_banks), 362 + GFP_KERNEL); 363 + if (!tegra_gpio_banks) { 364 + dev_err(&pdev->dev, "Couldn't allocate bank structure\n"); 365 + return -ENODEV; 366 + } 367 + 368 + irq_base = irq_alloc_descs(-1, 0, tegra_gpio_chip.ngpio, 0); 369 + if (irq_base < 0) { 370 + dev_err(&pdev->dev, "Couldn't allocate IRQ numbers\n"); 371 + return -ENODEV; 372 + } 373 + irq_domain = irq_domain_add_legacy(pdev->dev.of_node, 374 + tegra_gpio_chip.ngpio, irq_base, 0, 375 + &irq_domain_simple_ops, NULL); 376 + 377 + for (i = 0; i < tegra_gpio_bank_count; i++) { 349 378 res = platform_get_resource(pdev, IORESOURCE_IRQ, i); 350 379 if (!res) { 351 380 dev_err(&pdev->dev, "Missing IRQ resource\n"); ··· 413 380 414 381 gpiochip_add(&tegra_gpio_chip); 415 382 416 - for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) { 417 - int irq = TEGRA_GPIO_TO_IRQ(gpio); 383 + for (gpio = 0; gpio < tegra_gpio_chip.ngpio; gpio++) { 384 + int irq = irq_find_mapping(irq_domain, gpio); 418 385 /* No validity check; all Tegra GPIOs are valid IRQs */ 419 386 420 387 bank = &tegra_gpio_banks[GPIO_BANK(gpio)]; ··· 426 393 set_irq_flags(irq, IRQF_VALID); 427 394 } 428 395 429 - for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) { 396 + for (i = 0; i < tegra_gpio_bank_count; i++) { 430 397 bank = &tegra_gpio_banks[i]; 431 398 432 399 irq_set_chained_handler(bank->irq, tegra_gpio_irq_handler);
+2 -2
drivers/i2c/busses/i2c-imx.c
··· 191 191 192 192 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); 193 193 194 - clk_enable(i2c_imx->clk); 194 + clk_prepare_enable(i2c_imx->clk); 195 195 writeb(i2c_imx->ifdr, i2c_imx->base + IMX_I2C_IFDR); 196 196 /* Enable I2C controller */ 197 197 writeb(0, i2c_imx->base + IMX_I2C_I2SR); ··· 240 240 241 241 /* Disable I2C controller */ 242 242 writeb(0, i2c_imx->base + IMX_I2C_I2CR); 243 - clk_disable(i2c_imx->clk); 243 + clk_disable_unprepare(i2c_imx->clk); 244 244 } 245 245 246 246 static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
+3 -3
drivers/mmc/host/sdhci-esdhc-imx.c
··· 464 464 err = PTR_ERR(clk); 465 465 goto err_clk_get; 466 466 } 467 - clk_enable(clk); 467 + clk_prepare_enable(clk); 468 468 pltfm_host->clk = clk; 469 469 470 470 if (!is_imx25_esdhc(imx_data)) ··· 559 559 gpio_free(boarddata->wp_gpio); 560 560 no_card_detect_pin: 561 561 no_board_data: 562 - clk_disable(pltfm_host->clk); 562 + clk_disable_unprepare(pltfm_host->clk); 563 563 clk_put(pltfm_host->clk); 564 564 err_clk_get: 565 565 kfree(imx_data); ··· 586 586 gpio_free(boarddata->cd_gpio); 587 587 } 588 588 589 - clk_disable(pltfm_host->clk); 589 + clk_disable_unprepare(pltfm_host->clk); 590 590 clk_put(pltfm_host->clk); 591 591 kfree(imx_data); 592 592
+3 -3
drivers/mmc/host/sdhci-s3c.c
··· 518 518 if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) 519 519 host->mmc->caps = MMC_CAP_NONREMOVABLE; 520 520 521 - if (pdata->host_caps) 522 - host->mmc->caps |= pdata->host_caps; 523 - 524 521 if (pdata->pm_caps) 525 522 host->mmc->pm_caps |= pdata->pm_caps; 526 523 ··· 540 543 /* It supports additional host capabilities if needed */ 541 544 if (pdata->host_caps) 542 545 host->mmc->caps |= pdata->host_caps; 546 + 547 + if (pdata->host_caps2) 548 + host->mmc->caps2 |= pdata->host_caps2; 543 549 544 550 ret = sdhci_add_host(host); 545 551 if (ret) {
+2
drivers/net/Space.c
··· 190 190 {seeq8005_probe, 0}, 191 191 #endif 192 192 #ifdef CONFIG_CS89x0 193 + #ifndef CONFIG_CS89x0_PLATFORM 193 194 {cs89x0_probe, 0}, 195 + #endif 194 196 #endif 195 197 #ifdef CONFIG_AT1700 196 198 {at1700_probe, 0},
+11 -8
drivers/net/ethernet/cirrus/Kconfig
··· 5 5 config NET_VENDOR_CIRRUS 6 6 bool "Cirrus devices" 7 7 default y 8 - depends on ISA || EISA || MACH_IXDP2351 || ARCH_IXDP2X01 \ 9 - || MACH_MX31ADS || MACH_QQ2440 || (ARM && ARCH_EP93XX) || MAC 8 + depends on ISA || EISA || ARM || MAC 10 9 ---help--- 11 10 If you have a network (Ethernet) card belonging to this class, say Y 12 11 and read the Ethernet-HOWTO, available from ··· 20 21 21 22 config CS89x0 22 23 tristate "CS89x0 support" 23 - depends on (ISA || EISA || MACH_IXDP2351 \ 24 - || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440) 24 + depends on ISA || EISA || ARM 25 25 ---help--- 26 26 Support for CS89x0 chipset based Ethernet cards. If you have a 27 27 network (Ethernet) card of this type, say Y and read the ··· 31 33 To compile this driver as a module, choose M here. The module 32 34 will be called cs89x0. 33 35 34 - config CS89x0_NONISA_IRQ 35 - def_bool y 36 - depends on CS89x0 != n 37 - depends on MACH_IXDP2351 || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440 36 + config CS89x0_PLATFORM 37 + bool "CS89x0 platform driver support" 38 + depends on CS89x0 39 + help 40 + Say Y to compile the cs89x0 driver as a platform driver. This 41 + makes this driver suitable for use on certain evaluation boards 42 + such as the iMX21ADS. 43 + 44 + If you are unsure, say N. 38 45 39 46 config EP93XX_ETH 40 47 tristate "EP93xx Ethernet support"
+122 -26
drivers/net/ethernet/cirrus/cs89x0.c
··· 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 105 * Set this to zero to disable DMA code ··· 128 131 129 132 */ 130 133 134 + #include <linux/module.h> 135 + #include <linux/printk.h> 131 136 #include <linux/errno.h> 132 137 #include <linux/netdevice.h> 133 138 #include <linux/etherdevice.h> 139 + #include <linux/platform_device.h> 134 140 #include <linux/kernel.h> 135 141 #include <linux/types.h> 136 142 #include <linux/fcntl.h> ··· 151 151 #include <asm/system.h> 152 152 #include <asm/io.h> 153 153 #include <asm/irq.h> 154 + #include <linux/atomic.h> 154 155 #if ALLOW_DMA 155 156 #include <asm/dma.h> 156 157 #endif ··· 175 174 them to system IRQ numbers. This mapping is card specific and is set to 176 175 the configuration of the Cirrus Eval board for this chip. */ 177 176 #if defined(CONFIG_MACH_IXDP2351) 177 + #define CS89x0_NONISA_IRQ 178 178 static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; 179 179 static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; 180 180 #elif defined(CONFIG_ARCH_IXDP2X01) 181 + #define CS89x0_NONISA_IRQ 181 182 static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; 182 183 static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; 183 - #elif defined(CONFIG_MACH_QQ2440) 184 - #include <mach/qq2440.h> 185 - static unsigned int netcard_portlist[] __used __initdata = { QQ2440_CS8900_VIRT_BASE + 0x300, 0 }; 186 - static unsigned int cs8900_irq_map[] = { QQ2440_CS8900_IRQ, 0, 0, 0 }; 187 - #elif defined(CONFIG_MACH_MX31ADS) 188 - #include <mach/board-mx31ads.h> 189 - static unsigned int netcard_portlist[] __used __initdata = { 190 - PBC_BASE_ADDRESS + PBC_CS8900A_IOBASE + 0x300, 0 191 - }; 192 - static unsigned cs8900_irq_map[] = {EXPIO_INT_ENET_INT, 0, 0, 0}; 193 184 #else 185 + #ifndef CONFIG_CS89x0_PLATFORM 194 186 static unsigned int netcard_portlist[] __used __initdata = 195 187 { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; 196 188 static unsigned int cs8900_irq_map[] = {10,11,12,5}; 189 + #endif 197 190 #endif 198 191 199 192 #if DEBUGGING ··· 231 236 unsigned char *end_dma_buff; /* points to the end of the buffer */ 232 237 unsigned char *rx_dma_ptr; /* points to the next packet */ 233 238 #endif 239 + #ifdef CONFIG_CS89x0_PLATFORM 240 + void __iomem *virt_addr;/* Virtual address for accessing the CS89x0. */ 241 + unsigned long phys_addr;/* Physical address for accessing the CS89x0. */ 242 + unsigned long size; /* Length of CS89x0 memory region. */ 243 + #endif 234 244 }; 235 245 236 246 /* Index to functions, as function prototypes. */ 237 247 238 - static int cs89x0_probe1(struct net_device *dev, int ioaddr, int modular); 248 + static int cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular); 239 249 static int net_open(struct net_device *dev); 240 250 static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev); 241 251 static irqreturn_t net_interrupt(int irq, void *dev_id); ··· 294 294 __setup("cs89x0_media=", media_fn); 295 295 296 296 297 + #ifndef CONFIG_CS89x0_PLATFORM 297 298 /* Check for a network adaptor of this type, and return '0' iff one exists. 298 299 If dev->base_addr == 0, probe all likely locations. 299 300 If dev->base_addr == 1, always return failure. ··· 343 342 printk(KERN_WARNING "cs89x0: no cs8900 or cs8920 detected. Be sure to disable PnP with SETUP\n"); 344 343 return ERR_PTR(err); 345 344 } 345 + #endif 346 346 #endif 347 347 348 348 #if defined(CONFIG_MACH_IXDP2351) ··· 506 504 */ 507 505 508 506 static int __init 509 - cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) 507 + cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular) 510 508 { 511 509 struct net_local *lp = netdev_priv(dev); 512 510 static unsigned version_printed; ··· 531 529 lp->force = g_cs89x0_media__force; 532 530 #endif 533 531 534 - #if defined(CONFIG_MACH_QQ2440) 535 - lp->force |= FORCE_RJ45 | FORCE_FULL; 536 - #endif 537 532 } 538 533 539 534 /* Grab the region so we can find another board if autoIRQ fails. */ 540 535 /* WTF is going on here? */ 541 536 if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { 542 - printk(KERN_ERR "%s: request_region(0x%x, 0x%x) failed\n", 537 + printk(KERN_ERR "%s: request_region(0x%lx, 0x%x) failed\n", 543 538 DRV_NAME, ioaddr, NETCARD_IO_EXTENT); 544 539 retval = -EBUSY; 545 540 goto out1; ··· 548 549 will skip the test for the ADD_PORT. */ 549 550 if (ioaddr & 1) { 550 551 if (net_debug > 1) 551 - printk(KERN_INFO "%s: odd ioaddr 0x%x\n", dev->name, ioaddr); 552 + printk(KERN_INFO "%s: odd ioaddr 0x%lx\n", dev->name, ioaddr); 552 553 if ((ioaddr & 2) != 2) 553 554 if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { 554 555 printk(KERN_ERR "%s: bad signature 0x%x\n", ··· 559 560 } 560 561 561 562 ioaddr &= ~3; 562 - printk(KERN_DEBUG "PP_addr at %x[%x]: 0x%x\n", 563 + printk(KERN_DEBUG "PP_addr at %lx[%x]: 0x%x\n", 563 564 ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); 564 565 writeword(ioaddr, ADD_PORT, PP_ChipID); 565 566 566 567 tmp = readword(ioaddr, DATA_PORT); 567 568 if (tmp != CHIP_EISA_ID_SIG) { 568 - printk(KERN_DEBUG "%s: incorrect signature at %x[%x]: 0x%x!=" 569 + printk(KERN_DEBUG "%s: incorrect signature at %lx[%x]: 0x%x!=" 569 570 CHIP_EISA_ID_SIG_STR "\n", 570 571 dev->name, ioaddr, DATA_PORT, tmp); 571 572 retval = -ENODEV; ··· 735 736 dev->irq = i; 736 737 } else { 737 738 i = lp->isa_config & INT_NO_MASK; 739 + #ifndef CONFIG_CS89x0_PLATFORM 738 740 if (lp->chip_type == CS8900) { 739 - #ifdef CONFIG_CS89x0_NONISA_IRQ 741 + #ifdef CS89x0_NONISA_IRQ 740 742 i = cs8900_irq_map[0]; 741 743 #else 742 744 /* Translate the IRQ using the IRQ mapping table. */ ··· 758 758 } 759 759 #endif 760 760 } 761 + #endif 761 762 if (!dev->irq) 762 763 dev->irq = i; 763 764 } ··· 1169 1168 int i; 1170 1169 1171 1170 if (chip_type == CS8900) { 1171 + #ifndef CONFIG_CS89x0_PLATFORM 1172 1172 /* Search the mapping table for the corresponding IRQ pin. */ 1173 1173 for (i = 0; i != ARRAY_SIZE(cs8900_irq_map); i++) 1174 1174 if (cs8900_irq_map[i] == irq) ··· 1177 1175 /* Not found */ 1178 1176 if (i == ARRAY_SIZE(cs8900_irq_map)) 1179 1177 i = 3; 1178 + #else 1179 + /* INTRQ0 pin is used for interrupt generation. */ 1180 + i = 0; 1181 + #endif 1180 1182 writereg(dev, PP_CS8900_ISAINT, i); 1181 1183 } else { 1182 1184 writereg(dev, PP_CS8920_ISAINT, irq); ··· 1234 1228 } 1235 1229 else 1236 1230 { 1237 - #ifndef CONFIG_CS89x0_NONISA_IRQ 1231 + #if !defined(CS89x0_NONISA_IRQ) && !defined(CONFIG_CS89x0_PLATFORM) 1238 1232 if (((1 << dev->irq) & lp->irq_map) == 0) { 1239 1233 printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", 1240 1234 dev->name, dev->irq, lp->irq_map); ··· 1752 1746 return 0; 1753 1747 } 1754 1748 1755 - #ifdef MODULE 1749 + #if defined(MODULE) && !defined(CONFIG_CS89x0_PLATFORM) 1756 1750 1757 1751 static struct net_device *dev_cs89x0; 1758 1752 ··· 1906 1900 release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); 1907 1901 free_netdev(dev_cs89x0); 1908 1902 } 1909 - #endif /* MODULE */ 1903 + #endif /* MODULE && !CONFIG_CS89x0_PLATFORM */ 1904 + 1905 + #ifdef CONFIG_CS89x0_PLATFORM 1906 + static int __init cs89x0_platform_probe(struct platform_device *pdev) 1907 + { 1908 + struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); 1909 + struct net_local *lp; 1910 + struct resource *mem_res; 1911 + int err; 1912 + 1913 + if (!dev) 1914 + return -ENOMEM; 1915 + 1916 + lp = netdev_priv(dev); 1917 + 1918 + mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1919 + dev->irq = platform_get_irq(pdev, 0); 1920 + if (mem_res == NULL || dev->irq <= 0) { 1921 + dev_warn(&dev->dev, "memory/interrupt resource missing.\n"); 1922 + err = -ENXIO; 1923 + goto free; 1924 + } 1925 + 1926 + lp->phys_addr = mem_res->start; 1927 + lp->size = resource_size(mem_res); 1928 + if (!request_mem_region(lp->phys_addr, lp->size, DRV_NAME)) { 1929 + dev_warn(&dev->dev, "request_mem_region() failed.\n"); 1930 + err = -EBUSY; 1931 + goto free; 1932 + } 1933 + 1934 + lp->virt_addr = ioremap(lp->phys_addr, lp->size); 1935 + if (!lp->virt_addr) { 1936 + dev_warn(&dev->dev, "ioremap() failed.\n"); 1937 + err = -ENOMEM; 1938 + goto release; 1939 + } 1940 + 1941 + err = cs89x0_probe1(dev, (unsigned long)lp->virt_addr, 0); 1942 + if (err) { 1943 + dev_warn(&dev->dev, "no cs8900 or cs8920 detected.\n"); 1944 + goto unmap; 1945 + } 1946 + 1947 + platform_set_drvdata(pdev, dev); 1948 + return 0; 1949 + 1950 + unmap: 1951 + iounmap(lp->virt_addr); 1952 + release: 1953 + release_mem_region(lp->phys_addr, lp->size); 1954 + free: 1955 + free_netdev(dev); 1956 + return err; 1957 + } 1958 + 1959 + static int cs89x0_platform_remove(struct platform_device *pdev) 1960 + { 1961 + struct net_device *dev = platform_get_drvdata(pdev); 1962 + struct net_local *lp = netdev_priv(dev); 1963 + 1964 + unregister_netdev(dev); 1965 + iounmap(lp->virt_addr); 1966 + release_mem_region(lp->phys_addr, lp->size); 1967 + free_netdev(dev); 1968 + return 0; 1969 + } 1970 + 1971 + static struct platform_driver cs89x0_driver = { 1972 + .driver = { 1973 + .name = DRV_NAME, 1974 + .owner = THIS_MODULE, 1975 + }, 1976 + .remove = cs89x0_platform_remove, 1977 + }; 1978 + 1979 + static int __init cs89x0_init(void) 1980 + { 1981 + return platform_driver_probe(&cs89x0_driver, cs89x0_platform_probe); 1982 + } 1983 + 1984 + module_init(cs89x0_init); 1985 + 1986 + static void __exit cs89x0_cleanup(void) 1987 + { 1988 + platform_driver_unregister(&cs89x0_driver); 1989 + } 1990 + 1991 + module_exit(cs89x0_cleanup); 1992 + 1993 + #endif /* CONFIG_CS89x0_PLATFORM */ 1910 1994 1911 1995 /* 1912 1996 * Local variables:
-8
drivers/regulator/Kconfig
··· 258 258 This driver supports the voltage domain regulators controlled by the 259 259 DB8500 PRCMU 260 260 261 - config REGULATOR_BQ24022 262 - tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" 263 - help 264 - This driver controls a TI bq24022 Charger attached via 265 - GPIOs. The provided current regulator can enable/disable 266 - charging select between 100 mA and 500 mA charging current 267 - limit. 268 - 269 261 config REGULATOR_TPS6105X 270 262 tristate "TI TPS6105X Power regulators" 271 263 depends on TPS6105X
-1
drivers/regulator/Makefile
··· 16 16 obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o 17 17 obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o 18 18 obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o 19 - obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o 20 19 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o 21 20 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o 22 21 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
-162
drivers/regulator/bq24022.c
··· 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");
+2 -2
drivers/rtc/Kconfig
··· 780 780 will be called rtc-ep93xx. 781 781 782 782 config RTC_DRV_SA1100 783 - tristate "SA11x0/PXA2xx" 784 - depends on ARCH_SA1100 || ARCH_PXA 783 + tristate "SA11x0/PXA2xx/PXA910" 784 + depends on ARCH_SA1100 || ARCH_PXA || ARCH_MMP 785 785 help 786 786 If you say Y here you will get access to the real time clock 787 787 built into your SA11x0 or PXA2xx CPU.
+58 -13
drivers/rtc/rtc-s3c.c
··· 35 35 36 36 enum s3c_cpu_type { 37 37 TYPE_S3C2410, 38 + TYPE_S3C2416, 39 + TYPE_S3C2443, 38 40 TYPE_S3C64XX, 39 41 }; 40 42 ··· 134 132 struct platform_device *pdev = to_platform_device(dev); 135 133 struct rtc_device *rtc_dev = platform_get_drvdata(pdev); 136 134 unsigned int tmp = 0; 135 + int val; 137 136 138 137 if (!is_power_of_2(freq)) 139 138 return -EINVAL; ··· 142 139 clk_enable(rtc_clk); 143 140 spin_lock_irq(&s3c_rtc_pie_lock); 144 141 145 - if (s3c_rtc_cpu_type == TYPE_S3C2410) { 142 + if (s3c_rtc_cpu_type != TYPE_S3C64XX) { 146 143 tmp = readb(s3c_rtc_base + S3C2410_TICNT); 147 144 tmp &= S3C2410_TICNT_ENABLE; 148 145 } 149 146 150 - tmp |= (rtc_dev->max_user_freq / freq)-1; 147 + val = (rtc_dev->max_user_freq / freq) - 1; 148 + 149 + if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) { 150 + tmp |= S3C2443_TICNT_PART(val); 151 + writel(S3C2443_TICNT1_PART(val), s3c_rtc_base + S3C2443_TICNT1); 152 + 153 + if (s3c_rtc_cpu_type == TYPE_S3C2416) 154 + writel(S3C2416_TICNT2_PART(val), s3c_rtc_base + S3C2416_TICNT2); 155 + } else { 156 + tmp |= val; 157 + } 151 158 152 159 writel(tmp, s3c_rtc_base + S3C2410_TICNT); 153 160 spin_unlock_irq(&s3c_rtc_pie_lock); ··· 384 371 tmp &= ~S3C2410_RTCCON_RTCEN; 385 372 writew(tmp, base + S3C2410_RTCCON); 386 373 387 - if (s3c_rtc_cpu_type == TYPE_S3C2410) { 374 + if (s3c_rtc_cpu_type != TYPE_S3C64XX) { 388 375 tmp = readb(base + S3C2410_TICNT); 389 376 tmp &= ~S3C2410_TICNT_ENABLE; 390 377 writeb(tmp, base + S3C2410_TICNT); ··· 441 428 return 0; 442 429 } 443 430 431 + static const struct of_device_id s3c_rtc_dt_match[]; 432 + 433 + static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) 434 + { 435 + #ifdef CONFIG_OF 436 + if (pdev->dev.of_node) { 437 + const struct of_device_id *match; 438 + match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); 439 + return match->data; 440 + } 441 + #endif 442 + return platform_get_device_id(pdev)->driver_data; 443 + } 444 + 444 445 static int __devinit s3c_rtc_probe(struct platform_device *pdev) 445 446 { 446 447 struct rtc_device *rtc; 447 448 struct rtc_time rtc_tm; 448 449 struct resource *res; 449 450 int ret; 451 + int tmp; 450 452 451 453 pr_debug("%s: probe=%p\n", __func__, pdev); 452 454 ··· 536 508 goto err_nortc; 537 509 } 538 510 539 - #ifdef CONFIG_OF 540 - if (pdev->dev.of_node) 541 - s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node, 542 - "samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410; 543 - else 544 - #endif 545 - s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; 511 + s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev); 546 512 547 513 /* Check RTC Time */ 548 514 ··· 555 533 dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n"); 556 534 } 557 535 558 - if (s3c_rtc_cpu_type == TYPE_S3C64XX) 536 + if (s3c_rtc_cpu_type != TYPE_S3C2410) 559 537 rtc->max_user_freq = 32768; 560 538 else 561 539 rtc->max_user_freq = 128; 540 + 541 + if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) { 542 + tmp = readw(s3c_rtc_base + S3C2410_RTCCON); 543 + tmp |= S3C2443_RTCCON_TICSEL; 544 + writew(tmp, s3c_rtc_base + S3C2410_RTCCON); 545 + } 562 546 563 547 platform_set_drvdata(pdev, rtc); 564 548 ··· 666 638 667 639 #ifdef CONFIG_OF 668 640 static const struct of_device_id s3c_rtc_dt_match[] = { 669 - { .compatible = "samsung,s3c2410-rtc" }, 670 - { .compatible = "samsung,s3c6410-rtc" }, 641 + { 642 + .compatible = "samsung,s3c2410-rtc" 643 + .data = TYPE_S3C2410, 644 + }, { 645 + .compatible = "samsung,s3c2416-rtc" 646 + .data = TYPE_S3C2416, 647 + }, { 648 + .compatible = "samsung,s3c2443-rtc" 649 + .data = TYPE_S3C2443, 650 + }, { 651 + .compatible = "samsung,s3c6410-rtc" 652 + .data = TYPE_S3C64XX, 653 + }, 671 654 {}, 672 655 }; 673 656 MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match); ··· 690 651 { 691 652 .name = "s3c2410-rtc", 692 653 .driver_data = TYPE_S3C2410, 654 + }, { 655 + .name = "s3c2416-rtc", 656 + .driver_data = TYPE_S3C2416, 657 + }, { 658 + .name = "s3c2443-rtc", 659 + .driver_data = TYPE_S3C2443, 693 660 }, { 694 661 .name = "s3c64xx-rtc", 695 662 .driver_data = TYPE_S3C64XX,
+94 -33
drivers/rtc/rtc-sa1100.c
··· 23 23 24 24 #include <linux/platform_device.h> 25 25 #include <linux/module.h> 26 + #include <linux/clk.h> 26 27 #include <linux/rtc.h> 27 28 #include <linux/init.h> 28 29 #include <linux/fs.h> 29 30 #include <linux/interrupt.h> 31 + #include <linux/slab.h> 30 32 #include <linux/string.h> 33 + #include <linux/of.h> 31 34 #include <linux/pm.h> 32 35 #include <linux/bitops.h> 33 36 34 37 #include <mach/hardware.h> 35 38 #include <asm/irq.h> 36 39 37 - #ifdef CONFIG_ARCH_PXA 40 + #if defined(CONFIG_ARCH_PXA) || defined(CONFIG_ARCH_MMP) 38 41 #include <mach/regs-rtc.h> 39 42 #endif 40 43 41 44 #define RTC_DEF_DIVIDER (32768 - 1) 42 45 #define RTC_DEF_TRIM 0 46 + #define RTC_FREQ 1024 43 47 44 - static const unsigned long RTC_FREQ = 1024; 45 - static DEFINE_SPINLOCK(sa1100_rtc_lock); 48 + struct sa1100_rtc { 49 + spinlock_t lock; 50 + int irq_1hz; 51 + int irq_alarm; 52 + struct rtc_device *rtc; 53 + struct clk *clk; 54 + }; 46 55 47 56 static irqreturn_t sa1100_rtc_interrupt(int irq, void *dev_id) 48 57 { 49 - struct platform_device *pdev = to_platform_device(dev_id); 50 - struct rtc_device *rtc = platform_get_drvdata(pdev); 58 + struct sa1100_rtc *info = dev_get_drvdata(dev_id); 59 + struct rtc_device *rtc = info->rtc; 51 60 unsigned int rtsr; 52 61 unsigned long events = 0; 53 62 54 - spin_lock(&sa1100_rtc_lock); 63 + spin_lock(&info->lock); 55 64 56 65 rtsr = RTSR; 57 66 /* clear interrupt sources */ ··· 96 87 97 88 rtc_update_irq(rtc, 1, events); 98 89 99 - spin_unlock(&sa1100_rtc_lock); 90 + spin_unlock(&info->lock); 100 91 101 92 return IRQ_HANDLED; 102 93 } 103 94 104 95 static int sa1100_rtc_open(struct device *dev) 105 96 { 97 + struct sa1100_rtc *info = dev_get_drvdata(dev); 98 + struct rtc_device *rtc = info->rtc; 106 99 int ret; 107 - struct platform_device *plat_dev = to_platform_device(dev); 108 - struct rtc_device *rtc = platform_get_drvdata(plat_dev); 109 100 110 - ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, 0, "rtc 1Hz", dev); 101 + ret = clk_prepare_enable(info->clk); 102 + if (ret) 103 + goto fail_clk; 104 + ret = request_irq(info->irq_1hz, sa1100_rtc_interrupt, 0, "rtc 1Hz", dev); 111 105 if (ret) { 112 - dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz); 106 + dev_err(dev, "IRQ %d already in use.\n", info->irq_1hz); 113 107 goto fail_ui; 114 108 } 115 - ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, 0, 116 - "rtc Alrm", dev); 109 + ret = request_irq(info->irq_alarm, sa1100_rtc_interrupt, 0, "rtc Alrm", dev); 117 110 if (ret) { 118 - dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm); 111 + dev_err(dev, "IRQ %d already in use.\n", info->irq_alarm); 119 112 goto fail_ai; 120 113 } 121 114 rtc->max_user_freq = RTC_FREQ; ··· 126 115 return 0; 127 116 128 117 fail_ai: 129 - free_irq(IRQ_RTC1Hz, dev); 118 + free_irq(info->irq_1hz, dev); 130 119 fail_ui: 120 + clk_disable_unprepare(info->clk); 121 + fail_clk: 131 122 return ret; 132 123 } 133 124 134 125 static void sa1100_rtc_release(struct device *dev) 135 126 { 136 - spin_lock_irq(&sa1100_rtc_lock); 137 - RTSR = 0; 138 - spin_unlock_irq(&sa1100_rtc_lock); 127 + struct sa1100_rtc *info = dev_get_drvdata(dev); 139 128 140 - free_irq(IRQ_RTCAlrm, dev); 141 - free_irq(IRQ_RTC1Hz, dev); 129 + spin_lock_irq(&info->lock); 130 + RTSR = 0; 131 + spin_unlock_irq(&info->lock); 132 + 133 + free_irq(info->irq_alarm, dev); 134 + free_irq(info->irq_1hz, dev); 135 + clk_disable_unprepare(info->clk); 142 136 } 143 137 144 138 static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) 145 139 { 146 - spin_lock_irq(&sa1100_rtc_lock); 140 + struct sa1100_rtc *info = dev_get_drvdata(dev); 141 + 142 + spin_lock_irq(&info->lock); 147 143 if (enabled) 148 144 RTSR |= RTSR_ALE; 149 145 else 150 146 RTSR &= ~RTSR_ALE; 151 - spin_unlock_irq(&sa1100_rtc_lock); 147 + spin_unlock_irq(&info->lock); 152 148 return 0; 153 149 } 154 150 ··· 188 170 189 171 static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) 190 172 { 173 + struct sa1100_rtc *info = dev_get_drvdata(dev); 191 174 unsigned long time; 192 175 int ret; 193 176 194 - spin_lock_irq(&sa1100_rtc_lock); 177 + spin_lock_irq(&info->lock); 195 178 ret = rtc_tm_to_time(&alrm->time, &time); 196 179 if (ret != 0) 197 180 goto out; ··· 203 184 else 204 185 RTSR &= ~RTSR_ALE; 205 186 out: 206 - spin_unlock_irq(&sa1100_rtc_lock); 187 + spin_unlock_irq(&info->lock); 207 188 208 189 return ret; 209 190 } ··· 230 211 static int sa1100_rtc_probe(struct platform_device *pdev) 231 212 { 232 213 struct rtc_device *rtc; 214 + struct sa1100_rtc *info; 215 + int irq_1hz, irq_alarm, ret = 0; 216 + 217 + irq_1hz = platform_get_irq_byname(pdev, "rtc 1Hz"); 218 + irq_alarm = platform_get_irq_byname(pdev, "rtc alarm"); 219 + if (irq_1hz < 0 || irq_alarm < 0) 220 + return -ENODEV; 221 + 222 + info = kzalloc(sizeof(struct sa1100_rtc), GFP_KERNEL); 223 + if (!info) 224 + return -ENOMEM; 225 + info->clk = clk_get(&pdev->dev, NULL); 226 + if (IS_ERR(info->clk)) { 227 + dev_err(&pdev->dev, "failed to find rtc clock source\n"); 228 + ret = PTR_ERR(info->clk); 229 + goto err_clk; 230 + } 231 + info->irq_1hz = irq_1hz; 232 + info->irq_alarm = irq_alarm; 233 + spin_lock_init(&info->lock); 234 + platform_set_drvdata(pdev, info); 233 235 234 236 /* 235 237 * According to the manual we should be able to let RTTR be zero ··· 272 232 rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops, 273 233 THIS_MODULE); 274 234 275 - if (IS_ERR(rtc)) 276 - return PTR_ERR(rtc); 277 - 278 - platform_set_drvdata(pdev, rtc); 235 + if (IS_ERR(rtc)) { 236 + ret = PTR_ERR(rtc); 237 + goto err_dev; 238 + } 239 + info->rtc = rtc; 279 240 280 241 /* Fix for a nasty initialization problem the in SA11xx RTSR register. 281 242 * See also the comments in sa1100_rtc_interrupt(). ··· 303 262 RTSR = RTSR_AL | RTSR_HZ; 304 263 305 264 return 0; 265 + err_dev: 266 + platform_set_drvdata(pdev, NULL); 267 + clk_put(info->clk); 268 + err_clk: 269 + kfree(info); 270 + return ret; 306 271 } 307 272 308 273 static int sa1100_rtc_remove(struct platform_device *pdev) 309 274 { 310 - struct rtc_device *rtc = platform_get_drvdata(pdev); 275 + struct sa1100_rtc *info = platform_get_drvdata(pdev); 311 276 312 - if (rtc) 313 - rtc_device_unregister(rtc); 277 + if (info) { 278 + rtc_device_unregister(info->rtc); 279 + clk_put(info->clk); 280 + platform_set_drvdata(pdev, NULL); 281 + kfree(info); 282 + } 314 283 315 284 return 0; 316 285 } ··· 328 277 #ifdef CONFIG_PM 329 278 static int sa1100_rtc_suspend(struct device *dev) 330 279 { 280 + struct sa1100_rtc *info = dev_get_drvdata(dev); 331 281 if (device_may_wakeup(dev)) 332 - enable_irq_wake(IRQ_RTCAlrm); 282 + enable_irq_wake(info->irq_alarm); 333 283 return 0; 334 284 } 335 285 336 286 static int sa1100_rtc_resume(struct device *dev) 337 287 { 288 + struct sa1100_rtc *info = dev_get_drvdata(dev); 338 289 if (device_may_wakeup(dev)) 339 - disable_irq_wake(IRQ_RTCAlrm); 290 + disable_irq_wake(info->irq_alarm); 340 291 return 0; 341 292 } 342 293 ··· 348 295 }; 349 296 #endif 350 297 298 + static struct of_device_id sa1100_rtc_dt_ids[] = { 299 + { .compatible = "mrvl,sa1100-rtc", }, 300 + { .compatible = "mrvl,mmp-rtc", }, 301 + {} 302 + }; 303 + MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids); 304 + 351 305 static struct platform_driver sa1100_rtc_driver = { 352 306 .probe = sa1100_rtc_probe, 353 307 .remove = sa1100_rtc_remove, ··· 363 303 #ifdef CONFIG_PM 364 304 .pm = &sa1100_rtc_pm_ops, 365 305 #endif 306 + .of_match_table = sa1100_rtc_dt_ids, 366 307 }, 367 308 }; 368 309
+3 -4
drivers/tty/serial/imx.c
··· 1508 1508 ret = PTR_ERR(sport->clk); 1509 1509 goto unmap; 1510 1510 } 1511 - clk_enable(sport->clk); 1511 + clk_prepare_enable(sport->clk); 1512 1512 1513 1513 sport->port.uartclk = clk_get_rate(sport->clk); 1514 1514 ··· 1531 1531 if (pdata && pdata->exit) 1532 1532 pdata->exit(pdev); 1533 1533 clkput: 1534 + clk_disable_unprepare(sport->clk); 1534 1535 clk_put(sport->clk); 1535 - clk_disable(sport->clk); 1536 1536 unmap: 1537 1537 iounmap(sport->port.membase); 1538 1538 free: ··· 1552 1552 1553 1553 if (sport) { 1554 1554 uart_remove_one_port(&imx_reg, &sport->port); 1555 + clk_disable_unprepare(sport->clk); 1555 1556 clk_put(sport->clk); 1556 1557 } 1557 - 1558 - clk_disable(sport->clk); 1559 1558 1560 1559 if (pdata && pdata->exit) 1561 1560 pdata->exit(pdev);
+34
include/linux/platform_data/tegra_emc.h
··· 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
-24
include/linux/regulator/bq24022.h
··· 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 - };
+4 -4
sound/soc/imx/imx-audmux.c
··· 80 80 return -ENOMEM; 81 81 82 82 if (audmux_clk) 83 - clk_enable(audmux_clk); 83 + clk_prepare_enable(audmux_clk); 84 84 85 85 ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port)); 86 86 pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port)); 87 87 88 88 if (audmux_clk) 89 - clk_disable(audmux_clk); 89 + clk_disable_unprepare(audmux_clk); 90 90 91 91 ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n", 92 92 pdcr, ptcr); ··· 237 237 return -ENOSYS; 238 238 239 239 if (audmux_clk) 240 - clk_enable(audmux_clk); 240 + clk_prepare_enable(audmux_clk); 241 241 242 242 writel(ptcr, audmux_base + IMX_AUDMUX_V2_PTCR(port)); 243 243 writel(pdcr, audmux_base + IMX_AUDMUX_V2_PDCR(port)); 244 244 245 245 if (audmux_clk) 246 - clk_disable(audmux_clk); 246 + clk_disable_unprepare(audmux_clk); 247 247 248 248 return 0; 249 249 }