diff options
59 files changed, 1365 insertions, 193 deletions
diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt index 1aeaf6f2a1ba..ecc81e368715 100644 --- a/Documentation/devicetree/bindings/arm/atmel-at91.txt +++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt | |||
| @@ -30,3 +30,63 @@ One interrupt per TC channel in a TC block: | |||
| 30 | reg = <0xfffdc000 0x100>; | 30 | reg = <0xfffdc000 0x100>; |
| 31 | interrupts = <26 4 27 4 28 4>; | 31 | interrupts = <26 4 27 4 28 4>; |
| 32 | }; | 32 | }; |
| 33 | |||
| 34 | RSTC Reset Controller required properties: | ||
| 35 | - compatible: Should be "atmel,<chip>-rstc". | ||
| 36 | <chip> can be "at91sam9260" or "at91sam9g45" | ||
| 37 | - reg: Should contain registers location and length | ||
| 38 | |||
| 39 | Example: | ||
| 40 | |||
| 41 | rstc@fffffd00 { | ||
| 42 | compatible = "atmel,at91sam9260-rstc"; | ||
| 43 | reg = <0xfffffd00 0x10>; | ||
| 44 | }; | ||
| 45 | |||
| 46 | RAMC SDRAM/DDR Controller required properties: | ||
| 47 | - compatible: Should be "atmel,at91sam9260-sdramc", | ||
| 48 | "atmel,at91sam9g45-ddramc", | ||
| 49 | - reg: Should contain registers location and length | ||
| 50 | For at91sam9263 and at91sam9g45 you must specify 2 entries. | ||
| 51 | |||
| 52 | Examples: | ||
| 53 | |||
| 54 | ramc0: ramc@ffffe800 { | ||
| 55 | compatible = "atmel,at91sam9g45-ddramc"; | ||
| 56 | reg = <0xffffe800 0x200>; | ||
| 57 | }; | ||
| 58 | |||
| 59 | ramc0: ramc@ffffe400 { | ||
| 60 | compatible = "atmel,at91sam9g45-ddramc"; | ||
| 61 | reg = <0xffffe400 0x200 | ||
| 62 | 0xffffe600 0x200>; | ||
| 63 | }; | ||
| 64 | |||
| 65 | SHDWC Shutdown Controller | ||
| 66 | |||
| 67 | required properties: | ||
| 68 | - compatible: Should be "atmel,<chip>-shdwc". | ||
| 69 | <chip> can be "at91sam9260", "at91sam9rl" or "at91sam9x5". | ||
| 70 | - reg: Should contain registers location and length | ||
| 71 | |||
| 72 | optional properties: | ||
| 73 | - atmel,wakeup-mode: String, operation mode of the wakeup mode. | ||
| 74 | Supported values are: "none", "high", "low", "any". | ||
| 75 | - atmel,wakeup-counter: Counter on Wake-up 0 (between 0x0 and 0xf). | ||
| 76 | |||
| 77 | optional at91sam9260 properties: | ||
| 78 | - atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up. | ||
| 79 | |||
| 80 | optional at91sam9rl properties: | ||
| 81 | - atmel,wakeup-rtc-timer: boolean to enable Real-time Clock Wake-up. | ||
| 82 | - atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up. | ||
| 83 | |||
| 84 | optional at91sam9x5 properties: | ||
| 85 | - atmel,wakeup-rtc-timer: boolean to enable Real-time Clock Wake-up. | ||
| 86 | |||
| 87 | Example: | ||
| 88 | |||
| 89 | rstc@fffffd00 { | ||
| 90 | compatible = "atmel,at91sam9260-rstc"; | ||
| 91 | reg = <0xfffffd00 0x10>; | ||
| 92 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/atmel-pmc.txt b/Documentation/devicetree/bindings/arm/atmel-pmc.txt new file mode 100644 index 000000000000..389bed5056e8 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/atmel-pmc.txt | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | * Power Management Controller (PMC) | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible: Should be "atmel,at91rm9200-pmc" | ||
| 5 | - reg: Should contain PMC registers location and length | ||
| 6 | |||
| 7 | Examples: | ||
| 8 | pmc: pmc@fffffc00 { | ||
| 9 | compatible = "atmel,at91rm9200-pmc"; | ||
| 10 | reg = <0xfffffc00 0x100>; | ||
| 11 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/gpio_i2c.txt b/Documentation/devicetree/bindings/gpio/gpio_i2c.txt new file mode 100644 index 000000000000..4f8ec947c6bd --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio_i2c.txt | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | Device-Tree bindings for i2c gpio driver | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible = "i2c-gpio"; | ||
| 5 | - gpios: sda and scl gpio | ||
| 6 | |||
| 7 | |||
| 8 | Optional properties: | ||
| 9 | - i2c-gpio,sda-open-drain: sda as open drain | ||
| 10 | - i2c-gpio,scl-open-drain: scl as open drain | ||
| 11 | - i2c-gpio,scl-output-only: scl as output only | ||
| 12 | - i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform) | ||
| 13 | - i2c-gpio,timeout-ms: timeout to get data | ||
| 14 | |||
| 15 | Example nodes: | ||
| 16 | |||
| 17 | i2c@0 { | ||
| 18 | compatible = "i2c-gpio"; | ||
| 19 | gpios = <&pioA 23 0 /* sda */ | ||
| 20 | &pioA 24 0 /* scl */ | ||
| 21 | >; | ||
| 22 | i2c-gpio,sda-open-drain; | ||
| 23 | i2c-gpio,scl-open-drain; | ||
| 24 | i2c-gpio,delay-us = <2>; /* ~100 kHz */ | ||
| 25 | #address-cells = <1>; | ||
| 26 | #size-cells = <0>; | ||
| 27 | |||
| 28 | rv3029c2@56 { | ||
| 29 | compatible = "rv3029c2"; | ||
| 30 | reg = <0x56>; | ||
| 31 | }; | ||
| 32 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt new file mode 100644 index 000000000000..5903ecf6e895 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | Atmel NAND flash | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible : "atmel,at91rm9200-nand". | ||
| 5 | - reg : should specify localbus address and size used for the chip, | ||
| 6 | and if availlable the ECC. | ||
| 7 | - atmel,nand-addr-offset : offset for the address latch. | ||
| 8 | - atmel,nand-cmd-offset : offset for the command latch. | ||
| 9 | - #address-cells, #size-cells : Must be present if the device has sub-nodes | ||
| 10 | representing partitions. | ||
| 11 | |||
| 12 | - gpios : specifies the gpio pins to control the NAND device. detect is an | ||
| 13 | optional gpio and may be set to 0 if not present. | ||
| 14 | |||
| 15 | Optional properties: | ||
| 16 | - nand-ecc-mode : String, operation mode of the NAND ecc mode, soft by default. | ||
| 17 | Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first", | ||
| 18 | "soft_bch". | ||
| 19 | - nand-bus-width : 8 or 16 bus width if not present 8 | ||
| 20 | - nand-on-flash-bbt: boolean to enable on flash bbt option if not present false | ||
| 21 | |||
| 22 | Examples: | ||
| 23 | nand0: nand@40000000,0 { | ||
| 24 | compatible = "atmel,at91rm9200-nand"; | ||
| 25 | #address-cells = <1>; | ||
| 26 | #size-cells = <1>; | ||
| 27 | reg = <0x40000000 0x10000000 | ||
| 28 | 0xffffe800 0x200 | ||
| 29 | >; | ||
| 30 | atmel,nand-addr-offset = <21>; | ||
| 31 | atmel,nand-cmd-offset = <22>; | ||
| 32 | nand-on-flash-bbt; | ||
| 33 | nand-ecc-mode = "soft"; | ||
| 34 | gpios = <&pioC 13 0 | ||
| 35 | &pioC 14 0 | ||
| 36 | 0 | ||
| 37 | >; | ||
| 38 | partition@0 { | ||
| 39 | ... | ||
| 40 | }; | ||
| 41 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt new file mode 100644 index 000000000000..03855c8c492a --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/nand.txt | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | * MTD generic binding | ||
| 2 | |||
| 3 | - nand-ecc-mode : String, operation mode of the NAND ecc mode. | ||
| 4 | Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first", | ||
| 5 | "soft_bch". | ||
| 6 | - nand-bus-width : 8 or 16 bus width if not present 8 | ||
| 7 | - nand-on-flash-bbt: boolean to enable on flash bbt option if not present false | ||
diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt new file mode 100644 index 000000000000..0143d7c5b4b9 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | Atmel SOC USB controllers | ||
| 2 | |||
| 3 | OHCI | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | - compatible: Should be "atmel,at91rm9200-ohci" for USB controllers | ||
| 7 | used in host mode. | ||
| 8 | - num-ports: Number of ports. | ||
| 9 | - atmel,vbus-gpio: If present, specifies a gpio that needs to be | ||
| 10 | activated for the bus to be powered. | ||
| 11 | - atmel,oc-gpio: If present, specifies a gpio that needs to be | ||
| 12 | activated for the overcurrent detection. | ||
| 13 | |||
| 14 | usb0: ohci@00500000 { | ||
| 15 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | ||
| 16 | reg = <0x00500000 0x100000>; | ||
| 17 | interrupts = <20 4>; | ||
| 18 | num-ports = <2>; | ||
| 19 | }; | ||
| 20 | |||
| 21 | EHCI | ||
| 22 | |||
| 23 | Required properties: | ||
| 24 | - compatible: Should be "atmel,at91sam9g45-ehci" for USB controllers | ||
| 25 | used in host mode. | ||
| 26 | |||
| 27 | usb1: ehci@00800000 { | ||
| 28 | compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; | ||
| 29 | reg = <0x00800000 0x100000>; | ||
| 30 | interrupts = <22 4>; | ||
| 31 | }; | ||
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi index a100db03ec90..f091d679bd4c 100644 --- a/arch/arm/boot/dts/at91sam9g20.dtsi +++ b/arch/arm/boot/dts/at91sam9g20.dtsi | |||
| @@ -59,6 +59,26 @@ | |||
| 59 | reg = <0xfffff000 0x200>; | 59 | reg = <0xfffff000 0x200>; |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | ramc0: ramc@ffffea00 { | ||
| 63 | compatible = "atmel,at91sam9260-sdramc"; | ||
| 64 | reg = <0xffffea00 0x200>; | ||
| 65 | }; | ||
| 66 | |||
| 67 | pmc: pmc@fffffc00 { | ||
| 68 | compatible = "atmel,at91rm9200-pmc"; | ||
| 69 | reg = <0xfffffc00 0x100>; | ||
| 70 | }; | ||
| 71 | |||
| 72 | rstc@fffffd00 { | ||
| 73 | compatible = "atmel,at91sam9260-rstc"; | ||
| 74 | reg = <0xfffffd00 0x10>; | ||
| 75 | }; | ||
| 76 | |||
| 77 | shdwc@fffffd10 { | ||
| 78 | compatible = "atmel,at91sam9260-shdwc"; | ||
| 79 | reg = <0xfffffd10 0x10>; | ||
| 80 | }; | ||
| 81 | |||
| 62 | pit: timer@fffffd30 { | 82 | pit: timer@fffffd30 { |
| 63 | compatible = "atmel,at91sam9260-pit"; | 83 | compatible = "atmel,at91sam9260-pit"; |
| 64 | reg = <0xfffffd30 0xf>; | 84 | reg = <0xfffffd30 0xf>; |
| @@ -172,5 +192,41 @@ | |||
| 172 | status = "disabled"; | 192 | status = "disabled"; |
| 173 | }; | 193 | }; |
| 174 | }; | 194 | }; |
| 195 | |||
| 196 | nand0: nand@40000000 { | ||
| 197 | compatible = "atmel,at91rm9200-nand"; | ||
| 198 | #address-cells = <1>; | ||
| 199 | #size-cells = <1>; | ||
| 200 | reg = <0x40000000 0x10000000 | ||
| 201 | 0xffffe800 0x200 | ||
| 202 | >; | ||
| 203 | atmel,nand-addr-offset = <21>; | ||
| 204 | atmel,nand-cmd-offset = <22>; | ||
| 205 | gpios = <&pioC 13 0 | ||
| 206 | &pioC 14 0 | ||
| 207 | 0 | ||
| 208 | >; | ||
| 209 | status = "disabled"; | ||
| 210 | }; | ||
| 211 | |||
| 212 | usb0: ohci@00500000 { | ||
| 213 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | ||
| 214 | reg = <0x00500000 0x100000>; | ||
| 215 | interrupts = <20 4>; | ||
| 216 | status = "disabled"; | ||
| 217 | }; | ||
| 218 | }; | ||
| 219 | |||
| 220 | i2c@0 { | ||
| 221 | compatible = "i2c-gpio"; | ||
| 222 | gpios = <&pioA 23 0 /* sda */ | ||
| 223 | &pioA 24 0 /* scl */ | ||
| 224 | >; | ||
| 225 | i2c-gpio,sda-open-drain; | ||
| 226 | i2c-gpio,scl-open-drain; | ||
| 227 | i2c-gpio,delay-us = <2>; /* ~100 kHz */ | ||
| 228 | #address-cells = <1>; | ||
| 229 | #size-cells = <0>; | ||
| 230 | status = "disabled"; | ||
| 175 | }; | 231 | }; |
| 176 | }; | 232 | }; |
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts index e64eb932083b..ac0dc0031dda 100644 --- a/arch/arm/boot/dts/at91sam9g25ek.dts +++ b/arch/arm/boot/dts/at91sam9g25ek.dts | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; | 15 | compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; |
| 16 | 16 | ||
| 17 | chosen { | 17 | chosen { |
| 18 | bootargs = "128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs"; | 18 | bootargs = "128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs"; |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | ahb { | 21 | ahb { |
| @@ -33,5 +33,17 @@ | |||
| 33 | status = "okay"; | 33 | status = "okay"; |
| 34 | }; | 34 | }; |
| 35 | }; | 35 | }; |
| 36 | |||
| 37 | usb0: ohci@00600000 { | ||
| 38 | status = "okay"; | ||
| 39 | num-ports = <2>; | ||
| 40 | atmel,vbus-gpio = <&pioD 19 0 | ||
| 41 | &pioD 20 0 | ||
| 42 | >; | ||
| 43 | }; | ||
| 44 | |||
| 45 | usb1: ehci@00700000 { | ||
| 46 | status = "okay"; | ||
| 47 | }; | ||
| 36 | }; | 48 | }; |
| 37 | }; | 49 | }; |
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index f779667159b1..3d0c32fb218f 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi | |||
| @@ -60,6 +60,22 @@ | |||
| 60 | reg = <0xfffff000 0x200>; | 60 | reg = <0xfffff000 0x200>; |
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | ramc0: ramc@ffffe400 { | ||
| 64 | compatible = "atmel,at91sam9g45-ddramc"; | ||
| 65 | reg = <0xffffe400 0x200 | ||
| 66 | 0xffffe600 0x200>; | ||
| 67 | }; | ||
| 68 | |||
| 69 | pmc: pmc@fffffc00 { | ||
| 70 | compatible = "atmel,at91rm9200-pmc"; | ||
| 71 | reg = <0xfffffc00 0x100>; | ||
| 72 | }; | ||
| 73 | |||
| 74 | rstc@fffffd00 { | ||
| 75 | compatible = "atmel,at91sam9g45-rstc"; | ||
| 76 | reg = <0xfffffd00 0x10>; | ||
| 77 | }; | ||
| 78 | |||
| 63 | pit: timer@fffffd30 { | 79 | pit: timer@fffffd30 { |
| 64 | compatible = "atmel,at91sam9260-pit"; | 80 | compatible = "atmel,at91sam9260-pit"; |
| 65 | reg = <0xfffffd30 0xf>; | 81 | reg = <0xfffffd30 0xf>; |
| @@ -67,6 +83,11 @@ | |||
| 67 | }; | 83 | }; |
| 68 | 84 | ||
| 69 | 85 | ||
| 86 | shdwc@fffffd10 { | ||
| 87 | compatible = "atmel,at91sam9rl-shdwc"; | ||
| 88 | reg = <0xfffffd10 0x10>; | ||
| 89 | }; | ||
| 90 | |||
| 70 | tcb0: timer@fff7c000 { | 91 | tcb0: timer@fff7c000 { |
| 71 | compatible = "atmel,at91rm9200-tcb"; | 92 | compatible = "atmel,at91rm9200-tcb"; |
| 72 | reg = <0xfff7c000 0x100>; | 93 | reg = <0xfff7c000 0x100>; |
| @@ -180,5 +201,48 @@ | |||
| 180 | status = "disabled"; | 201 | status = "disabled"; |
| 181 | }; | 202 | }; |
| 182 | }; | 203 | }; |
| 204 | |||
| 205 | nand0: nand@40000000 { | ||
| 206 | compatible = "atmel,at91rm9200-nand"; | ||
| 207 | #address-cells = <1>; | ||
| 208 | #size-cells = <1>; | ||
| 209 | reg = <0x40000000 0x10000000 | ||
| 210 | 0xffffe200 0x200 | ||
| 211 | >; | ||
| 212 | atmel,nand-addr-offset = <21>; | ||
| 213 | atmel,nand-cmd-offset = <22>; | ||
| 214 | gpios = <&pioC 8 0 | ||
| 215 | &pioC 14 0 | ||
| 216 | 0 | ||
| 217 | >; | ||
| 218 | status = "disabled"; | ||
| 219 | }; | ||
| 220 | |||
| 221 | usb0: ohci@00700000 { | ||
| 222 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | ||
| 223 | reg = <0x00700000 0x100000>; | ||
| 224 | interrupts = <22 4>; | ||
| 225 | status = "disabled"; | ||
| 226 | }; | ||
| 227 | |||
| 228 | usb1: ehci@00800000 { | ||
| 229 | compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; | ||
| 230 | reg = <0x00800000 0x100000>; | ||
| 231 | interrupts = <22 4>; | ||
| 232 | status = "disabled"; | ||
| 233 | }; | ||
| 234 | }; | ||
| 235 | |||
| 236 | i2c@0 { | ||
| 237 | compatible = "i2c-gpio"; | ||
| 238 | gpios = <&pioA 20 0 /* sda */ | ||
| 239 | &pioA 21 0 /* scl */ | ||
| 240 | >; | ||
| 241 | i2c-gpio,sda-open-drain; | ||
| 242 | i2c-gpio,scl-open-drain; | ||
| 243 | i2c-gpio,delay-us = <5>; /* ~100 kHz */ | ||
| 244 | #address-cells = <1>; | ||
| 245 | #size-cells = <0>; | ||
| 246 | status = "disabled"; | ||
| 183 | }; | 247 | }; |
| 184 | }; | 248 | }; |
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts index 15e25f903cad..c4c8ae4123d5 100644 --- a/arch/arm/boot/dts/at91sam9m10g45ek.dts +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts | |||
| @@ -14,13 +14,24 @@ | |||
| 14 | compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; | 14 | compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; |
| 15 | 15 | ||
| 16 | chosen { | 16 | chosen { |
| 17 | bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; | 17 | bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"; |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | memory@70000000 { | 20 | memory@70000000 { |
| 21 | reg = <0x70000000 0x4000000>; | 21 | reg = <0x70000000 0x4000000>; |
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | clocks { | ||
| 25 | #address-cells = <1>; | ||
| 26 | #size-cells = <1>; | ||
| 27 | ranges; | ||
| 28 | |||
| 29 | main_clock: clock@0 { | ||
| 30 | compatible = "atmel,osc", "fixed-clock"; | ||
| 31 | clock-frequency = <12000000>; | ||
| 32 | }; | ||
| 33 | }; | ||
| 34 | |||
| 24 | ahb { | 35 | ahb { |
| 25 | apb { | 36 | apb { |
| 26 | dbgu: serial@ffffee00 { | 37 | dbgu: serial@ffffee00 { |
| @@ -36,6 +47,39 @@ | |||
| 36 | status = "okay"; | 47 | status = "okay"; |
| 37 | }; | 48 | }; |
| 38 | }; | 49 | }; |
| 50 | |||
| 51 | nand0: nand@40000000 { | ||
| 52 | nand-bus-width = <8>; | ||
| 53 | nand-ecc-mode = "soft"; | ||
| 54 | nand-on-flash-bbt; | ||
| 55 | status = "okay"; | ||
| 56 | |||
| 57 | boot@0 { | ||
| 58 | label = "bootstrap/uboot/kernel"; | ||
| 59 | reg = <0x0 0x400000>; | ||
| 60 | }; | ||
| 61 | |||
| 62 | rootfs@400000 { | ||
| 63 | label = "rootfs"; | ||
| 64 | reg = <0x400000 0x3C00000>; | ||
| 65 | }; | ||
| 66 | |||
| 67 | data@4000000 { | ||
| 68 | label = "data"; | ||
| 69 | reg = <0x4000000 0xC000000>; | ||
| 70 | }; | ||
| 71 | }; | ||
| 72 | |||
| 73 | usb0: ohci@00700000 { | ||
| 74 | status = "okay"; | ||
| 75 | num-ports = <2>; | ||
| 76 | atmel,vbus-gpio = <&pioD 1 0 | ||
| 77 | &pioD 3 0>; | ||
| 78 | }; | ||
| 79 | |||
| 80 | usb1: ehci@00800000 { | ||
| 81 | status = "okay"; | ||
| 82 | }; | ||
| 39 | }; | 83 | }; |
| 40 | 84 | ||
| 41 | leds { | 85 | leds { |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index a02e636d8a57..c111001f254e 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
| @@ -58,6 +58,26 @@ | |||
| 58 | reg = <0xfffff000 0x200>; | 58 | reg = <0xfffff000 0x200>; |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | ramc0: ramc@ffffe800 { | ||
| 62 | compatible = "atmel,at91sam9g45-ddramc"; | ||
| 63 | reg = <0xffffe800 0x200>; | ||
| 64 | }; | ||
| 65 | |||
| 66 | pmc: pmc@fffffc00 { | ||
| 67 | compatible = "atmel,at91rm9200-pmc"; | ||
| 68 | reg = <0xfffffc00 0x100>; | ||
| 69 | }; | ||
| 70 | |||
| 71 | rstc@fffffe00 { | ||
| 72 | compatible = "atmel,at91sam9g45-rstc"; | ||
| 73 | reg = <0xfffffe00 0x10>; | ||
| 74 | }; | ||
| 75 | |||
| 76 | shdwc@fffffe10 { | ||
| 77 | compatible = "atmel,at91sam9x5-shdwc"; | ||
| 78 | reg = <0xfffffe10 0x10>; | ||
| 79 | }; | ||
| 80 | |||
| 61 | pit: timer@fffffe30 { | 81 | pit: timer@fffffe30 { |
| 62 | compatible = "atmel,at91sam9260-pit"; | 82 | compatible = "atmel,at91sam9260-pit"; |
| 63 | reg = <0xfffffe30 0xf>; | 83 | reg = <0xfffffe30 0xf>; |
| @@ -172,5 +192,73 @@ | |||
| 172 | status = "disabled"; | 192 | status = "disabled"; |
| 173 | }; | 193 | }; |
| 174 | }; | 194 | }; |
| 195 | |||
| 196 | nand0: nand@40000000 { | ||
| 197 | compatible = "atmel,at91rm9200-nand"; | ||
| 198 | #address-cells = <1>; | ||
| 199 | #size-cells = <1>; | ||
| 200 | reg = <0x40000000 0x10000000 | ||
| 201 | >; | ||
| 202 | atmel,nand-addr-offset = <21>; | ||
| 203 | atmel,nand-cmd-offset = <22>; | ||
| 204 | gpios = <&pioC 8 0 | ||
| 205 | &pioC 14 0 | ||
| 206 | 0 | ||
| 207 | >; | ||
| 208 | status = "disabled"; | ||
| 209 | }; | ||
| 210 | |||
| 211 | usb0: ohci@00600000 { | ||
| 212 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | ||
| 213 | reg = <0x00600000 0x100000>; | ||
| 214 | interrupts = <22 4>; | ||
| 215 | status = "disabled"; | ||
| 216 | }; | ||
| 217 | |||
| 218 | usb1: ehci@00700000 { | ||
| 219 | compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; | ||
| 220 | reg = <0x00700000 0x100000>; | ||
| 221 | interrupts = <22 4>; | ||
| 222 | status = "disabled"; | ||
| 223 | }; | ||
| 224 | }; | ||
| 225 | |||
| 226 | i2c@0 { | ||
| 227 | compatible = "i2c-gpio"; | ||
| 228 | gpios = <&pioA 30 0 /* sda */ | ||
| 229 | &pioA 31 0 /* scl */ | ||
| 230 | >; | ||
| 231 | i2c-gpio,sda-open-drain; | ||
| 232 | i2c-gpio,scl-open-drain; | ||
| 233 | i2c-gpio,delay-us = <2>; /* ~100 kHz */ | ||
| 234 | #address-cells = <1>; | ||
| 235 | #size-cells = <0>; | ||
| 236 | status = "disabled"; | ||
| 237 | }; | ||
| 238 | |||
| 239 | i2c@1 { | ||
| 240 | compatible = "i2c-gpio"; | ||
| 241 | gpios = <&pioC 0 0 /* sda */ | ||
| 242 | &pioC 1 0 /* scl */ | ||
| 243 | >; | ||
| 244 | i2c-gpio,sda-open-drain; | ||
| 245 | i2c-gpio,scl-open-drain; | ||
| 246 | i2c-gpio,delay-us = <2>; /* ~100 kHz */ | ||
| 247 | #address-cells = <1>; | ||
| 248 | #size-cells = <0>; | ||
| 249 | status = "disabled"; | ||
| 250 | }; | ||
| 251 | |||
| 252 | i2c@2 { | ||
| 253 | compatible = "i2c-gpio"; | ||
| 254 | gpios = <&pioB 4 0 /* sda */ | ||
| 255 | &pioB 5 0 /* scl */ | ||
| 256 | >; | ||
| 257 | i2c-gpio,sda-open-drain; | ||
| 258 | i2c-gpio,scl-open-drain; | ||
| 259 | i2c-gpio,delay-us = <2>; /* ~100 kHz */ | ||
| 260 | #address-cells = <1>; | ||
| 261 | #size-cells = <0>; | ||
| 262 | status = "disabled"; | ||
| 175 | }; | 263 | }; |
| 176 | }; | 264 | }; |
diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi b/arch/arm/boot/dts/at91sam9x5cm.dtsi index 64ae3e890259..67936f83c694 100644 --- a/arch/arm/boot/dts/at91sam9x5cm.dtsi +++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi | |||
| @@ -12,6 +12,51 @@ | |||
| 12 | reg = <0x20000000 0x8000000>; | 12 | reg = <0x20000000 0x8000000>; |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | clocks { | ||
| 16 | #address-cells = <1>; | ||
| 17 | #size-cells = <1>; | ||
| 18 | ranges; | ||
| 19 | |||
| 20 | main_clock: clock@0 { | ||
| 21 | compatible = "atmel,osc", "fixed-clock"; | ||
| 22 | clock-frequency = <12000000>; | ||
| 23 | }; | ||
| 24 | }; | ||
| 25 | |||
| 26 | ahb { | ||
| 27 | nand0: nand@40000000 { | ||
| 28 | nand-bus-width = <8>; | ||
| 29 | nand-ecc-mode = "soft"; | ||
| 30 | nand-on-flash-bbt; | ||
| 31 | status = "okay"; | ||
| 32 | |||
| 33 | at91bootstrap@0 { | ||
| 34 | label = "at91bootstrap"; | ||
| 35 | reg = <0x0 0x40000>; | ||
| 36 | }; | ||
| 37 | |||
| 38 | uboot@40000 { | ||
| 39 | label = "u-boot"; | ||
| 40 | reg = <0x40000 0x80000>; | ||
| 41 | }; | ||
| 42 | |||
| 43 | ubootenv@c0000 { | ||
| 44 | label = "U-Boot Env"; | ||
| 45 | reg = <0xc0000 0x140000>; | ||
| 46 | }; | ||
| 47 | |||
| 48 | kernel@200000 { | ||
| 49 | label = "kernel"; | ||
| 50 | reg = <0x200000 0x600000>; | ||
| 51 | }; | ||
| 52 | |||
| 53 | rootfs@800000 { | ||
| 54 | label = "rootfs"; | ||
| 55 | reg = <0x800000 0x1f800000>; | ||
| 56 | }; | ||
| 57 | }; | ||
| 58 | }; | ||
| 59 | |||
| 15 | leds { | 60 | leds { |
| 16 | compatible = "gpio-leds"; | 61 | compatible = "gpio-leds"; |
| 17 | 62 | ||
diff --git a/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi b/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi new file mode 100644 index 000000000000..ad3eca17c436 --- /dev/null +++ b/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | /* | ||
| 2 | * calao-dab-mmx.dtsi - Device Tree Include file for Calao DAB-MMX Daughter Board | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | ||
| 5 | * | ||
| 6 | * Licensed under GPLv2. | ||
| 7 | */ | ||
| 8 | |||
| 9 | / { | ||
| 10 | ahb { | ||
| 11 | apb { | ||
| 12 | usart1: serial@fffb4000 { | ||
| 13 | status = "okay"; | ||
| 14 | }; | ||
| 15 | |||
| 16 | usart3: serial@fffd0000 { | ||
| 17 | status = "okay"; | ||
| 18 | }; | ||
| 19 | }; | ||
| 20 | }; | ||
| 21 | |||
| 22 | i2c-gpio@0 { | ||
| 23 | status = "okay"; | ||
| 24 | }; | ||
| 25 | |||
| 26 | leds { | ||
| 27 | compatible = "gpio-leds"; | ||
| 28 | |||
| 29 | user_led1 { | ||
| 30 | label = "user_led1"; | ||
| 31 | gpios = <&pioB 20 1>; | ||
| 32 | }; | ||
| 33 | |||
| 34 | /* | ||
| 35 | * led already used by mother board but active as high | ||
| 36 | * user_led2 { | ||
| 37 | * label = "user_led2"; | ||
| 38 | * gpios = <&pioB 21 1>; | ||
| 39 | * }; | ||
| 40 | */ | ||
| 41 | user_led3 { | ||
| 42 | label = "user_led3"; | ||
| 43 | gpios = <&pioB 22 1>; | ||
| 44 | }; | ||
| 45 | |||
| 46 | user_led4 { | ||
| 47 | label = "user_led4"; | ||
| 48 | gpios = <&pioB 23 1>; | ||
| 49 | }; | ||
| 50 | |||
| 51 | red { | ||
| 52 | label = "red"; | ||
| 53 | gpios = <&pioB 24 1>; | ||
| 54 | }; | ||
| 55 | |||
| 56 | orange { | ||
| 57 | label = "orange"; | ||
| 58 | gpios = <&pioB 30 1>; | ||
| 59 | }; | ||
| 60 | |||
| 61 | green { | ||
| 62 | label = "green"; | ||
| 63 | gpios = <&pioB 31 1>; | ||
| 64 | }; | ||
| 65 | }; | ||
| 66 | |||
| 67 | gpio_keys { | ||
| 68 | compatible = "gpio-keys"; | ||
| 69 | #address-cells = <1>; | ||
| 70 | #size-cells = <0>; | ||
| 71 | |||
| 72 | user_pb1 { | ||
| 73 | label = "user_pb1"; | ||
| 74 | gpios = <&pioB 25 1>; | ||
| 75 | linux,code = <0x100>; | ||
| 76 | }; | ||
| 77 | |||
| 78 | user_pb2 { | ||
| 79 | label = "user_pb2"; | ||
| 80 | gpios = <&pioB 13 1>; | ||
| 81 | linux,code = <0x101>; | ||
| 82 | }; | ||
| 83 | |||
| 84 | user_pb3 { | ||
| 85 | label = "user_pb3"; | ||
| 86 | gpios = <&pioA 26 1>; | ||
| 87 | linux,code = <0x102>; | ||
| 88 | }; | ||
| 89 | |||
| 90 | user_pb4 { | ||
| 91 | label = "user_pb4"; | ||
| 92 | gpios = <&pioC 9 1>; | ||
| 93 | linux,code = <0x103>; | ||
| 94 | }; | ||
| 95 | }; | ||
| 96 | }; | ||
diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts index d74545a2a77c..748d4c2f889f 100644 --- a/arch/arm/boot/dts/usb_a9g20.dts +++ b/arch/arm/boot/dts/usb_a9g20.dts | |||
| @@ -13,13 +13,24 @@ | |||
| 13 | compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9"; | 13 | compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9"; |
| 14 | 14 | ||
| 15 | chosen { | 15 | chosen { |
| 16 | bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),4M(kernel),120M(rootfs),-(data) root=/dev/mtdblock5 rw rootfstype=ubifs"; | 16 | bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs"; |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | memory@20000000 { | 19 | memory@20000000 { |
| 20 | reg = <0x20000000 0x4000000>; | 20 | reg = <0x20000000 0x4000000>; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | clocks { | ||
| 24 | #address-cells = <1>; | ||
| 25 | #size-cells = <1>; | ||
| 26 | ranges; | ||
| 27 | |||
| 28 | main_clock: clock@0 { | ||
| 29 | compatible = "atmel,osc", "fixed-clock"; | ||
| 30 | clock-frequency = <12000000>; | ||
| 31 | }; | ||
| 32 | }; | ||
| 33 | |||
| 23 | ahb { | 34 | ahb { |
| 24 | apb { | 35 | apb { |
| 25 | dbgu: serial@fffff200 { | 36 | dbgu: serial@fffff200 { |
| @@ -31,6 +42,53 @@ | |||
| 31 | status = "okay"; | 42 | status = "okay"; |
| 32 | }; | 43 | }; |
| 33 | }; | 44 | }; |
| 45 | |||
| 46 | nand0: nand@40000000 { | ||
| 47 | nand-bus-width = <8>; | ||
| 48 | nand-ecc-mode = "soft"; | ||
| 49 | nand-on-flash-bbt; | ||
| 50 | status = "okay"; | ||
| 51 | |||
| 52 | at91bootstrap@0 { | ||
| 53 | label = "at91bootstrap"; | ||
| 54 | reg = <0x0 0x20000>; | ||
| 55 | }; | ||
| 56 | |||
| 57 | barebox@20000 { | ||
| 58 | label = "barebox"; | ||
| 59 | reg = <0x20000 0x40000>; | ||
| 60 | }; | ||
| 61 | |||
| 62 | bareboxenv@60000 { | ||
| 63 | label = "bareboxenv"; | ||
| 64 | reg = <0x60000 0x20000>; | ||
| 65 | }; | ||
| 66 | |||
| 67 | bareboxenv2@80000 { | ||
| 68 | label = "bareboxenv2"; | ||
| 69 | reg = <0x80000 0x20000>; | ||
| 70 | }; | ||
| 71 | |||
| 72 | kernel@a0000 { | ||
| 73 | label = "kernel"; | ||
| 74 | reg = <0xa0000 0x400000>; | ||
| 75 | }; | ||
| 76 | |||
| 77 | rootfs@4a0000 { | ||
| 78 | label = "rootfs"; | ||
| 79 | reg = <0x4a0000 0x7800000>; | ||
| 80 | }; | ||
| 81 | |||
| 82 | data@7ca0000 { | ||
| 83 | label = "data"; | ||
| 84 | reg = <0x7ca0000 0x8360000>; | ||
| 85 | }; | ||
| 86 | }; | ||
| 87 | |||
| 88 | usb0: ohci@00500000 { | ||
| 89 | num-ports = <2>; | ||
| 90 | status = "okay"; | ||
| 91 | }; | ||
| 34 | }; | 92 | }; |
| 35 | 93 | ||
| 36 | leds { | 94 | leds { |
| @@ -55,4 +113,13 @@ | |||
| 55 | gpio-key,wakeup; | 113 | gpio-key,wakeup; |
| 56 | }; | 114 | }; |
| 57 | }; | 115 | }; |
| 116 | |||
| 117 | i2c@0 { | ||
| 118 | status = "okay"; | ||
| 119 | |||
| 120 | rv3029c2@56 { | ||
| 121 | compatible = "rv3029c2"; | ||
| 122 | reg = <0x56>; | ||
| 123 | }; | ||
| 124 | }; | ||
| 58 | }; | 125 | }; |
diff --git a/arch/arm/configs/at91sam9g20_defconfig b/arch/arm/configs/at91sam9g20_defconfig index 9123568d9a8d..994d331b2319 100644 --- a/arch/arm/configs/at91sam9g20_defconfig +++ b/arch/arm/configs/at91sam9g20_defconfig | |||
| @@ -74,6 +74,8 @@ CONFIG_LEGACY_PTY_COUNT=16 | |||
| 74 | CONFIG_SERIAL_ATMEL=y | 74 | CONFIG_SERIAL_ATMEL=y |
| 75 | CONFIG_SERIAL_ATMEL_CONSOLE=y | 75 | CONFIG_SERIAL_ATMEL_CONSOLE=y |
| 76 | CONFIG_HW_RANDOM=y | 76 | CONFIG_HW_RANDOM=y |
| 77 | CONFIG_I2C=y | ||
| 78 | CONFIG_I2C_GPIO=y | ||
| 77 | CONFIG_SPI=y | 79 | CONFIG_SPI=y |
| 78 | CONFIG_SPI_ATMEL=y | 80 | CONFIG_SPI_ATMEL=y |
| 79 | CONFIG_SPI_SPIDEV=y | 81 | CONFIG_SPI_SPIDEV=y |
| @@ -105,6 +107,7 @@ CONFIG_LEDS_TRIGGERS=y | |||
| 105 | CONFIG_LEDS_TRIGGER_TIMER=y | 107 | CONFIG_LEDS_TRIGGER_TIMER=y |
| 106 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | 108 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y |
| 107 | CONFIG_RTC_CLASS=y | 109 | CONFIG_RTC_CLASS=y |
| 110 | CONFIG_RTC_DRV_RV3029C2=y | ||
| 108 | CONFIG_RTC_DRV_AT91SAM9=y | 111 | CONFIG_RTC_DRV_AT91SAM9=y |
| 109 | CONFIG_EXT2_FS=y | 112 | CONFIG_EXT2_FS=y |
| 110 | CONFIG_MSDOS_FS=y | 113 | CONFIG_MSDOS_FS=y |
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index e55cdcbd81fb..45db05d8d94c 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
| @@ -20,9 +20,11 @@ config HAVE_AT91_USART5 | |||
| 20 | 20 | ||
| 21 | config AT91_SAM9_ALT_RESET | 21 | config AT91_SAM9_ALT_RESET |
| 22 | bool | 22 | bool |
| 23 | default !ARCH_AT91X40 | ||
| 23 | 24 | ||
| 24 | config AT91_SAM9G45_RESET | 25 | config AT91_SAM9G45_RESET |
| 25 | bool | 26 | bool |
| 27 | default !ARCH_AT91X40 | ||
| 26 | 28 | ||
| 27 | menu "Atmel AT91 System-on-Chip" | 29 | menu "Atmel AT91 System-on-Chip" |
| 28 | 30 | ||
| @@ -45,7 +47,6 @@ config ARCH_AT91SAM9260 | |||
| 45 | select HAVE_AT91_USART4 | 47 | select HAVE_AT91_USART4 |
| 46 | select HAVE_AT91_USART5 | 48 | select HAVE_AT91_USART5 |
| 47 | select HAVE_NET_MACB | 49 | select HAVE_NET_MACB |
| 48 | select AT91_SAM9_ALT_RESET | ||
| 49 | 50 | ||
| 50 | config ARCH_AT91SAM9261 | 51 | config ARCH_AT91SAM9261 |
| 51 | bool "AT91SAM9261" | 52 | bool "AT91SAM9261" |
| @@ -53,7 +54,6 @@ config ARCH_AT91SAM9261 | |||
| 53 | select GENERIC_CLOCKEVENTS | 54 | select GENERIC_CLOCKEVENTS |
| 54 | select HAVE_FB_ATMEL | 55 | select HAVE_FB_ATMEL |
| 55 | select HAVE_AT91_DBGU0 | 56 | select HAVE_AT91_DBGU0 |
| 56 | select AT91_SAM9_ALT_RESET | ||
| 57 | 57 | ||
| 58 | config ARCH_AT91SAM9G10 | 58 | config ARCH_AT91SAM9G10 |
| 59 | bool "AT91SAM9G10" | 59 | bool "AT91SAM9G10" |
| @@ -61,7 +61,6 @@ config ARCH_AT91SAM9G10 | |||
| 61 | select GENERIC_CLOCKEVENTS | 61 | select GENERIC_CLOCKEVENTS |
| 62 | select HAVE_AT91_DBGU0 | 62 | select HAVE_AT91_DBGU0 |
| 63 | select HAVE_FB_ATMEL | 63 | select HAVE_FB_ATMEL |
| 64 | select AT91_SAM9_ALT_RESET | ||
| 65 | 64 | ||
| 66 | config ARCH_AT91SAM9263 | 65 | config ARCH_AT91SAM9263 |
| 67 | bool "AT91SAM9263" | 66 | bool "AT91SAM9263" |
| @@ -70,7 +69,6 @@ config ARCH_AT91SAM9263 | |||
| 70 | select HAVE_FB_ATMEL | 69 | select HAVE_FB_ATMEL |
| 71 | select HAVE_NET_MACB | 70 | select HAVE_NET_MACB |
| 72 | select HAVE_AT91_DBGU1 | 71 | select HAVE_AT91_DBGU1 |
| 73 | select AT91_SAM9_ALT_RESET | ||
| 74 | 72 | ||
| 75 | config ARCH_AT91SAM9RL | 73 | config ARCH_AT91SAM9RL |
| 76 | bool "AT91SAM9RL" | 74 | bool "AT91SAM9RL" |
| @@ -79,7 +77,6 @@ config ARCH_AT91SAM9RL | |||
| 79 | select HAVE_AT91_USART3 | 77 | select HAVE_AT91_USART3 |
| 80 | select HAVE_FB_ATMEL | 78 | select HAVE_FB_ATMEL |
| 81 | select HAVE_AT91_DBGU0 | 79 | select HAVE_AT91_DBGU0 |
| 82 | select AT91_SAM9_ALT_RESET | ||
| 83 | 80 | ||
| 84 | config ARCH_AT91SAM9G20 | 81 | config ARCH_AT91SAM9G20 |
| 85 | bool "AT91SAM9G20" | 82 | bool "AT91SAM9G20" |
| @@ -90,7 +87,6 @@ config ARCH_AT91SAM9G20 | |||
| 90 | select HAVE_AT91_USART4 | 87 | select HAVE_AT91_USART4 |
| 91 | select HAVE_AT91_USART5 | 88 | select HAVE_AT91_USART5 |
| 92 | select HAVE_NET_MACB | 89 | select HAVE_NET_MACB |
| 93 | select AT91_SAM9_ALT_RESET | ||
| 94 | 90 | ||
| 95 | config ARCH_AT91SAM9G45 | 91 | config ARCH_AT91SAM9G45 |
| 96 | bool "AT91SAM9G45" | 92 | bool "AT91SAM9G45" |
| @@ -100,7 +96,6 @@ config ARCH_AT91SAM9G45 | |||
| 100 | select HAVE_FB_ATMEL | 96 | select HAVE_FB_ATMEL |
| 101 | select HAVE_NET_MACB | 97 | select HAVE_NET_MACB |
| 102 | select HAVE_AT91_DBGU1 | 98 | select HAVE_AT91_DBGU1 |
| 103 | select AT91_SAM9G45_RESET | ||
| 104 | 99 | ||
| 105 | config ARCH_AT91SAM9X5 | 100 | config ARCH_AT91SAM9X5 |
| 106 | bool "AT91SAM9x5 family" | 101 | bool "AT91SAM9x5 family" |
| @@ -109,7 +104,6 @@ config ARCH_AT91SAM9X5 | |||
| 109 | select HAVE_FB_ATMEL | 104 | select HAVE_FB_ATMEL |
| 110 | select HAVE_NET_MACB | 105 | select HAVE_NET_MACB |
| 111 | select HAVE_AT91_DBGU0 | 106 | select HAVE_AT91_DBGU0 |
| 112 | select AT91_SAM9G45_RESET | ||
| 113 | 107 | ||
| 114 | config ARCH_AT91X40 | 108 | config ARCH_AT91X40 |
| 115 | bool "AT91x40" | 109 | bool "AT91x40" |
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index 14b5a9c9a514..d1e5750a6a04 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c | |||
| @@ -216,6 +216,7 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
| 216 | CLKDEV_CON_DEV_ID("t0_clk", "fffdc000.timer", &tc3_clk), | 216 | CLKDEV_CON_DEV_ID("t0_clk", "fffdc000.timer", &tc3_clk), |
| 217 | CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk), | 217 | CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk), |
| 218 | CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk), | 218 | CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk), |
| 219 | CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk), | ||
| 219 | /* fake hclk clock */ | 220 | /* fake hclk clock */ |
| 220 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), | 221 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), |
| 221 | CLKDEV_CON_ID("pioA", &pioA_clk), | 222 | CLKDEV_CON_ID("pioA", &pioA_clk), |
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index 0014573dfe17..df3bceacc86c 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c | |||
| @@ -232,6 +232,8 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
| 232 | /* more tc lookup table for DT entries */ | 232 | /* more tc lookup table for DT entries */ |
| 233 | CLKDEV_CON_DEV_ID("t0_clk", "fff7c000.timer", &tcb0_clk), | 233 | CLKDEV_CON_DEV_ID("t0_clk", "fff7c000.timer", &tcb0_clk), |
| 234 | CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk), | 234 | CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk), |
| 235 | CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk), | ||
| 236 | CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk), | ||
| 235 | /* fake hclk clock */ | 237 | /* fake hclk clock */ |
| 236 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), | 238 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), |
| 237 | CLKDEV_CON_ID("pioA", &pioA_clk), | 239 | CLKDEV_CON_ID("pioA", &pioA_clk), |
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index a34d96afa746..b6831eeb7b76 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c | |||
| @@ -131,7 +131,7 @@ static struct clk dma1_clk = { | |||
| 131 | .type = CLK_TYPE_PERIPHERAL, | 131 | .type = CLK_TYPE_PERIPHERAL, |
| 132 | }; | 132 | }; |
| 133 | static struct clk uhphs_clk = { | 133 | static struct clk uhphs_clk = { |
| 134 | .name = "uhphs_clk", | 134 | .name = "uhphs", |
| 135 | .pmc_mask = 1 << AT91SAM9X5_ID_UHPHS, | 135 | .pmc_mask = 1 << AT91SAM9X5_ID_UHPHS, |
| 136 | .type = CLK_TYPE_PERIPHERAL, | 136 | .type = CLK_TYPE_PERIPHERAL, |
| 137 | }; | 137 | }; |
| @@ -230,6 +230,9 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
| 230 | /* additional fake clock for macb_hclk */ | 230 | /* additional fake clock for macb_hclk */ |
| 231 | CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk), | 231 | CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk), |
| 232 | CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk), | 232 | CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk), |
| 233 | CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk), | ||
| 234 | CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk), | ||
| 235 | CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk), | ||
| 233 | }; | 236 | }; |
| 234 | 237 | ||
| 235 | /* | 238 | /* |
| @@ -299,14 +302,8 @@ static void __init at91sam9x5_map_io(void) | |||
| 299 | at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); | 302 | at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); |
| 300 | } | 303 | } |
| 301 | 304 | ||
| 302 | static void __init at91sam9x5_ioremap_registers(void) | ||
| 303 | { | ||
| 304 | at91_ioremap_ramc(0, AT91SAM9X5_BASE_DDRSDRC0, 512); | ||
| 305 | } | ||
| 306 | |||
| 307 | void __init at91sam9x5_initialize(void) | 305 | void __init at91sam9x5_initialize(void) |
| 308 | { | 306 | { |
| 309 | arm_pm_restart = at91sam9g45_restart; | ||
| 310 | at91_extern_irq = (1 << AT91SAM9X5_ID_IRQ0); | 307 | at91_extern_irq = (1 << AT91SAM9X5_ID_IRQ0); |
| 311 | 308 | ||
| 312 | /* Register GPIO subsystem (using DT) */ | 309 | /* Register GPIO subsystem (using DT) */ |
| @@ -314,11 +311,6 @@ void __init at91sam9x5_initialize(void) | |||
| 314 | } | 311 | } |
| 315 | 312 | ||
| 316 | /* -------------------------------------------------------------------- | 313 | /* -------------------------------------------------------------------- |
| 317 | * AT91SAM9x5 devices (temporary before modification of code) | ||
| 318 | * -------------------------------------------------------------------- */ | ||
| 319 | void __init at91_add_device_nand(struct atmel_nand_data *data) {} | ||
| 320 | |||
| 321 | /* -------------------------------------------------------------------- | ||
| 322 | * Interrupt initialization | 314 | * Interrupt initialization |
| 323 | * -------------------------------------------------------------------- */ | 315 | * -------------------------------------------------------------------- */ |
| 324 | /* | 316 | /* |
| @@ -362,7 +354,6 @@ static unsigned int at91sam9x5_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
| 362 | struct at91_init_soc __initdata at91sam9x5_soc = { | 354 | struct at91_init_soc __initdata at91sam9x5_soc = { |
| 363 | .map_io = at91sam9x5_map_io, | 355 | .map_io = at91sam9x5_map_io, |
| 364 | .default_irq_priority = at91sam9x5_default_irq_priority, | 356 | .default_irq_priority = at91sam9x5_default_irq_priority, |
| 365 | .ioremap_registers = at91sam9x5_ioremap_registers, | ||
| 366 | .register_clocks = at91sam9x5_register_clocks, | 357 | .register_clocks = at91sam9x5_register_clocks, |
| 367 | .init = at91sam9x5_initialize, | 358 | .init = at91sam9x5_initialize, |
| 368 | }; | 359 | }; |
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c index 3bb40694b02d..161efbaa1029 100644 --- a/arch/arm/mach-at91/board-afeb-9260v1.c +++ b/arch/arm/mach-at91/board-afeb-9260v1.c | |||
| @@ -138,6 +138,7 @@ static struct atmel_nand_data __initdata afeb9260_nand_data = { | |||
| 138 | .rdy_pin = AT91_PIN_PC13, | 138 | .rdy_pin = AT91_PIN_PC13, |
| 139 | .enable_pin = AT91_PIN_PC14, | 139 | .enable_pin = AT91_PIN_PC14, |
| 140 | .bus_width_16 = 0, | 140 | .bus_width_16 = 0, |
| 141 | .ecc_mode = NAND_ECC_SOFT, | ||
| 141 | .parts = afeb9260_nand_partition, | 142 | .parts = afeb9260_nand_partition, |
| 142 | .num_parts = ARRAY_SIZE(afeb9260_nand_partition), | 143 | .num_parts = ARRAY_SIZE(afeb9260_nand_partition), |
| 143 | .det_pin = -EINVAL, | 144 | .det_pin = -EINVAL, |
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c index 8510e9e54988..c6d44ee0c77e 100644 --- a/arch/arm/mach-at91/board-cam60.c +++ b/arch/arm/mach-at91/board-cam60.c | |||
| @@ -140,6 +140,7 @@ static struct atmel_nand_data __initdata cam60_nand_data = { | |||
| 140 | .det_pin = -EINVAL, | 140 | .det_pin = -EINVAL, |
| 141 | .rdy_pin = AT91_PIN_PA9, | 141 | .rdy_pin = AT91_PIN_PA9, |
| 142 | .enable_pin = AT91_PIN_PA7, | 142 | .enable_pin = AT91_PIN_PA7, |
| 143 | .ecc_mode = NAND_ECC_SOFT, | ||
| 143 | .parts = cam60_nand_partition, | 144 | .parts = cam60_nand_partition, |
| 144 | .num_parts = ARRAY_SIZE(cam60_nand_partition), | 145 | .num_parts = ARRAY_SIZE(cam60_nand_partition), |
| 145 | }; | 146 | }; |
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c index 989e1c5a9ca0..5f3680e7c883 100644 --- a/arch/arm/mach-at91/board-cpu9krea.c +++ b/arch/arm/mach-at91/board-cpu9krea.c | |||
| @@ -117,6 +117,7 @@ static struct atmel_nand_data __initdata cpu9krea_nand_data = { | |||
| 117 | .enable_pin = AT91_PIN_PC14, | 117 | .enable_pin = AT91_PIN_PC14, |
| 118 | .bus_width_16 = 0, | 118 | .bus_width_16 = 0, |
| 119 | .det_pin = -EINVAL, | 119 | .det_pin = -EINVAL, |
| 120 | .ecc_mode = NAND_ECC_SOFT, | ||
| 120 | }; | 121 | }; |
| 121 | 122 | ||
| 122 | #ifdef CONFIG_MACH_CPU9260 | 123 | #ifdef CONFIG_MACH_CPU9260 |
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c index 583b72472ad9..c18d4d307801 100644 --- a/arch/arm/mach-at91/board-dt.c +++ b/arch/arm/mach-at91/board-dt.c | |||
| @@ -19,10 +19,7 @@ | |||
| 19 | #include <linux/of_irq.h> | 19 | #include <linux/of_irq.h> |
| 20 | #include <linux/of_platform.h> | 20 | #include <linux/of_platform.h> |
| 21 | 21 | ||
| 22 | #include <mach/hardware.h> | ||
| 23 | #include <mach/board.h> | 22 | #include <mach/board.h> |
| 24 | #include <mach/system_rev.h> | ||
| 25 | #include <mach/at91sam9_smc.h> | ||
| 26 | 23 | ||
| 27 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
| 28 | #include <asm/irq.h> | 25 | #include <asm/irq.h> |
| @@ -30,58 +27,9 @@ | |||
| 30 | #include <asm/mach/map.h> | 27 | #include <asm/mach/map.h> |
| 31 | #include <asm/mach/irq.h> | 28 | #include <asm/mach/irq.h> |
| 32 | 29 | ||
| 33 | #include "sam9_smc.h" | ||
| 34 | #include "generic.h" | 30 | #include "generic.h" |
| 35 | 31 | ||
| 36 | 32 | ||
| 37 | static void __init ek_init_early(void) | ||
| 38 | { | ||
| 39 | /* Initialize processor: 12.000 MHz crystal */ | ||
| 40 | at91_initialize(12000000); | ||
| 41 | } | ||
| 42 | |||
| 43 | /* det_pin is not connected */ | ||
| 44 | static struct atmel_nand_data __initdata ek_nand_data = { | ||
| 45 | .ale = 21, | ||
| 46 | .cle = 22, | ||
| 47 | .det_pin = -EINVAL, | ||
| 48 | .rdy_pin = AT91_PIN_PC8, | ||
| 49 | .enable_pin = AT91_PIN_PC14, | ||
| 50 | }; | ||
| 51 | |||
| 52 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
| 53 | .ncs_read_setup = 0, | ||
| 54 | .nrd_setup = 2, | ||
| 55 | .ncs_write_setup = 0, | ||
| 56 | .nwe_setup = 2, | ||
| 57 | |||
| 58 | .ncs_read_pulse = 4, | ||
| 59 | .nrd_pulse = 4, | ||
| 60 | .ncs_write_pulse = 4, | ||
| 61 | .nwe_pulse = 4, | ||
| 62 | |||
| 63 | .read_cycle = 7, | ||
| 64 | .write_cycle = 7, | ||
| 65 | |||
| 66 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, | ||
| 67 | .tdf_cycles = 3, | ||
| 68 | }; | ||
| 69 | |||
| 70 | static void __init ek_add_device_nand(void) | ||
| 71 | { | ||
| 72 | ek_nand_data.bus_width_16 = board_have_nand_16bit(); | ||
| 73 | /* setup bus-width (8 or 16) */ | ||
| 74 | if (ek_nand_data.bus_width_16) | ||
| 75 | ek_nand_smc_config.mode |= AT91_SMC_DBW_16; | ||
| 76 | else | ||
| 77 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | ||
| 78 | |||
| 79 | /* configure chip-select 3 (NAND) */ | ||
| 80 | sam9_smc_configure(0, 3, &ek_nand_smc_config); | ||
| 81 | |||
| 82 | at91_add_device_nand(&ek_nand_data); | ||
| 83 | } | ||
| 84 | |||
| 85 | static const struct of_device_id irq_of_match[] __initconst = { | 33 | static const struct of_device_id irq_of_match[] __initconst = { |
| 86 | 34 | ||
| 87 | { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init }, | 35 | { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init }, |
| @@ -98,9 +46,6 @@ static void __init at91_dt_init_irq(void) | |||
| 98 | static void __init at91_dt_device_init(void) | 46 | static void __init at91_dt_device_init(void) |
| 99 | { | 47 | { |
| 100 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 48 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
| 101 | |||
| 102 | /* NAND */ | ||
| 103 | ek_add_device_nand(); | ||
| 104 | } | 49 | } |
| 105 | 50 | ||
| 106 | static const char *at91_dt_board_compat[] __initdata = { | 51 | static const char *at91_dt_board_compat[] __initdata = { |
| @@ -114,7 +59,7 @@ DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)") | |||
| 114 | /* Maintainer: Atmel */ | 59 | /* Maintainer: Atmel */ |
| 115 | .timer = &at91sam926x_timer, | 60 | .timer = &at91sam926x_timer, |
| 116 | .map_io = at91_map_io, | 61 | .map_io = at91_map_io, |
| 117 | .init_early = ek_init_early, | 62 | .init_early = at91_dt_initialize, |
| 118 | .init_irq = at91_dt_init_irq, | 63 | .init_irq = at91_dt_init_irq, |
| 119 | .init_machine = at91_dt_device_init, | 64 | .init_machine = at91_dt_device_init, |
| 120 | .dt_compat = at91_dt_board_compat, | 65 | .dt_compat = at91_dt_board_compat, |
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c index bb9914582013..59b92aab9bcf 100644 --- a/arch/arm/mach-at91/board-kb9202.c +++ b/arch/arm/mach-at91/board-kb9202.c | |||
| @@ -108,6 +108,7 @@ static struct atmel_nand_data __initdata kb9202_nand_data = { | |||
| 108 | .det_pin = -EINVAL, | 108 | .det_pin = -EINVAL, |
| 109 | .rdy_pin = AT91_PIN_PC29, | 109 | .rdy_pin = AT91_PIN_PC29, |
| 110 | .enable_pin = AT91_PIN_PC28, | 110 | .enable_pin = AT91_PIN_PC28, |
| 111 | .ecc_mode = NAND_ECC_SOFT, | ||
| 111 | .parts = kb9202_nand_partition, | 112 | .parts = kb9202_nand_partition, |
| 112 | .num_parts = ARRAY_SIZE(kb9202_nand_partition), | 113 | .num_parts = ARRAY_SIZE(kb9202_nand_partition), |
| 113 | }; | 114 | }; |
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c index 3f8617c0e04e..57d5f6a4726a 100644 --- a/arch/arm/mach-at91/board-neocore926.c +++ b/arch/arm/mach-at91/board-neocore926.c | |||
| @@ -190,6 +190,7 @@ static struct atmel_nand_data __initdata neocore926_nand_data = { | |||
| 190 | .rdy_pin = AT91_PIN_PB19, | 190 | .rdy_pin = AT91_PIN_PB19, |
| 191 | .rdy_pin_active_low = 1, | 191 | .rdy_pin_active_low = 1, |
| 192 | .enable_pin = AT91_PIN_PD15, | 192 | .enable_pin = AT91_PIN_PD15, |
| 193 | .ecc_mode = NAND_ECC_SOFT, | ||
| 193 | .parts = neocore926_nand_partition, | 194 | .parts = neocore926_nand_partition, |
| 194 | .num_parts = ARRAY_SIZE(neocore926_nand_partition), | 195 | .num_parts = ARRAY_SIZE(neocore926_nand_partition), |
| 195 | .det_pin = -EINVAL, | 196 | .det_pin = -EINVAL, |
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c index e029d220cb84..b6ed5ed7081a 100644 --- a/arch/arm/mach-at91/board-qil-a9260.c +++ b/arch/arm/mach-at91/board-qil-a9260.c | |||
| @@ -138,6 +138,8 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
| 138 | .det_pin = -EINVAL, | 138 | .det_pin = -EINVAL, |
| 139 | .rdy_pin = AT91_PIN_PC13, | 139 | .rdy_pin = AT91_PIN_PC13, |
| 140 | .enable_pin = AT91_PIN_PC14, | 140 | .enable_pin = AT91_PIN_PC14, |
| 141 | .ecc_mode = NAND_ECC_SOFT, | ||
| 142 | .on_flash_bbt = 1, | ||
| 141 | .parts = ek_nand_partition, | 143 | .parts = ek_nand_partition, |
| 142 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 144 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
| 143 | }; | 145 | }; |
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c index 9083df04e7ed..01332aa538b2 100644 --- a/arch/arm/mach-at91/board-rm9200dk.c +++ b/arch/arm/mach-at91/board-rm9200dk.c | |||
| @@ -150,6 +150,8 @@ static struct atmel_nand_data __initdata dk_nand_data = { | |||
| 150 | .det_pin = AT91_PIN_PB1, | 150 | .det_pin = AT91_PIN_PB1, |
| 151 | .rdy_pin = AT91_PIN_PC2, | 151 | .rdy_pin = AT91_PIN_PC2, |
| 152 | .enable_pin = -EINVAL, | 152 | .enable_pin = -EINVAL, |
| 153 | .ecc_mode = NAND_ECC_SOFT, | ||
| 154 | .on_flash_bbt = 1, | ||
| 153 | .parts = dk_nand_partition, | 155 | .parts = dk_nand_partition, |
| 154 | .num_parts = ARRAY_SIZE(dk_nand_partition), | 156 | .num_parts = ARRAY_SIZE(dk_nand_partition), |
| 155 | }; | 157 | }; |
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c index 84bce587735f..e8b116b6cba6 100644 --- a/arch/arm/mach-at91/board-sam9-l9260.c +++ b/arch/arm/mach-at91/board-sam9-l9260.c | |||
| @@ -139,6 +139,7 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
| 139 | .det_pin = -EINVAL, | 139 | .det_pin = -EINVAL, |
| 140 | .rdy_pin = AT91_PIN_PC13, | 140 | .rdy_pin = AT91_PIN_PC13, |
| 141 | .enable_pin = AT91_PIN_PC14, | 141 | .enable_pin = AT91_PIN_PC14, |
| 142 | .ecc_mode = NAND_ECC_SOFT, | ||
| 142 | .parts = ek_nand_partition, | 143 | .parts = ek_nand_partition, |
| 143 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 144 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
| 144 | }; | 145 | }; |
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c index be8233bcabdc..d5aec55b0eb4 100644 --- a/arch/arm/mach-at91/board-sam9260ek.c +++ b/arch/arm/mach-at91/board-sam9260ek.c | |||
| @@ -181,6 +181,8 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
| 181 | .det_pin = -EINVAL, | 181 | .det_pin = -EINVAL, |
| 182 | .rdy_pin = AT91_PIN_PC13, | 182 | .rdy_pin = AT91_PIN_PC13, |
| 183 | .enable_pin = AT91_PIN_PC14, | 183 | .enable_pin = AT91_PIN_PC14, |
| 184 | .ecc_mode = NAND_ECC_SOFT, | ||
| 185 | .on_flash_bbt = 1, | ||
| 184 | .parts = ek_nand_partition, | 186 | .parts = ek_nand_partition, |
| 185 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 187 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
| 186 | }; | 188 | }; |
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index 40895072a1a7..c3f994462864 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
| @@ -187,6 +187,8 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
| 187 | .det_pin = -EINVAL, | 187 | .det_pin = -EINVAL, |
| 188 | .rdy_pin = AT91_PIN_PC15, | 188 | .rdy_pin = AT91_PIN_PC15, |
| 189 | .enable_pin = AT91_PIN_PC14, | 189 | .enable_pin = AT91_PIN_PC14, |
| 190 | .ecc_mode = NAND_ECC_SOFT, | ||
| 191 | .on_flash_bbt = 1, | ||
| 190 | .parts = ek_nand_partition, | 192 | .parts = ek_nand_partition, |
| 191 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 193 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
| 192 | }; | 194 | }; |
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c index 29f66052fe63..66f0ddf4b2ae 100644 --- a/arch/arm/mach-at91/board-sam9263ek.c +++ b/arch/arm/mach-at91/board-sam9263ek.c | |||
| @@ -187,6 +187,8 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
| 187 | .det_pin = -EINVAL, | 187 | .det_pin = -EINVAL, |
| 188 | .rdy_pin = AT91_PIN_PA22, | 188 | .rdy_pin = AT91_PIN_PA22, |
| 189 | .enable_pin = AT91_PIN_PD15, | 189 | .enable_pin = AT91_PIN_PD15, |
| 190 | .ecc_mode = NAND_ECC_SOFT, | ||
| 191 | .on_flash_bbt = 1, | ||
| 190 | .parts = ek_nand_partition, | 192 | .parts = ek_nand_partition, |
| 191 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 193 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
| 192 | }; | 194 | }; |
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c index 843d6286c6f4..8923ec9f5831 100644 --- a/arch/arm/mach-at91/board-sam9g20ek.c +++ b/arch/arm/mach-at91/board-sam9g20ek.c | |||
| @@ -166,6 +166,8 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
| 166 | .rdy_pin = AT91_PIN_PC13, | 166 | .rdy_pin = AT91_PIN_PC13, |
| 167 | .enable_pin = AT91_PIN_PC14, | 167 | .enable_pin = AT91_PIN_PC14, |
| 168 | .det_pin = -EINVAL, | 168 | .det_pin = -EINVAL, |
| 169 | .ecc_mode = NAND_ECC_SOFT, | ||
| 170 | .on_flash_bbt = 1, | ||
| 169 | .parts = ek_nand_partition, | 171 | .parts = ek_nand_partition, |
| 170 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 172 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
| 171 | }; | 173 | }; |
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c index 57497e2b8878..e1bea73e6b30 100644 --- a/arch/arm/mach-at91/board-sam9m10g45ek.c +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c | |||
| @@ -148,6 +148,8 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
| 148 | .rdy_pin = AT91_PIN_PC8, | 148 | .rdy_pin = AT91_PIN_PC8, |
| 149 | .enable_pin = AT91_PIN_PC14, | 149 | .enable_pin = AT91_PIN_PC14, |
| 150 | .det_pin = -EINVAL, | 150 | .det_pin = -EINVAL, |
| 151 | .ecc_mode = NAND_ECC_SOFT, | ||
| 152 | .on_flash_bbt = 1, | ||
| 151 | .parts = ek_nand_partition, | 153 | .parts = ek_nand_partition, |
| 152 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 154 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
| 153 | }; | 155 | }; |
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c index c1366d0032bf..b109ce2ba864 100644 --- a/arch/arm/mach-at91/board-sam9rlek.c +++ b/arch/arm/mach-at91/board-sam9rlek.c | |||
| @@ -94,6 +94,8 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
| 94 | .det_pin = -EINVAL, | 94 | .det_pin = -EINVAL, |
| 95 | .rdy_pin = AT91_PIN_PD17, | 95 | .rdy_pin = AT91_PIN_PD17, |
| 96 | .enable_pin = AT91_PIN_PB6, | 96 | .enable_pin = AT91_PIN_PB6, |
| 97 | .ecc_mode = NAND_ECC_SOFT, | ||
| 98 | .on_flash_bbt = 1, | ||
| 97 | .parts = ek_nand_partition, | 99 | .parts = ek_nand_partition, |
| 98 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 100 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
| 99 | }; | 101 | }; |
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c index 3c2e3fcc310c..ebc9d01ce742 100644 --- a/arch/arm/mach-at91/board-snapper9260.c +++ b/arch/arm/mach-at91/board-snapper9260.c | |||
| @@ -110,6 +110,7 @@ static struct atmel_nand_data __initdata snapper9260_nand_data = { | |||
| 110 | .bus_width_16 = 0, | 110 | .bus_width_16 = 0, |
| 111 | .enable_pin = -EINVAL, | 111 | .enable_pin = -EINVAL, |
| 112 | .det_pin = -EINVAL, | 112 | .det_pin = -EINVAL, |
| 113 | .ecc_mode = NAND_ECC_SOFT, | ||
| 113 | }; | 114 | }; |
| 114 | 115 | ||
| 115 | static struct sam9_smc_config __initdata snapper9260_nand_smc_config = { | 116 | static struct sam9_smc_config __initdata snapper9260_nand_smc_config = { |
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c index 72eb3b4d9ab6..7640049410a0 100644 --- a/arch/arm/mach-at91/board-stamp9g20.c +++ b/arch/arm/mach-at91/board-stamp9g20.c | |||
| @@ -86,6 +86,7 @@ static struct atmel_nand_data __initdata nand_data = { | |||
| 86 | .enable_pin = AT91_PIN_PC14, | 86 | .enable_pin = AT91_PIN_PC14, |
| 87 | .bus_width_16 = 0, | 87 | .bus_width_16 = 0, |
| 88 | .det_pin = -EINVAL, | 88 | .det_pin = -EINVAL, |
| 89 | .ecc_mode = NAND_ECC_SOFT, | ||
| 89 | }; | 90 | }; |
| 90 | 91 | ||
| 91 | static struct sam9_smc_config __initdata nand_smc_config = { | 92 | static struct sam9_smc_config __initdata nand_smc_config = { |
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c index 26c36fc2d1e5..b7483a3d0980 100644 --- a/arch/arm/mach-at91/board-usb-a926x.c +++ b/arch/arm/mach-at91/board-usb-a926x.c | |||
| @@ -198,6 +198,8 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
| 198 | .det_pin = -EINVAL, | 198 | .det_pin = -EINVAL, |
| 199 | .rdy_pin = AT91_PIN_PA22, | 199 | .rdy_pin = AT91_PIN_PA22, |
| 200 | .enable_pin = AT91_PIN_PD15, | 200 | .enable_pin = AT91_PIN_PD15, |
| 201 | .ecc_mode = NAND_ECC_SOFT, | ||
| 202 | .on_flash_bbt = 1, | ||
| 201 | .parts = ek_nand_partition, | 203 | .parts = ek_nand_partition, |
| 202 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 204 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
| 203 | }; | 205 | }; |
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c index 52f460768f71..38dd279d30b2 100644 --- a/arch/arm/mach-at91/board-yl-9200.c +++ b/arch/arm/mach-at91/board-yl-9200.c | |||
| @@ -182,6 +182,7 @@ static struct atmel_nand_data __initdata yl9200_nand_data = { | |||
| 182 | .det_pin = -EINVAL, | 182 | .det_pin = -EINVAL, |
| 183 | .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */ | 183 | .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */ |
| 184 | .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */ | 184 | .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */ |
| 185 | .ecc_mode = NAND_ECC_SOFT, | ||
| 185 | .parts = yl9200_nand_partition, | 186 | .parts = yl9200_nand_partition, |
| 186 | .num_parts = ARRAY_SIZE(yl9200_nand_partition), | 187 | .num_parts = ARRAY_SIZE(yl9200_nand_partition), |
| 187 | }; | 188 | }; |
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index be51ca7f694d..a0f4d7424cdc 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| 24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
| 25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
| 26 | #include <linux/of_address.h> | ||
| 26 | 27 | ||
| 27 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
| 28 | #include <mach/at91_pmc.h> | 29 | #include <mach/at91_pmc.h> |
| @@ -671,16 +672,12 @@ static void __init at91_upll_usbfs_clock_init(unsigned long main_clock) | |||
| 671 | uhpck.rate_hz /= 1 + ((at91_pmc_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8); | 672 | uhpck.rate_hz /= 1 + ((at91_pmc_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8); |
| 672 | } | 673 | } |
| 673 | 674 | ||
| 674 | int __init at91_clock_init(unsigned long main_clock) | 675 | static int __init at91_pmc_init(unsigned long main_clock) |
| 675 | { | 676 | { |
| 676 | unsigned tmp, freq, mckr; | 677 | unsigned tmp, freq, mckr; |
| 677 | int i; | 678 | int i; |
| 678 | int pll_overclock = false; | 679 | int pll_overclock = false; |
| 679 | 680 | ||
| 680 | at91_pmc_base = ioremap(AT91_PMC, 256); | ||
| 681 | if (!at91_pmc_base) | ||
| 682 | panic("Impossible to ioremap AT91_PMC 0x%x\n", AT91_PMC); | ||
| 683 | |||
| 684 | /* | 681 | /* |
| 685 | * When the bootloader initialized the main oscillator correctly, | 682 | * When the bootloader initialized the main oscillator correctly, |
| 686 | * there's no problem using the cycle counter. But if it didn't, | 683 | * there's no problem using the cycle counter. But if it didn't, |
| @@ -802,6 +799,55 @@ int __init at91_clock_init(unsigned long main_clock) | |||
| 802 | return 0; | 799 | return 0; |
| 803 | } | 800 | } |
| 804 | 801 | ||
| 802 | #if defined(CONFIG_OF) | ||
| 803 | static struct of_device_id pmc_ids[] = { | ||
| 804 | { .compatible = "atmel,at91rm9200-pmc" }, | ||
| 805 | { /*sentinel*/ } | ||
| 806 | }; | ||
| 807 | |||
| 808 | static struct of_device_id osc_ids[] = { | ||
| 809 | { .compatible = "atmel,osc" }, | ||
| 810 | { /*sentinel*/ } | ||
| 811 | }; | ||
| 812 | |||
| 813 | int __init at91_dt_clock_init(void) | ||
| 814 | { | ||
| 815 | struct device_node *np; | ||
| 816 | u32 main_clock = 0; | ||
| 817 | |||
| 818 | np = of_find_matching_node(NULL, pmc_ids); | ||
| 819 | if (!np) | ||
| 820 | panic("unable to find compatible pmc node in dtb\n"); | ||
| 821 | |||
| 822 | at91_pmc_base = of_iomap(np, 0); | ||
| 823 | if (!at91_pmc_base) | ||
| 824 | panic("unable to map pmc cpu registers\n"); | ||
| 825 | |||
| 826 | of_node_put(np); | ||
| 827 | |||
| 828 | /* retrieve the freqency of fixed clocks from device tree */ | ||
| 829 | np = of_find_matching_node(NULL, osc_ids); | ||
| 830 | if (np) { | ||
| 831 | u32 rate; | ||
| 832 | if (!of_property_read_u32(np, "clock-frequency", &rate)) | ||
| 833 | main_clock = rate; | ||
| 834 | } | ||
| 835 | |||
| 836 | of_node_put(np); | ||
| 837 | |||
| 838 | return at91_pmc_init(main_clock); | ||
| 839 | } | ||
| 840 | #endif | ||
| 841 | |||
| 842 | int __init at91_clock_init(unsigned long main_clock) | ||
| 843 | { | ||
| 844 | at91_pmc_base = ioremap(AT91_PMC, 256); | ||
| 845 | if (!at91_pmc_base) | ||
| 846 | panic("Impossible to ioremap AT91_PMC 0x%x\n", AT91_PMC); | ||
| 847 | |||
| 848 | return at91_pmc_init(main_clock); | ||
| 849 | } | ||
| 850 | |||
| 805 | /* | 851 | /* |
| 806 | * Several unused clocks may be active. Turn them off. | 852 | * Several unused clocks may be active. Turn them off. |
| 807 | */ | 853 | */ |
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 459f01a4a546..dd9b346c451d 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
| @@ -20,6 +20,7 @@ extern void __init at91_init_sram(int bank, unsigned long base, | |||
| 20 | extern void __init at91rm9200_set_type(int type); | 20 | extern void __init at91rm9200_set_type(int type); |
| 21 | extern void __init at91_initialize(unsigned long main_clock); | 21 | extern void __init at91_initialize(unsigned long main_clock); |
| 22 | extern void __init at91x40_initialize(unsigned long main_clock); | 22 | extern void __init at91x40_initialize(unsigned long main_clock); |
| 23 | extern void __init at91_dt_initialize(void); | ||
| 23 | 24 | ||
| 24 | /* Interrupts */ | 25 | /* Interrupts */ |
| 25 | extern void __init at91_init_irq_default(void); | 26 | extern void __init at91_init_irq_default(void); |
| @@ -52,6 +53,7 @@ extern void __init at91sam9rl_set_console_clock(int id); | |||
| 52 | extern void __init at91sam9g45_set_console_clock(int id); | 53 | extern void __init at91sam9g45_set_console_clock(int id); |
| 53 | #ifdef CONFIG_AT91_PMC_UNIT | 54 | #ifdef CONFIG_AT91_PMC_UNIT |
| 54 | extern int __init at91_clock_init(unsigned long main_clock); | 55 | extern int __init at91_clock_init(unsigned long main_clock); |
| 56 | extern int __init at91_dt_clock_init(void); | ||
| 55 | #else | 57 | #else |
| 56 | static int inline at91_clock_init(unsigned long main_clock) { return 0; } | 58 | static int inline at91_clock_init(unsigned long main_clock) { return 0; } |
| 57 | #endif | 59 | #endif |
diff --git a/arch/arm/mach-at91/include/mach/at91_shdwc.h b/arch/arm/mach-at91/include/mach/at91_shdwc.h index 1d4fe822c77a..60478ea8bd46 100644 --- a/arch/arm/mach-at91/include/mach/at91_shdwc.h +++ b/arch/arm/mach-at91/include/mach/at91_shdwc.h | |||
| @@ -36,9 +36,11 @@ extern void __iomem *at91_shdwc_base; | |||
| 36 | #define AT91_SHDW_WKMODE0_HIGH 1 | 36 | #define AT91_SHDW_WKMODE0_HIGH 1 |
| 37 | #define AT91_SHDW_WKMODE0_LOW 2 | 37 | #define AT91_SHDW_WKMODE0_LOW 2 |
| 38 | #define AT91_SHDW_WKMODE0_ANYLEVEL 3 | 38 | #define AT91_SHDW_WKMODE0_ANYLEVEL 3 |
| 39 | #define AT91_SHDW_CPTWK0 (0xf << 4) /* Counter On Wake Up 0 */ | 39 | #define AT91_SHDW_CPTWK0_MAX 0xf /* Maximum Counter On Wake Up 0 */ |
| 40 | #define AT91_SHDW_CPTWK0 (AT91_SHDW_CPTWK0_MAX << 4) /* Counter On Wake Up 0 */ | ||
| 40 | #define AT91_SHDW_CPTWK0_(x) ((x) << 4) | 41 | #define AT91_SHDW_CPTWK0_(x) ((x) << 4) |
| 41 | #define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */ | 42 | #define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */ |
| 43 | #define AT91_SHDW_RTCWKEN (1 << 17) /* Real Time Clock Wake-up Enable */ | ||
| 42 | 44 | ||
| 43 | #define AT91_SHDW_SR 0x08 /* Shut Down Status Register */ | 45 | #define AT91_SHDW_SR 0x08 /* Shut Down Status Register */ |
| 44 | #define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */ | 46 | #define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */ |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h index a297a77d88e2..88e43d534cdf 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9x5.h +++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h | |||
| @@ -55,11 +55,6 @@ | |||
| 55 | #define AT91SAM9X5_BASE_USART2 0xf8024000 | 55 | #define AT91SAM9X5_BASE_USART2 0xf8024000 |
| 56 | 56 | ||
| 57 | /* | 57 | /* |
| 58 | * System Peripherals | ||
| 59 | */ | ||
| 60 | #define AT91SAM9X5_BASE_DDRSDRC0 0xffffe800 | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Base addresses for early serial code (uncompress.h) | 58 | * Base addresses for early serial code (uncompress.h) |
| 64 | */ | 59 | */ |
| 65 | #define AT91_DBGU AT91_BASE_DBGU0 | 60 | #define AT91_DBGU AT91_BASE_DBGU0 |
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index dc8d6d4f17cf..544a5d5ce416 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include <sound/atmel-ac97c.h> | 41 | #include <sound/atmel-ac97c.h> |
| 42 | #include <linux/serial.h> | 42 | #include <linux/serial.h> |
| 43 | #include <linux/platform_data/macb.h> | 43 | #include <linux/platform_data/macb.h> |
| 44 | #include <linux/platform_data/atmel.h> | ||
| 44 | 45 | ||
| 45 | /* USB Device */ | 46 | /* USB Device */ |
| 46 | struct at91_udc_data { | 47 | struct at91_udc_data { |
| @@ -98,20 +99,6 @@ extern void __init at91_add_device_usbh(struct at91_usbh_data *data); | |||
| 98 | extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data); | 99 | extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data); |
| 99 | extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data); | 100 | extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data); |
| 100 | 101 | ||
| 101 | /* NAND / SmartMedia */ | ||
| 102 | struct atmel_nand_data { | ||
| 103 | int enable_pin; /* chip enable */ | ||
| 104 | int det_pin; /* card detect */ | ||
| 105 | int rdy_pin; /* ready/busy */ | ||
| 106 | u8 rdy_pin_active_low; /* rdy_pin value is inverted */ | ||
| 107 | u8 ale; /* address line number connected to ALE */ | ||
| 108 | u8 cle; /* address line number connected to CLE */ | ||
| 109 | u8 bus_width_16; /* buswidth is 16 bit */ | ||
| 110 | u8 correction_cap; /* PMECC correction capability */ | ||
| 111 | u16 sector_size; /* Sector size for PMECC */ | ||
| 112 | struct mtd_partition *parts; | ||
| 113 | unsigned int num_parts; | ||
| 114 | }; | ||
| 115 | extern void __init at91_add_device_nand(struct atmel_nand_data *data); | 102 | extern void __init at91_add_device_nand(struct atmel_nand_data *data); |
| 116 | 103 | ||
| 117 | /* I2C*/ | 104 | /* I2C*/ |
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 6c9d5e69ac28..f630250c6b87 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
| @@ -197,19 +197,6 @@ extern void at91_slow_clock(void __iomem *pmc, void __iomem *ramc0, | |||
| 197 | extern u32 at91_slow_clock_sz; | 197 | extern u32 at91_slow_clock_sz; |
| 198 | #endif | 198 | #endif |
| 199 | 199 | ||
| 200 | void __iomem *at91_ramc_base[2]; | ||
| 201 | |||
| 202 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) | ||
| 203 | { | ||
| 204 | if (id < 0 || id > 1) { | ||
| 205 | pr_emerg("Wrong RAM controller id (%d), cannot continue\n", id); | ||
| 206 | BUG(); | ||
| 207 | } | ||
| 208 | at91_ramc_base[id] = ioremap(addr, size); | ||
| 209 | if (!at91_ramc_base[id]) | ||
| 210 | panic("Impossible to ioremap ramc.%d 0x%x\n", id, addr); | ||
| 211 | } | ||
| 212 | |||
| 213 | static int at91_pm_enter(suspend_state_t state) | 200 | static int at91_pm_enter(suspend_state_t state) |
| 214 | { | 201 | { |
| 215 | at91_gpio_suspend(); | 202 | at91_gpio_suspend(); |
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 372396c2ecb6..1083739e3065 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
| 10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
| 11 | #include <linux/pm.h> | 11 | #include <linux/pm.h> |
| 12 | #include <linux/of_address.h> | ||
| 12 | 13 | ||
| 13 | #include <asm/mach/map.h> | 14 | #include <asm/mach/map.h> |
| 14 | 15 | ||
| @@ -51,6 +52,19 @@ void __init at91_init_interrupts(unsigned int *priority) | |||
| 51 | at91_gpio_irq_setup(); | 52 | at91_gpio_irq_setup(); |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 55 | void __iomem *at91_ramc_base[2]; | ||
| 56 | |||
| 57 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) | ||
| 58 | { | ||
| 59 | if (id < 0 || id > 1) { | ||
| 60 | pr_emerg("Wrong RAM controller id (%d), cannot continue\n", id); | ||
| 61 | BUG(); | ||
| 62 | } | ||
| 63 | at91_ramc_base[id] = ioremap(addr, size); | ||
| 64 | if (!at91_ramc_base[id]) | ||
| 65 | panic("Impossible to ioremap ramc.%d 0x%x\n", id, addr); | ||
| 66 | } | ||
| 67 | |||
| 54 | static struct map_desc sram_desc[2] __initdata; | 68 | static struct map_desc sram_desc[2] __initdata; |
| 55 | 69 | ||
| 56 | void __init at91_init_sram(int bank, unsigned long base, unsigned int length) | 70 | void __init at91_init_sram(int bank, unsigned long base, unsigned int length) |
| @@ -285,6 +299,150 @@ void __init at91_ioremap_matrix(u32 base_addr) | |||
| 285 | panic("Impossible to ioremap at91_matrix_base\n"); | 299 | panic("Impossible to ioremap at91_matrix_base\n"); |
| 286 | } | 300 | } |
| 287 | 301 | ||
| 302 | #if defined(CONFIG_OF) | ||
| 303 | static struct of_device_id rstc_ids[] = { | ||
| 304 | { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9_alt_restart }, | ||
| 305 | { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart }, | ||
| 306 | { /*sentinel*/ } | ||
| 307 | }; | ||
| 308 | |||
| 309 | static void at91_dt_rstc(void) | ||
| 310 | { | ||
| 311 | struct device_node *np; | ||
| 312 | const struct of_device_id *of_id; | ||
| 313 | |||
| 314 | np = of_find_matching_node(NULL, rstc_ids); | ||
| 315 | if (!np) | ||
| 316 | panic("unable to find compatible rstc node in dtb\n"); | ||
| 317 | |||
| 318 | at91_rstc_base = of_iomap(np, 0); | ||
| 319 | if (!at91_rstc_base) | ||
| 320 | panic("unable to map rstc cpu registers\n"); | ||
| 321 | |||
| 322 | of_id = of_match_node(rstc_ids, np); | ||
| 323 | if (!of_id) | ||
| 324 | panic("AT91: rtsc no restart function availlable\n"); | ||
| 325 | |||
| 326 | arm_pm_restart = of_id->data; | ||
| 327 | |||
| 328 | of_node_put(np); | ||
| 329 | } | ||
| 330 | |||
| 331 | static struct of_device_id ramc_ids[] = { | ||
| 332 | { .compatible = "atmel,at91sam9260-sdramc" }, | ||
| 333 | { .compatible = "atmel,at91sam9g45-ddramc" }, | ||
| 334 | { /*sentinel*/ } | ||
| 335 | }; | ||
| 336 | |||
| 337 | static void at91_dt_ramc(void) | ||
| 338 | { | ||
| 339 | struct device_node *np; | ||
| 340 | |||
| 341 | np = of_find_matching_node(NULL, ramc_ids); | ||
| 342 | if (!np) | ||
| 343 | panic("unable to find compatible ram conroller node in dtb\n"); | ||
| 344 | |||
| 345 | at91_ramc_base[0] = of_iomap(np, 0); | ||
| 346 | if (!at91_ramc_base[0]) | ||
| 347 | panic("unable to map ramc[0] cpu registers\n"); | ||
| 348 | /* the controller may have 2 banks */ | ||
| 349 | at91_ramc_base[1] = of_iomap(np, 1); | ||
| 350 | |||
| 351 | of_node_put(np); | ||
| 352 | } | ||
| 353 | |||
| 354 | static struct of_device_id shdwc_ids[] = { | ||
| 355 | { .compatible = "atmel,at91sam9260-shdwc", }, | ||
| 356 | { .compatible = "atmel,at91sam9rl-shdwc", }, | ||
| 357 | { .compatible = "atmel,at91sam9x5-shdwc", }, | ||
| 358 | { /*sentinel*/ } | ||
| 359 | }; | ||
| 360 | |||
| 361 | static const char *shdwc_wakeup_modes[] = { | ||
| 362 | [AT91_SHDW_WKMODE0_NONE] = "none", | ||
| 363 | [AT91_SHDW_WKMODE0_HIGH] = "high", | ||
| 364 | [AT91_SHDW_WKMODE0_LOW] = "low", | ||
| 365 | [AT91_SHDW_WKMODE0_ANYLEVEL] = "any", | ||
| 366 | }; | ||
| 367 | |||
| 368 | const int at91_dtget_shdwc_wakeup_mode(struct device_node *np) | ||
| 369 | { | ||
| 370 | const char *pm; | ||
| 371 | int err, i; | ||
| 372 | |||
| 373 | err = of_property_read_string(np, "atmel,wakeup-mode", &pm); | ||
| 374 | if (err < 0) | ||
| 375 | return AT91_SHDW_WKMODE0_ANYLEVEL; | ||
| 376 | |||
| 377 | for (i = 0; i < ARRAY_SIZE(shdwc_wakeup_modes); i++) | ||
| 378 | if (!strcasecmp(pm, shdwc_wakeup_modes[i])) | ||
| 379 | return i; | ||
| 380 | |||
| 381 | return -ENODEV; | ||
| 382 | } | ||
| 383 | |||
| 384 | static void at91_dt_shdwc(void) | ||
| 385 | { | ||
| 386 | struct device_node *np; | ||
| 387 | int wakeup_mode; | ||
| 388 | u32 reg; | ||
| 389 | u32 mode = 0; | ||
| 390 | |||
| 391 | np = of_find_matching_node(NULL, shdwc_ids); | ||
| 392 | if (!np) { | ||
| 393 | pr_debug("AT91: unable to find compatible shutdown (shdwc) conroller node in dtb\n"); | ||
| 394 | return; | ||
| 395 | } | ||
| 396 | |||
| 397 | at91_shdwc_base = of_iomap(np, 0); | ||
| 398 | if (!at91_shdwc_base) | ||
| 399 | panic("AT91: unable to map shdwc cpu registers\n"); | ||
| 400 | |||
| 401 | wakeup_mode = at91_dtget_shdwc_wakeup_mode(np); | ||
| 402 | if (wakeup_mode < 0) { | ||
| 403 | pr_warn("AT91: shdwc unknown wakeup mode\n"); | ||
| 404 | goto end; | ||
| 405 | } | ||
| 406 | |||
| 407 | if (!of_property_read_u32(np, "atmel,wakeup-counter", ®)) { | ||
| 408 | if (reg > AT91_SHDW_CPTWK0_MAX) { | ||
| 409 | pr_warn("AT91: shdwc wakeup conter 0x%x > 0x%x reduce it to 0x%x\n", | ||
| 410 | reg, AT91_SHDW_CPTWK0_MAX, AT91_SHDW_CPTWK0_MAX); | ||
| 411 | reg = AT91_SHDW_CPTWK0_MAX; | ||
| 412 | } | ||
| 413 | mode |= AT91_SHDW_CPTWK0_(reg); | ||
| 414 | } | ||
| 415 | |||
| 416 | if (of_property_read_bool(np, "atmel,wakeup-rtc-timer")) | ||
| 417 | mode |= AT91_SHDW_RTCWKEN; | ||
| 418 | |||
| 419 | if (of_property_read_bool(np, "atmel,wakeup-rtt-timer")) | ||
| 420 | mode |= AT91_SHDW_RTTWKEN; | ||
| 421 | |||
| 422 | at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode); | ||
| 423 | |||
| 424 | end: | ||
| 425 | pm_power_off = at91sam9_poweroff; | ||
| 426 | |||
| 427 | of_node_put(np); | ||
| 428 | } | ||
| 429 | |||
| 430 | void __init at91_dt_initialize(void) | ||
| 431 | { | ||
| 432 | at91_dt_rstc(); | ||
| 433 | at91_dt_ramc(); | ||
| 434 | at91_dt_shdwc(); | ||
| 435 | |||
| 436 | /* Init clock subsystem */ | ||
| 437 | at91_dt_clock_init(); | ||
| 438 | |||
| 439 | /* Register the processor-specific clocks */ | ||
| 440 | at91_boot_soc.register_clocks(); | ||
| 441 | |||
| 442 | at91_boot_soc.init(); | ||
| 443 | } | ||
| 444 | #endif | ||
| 445 | |||
| 288 | void __init at91_initialize(unsigned long main_clock) | 446 | void __init at91_initialize(unsigned long main_clock) |
| 289 | { | 447 | { |
| 290 | at91_boot_soc.ioremap_registers(); | 448 | at91_boot_soc.ioremap_registers(); |
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index 7c756fb189f7..afeae8978a8d 100644 --- a/arch/avr32/boards/atngw100/setup.c +++ b/arch/avr32/boards/atngw100/setup.c | |||
| @@ -97,6 +97,7 @@ static struct atmel_nand_data atngw100mkii_nand_data __initdata = { | |||
| 97 | .rdy_pin = GPIO_PIN_PB(28), | 97 | .rdy_pin = GPIO_PIN_PB(28), |
| 98 | .enable_pin = GPIO_PIN_PE(23), | 98 | .enable_pin = GPIO_PIN_PE(23), |
| 99 | .bus_width_16 = true, | 99 | .bus_width_16 = true, |
| 100 | .ecc_mode = NAND_ECC_SOFT, | ||
| 100 | .parts = nand_partitions, | 101 | .parts = nand_partitions, |
| 101 | .num_parts = ARRAY_SIZE(nand_partitions), | 102 | .num_parts = ARRAY_SIZE(nand_partitions), |
| 102 | }; | 103 | }; |
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index c56ddac85d61..dc5263321480 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
| @@ -95,6 +95,7 @@ static struct atmel_nand_data atstk1006_nand_data __initdata = { | |||
| 95 | .ale = 22, | 95 | .ale = 22, |
| 96 | .rdy_pin = GPIO_PIN_PB(30), | 96 | .rdy_pin = GPIO_PIN_PB(30), |
| 97 | .enable_pin = GPIO_PIN_PB(29), | 97 | .enable_pin = GPIO_PIN_PB(29), |
| 98 | .ecc_mode = NAND_ECC_SOFT, | ||
| 98 | .parts = nand_partitions, | 99 | .parts = nand_partitions, |
| 99 | .num_parts = ARRAY_SIZE(num_partitions), | 100 | .num_parts = ARRAY_SIZE(num_partitions), |
| 100 | }; | 101 | }; |
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h index 67b111ce332d..71733866cb4f 100644 --- a/arch/avr32/mach-at32ap/include/mach/board.h +++ b/arch/avr32/mach-at32ap/include/mach/board.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
| 8 | #include <linux/serial.h> | 8 | #include <linux/serial.h> |
| 9 | #include <linux/platform_data/macb.h> | 9 | #include <linux/platform_data/macb.h> |
| 10 | #include <linux/platform_data/atmel_nand.h> | ||
| 10 | 11 | ||
| 11 | #define GPIO_PIN_NONE (-1) | 12 | #define GPIO_PIN_NONE (-1) |
| 12 | 13 | ||
| @@ -116,18 +117,6 @@ struct platform_device * | |||
| 116 | at32_add_device_cf(unsigned int id, unsigned int extint, | 117 | at32_add_device_cf(unsigned int id, unsigned int extint, |
| 117 | struct cf_platform_data *data); | 118 | struct cf_platform_data *data); |
| 118 | 119 | ||
| 119 | /* NAND / SmartMedia */ | ||
| 120 | struct atmel_nand_data { | ||
| 121 | int enable_pin; /* chip enable */ | ||
| 122 | int det_pin; /* card detect */ | ||
| 123 | int rdy_pin; /* ready/busy */ | ||
| 124 | u8 rdy_pin_active_low; /* rdy_pin value is inverted */ | ||
| 125 | u8 ale; /* address line number connected to ALE */ | ||
| 126 | u8 cle; /* address line number connected to CLE */ | ||
| 127 | u8 bus_width_16; /* buswidth is 16 bit */ | ||
| 128 | struct mtd_partition *parts; | ||
| 129 | unsigned int num_parts; | ||
| 130 | }; | ||
| 131 | struct platform_device * | 120 | struct platform_device * |
| 132 | at32_add_device_nand(unsigned int id, struct atmel_nand_data *data); | 121 | at32_add_device_nand(unsigned int id, struct atmel_nand_data *data); |
| 133 | 122 | ||
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index a651779d9ff7..c0330a41db03 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c | |||
| @@ -14,8 +14,15 @@ | |||
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
| 16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
| 17 | 17 | #include <linux/gpio.h> | |
| 18 | #include <asm/gpio.h> | 18 | #include <linux/of_gpio.h> |
| 19 | #include <linux/of_i2c.h> | ||
| 20 | |||
| 21 | struct i2c_gpio_private_data { | ||
| 22 | struct i2c_adapter adap; | ||
| 23 | struct i2c_algo_bit_data bit_data; | ||
| 24 | struct i2c_gpio_platform_data pdata; | ||
| 25 | }; | ||
| 19 | 26 | ||
| 20 | /* Toggle SDA by changing the direction of the pin */ | 27 | /* Toggle SDA by changing the direction of the pin */ |
| 21 | static void i2c_gpio_setsda_dir(void *data, int state) | 28 | static void i2c_gpio_setsda_dir(void *data, int state) |
| @@ -78,24 +85,62 @@ static int i2c_gpio_getscl(void *data) | |||
| 78 | return gpio_get_value(pdata->scl_pin); | 85 | return gpio_get_value(pdata->scl_pin); |
| 79 | } | 86 | } |
| 80 | 87 | ||
| 88 | static int __devinit of_i2c_gpio_probe(struct device_node *np, | ||
| 89 | struct i2c_gpio_platform_data *pdata) | ||
| 90 | { | ||
| 91 | u32 reg; | ||
| 92 | |||
| 93 | if (of_gpio_count(np) < 2) | ||
| 94 | return -ENODEV; | ||
| 95 | |||
| 96 | pdata->sda_pin = of_get_gpio(np, 0); | ||
| 97 | pdata->scl_pin = of_get_gpio(np, 1); | ||
| 98 | |||
| 99 | if (!gpio_is_valid(pdata->sda_pin) || !gpio_is_valid(pdata->scl_pin)) { | ||
| 100 | pr_err("%s: invalid GPIO pins, sda=%d/scl=%d\n", | ||
| 101 | np->full_name, pdata->sda_pin, pdata->scl_pin); | ||
| 102 | return -ENODEV; | ||
| 103 | } | ||
| 104 | |||
| 105 | of_property_read_u32(np, "i2c-gpio,delay-us", &pdata->udelay); | ||
| 106 | |||
| 107 | if (!of_property_read_u32(np, "i2c-gpio,timeout-ms", ®)) | ||
| 108 | pdata->timeout = msecs_to_jiffies(reg); | ||
| 109 | |||
| 110 | pdata->sda_is_open_drain = | ||
| 111 | of_property_read_bool(np, "i2c-gpio,sda-open-drain"); | ||
| 112 | pdata->scl_is_open_drain = | ||
| 113 | of_property_read_bool(np, "i2c-gpio,scl-open-drain"); | ||
| 114 | pdata->scl_is_output_only = | ||
| 115 | of_property_read_bool(np, "i2c-gpio,scl-output-only"); | ||
| 116 | |||
| 117 | return 0; | ||
| 118 | } | ||
| 119 | |||
| 81 | static int __devinit i2c_gpio_probe(struct platform_device *pdev) | 120 | static int __devinit i2c_gpio_probe(struct platform_device *pdev) |
| 82 | { | 121 | { |
| 122 | struct i2c_gpio_private_data *priv; | ||
| 83 | struct i2c_gpio_platform_data *pdata; | 123 | struct i2c_gpio_platform_data *pdata; |
| 84 | struct i2c_algo_bit_data *bit_data; | 124 | struct i2c_algo_bit_data *bit_data; |
| 85 | struct i2c_adapter *adap; | 125 | struct i2c_adapter *adap; |
| 86 | int ret; | 126 | int ret; |
| 87 | 127 | ||
| 88 | pdata = pdev->dev.platform_data; | 128 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
| 89 | if (!pdata) | 129 | if (!priv) |
| 90 | return -ENXIO; | 130 | return -ENOMEM; |
| 91 | 131 | adap = &priv->adap; | |
| 92 | ret = -ENOMEM; | 132 | bit_data = &priv->bit_data; |
| 93 | adap = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL); | 133 | pdata = &priv->pdata; |
| 94 | if (!adap) | 134 | |
| 95 | goto err_alloc_adap; | 135 | if (pdev->dev.of_node) { |
| 96 | bit_data = kzalloc(sizeof(struct i2c_algo_bit_data), GFP_KERNEL); | 136 | ret = of_i2c_gpio_probe(pdev->dev.of_node, pdata); |
| 97 | if (!bit_data) | 137 | if (ret) |
| 98 | goto err_alloc_bit_data; | 138 | return ret; |
| 139 | } else { | ||
| 140 | if (!pdev->dev.platform_data) | ||
| 141 | return -ENXIO; | ||
| 142 | memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata)); | ||
| 143 | } | ||
| 99 | 144 | ||
| 100 | ret = gpio_request(pdata->sda_pin, "sda"); | 145 | ret = gpio_request(pdata->sda_pin, "sda"); |
| 101 | if (ret) | 146 | if (ret) |
| @@ -143,6 +188,7 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev) | |||
| 143 | adap->algo_data = bit_data; | 188 | adap->algo_data = bit_data; |
| 144 | adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; | 189 | adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
| 145 | adap->dev.parent = &pdev->dev; | 190 | adap->dev.parent = &pdev->dev; |
| 191 | adap->dev.of_node = pdev->dev.of_node; | ||
| 146 | 192 | ||
| 147 | /* | 193 | /* |
| 148 | * If "dev->id" is negative we consider it as zero. | 194 | * If "dev->id" is negative we consider it as zero. |
| @@ -154,7 +200,9 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev) | |||
| 154 | if (ret) | 200 | if (ret) |
| 155 | goto err_add_bus; | 201 | goto err_add_bus; |
| 156 | 202 | ||
| 157 | platform_set_drvdata(pdev, adap); | 203 | of_i2c_register_devices(adap); |
| 204 | |||
| 205 | platform_set_drvdata(pdev, priv); | ||
| 158 | 206 | ||
| 159 | dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n", | 207 | dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n", |
| 160 | pdata->sda_pin, pdata->scl_pin, | 208 | pdata->sda_pin, pdata->scl_pin, |
| @@ -168,34 +216,40 @@ err_add_bus: | |||
| 168 | err_request_scl: | 216 | err_request_scl: |
| 169 | gpio_free(pdata->sda_pin); | 217 | gpio_free(pdata->sda_pin); |
| 170 | err_request_sda: | 218 | err_request_sda: |
| 171 | kfree(bit_data); | ||
| 172 | err_alloc_bit_data: | ||
| 173 | kfree(adap); | ||
| 174 | err_alloc_adap: | ||
| 175 | return ret; | 219 | return ret; |
| 176 | } | 220 | } |
| 177 | 221 | ||
| 178 | static int __devexit i2c_gpio_remove(struct platform_device *pdev) | 222 | static int __devexit i2c_gpio_remove(struct platform_device *pdev) |
| 179 | { | 223 | { |
| 224 | struct i2c_gpio_private_data *priv; | ||
| 180 | struct i2c_gpio_platform_data *pdata; | 225 | struct i2c_gpio_platform_data *pdata; |
| 181 | struct i2c_adapter *adap; | 226 | struct i2c_adapter *adap; |
| 182 | 227 | ||
| 183 | adap = platform_get_drvdata(pdev); | 228 | priv = platform_get_drvdata(pdev); |
| 184 | pdata = pdev->dev.platform_data; | 229 | adap = &priv->adap; |
| 230 | pdata = &priv->pdata; | ||
| 185 | 231 | ||
| 186 | i2c_del_adapter(adap); | 232 | i2c_del_adapter(adap); |
| 187 | gpio_free(pdata->scl_pin); | 233 | gpio_free(pdata->scl_pin); |
| 188 | gpio_free(pdata->sda_pin); | 234 | gpio_free(pdata->sda_pin); |
| 189 | kfree(adap->algo_data); | ||
| 190 | kfree(adap); | ||
| 191 | 235 | ||
| 192 | return 0; | 236 | return 0; |
| 193 | } | 237 | } |
| 194 | 238 | ||
| 239 | #if defined(CONFIG_OF) | ||
| 240 | static const struct of_device_id i2c_gpio_dt_ids[] = { | ||
| 241 | { .compatible = "i2c-gpio", }, | ||
| 242 | { /* sentinel */ } | ||
| 243 | }; | ||
| 244 | |||
| 245 | MODULE_DEVICE_TABLE(of, i2c_gpio_dt_ids); | ||
| 246 | #endif | ||
| 247 | |||
| 195 | static struct platform_driver i2c_gpio_driver = { | 248 | static struct platform_driver i2c_gpio_driver = { |
| 196 | .driver = { | 249 | .driver = { |
| 197 | .name = "i2c-gpio", | 250 | .name = "i2c-gpio", |
| 198 | .owner = THIS_MODULE, | 251 | .owner = THIS_MODULE, |
| 252 | .of_match_table = of_match_ptr(i2c_gpio_dt_ids), | ||
| 199 | }, | 253 | }, |
| 200 | .probe = i2c_gpio_probe, | 254 | .probe = i2c_gpio_probe, |
| 201 | .remove = __devexit_p(i2c_gpio_remove), | 255 | .remove = __devexit_p(i2c_gpio_remove), |
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 35b4fb55dbd6..ae7e37d9ac17 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
| @@ -27,6 +27,10 @@ | |||
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
| 29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
| 30 | #include <linux/of.h> | ||
| 31 | #include <linux/of_device.h> | ||
| 32 | #include <linux/of_gpio.h> | ||
| 33 | #include <linux/of_mtd.h> | ||
| 30 | #include <linux/mtd/mtd.h> | 34 | #include <linux/mtd/mtd.h> |
| 31 | #include <linux/mtd/nand.h> | 35 | #include <linux/mtd/nand.h> |
| 32 | #include <linux/mtd/partitions.h> | 36 | #include <linux/mtd/partitions.h> |
| @@ -34,22 +38,10 @@ | |||
| 34 | #include <linux/dmaengine.h> | 38 | #include <linux/dmaengine.h> |
| 35 | #include <linux/gpio.h> | 39 | #include <linux/gpio.h> |
| 36 | #include <linux/io.h> | 40 | #include <linux/io.h> |
| 41 | #include <linux/platform_data/atmel.h> | ||
| 37 | 42 | ||
| 38 | #include <mach/board.h> | ||
| 39 | #include <mach/cpu.h> | 43 | #include <mach/cpu.h> |
| 40 | 44 | ||
| 41 | #ifdef CONFIG_MTD_NAND_ATMEL_ECC_HW | ||
| 42 | #define hard_ecc 1 | ||
| 43 | #else | ||
| 44 | #define hard_ecc 0 | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #ifdef CONFIG_MTD_NAND_ATMEL_ECC_NONE | ||
| 48 | #define no_ecc 1 | ||
| 49 | #else | ||
| 50 | #define no_ecc 0 | ||
| 51 | #endif | ||
| 52 | |||
| 53 | static int use_dma = 1; | 45 | static int use_dma = 1; |
| 54 | module_param(use_dma, int, 0); | 46 | module_param(use_dma, int, 0); |
| 55 | 47 | ||
| @@ -95,7 +87,7 @@ struct atmel_nand_host { | |||
| 95 | struct mtd_info mtd; | 87 | struct mtd_info mtd; |
| 96 | void __iomem *io_base; | 88 | void __iomem *io_base; |
| 97 | dma_addr_t io_phys; | 89 | dma_addr_t io_phys; |
| 98 | struct atmel_nand_data *board; | 90 | struct atmel_nand_data board; |
| 99 | struct device *dev; | 91 | struct device *dev; |
| 100 | void __iomem *ecc; | 92 | void __iomem *ecc; |
| 101 | 93 | ||
| @@ -113,8 +105,8 @@ static int cpu_has_dma(void) | |||
| 113 | */ | 105 | */ |
| 114 | static void atmel_nand_enable(struct atmel_nand_host *host) | 106 | static void atmel_nand_enable(struct atmel_nand_host *host) |
| 115 | { | 107 | { |
| 116 | if (gpio_is_valid(host->board->enable_pin)) | 108 | if (gpio_is_valid(host->board.enable_pin)) |
| 117 | gpio_set_value(host->board->enable_pin, 0); | 109 | gpio_set_value(host->board.enable_pin, 0); |
| 118 | } | 110 | } |
| 119 | 111 | ||
| 120 | /* | 112 | /* |
| @@ -122,8 +114,8 @@ static void atmel_nand_enable(struct atmel_nand_host *host) | |||
| 122 | */ | 114 | */ |
| 123 | static void atmel_nand_disable(struct atmel_nand_host *host) | 115 | static void atmel_nand_disable(struct atmel_nand_host *host) |
| 124 | { | 116 | { |
| 125 | if (gpio_is_valid(host->board->enable_pin)) | 117 | if (gpio_is_valid(host->board.enable_pin)) |
| 126 | gpio_set_value(host->board->enable_pin, 1); | 118 | gpio_set_value(host->board.enable_pin, 1); |
| 127 | } | 119 | } |
| 128 | 120 | ||
| 129 | /* | 121 | /* |
| @@ -144,9 +136,9 @@ static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl | |||
| 144 | return; | 136 | return; |
| 145 | 137 | ||
| 146 | if (ctrl & NAND_CLE) | 138 | if (ctrl & NAND_CLE) |
| 147 | writeb(cmd, host->io_base + (1 << host->board->cle)); | 139 | writeb(cmd, host->io_base + (1 << host->board.cle)); |
| 148 | else | 140 | else |
| 149 | writeb(cmd, host->io_base + (1 << host->board->ale)); | 141 | writeb(cmd, host->io_base + (1 << host->board.ale)); |
| 150 | } | 142 | } |
| 151 | 143 | ||
| 152 | /* | 144 | /* |
| @@ -157,8 +149,8 @@ static int atmel_nand_device_ready(struct mtd_info *mtd) | |||
| 157 | struct nand_chip *nand_chip = mtd->priv; | 149 | struct nand_chip *nand_chip = mtd->priv; |
| 158 | struct atmel_nand_host *host = nand_chip->priv; | 150 | struct atmel_nand_host *host = nand_chip->priv; |
| 159 | 151 | ||
| 160 | return gpio_get_value(host->board->rdy_pin) ^ | 152 | return gpio_get_value(host->board.rdy_pin) ^ |
| 161 | !!host->board->rdy_pin_active_low; | 153 | !!host->board.rdy_pin_active_low; |
| 162 | } | 154 | } |
| 163 | 155 | ||
| 164 | /* | 156 | /* |
| @@ -273,7 +265,7 @@ static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len) | |||
| 273 | if (atmel_nand_dma_op(mtd, buf, len, 1) == 0) | 265 | if (atmel_nand_dma_op(mtd, buf, len, 1) == 0) |
| 274 | return; | 266 | return; |
| 275 | 267 | ||
| 276 | if (host->board->bus_width_16) | 268 | if (host->board.bus_width_16) |
| 277 | atmel_read_buf16(mtd, buf, len); | 269 | atmel_read_buf16(mtd, buf, len); |
| 278 | else | 270 | else |
| 279 | atmel_read_buf8(mtd, buf, len); | 271 | atmel_read_buf8(mtd, buf, len); |
| @@ -289,7 +281,7 @@ static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len) | |||
| 289 | if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0) | 281 | if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0) |
| 290 | return; | 282 | return; |
| 291 | 283 | ||
| 292 | if (host->board->bus_width_16) | 284 | if (host->board.bus_width_16) |
| 293 | atmel_write_buf16(mtd, buf, len); | 285 | atmel_write_buf16(mtd, buf, len); |
| 294 | else | 286 | else |
| 295 | atmel_write_buf8(mtd, buf, len); | 287 | atmel_write_buf8(mtd, buf, len); |
| @@ -481,6 +473,56 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode) | |||
| 481 | } | 473 | } |
| 482 | } | 474 | } |
| 483 | 475 | ||
| 476 | #if defined(CONFIG_OF) | ||
| 477 | static int __devinit atmel_of_init_port(struct atmel_nand_host *host, | ||
| 478 | struct device_node *np) | ||
| 479 | { | ||
| 480 | u32 val; | ||
| 481 | int ecc_mode; | ||
| 482 | struct atmel_nand_data *board = &host->board; | ||
| 483 | enum of_gpio_flags flags; | ||
| 484 | |||
| 485 | if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) { | ||
| 486 | if (val >= 32) { | ||
| 487 | dev_err(host->dev, "invalid addr-offset %u\n", val); | ||
| 488 | return -EINVAL; | ||
| 489 | } | ||
| 490 | board->ale = val; | ||
| 491 | } | ||
| 492 | |||
| 493 | if (of_property_read_u32(np, "atmel,nand-cmd-offset", &val) == 0) { | ||
| 494 | if (val >= 32) { | ||
| 495 | dev_err(host->dev, "invalid cmd-offset %u\n", val); | ||
| 496 | return -EINVAL; | ||
| 497 | } | ||
| 498 | board->cle = val; | ||
| 499 | } | ||
| 500 | |||
| 501 | ecc_mode = of_get_nand_ecc_mode(np); | ||
| 502 | |||
| 503 | board->ecc_mode = ecc_mode < 0 ? NAND_ECC_SOFT : ecc_mode; | ||
| 504 | |||
| 505 | board->on_flash_bbt = of_get_nand_on_flash_bbt(np); | ||
| 506 | |||
| 507 | if (of_get_nand_bus_width(np) == 16) | ||
| 508 | board->bus_width_16 = 1; | ||
| 509 | |||
| 510 | board->rdy_pin = of_get_gpio_flags(np, 0, &flags); | ||
| 511 | board->rdy_pin_active_low = (flags == OF_GPIO_ACTIVE_LOW); | ||
| 512 | |||
| 513 | board->enable_pin = of_get_gpio(np, 1); | ||
| 514 | board->det_pin = of_get_gpio(np, 2); | ||
| 515 | |||
| 516 | return 0; | ||
| 517 | } | ||
| 518 | #else | ||
| 519 | static int __devinit atmel_of_init_port(struct atmel_nand_host *host, | ||
| 520 | struct device_node *np) | ||
| 521 | { | ||
| 522 | return -EINVAL; | ||
| 523 | } | ||
| 524 | #endif | ||
| 525 | |||
| 484 | /* | 526 | /* |
| 485 | * Probe for the NAND device. | 527 | * Probe for the NAND device. |
| 486 | */ | 528 | */ |
| @@ -491,6 +533,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
| 491 | struct nand_chip *nand_chip; | 533 | struct nand_chip *nand_chip; |
| 492 | struct resource *regs; | 534 | struct resource *regs; |
| 493 | struct resource *mem; | 535 | struct resource *mem; |
| 536 | struct mtd_part_parser_data ppdata = {}; | ||
| 494 | int res; | 537 | int res; |
| 495 | 538 | ||
| 496 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 539 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| @@ -517,8 +560,15 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
| 517 | 560 | ||
| 518 | mtd = &host->mtd; | 561 | mtd = &host->mtd; |
| 519 | nand_chip = &host->nand_chip; | 562 | nand_chip = &host->nand_chip; |
| 520 | host->board = pdev->dev.platform_data; | ||
| 521 | host->dev = &pdev->dev; | 563 | host->dev = &pdev->dev; |
| 564 | if (pdev->dev.of_node) { | ||
| 565 | res = atmel_of_init_port(host, pdev->dev.of_node); | ||
| 566 | if (res) | ||
| 567 | goto err_nand_ioremap; | ||
| 568 | } else { | ||
| 569 | memcpy(&host->board, pdev->dev.platform_data, | ||
| 570 | sizeof(struct atmel_nand_data)); | ||
| 571 | } | ||
| 522 | 572 | ||
| 523 | nand_chip->priv = host; /* link the private data structures */ | 573 | nand_chip->priv = host; /* link the private data structures */ |
| 524 | mtd->priv = nand_chip; | 574 | mtd->priv = nand_chip; |
| @@ -529,26 +579,25 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
| 529 | nand_chip->IO_ADDR_W = host->io_base; | 579 | nand_chip->IO_ADDR_W = host->io_base; |
| 530 | nand_chip->cmd_ctrl = atmel_nand_cmd_ctrl; | 580 | nand_chip->cmd_ctrl = atmel_nand_cmd_ctrl; |
| 531 | 581 | ||
| 532 | if (gpio_is_valid(host->board->rdy_pin)) | 582 | if (gpio_is_valid(host->board.rdy_pin)) |
| 533 | nand_chip->dev_ready = atmel_nand_device_ready; | 583 | nand_chip->dev_ready = atmel_nand_device_ready; |
| 534 | 584 | ||
| 585 | nand_chip->ecc.mode = host->board.ecc_mode; | ||
| 586 | |||
| 535 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 587 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
| 536 | if (!regs && hard_ecc) { | 588 | if (!regs && nand_chip->ecc.mode == NAND_ECC_HW) { |
| 537 | printk(KERN_ERR "atmel_nand: can't get I/O resource " | 589 | printk(KERN_ERR "atmel_nand: can't get I/O resource " |
| 538 | "regs\nFalling back on software ECC\n"); | 590 | "regs\nFalling back on software ECC\n"); |
| 591 | nand_chip->ecc.mode = NAND_ECC_SOFT; | ||
| 539 | } | 592 | } |
| 540 | 593 | ||
| 541 | nand_chip->ecc.mode = NAND_ECC_SOFT; /* enable ECC */ | 594 | if (nand_chip->ecc.mode == NAND_ECC_HW) { |
| 542 | if (no_ecc) | ||
| 543 | nand_chip->ecc.mode = NAND_ECC_NONE; | ||
| 544 | if (hard_ecc && regs) { | ||
| 545 | host->ecc = ioremap(regs->start, resource_size(regs)); | 595 | host->ecc = ioremap(regs->start, resource_size(regs)); |
| 546 | if (host->ecc == NULL) { | 596 | if (host->ecc == NULL) { |
| 547 | printk(KERN_ERR "atmel_nand: ioremap failed\n"); | 597 | printk(KERN_ERR "atmel_nand: ioremap failed\n"); |
| 548 | res = -EIO; | 598 | res = -EIO; |
| 549 | goto err_ecc_ioremap; | 599 | goto err_ecc_ioremap; |
| 550 | } | 600 | } |
| 551 | nand_chip->ecc.mode = NAND_ECC_HW; | ||
| 552 | nand_chip->ecc.calculate = atmel_nand_calculate; | 601 | nand_chip->ecc.calculate = atmel_nand_calculate; |
| 553 | nand_chip->ecc.correct = atmel_nand_correct; | 602 | nand_chip->ecc.correct = atmel_nand_correct; |
| 554 | nand_chip->ecc.hwctl = atmel_nand_hwctl; | 603 | nand_chip->ecc.hwctl = atmel_nand_hwctl; |
| @@ -558,7 +607,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
| 558 | 607 | ||
| 559 | nand_chip->chip_delay = 20; /* 20us command delay time */ | 608 | nand_chip->chip_delay = 20; /* 20us command delay time */ |
| 560 | 609 | ||
| 561 | if (host->board->bus_width_16) /* 16-bit bus width */ | 610 | if (host->board.bus_width_16) /* 16-bit bus width */ |
| 562 | nand_chip->options |= NAND_BUSWIDTH_16; | 611 | nand_chip->options |= NAND_BUSWIDTH_16; |
| 563 | 612 | ||
| 564 | nand_chip->read_buf = atmel_read_buf; | 613 | nand_chip->read_buf = atmel_read_buf; |
| @@ -567,15 +616,15 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
| 567 | platform_set_drvdata(pdev, host); | 616 | platform_set_drvdata(pdev, host); |
| 568 | atmel_nand_enable(host); | 617 | atmel_nand_enable(host); |
| 569 | 618 | ||
| 570 | if (gpio_is_valid(host->board->det_pin)) { | 619 | if (gpio_is_valid(host->board.det_pin)) { |
| 571 | if (gpio_get_value(host->board->det_pin)) { | 620 | if (gpio_get_value(host->board.det_pin)) { |
| 572 | printk(KERN_INFO "No SmartMedia card inserted.\n"); | 621 | printk(KERN_INFO "No SmartMedia card inserted.\n"); |
| 573 | res = -ENXIO; | 622 | res = -ENXIO; |
| 574 | goto err_no_card; | 623 | goto err_no_card; |
| 575 | } | 624 | } |
| 576 | } | 625 | } |
| 577 | 626 | ||
| 578 | if (on_flash_bbt) { | 627 | if (host->board.on_flash_bbt || on_flash_bbt) { |
| 579 | printk(KERN_INFO "atmel_nand: Use On Flash BBT\n"); | 628 | printk(KERN_INFO "atmel_nand: Use On Flash BBT\n"); |
| 580 | nand_chip->bbt_options |= NAND_BBT_USE_FLASH; | 629 | nand_chip->bbt_options |= NAND_BBT_USE_FLASH; |
| 581 | } | 630 | } |
| @@ -650,8 +699,9 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
| 650 | } | 699 | } |
| 651 | 700 | ||
| 652 | mtd->name = "atmel_nand"; | 701 | mtd->name = "atmel_nand"; |
| 653 | res = mtd_device_parse_register(mtd, NULL, 0, | 702 | ppdata.of_node = pdev->dev.of_node; |
| 654 | host->board->parts, host->board->num_parts); | 703 | res = mtd_device_parse_register(mtd, NULL, &ppdata, |
| 704 | host->board.parts, host->board.num_parts); | ||
| 655 | if (!res) | 705 | if (!res) |
| 656 | return res; | 706 | return res; |
| 657 | 707 | ||
| @@ -695,11 +745,21 @@ static int __exit atmel_nand_remove(struct platform_device *pdev) | |||
| 695 | return 0; | 745 | return 0; |
| 696 | } | 746 | } |
| 697 | 747 | ||
| 748 | #if defined(CONFIG_OF) | ||
| 749 | static const struct of_device_id atmel_nand_dt_ids[] = { | ||
| 750 | { .compatible = "atmel,at91rm9200-nand" }, | ||
| 751 | { /* sentinel */ } | ||
| 752 | }; | ||
| 753 | |||
| 754 | MODULE_DEVICE_TABLE(of, atmel_nand_dt_ids); | ||
| 755 | #endif | ||
| 756 | |||
| 698 | static struct platform_driver atmel_nand_driver = { | 757 | static struct platform_driver atmel_nand_driver = { |
| 699 | .remove = __exit_p(atmel_nand_remove), | 758 | .remove = __exit_p(atmel_nand_remove), |
| 700 | .driver = { | 759 | .driver = { |
| 701 | .name = "atmel_nand", | 760 | .name = "atmel_nand", |
| 702 | .owner = THIS_MODULE, | 761 | .owner = THIS_MODULE, |
| 762 | .of_match_table = of_match_ptr(atmel_nand_dt_ids), | ||
| 703 | }, | 763 | }, |
| 704 | }; | 764 | }; |
| 705 | 765 | ||
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 268163dd71c7..fa666a93540c 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig | |||
| @@ -90,4 +90,8 @@ config OF_PCI_IRQ | |||
| 90 | help | 90 | help |
| 91 | OpenFirmware PCI IRQ routing helpers | 91 | OpenFirmware PCI IRQ routing helpers |
| 92 | 92 | ||
| 93 | config OF_MTD | ||
| 94 | depends on MTD | ||
| 95 | def_bool y | ||
| 96 | |||
| 93 | endmenu # OF | 97 | endmenu # OF |
diff --git a/drivers/of/Makefile b/drivers/of/Makefile index a73f5a51ff4c..aa90e602c8a7 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile | |||
| @@ -12,3 +12,4 @@ obj-$(CONFIG_OF_SELFTEST) += selftest.o | |||
| 12 | obj-$(CONFIG_OF_MDIO) += of_mdio.o | 12 | obj-$(CONFIG_OF_MDIO) += of_mdio.o |
| 13 | obj-$(CONFIG_OF_PCI) += of_pci.o | 13 | obj-$(CONFIG_OF_PCI) += of_pci.o |
| 14 | obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o | 14 | obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o |
| 15 | obj-$(CONFIG_OF_MTD) += of_mtd.o | ||
diff --git a/drivers/of/of_mtd.c b/drivers/of/of_mtd.c new file mode 100644 index 000000000000..e7cad627a5d1 --- /dev/null +++ b/drivers/of/of_mtd.c | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | ||
| 3 | * | ||
| 4 | * OF helpers for mtd. | ||
| 5 | * | ||
| 6 | * This file is released under the GPLv2 | ||
| 7 | * | ||
| 8 | */ | ||
| 9 | #include <linux/kernel.h> | ||
| 10 | #include <linux/of_mtd.h> | ||
| 11 | #include <linux/mtd/nand.h> | ||
| 12 | #include <linux/export.h> | ||
| 13 | |||
| 14 | /** | ||
| 15 | * It maps 'enum nand_ecc_modes_t' found in include/linux/mtd/nand.h | ||
| 16 | * into the device tree binding of 'nand-ecc', so that MTD | ||
| 17 | * device driver can get nand ecc from device tree. | ||
| 18 | */ | ||
| 19 | static const char *nand_ecc_modes[] = { | ||
| 20 | [NAND_ECC_NONE] = "none", | ||
| 21 | [NAND_ECC_SOFT] = "soft", | ||
| 22 | [NAND_ECC_HW] = "hw", | ||
| 23 | [NAND_ECC_HW_SYNDROME] = "hw_syndrome", | ||
| 24 | [NAND_ECC_HW_OOB_FIRST] = "hw_oob_first", | ||
| 25 | [NAND_ECC_SOFT_BCH] = "soft_bch", | ||
| 26 | }; | ||
| 27 | |||
| 28 | /** | ||
| 29 | * of_get_nand_ecc_mode - Get nand ecc mode for given device_node | ||
| 30 | * @np: Pointer to the given device_node | ||
| 31 | * | ||
| 32 | * The function gets ecc mode string from property 'nand-ecc-mode', | ||
| 33 | * and return its index in nand_ecc_modes table, or errno in error case. | ||
| 34 | */ | ||
| 35 | const int of_get_nand_ecc_mode(struct device_node *np) | ||
| 36 | { | ||
| 37 | const char *pm; | ||
| 38 | int err, i; | ||
| 39 | |||
| 40 | err = of_property_read_string(np, "nand-ecc-mode", &pm); | ||
| 41 | if (err < 0) | ||
| 42 | return err; | ||
| 43 | |||
| 44 | for (i = 0; i < ARRAY_SIZE(nand_ecc_modes); i++) | ||
| 45 | if (!strcasecmp(pm, nand_ecc_modes[i])) | ||
| 46 | return i; | ||
| 47 | |||
| 48 | return -ENODEV; | ||
| 49 | } | ||
| 50 | EXPORT_SYMBOL_GPL(of_get_nand_ecc_mode); | ||
| 51 | |||
| 52 | /** | ||
| 53 | * of_get_nand_bus_width - Get nand bus witdh for given device_node | ||
| 54 | * @np: Pointer to the given device_node | ||
| 55 | * | ||
| 56 | * return bus width option, or errno in error case. | ||
| 57 | */ | ||
| 58 | int of_get_nand_bus_width(struct device_node *np) | ||
| 59 | { | ||
| 60 | u32 val; | ||
| 61 | |||
| 62 | if (of_property_read_u32(np, "nand-bus-width", &val)) | ||
| 63 | return 8; | ||
| 64 | |||
| 65 | switch(val) { | ||
| 66 | case 8: | ||
| 67 | case 16: | ||
| 68 | return val; | ||
| 69 | default: | ||
| 70 | return -EIO; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | EXPORT_SYMBOL_GPL(of_get_nand_bus_width); | ||
| 74 | |||
| 75 | /** | ||
| 76 | * of_get_nand_on_flash_bbt - Get nand on flash bbt for given device_node | ||
| 77 | * @np: Pointer to the given device_node | ||
| 78 | * | ||
| 79 | * return true if present false other wise | ||
| 80 | */ | ||
| 81 | bool of_get_nand_on_flash_bbt(struct device_node *np) | ||
| 82 | { | ||
| 83 | return of_property_read_bool(np, "nand-on-flash-bbt"); | ||
| 84 | } | ||
| 85 | EXPORT_SYMBOL_GPL(of_get_nand_on_flash_bbt); | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 75823a1abeb6..7fe4902d9e51 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
| @@ -65,7 +65,7 @@ config USB_ARCH_HAS_EHCI | |||
| 65 | default y if PPC_MPC512x | 65 | default y if PPC_MPC512x |
| 66 | default y if ARCH_IXP4XX | 66 | default y if ARCH_IXP4XX |
| 67 | default y if ARCH_W90X900 | 67 | default y if ARCH_W90X900 |
| 68 | default y if ARCH_AT91SAM9G45 | 68 | default y if ARCH_AT91 |
| 69 | default y if ARCH_MXC | 69 | default y if ARCH_MXC |
| 70 | default y if ARCH_OMAP3 | 70 | default y if ARCH_OMAP3 |
| 71 | default y if ARCH_CNS3XXX | 71 | default y if ARCH_CNS3XXX |
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index a5a3ef1f0096..19f318ababa2 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
| 15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/of_platform.h> | ||
| 16 | 17 | ||
| 17 | /* interface and function clocks */ | 18 | /* interface and function clocks */ |
| 18 | static struct clk *iclk, *fclk; | 19 | static struct clk *iclk, *fclk; |
| @@ -115,6 +116,8 @@ static const struct hc_driver ehci_atmel_hc_driver = { | |||
| 115 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 116 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
| 116 | }; | 117 | }; |
| 117 | 118 | ||
| 119 | static u64 at91_ehci_dma_mask = DMA_BIT_MASK(32); | ||
| 120 | |||
| 118 | static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev) | 121 | static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev) |
| 119 | { | 122 | { |
| 120 | struct usb_hcd *hcd; | 123 | struct usb_hcd *hcd; |
| @@ -137,6 +140,13 @@ static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev) | |||
| 137 | goto fail_create_hcd; | 140 | goto fail_create_hcd; |
| 138 | } | 141 | } |
| 139 | 142 | ||
| 143 | /* Right now device-tree probed devices don't get dma_mask set. | ||
| 144 | * Since shared usb code relies on it, set it here for now. | ||
| 145 | * Once we have dma capability bindings this can go away. | ||
| 146 | */ | ||
| 147 | if (!pdev->dev.dma_mask) | ||
| 148 | pdev->dev.dma_mask = &at91_ehci_dma_mask; | ||
| 149 | |||
| 140 | hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); | 150 | hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); |
| 141 | if (!hcd) { | 151 | if (!hcd) { |
| 142 | retval = -ENOMEM; | 152 | retval = -ENOMEM; |
| @@ -225,9 +235,21 @@ static int __devexit ehci_atmel_drv_remove(struct platform_device *pdev) | |||
| 225 | return 0; | 235 | return 0; |
| 226 | } | 236 | } |
| 227 | 237 | ||
| 238 | #ifdef CONFIG_OF | ||
| 239 | static const struct of_device_id atmel_ehci_dt_ids[] = { | ||
| 240 | { .compatible = "atmel,at91sam9g45-ehci" }, | ||
| 241 | { /* sentinel */ } | ||
| 242 | }; | ||
| 243 | |||
| 244 | MODULE_DEVICE_TABLE(of, atmel_ehci_dt_ids); | ||
| 245 | #endif | ||
| 246 | |||
| 228 | static struct platform_driver ehci_atmel_driver = { | 247 | static struct platform_driver ehci_atmel_driver = { |
| 229 | .probe = ehci_atmel_drv_probe, | 248 | .probe = ehci_atmel_drv_probe, |
| 230 | .remove = __devexit_p(ehci_atmel_drv_remove), | 249 | .remove = __devexit_p(ehci_atmel_drv_remove), |
| 231 | .shutdown = usb_hcd_platform_shutdown, | 250 | .shutdown = usb_hcd_platform_shutdown, |
| 232 | .driver.name = "atmel-ehci", | 251 | .driver = { |
| 252 | .name = "atmel-ehci", | ||
| 253 | .of_match_table = of_match_ptr(atmel_ehci_dt_ids), | ||
| 254 | }, | ||
| 233 | }; | 255 | }; |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 8e855eb0bf89..db8963f5fbce 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | 14 | ||
| 15 | #include <linux/clk.h> | 15 | #include <linux/clk.h> |
| 16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/of_platform.h> | ||
| 18 | #include <linux/of_gpio.h> | ||
| 17 | 19 | ||
| 18 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
| 19 | #include <asm/gpio.h> | 21 | #include <asm/gpio.h> |
| @@ -477,13 +479,109 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data) | |||
| 477 | return IRQ_HANDLED; | 479 | return IRQ_HANDLED; |
| 478 | } | 480 | } |
| 479 | 481 | ||
| 482 | #ifdef CONFIG_OF | ||
| 483 | static const struct of_device_id at91_ohci_dt_ids[] = { | ||
| 484 | { .compatible = "atmel,at91rm9200-ohci" }, | ||
| 485 | { /* sentinel */ } | ||
| 486 | }; | ||
| 487 | |||
| 488 | MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids); | ||
| 489 | |||
| 490 | static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32); | ||
| 491 | |||
| 492 | static int __devinit ohci_at91_of_init(struct platform_device *pdev) | ||
| 493 | { | ||
| 494 | struct device_node *np = pdev->dev.of_node; | ||
| 495 | int i, ret, gpio; | ||
| 496 | enum of_gpio_flags flags; | ||
| 497 | struct at91_usbh_data *pdata; | ||
| 498 | u32 ports; | ||
| 499 | |||
| 500 | if (!np) | ||
| 501 | return 0; | ||
| 502 | |||
| 503 | /* Right now device-tree probed devices don't get dma_mask set. | ||
| 504 | * Since shared usb code relies on it, set it here for now. | ||
| 505 | * Once we have dma capability bindings this can go away. | ||
| 506 | */ | ||
| 507 | if (!pdev->dev.dma_mask) | ||
| 508 | pdev->dev.dma_mask = &at91_ohci_dma_mask; | ||
| 509 | |||
| 510 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
| 511 | if (!pdata) | ||
| 512 | return -ENOMEM; | ||
| 513 | |||
| 514 | if (!of_property_read_u32(np, "num-ports", &ports)) | ||
| 515 | pdata->ports = ports; | ||
| 516 | |||
| 517 | for (i = 0; i < 2; i++) { | ||
| 518 | gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags); | ||
| 519 | pdata->vbus_pin[i] = gpio; | ||
| 520 | if (!gpio_is_valid(gpio)) | ||
| 521 | continue; | ||
| 522 | pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW; | ||
| 523 | ret = gpio_request(gpio, "ohci_vbus"); | ||
| 524 | if (ret) { | ||
| 525 | dev_warn(&pdev->dev, "can't request vbus gpio %d", gpio); | ||
| 526 | continue; | ||
| 527 | } | ||
| 528 | ret = gpio_direction_output(gpio, !(flags & OF_GPIO_ACTIVE_LOW) ^ 1); | ||
| 529 | if (ret) | ||
| 530 | dev_warn(&pdev->dev, "can't put vbus gpio %d as output %d", | ||
| 531 | !(flags & OF_GPIO_ACTIVE_LOW) ^ 1, gpio); | ||
| 532 | } | ||
| 533 | |||
| 534 | for (i = 0; i < 2; i++) { | ||
| 535 | gpio = of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags); | ||
| 536 | pdata->overcurrent_pin[i] = gpio; | ||
| 537 | if (!gpio_is_valid(gpio)) | ||
| 538 | continue; | ||
| 539 | ret = gpio_request(gpio, "ohci_overcurrent"); | ||
| 540 | if (ret) { | ||
| 541 | dev_err(&pdev->dev, "can't request overcurrent gpio %d", gpio); | ||
| 542 | continue; | ||
| 543 | } | ||
| 544 | |||
| 545 | ret = gpio_direction_input(gpio); | ||
| 546 | if (ret) { | ||
| 547 | dev_err(&pdev->dev, "can't configure overcurrent gpio %d as input", gpio); | ||
| 548 | continue; | ||
| 549 | } | ||
| 550 | |||
| 551 | ret = request_irq(gpio_to_irq(gpio), | ||
| 552 | ohci_hcd_at91_overcurrent_irq, | ||
| 553 | IRQF_SHARED, "ohci_overcurrent", pdev); | ||
| 554 | if (ret) { | ||
| 555 | gpio_free(gpio); | ||
| 556 | dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n"); | ||
| 557 | } | ||
| 558 | } | ||
| 559 | |||
| 560 | pdev->dev.platform_data = pdata; | ||
| 561 | |||
| 562 | return 0; | ||
| 563 | } | ||
| 564 | #else | ||
| 565 | static int __devinit ohci_at91_of_init(struct platform_device *pdev) | ||
| 566 | { | ||
| 567 | return 0; | ||
| 568 | } | ||
| 569 | #endif | ||
| 570 | |||
| 480 | /*-------------------------------------------------------------------------*/ | 571 | /*-------------------------------------------------------------------------*/ |
| 481 | 572 | ||
| 482 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | 573 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
| 483 | { | 574 | { |
| 484 | struct at91_usbh_data *pdata = pdev->dev.platform_data; | 575 | struct at91_usbh_data *pdata; |
| 485 | int i; | 576 | int i; |
| 486 | 577 | ||
| 578 | i = ohci_at91_of_init(pdev); | ||
| 579 | |||
| 580 | if (i) | ||
| 581 | return i; | ||
| 582 | |||
| 583 | pdata = pdev->dev.platform_data; | ||
| 584 | |||
| 487 | if (pdata) { | 585 | if (pdata) { |
| 488 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { | 586 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { |
| 489 | if (!gpio_is_valid(pdata->vbus_pin[i])) | 587 | if (!gpio_is_valid(pdata->vbus_pin[i])) |
| @@ -596,5 +694,6 @@ static struct platform_driver ohci_hcd_at91_driver = { | |||
| 596 | .driver = { | 694 | .driver = { |
| 597 | .name = "at91_ohci", | 695 | .name = "at91_ohci", |
| 598 | .owner = THIS_MODULE, | 696 | .owner = THIS_MODULE, |
| 697 | .of_match_table = of_match_ptr(at91_ohci_dt_ids), | ||
| 599 | }, | 698 | }, |
| 600 | }; | 699 | }; |
diff --git a/include/linux/of.h b/include/linux/of.h index a75a831e2057..50059cf63135 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -342,6 +342,22 @@ static inline int of_machine_is_compatible(const char *compat) | |||
| 342 | #define of_match_node(_matches, _node) NULL | 342 | #define of_match_node(_matches, _node) NULL |
| 343 | #endif /* CONFIG_OF */ | 343 | #endif /* CONFIG_OF */ |
| 344 | 344 | ||
| 345 | /** | ||
| 346 | * of_property_read_bool - Findfrom a property | ||
| 347 | * @np: device node from which the property value is to be read. | ||
| 348 | * @propname: name of the property to be searched. | ||
| 349 | * | ||
| 350 | * Search for a property in a device node. | ||
| 351 | * Returns true if the property exist false otherwise. | ||
| 352 | */ | ||
| 353 | static inline bool of_property_read_bool(const struct device_node *np, | ||
| 354 | const char *propname) | ||
| 355 | { | ||
| 356 | struct property *prop = of_find_property(np, propname, NULL); | ||
| 357 | |||
| 358 | return prop ? true : false; | ||
| 359 | } | ||
| 360 | |||
| 345 | static inline int of_property_read_u32(const struct device_node *np, | 361 | static inline int of_property_read_u32(const struct device_node *np, |
| 346 | const char *propname, | 362 | const char *propname, |
| 347 | u32 *out_value) | 363 | u32 *out_value) |
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h new file mode 100644 index 000000000000..bae1b6094c63 --- /dev/null +++ b/include/linux/of_mtd.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | ||
| 3 | * | ||
| 4 | * OF helpers for mtd. | ||
| 5 | * | ||
| 6 | * This file is released under the GPLv2 | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __LINUX_OF_MTD_H | ||
| 10 | #define __LINUX_OF_NET_H | ||
| 11 | |||
| 12 | #ifdef CONFIG_OF_MTD | ||
| 13 | #include <linux/of.h> | ||
| 14 | extern const int of_get_nand_ecc_mode(struct device_node *np); | ||
| 15 | int of_get_nand_bus_width(struct device_node *np); | ||
| 16 | bool of_get_nand_on_flash_bbt(struct device_node *np); | ||
| 17 | #endif | ||
| 18 | |||
| 19 | #endif /* __LINUX_OF_MTD_H */ | ||
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h new file mode 100644 index 000000000000..d056263545b1 --- /dev/null +++ b/include/linux/platform_data/atmel.h | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | /* | ||
| 2 | * atmel platform data | ||
| 3 | * | ||
| 4 | * GPL v2 Only | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef __ATMEL_NAND_H__ | ||
| 8 | #define __ATMEL_NAND_H__ | ||
| 9 | |||
| 10 | #include <linux/mtd/nand.h> | ||
| 11 | |||
| 12 | /* NAND / SmartMedia */ | ||
| 13 | struct atmel_nand_data { | ||
| 14 | int enable_pin; /* chip enable */ | ||
| 15 | int det_pin; /* card detect */ | ||
| 16 | int rdy_pin; /* ready/busy */ | ||
| 17 | u8 rdy_pin_active_low; /* rdy_pin value is inverted */ | ||
| 18 | u8 ale; /* address line number connected to ALE */ | ||
| 19 | u8 cle; /* address line number connected to CLE */ | ||
| 20 | u8 bus_width_16; /* buswidth is 16 bit */ | ||
| 21 | u8 ecc_mode; /* ecc mode */ | ||
| 22 | u8 on_flash_bbt; /* bbt on flash */ | ||
| 23 | struct mtd_partition *parts; | ||
| 24 | unsigned int num_parts; | ||
| 25 | }; | ||
| 26 | |||
| 27 | #endif /* __ATMEL_NAND_H__ */ | ||
