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

Merge branch 'next/dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/linux-arm-soc

* 'next/dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/linux-arm-soc: (21 commits)
arm/dt: tegra devicetree support
arm/versatile: Add device tree support
dt/irq: add irq_domain_generate_simple() helper
irq: add irq_domain translation infrastructure
dmaengine: imx-sdma: add device tree probe support
dmaengine: imx-sdma: sdma_get_firmware does not need to copy fw_name
dmaengine: imx-sdma: use platform_device_id to identify sdma version
mmc: sdhci-esdhc-imx: add device tree probe support
mmc: sdhci-pltfm: dt device does not pass parent to sdhci_alloc_host
mmc: sdhci-esdhc-imx: get rid of the uses of cpu_is_mx()
mmc: sdhci-esdhc-imx: do not reference platform data after probe
mmc: sdhci-esdhc-imx: extend card_detect and write_protect support for mx5
net/fec: add device tree probe support
net: ibm_newemac: convert it to use of_get_phy_mode
dt/net: add helper function of_get_phy_mode
net/fec: gasket needs to be enabled for some i.mx
serial/imx: add device tree probe support
serial/imx: get rid of the uses of cpu_is_mx1()
arm/dt: Add dtb make rule
arm/dt: Add skeleton dtsi file
...

+1963 -281
+20
Documentation/devicetree/bindings/arm/arm-boards
··· 1 + ARM Versatile Application and Platform Baseboards 2 + ------------------------------------------------- 3 + ARM's development hardware platform with connectors for customizable 4 + core tiles. The hardware configuration of the Versatile boards is 5 + highly customizable. 6 + 7 + Required properties (in root node): 8 + compatible = "arm,versatile-ab"; /* Application baseboard */ 9 + compatible = "arm,versatile-pb"; /* Platform baseboard */ 10 + 11 + Interrupt controllers: 12 + - VIC required properties: 13 + compatible = "arm,versatile-vic"; 14 + interrupt-controller; 15 + #interrupt-cells = <1>; 16 + 17 + - SIC required properties: 18 + compatible = "arm,versatile-sic"; 19 + interrupt-controller; 20 + #interrupt-cells = <1>;
+17
Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
··· 1 + * Freescale Smart Direct Memory Access (SDMA) Controller for i.MX 2 + 3 + Required properties: 4 + - compatible : Should be "fsl,<chip>-sdma" 5 + - reg : Should contain SDMA registers location and length 6 + - interrupts : Should contain SDMA interrupt 7 + - fsl,sdma-ram-script-name : Should contain the full path of SDMA RAM 8 + scripts firmware 9 + 10 + Examples: 11 + 12 + sdma@83fb0000 { 13 + compatible = "fsl,imx51-sdma", "fsl,imx35-sdma"; 14 + reg = <0x83fb0000 0x4000>; 15 + interrupts = <6>; 16 + fsl,sdma-ram-script-name = "sdma-imx51.bin"; 17 + };
+10
Documentation/devicetree/bindings/i2c/arm-versatile.txt
··· 1 + i2c Controller on ARM Versatile platform: 2 + 3 + Required properties: 4 + - compatible : Must be "arm,versatile-i2c"; 5 + - reg 6 + - #address-cells = <1>; 7 + - #size-cells = <0>; 8 + 9 + Optional properties: 10 + - Child nodes conforming to i2c bus binding
+34
Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
··· 1 + * Freescale Enhanced Secure Digital Host Controller (eSDHC) for i.MX 2 + 3 + The Enhanced Secure Digital Host Controller on Freescale i.MX family 4 + provides an interface for MMC, SD, and SDIO types of memory cards. 5 + 6 + Required properties: 7 + - compatible : Should be "fsl,<chip>-esdhc" 8 + - reg : Should contain eSDHC registers location and length 9 + - interrupts : Should contain eSDHC interrupt 10 + 11 + Optional properties: 12 + - fsl,card-wired : Indicate the card is wired to host permanently 13 + - fsl,cd-internal : Indicate to use controller internal card detection 14 + - fsl,wp-internal : Indicate to use controller internal write protection 15 + - cd-gpios : Specify GPIOs for card detection 16 + - wp-gpios : Specify GPIOs for write protection 17 + 18 + Examples: 19 + 20 + esdhc@70004000 { 21 + compatible = "fsl,imx51-esdhc"; 22 + reg = <0x70004000 0x4000>; 23 + interrupts = <1>; 24 + fsl,cd-internal; 25 + fsl,wp-internal; 26 + }; 27 + 28 + esdhc@70008000 { 29 + compatible = "fsl,imx51-esdhc"; 30 + reg = <0x70008000 0x4000>; 31 + interrupts = <2>; 32 + cd-gpios = <&gpio0 6 0>; /* GPIO1_6 */ 33 + wp-gpios = <&gpio0 5 0>; /* GPIO1_5 */ 34 + };
+8
Documentation/devicetree/bindings/mtd/arm-versatile.txt
··· 1 + Flash device on ARM Versatile board 2 + 3 + Required properties: 4 + - compatible : must be "arm,versatile-flash"; 5 + - bank-width : width in bytes of flash interface. 6 + 7 + Optional properties: 8 + - Subnode partition map from mtd flash binding
+24
Documentation/devicetree/bindings/net/fsl-fec.txt
··· 1 + * Freescale Fast Ethernet Controller (FEC) 2 + 3 + Required properties: 4 + - compatible : Should be "fsl,<soc>-fec" 5 + - reg : Address and length of the register set for the device 6 + - interrupts : Should contain fec interrupt 7 + - phy-mode : String, operation mode of the PHY interface. 8 + Supported values are: "mii", "gmii", "sgmii", "tbi", "rmii", 9 + "rgmii", "rgmii-id", "rgmii-rxid", "rgmii-txid", "rtbi", "smii". 10 + - phy-reset-gpios : Should specify the gpio for phy reset 11 + 12 + Optional properties: 13 + - local-mac-address : 6 bytes, mac address 14 + 15 + Example: 16 + 17 + fec@83fec000 { 18 + compatible = "fsl,imx51-fec", "fsl,imx27-fec"; 19 + reg = <0x83fec000 0x4000>; 20 + interrupts = <87>; 21 + phy-mode = "mii"; 22 + phy-reset-gpios = <&gpio1 14 0>; /* GPIO2_14 */ 23 + local-mac-address = [00 04 9F 01 1B B9]; 24 + };
+10
Documentation/devicetree/bindings/net/smsc-lan91c111.txt
··· 1 + SMSC LAN91c111 Ethernet mac 2 + 3 + Required properties: 4 + - compatible = "smsc,lan91c111"; 5 + - reg : physical address and size of registers 6 + - interrupts : interrupt connection 7 + 8 + Optional properties: 9 + - phy-device : phandle to Ethernet phy 10 + - local-mac-address : Ethernet mac address to use
+19
Documentation/devicetree/bindings/tty/serial/fsl-imx-uart.txt
··· 1 + * Freescale i.MX Universal Asynchronous Receiver/Transmitter (UART) 2 + 3 + Required properties: 4 + - compatible : Should be "fsl,<soc>-uart" 5 + - reg : Address and length of the register set for the device 6 + - interrupts : Should contain uart interrupt 7 + 8 + Optional properties: 9 + - fsl,uart-has-rtscts : Indicate the uart has rts and cts 10 + - fsl,irda-mode : Indicate the uart supports irda mode 11 + 12 + Example: 13 + 14 + uart@73fbc000 { 15 + compatible = "fsl,imx51-uart", "fsl,imx21-uart"; 16 + reg = <0x73fbc000 0x4000>; 17 + interrupts = <31>; 18 + fsl,uart-has-rtscts; 19 + };
+1
arch/arm/Kconfig
··· 1716 1716 bool "Flattened Device Tree support" 1717 1717 select OF 1718 1718 select OF_EARLY_FLATTREE 1719 + select IRQ_DOMAIN 1719 1720 help 1720 1721 Include support for flattened device tree machine descriptions. 1721 1722
+7
arch/arm/Makefile
··· 282 282 zinstall uinstall install: vmlinux 283 283 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 284 284 285 + %.dtb: 286 + $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 287 + 288 + dtbs: 289 + $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 290 + 285 291 # We use MRPROPER_FILES and CLEAN_FILES now 286 292 archclean: 287 293 $(Q)$(MAKE) $(clean)=$(boot) ··· 304 298 echo ' uImage - U-Boot wrapped zImage' 305 299 echo ' bootpImage - Combined zImage and initial RAM disk' 306 300 echo ' (supply initrd image via make variable INITRD=<path>)' 301 + echo ' dtbs - Build device tree blobs for enabled boards' 307 302 echo ' install - Install uncompressed kernel' 308 303 echo ' zinstall - Install compressed kernel' 309 304 echo ' uinstall - Install U-Boot wrapped compressed kernel'
+6
arch/arm/boot/Makefile
··· 59 59 60 60 endif 61 61 62 + # Rule to build device tree blobs 63 + $(obj)/%.dtb: $(src)/dts/%.dts 64 + $(call cmd,dtc) 65 + 66 + $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) 67 + 62 68 quiet_cmd_uimage = UIMAGE $@ 63 69 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ 64 70 -C none -a $(LOADADDR) -e $(STARTADDR) \
+13
arch/arm/boot/dts/skeleton.dtsi
··· 1 + /* 2 + * Skeleton device tree; the bare minimum needed to boot; just include and 3 + * add a compatible value. The bootloader will typically populate the memory 4 + * node. 5 + */ 6 + 7 + / { 8 + #address-cells = <1>; 9 + #size-cells = <1>; 10 + chosen { }; 11 + aliases { }; 12 + memory { device_type = "memory"; reg = <0 0>; }; 13 + };
+70
arch/arm/boot/dts/tegra-harmony.dts
··· 1 + /dts-v1/; 2 + 3 + /memreserve/ 0x1c000000 0x04000000; 4 + /include/ "tegra20.dtsi" 5 + 6 + / { 7 + model = "NVIDIA Tegra2 Harmony evaluation board"; 8 + compatible = "nvidia,harmony", "nvidia,tegra20"; 9 + 10 + chosen { 11 + bootargs = "vmalloc=192M video=tegrafb console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw rootwait"; 12 + }; 13 + 14 + memory@0 { 15 + reg = < 0x00000000 0x40000000 >; 16 + }; 17 + 18 + i2c@7000c000 { 19 + clock-frequency = <400000>; 20 + 21 + codec: wm8903@1a { 22 + compatible = "wlf,wm8903"; 23 + reg = <0x1a>; 24 + interrupts = < 347 >; 25 + 26 + gpio-controller; 27 + #gpio-cells = <2>; 28 + 29 + /* 0x8000 = Not configured */ 30 + gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >; 31 + }; 32 + }; 33 + 34 + i2c@7000c400 { 35 + clock-frequency = <400000>; 36 + }; 37 + 38 + i2c@7000c500 { 39 + clock-frequency = <400000>; 40 + }; 41 + 42 + i2c@7000d000 { 43 + clock-frequency = <400000>; 44 + }; 45 + 46 + sound { 47 + compatible = "nvidia,harmony-sound", "nvidia,tegra-wm8903"; 48 + 49 + spkr-en-gpios = <&codec 2 0>; 50 + hp-det-gpios = <&gpio 178 0>; 51 + int-mic-en-gpios = <&gpio 184 0>; 52 + ext-mic-en-gpios = <&gpio 185 0>; 53 + }; 54 + 55 + serial@70006300 { 56 + clock-frequency = < 216000000 >; 57 + }; 58 + 59 + sdhci@c8000200 { 60 + gpios = <&gpio 69 0>, /* cd, gpio PI5 */ 61 + <&gpio 57 0>, /* wp, gpio PH1 */ 62 + <&gpio 155 0>; /* power, gpio PT3 */ 63 + }; 64 + 65 + sdhci@c8000600 { 66 + gpios = <&gpio 58 0>, /* cd, gpio PH2 */ 67 + <&gpio 59 0>, /* wp, gpio PH3 */ 68 + <&gpio 70 0>; /* power, gpio PI6 */ 69 + }; 70 + };
+28
arch/arm/boot/dts/tegra-seaboard.dts
··· 1 + /dts-v1/; 2 + 3 + /memreserve/ 0x1c000000 0x04000000; 4 + /include/ "tegra20.dtsi" 5 + 6 + / { 7 + model = "NVIDIA Seaboard"; 8 + compatible = "nvidia,seaboard", "nvidia,tegra20"; 9 + 10 + chosen { 11 + bootargs = "vmalloc=192M video=tegrafb console=ttyS0,115200n8 root=/dev/mmcblk1p3 rw rootwait"; 12 + }; 13 + 14 + memory { 15 + device_type = "memory"; 16 + reg = < 0x00000000 0x40000000 >; 17 + }; 18 + 19 + serial@70006300 { 20 + clock-frequency = < 216000000 >; 21 + }; 22 + 23 + sdhci@c8000400 { 24 + gpios = <&gpio 69 0>, /* cd, gpio PI5 */ 25 + <&gpio 57 0>, /* wp, gpio PH1 */ 26 + <&gpio 70 0>; /* power, gpio PI6 */ 27 + }; 28 + };
+139
arch/arm/boot/dts/tegra20.dtsi
··· 1 + /include/ "skeleton.dtsi" 2 + 3 + / { 4 + compatible = "nvidia,tegra20"; 5 + interrupt-parent = <&intc>; 6 + 7 + intc: interrupt-controller@50041000 { 8 + compatible = "nvidia,tegra20-gic"; 9 + interrupt-controller; 10 + #interrupt-cells = <1>; 11 + reg = < 0x50041000 0x1000 >, 12 + < 0x50040100 0x0100 >; 13 + }; 14 + 15 + i2c@7000c000 { 16 + #address-cells = <1>; 17 + #size-cells = <0>; 18 + compatible = "nvidia,tegra20-i2c"; 19 + reg = <0x7000C000 0x100>; 20 + interrupts = < 70 >; 21 + }; 22 + 23 + i2c@7000c400 { 24 + #address-cells = <1>; 25 + #size-cells = <0>; 26 + compatible = "nvidia,tegra20-i2c"; 27 + reg = <0x7000C400 0x100>; 28 + interrupts = < 116 >; 29 + }; 30 + 31 + i2c@7000c500 { 32 + #address-cells = <1>; 33 + #size-cells = <0>; 34 + compatible = "nvidia,tegra20-i2c"; 35 + reg = <0x7000C500 0x100>; 36 + interrupts = < 124 >; 37 + }; 38 + 39 + i2c@7000d000 { 40 + #address-cells = <1>; 41 + #size-cells = <0>; 42 + compatible = "nvidia,tegra20-i2c"; 43 + reg = <0x7000D000 0x200>; 44 + interrupts = < 85 >; 45 + }; 46 + 47 + i2s@70002800 { 48 + #address-cells = <1>; 49 + #size-cells = <0>; 50 + compatible = "nvidia,tegra20-i2s"; 51 + reg = <0x70002800 0x200>; 52 + interrupts = < 45 >; 53 + dma-channel = < 2 >; 54 + }; 55 + 56 + i2s@70002a00 { 57 + #address-cells = <1>; 58 + #size-cells = <0>; 59 + compatible = "nvidia,tegra20-i2s"; 60 + reg = <0x70002a00 0x200>; 61 + interrupts = < 35 >; 62 + dma-channel = < 1 >; 63 + }; 64 + 65 + das@70000c00 { 66 + #address-cells = <1>; 67 + #size-cells = <0>; 68 + compatible = "nvidia,tegra20-das"; 69 + reg = <0x70000c00 0x80>; 70 + }; 71 + 72 + gpio: gpio@6000d000 { 73 + compatible = "nvidia,tegra20-gpio"; 74 + reg = < 0x6000d000 0x1000 >; 75 + interrupts = < 64 65 66 67 87 119 121 >; 76 + #gpio-cells = <2>; 77 + gpio-controller; 78 + }; 79 + 80 + serial@70006000 { 81 + compatible = "nvidia,tegra20-uart"; 82 + reg = <0x70006000 0x40>; 83 + reg-shift = <2>; 84 + interrupts = < 68 >; 85 + }; 86 + 87 + serial@70006040 { 88 + compatible = "nvidia,tegra20-uart"; 89 + reg = <0x70006040 0x40>; 90 + reg-shift = <2>; 91 + interrupts = < 69 >; 92 + }; 93 + 94 + serial@70006200 { 95 + compatible = "nvidia,tegra20-uart"; 96 + reg = <0x70006200 0x100>; 97 + reg-shift = <2>; 98 + interrupts = < 78 >; 99 + }; 100 + 101 + serial@70006300 { 102 + compatible = "nvidia,tegra20-uart"; 103 + reg = <0x70006300 0x100>; 104 + reg-shift = <2>; 105 + interrupts = < 122 >; 106 + }; 107 + 108 + serial@70006400 { 109 + compatible = "nvidia,tegra20-uart"; 110 + reg = <0x70006400 0x100>; 111 + reg-shift = <2>; 112 + interrupts = < 123 >; 113 + }; 114 + 115 + sdhci@c8000000 { 116 + compatible = "nvidia,tegra20-sdhci"; 117 + reg = <0xc8000000 0x200>; 118 + interrupts = < 46 >; 119 + }; 120 + 121 + sdhci@c8000200 { 122 + compatible = "nvidia,tegra20-sdhci"; 123 + reg = <0xc8000200 0x200>; 124 + interrupts = < 47 >; 125 + }; 126 + 127 + sdhci@c8000400 { 128 + compatible = "nvidia,tegra20-sdhci"; 129 + reg = <0xc8000400 0x200>; 130 + interrupts = < 51 >; 131 + }; 132 + 133 + sdhci@c8000600 { 134 + compatible = "nvidia,tegra20-sdhci"; 135 + reg = <0xc8000600 0x200>; 136 + interrupts = < 63 >; 137 + }; 138 + }; 139 +
+192
arch/arm/boot/dts/versatile-ab.dts
··· 1 + /dts-v1/; 2 + /include/ "skeleton.dtsi" 3 + 4 + / { 5 + model = "ARM Versatile AB"; 6 + compatible = "arm,versatile-ab"; 7 + #address-cells = <1>; 8 + #size-cells = <1>; 9 + interrupt-parent = <&vic>; 10 + 11 + aliases { 12 + serial0 = &uart0; 13 + serial1 = &uart1; 14 + serial2 = &uart2; 15 + i2c0 = &i2c0; 16 + }; 17 + 18 + memory { 19 + reg = <0x0 0x08000000>; 20 + }; 21 + 22 + flash@34000000 { 23 + compatible = "arm,versatile-flash"; 24 + reg = <0x34000000 0x4000000>; 25 + bank-width = <4>; 26 + }; 27 + 28 + i2c0: i2c@10002000 { 29 + #address-cells = <1>; 30 + #size-cells = <0>; 31 + compatible = "arm,versatile-i2c"; 32 + reg = <0x10002000 0x1000>; 33 + 34 + rtc@68 { 35 + compatible = "dallas,ds1338"; 36 + reg = <0x68>; 37 + }; 38 + }; 39 + 40 + net@10010000 { 41 + compatible = "smsc,lan91c111"; 42 + reg = <0x10010000 0x10000>; 43 + interrupts = <25>; 44 + }; 45 + 46 + lcd@10008000 { 47 + compatible = "arm,versatile-lcd"; 48 + reg = <0x10008000 0x1000>; 49 + }; 50 + 51 + amba { 52 + compatible = "arm,amba-bus"; 53 + #address-cells = <1>; 54 + #size-cells = <1>; 55 + ranges; 56 + 57 + vic: intc@10140000 { 58 + compatible = "arm,versatile-vic"; 59 + interrupt-controller; 60 + #interrupt-cells = <1>; 61 + reg = <0x10140000 0x1000>; 62 + }; 63 + 64 + sic: intc@10003000 { 65 + compatible = "arm,versatile-sic"; 66 + interrupt-controller; 67 + #interrupt-cells = <1>; 68 + reg = <0x10003000 0x1000>; 69 + interrupt-parent = <&vic>; 70 + interrupts = <31>; /* Cascaded to vic */ 71 + }; 72 + 73 + dma@10130000 { 74 + compatible = "arm,pl081", "arm,primecell"; 75 + reg = <0x10130000 0x1000>; 76 + interrupts = <17>; 77 + }; 78 + 79 + uart0: uart@101f1000 { 80 + compatible = "arm,pl011", "arm,primecell"; 81 + reg = <0x101f1000 0x1000>; 82 + interrupts = <12>; 83 + }; 84 + 85 + uart1: uart@101f2000 { 86 + compatible = "arm,pl011", "arm,primecell"; 87 + reg = <0x101f2000 0x1000>; 88 + interrupts = <13>; 89 + }; 90 + 91 + uart2: uart@101f3000 { 92 + compatible = "arm,pl011", "arm,primecell"; 93 + reg = <0x101f3000 0x1000>; 94 + interrupts = <14>; 95 + }; 96 + 97 + smc@10100000 { 98 + compatible = "arm,primecell"; 99 + reg = <0x10100000 0x1000>; 100 + }; 101 + 102 + mpmc@10110000 { 103 + compatible = "arm,primecell"; 104 + reg = <0x10110000 0x1000>; 105 + }; 106 + 107 + display@10120000 { 108 + compatible = "arm,pl110", "arm,primecell"; 109 + reg = <0x10120000 0x1000>; 110 + interrupts = <16>; 111 + }; 112 + 113 + sctl@101e0000 { 114 + compatible = "arm,primecell"; 115 + reg = <0x101e0000 0x1000>; 116 + }; 117 + 118 + watchdog@101e1000 { 119 + compatible = "arm,primecell"; 120 + reg = <0x101e1000 0x1000>; 121 + interrupts = <0>; 122 + }; 123 + 124 + gpio0: gpio@101e4000 { 125 + compatible = "arm,pl061", "arm,primecell"; 126 + reg = <0x101e4000 0x1000>; 127 + gpio-controller; 128 + interrupts = <6>; 129 + #gpio-cells = <2>; 130 + interrupt-controller; 131 + #interrupt-cells = <2>; 132 + }; 133 + 134 + gpio1: gpio@101e5000 { 135 + compatible = "arm,pl061", "arm,primecell"; 136 + reg = <0x101e5000 0x1000>; 137 + interrupts = <7>; 138 + gpio-controller; 139 + #gpio-cells = <2>; 140 + interrupt-controller; 141 + #interrupt-cells = <2>; 142 + }; 143 + 144 + rtc@101e8000 { 145 + compatible = "arm,pl030", "arm,primecell"; 146 + reg = <0x101e8000 0x1000>; 147 + interrupts = <10>; 148 + }; 149 + 150 + sci@101f0000 { 151 + compatible = "arm,primecell"; 152 + reg = <0x101f0000 0x1000>; 153 + interrupts = <15>; 154 + }; 155 + 156 + ssp@101f4000 { 157 + compatible = "arm,pl022", "arm,primecell"; 158 + reg = <0x101f4000 0x1000>; 159 + interrupts = <11>; 160 + }; 161 + 162 + fpga { 163 + compatible = "arm,versatile-fpga", "simple-bus"; 164 + #address-cells = <1>; 165 + #size-cells = <1>; 166 + ranges = <0 0x10000000 0x10000>; 167 + 168 + aaci@4000 { 169 + compatible = "arm,primecell"; 170 + reg = <0x4000 0x1000>; 171 + interrupts = <24>; 172 + }; 173 + mmc@5000 { 174 + compatible = "arm,primecell"; 175 + reg = < 0x5000 0x1000>; 176 + interrupts = <22>; 177 + }; 178 + kmi@6000 { 179 + compatible = "arm,pl050", "arm,primecell"; 180 + reg = <0x6000 0x1000>; 181 + interrupt-parent = <&sic>; 182 + interrupts = <3>; 183 + }; 184 + kmi@7000 { 185 + compatible = "arm,pl050", "arm,primecell"; 186 + reg = <0x7000 0x1000>; 187 + interrupt-parent = <&sic>; 188 + interrupts = <4>; 189 + }; 190 + }; 191 + }; 192 + };
+48
arch/arm/boot/dts/versatile-pb.dts
··· 1 + /include/ "versatile-ab.dts" 2 + 3 + / { 4 + model = "ARM Versatile PB"; 5 + compatible = "arm,versatile-pb"; 6 + 7 + amba { 8 + gpio2: gpio@101e6000 { 9 + compatible = "arm,pl061", "arm,primecell"; 10 + reg = <0x101e6000 0x1000>; 11 + interrupts = <8>; 12 + gpio-controller; 13 + #gpio-cells = <2>; 14 + interrupt-controller; 15 + #interrupt-cells = <2>; 16 + }; 17 + 18 + gpio3: gpio@101e7000 { 19 + compatible = "arm,pl061", "arm,primecell"; 20 + reg = <0x101e7000 0x1000>; 21 + interrupts = <9>; 22 + gpio-controller; 23 + #gpio-cells = <2>; 24 + interrupt-controller; 25 + #interrupt-cells = <2>; 26 + }; 27 + 28 + fpga { 29 + uart@9000 { 30 + compatible = "arm,pl011", "arm,primecell"; 31 + reg = <0x9000 0x1000>; 32 + interrupt-parent = <&sic>; 33 + interrupts = <6>; 34 + }; 35 + sci@a000 { 36 + compatible = "arm,primecell"; 37 + reg = <0xa000 0x1000>; 38 + interrupt-parent = <&sic>; 39 + interrupts = <5>; 40 + }; 41 + mmc@b000 { 42 + compatible = "arm,primecell"; 43 + reg = <0xb000 0x1000>; 44 + interrupts = <23>; 45 + }; 46 + }; 47 + }; 48 + };
+7
arch/arm/include/asm/mach/arch.h
··· 74 74 #define MACHINE_END \ 75 75 }; 76 76 77 + #define DT_MACHINE_START(_name, _namestr) \ 78 + static const struct machine_desc __mach_desc_##_name \ 79 + __used \ 80 + __attribute__((__section__(".arch.info.init"))) = { \ 81 + .nr = ~0, \ 82 + .name = _namestr, 83 + 77 84 #endif
-5
arch/arm/include/asm/prom.h
··· 16 16 #include <asm/setup.h> 17 17 #include <asm/irq.h> 18 18 19 - static inline void irq_dispose_mapping(unsigned int virq) 20 - { 21 - return; 22 - } 23 - 24 19 extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); 25 20 extern void arm_dt_memblock_reserve(void); 26 21
-14
arch/arm/kernel/devtree.c
··· 132 132 133 133 return mdesc_best; 134 134 } 135 - 136 - /** 137 - * irq_create_of_mapping - Hook to resolve OF irq specifier into a Linux irq# 138 - * 139 - * Currently the mapping mechanism is trivial; simple flat hwirq numbers are 140 - * mapped 1:1 onto Linux irq numbers. Cascaded irq controllers are not 141 - * supported. 142 - */ 143 - unsigned int irq_create_of_mapping(struct device_node *controller, 144 - const u32 *intspec, unsigned int intsize) 145 - { 146 - return intspec[0]; 147 - } 148 - EXPORT_SYMBOL_GPL(irq_create_of_mapping);
+3 -3
arch/arm/mach-imx/clock-imx1.c
··· 587 587 _REGISTER_CLOCK(NULL, "mma", mma_clk) 588 588 _REGISTER_CLOCK("imx_udc.0", NULL, usbd_clk) 589 589 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 590 - _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk) 591 - _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk) 592 - _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk) 590 + _REGISTER_CLOCK("imx1-uart.0", NULL, uart_clk) 591 + _REGISTER_CLOCK("imx1-uart.1", NULL, uart_clk) 592 + _REGISTER_CLOCK("imx1-uart.2", NULL, uart_clk) 593 593 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) 594 594 _REGISTER_CLOCK("imx1-cspi.0", NULL, spi_clk) 595 595 _REGISTER_CLOCK("imx1-cspi.1", NULL, spi_clk)
+4 -4
arch/arm/mach-imx/clock-imx21.c
··· 1162 1162 _REGISTER_CLOCK(NULL, "perclk3", per_clk[2]) 1163 1163 _REGISTER_CLOCK(NULL, "perclk4", per_clk[3]) 1164 1164 _REGISTER_CLOCK(NULL, "clko", clko_clk) 1165 - _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk[0]) 1166 - _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk[1]) 1167 - _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk[2]) 1168 - _REGISTER_CLOCK("imx-uart.3", NULL, uart_clk[3]) 1165 + _REGISTER_CLOCK("imx21-uart.0", NULL, uart_clk[0]) 1166 + _REGISTER_CLOCK("imx21-uart.1", NULL, uart_clk[1]) 1167 + _REGISTER_CLOCK("imx21-uart.2", NULL, uart_clk[2]) 1168 + _REGISTER_CLOCK("imx21-uart.3", NULL, uart_clk[3]) 1169 1169 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[0]) 1170 1170 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[1]) 1171 1171 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[2])
+11 -9
arch/arm/mach-imx/clock-imx25.c
··· 272 272 }, 273 273 274 274 static struct clk_lookup lookups[] = { 275 - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 276 - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 277 - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 278 - _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 279 - _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 275 + /* i.mx25 has the i.mx21 type uart */ 276 + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) 277 + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) 278 + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) 279 + _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk) 280 + _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk) 280 281 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk) 281 282 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk) 282 283 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk) ··· 296 295 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) 297 296 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk) 298 297 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk) 299 - _REGISTER_CLOCK("fec.0", NULL, fec_clk) 298 + _REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk) 300 299 _REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk) 301 300 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk) 302 301 _REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk) 303 302 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 304 303 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 305 - _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 306 - _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 304 + _REGISTER_CLOCK("sdhci-esdhc-imx25.0", NULL, esdhc1_clk) 305 + _REGISTER_CLOCK("sdhci-esdhc-imx25.1", NULL, esdhc2_clk) 307 306 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk) 308 307 _REGISTER_CLOCK(NULL, "audmux", audmux_clk) 309 308 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk) 310 309 _REGISTER_CLOCK("flexcan.1", NULL, can2_clk) 311 - _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 310 + /* i.mx25 has the i.mx35 type sdma */ 311 + _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk) 312 312 }; 313 313 314 314 int __init mx25_clocks_init(void)
+8 -7
arch/arm/mach-imx/clock-imx27.c
··· 624 624 }, 625 625 626 626 static struct clk_lookup lookups[] = { 627 - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 628 - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 629 - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 630 - _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 631 - _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 632 - _REGISTER_CLOCK("imx-uart.5", NULL, uart6_clk) 627 + /* i.mx27 has the i.mx21 type uart */ 628 + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) 629 + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) 630 + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) 631 + _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk) 632 + _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk) 633 + _REGISTER_CLOCK("imx21-uart.5", NULL, uart6_clk) 633 634 _REGISTER_CLOCK(NULL, "gpt1", gpt1_clk) 634 635 _REGISTER_CLOCK(NULL, "gpt2", gpt2_clk) 635 636 _REGISTER_CLOCK(NULL, "gpt3", gpt3_clk) ··· 663 662 _REGISTER_CLOCK(NULL, "brom", brom_clk) 664 663 _REGISTER_CLOCK(NULL, "emma", emma_clk) 665 664 _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk) 666 - _REGISTER_CLOCK("fec.0", NULL, fec_clk) 665 + _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) 667 666 _REGISTER_CLOCK(NULL, "emi", emi_clk) 668 667 _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk) 669 668 _REGISTER_CLOCK(NULL, "ata", ata_clk)
+7 -6
arch/arm/mach-imx/clock-imx31.c
··· 547 547 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk1) 548 548 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk2) 549 549 _REGISTER_CLOCK("mx3-camera.0", NULL, csi_clk) 550 - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 551 - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 552 - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 553 - _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 554 - _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 550 + /* i.mx31 has the i.mx21 type uart */ 551 + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) 552 + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) 553 + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) 554 + _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk) 555 + _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk) 555 556 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 556 557 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 557 558 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_clk) ··· 565 564 _REGISTER_CLOCK(NULL, "ata", ata_clk) 566 565 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 567 566 _REGISTER_CLOCK(NULL, "rng", rng_clk) 568 - _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk1) 567 + _REGISTER_CLOCK("imx31-sdma", NULL, sdma_clk1) 569 568 _REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2) 570 569 _REGISTER_CLOCK(NULL, "mstick", mstick1_clk) 571 570 _REGISTER_CLOCK(NULL, "mstick", mstick2_clk)
+10 -8
arch/arm/mach-imx/clock-imx35.c
··· 458 458 _REGISTER_CLOCK("imx-epit.0", NULL, epit1_clk) 459 459 _REGISTER_CLOCK("imx-epit.1", NULL, epit2_clk) 460 460 _REGISTER_CLOCK(NULL, "esai", esai_clk) 461 - _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 462 - _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 463 - _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk) 464 - _REGISTER_CLOCK("fec.0", NULL, fec_clk) 461 + _REGISTER_CLOCK("sdhci-esdhc-imx35.0", NULL, esdhc1_clk) 462 + _REGISTER_CLOCK("sdhci-esdhc-imx35.1", NULL, esdhc2_clk) 463 + _REGISTER_CLOCK("sdhci-esdhc-imx35.2", NULL, esdhc3_clk) 464 + /* i.mx35 has the i.mx27 type fec */ 465 + _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) 465 466 _REGISTER_CLOCK(NULL, "gpio", gpio1_clk) 466 467 _REGISTER_CLOCK(NULL, "gpio", gpio2_clk) 467 468 _REGISTER_CLOCK(NULL, "gpio", gpio3_clk) ··· 482 481 _REGISTER_CLOCK(NULL, "rtc", rtc_clk) 483 482 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 484 483 _REGISTER_CLOCK(NULL, "scc", scc_clk) 485 - _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 484 + _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk) 486 485 _REGISTER_CLOCK(NULL, "spba", spba_clk) 487 486 _REGISTER_CLOCK(NULL, "spdif", spdif_clk) 488 487 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 489 488 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 490 - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 491 - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 492 - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 489 + /* i.mx35 has the i.mx21 type uart */ 490 + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) 491 + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) 492 + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) 493 493 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk) 494 494 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk) 495 495 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
+2 -1
arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
··· 225 225 226 226 static struct esdhc_platform_data sd1_pdata = { 227 227 .cd_gpio = GPIO_SD1CD, 228 - .wp_gpio = -EINVAL, 228 + .cd_type = ESDHC_CD_GPIO, 229 + .wp_type = ESDHC_WP_NONE, 229 230 }; 230 231 231 232 /*
+2 -1
arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
··· 236 236 237 237 static struct esdhc_platform_data sd1_pdata = { 238 238 .cd_gpio = GPIO_SD1CD, 239 - .wp_gpio = -EINVAL, 239 + .cd_type = ESDHC_CD_GPIO, 240 + .wp_type = ESDHC_WP_NONE, 240 241 }; 241 242 242 243 /*
+2
arch/arm/mach-imx/mach-mx25_3ds.c
··· 215 215 static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = { 216 216 .wp_gpio = SD1_GPIO_WP, 217 217 .cd_gpio = SD1_GPIO_CD, 218 + .wp_type = ESDHC_WP_GPIO, 219 + .cd_type = ESDHC_CD_GPIO, 218 220 }; 219 221 220 222 static void __init mx25pdk_init(void)
+2
arch/arm/mach-imx/mach-pcm043.c
··· 349 349 static struct esdhc_platform_data sd1_pdata = { 350 350 .wp_gpio = SD1_GPIO_WP, 351 351 .cd_gpio = SD1_GPIO_CD, 352 + .wp_type = ESDHC_WP_GPIO, 353 + .cd_type = ESDHC_CD_GPIO, 352 354 }; 353 355 354 356 /*
+2 -2
arch/arm/mach-imx/mm-imx25.c
··· 79 79 }; 80 80 81 81 static struct sdma_platform_data imx25_sdma_pdata __initdata = { 82 - .sdma_version = 2, 83 82 .fw_name = "sdma-imx25.bin", 84 83 .script_addrs = &imx25_sdma_script, 85 84 }; ··· 91 92 mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0); 92 93 mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0); 93 94 94 - imx_add_imx_sdma(MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata); 95 + /* i.mx25 has the i.mx35 type sdma */ 96 + imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata); 95 97 }
+1 -2
arch/arm/mach-imx/mm-imx31.c
··· 69 69 }; 70 70 71 71 static struct sdma_platform_data imx31_sdma_pdata __initdata = { 72 - .sdma_version = 1, 73 72 .fw_name = "sdma-imx31-to2.bin", 74 73 .script_addrs = &imx31_to2_sdma_script, 75 74 }; ··· 87 88 imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script; 88 89 } 89 90 90 - imx_add_imx_sdma(MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata); 91 + imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata); 91 92 }
+1 -2
arch/arm/mach-imx/mm-imx35.c
··· 86 86 }; 87 87 88 88 static struct sdma_platform_data imx35_sdma_pdata __initdata = { 89 - .sdma_version = 2, 90 89 .fw_name = "sdma-imx35-to2.bin", 91 90 .script_addrs = &imx35_to2_sdma_script, 92 91 }; ··· 105 106 imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script; 106 107 } 107 108 108 - imx_add_imx_sdma(MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata); 109 + imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata); 109 110 }
+8 -6
arch/arm/mach-mx5/board-mx51_babbage.c
··· 41 41 #define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21) 42 42 #define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24) 43 43 #define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25) 44 - #define BABBAGE_SD1_CD IMX_GPIO_NR(1, 0) 45 - #define BABBAGE_SD1_WP IMX_GPIO_NR(1, 1) 46 44 #define BABBAGE_SD2_CD IMX_GPIO_NR(1, 6) 47 45 #define BABBAGE_SD2_WP IMX_GPIO_NR(1, 5) 48 46 ··· 144 146 MX51_PAD_SD1_DATA1__SD1_DATA1, 145 147 MX51_PAD_SD1_DATA2__SD1_DATA2, 146 148 MX51_PAD_SD1_DATA3__SD1_DATA3, 147 - MX51_PAD_GPIO1_0__GPIO1_0, 148 - MX51_PAD_GPIO1_1__GPIO1_1, 149 + /* CD/WP from controller */ 150 + MX51_PAD_GPIO1_0__SD1_CD, 151 + MX51_PAD_GPIO1_1__SD1_WP, 149 152 150 153 /* SD 2 */ 151 154 MX51_PAD_SD2_CMD__SD2_CMD, ··· 155 156 MX51_PAD_SD2_DATA1__SD2_DATA1, 156 157 MX51_PAD_SD2_DATA2__SD2_DATA2, 157 158 MX51_PAD_SD2_DATA3__SD2_DATA3, 159 + /* CD/WP gpio */ 158 160 MX51_PAD_GPIO1_6__GPIO1_6, 159 161 MX51_PAD_GPIO1_5__GPIO1_5, 160 162 ··· 340 340 }; 341 341 342 342 static const struct esdhc_platform_data mx51_babbage_sd1_data __initconst = { 343 - .cd_gpio = BABBAGE_SD1_CD, 344 - .wp_gpio = BABBAGE_SD1_WP, 343 + .cd_type = ESDHC_CD_CONTROLLER, 344 + .wp_type = ESDHC_WP_CONTROLLER, 345 345 }; 346 346 347 347 static const struct esdhc_platform_data mx51_babbage_sd2_data __initconst = { 348 348 .cd_gpio = BABBAGE_SD2_CD, 349 349 .wp_gpio = BABBAGE_SD2_WP, 350 + .cd_type = ESDHC_CD_GPIO, 351 + .wp_type = ESDHC_WP_GPIO, 350 352 }; 351 353 352 354 /*
+4
arch/arm/mach-mx5/board-mx53_loco.c
··· 210 210 211 211 static const struct esdhc_platform_data mx53_loco_sd1_data __initconst = { 212 212 .cd_gpio = LOCO_SD1_CD, 213 + .cd_type = ESDHC_CD_GPIO, 214 + .wp_type = ESDHC_WP_NONE, 213 215 }; 214 216 215 217 static const struct esdhc_platform_data mx53_loco_sd3_data __initconst = { 216 218 .cd_gpio = LOCO_SD3_CD, 217 219 .wp_gpio = LOCO_SD3_WP, 220 + .cd_type = ESDHC_CD_GPIO, 221 + .wp_type = ESDHC_WP_GPIO, 218 222 }; 219 223 220 224 static inline void mx53_loco_fec_reset(void)
+26 -20
arch/arm/mach-mx5/clock-mx51-mx53.c
··· 1422 1422 }, 1423 1423 1424 1424 static struct clk_lookup mx51_lookups[] = { 1425 - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 1426 - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 1427 - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 1425 + /* i.mx51 has the i.mx21 type uart */ 1426 + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) 1427 + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) 1428 + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) 1428 1429 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 1429 - _REGISTER_CLOCK("fec.0", NULL, fec_clk) 1430 + /* i.mx51 has the i.mx27 type fec */ 1431 + _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) 1430 1432 _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk) 1431 1433 _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk) 1432 1434 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) ··· 1448 1446 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 1449 1447 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 1450 1448 _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk) 1451 - _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 1449 + /* i.mx51 has the i.mx35 type sdma */ 1450 + _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk) 1452 1451 _REGISTER_CLOCK(NULL, "ckih", ckih_clk) 1453 1452 _REGISTER_CLOCK(NULL, "ckih2", ckih2_clk) 1454 1453 _REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk) ··· 1457 1454 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) 1458 1455 /* i.mx51 has the i.mx35 type cspi */ 1459 1456 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk) 1460 - _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1461 - _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 1462 - _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk) 1463 - _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_clk) 1457 + _REGISTER_CLOCK("sdhci-esdhc-imx51.0", NULL, esdhc1_clk) 1458 + _REGISTER_CLOCK("sdhci-esdhc-imx51.1", NULL, esdhc2_clk) 1459 + _REGISTER_CLOCK("sdhci-esdhc-imx51.2", NULL, esdhc3_clk) 1460 + _REGISTER_CLOCK("sdhci-esdhc-imx51.3", NULL, esdhc4_clk) 1464 1461 _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk) 1465 1462 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk) 1466 1463 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) ··· 1473 1470 }; 1474 1471 1475 1472 static struct clk_lookup mx53_lookups[] = { 1476 - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 1477 - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 1478 - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 1479 - _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 1480 - _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 1473 + /* i.mx53 has the i.mx21 type uart */ 1474 + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) 1475 + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) 1476 + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) 1477 + _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk) 1478 + _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk) 1481 1479 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 1482 - _REGISTER_CLOCK("fec.0", NULL, fec_clk) 1480 + /* i.mx53 has the i.mx25 type fec */ 1481 + _REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk) 1483 1482 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk) 1484 1483 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 1485 1484 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 1486 1485 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_mx53_clk) 1487 - _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1488 - _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_mx53_clk) 1489 - _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_mx53_clk) 1490 - _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_mx53_clk) 1491 1486 /* i.mx53 has the i.mx51 type ecspi */ 1492 1487 _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk) 1493 1488 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) 1494 1489 /* i.mx53 has the i.mx25 type cspi */ 1495 1490 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk) 1491 + _REGISTER_CLOCK("sdhci-esdhc-imx53.0", NULL, esdhc1_clk) 1492 + _REGISTER_CLOCK("sdhci-esdhc-imx53.1", NULL, esdhc2_mx53_clk) 1493 + _REGISTER_CLOCK("sdhci-esdhc-imx53.2", NULL, esdhc3_mx53_clk) 1494 + _REGISTER_CLOCK("sdhci-esdhc-imx53.3", NULL, esdhc4_mx53_clk) 1496 1495 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) 1497 1496 _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk) 1498 - _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 1497 + /* i.mx53 has the i.mx35 type sdma */ 1498 + _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk) 1499 1499 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 1500 1500 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 1501 1501 _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
+4 -4
arch/arm/mach-mx5/mm.c
··· 115 115 }; 116 116 117 117 static struct sdma_platform_data imx51_sdma_pdata __initdata = { 118 - .sdma_version = 2, 119 118 .fw_name = "sdma-imx51.bin", 120 119 .script_addrs = &imx51_sdma_script, 121 120 }; ··· 134 135 }; 135 136 136 137 static struct sdma_platform_data imx53_sdma_pdata __initdata = { 137 - .sdma_version = 2, 138 138 .fw_name = "sdma-imx53.bin", 139 139 .script_addrs = &imx53_sdma_script, 140 140 }; ··· 146 148 mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH); 147 149 mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH); 148 150 149 - imx_add_imx_sdma(MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata); 151 + /* i.mx51 has the i.mx35 type sdma */ 152 + imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata); 150 153 } 151 154 152 155 void __init imx53_soc_init(void) ··· 161 162 mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH); 162 163 mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH); 163 164 164 - imx_add_imx_sdma(MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata); 165 + /* i.mx53 has the i.mx35 type sdma */ 166 + imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata); 165 167 }
+2 -2
arch/arm/mach-mx5/mx51_efika.c
··· 260 260 }; 261 261 262 262 static struct regulator_consumer_supply vsd_consumers[] = { 263 - REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.0"), 264 - REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.1"), 263 + REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.0"), 264 + REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.1"), 265 265 }; 266 266 267 267 static struct regulator_consumer_supply pwgt1_consumer[] = {
+6
arch/arm/mach-tegra/Kconfig
··· 51 51 also be included for some of the derivative boards that 52 52 have large similarities with the seaboard design. 53 53 54 + config MACH_TEGRA_DT 55 + bool "Generic Tegra board (FDT support)" 56 + select USE_OF 57 + help 58 + Support for generic nVidia Tegra boards using Flattened Device Tree 59 + 54 60 config MACH_TRIMSLICE 55 61 bool "TrimSlice board" 56 62 select TEGRA_PCI
+3
arch/arm/mach-tegra/Makefile
··· 29 29 obj-${CONFIG_MACH_SEABOARD} += board-seaboard.o 30 30 obj-${CONFIG_MACH_SEABOARD} += board-seaboard-pinmux.o 31 31 32 + obj-${CONFIG_MACH_TEGRA_DT} += board-dt.o 33 + obj-${CONFIG_MACH_TEGRA_DT} += board-harmony-pinmux.o 34 + 32 35 obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice.o 33 36 obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice-pinmux.o
+3
arch/arm/mach-tegra/Makefile.boot
··· 1 1 zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000 2 2 params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100 3 3 initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000 4 + 5 + dtb-$(CONFIG_MACH_HARMONY) += tegra-harmony.dtb 6 + dtb-$(CONFIG_MACH_SEABOARD) += tegra-seaboard.dtb
+119
arch/arm/mach-tegra/board-dt.c
··· 1 + /* 2 + * nVidia Tegra device tree board support 3 + * 4 + * Copyright (C) 2010 Secret Lab Technologies, Ltd. 5 + * Copyright (C) 2010 Google, Inc. 6 + * 7 + * This software is licensed under the terms of the GNU General Public 8 + * License version 2, as published by the Free Software Foundation, and 9 + * may be copied, distributed, and modified under those terms. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + * 16 + */ 17 + 18 + #include <linux/kernel.h> 19 + #include <linux/init.h> 20 + #include <linux/platform_device.h> 21 + #include <linux/serial_8250.h> 22 + #include <linux/clk.h> 23 + #include <linux/dma-mapping.h> 24 + #include <linux/irqdomain.h> 25 + #include <linux/of.h> 26 + #include <linux/of_address.h> 27 + #include <linux/of_fdt.h> 28 + #include <linux/of_irq.h> 29 + #include <linux/of_platform.h> 30 + #include <linux/pda_power.h> 31 + #include <linux/io.h> 32 + #include <linux/i2c.h> 33 + #include <linux/i2c-tegra.h> 34 + 35 + #include <asm/mach-types.h> 36 + #include <asm/mach/arch.h> 37 + #include <asm/mach/time.h> 38 + #include <asm/setup.h> 39 + 40 + #include <mach/iomap.h> 41 + #include <mach/irqs.h> 42 + 43 + #include "board.h" 44 + #include "board-harmony.h" 45 + #include "clock.h" 46 + #include "devices.h" 47 + 48 + void harmony_pinmux_init(void); 49 + void seaboard_pinmux_init(void); 50 + 51 + 52 + struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { 53 + OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), 54 + OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL), 55 + OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC3_BASE, "sdhci-tegra.2", NULL), 56 + OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC4_BASE, "sdhci-tegra.3", NULL), 57 + OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C_BASE, "tegra-i2c.0", NULL), 58 + OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C2_BASE, "tegra-i2c.1", NULL), 59 + OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C3_BASE, "tegra-i2c.2", NULL), 60 + OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_DVC_BASE, "tegra-i2c.3", NULL), 61 + OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra-i2s.0", NULL), 62 + OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra-i2s.1", NULL), 63 + OF_DEV_AUXDATA("nvidia,tegra20-das", TEGRA_APB_MISC_DAS_BASE, "tegra-das", NULL), 64 + {} 65 + }; 66 + 67 + static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = { 68 + /* name parent rate enabled */ 69 + { "uartd", "pll_p", 216000000, true }, 70 + { NULL, NULL, 0, 0}, 71 + }; 72 + 73 + static struct of_device_id tegra_dt_match_table[] __initdata = { 74 + { .compatible = "simple-bus", }, 75 + {} 76 + }; 77 + 78 + static struct of_device_id tegra_dt_gic_match[] __initdata = { 79 + { .compatible = "nvidia,tegra20-gic", }, 80 + {} 81 + }; 82 + 83 + static void __init tegra_dt_init(void) 84 + { 85 + struct device_node *node; 86 + 87 + node = of_find_matching_node_by_address(NULL, tegra_dt_gic_match, 88 + TEGRA_ARM_INT_DIST_BASE); 89 + if (node) 90 + irq_domain_add_simple(node, INT_GIC_BASE); 91 + 92 + tegra_clk_init_from_table(tegra_dt_clk_init_table); 93 + 94 + if (of_machine_is_compatible("nvidia,harmony")) 95 + harmony_pinmux_init(); 96 + else if (of_machine_is_compatible("nvidia,seaboard")) 97 + seaboard_pinmux_init(); 98 + 99 + /* 100 + * Finished with the static registrations now; fill in the missing 101 + * devices 102 + */ 103 + of_platform_populate(NULL, tegra_dt_match_table, tegra20_auxdata_lookup, NULL); 104 + } 105 + 106 + static const char * tegra_dt_board_compat[] = { 107 + "nvidia,harmony", 108 + "nvidia,seaboard", 109 + NULL 110 + }; 111 + 112 + DT_MACHINE_START(TEGRA_DT, "nVidia Tegra (Flattened Device Tree)") 113 + .map_io = tegra_map_common_io, 114 + .init_early = tegra_init_early, 115 + .init_irq = tegra_init_irq, 116 + .timer = &tegra_timer, 117 + .init_machine = tegra_dt_init, 118 + .dt_compat = tegra_dt_board_compat, 119 + MACHINE_END
+8
arch/arm/mach-versatile/Kconfig
··· 17 17 Include support for the ARM(R) Versatile Application Baseboard 18 18 for the ARM926EJ-S. 19 19 20 + config MACH_VERSATILE_DT 21 + bool "Support Versatile platform from device tree" 22 + select USE_OF 23 + select CPU_ARM926T 24 + help 25 + Include support for the ARM(R) Versatile/PB platform, 26 + using the device tree for discovery 27 + 20 28 endmenu
+1
arch/arm/mach-versatile/Makefile
··· 5 5 obj-y := core.o 6 6 obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o 7 7 obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o 8 + obj-$(CONFIG_MACH_VERSATILE_DT) += versatile_dt.o 8 9 obj-$(CONFIG_PCI) += pci.o
+62
arch/arm/mach-versatile/core.c
··· 24 24 #include <linux/platform_device.h> 25 25 #include <linux/sysdev.h> 26 26 #include <linux/interrupt.h> 27 + #include <linux/irqdomain.h> 28 + #include <linux/of_address.h> 29 + #include <linux/of_platform.h> 27 30 #include <linux/amba/bus.h> 28 31 #include <linux/amba/clcd.h> 29 32 #include <linux/amba/pl061.h> ··· 86 83 #define PIC_MASK 0 87 84 #endif 88 85 86 + /* Lookup table for finding a DT node that represents the vic instance */ 87 + static const struct of_device_id vic_of_match[] __initconst = { 88 + { .compatible = "arm,versatile-vic", }, 89 + {} 90 + }; 91 + 92 + static const struct of_device_id sic_of_match[] __initconst = { 93 + { .compatible = "arm,versatile-sic", }, 94 + {} 95 + }; 96 + 89 97 void __init versatile_init_irq(void) 90 98 { 91 99 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0); 100 + irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE, IRQ_VIC_START); 92 101 93 102 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 94 103 95 104 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq); 105 + irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE, IRQ_SIC_START); 96 106 97 107 /* 98 108 * Interrupts on secondary controller from 0 to 8 are routed to ··· 661 645 &kmi0_device, 662 646 &kmi1_device, 663 647 }; 648 + 649 + #ifdef CONFIG_OF 650 + /* 651 + * Lookup table for attaching a specific name and platform_data pointer to 652 + * devices as they get created by of_platform_populate(). Ideally this table 653 + * would not exist, but the current clock implementation depends on some devices 654 + * having a specific name. 655 + */ 656 + struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = { 657 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", NULL), 658 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL), 659 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL), 660 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL), 661 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL), 662 + 663 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data), 664 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL), 665 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL), 666 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL), 667 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", NULL), 668 + 669 + #if 0 670 + /* 671 + * These entries are unnecessary because no clocks referencing 672 + * them. I've left them in for now as place holders in case 673 + * any of them need to be added back, but they should be 674 + * removed before actually committing this patch. --gcl 675 + */ 676 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_AACI_BASE, "fpga:04", NULL), 677 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI1_BASE, "fpga:0a", NULL), 678 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_SMC_BASE, "dev:00", NULL), 679 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_MPMC_BASE, "dev:10", NULL), 680 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_DMAC_BASE, "dev:30", NULL), 681 + 682 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCTL_BASE, "dev:e0", NULL), 683 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_WATCHDOG_BASE, "dev:e1", NULL), 684 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO0_BASE, "dev:e4", NULL), 685 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO1_BASE, "dev:e5", NULL), 686 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO2_BASE, "dev:e6", NULL), 687 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO3_BASE, "dev:e7", NULL), 688 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_RTC_BASE, "dev:e8", NULL), 689 + OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI_BASE, "dev:f0", NULL), 690 + #endif 691 + {} 692 + }; 693 + #endif 664 694 665 695 #ifdef CONFIG_LEDS 666 696 #define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
+4
arch/arm/mach-versatile/core.h
··· 23 23 #define __ASM_ARCH_VERSATILE_H 24 24 25 25 #include <linux/amba/bus.h> 26 + #include <linux/of_platform.h> 26 27 27 28 extern void __init versatile_init(void); 28 29 extern void __init versatile_init_early(void); ··· 31 30 extern void __init versatile_map_io(void); 32 31 extern struct sys_timer versatile_timer; 33 32 extern unsigned int mmc_status(struct device *dev); 33 + #ifdef CONFIG_OF 34 + extern struct of_dev_auxdata versatile_auxdata_lookup[]; 35 + #endif 34 36 35 37 #define AMBA_DEVICE(name,busid,base,plat) \ 36 38 static struct amba_device name##_device = { \
+51
arch/arm/mach-versatile/versatile_dt.c
··· 1 + /* 2 + * Versatile board support using the device tree 3 + * 4 + * Copyright (C) 2010 Secret Lab Technologies Ltd. 5 + * Copyright (C) 2009 Jeremy Kerr <jeremy.kerr@canonical.com> 6 + * Copyright (C) 2004 ARM Limited 7 + * Copyright (C) 2000 Deep Blue Solutions Ltd 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License as published by 11 + * the Free Software Foundation; either version 2 of the License, or 12 + * (at your option) any later version. 13 + * 14 + * This program is distributed in the hope that it will be useful, 15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 + * GNU General Public License for more details. 18 + * 19 + * You should have received a copy of the GNU General Public License 20 + * along with this program; if not, write to the Free Software 21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 + */ 23 + 24 + #include <linux/init.h> 25 + #include <linux/of_irq.h> 26 + #include <linux/of_platform.h> 27 + #include <asm/mach-types.h> 28 + #include <asm/mach/arch.h> 29 + 30 + #include "core.h" 31 + 32 + static void __init versatile_dt_init(void) 33 + { 34 + of_platform_populate(NULL, of_default_bus_match_table, 35 + versatile_auxdata_lookup, NULL); 36 + } 37 + 38 + static const char *versatile_dt_match[] __initconst = { 39 + "arm,versatile-ab", 40 + "arm,versatile-pb", 41 + NULL, 42 + }; 43 + 44 + DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)") 45 + .map_io = versatile_map_io, 46 + .init_early = versatile_init_early, 47 + .init_irq = versatile_init_irq, 48 + .timer = &versatile_timer, 49 + .init_machine = versatile_dt_init, 50 + .dt_compat = versatile_dt_match, 51 + MACHINE_END
+13 -8
arch/arm/plat-mxc/devices/platform-fec.c
··· 11 11 #include <mach/hardware.h> 12 12 #include <mach/devices-common.h> 13 13 14 - #define imx_fec_data_entry_single(soc) \ 14 + #define imx_fec_data_entry_single(soc, _devid) \ 15 15 { \ 16 + .devid = _devid, \ 16 17 .iobase = soc ## _FEC_BASE_ADDR, \ 17 18 .irq = soc ## _INT_FEC, \ 18 19 } 19 20 20 21 #ifdef CONFIG_SOC_IMX25 21 22 const struct imx_fec_data imx25_fec_data __initconst = 22 - imx_fec_data_entry_single(MX25); 23 + imx_fec_data_entry_single(MX25, "imx25-fec"); 23 24 #endif /* ifdef CONFIG_SOC_IMX25 */ 24 25 25 26 #ifdef CONFIG_SOC_IMX27 26 27 const struct imx_fec_data imx27_fec_data __initconst = 27 - imx_fec_data_entry_single(MX27); 28 + imx_fec_data_entry_single(MX27, "imx27-fec"); 28 29 #endif /* ifdef CONFIG_SOC_IMX27 */ 29 30 30 31 #ifdef CONFIG_SOC_IMX35 32 + /* i.mx35 has the i.mx27 type fec */ 31 33 const struct imx_fec_data imx35_fec_data __initconst = 32 - imx_fec_data_entry_single(MX35); 34 + imx_fec_data_entry_single(MX35, "imx27-fec"); 33 35 #endif 34 36 35 37 #ifdef CONFIG_SOC_IMX50 38 + /* i.mx50 has the i.mx25 type fec */ 36 39 const struct imx_fec_data imx50_fec_data __initconst = 37 - imx_fec_data_entry_single(MX50); 40 + imx_fec_data_entry_single(MX50, "imx25-fec"); 38 41 #endif 39 42 40 43 #ifdef CONFIG_SOC_IMX51 44 + /* i.mx51 has the i.mx27 type fec */ 41 45 const struct imx_fec_data imx51_fec_data __initconst = 42 - imx_fec_data_entry_single(MX51); 46 + imx_fec_data_entry_single(MX51, "imx27-fec"); 43 47 #endif 44 48 45 49 #ifdef CONFIG_SOC_IMX53 50 + /* i.mx53 has the i.mx25 type fec */ 46 51 const struct imx_fec_data imx53_fec_data __initconst = 47 - imx_fec_data_entry_single(MX53); 52 + imx_fec_data_entry_single(MX53, "imx25-fec"); 48 53 #endif 49 54 50 55 struct platform_device *__init imx_add_fec( ··· 68 63 }, 69 64 }; 70 65 71 - return imx_add_platform_device_dmamask("fec", 0, 66 + return imx_add_platform_device_dmamask(data->devid, 0, 72 67 res, ARRAY_SIZE(res), 73 68 pdata, sizeof(*pdata), DMA_BIT_MASK(32)); 74 69 }
+2 -2
arch/arm/plat-mxc/devices/platform-imx-dma.c
··· 14 14 "imx-dma", -1, NULL, 0, NULL, 0); 15 15 } 16 16 17 - struct platform_device __init __maybe_unused *imx_add_imx_sdma( 17 + struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name, 18 18 resource_size_t iobase, int irq, struct sdma_platform_data *pdata) 19 19 { 20 20 struct resource res[] = { ··· 29 29 }, 30 30 }; 31 31 32 - return platform_device_register_resndata(&mxc_ahb_bus, "imx-sdma", 32 + return platform_device_register_resndata(&mxc_ahb_bus, name, 33 33 -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); 34 34 }
+4 -3
arch/arm/plat-mxc/devices/platform-imx-uart.c
··· 152 152 }, 153 153 }; 154 154 155 - return imx_add_platform_device("imx-uart", data->id, res, 155 + return imx_add_platform_device("imx1-uart", data->id, res, 156 156 ARRAY_SIZE(res), pdata, sizeof(*pdata)); 157 157 } 158 158 ··· 172 172 }, 173 173 }; 174 174 175 - return imx_add_platform_device("imx-uart", data->id, res, ARRAY_SIZE(res), 176 - pdata, sizeof(*pdata)); 175 + /* i.mx21 type uart runs on all i.mx except i.mx1 */ 176 + return imx_add_platform_device("imx21-uart", data->id, 177 + res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); 177 178 }
+21 -8
arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
··· 10 10 #include <mach/devices-common.h> 11 11 #include <mach/esdhc.h> 12 12 13 - #define imx_sdhci_esdhc_imx_data_entry_single(soc, _id, hwid) \ 13 + #define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \ 14 14 { \ 15 + .devid = _devid, \ 15 16 .id = _id, \ 16 17 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \ 17 18 .irq = soc ## _INT_ESDHC ## hwid, \ 18 19 } 19 20 20 - #define imx_sdhci_esdhc_imx_data_entry(soc, id, hwid) \ 21 - [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, id, hwid) 21 + #define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid) \ 22 + [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid) 22 23 23 24 #ifdef CONFIG_SOC_IMX25 24 25 const struct imx_sdhci_esdhc_imx_data 25 26 imx25_sdhci_esdhc_imx_data[] __initconst = { 26 27 #define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 27 - imx_sdhci_esdhc_imx_data_entry(MX25, _id, _hwid) 28 + imx_sdhci_esdhc_imx_data_entry(MX25, "sdhci-esdhc-imx25", _id, _hwid) 28 29 imx25_sdhci_esdhc_imx_data_entry(0, 1), 29 30 imx25_sdhci_esdhc_imx_data_entry(1, 2), 30 31 }; ··· 35 34 const struct imx_sdhci_esdhc_imx_data 36 35 imx35_sdhci_esdhc_imx_data[] __initconst = { 37 36 #define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 38 - imx_sdhci_esdhc_imx_data_entry(MX35, _id, _hwid) 37 + imx_sdhci_esdhc_imx_data_entry(MX35, "sdhci-esdhc-imx35", _id, _hwid) 39 38 imx35_sdhci_esdhc_imx_data_entry(0, 1), 40 39 imx35_sdhci_esdhc_imx_data_entry(1, 2), 41 40 imx35_sdhci_esdhc_imx_data_entry(2, 3), ··· 46 45 const struct imx_sdhci_esdhc_imx_data 47 46 imx51_sdhci_esdhc_imx_data[] __initconst = { 48 47 #define imx51_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 49 - imx_sdhci_esdhc_imx_data_entry(MX51, _id, _hwid) 48 + imx_sdhci_esdhc_imx_data_entry(MX51, "sdhci-esdhc-imx51", _id, _hwid) 50 49 imx51_sdhci_esdhc_imx_data_entry(0, 1), 51 50 imx51_sdhci_esdhc_imx_data_entry(1, 2), 52 51 imx51_sdhci_esdhc_imx_data_entry(2, 3), ··· 58 57 const struct imx_sdhci_esdhc_imx_data 59 58 imx53_sdhci_esdhc_imx_data[] __initconst = { 60 59 #define imx53_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 61 - imx_sdhci_esdhc_imx_data_entry(MX53, _id, _hwid) 60 + imx_sdhci_esdhc_imx_data_entry(MX53, "sdhci-esdhc-imx53", _id, _hwid) 62 61 imx53_sdhci_esdhc_imx_data_entry(0, 1), 63 62 imx53_sdhci_esdhc_imx_data_entry(1, 2), 64 63 imx53_sdhci_esdhc_imx_data_entry(2, 3), 65 64 imx53_sdhci_esdhc_imx_data_entry(3, 4), 66 65 }; 67 66 #endif /* ifdef CONFIG_SOC_IMX53 */ 67 + 68 + static const struct esdhc_platform_data default_esdhc_pdata __initconst = { 69 + .wp_type = ESDHC_WP_NONE, 70 + .cd_type = ESDHC_CD_NONE, 71 + }; 68 72 69 73 struct platform_device *__init imx_add_sdhci_esdhc_imx( 70 74 const struct imx_sdhci_esdhc_imx_data *data, ··· 87 81 }, 88 82 }; 89 83 90 - return imx_add_platform_device("sdhci-esdhc-imx", data->id, res, 84 + /* 85 + * If machine does not provide pdata, use the default one 86 + * which means no WP/CD support 87 + */ 88 + if (!pdata) 89 + pdata = &default_esdhc_pdata; 90 + 91 + return imx_add_platform_device(data->devid, data->id, res, 91 92 ARRAY_SIZE(res), pdata, sizeof(*pdata)); 92 93 }
+3 -1
arch/arm/plat-mxc/include/mach/devices-common.h
··· 30 30 31 31 #include <linux/fec.h> 32 32 struct imx_fec_data { 33 + const char *devid; 33 34 resource_size_t iobase; 34 35 resource_size_t irq; 35 36 }; ··· 277 276 278 277 #include <mach/esdhc.h> 279 278 struct imx_sdhci_esdhc_imx_data { 279 + const char *devid; 280 280 int id; 281 281 resource_size_t iobase; 282 282 resource_size_t irq; ··· 299 297 const struct spi_imx_master *pdata); 300 298 301 299 struct platform_device *imx_add_imx_dma(void); 302 - struct platform_device *imx_add_imx_sdma( 300 + struct platform_device *imx_add_imx_sdma(char *name, 303 301 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
+2 -1
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), "imx-sdma") || 63 + return !strcmp(dev_name(chan->device->dev), "imx31-sdma") || 64 + !strcmp(dev_name(chan->device->dev), "imx35-sdma") || 64 65 !strcmp(dev_name(chan->device->dev), "imx-dma"); 65 66 } 66 67
+21 -4
arch/arm/plat-mxc/include/mach/esdhc.h
··· 10 10 #ifndef __ASM_ARCH_IMX_ESDHC_H 11 11 #define __ASM_ARCH_IMX_ESDHC_H 12 12 13 + enum wp_types { 14 + ESDHC_WP_NONE, /* no WP, neither controller nor gpio */ 15 + ESDHC_WP_CONTROLLER, /* mmc controller internal WP */ 16 + ESDHC_WP_GPIO, /* external gpio pin for WP */ 17 + }; 18 + 19 + enum cd_types { 20 + ESDHC_CD_NONE, /* no CD, neither controller nor gpio */ 21 + ESDHC_CD_CONTROLLER, /* mmc controller internal CD */ 22 + ESDHC_CD_GPIO, /* external gpio pin for CD */ 23 + ESDHC_CD_PERMANENT, /* no CD, card permanently wired to host */ 24 + }; 25 + 13 26 /** 14 - * struct esdhc_platform_data - optional platform data for esdhc on i.MX 27 + * struct esdhc_platform_data - platform data for esdhc on i.MX 15 28 * 16 - * strongly recommended for i.MX25/35, not needed for other variants 29 + * ESDHC_WP(CD)_CONTROLLER type is not available on i.MX25/35. 17 30 * 18 - * @wp_gpio: gpio for write_protect (-EINVAL if unused) 19 - * @cd_gpio: gpio for card_detect interrupt (-EINVAL if unused) 31 + * @wp_gpio: gpio for write_protect 32 + * @cd_gpio: gpio for card_detect interrupt 33 + * @wp_type: type of write_protect method (see wp_types enum above) 34 + * @cd_type: type of card_detect method (see cd_types enum above) 20 35 */ 21 36 22 37 struct esdhc_platform_data { 23 38 unsigned int wp_gpio; 24 39 unsigned int cd_gpio; 40 + enum wp_types wp_type; 41 + enum cd_types cd_type; 25 42 }; 26 43 #endif /* __ASM_ARCH_IMX_ESDHC_H */
-2
arch/arm/plat-mxc/include/mach/sdma.h
··· 48 48 /** 49 49 * struct sdma_platform_data - platform specific data for SDMA engine 50 50 * 51 - * @sdma_version The version of this SDMA engine 52 51 * @fw_name The firmware name 53 52 * @script_addrs SDMA scripts addresses in SDMA ROM 54 53 */ 55 54 struct sdma_platform_data { 56 - int sdma_version; 57 55 char *fw_name; 58 56 struct sdma_script_start_addrs *script_addrs; 59 57 };
+71 -23
drivers/dma/imx-sdma.c
··· 32 32 #include <linux/slab.h> 33 33 #include <linux/platform_device.h> 34 34 #include <linux/dmaengine.h> 35 + #include <linux/of.h> 36 + #include <linux/of_device.h> 35 37 36 38 #include <asm/irq.h> 37 39 #include <mach/sdma.h> ··· 67 65 #define SDMA_ONCE_RTB 0x060 68 66 #define SDMA_XTRIG_CONF1 0x070 69 67 #define SDMA_XTRIG_CONF2 0x074 70 - #define SDMA_CHNENBL0_V2 0x200 71 - #define SDMA_CHNENBL0_V1 0x080 68 + #define SDMA_CHNENBL0_IMX35 0x200 69 + #define SDMA_CHNENBL0_IMX31 0x080 72 70 #define SDMA_CHNPRI_0 0x100 73 71 74 72 /* ··· 301 299 u32 ram_code_size; 302 300 }; 303 301 302 + enum sdma_devtype { 303 + IMX31_SDMA, /* runs on i.mx31 */ 304 + IMX35_SDMA, /* runs on i.mx35 and later */ 305 + }; 306 + 304 307 struct sdma_engine { 305 308 struct device *dev; 306 309 struct device_dma_parameters dma_parms; 307 310 struct sdma_channel channel[MAX_DMA_CHANNELS]; 308 311 struct sdma_channel_control *channel_control; 309 312 void __iomem *regs; 310 - unsigned int version; 313 + enum sdma_devtype devtype; 311 314 unsigned int num_events; 312 315 struct sdma_context_data *context; 313 316 dma_addr_t context_phys; ··· 321 314 struct sdma_script_start_addrs *script_addrs; 322 315 }; 323 316 317 + static struct platform_device_id sdma_devtypes[] = { 318 + { 319 + .name = "imx31-sdma", 320 + .driver_data = IMX31_SDMA, 321 + }, { 322 + .name = "imx35-sdma", 323 + .driver_data = IMX35_SDMA, 324 + }, { 325 + /* sentinel */ 326 + } 327 + }; 328 + MODULE_DEVICE_TABLE(platform, sdma_devtypes); 329 + 330 + static const struct of_device_id sdma_dt_ids[] = { 331 + { .compatible = "fsl,imx31-sdma", .data = &sdma_devtypes[IMX31_SDMA], }, 332 + { .compatible = "fsl,imx35-sdma", .data = &sdma_devtypes[IMX35_SDMA], }, 333 + { /* sentinel */ } 334 + }; 335 + MODULE_DEVICE_TABLE(of, sdma_dt_ids); 336 + 324 337 #define SDMA_H_CONFIG_DSPDMA (1 << 12) /* indicates if the DSPDMA is used */ 325 338 #define SDMA_H_CONFIG_RTD_PINS (1 << 11) /* indicates if Real-Time Debug pins are enabled */ 326 339 #define SDMA_H_CONFIG_ACR (1 << 4) /* indicates if AHB freq /core freq = 2 or 1 */ ··· 348 321 349 322 static inline u32 chnenbl_ofs(struct sdma_engine *sdma, unsigned int event) 350 323 { 351 - u32 chnenbl0 = (sdma->version == 2 ? SDMA_CHNENBL0_V2 : SDMA_CHNENBL0_V1); 352 - 324 + u32 chnenbl0 = (sdma->devtype == IMX31_SDMA ? SDMA_CHNENBL0_IMX31 : 325 + SDMA_CHNENBL0_IMX35); 353 326 return chnenbl0 + event * 4; 354 327 } 355 328 ··· 1135 1108 const char *fw_name) 1136 1109 { 1137 1110 const struct firmware *fw; 1138 - char *fwname; 1139 1111 const struct sdma_firmware_header *header; 1140 1112 int ret; 1141 1113 const struct sdma_script_start_addrs *addr; 1142 1114 unsigned short *ram_code; 1143 1115 1144 - fwname = kasprintf(GFP_KERNEL, "%s", fw_name); 1145 - if (!fwname) 1146 - return -ENOMEM; 1147 - 1148 - ret = request_firmware(&fw, fwname, sdma->dev); 1149 - if (ret) { 1150 - kfree(fwname); 1116 + ret = request_firmware(&fw, fw_name, sdma->dev); 1117 + if (ret) 1151 1118 return ret; 1152 - } 1153 - kfree(fwname); 1154 1119 1155 1120 if (fw->size < sizeof(*header)) 1156 1121 goto err_firmware; ··· 1181 1162 int i, ret; 1182 1163 dma_addr_t ccb_phys; 1183 1164 1184 - switch (sdma->version) { 1185 - case 1: 1165 + switch (sdma->devtype) { 1166 + case IMX31_SDMA: 1186 1167 sdma->num_events = 32; 1187 1168 break; 1188 - case 2: 1169 + case IMX35_SDMA: 1189 1170 sdma->num_events = 48; 1190 1171 break; 1191 1172 default: 1192 - dev_err(sdma->dev, "Unknown version %d. aborting\n", sdma->version); 1173 + dev_err(sdma->dev, "Unknown sdma type %d. aborting\n", 1174 + sdma->devtype); 1193 1175 return -ENODEV; 1194 1176 } 1195 1177 ··· 1259 1239 1260 1240 static int __init sdma_probe(struct platform_device *pdev) 1261 1241 { 1242 + const struct of_device_id *of_id = 1243 + of_match_device(sdma_dt_ids, &pdev->dev); 1244 + struct device_node *np = pdev->dev.of_node; 1245 + const char *fw_name; 1262 1246 int ret; 1263 1247 int irq; 1264 1248 struct resource *iores; ··· 1278 1254 1279 1255 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1280 1256 irq = platform_get_irq(pdev, 0); 1281 - if (!iores || irq < 0 || !pdata) { 1257 + if (!iores || irq < 0) { 1282 1258 ret = -EINVAL; 1283 1259 goto err_irq; 1284 1260 } ··· 1308 1284 if (!sdma->script_addrs) 1309 1285 goto err_alloc; 1310 1286 1311 - sdma->version = pdata->sdma_version; 1287 + if (of_id) 1288 + pdev->id_entry = of_id->data; 1289 + sdma->devtype = pdev->id_entry->driver_data; 1312 1290 1313 1291 dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask); 1314 1292 dma_cap_set(DMA_CYCLIC, sdma->dma_device.cap_mask); ··· 1340 1314 if (ret) 1341 1315 goto err_init; 1342 1316 1343 - if (pdata->script_addrs) 1317 + if (pdata && pdata->script_addrs) 1344 1318 sdma_add_scripts(sdma, pdata->script_addrs); 1345 1319 1346 - sdma_get_firmware(sdma, pdata->fw_name); 1320 + if (pdata) { 1321 + sdma_get_firmware(sdma, pdata->fw_name); 1322 + } else { 1323 + /* 1324 + * Because that device tree does not encode ROM script address, 1325 + * the RAM script in firmware is mandatory for device tree 1326 + * probe, otherwise it fails. 1327 + */ 1328 + ret = of_property_read_string(np, "fsl,sdma-ram-script-name", 1329 + &fw_name); 1330 + if (ret) { 1331 + dev_err(&pdev->dev, "failed to get firmware name\n"); 1332 + goto err_init; 1333 + } 1334 + 1335 + ret = sdma_get_firmware(sdma, fw_name); 1336 + if (ret) { 1337 + dev_err(&pdev->dev, "failed to get firmware\n"); 1338 + goto err_init; 1339 + } 1340 + } 1347 1341 1348 1342 sdma->dma_device.dev = &pdev->dev; 1349 1343 ··· 1411 1365 static struct platform_driver sdma_driver = { 1412 1366 .driver = { 1413 1367 .name = "imx-sdma", 1368 + .of_match_table = sdma_dt_ids, 1414 1369 }, 1370 + .id_table = sdma_devtypes, 1415 1371 .remove = __exit_p(sdma_remove), 1416 1372 }; 1417 1373
+205 -56
drivers/mmc/host/sdhci-esdhc-imx.c
··· 20 20 #include <linux/mmc/host.h> 21 21 #include <linux/mmc/mmc.h> 22 22 #include <linux/mmc/sdio.h> 23 - #include <mach/hardware.h> 23 + #include <linux/of.h> 24 + #include <linux/of_device.h> 25 + #include <linux/of_gpio.h> 24 26 #include <mach/esdhc.h> 25 27 #include "sdhci-pltfm.h" 26 28 #include "sdhci-esdhc.h" ··· 31 29 #define SDHCI_VENDOR_SPEC 0xC0 32 30 #define SDHCI_VENDOR_SPEC_SDIO_QUIRK 0x00000002 33 31 34 - #define ESDHC_FLAG_GPIO_FOR_CD (1 << 0) 35 32 /* 36 33 * The CMDTYPE of the CMD register (offset 0xE) should be set to 37 34 * "11" when the STOP CMD12 is issued on imx53 to abort one ··· 44 43 */ 45 44 #define ESDHC_FLAG_MULTIBLK_NO_INT (1 << 1) 46 45 46 + enum imx_esdhc_type { 47 + IMX25_ESDHC, 48 + IMX35_ESDHC, 49 + IMX51_ESDHC, 50 + IMX53_ESDHC, 51 + }; 52 + 47 53 struct pltfm_imx_data { 48 54 int flags; 49 55 u32 scratchpad; 56 + enum imx_esdhc_type devtype; 57 + struct esdhc_platform_data boarddata; 50 58 }; 59 + 60 + static struct platform_device_id imx_esdhc_devtype[] = { 61 + { 62 + .name = "sdhci-esdhc-imx25", 63 + .driver_data = IMX25_ESDHC, 64 + }, { 65 + .name = "sdhci-esdhc-imx35", 66 + .driver_data = IMX35_ESDHC, 67 + }, { 68 + .name = "sdhci-esdhc-imx51", 69 + .driver_data = IMX51_ESDHC, 70 + }, { 71 + .name = "sdhci-esdhc-imx53", 72 + .driver_data = IMX53_ESDHC, 73 + }, { 74 + /* sentinel */ 75 + } 76 + }; 77 + MODULE_DEVICE_TABLE(platform, imx_esdhc_devtype); 78 + 79 + static const struct of_device_id imx_esdhc_dt_ids[] = { 80 + { .compatible = "fsl,imx25-esdhc", .data = &imx_esdhc_devtype[IMX25_ESDHC], }, 81 + { .compatible = "fsl,imx35-esdhc", .data = &imx_esdhc_devtype[IMX35_ESDHC], }, 82 + { .compatible = "fsl,imx51-esdhc", .data = &imx_esdhc_devtype[IMX51_ESDHC], }, 83 + { .compatible = "fsl,imx53-esdhc", .data = &imx_esdhc_devtype[IMX53_ESDHC], }, 84 + { /* sentinel */ } 85 + }; 86 + MODULE_DEVICE_TABLE(of, imx_esdhc_dt_ids); 87 + 88 + static inline int is_imx25_esdhc(struct pltfm_imx_data *data) 89 + { 90 + return data->devtype == IMX25_ESDHC; 91 + } 92 + 93 + static inline int is_imx35_esdhc(struct pltfm_imx_data *data) 94 + { 95 + return data->devtype == IMX35_ESDHC; 96 + } 97 + 98 + static inline int is_imx51_esdhc(struct pltfm_imx_data *data) 99 + { 100 + return data->devtype == IMX51_ESDHC; 101 + } 102 + 103 + static inline int is_imx53_esdhc(struct pltfm_imx_data *data) 104 + { 105 + return data->devtype == IMX53_ESDHC; 106 + } 51 107 52 108 static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg) 53 109 { ··· 118 60 { 119 61 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 120 62 struct pltfm_imx_data *imx_data = pltfm_host->priv; 63 + struct esdhc_platform_data *boarddata = &imx_data->boarddata; 121 64 122 - /* fake CARD_PRESENT flag on mx25/35 */ 65 + /* fake CARD_PRESENT flag */ 123 66 u32 val = readl(host->ioaddr + reg); 124 67 125 68 if (unlikely((reg == SDHCI_PRESENT_STATE) 126 - && (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD))) { 127 - struct esdhc_platform_data *boarddata = 128 - host->mmc->parent->platform_data; 129 - 130 - if (boarddata && gpio_is_valid(boarddata->cd_gpio) 131 - && gpio_get_value(boarddata->cd_gpio)) 69 + && gpio_is_valid(boarddata->cd_gpio))) { 70 + if (gpio_get_value(boarddata->cd_gpio)) 132 71 /* no card, if a valid gpio says so... */ 133 72 val &= ~SDHCI_CARD_PRESENT; 134 73 else ··· 140 85 { 141 86 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 142 87 struct pltfm_imx_data *imx_data = pltfm_host->priv; 88 + struct esdhc_platform_data *boarddata = &imx_data->boarddata; 143 89 144 90 if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE) 145 - && (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD))) 91 + && (boarddata->cd_type == ESDHC_CD_GPIO))) 146 92 /* 147 93 * these interrupts won't work with a custom card_detect gpio 148 - * (only applied to mx25/35) 149 94 */ 150 95 val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT); 151 96 ··· 228 173 return; 229 174 } 230 175 esdhc_clrset_le(host, 0xff, val, reg); 176 + 177 + /* 178 + * The esdhc has a design violation to SDHC spec which tells 179 + * that software reset should not affect card detection circuit. 180 + * But esdhc clears its SYSCTL register bits [0..2] during the 181 + * software reset. This will stop those clocks that card detection 182 + * circuit relies on. To work around it, we turn the clocks on back 183 + * to keep card detection circuit functional. 184 + */ 185 + if ((reg == SDHCI_SOFTWARE_RESET) && (val & 1)) 186 + esdhc_clrset_le(host, 0x7, 0x7, ESDHC_SYSTEM_CONTROL); 231 187 } 232 188 233 189 static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host) ··· 255 189 return clk_get_rate(pltfm_host->clk) / 256 / 16; 256 190 } 257 191 192 + static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host) 193 + { 194 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 195 + struct pltfm_imx_data *imx_data = pltfm_host->priv; 196 + struct esdhc_platform_data *boarddata = &imx_data->boarddata; 197 + 198 + switch (boarddata->wp_type) { 199 + case ESDHC_WP_GPIO: 200 + if (gpio_is_valid(boarddata->wp_gpio)) 201 + return gpio_get_value(boarddata->wp_gpio); 202 + case ESDHC_WP_CONTROLLER: 203 + return !(readl(host->ioaddr + SDHCI_PRESENT_STATE) & 204 + SDHCI_WRITE_PROTECT); 205 + case ESDHC_WP_NONE: 206 + break; 207 + } 208 + 209 + return -ENOSYS; 210 + } 211 + 258 212 static struct sdhci_ops sdhci_esdhc_ops = { 259 213 .read_l = esdhc_readl_le, 260 214 .read_w = esdhc_readw_le, ··· 284 198 .set_clock = esdhc_set_clock, 285 199 .get_max_clock = esdhc_pltfm_get_max_clock, 286 200 .get_min_clock = esdhc_pltfm_get_min_clock, 201 + .get_ro = esdhc_pltfm_get_ro, 287 202 }; 288 203 289 204 static struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = { ··· 294 207 .ops = &sdhci_esdhc_ops, 295 208 }; 296 209 297 - static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host) 298 - { 299 - struct esdhc_platform_data *boarddata = 300 - host->mmc->parent->platform_data; 301 - 302 - if (boarddata && gpio_is_valid(boarddata->wp_gpio)) 303 - return gpio_get_value(boarddata->wp_gpio); 304 - else 305 - return -ENOSYS; 306 - } 307 - 308 210 static irqreturn_t cd_irq(int irq, void *data) 309 211 { 310 212 struct sdhci_host *sdhost = (struct sdhci_host *)data; ··· 302 226 return IRQ_HANDLED; 303 227 }; 304 228 229 + #ifdef CONFIG_OF 230 + static int __devinit 231 + sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, 232 + struct esdhc_platform_data *boarddata) 233 + { 234 + struct device_node *np = pdev->dev.of_node; 235 + 236 + if (!np) 237 + return -ENODEV; 238 + 239 + if (of_get_property(np, "fsl,card-wired", NULL)) 240 + boarddata->cd_type = ESDHC_CD_PERMANENT; 241 + 242 + if (of_get_property(np, "fsl,cd-controller", NULL)) 243 + boarddata->cd_type = ESDHC_CD_CONTROLLER; 244 + 245 + if (of_get_property(np, "fsl,wp-controller", NULL)) 246 + boarddata->wp_type = ESDHC_WP_CONTROLLER; 247 + 248 + boarddata->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0); 249 + if (gpio_is_valid(boarddata->cd_gpio)) 250 + boarddata->cd_type = ESDHC_CD_GPIO; 251 + 252 + boarddata->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0); 253 + if (gpio_is_valid(boarddata->wp_gpio)) 254 + boarddata->wp_type = ESDHC_WP_GPIO; 255 + 256 + return 0; 257 + } 258 + #else 259 + static inline int 260 + sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, 261 + struct esdhc_platform_data *boarddata) 262 + { 263 + return -ENODEV; 264 + } 265 + #endif 266 + 305 267 static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) 306 268 { 269 + const struct of_device_id *of_id = 270 + of_match_device(imx_esdhc_dt_ids, &pdev->dev); 307 271 struct sdhci_pltfm_host *pltfm_host; 308 272 struct sdhci_host *host; 309 273 struct esdhc_platform_data *boarddata; ··· 358 242 pltfm_host = sdhci_priv(host); 359 243 360 244 imx_data = kzalloc(sizeof(struct pltfm_imx_data), GFP_KERNEL); 361 - if (!imx_data) 362 - return -ENOMEM; 245 + if (!imx_data) { 246 + err = -ENOMEM; 247 + goto err_imx_data; 248 + } 249 + 250 + if (of_id) 251 + pdev->id_entry = of_id->data; 252 + imx_data->devtype = pdev->id_entry->driver_data; 363 253 pltfm_host->priv = imx_data; 364 254 365 255 clk = clk_get(mmc_dev(host->mmc), NULL); ··· 377 255 clk_enable(clk); 378 256 pltfm_host->clk = clk; 379 257 380 - if (!cpu_is_mx25()) 258 + if (!is_imx25_esdhc(imx_data)) 381 259 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; 382 260 383 - if (cpu_is_mx25() || cpu_is_mx35()) { 261 + if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) 384 262 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ 385 263 host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK; 386 - /* write_protect can't be routed to controller, use gpio */ 387 - sdhci_esdhc_ops.get_ro = esdhc_pltfm_get_ro; 388 - } 389 264 390 - if (!(cpu_is_mx25() || cpu_is_mx35() || cpu_is_mx51())) 265 + if (is_imx53_esdhc(imx_data)) 391 266 imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT; 392 267 393 - boarddata = host->mmc->parent->platform_data; 394 - if (boarddata) { 268 + boarddata = &imx_data->boarddata; 269 + if (sdhci_esdhc_imx_probe_dt(pdev, boarddata) < 0) { 270 + if (!host->mmc->parent->platform_data) { 271 + dev_err(mmc_dev(host->mmc), "no board data!\n"); 272 + err = -EINVAL; 273 + goto no_board_data; 274 + } 275 + imx_data->boarddata = *((struct esdhc_platform_data *) 276 + host->mmc->parent->platform_data); 277 + } 278 + 279 + /* write_protect */ 280 + if (boarddata->wp_type == ESDHC_WP_GPIO) { 395 281 err = gpio_request_one(boarddata->wp_gpio, GPIOF_IN, "ESDHC_WP"); 396 282 if (err) { 397 283 dev_warn(mmc_dev(host->mmc), 398 - "no write-protect pin available!\n"); 399 - boarddata->wp_gpio = err; 284 + "no write-protect pin available!\n"); 285 + boarddata->wp_gpio = -EINVAL; 400 286 } 287 + } else { 288 + boarddata->wp_gpio = -EINVAL; 289 + } 401 290 291 + /* card_detect */ 292 + if (boarddata->cd_type != ESDHC_CD_GPIO) 293 + boarddata->cd_gpio = -EINVAL; 294 + 295 + switch (boarddata->cd_type) { 296 + case ESDHC_CD_GPIO: 402 297 err = gpio_request_one(boarddata->cd_gpio, GPIOF_IN, "ESDHC_CD"); 403 298 if (err) { 404 - dev_warn(mmc_dev(host->mmc), 299 + dev_err(mmc_dev(host->mmc), 405 300 "no card-detect pin available!\n"); 406 301 goto no_card_detect_pin; 407 302 } 408 - 409 - /* i.MX5x has issues to be researched */ 410 - if (!cpu_is_mx25() && !cpu_is_mx35()) 411 - goto not_supported; 412 303 413 304 err = request_irq(gpio_to_irq(boarddata->cd_gpio), cd_irq, 414 305 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 415 306 mmc_hostname(host->mmc), host); 416 307 if (err) { 417 - dev_warn(mmc_dev(host->mmc), "request irq error\n"); 308 + dev_err(mmc_dev(host->mmc), "request irq error\n"); 418 309 goto no_card_detect_irq; 419 310 } 311 + /* fall through */ 420 312 421 - imx_data->flags |= ESDHC_FLAG_GPIO_FOR_CD; 422 - /* Now we have a working card_detect again */ 313 + case ESDHC_CD_CONTROLLER: 314 + /* we have a working card_detect back */ 423 315 host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; 316 + break; 317 + 318 + case ESDHC_CD_PERMANENT: 319 + host->mmc->caps = MMC_CAP_NONREMOVABLE; 320 + break; 321 + 322 + case ESDHC_CD_NONE: 323 + break; 424 324 } 425 325 426 326 err = sdhci_add_host(host); ··· 451 307 452 308 return 0; 453 309 454 - no_card_detect_irq: 455 - gpio_free(boarddata->cd_gpio); 456 - no_card_detect_pin: 457 - boarddata->cd_gpio = err; 458 - not_supported: 459 - kfree(imx_data); 460 - err_add_host: 310 + err_add_host: 311 + if (gpio_is_valid(boarddata->cd_gpio)) 312 + free_irq(gpio_to_irq(boarddata->cd_gpio), host); 313 + no_card_detect_irq: 314 + if (gpio_is_valid(boarddata->cd_gpio)) 315 + gpio_free(boarddata->cd_gpio); 316 + if (gpio_is_valid(boarddata->wp_gpio)) 317 + gpio_free(boarddata->wp_gpio); 318 + no_card_detect_pin: 319 + no_board_data: 461 320 clk_disable(pltfm_host->clk); 462 321 clk_put(pltfm_host->clk); 463 - err_clk_get: 322 + err_clk_get: 323 + kfree(imx_data); 324 + err_imx_data: 464 325 sdhci_pltfm_free(pdev); 465 326 return err; 466 327 } ··· 474 325 { 475 326 struct sdhci_host *host = platform_get_drvdata(pdev); 476 327 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 477 - struct esdhc_platform_data *boarddata = host->mmc->parent->platform_data; 478 328 struct pltfm_imx_data *imx_data = pltfm_host->priv; 329 + struct esdhc_platform_data *boarddata = &imx_data->boarddata; 479 330 int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); 480 331 481 332 sdhci_remove_host(host, dead); 482 333 483 - if (boarddata && gpio_is_valid(boarddata->wp_gpio)) 334 + if (gpio_is_valid(boarddata->wp_gpio)) 484 335 gpio_free(boarddata->wp_gpio); 485 336 486 - if (boarddata && gpio_is_valid(boarddata->cd_gpio)) { 337 + if (gpio_is_valid(boarddata->cd_gpio)) { 338 + free_irq(gpio_to_irq(boarddata->cd_gpio), host); 487 339 gpio_free(boarddata->cd_gpio); 488 - 489 - if (!(host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)) 490 - free_irq(gpio_to_irq(boarddata->cd_gpio), host); 491 340 } 492 341 493 342 clk_disable(pltfm_host->clk); ··· 501 354 .driver = { 502 355 .name = "sdhci-esdhc-imx", 503 356 .owner = THIS_MODULE, 357 + .of_match_table = imx_esdhc_dt_ids, 504 358 }, 359 + .id_table = imx_esdhc_devtype, 505 360 .probe = sdhci_esdhc_imx_probe, 506 361 .remove = __devexit_p(sdhci_esdhc_imx_remove), 507 362 #ifdef CONFIG_PM
+2 -1
drivers/mmc/host/sdhci-pltfm.c
··· 85 85 { 86 86 struct sdhci_host *host; 87 87 struct sdhci_pltfm_host *pltfm_host; 88 + struct device_node *np = pdev->dev.of_node; 88 89 struct resource *iomem; 89 90 int ret; 90 91 ··· 99 98 dev_err(&pdev->dev, "Invalid iomem size!\n"); 100 99 101 100 /* Some PCI-based MFD need the parent here */ 102 - if (pdev->dev.parent != &platform_bus) 101 + if (pdev->dev.parent != &platform_bus && !np) 103 102 host = sdhci_alloc_host(pdev->dev.parent, sizeof(*pltfm_host)); 104 103 else 105 104 host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));
+116 -9
drivers/net/fec.c
··· 44 44 #include <linux/platform_device.h> 45 45 #include <linux/phy.h> 46 46 #include <linux/fec.h> 47 + #include <linux/of.h> 48 + #include <linux/of_device.h> 49 + #include <linux/of_gpio.h> 50 + #include <linux/of_net.h> 47 51 48 52 #include <asm/cacheflush.h> 49 53 ··· 70 66 #define FEC_QUIRK_ENET_MAC (1 << 0) 71 67 /* Controller needs driver to swap frame */ 72 68 #define FEC_QUIRK_SWAP_FRAME (1 << 1) 69 + /* Controller uses gasket */ 70 + #define FEC_QUIRK_USE_GASKET (1 << 2) 73 71 74 72 static struct platform_device_id fec_devtype[] = { 75 73 { 74 + /* keep it for coldfire */ 76 75 .name = DRIVER_NAME, 76 + .driver_data = 0, 77 + }, { 78 + .name = "imx25-fec", 79 + .driver_data = FEC_QUIRK_USE_GASKET, 80 + }, { 81 + .name = "imx27-fec", 77 82 .driver_data = 0, 78 83 }, { 79 84 .name = "imx28-fec", 80 85 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME, 81 - }, 82 - { } 86 + }, { 87 + /* sentinel */ 88 + } 83 89 }; 90 + MODULE_DEVICE_TABLE(platform, fec_devtype); 91 + 92 + enum imx_fec_type { 93 + IMX25_FEC = 1, /* runs on i.mx25/50/53 */ 94 + IMX27_FEC, /* runs on i.mx27/35/51 */ 95 + IMX28_FEC, 96 + }; 97 + 98 + static const struct of_device_id fec_dt_ids[] = { 99 + { .compatible = "fsl,imx25-fec", .data = &fec_devtype[IMX25_FEC], }, 100 + { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], }, 101 + { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], }, 102 + { /* sentinel */ } 103 + }; 104 + MODULE_DEVICE_TABLE(of, fec_dt_ids); 84 105 85 106 static unsigned char macaddr[ETH_ALEN]; 86 107 module_param_array(macaddr, byte, NULL, 0); ··· 456 427 457 428 } else { 458 429 #ifdef FEC_MIIGSK_ENR 459 - if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) { 430 + if (id_entry->driver_data & FEC_QUIRK_USE_GASKET) { 460 431 /* disable the gasket and wait */ 461 432 writel(0, fep->hwp + FEC_MIIGSK_ENR); 462 433 while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4) ··· 465 436 /* 466 437 * configure the gasket: 467 438 * RMII, 50 MHz, no loopback, no echo 439 + * MII, 25 MHz, no loopback, no echo 468 440 */ 469 - writel(1, fep->hwp + FEC_MIIGSK_CFGR); 441 + writel((fep->phy_interface == PHY_INTERFACE_MODE_RMII) ? 442 + 1 : 0, fep->hwp + FEC_MIIGSK_CFGR); 443 + 470 444 471 445 /* re-enable the gasket */ 472 446 writel(2, fep->hwp + FEC_MIIGSK_ENR); ··· 766 734 */ 767 735 iap = macaddr; 768 736 737 + #ifdef CONFIG_OF 769 738 /* 770 - * 2) from flash or fuse (via platform data) 739 + * 2) from device tree data 740 + */ 741 + if (!is_valid_ether_addr(iap)) { 742 + struct device_node *np = fep->pdev->dev.of_node; 743 + if (np) { 744 + const char *mac = of_get_mac_address(np); 745 + if (mac) 746 + iap = (unsigned char *) mac; 747 + } 748 + } 749 + #endif 750 + 751 + /* 752 + * 3) from flash or fuse (via platform data) 771 753 */ 772 754 if (!is_valid_ether_addr(iap)) { 773 755 #ifdef CONFIG_M5272 ··· 794 748 } 795 749 796 750 /* 797 - * 3) FEC mac registers set by bootloader 751 + * 4) FEC mac registers set by bootloader 798 752 */ 799 753 if (!is_valid_ether_addr(iap)) { 800 754 *((unsigned long *) &tmpaddr[0]) = ··· 1400 1354 return 0; 1401 1355 } 1402 1356 1357 + #ifdef CONFIG_OF 1358 + static int __devinit fec_get_phy_mode_dt(struct platform_device *pdev) 1359 + { 1360 + struct device_node *np = pdev->dev.of_node; 1361 + 1362 + if (np) 1363 + return of_get_phy_mode(np); 1364 + 1365 + return -ENODEV; 1366 + } 1367 + 1368 + static int __devinit fec_reset_phy(struct platform_device *pdev) 1369 + { 1370 + int err, phy_reset; 1371 + struct device_node *np = pdev->dev.of_node; 1372 + 1373 + if (!np) 1374 + return -ENODEV; 1375 + 1376 + phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0); 1377 + err = gpio_request_one(phy_reset, GPIOF_OUT_INIT_LOW, "phy-reset"); 1378 + if (err) { 1379 + pr_warn("FEC: failed to get gpio phy-reset: %d\n", err); 1380 + return err; 1381 + } 1382 + msleep(1); 1383 + gpio_set_value(phy_reset, 1); 1384 + 1385 + return 0; 1386 + } 1387 + #else /* CONFIG_OF */ 1388 + static inline int fec_get_phy_mode_dt(struct platform_device *pdev) 1389 + { 1390 + return -ENODEV; 1391 + } 1392 + 1393 + static inline int fec_reset_phy(struct platform_device *pdev) 1394 + { 1395 + /* 1396 + * In case of platform probe, the reset has been done 1397 + * by machine code. 1398 + */ 1399 + return 0; 1400 + } 1401 + #endif /* CONFIG_OF */ 1402 + 1403 1403 static int __devinit 1404 1404 fec_probe(struct platform_device *pdev) 1405 1405 { ··· 1454 1362 struct net_device *ndev; 1455 1363 int i, irq, ret = 0; 1456 1364 struct resource *r; 1365 + const struct of_device_id *of_id; 1366 + 1367 + of_id = of_match_device(fec_dt_ids, &pdev->dev); 1368 + if (of_id) 1369 + pdev->id_entry = of_id->data; 1457 1370 1458 1371 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1459 1372 if (!r) ··· 1490 1393 1491 1394 platform_set_drvdata(pdev, ndev); 1492 1395 1493 - pdata = pdev->dev.platform_data; 1494 - if (pdata) 1495 - fep->phy_interface = pdata->phy; 1396 + ret = fec_get_phy_mode_dt(pdev); 1397 + if (ret < 0) { 1398 + pdata = pdev->dev.platform_data; 1399 + if (pdata) 1400 + fep->phy_interface = pdata->phy; 1401 + else 1402 + fep->phy_interface = PHY_INTERFACE_MODE_MII; 1403 + } else { 1404 + fep->phy_interface = ret; 1405 + } 1406 + 1407 + fec_reset_phy(pdev); 1496 1408 1497 1409 /* This device has up to three irqs on some platforms */ 1498 1410 for (i = 0; i < 3; i++) { ··· 1636 1530 #ifdef CONFIG_PM 1637 1531 .pm = &fec_pm_ops, 1638 1532 #endif 1533 + .of_match_table = fec_dt_ids, 1639 1534 }, 1640 1535 .id_table = fec_devtype, 1641 1536 .probe = fec_probe,
+4 -29
drivers/net/ibm_newemac/core.c
··· 39 39 #include <linux/bitops.h> 40 40 #include <linux/workqueue.h> 41 41 #include <linux/of.h> 42 + #include <linux/of_net.h> 42 43 #include <linux/slab.h> 43 44 44 45 #include <asm/processor.h> ··· 2507 2506 { 2508 2507 struct device_node *np = dev->ofdev->dev.of_node; 2509 2508 const void *p; 2510 - unsigned int plen; 2511 - const char *pm, *phy_modes[] = { 2512 - [PHY_MODE_NA] = "", 2513 - [PHY_MODE_MII] = "mii", 2514 - [PHY_MODE_RMII] = "rmii", 2515 - [PHY_MODE_SMII] = "smii", 2516 - [PHY_MODE_RGMII] = "rgmii", 2517 - [PHY_MODE_TBI] = "tbi", 2518 - [PHY_MODE_GMII] = "gmii", 2519 - [PHY_MODE_RTBI] = "rtbi", 2520 - [PHY_MODE_SGMII] = "sgmii", 2521 - }; 2522 2509 2523 2510 /* Read config from device-tree */ 2524 2511 if (emac_read_uint_prop(np, "mal-device", &dev->mal_ph, 1)) ··· 2555 2566 dev->mal_burst_size = 256; 2556 2567 2557 2568 /* PHY mode needs some decoding */ 2558 - dev->phy_mode = PHY_MODE_NA; 2559 - pm = of_get_property(np, "phy-mode", &plen); 2560 - if (pm != NULL) { 2561 - int i; 2562 - for (i = 0; i < ARRAY_SIZE(phy_modes); i++) 2563 - if (!strcasecmp(pm, phy_modes[i])) { 2564 - dev->phy_mode = i; 2565 - break; 2566 - } 2567 - } 2568 - 2569 - /* Backward compat with non-final DT */ 2570 - if (dev->phy_mode == PHY_MODE_NA && pm != NULL && plen == 4) { 2571 - u32 nmode = *(const u32 *)pm; 2572 - if (nmode > PHY_MODE_NA && nmode <= PHY_MODE_SGMII) 2573 - dev->phy_mode = nmode; 2574 - } 2569 + dev->phy_mode = of_get_phy_mode(np); 2570 + if (dev->phy_mode < 0) 2571 + dev->phy_mode = PHY_MODE_NA; 2575 2572 2576 2573 /* Check EMAC version */ 2577 2574 if (of_device_is_compatible(np, "ibm,emac4sync")) {
+10 -9
drivers/net/ibm_newemac/emac.h
··· 26 26 #define __IBM_NEWEMAC_H 27 27 28 28 #include <linux/types.h> 29 + #include <linux/phy.h> 29 30 30 31 /* EMAC registers Write Access rules */ 31 32 struct emac_regs { ··· 107 106 /* 108 107 * PHY mode settings (EMAC <-> ZMII/RGMII bridge <-> PHY) 109 108 */ 110 - #define PHY_MODE_NA 0 111 - #define PHY_MODE_MII 1 112 - #define PHY_MODE_RMII 2 113 - #define PHY_MODE_SMII 3 114 - #define PHY_MODE_RGMII 4 115 - #define PHY_MODE_TBI 5 116 - #define PHY_MODE_GMII 6 117 - #define PHY_MODE_RTBI 7 118 - #define PHY_MODE_SGMII 8 109 + #define PHY_MODE_NA PHY_INTERFACE_MODE_NA 110 + #define PHY_MODE_MII PHY_INTERFACE_MODE_MII 111 + #define PHY_MODE_RMII PHY_INTERFACE_MODE_RMII 112 + #define PHY_MODE_SMII PHY_INTERFACE_MODE_SMII 113 + #define PHY_MODE_RGMII PHY_INTERFACE_MODE_RGMII 114 + #define PHY_MODE_TBI PHY_INTERFACE_MODE_TBI 115 + #define PHY_MODE_GMII PHY_INTERFACE_MODE_GMII 116 + #define PHY_MODE_RTBI PHY_INTERFACE_MODE_RTBI 117 + #define PHY_MODE_SGMII PHY_INTERFACE_MODE_SGMII 119 118 120 119 /* EMACx_MR0 */ 121 120 #define EMAC_MR0_RXI 0x80000000
+5 -2
drivers/net/ibm_newemac/phy.c
··· 28 28 #include "emac.h" 29 29 #include "phy.h" 30 30 31 - static inline int phy_read(struct mii_phy *phy, int reg) 31 + #define phy_read _phy_read 32 + #define phy_write _phy_write 33 + 34 + static inline int _phy_read(struct mii_phy *phy, int reg) 32 35 { 33 36 return phy->mdio_read(phy->dev, phy->address, reg); 34 37 } 35 38 36 - static inline void phy_write(struct mii_phy *phy, int reg, int val) 39 + static inline void _phy_write(struct mii_phy *phy, int reg, int val) 37 40 { 38 41 phy->mdio_write(phy->dev, phy->address, reg, val); 39 42 }
+45
drivers/of/of_net.c
··· 8 8 #include <linux/etherdevice.h> 9 9 #include <linux/kernel.h> 10 10 #include <linux/of_net.h> 11 + #include <linux/phy.h> 12 + 13 + /** 14 + * It maps 'enum phy_interface_t' found in include/linux/phy.h 15 + * into the device tree binding of 'phy-mode', so that Ethernet 16 + * device driver can get phy interface from device tree. 17 + */ 18 + static const char *phy_modes[] = { 19 + [PHY_INTERFACE_MODE_NA] = "", 20 + [PHY_INTERFACE_MODE_MII] = "mii", 21 + [PHY_INTERFACE_MODE_GMII] = "gmii", 22 + [PHY_INTERFACE_MODE_SGMII] = "sgmii", 23 + [PHY_INTERFACE_MODE_TBI] = "tbi", 24 + [PHY_INTERFACE_MODE_RMII] = "rmii", 25 + [PHY_INTERFACE_MODE_RGMII] = "rgmii", 26 + [PHY_INTERFACE_MODE_RGMII_ID] = "rgmii-id", 27 + [PHY_INTERFACE_MODE_RGMII_RXID] = "rgmii-rxid", 28 + [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid", 29 + [PHY_INTERFACE_MODE_RTBI] = "rtbi", 30 + [PHY_INTERFACE_MODE_SMII] = "smii", 31 + }; 32 + 33 + /** 34 + * of_get_phy_mode - Get phy mode for given device_node 35 + * @np: Pointer to the given device_node 36 + * 37 + * The function gets phy interface string from property 'phy-mode', 38 + * and return its index in phy_modes table, or errno in error case. 39 + */ 40 + const int of_get_phy_mode(struct device_node *np) 41 + { 42 + const char *pm; 43 + int err, i; 44 + 45 + err = of_property_read_string(np, "phy-mode", &pm); 46 + if (err < 0) 47 + return err; 48 + 49 + for (i = 0; i < ARRAY_SIZE(phy_modes); i++) 50 + if (!strcasecmp(pm, phy_modes[i])) 51 + return i; 52 + 53 + return -ENODEV; 54 + } 55 + EXPORT_SYMBOL_GPL(of_get_phy_mode); 11 56 12 57 /** 13 58 * Search the device tree for the best MAC address to use. 'mac-address' is
+140 -26
drivers/tty/serial/imx.c
··· 45 45 #include <linux/delay.h> 46 46 #include <linux/rational.h> 47 47 #include <linux/slab.h> 48 + #include <linux/of.h> 49 + #include <linux/of_device.h> 48 50 49 51 #include <asm/io.h> 50 52 #include <asm/irq.h> 51 - #include <mach/hardware.h> 52 53 #include <mach/imx-uart.h> 53 54 54 55 /* Register definitions */ ··· 67 66 #define UBIR 0xa4 /* BRM Incremental Register */ 68 67 #define UBMR 0xa8 /* BRM Modulator Register */ 69 68 #define UBRC 0xac /* Baud Rate Count Register */ 70 - #define MX2_ONEMS 0xb0 /* One Millisecond register */ 71 - #define UTS (cpu_is_mx1() ? 0xd0 : 0xb4) /* UART Test Register */ 69 + #define IMX21_ONEMS 0xb0 /* One Millisecond register */ 70 + #define IMX1_UTS 0xd0 /* UART Test Register on i.mx1 */ 71 + #define IMX21_UTS 0xb4 /* UART Test Register on all other i.mx*/ 72 72 73 73 /* UART Control Register Bit Fields.*/ 74 74 #define URXD_CHARRDY (1<<15) ··· 89 87 #define UCR1_RTSDEN (1<<5) /* RTS delta interrupt enable */ 90 88 #define UCR1_SNDBRK (1<<4) /* Send break */ 91 89 #define UCR1_TDMAEN (1<<3) /* Transmitter ready DMA enable */ 92 - #define MX1_UCR1_UARTCLKEN (1<<2) /* UART clock enabled, mx1 only */ 90 + #define IMX1_UCR1_UARTCLKEN (1<<2) /* UART clock enabled, i.mx1 only */ 93 91 #define UCR1_DOZE (1<<1) /* Doze */ 94 92 #define UCR1_UARTEN (1<<0) /* UART enabled */ 95 93 #define UCR2_ESCI (1<<15) /* Escape seq interrupt enable */ ··· 115 113 #define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ 116 114 #define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ 117 115 #define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ 118 - #define MX1_UCR3_REF25 (1<<3) /* Ref freq 25 MHz, only on mx1 */ 119 - #define MX1_UCR3_REF30 (1<<2) /* Ref Freq 30 MHz, only on mx1 */ 120 - #define MX2_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */ 116 + #define IMX21_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select */ 121 117 #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ 122 118 #define UCR3_BPEN (1<<0) /* Preset registers enable */ 123 119 #define UCR4_CTSTL_SHF 10 /* CTS trigger level shift */ ··· 181 181 182 182 #define UART_NR 8 183 183 184 + /* i.mx21 type uart runs on all i.mx except i.mx1 */ 185 + enum imx_uart_type { 186 + IMX1_UART, 187 + IMX21_UART, 188 + }; 189 + 190 + /* device type dependent stuff */ 191 + struct imx_uart_data { 192 + unsigned uts_reg; 193 + enum imx_uart_type devtype; 194 + }; 195 + 184 196 struct imx_port { 185 197 struct uart_port port; 186 198 struct timer_list timer; ··· 204 192 unsigned int irda_inv_tx:1; 205 193 unsigned short trcv_delay; /* transceiver delay */ 206 194 struct clk *clk; 195 + struct imx_uart_data *devdata; 207 196 }; 208 197 209 198 #ifdef CONFIG_IRDA ··· 212 199 #else 213 200 #define USE_IRDA(sport) (0) 214 201 #endif 202 + 203 + static struct imx_uart_data imx_uart_devdata[] = { 204 + [IMX1_UART] = { 205 + .uts_reg = IMX1_UTS, 206 + .devtype = IMX1_UART, 207 + }, 208 + [IMX21_UART] = { 209 + .uts_reg = IMX21_UTS, 210 + .devtype = IMX21_UART, 211 + }, 212 + }; 213 + 214 + static struct platform_device_id imx_uart_devtype[] = { 215 + { 216 + .name = "imx1-uart", 217 + .driver_data = (kernel_ulong_t) &imx_uart_devdata[IMX1_UART], 218 + }, { 219 + .name = "imx21-uart", 220 + .driver_data = (kernel_ulong_t) &imx_uart_devdata[IMX21_UART], 221 + }, { 222 + /* sentinel */ 223 + } 224 + }; 225 + MODULE_DEVICE_TABLE(platform, imx_uart_devtype); 226 + 227 + static struct of_device_id imx_uart_dt_ids[] = { 228 + { .compatible = "fsl,imx1-uart", .data = &imx_uart_devdata[IMX1_UART], }, 229 + { .compatible = "fsl,imx21-uart", .data = &imx_uart_devdata[IMX21_UART], }, 230 + { /* sentinel */ } 231 + }; 232 + MODULE_DEVICE_TABLE(of, imx_uart_dt_ids); 233 + 234 + static inline unsigned uts_reg(struct imx_port *sport) 235 + { 236 + return sport->devdata->uts_reg; 237 + } 238 + 239 + static inline int is_imx1_uart(struct imx_port *sport) 240 + { 241 + return sport->devdata->devtype == IMX1_UART; 242 + } 243 + 244 + static inline int is_imx21_uart(struct imx_port *sport) 245 + { 246 + return sport->devdata->devtype == IMX21_UART; 247 + } 215 248 216 249 /* 217 250 * Handle any change of modem status signal since we were last called. ··· 385 326 struct circ_buf *xmit = &sport->port.state->xmit; 386 327 387 328 while (!uart_circ_empty(xmit) && 388 - !(readl(sport->port.membase + UTS) & UTS_TXFULL)) { 329 + !(readl(sport->port.membase + uts_reg(sport)) 330 + & UTS_TXFULL)) { 389 331 /* send xmit->buf[xmit->tail] 390 332 * out the port here */ 391 333 writel(xmit->buf[xmit->tail], sport->port.membase + URTX0); ··· 433 373 writel(temp, sport->port.membase + UCR4); 434 374 } 435 375 436 - if (readl(sport->port.membase + UTS) & UTS_TXEMPTY) 376 + if (readl(sport->port.membase + uts_reg(sport)) & UTS_TXEMPTY) 437 377 imx_transmit_buffer(sport); 438 378 } 439 379 ··· 749 689 } 750 690 } 751 691 752 - if (!cpu_is_mx1()) { 692 + if (is_imx21_uart(sport)) { 753 693 temp = readl(sport->port.membase + UCR3); 754 - temp |= MX2_UCR3_RXDMUXSEL; 694 + temp |= IMX21_UCR3_RXDMUXSEL; 755 695 writel(temp, sport->port.membase + UCR3); 756 696 } 757 697 ··· 983 923 writel(num, sport->port.membase + UBIR); 984 924 writel(denom, sport->port.membase + UBMR); 985 925 986 - if (!cpu_is_mx1()) 926 + if (is_imx21_uart(sport)) 987 927 writel(sport->port.uartclk / div / 1000, 988 - sport->port.membase + MX2_ONEMS); 928 + sport->port.membase + IMX21_ONEMS); 989 929 990 930 writel(old_ucr1, sport->port.membase + UCR1); 991 931 ··· 1101 1041 { 1102 1042 struct imx_port *sport = (struct imx_port *)port; 1103 1043 1104 - while (readl(sport->port.membase + UTS) & UTS_TXFULL) 1044 + while (readl(sport->port.membase + uts_reg(sport)) & UTS_TXFULL) 1105 1045 barrier(); 1106 1046 1107 1047 writel(ch, sport->port.membase + URTX0); ··· 1122 1062 ucr1 = old_ucr1 = readl(sport->port.membase + UCR1); 1123 1063 old_ucr2 = readl(sport->port.membase + UCR2); 1124 1064 1125 - if (cpu_is_mx1()) 1126 - ucr1 |= MX1_UCR1_UARTCLKEN; 1065 + if (is_imx1_uart(sport)) 1066 + ucr1 |= IMX1_UCR1_UARTCLKEN; 1127 1067 ucr1 |= UCR1_UARTEN; 1128 1068 ucr1 &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); 1129 1069 ··· 1282 1222 return 0; 1283 1223 } 1284 1224 1225 + #ifdef CONFIG_OF 1226 + static int serial_imx_probe_dt(struct imx_port *sport, 1227 + struct platform_device *pdev) 1228 + { 1229 + struct device_node *np = pdev->dev.of_node; 1230 + const struct of_device_id *of_id = 1231 + of_match_device(imx_uart_dt_ids, &pdev->dev); 1232 + int ret; 1233 + 1234 + if (!np) 1235 + return -ENODEV; 1236 + 1237 + ret = of_alias_get_id(np, "serial"); 1238 + if (ret < 0) { 1239 + pr_err("%s: failed to get alias id, errno %d\n", 1240 + __func__, ret); 1241 + return -ENODEV; 1242 + } else { 1243 + sport->port.line = ret; 1244 + } 1245 + 1246 + if (of_get_property(np, "fsl,uart-has-rtscts", NULL)) 1247 + sport->have_rtscts = 1; 1248 + 1249 + if (of_get_property(np, "fsl,irda-mode", NULL)) 1250 + sport->use_irda = 1; 1251 + 1252 + sport->devdata = of_id->data; 1253 + 1254 + return 0; 1255 + } 1256 + #else 1257 + static inline int serial_imx_probe_dt(struct imx_port *sport, 1258 + struct platform_device *pdev) 1259 + { 1260 + return -ENODEV; 1261 + } 1262 + #endif 1263 + 1264 + static void serial_imx_probe_pdata(struct imx_port *sport, 1265 + struct platform_device *pdev) 1266 + { 1267 + struct imxuart_platform_data *pdata = pdev->dev.platform_data; 1268 + 1269 + sport->port.line = pdev->id; 1270 + sport->devdata = (struct imx_uart_data *) pdev->id_entry->driver_data; 1271 + 1272 + if (!pdata) 1273 + return; 1274 + 1275 + if (pdata->flags & IMXUART_HAVE_RTSCTS) 1276 + sport->have_rtscts = 1; 1277 + 1278 + if (pdata->flags & IMXUART_IRDA) 1279 + sport->use_irda = 1; 1280 + } 1281 + 1285 1282 static int serial_imx_probe(struct platform_device *pdev) 1286 1283 { 1287 1284 struct imx_port *sport; ··· 1350 1233 sport = kzalloc(sizeof(*sport), GFP_KERNEL); 1351 1234 if (!sport) 1352 1235 return -ENOMEM; 1236 + 1237 + ret = serial_imx_probe_dt(sport, pdev); 1238 + if (ret == -ENODEV) 1239 + serial_imx_probe_pdata(sport, pdev); 1353 1240 1354 1241 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1355 1242 if (!res) { ··· 1379 1258 sport->port.fifosize = 32; 1380 1259 sport->port.ops = &imx_pops; 1381 1260 sport->port.flags = UPF_BOOT_AUTOCONF; 1382 - sport->port.line = pdev->id; 1383 1261 init_timer(&sport->timer); 1384 1262 sport->timer.function = imx_timeout; 1385 1263 sport->timer.data = (unsigned long)sport; ··· 1392 1272 1393 1273 sport->port.uartclk = clk_get_rate(sport->clk); 1394 1274 1395 - imx_ports[pdev->id] = sport; 1275 + imx_ports[sport->port.line] = sport; 1396 1276 1397 1277 pdata = pdev->dev.platform_data; 1398 - if (pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) 1399 - sport->have_rtscts = 1; 1400 - 1401 - #ifdef CONFIG_IRDA 1402 - if (pdata && (pdata->flags & IMXUART_IRDA)) 1403 - sport->use_irda = 1; 1404 - #endif 1405 - 1406 1278 if (pdata && pdata->init) { 1407 1279 ret = pdata->init(pdev); 1408 1280 if (ret) ··· 1452 1340 1453 1341 .suspend = serial_imx_suspend, 1454 1342 .resume = serial_imx_resume, 1343 + .id_table = imx_uart_devtype, 1455 1344 .driver = { 1456 1345 .name = "imx-uart", 1457 1346 .owner = THIS_MODULE, 1347 + .of_match_table = imx_uart_dt_ids, 1458 1348 }, 1459 1349 }; 1460 1350
+6
include/linux/irq.h
··· 108 108 }; 109 109 110 110 struct msi_desc; 111 + struct irq_domain; 111 112 112 113 /** 113 114 * struct irq_data - per irq and irq chip data passed down to chip functions 114 115 * @irq: interrupt number 116 + * @hwirq: hardware interrupt number, local to the interrupt domain 115 117 * @node: node index useful for balancing 116 118 * @state_use_accessors: status information for irq chip functions. 117 119 * Use accessor functions to deal with it 118 120 * @chip: low level interrupt hardware access 121 + * @domain: Interrupt translation domain; responsible for mapping 122 + * between hwirq number and linux irq number. 119 123 * @handler_data: per-IRQ data for the irq_chip methods 120 124 * @chip_data: platform-specific per-chip private data for the chip 121 125 * methods, to allow shared chip implementations ··· 132 128 */ 133 129 struct irq_data { 134 130 unsigned int irq; 131 + unsigned long hwirq; 135 132 unsigned int node; 136 133 unsigned int state_use_accessors; 137 134 struct irq_chip *chip; 135 + struct irq_domain *domain; 138 136 void *handler_data; 139 137 void *chip_data; 140 138 struct msi_desc *msi_desc;
+91
include/linux/irqdomain.h
··· 1 + /* 2 + * irq_domain - IRQ translation domains 3 + * 4 + * Translation infrastructure between hw and linux irq numbers. This is 5 + * helpful for interrupt controllers to implement mapping between hardware 6 + * irq numbers and the Linux irq number space. 7 + * 8 + * irq_domains also have a hook for translating device tree interrupt 9 + * representation into a hardware irq number that can be mapped back to a 10 + * Linux irq number without any extra platform support code. 11 + * 12 + * irq_domain is expected to be embedded in an interrupt controller's private 13 + * data structure. 14 + */ 15 + #ifndef _LINUX_IRQDOMAIN_H 16 + #define _LINUX_IRQDOMAIN_H 17 + 18 + #include <linux/irq.h> 19 + #include <linux/mod_devicetable.h> 20 + 21 + #ifdef CONFIG_IRQ_DOMAIN 22 + struct device_node; 23 + struct irq_domain; 24 + 25 + /** 26 + * struct irq_domain_ops - Methods for irq_domain objects 27 + * @to_irq: (optional) given a local hardware irq number, return the linux 28 + * irq number. If to_irq is not implemented, then the irq_domain 29 + * will use this translation: irq = (domain->irq_base + hwirq) 30 + * @dt_translate: Given a device tree node and interrupt specifier, decode 31 + * the hardware irq number and linux irq type value. 32 + */ 33 + struct irq_domain_ops { 34 + unsigned int (*to_irq)(struct irq_domain *d, unsigned long hwirq); 35 + 36 + #ifdef CONFIG_OF 37 + int (*dt_translate)(struct irq_domain *d, struct device_node *node, 38 + const u32 *intspec, unsigned int intsize, 39 + unsigned long *out_hwirq, unsigned int *out_type); 40 + #endif /* CONFIG_OF */ 41 + }; 42 + 43 + /** 44 + * struct irq_domain - Hardware interrupt number translation object 45 + * @list: Element in global irq_domain list. 46 + * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator 47 + * of the irq_domain is responsible for allocating the array of 48 + * irq_desc structures. 49 + * @nr_irq: Number of irqs managed by the irq domain 50 + * @ops: pointer to irq_domain methods 51 + * @priv: private data pointer for use by owner. Not touched by irq_domain 52 + * core code. 53 + * @of_node: (optional) Pointer to device tree nodes associated with the 54 + * irq_domain. Used when decoding device tree interrupt specifiers. 55 + */ 56 + struct irq_domain { 57 + struct list_head list; 58 + unsigned int irq_base; 59 + unsigned int nr_irq; 60 + const struct irq_domain_ops *ops; 61 + void *priv; 62 + struct device_node *of_node; 63 + }; 64 + 65 + /** 66 + * irq_domain_to_irq() - Translate from a hardware irq to a linux irq number 67 + * 68 + * Returns the linux irq number associated with a hardware irq. By default, 69 + * the mapping is irq == domain->irq_base + hwirq, but this mapping can 70 + * be overridden if the irq_domain implements a .to_irq() hook. 71 + */ 72 + static inline unsigned int irq_domain_to_irq(struct irq_domain *d, 73 + unsigned long hwirq) 74 + { 75 + return d->ops->to_irq ? d->ops->to_irq(d, hwirq) : d->irq_base + hwirq; 76 + } 77 + 78 + extern void irq_domain_add(struct irq_domain *domain); 79 + extern void irq_domain_del(struct irq_domain *domain); 80 + #endif /* CONFIG_IRQ_DOMAIN */ 81 + 82 + #if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) 83 + extern void irq_domain_add_simple(struct device_node *controller, int irq_base); 84 + extern void irq_domain_generate_simple(const struct of_device_id *match, 85 + u64 phys_base, unsigned int irq_start); 86 + #else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ 87 + static inline void irq_domain_generate_simple(const struct of_device_id *match, 88 + u64 phys_base, unsigned int irq_start) { } 89 + #endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ 90 + 91 + #endif /* _LINUX_IRQDOMAIN_H */
+4
include/linux/of_irq.h
··· 63 63 extern unsigned int irq_create_of_mapping(struct device_node *controller, 64 64 const u32 *intspec, 65 65 unsigned int intsize); 66 + #ifdef CONFIG_IRQ_DOMAIN 67 + extern void irq_dispose_mapping(unsigned int irq); 68 + #endif 66 69 extern int of_irq_to_resource(struct device_node *dev, int index, 67 70 struct resource *r); 68 71 extern int of_irq_count(struct device_node *dev); 69 72 extern int of_irq_to_resource_table(struct device_node *dev, 70 73 struct resource *res, int nr_irqs); 71 74 extern struct device_node *of_irq_find_parent(struct device_node *child); 75 + 72 76 73 77 #endif /* CONFIG_OF_IRQ */ 74 78 #endif /* CONFIG_OF */
+1
include/linux/of_net.h
··· 9 9 10 10 #ifdef CONFIG_OF_NET 11 11 #include <linux/of.h> 12 + extern const int of_get_phy_mode(struct device_node *np); 12 13 extern const void *of_get_mac_address(struct device_node *np); 13 14 #endif 14 15
+3 -1
include/linux/phy.h
··· 53 53 54 54 /* Interface Mode definitions */ 55 55 typedef enum { 56 + PHY_INTERFACE_MODE_NA, 56 57 PHY_INTERFACE_MODE_MII, 57 58 PHY_INTERFACE_MODE_GMII, 58 59 PHY_INTERFACE_MODE_SGMII, ··· 63 62 PHY_INTERFACE_MODE_RGMII_ID, 64 63 PHY_INTERFACE_MODE_RGMII_RXID, 65 64 PHY_INTERFACE_MODE_RGMII_TXID, 66 - PHY_INTERFACE_MODE_RTBI 65 + PHY_INTERFACE_MODE_RTBI, 66 + PHY_INTERFACE_MODE_SMII, 67 67 } phy_interface_t; 68 68 69 69
+4
kernel/irq/Kconfig
··· 52 52 config GENERIC_IRQ_CHIP 53 53 bool 54 54 55 + # Generic irq_domain hw <--> linux irq number translation 56 + config IRQ_DOMAIN 57 + bool 58 + 55 59 # Support forced irq threading 56 60 config IRQ_FORCED_THREADING 57 61 bool
+1
kernel/irq/Makefile
··· 2 2 obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o 3 3 obj-$(CONFIG_GENERIC_IRQ_CHIP) += generic-chip.o 4 4 obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o 5 + obj-$(CONFIG_IRQ_DOMAIN) += irqdomain.o 5 6 obj-$(CONFIG_PROC_FS) += proc.o 6 7 obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o 7 8 obj-$(CONFIG_PM_SLEEP) += pm.o
+180
kernel/irq/irqdomain.c
··· 1 + #include <linux/irq.h> 2 + #include <linux/irqdomain.h> 3 + #include <linux/module.h> 4 + #include <linux/mutex.h> 5 + #include <linux/of.h> 6 + #include <linux/of_address.h> 7 + #include <linux/slab.h> 8 + 9 + static LIST_HEAD(irq_domain_list); 10 + static DEFINE_MUTEX(irq_domain_mutex); 11 + 12 + /** 13 + * irq_domain_add() - Register an irq_domain 14 + * @domain: ptr to initialized irq_domain structure 15 + * 16 + * Registers an irq_domain structure. The irq_domain must at a minimum be 17 + * initialized with an ops structure pointer, and either a ->to_irq hook or 18 + * a valid irq_base value. Everything else is optional. 19 + */ 20 + void irq_domain_add(struct irq_domain *domain) 21 + { 22 + struct irq_data *d; 23 + int hwirq; 24 + 25 + /* 26 + * This assumes that the irq_domain owner has already allocated 27 + * the irq_descs. This block will be removed when support for dynamic 28 + * allocation of irq_descs is added to irq_domain. 29 + */ 30 + for (hwirq = 0; hwirq < domain->nr_irq; hwirq++) { 31 + d = irq_get_irq_data(irq_domain_to_irq(domain, hwirq)); 32 + if (d || d->domain) { 33 + /* things are broken; just report, don't clean up */ 34 + WARN(1, "error: irq_desc already assigned to a domain"); 35 + return; 36 + } 37 + d->domain = domain; 38 + d->hwirq = hwirq; 39 + } 40 + 41 + mutex_lock(&irq_domain_mutex); 42 + list_add(&domain->list, &irq_domain_list); 43 + mutex_unlock(&irq_domain_mutex); 44 + } 45 + 46 + /** 47 + * irq_domain_del() - Unregister an irq_domain 48 + * @domain: ptr to registered irq_domain. 49 + */ 50 + void irq_domain_del(struct irq_domain *domain) 51 + { 52 + struct irq_data *d; 53 + int hwirq; 54 + 55 + mutex_lock(&irq_domain_mutex); 56 + list_del(&domain->list); 57 + mutex_unlock(&irq_domain_mutex); 58 + 59 + /* Clear the irq_domain assignments */ 60 + for (hwirq = 0; hwirq < domain->nr_irq; hwirq++) { 61 + d = irq_get_irq_data(irq_domain_to_irq(domain, hwirq)); 62 + d->domain = NULL; 63 + } 64 + } 65 + 66 + #if defined(CONFIG_OF_IRQ) 67 + /** 68 + * irq_create_of_mapping() - Map a linux irq number from a DT interrupt spec 69 + * 70 + * Used by the device tree interrupt mapping code to translate a device tree 71 + * interrupt specifier to a valid linux irq number. Returns either a valid 72 + * linux IRQ number or 0. 73 + * 74 + * When the caller no longer need the irq number returned by this function it 75 + * should arrange to call irq_dispose_mapping(). 76 + */ 77 + unsigned int irq_create_of_mapping(struct device_node *controller, 78 + const u32 *intspec, unsigned int intsize) 79 + { 80 + struct irq_domain *domain; 81 + unsigned long hwirq; 82 + unsigned int irq, type; 83 + int rc = -EINVAL; 84 + 85 + /* Find a domain which can translate the irq spec */ 86 + mutex_lock(&irq_domain_mutex); 87 + list_for_each_entry(domain, &irq_domain_list, list) { 88 + if (!domain->ops->dt_translate) 89 + continue; 90 + rc = domain->ops->dt_translate(domain, controller, 91 + intspec, intsize, &hwirq, &type); 92 + if (rc == 0) 93 + break; 94 + } 95 + mutex_unlock(&irq_domain_mutex); 96 + 97 + if (rc != 0) 98 + return 0; 99 + 100 + irq = irq_domain_to_irq(domain, hwirq); 101 + if (type != IRQ_TYPE_NONE) 102 + irq_set_irq_type(irq, type); 103 + pr_debug("%s: mapped hwirq=%i to irq=%i, flags=%x\n", 104 + controller->full_name, (int)hwirq, irq, type); 105 + return irq; 106 + } 107 + EXPORT_SYMBOL_GPL(irq_create_of_mapping); 108 + 109 + /** 110 + * irq_dispose_mapping() - Discard a mapping created by irq_create_of_mapping() 111 + * @irq: linux irq number to be discarded 112 + * 113 + * Calling this function indicates the caller no longer needs a reference to 114 + * the linux irq number returned by a prior call to irq_create_of_mapping(). 115 + */ 116 + void irq_dispose_mapping(unsigned int irq) 117 + { 118 + /* 119 + * nothing yet; will be filled when support for dynamic allocation of 120 + * irq_descs is added to irq_domain 121 + */ 122 + } 123 + EXPORT_SYMBOL_GPL(irq_dispose_mapping); 124 + 125 + int irq_domain_simple_dt_translate(struct irq_domain *d, 126 + struct device_node *controller, 127 + const u32 *intspec, unsigned int intsize, 128 + unsigned long *out_hwirq, unsigned int *out_type) 129 + { 130 + if (d->of_node != controller) 131 + return -EINVAL; 132 + if (intsize < 1) 133 + return -EINVAL; 134 + 135 + *out_hwirq = intspec[0]; 136 + *out_type = IRQ_TYPE_NONE; 137 + if (intsize > 1) 138 + *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; 139 + return 0; 140 + } 141 + 142 + struct irq_domain_ops irq_domain_simple_ops = { 143 + .dt_translate = irq_domain_simple_dt_translate, 144 + }; 145 + EXPORT_SYMBOL_GPL(irq_domain_simple_ops); 146 + 147 + /** 148 + * irq_domain_create_simple() - Set up a 'simple' translation range 149 + */ 150 + void irq_domain_add_simple(struct device_node *controller, int irq_base) 151 + { 152 + struct irq_domain *domain; 153 + 154 + domain = kzalloc(sizeof(*domain), GFP_KERNEL); 155 + if (!domain) { 156 + WARN_ON(1); 157 + return; 158 + } 159 + 160 + domain->irq_base = irq_base; 161 + domain->of_node = of_node_get(controller); 162 + domain->ops = &irq_domain_simple_ops; 163 + irq_domain_add(domain); 164 + } 165 + EXPORT_SYMBOL_GPL(irq_domain_add_simple); 166 + 167 + void irq_domain_generate_simple(const struct of_device_id *match, 168 + u64 phys_base, unsigned int irq_start) 169 + { 170 + struct device_node *node; 171 + pr_info("looking for phys_base=%llx, irq_start=%i\n", 172 + (unsigned long long) phys_base, (int) irq_start); 173 + node = of_find_matching_node_by_address(NULL, match, phys_base); 174 + if (node) 175 + irq_domain_add_simple(node, irq_start); 176 + else 177 + pr_info("no node found\n"); 178 + } 179 + EXPORT_SYMBOL_GPL(irq_domain_generate_simple); 180 + #endif /* CONFIG_OF_IRQ */