diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 15:34:33 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 15:34:33 -0400 |
| commit | 09893ee84591b0417a9186a7e7cf1503ccf99ac2 (patch) | |
| tree | da8b044ad157b82203df04ae48cb60f4737cc390 /drivers | |
| parent | 4bb2d1009f671815870e8f78e826e4f9071392a7 (diff) | |
| parent | 7d1206bc2859c6e9f46e35ae697c138e7d7858a7 (diff) | |
Merge tag 'dt2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull "ARM: More device tree support updates" from Olof Johansson:
"This branch contains a number of updates for device tree support on
several ARM platforms, in particular:
* AT91 continues the device tree conversion adding support for a
number of on-chip drivers and other functionality
* ux500 adds probing of some of the core SoC blocks through device
tree
* Initial device tree support for ST SPEAr600 platforms
* kirkwood continues the conversion to device-tree probing"
Manually merge arch/arm/mach-ux500/Kconfig due to MACH_U8500 rename, and
drivers/usb/gadget/at91_udc.c due to header file include cleanups.
Also do an "evil merge" for the MACH_U8500 config option rename that the
affected RMI4 touchscreen driver in staging. It's called MACH_MOP500
now, and it was missed during previous merges.
* tag 'dt2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (48 commits)
ARM: SPEAr600: Add device-tree support to SPEAr600 boards
ARM: ux500: Provide local timer support for Device Tree
ARM: ux500: Enable PL022 SSP Controller in Device Tree
ARM: ux500: Enable PL310 Level 2 Cache Controller in Device Tree
ARM: ux500: Enable PL011 AMBA UART Controller for Device Tree
ARM: ux500: Enable Cortex-A9 GIC (Generic Interrupt Controller) in Device Tree
ARM: ux500: db8500: list most devices in the snowball device tree
ARM: ux500: split dts file for snowball into generic part
ARM: ux500: combine the board init functions for DT boot
ARM: ux500: Initial Device Tree support for Snowball
ARM: ux500: CONFIG: Enable Device Tree support for future endeavours
ARM: kirkwood: use devicetree for rtc-mv
ARM: kirkwood: rtc-mv devicetree bindings
ARM: kirkwood: fdt: define uart[01] as disabled, enable uart0
ARM: kirkwood: fdt: facilitate new boards during fdt migration
ARM: kirkwood: fdt: absorb kirkwood_init()
ARM: kirkwood: fdt: use mrvl ticker symbol
ARM: orion: wdt: use resource vice direct access
ARM: Kirkwood: Remove tclk from kirkwood_asoc_platform_data.
ARM: orion: spi: remove enable_clock_fix which is not used
...
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/i2c/busses/i2c-gpio.c | 98 | ||||
| -rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 136 | ||||
| -rw-r--r-- | drivers/of/Kconfig | 4 | ||||
| -rw-r--r-- | drivers/of/Makefile | 1 | ||||
| -rw-r--r-- | drivers/of/of_mtd.c | 85 | ||||
| -rw-r--r-- | drivers/rtc/rtc-mv.c | 9 | ||||
| -rw-r--r-- | drivers/spi/spi-orion.c | 5 | ||||
| -rw-r--r-- | drivers/staging/ste_rmi4/Makefile | 2 | ||||
| -rw-r--r-- | drivers/usb/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/usb/gadget/at91_udc.c | 40 | ||||
| -rw-r--r-- | drivers/usb/host/ehci-atmel.c | 24 | ||||
| -rw-r--r-- | drivers/usb/host/ohci-at91.c | 101 | ||||
| -rw-r--r-- | drivers/watchdog/orion_wdt.c | 24 |
14 files changed, 452 insertions, 81 deletions
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 6ea51dcbc728..8e84ce9765a9 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig | |||
| @@ -91,4 +91,8 @@ config OF_PCI_IRQ | |||
| 91 | help | 91 | help |
| 92 | OpenFirmware PCI IRQ routing helpers | 92 | OpenFirmware PCI IRQ routing helpers |
| 93 | 93 | ||
| 94 | config OF_MTD | ||
| 95 | depends on MTD | ||
| 96 | def_bool y | ||
| 97 | |||
| 94 | endmenu # OF | 98 | 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/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index 1300962486d1..b2185f4255aa 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/bcd.h> | 12 | #include <linux/bcd.h> |
| 13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
| 14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/of.h> | ||
| 15 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
| 16 | #include <linux/gfp.h> | 17 | #include <linux/gfp.h> |
| 17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| @@ -294,11 +295,19 @@ static int __exit mv_rtc_remove(struct platform_device *pdev) | |||
| 294 | return 0; | 295 | return 0; |
| 295 | } | 296 | } |
| 296 | 297 | ||
| 298 | #ifdef CONFIG_OF | ||
| 299 | static struct of_device_id rtc_mv_of_match_table[] = { | ||
| 300 | { .compatible = "mrvl,orion-rtc", }, | ||
| 301 | {} | ||
| 302 | }; | ||
| 303 | #endif | ||
| 304 | |||
| 297 | static struct platform_driver mv_rtc_driver = { | 305 | static struct platform_driver mv_rtc_driver = { |
| 298 | .remove = __exit_p(mv_rtc_remove), | 306 | .remove = __exit_p(mv_rtc_remove), |
| 299 | .driver = { | 307 | .driver = { |
| 300 | .name = "rtc-mv", | 308 | .name = "rtc-mv", |
| 301 | .owner = THIS_MODULE, | 309 | .owner = THIS_MODULE, |
| 310 | .of_match_table = of_match_ptr(rtc_mv_of_match_table), | ||
| 302 | }, | 311 | }, |
| 303 | }; | 312 | }; |
| 304 | 313 | ||
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 13448c832c44..e496f799b7a9 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c | |||
| @@ -359,11 +359,6 @@ static int orion_spi_setup(struct spi_device *spi) | |||
| 359 | 359 | ||
| 360 | orion_spi = spi_master_get_devdata(spi->master); | 360 | orion_spi = spi_master_get_devdata(spi->master); |
| 361 | 361 | ||
| 362 | /* Fix ac timing if required. */ | ||
| 363 | if (orion_spi->spi_info->enable_clock_fix) | ||
| 364 | orion_spi_setbits(orion_spi, ORION_SPI_IF_CONFIG_REG, | ||
| 365 | (1 << 14)); | ||
| 366 | |||
| 367 | if ((spi->max_speed_hz == 0) | 362 | if ((spi->max_speed_hz == 0) |
| 368 | || (spi->max_speed_hz > orion_spi->max_speed)) | 363 | || (spi->max_speed_hz > orion_spi->max_speed)) |
| 369 | spi->max_speed_hz = orion_spi->max_speed; | 364 | spi->max_speed_hz = orion_spi->max_speed; |
diff --git a/drivers/staging/ste_rmi4/Makefile b/drivers/staging/ste_rmi4/Makefile index 176f46900571..e4c03351420f 100644 --- a/drivers/staging/ste_rmi4/Makefile +++ b/drivers/staging/ste_rmi4/Makefile | |||
| @@ -2,4 +2,4 @@ | |||
| 2 | # Makefile for the RMI4 touchscreen driver. | 2 | # Makefile for the RMI4 touchscreen driver. |
| 3 | # | 3 | # |
| 4 | obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += synaptics_i2c_rmi4.o | 4 | obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += synaptics_i2c_rmi4.o |
| 5 | obj-$(CONFIG_MACH_U8500) += board-mop500-u8500uib-rmi4.o | 5 | obj-$(CONFIG_MACH_MOP500) += board-mop500-u8500uib-rmi4.o |
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 48ac6e781ba2..cbd8f5f80596 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
| @@ -44,7 +44,7 @@ config USB_ARCH_HAS_EHCI | |||
| 44 | default y if PPC_MPC512x | 44 | default y if PPC_MPC512x |
| 45 | default y if ARCH_IXP4XX | 45 | default y if ARCH_IXP4XX |
| 46 | default y if ARCH_W90X900 | 46 | default y if ARCH_W90X900 |
| 47 | default y if ARCH_AT91SAM9G45 | 47 | default y if ARCH_AT91 |
| 48 | default y if ARCH_MXC | 48 | default y if ARCH_MXC |
| 49 | default y if ARCH_OMAP3 | 49 | default y if ARCH_OMAP3 |
| 50 | default y if ARCH_CNS3XXX | 50 | default y if ARCH_CNS3XXX |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 26c0b75f152e..2633f7595116 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
| @@ -137,7 +137,7 @@ choice | |||
| 137 | 137 | ||
| 138 | config USB_AT91 | 138 | config USB_AT91 |
| 139 | tristate "Atmel AT91 USB Device Port" | 139 | tristate "Atmel AT91 USB Device Port" |
| 140 | depends on ARCH_AT91 && !ARCH_AT91SAM9RL && !ARCH_AT91SAM9G45 | 140 | depends on ARCH_AT91 |
| 141 | help | 141 | help |
| 142 | Many Atmel AT91 processors (such as the AT91RM2000) have a | 142 | Many Atmel AT91 processors (such as the AT91RM2000) have a |
| 143 | full speed USB Device Port with support for five configurable | 143 | full speed USB Device Port with support for five configurable |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 2db5f68f7960..36fd2b4b49a2 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
| @@ -29,6 +29,8 @@ | |||
| 29 | #include <linux/clk.h> | 29 | #include <linux/clk.h> |
| 30 | #include <linux/usb/ch9.h> | 30 | #include <linux/usb/ch9.h> |
| 31 | #include <linux/usb/gadget.h> | 31 | #include <linux/usb/gadget.h> |
| 32 | #include <linux/of.h> | ||
| 33 | #include <linux/of_gpio.h> | ||
| 32 | 34 | ||
| 33 | #include <asm/byteorder.h> | 35 | #include <asm/byteorder.h> |
| 34 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
| @@ -1707,7 +1709,27 @@ static void at91udc_shutdown(struct platform_device *dev) | |||
| 1707 | spin_unlock_irqrestore(&udc->lock, flags); | 1709 | spin_unlock_irqrestore(&udc->lock, flags); |
| 1708 | } | 1710 | } |
| 1709 | 1711 | ||
| 1710 | static int __init at91udc_probe(struct platform_device *pdev) | 1712 | static void __devinit at91udc_of_init(struct at91_udc *udc, |
| 1713 | struct device_node *np) | ||
| 1714 | { | ||
| 1715 | struct at91_udc_data *board = &udc->board; | ||
| 1716 | u32 val; | ||
| 1717 | enum of_gpio_flags flags; | ||
| 1718 | |||
| 1719 | if (of_property_read_u32(np, "atmel,vbus-polled", &val) == 0) | ||
| 1720 | board->vbus_polled = 1; | ||
| 1721 | |||
| 1722 | board->vbus_pin = of_get_named_gpio_flags(np, "atmel,vbus-gpio", 0, | ||
| 1723 | &flags); | ||
| 1724 | board->vbus_active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0; | ||
| 1725 | |||
| 1726 | board->pullup_pin = of_get_named_gpio_flags(np, "atmel,pullup-gpio", 0, | ||
| 1727 | &flags); | ||
| 1728 | |||
| 1729 | board->pullup_active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0; | ||
| 1730 | } | ||
| 1731 | |||
| 1732 | static int __devinit at91udc_probe(struct platform_device *pdev) | ||
| 1711 | { | 1733 | { |
| 1712 | struct device *dev = &pdev->dev; | 1734 | struct device *dev = &pdev->dev; |
| 1713 | struct at91_udc *udc; | 1735 | struct at91_udc *udc; |
| @@ -1742,7 +1764,11 @@ static int __init at91udc_probe(struct platform_device *pdev) | |||
| 1742 | /* init software state */ | 1764 | /* init software state */ |
| 1743 | udc = &controller; | 1765 | udc = &controller; |
| 1744 | udc->gadget.dev.parent = dev; | 1766 | udc->gadget.dev.parent = dev; |
| 1745 | udc->board = *(struct at91_udc_data *) dev->platform_data; | 1767 | if (pdev->dev.of_node) |
| 1768 | at91udc_of_init(udc, pdev->dev.of_node); | ||
| 1769 | else | ||
| 1770 | memcpy(&udc->board, dev->platform_data, | ||
| 1771 | sizeof(struct at91_udc_data)); | ||
| 1746 | udc->pdev = pdev; | 1772 | udc->pdev = pdev; |
| 1747 | udc->enabled = 0; | 1773 | udc->enabled = 0; |
| 1748 | spin_lock_init(&udc->lock); | 1774 | spin_lock_init(&udc->lock); |
| @@ -1971,6 +1997,15 @@ static int at91udc_resume(struct platform_device *pdev) | |||
| 1971 | #define at91udc_resume NULL | 1997 | #define at91udc_resume NULL |
| 1972 | #endif | 1998 | #endif |
| 1973 | 1999 | ||
| 2000 | #if defined(CONFIG_OF) | ||
| 2001 | static const struct of_device_id at91_udc_dt_ids[] = { | ||
| 2002 | { .compatible = "atmel,at91rm9200-udc" }, | ||
| 2003 | { /* sentinel */ } | ||
| 2004 | }; | ||
| 2005 | |||
| 2006 | MODULE_DEVICE_TABLE(of, at91_udc_dt_ids); | ||
| 2007 | #endif | ||
| 2008 | |||
| 1974 | static struct platform_driver at91_udc_driver = { | 2009 | static struct platform_driver at91_udc_driver = { |
| 1975 | .remove = __exit_p(at91udc_remove), | 2010 | .remove = __exit_p(at91udc_remove), |
| 1976 | .shutdown = at91udc_shutdown, | 2011 | .shutdown = at91udc_shutdown, |
| @@ -1979,6 +2014,7 @@ static struct platform_driver at91_udc_driver = { | |||
| 1979 | .driver = { | 2014 | .driver = { |
| 1980 | .name = (char *) driver_name, | 2015 | .name = (char *) driver_name, |
| 1981 | .owner = THIS_MODULE, | 2016 | .owner = THIS_MODULE, |
| 2017 | .of_match_table = of_match_ptr(at91_udc_dt_ids), | ||
| 1982 | }, | 2018 | }, |
| 1983 | }; | 2019 | }; |
| 1984 | 2020 | ||
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/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index 4ad78f868515..1368e4ca3100 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c | |||
| @@ -28,9 +28,9 @@ | |||
| 28 | /* | 28 | /* |
| 29 | * Watchdog timer block registers. | 29 | * Watchdog timer block registers. |
| 30 | */ | 30 | */ |
| 31 | #define TIMER_CTRL (TIMER_VIRT_BASE + 0x0000) | 31 | #define TIMER_CTRL 0x0000 |
| 32 | #define WDT_EN 0x0010 | 32 | #define WDT_EN 0x0010 |
| 33 | #define WDT_VAL (TIMER_VIRT_BASE + 0x0024) | 33 | #define WDT_VAL 0x0024 |
| 34 | 34 | ||
| 35 | #define WDT_MAX_CYCLE_COUNT 0xffffffff | 35 | #define WDT_MAX_CYCLE_COUNT 0xffffffff |
| 36 | #define WDT_IN_USE 0 | 36 | #define WDT_IN_USE 0 |
| @@ -40,6 +40,7 @@ static int nowayout = WATCHDOG_NOWAYOUT; | |||
| 40 | static int heartbeat = -1; /* module parameter (seconds) */ | 40 | static int heartbeat = -1; /* module parameter (seconds) */ |
| 41 | static unsigned int wdt_max_duration; /* (seconds) */ | 41 | static unsigned int wdt_max_duration; /* (seconds) */ |
| 42 | static unsigned int wdt_tclk; | 42 | static unsigned int wdt_tclk; |
| 43 | static void __iomem *wdt_reg; | ||
| 43 | static unsigned long wdt_status; | 44 | static unsigned long wdt_status; |
| 44 | static DEFINE_SPINLOCK(wdt_lock); | 45 | static DEFINE_SPINLOCK(wdt_lock); |
| 45 | 46 | ||
| @@ -48,7 +49,7 @@ static void orion_wdt_ping(void) | |||
| 48 | spin_lock(&wdt_lock); | 49 | spin_lock(&wdt_lock); |
| 49 | 50 | ||
| 50 | /* Reload watchdog duration */ | 51 | /* Reload watchdog duration */ |
| 51 | writel(wdt_tclk * heartbeat, WDT_VAL); | 52 | writel(wdt_tclk * heartbeat, wdt_reg + WDT_VAL); |
| 52 | 53 | ||
| 53 | spin_unlock(&wdt_lock); | 54 | spin_unlock(&wdt_lock); |
| 54 | } | 55 | } |
| @@ -60,7 +61,7 @@ static void orion_wdt_enable(void) | |||
| 60 | spin_lock(&wdt_lock); | 61 | spin_lock(&wdt_lock); |
| 61 | 62 | ||
| 62 | /* Set watchdog duration */ | 63 | /* Set watchdog duration */ |
| 63 | writel(wdt_tclk * heartbeat, WDT_VAL); | 64 | writel(wdt_tclk * heartbeat, wdt_reg + WDT_VAL); |
| 64 | 65 | ||
| 65 | /* Clear watchdog timer interrupt */ | 66 | /* Clear watchdog timer interrupt */ |
| 66 | reg = readl(BRIDGE_CAUSE); | 67 | reg = readl(BRIDGE_CAUSE); |
| @@ -68,9 +69,9 @@ static void orion_wdt_enable(void) | |||
| 68 | writel(reg, BRIDGE_CAUSE); | 69 | writel(reg, BRIDGE_CAUSE); |
| 69 | 70 | ||
| 70 | /* Enable watchdog timer */ | 71 | /* Enable watchdog timer */ |
| 71 | reg = readl(TIMER_CTRL); | 72 | reg = readl(wdt_reg + TIMER_CTRL); |
| 72 | reg |= WDT_EN; | 73 | reg |= WDT_EN; |
| 73 | writel(reg, TIMER_CTRL); | 74 | writel(reg, wdt_reg + TIMER_CTRL); |
| 74 | 75 | ||
| 75 | /* Enable reset on watchdog */ | 76 | /* Enable reset on watchdog */ |
| 76 | reg = readl(RSTOUTn_MASK); | 77 | reg = readl(RSTOUTn_MASK); |
| @@ -92,9 +93,9 @@ static void orion_wdt_disable(void) | |||
| 92 | writel(reg, RSTOUTn_MASK); | 93 | writel(reg, RSTOUTn_MASK); |
| 93 | 94 | ||
| 94 | /* Disable watchdog timer */ | 95 | /* Disable watchdog timer */ |
| 95 | reg = readl(TIMER_CTRL); | 96 | reg = readl(wdt_reg + TIMER_CTRL); |
| 96 | reg &= ~WDT_EN; | 97 | reg &= ~WDT_EN; |
| 97 | writel(reg, TIMER_CTRL); | 98 | writel(reg, wdt_reg + TIMER_CTRL); |
| 98 | 99 | ||
| 99 | spin_unlock(&wdt_lock); | 100 | spin_unlock(&wdt_lock); |
| 100 | } | 101 | } |
| @@ -102,7 +103,7 @@ static void orion_wdt_disable(void) | |||
| 102 | static int orion_wdt_get_timeleft(int *time_left) | 103 | static int orion_wdt_get_timeleft(int *time_left) |
| 103 | { | 104 | { |
| 104 | spin_lock(&wdt_lock); | 105 | spin_lock(&wdt_lock); |
| 105 | *time_left = readl(WDT_VAL) / wdt_tclk; | 106 | *time_left = readl(wdt_reg + WDT_VAL) / wdt_tclk; |
| 106 | spin_unlock(&wdt_lock); | 107 | spin_unlock(&wdt_lock); |
| 107 | return 0; | 108 | return 0; |
| 108 | } | 109 | } |
| @@ -236,6 +237,7 @@ static struct miscdevice orion_wdt_miscdev = { | |||
| 236 | static int __devinit orion_wdt_probe(struct platform_device *pdev) | 237 | static int __devinit orion_wdt_probe(struct platform_device *pdev) |
| 237 | { | 238 | { |
| 238 | struct orion_wdt_platform_data *pdata = pdev->dev.platform_data; | 239 | struct orion_wdt_platform_data *pdata = pdev->dev.platform_data; |
| 240 | struct resource *res; | ||
| 239 | int ret; | 241 | int ret; |
| 240 | 242 | ||
| 241 | if (pdata) { | 243 | if (pdata) { |
| @@ -245,6 +247,10 @@ static int __devinit orion_wdt_probe(struct platform_device *pdev) | |||
| 245 | return -ENODEV; | 247 | return -ENODEV; |
| 246 | } | 248 | } |
| 247 | 249 | ||
| 250 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 251 | |||
| 252 | wdt_reg = ioremap(res->start, resource_size(res)); | ||
| 253 | |||
| 248 | if (orion_wdt_miscdev.parent) | 254 | if (orion_wdt_miscdev.parent) |
| 249 | return -EBUSY; | 255 | return -EBUSY; |
| 250 | orion_wdt_miscdev.parent = &pdev->dev; | 256 | orion_wdt_miscdev.parent = &pdev->dev; |
