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

Merge commit 'gcl/gcl-next' into next

+113 -62
+2 -2
arch/powerpc/platforms/512x/clock.c
··· 56 56 int dev_match = 0; 57 57 int id_match = 0; 58 58 59 - if (dev == NULL && id == NULL) 59 + if (dev == NULL || id == NULL) 60 60 return NULL; 61 61 62 62 mutex_lock(&clocks_mutex); 63 63 list_for_each_entry(p, &clocks, node) { 64 - if (dev && dev == p->dev) 64 + if (dev == p->dev) 65 65 dev_match++; 66 66 if (strcmp(id, p->name) == 0) 67 67 id_match++;
-3
arch/powerpc/platforms/52xx/mpc52xx_gpio.c
··· 363 363 { 364 364 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 365 365 struct mpc52xx_gpt __iomem *regs = mm_gc->regs; 366 - unsigned int ret; 367 366 368 367 return (in_be32(&regs->status) & (1 << (31 - 23))) ? 1 : 0; 369 - 370 - return ret; 371 368 } 372 369 373 370 static void
+7 -1
arch/powerpc/platforms/52xx/mpc52xx_pic.c
··· 196 196 197 197 static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type) 198 198 { 199 + struct irq_desc *desc = get_irq_desc(virq); 199 200 u32 ctrl_reg, type; 200 201 int irq; 201 202 int l2irq; ··· 223 222 type = 0; 224 223 } 225 224 225 + desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); 226 + desc->status |= flow_type & IRQ_TYPE_SENSE_MASK; 227 + if (flow_type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) 228 + desc->status |= IRQ_LEVEL; 229 + 226 230 ctrl_reg = in_be32(&intr->ctrl); 227 231 ctrl_reg &= ~(0x3 << (22 - (l2irq * 2))); 228 232 ctrl_reg |= (type << (22 - (l2irq * 2))); ··· 237 231 } 238 232 239 233 static struct irq_chip mpc52xx_extirq_irqchip = { 240 - .typename = " MPC52xx IRQ[0-3] ", 234 + .typename = "MPC52xx External", 241 235 .mask = mpc52xx_extirq_mask, 242 236 .unmask = mpc52xx_extirq_unmask, 243 237 .ack = mpc52xx_extirq_ack,
+1
drivers/block/xsysace.c
··· 1206 1206 { .compatible = "xlnx,opb-sysace-1.00.b", }, 1207 1207 { .compatible = "xlnx,opb-sysace-1.00.c", }, 1208 1208 { .compatible = "xlnx,xps-sysace-1.00.a", }, 1209 + { .compatible = "xlnx,sysace", }, 1209 1210 {}, 1210 1211 }; 1211 1212 MODULE_DEVICE_TABLE(of, ace_of_match);
+19
drivers/of/of_i2c.c
··· 66 66 } 67 67 EXPORT_SYMBOL(of_register_i2c_devices); 68 68 69 + static int of_dev_node_match(struct device *dev, void *data) 70 + { 71 + return dev_archdata_get_node(&dev->archdata) == data; 72 + } 73 + 74 + /* must call put_device() when done with returned i2c_client device */ 75 + struct i2c_client *of_find_i2c_device_by_node(struct device_node *node) 76 + { 77 + struct device *dev; 78 + 79 + dev = bus_find_device(&i2c_bus_type, NULL, node, 80 + of_dev_node_match); 81 + if (!dev) 82 + return NULL; 83 + 84 + return to_i2c_client(dev); 85 + } 86 + EXPORT_SYMBOL(of_find_i2c_device_by_node); 87 + 69 88 MODULE_LICENSE("GPL");
+81 -56
drivers/spi/xilinx_spi.c
··· 15 15 #include <linux/init.h> 16 16 #include <linux/interrupt.h> 17 17 #include <linux/platform_device.h> 18 + 19 + #include <linux/of_platform.h> 20 + #include <linux/of_device.h> 21 + #include <linux/of_spi.h> 22 + 18 23 #include <linux/spi/spi.h> 19 24 #include <linux/spi/spi_bitbang.h> 20 25 #include <linux/io.h> 21 - 22 - #include <syslib/virtex_devices.h> 23 26 24 27 #define XILINX_SPI_NAME "xilinx_spi" 25 28 ··· 147 144 struct spi_transfer *t) 148 145 { 149 146 u8 bits_per_word; 150 - u32 hz; 151 - struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); 152 147 153 148 bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; 154 - hz = (t) ? t->speed_hz : spi->max_speed_hz; 155 149 if (bits_per_word != 8) { 156 150 dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", 157 151 __func__, bits_per_word); 158 - return -EINVAL; 159 - } 160 - 161 - if (hz && xspi->speed_hz > hz) { 162 - dev_err(&spi->dev, "%s, unsupported clock rate %uHz\n", 163 - __func__, hz); 164 152 return -EINVAL; 165 153 } 166 154 ··· 298 304 return IRQ_HANDLED; 299 305 } 300 306 301 - static int __init xilinx_spi_probe(struct platform_device *dev) 307 + static int __init xilinx_spi_of_probe(struct of_device *ofdev, 308 + const struct of_device_id *match) 302 309 { 303 - int ret = 0; 304 310 struct spi_master *master; 305 311 struct xilinx_spi *xspi; 306 - struct xspi_platform_data *pdata; 307 - struct resource *r; 312 + struct resource r_irq_struct; 313 + struct resource r_mem_struct; 314 + 315 + struct resource *r_irq = &r_irq_struct; 316 + struct resource *r_mem = &r_mem_struct; 317 + int rc = 0; 318 + const u32 *prop; 319 + int len; 308 320 309 321 /* Get resources(memory, IRQ) associated with the device */ 310 - master = spi_alloc_master(&dev->dev, sizeof(struct xilinx_spi)); 322 + master = spi_alloc_master(&ofdev->dev, sizeof(struct xilinx_spi)); 311 323 312 324 if (master == NULL) { 313 325 return -ENOMEM; 314 326 } 315 327 316 - platform_set_drvdata(dev, master); 317 - pdata = dev->dev.platform_data; 328 + dev_set_drvdata(&ofdev->dev, master); 318 329 319 - if (pdata == NULL) { 320 - ret = -ENODEV; 330 + rc = of_address_to_resource(ofdev->node, 0, r_mem); 331 + if (rc) { 332 + dev_warn(&ofdev->dev, "invalid address\n"); 321 333 goto put_master; 322 334 } 323 335 324 - r = platform_get_resource(dev, IORESOURCE_MEM, 0); 325 - if (r == NULL) { 326 - ret = -ENODEV; 336 + rc = of_irq_to_resource(ofdev->node, 0, r_irq); 337 + if (rc == NO_IRQ) { 338 + dev_warn(&ofdev->dev, "no IRQ found\n"); 327 339 goto put_master; 328 340 } 329 341 ··· 341 341 xspi->bitbang.master->setup = xilinx_spi_setup; 342 342 init_completion(&xspi->done); 343 343 344 - if (!request_mem_region(r->start, 345 - r->end - r->start + 1, XILINX_SPI_NAME)) { 346 - ret = -ENXIO; 344 + xspi->irq = r_irq->start; 345 + 346 + if (!request_mem_region(r_mem->start, 347 + r_mem->end - r_mem->start + 1, XILINX_SPI_NAME)) { 348 + rc = -ENXIO; 349 + dev_warn(&ofdev->dev, "memory request failure\n"); 347 350 goto put_master; 348 351 } 349 352 350 - xspi->regs = ioremap(r->start, r->end - r->start + 1); 353 + xspi->regs = ioremap(r_mem->start, r_mem->end - r_mem->start + 1); 351 354 if (xspi->regs == NULL) { 352 - ret = -ENOMEM; 355 + rc = -ENOMEM; 356 + dev_warn(&ofdev->dev, "ioremap failure\n"); 353 357 goto put_master; 354 358 } 359 + xspi->irq = r_irq->start; 355 360 356 - ret = platform_get_irq(dev, 0); 357 - if (ret < 0) { 358 - ret = -ENXIO; 359 - goto unmap_io; 361 + /* dynamic bus assignment */ 362 + master->bus_num = -1; 363 + 364 + /* number of slave select bits is required */ 365 + prop = of_get_property(ofdev->node, "xlnx,num-ss-bits", &len); 366 + if (!prop || len < sizeof(*prop)) { 367 + dev_warn(&ofdev->dev, "no 'xlnx,num-ss-bits' property\n"); 368 + goto put_master; 360 369 } 361 - xspi->irq = ret; 362 - 363 - master->bus_num = pdata->bus_num; 364 - master->num_chipselect = pdata->num_chipselect; 365 - xspi->speed_hz = pdata->speed_hz; 370 + master->num_chipselect = *prop; 366 371 367 372 /* SPI controller initializations */ 368 373 xspi_init_hw(xspi->regs); 369 374 370 375 /* Register for SPI Interrupt */ 371 - ret = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi); 372 - if (ret != 0) 376 + rc = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi); 377 + if (rc != 0) { 378 + dev_warn(&ofdev->dev, "irq request failure: %d\n", xspi->irq); 373 379 goto unmap_io; 380 + } 374 381 375 - ret = spi_bitbang_start(&xspi->bitbang); 376 - if (ret != 0) { 377 - dev_err(&dev->dev, "spi_bitbang_start FAILED\n"); 382 + rc = spi_bitbang_start(&xspi->bitbang); 383 + if (rc != 0) { 384 + dev_err(&ofdev->dev, "spi_bitbang_start FAILED\n"); 378 385 goto free_irq; 379 386 } 380 387 381 - dev_info(&dev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n", 382 - r->start, (u32)xspi->regs, xspi->irq); 388 + dev_info(&ofdev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n", 389 + (unsigned int)r_mem->start, (u32)xspi->regs, xspi->irq); 383 390 384 - return ret; 391 + /* Add any subnodes on the SPI bus */ 392 + of_register_spi_devices(master, ofdev->node); 393 + 394 + return rc; 385 395 386 396 free_irq: 387 397 free_irq(xspi->irq, xspi); ··· 399 389 iounmap(xspi->regs); 400 390 put_master: 401 391 spi_master_put(master); 402 - return ret; 392 + return rc; 403 393 } 404 394 405 - static int __devexit xilinx_spi_remove(struct platform_device *dev) 395 + static int __devexit xilinx_spi_remove(struct of_device *ofdev) 406 396 { 407 397 struct xilinx_spi *xspi; 408 398 struct spi_master *master; 409 399 410 - master = platform_get_drvdata(dev); 400 + master = platform_get_drvdata(ofdev); 411 401 xspi = spi_master_get_devdata(master); 412 402 413 403 spi_bitbang_stop(&xspi->bitbang); 414 404 free_irq(xspi->irq, xspi); 415 405 iounmap(xspi->regs); 416 - platform_set_drvdata(dev, 0); 406 + dev_set_drvdata(&ofdev->dev, 0); 417 407 spi_master_put(xspi->bitbang.master); 418 408 419 409 return 0; ··· 422 412 /* work with hotplug and coldplug */ 423 413 MODULE_ALIAS("platform:" XILINX_SPI_NAME); 424 414 425 - static struct platform_driver xilinx_spi_driver = { 426 - .probe = xilinx_spi_probe, 427 - .remove = __devexit_p(xilinx_spi_remove), 415 + static int __exit xilinx_spi_of_remove(struct of_device *op) 416 + { 417 + return xilinx_spi_remove(op); 418 + } 419 + 420 + static struct of_device_id xilinx_spi_of_match[] = { 421 + { .compatible = "xlnx,xps-spi-2.00.a", }, 422 + { .compatible = "xlnx,xps-spi-2.00.b", }, 423 + {} 424 + }; 425 + 426 + MODULE_DEVICE_TABLE(of, xilinx_spi_of_match); 427 + 428 + static struct of_platform_driver xilinx_spi_of_driver = { 429 + .owner = THIS_MODULE, 430 + .name = "xilinx-xps-spi", 431 + .match_table = xilinx_spi_of_match, 432 + .probe = xilinx_spi_of_probe, 433 + .remove = __exit_p(xilinx_spi_of_remove), 428 434 .driver = { 429 - .name = XILINX_SPI_NAME, 435 + .name = "xilinx-xps-spi", 430 436 .owner = THIS_MODULE, 431 437 }, 432 438 }; 433 439 434 440 static int __init xilinx_spi_init(void) 435 441 { 436 - return platform_driver_register(&xilinx_spi_driver); 442 + return of_register_platform_driver(&xilinx_spi_of_driver); 437 443 } 438 444 module_init(xilinx_spi_init); 439 445 440 446 static void __exit xilinx_spi_exit(void) 441 447 { 442 - platform_driver_unregister(&xilinx_spi_driver); 448 + of_unregister_platform_driver(&xilinx_spi_of_driver); 443 449 } 444 450 module_exit(xilinx_spi_exit); 445 - 446 451 MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); 447 452 MODULE_DESCRIPTION("Xilinx SPI driver"); 448 453 MODULE_LICENSE("GPL");
+3
include/linux/of_i2c.h
··· 17 17 void of_register_i2c_devices(struct i2c_adapter *adap, 18 18 struct device_node *adap_node); 19 19 20 + /* must call put_device() when done with returned i2c_client device */ 21 + struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); 22 + 20 23 #endif /* __LINUX_OF_I2C_H */