Commit e3279550 authored by Linus Torvalds's avatar Linus Torvalds

Merge tags 'dt-for-linus', 'gpio-for-linus' and 'spi-for-linus' of...

Merge tags 'dt-for-linus', 'gpio-for-linus' and 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6

Pull devicetree, gpio and spi bugfixes from Grant Likely:
 "Device tree v3.8 bug fix:
   - Fixes an undefined struct device build error and a missing symbol
     export.

  GPIO device driver bug fixes:
   - gpio/mvebu-gpio: Make mvebu-gpio depend on OF_CONFIG
   - gpio/ich: Add missing spinlock init

  SPI device driver bug fixes:
   - Most of this is bug fixes to the core code and the sh-hspi and
     s3c64xx device drivers.

   - There is also a patch here to add DT support to the Atmel driver.
     This one should have been in the first round, but I missed it.
     It's a low risk change contained within a single driver and the
     Atmel maintainer has requested it."

* tag 'dt-for-linus' of git://git.secretlab.ca/git/linux-2.6:
  of: define struct device in of_platform.h if !OF_DEVICE and !OF_ADDRESS
  of: Fix export of of_find_matching_node_and_match()

* tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6:
  gpio/mvebu-gpio: Make mvebu-gpio depend on OF_CONFIG
  gpio/ich: Add missing spinlock init

* tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6:
  spi/sh-hspi: fix return value check in hspi_probe().
  spi: fix tegra SPI binding examples
  spi/atmel: add DT support
  of/spi: Fix SPI module loading by using proper "spi:" modalias prefixes.
  spi: Change FIFO flush operation and spi channel off
  spi: Keep chipselect assertion during one message
...@@ -13,7 +13,7 @@ Recommended properties: ...@@ -13,7 +13,7 @@ Recommended properties:
Example: Example:
spi@7000d600 { spi@7000c380 {
compatible = "nvidia,tegra20-sflash"; compatible = "nvidia,tegra20-sflash";
reg = <0x7000c380 0x80>; reg = <0x7000c380 0x80>;
interrupts = <0 39 0x04>; interrupts = <0 39 0x04>;
......
...@@ -13,7 +13,7 @@ Recommended properties: ...@@ -13,7 +13,7 @@ Recommended properties:
Example: Example:
slink@7000d600 { spi@7000d600 {
compatible = "nvidia,tegra20-slink"; compatible = "nvidia,tegra20-slink";
reg = <0x7000d600 0x200>; reg = <0x7000d600 0x200>;
interrupts = <0 82 0x04>; interrupts = <0 82 0x04>;
......
Atmel SPI device
Required properties:
- compatible : should be "atmel,at91rm9200-spi".
- reg: Address and length of the register set for the device
- interrupts: Should contain spi interrupt
- cs-gpios: chipselects
Example:
spi1: spi@fffcc000 {
compatible = "atmel,at91rm9200-spi";
reg = <0xfffcc000 0x4000>;
interrupts = <13 4 5>;
#address-cells = <1>;
#size-cells = <0>;
cs-gpios = <&pioB 3 0>;
status = "okay";
mmc-slot@0 {
compatible = "mmc-spi-slot";
reg = <0>;
gpios = <&pioC 4 0>; /* CD */
spi-max-frequency = <25000000>;
};
};
...@@ -172,6 +172,7 @@ config GPIO_MSM_V2 ...@@ -172,6 +172,7 @@ config GPIO_MSM_V2
config GPIO_MVEBU config GPIO_MVEBU
def_bool y def_bool y
depends on PLAT_ORION depends on PLAT_ORION
depends on OF
select GPIO_GENERIC select GPIO_GENERIC
select GENERIC_IRQ_CHIP select GENERIC_IRQ_CHIP
......
...@@ -390,6 +390,7 @@ static int ichx_gpio_probe(struct platform_device *pdev) ...@@ -390,6 +390,7 @@ static int ichx_gpio_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
spin_lock_init(&ichx_priv.lock);
res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO); res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO);
ichx_priv.use_gpio = ich_info->use_gpio; ichx_priv.use_gpio = ich_info->use_gpio;
err = ichx_gpio_request_regions(res_base, pdev->name, err = ichx_gpio_request_regions(res_base, pdev->name,
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
/* /*
...@@ -469,19 +468,6 @@ static void mvebu_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) ...@@ -469,19 +468,6 @@ static void mvebu_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
} }
} }
static struct platform_device_id mvebu_gpio_ids[] = {
{
.name = "orion-gpio",
}, {
.name = "mv78200-gpio",
}, {
.name = "armadaxp-gpio",
}, {
/* sentinel */
},
};
MODULE_DEVICE_TABLE(platform, mvebu_gpio_ids);
static struct of_device_id mvebu_gpio_of_match[] = { static struct of_device_id mvebu_gpio_of_match[] = {
{ {
.compatible = "marvell,orion-gpio", .compatible = "marvell,orion-gpio",
...@@ -555,9 +541,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) ...@@ -555,9 +541,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK; mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK;
mvchip->chip.ngpio = ngpios; mvchip->chip.ngpio = ngpios;
mvchip->chip.can_sleep = 0; mvchip->chip.can_sleep = 0;
#ifdef CONFIG_OF
mvchip->chip.of_node = np; mvchip->chip.of_node = np;
#endif
spin_lock_init(&mvchip->lock); spin_lock_init(&mvchip->lock);
mvchip->membase = devm_request_and_ioremap(&pdev->dev, res); mvchip->membase = devm_request_and_ioremap(&pdev->dev, res);
...@@ -698,7 +682,6 @@ static struct platform_driver mvebu_gpio_driver = { ...@@ -698,7 +682,6 @@ static struct platform_driver mvebu_gpio_driver = {
.of_match_table = mvebu_gpio_of_match, .of_match_table = mvebu_gpio_of_match,
}, },
.probe = mvebu_gpio_probe, .probe = mvebu_gpio_probe,
.id_table = mvebu_gpio_ids,
}; };
static int __init mvebu_gpio_init(void) static int __init mvebu_gpio_init(void)
......
...@@ -629,7 +629,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from, ...@@ -629,7 +629,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
read_unlock(&devtree_lock); read_unlock(&devtree_lock);
return np; return np;
} }
EXPORT_SYMBOL(of_find_matching_node); EXPORT_SYMBOL(of_find_matching_node_and_match);
/** /**
* of_modalias_node - Lookup appropriate modalias for a device node * of_modalias_node - Lookup appropriate modalias for a device node
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/platform_data/atmel.h> #include <linux/platform_data/atmel.h>
#include <linux/of.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/gpio.h> #include <asm/gpio.h>
...@@ -768,6 +769,10 @@ static int atmel_spi_setup(struct spi_device *spi) ...@@ -768,6 +769,10 @@ static int atmel_spi_setup(struct spi_device *spi)
/* chipselect must have been muxed as GPIO (e.g. in board setup) */ /* chipselect must have been muxed as GPIO (e.g. in board setup) */
npcs_pin = (unsigned int)spi->controller_data; npcs_pin = (unsigned int)spi->controller_data;
if (gpio_is_valid(spi->cs_gpio))
npcs_pin = spi->cs_gpio;
asd = spi->controller_state; asd = spi->controller_state;
if (!asd) { if (!asd) {
asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL); asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL);
...@@ -937,8 +942,9 @@ static int atmel_spi_probe(struct platform_device *pdev) ...@@ -937,8 +942,9 @@ static int atmel_spi_probe(struct platform_device *pdev)
/* the spi->mode bits understood by this driver: */ /* the spi->mode bits understood by this driver: */
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
master->dev.of_node = pdev->dev.of_node;
master->bus_num = pdev->id; master->bus_num = pdev->id;
master->num_chipselect = 4; master->num_chipselect = master->dev.of_node ? 0 : 4;
master->setup = atmel_spi_setup; master->setup = atmel_spi_setup;
master->transfer = atmel_spi_transfer; master->transfer = atmel_spi_transfer;
master->cleanup = atmel_spi_cleanup; master->cleanup = atmel_spi_cleanup;
...@@ -1064,11 +1070,20 @@ static int atmel_spi_resume(struct platform_device *pdev) ...@@ -1064,11 +1070,20 @@ static int atmel_spi_resume(struct platform_device *pdev)
#define atmel_spi_resume NULL #define atmel_spi_resume NULL
#endif #endif
#if defined(CONFIG_OF)
static const struct of_device_id atmel_spi_dt_ids[] = {
{ .compatible = "atmel,at91rm9200-spi" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
#endif
static struct platform_driver atmel_spi_driver = { static struct platform_driver atmel_spi_driver = {
.driver = { .driver = {
.name = "atmel_spi", .name = "atmel_spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = of_match_ptr(atmel_spi_dt_ids),
}, },
.suspend = atmel_spi_suspend, .suspend = atmel_spi_suspend,
.resume = atmel_spi_resume, .resume = atmel_spi_resume,
......
...@@ -214,6 +214,10 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) ...@@ -214,6 +214,10 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
writel(0, regs + S3C64XX_SPI_PACKET_CNT); writel(0, regs + S3C64XX_SPI_PACKET_CNT);
val = readl(regs + S3C64XX_SPI_CH_CFG);
val &= ~(S3C64XX_SPI_CH_RXCH_ON | S3C64XX_SPI_CH_TXCH_ON);
writel(val, regs + S3C64XX_SPI_CH_CFG);
val = readl(regs + S3C64XX_SPI_CH_CFG); val = readl(regs + S3C64XX_SPI_CH_CFG);
val |= S3C64XX_SPI_CH_SW_RST; val |= S3C64XX_SPI_CH_SW_RST;
val &= ~S3C64XX_SPI_CH_HS_EN; val &= ~S3C64XX_SPI_CH_HS_EN;
...@@ -248,10 +252,6 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) ...@@ -248,10 +252,6 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
val = readl(regs + S3C64XX_SPI_MODE_CFG); val = readl(regs + S3C64XX_SPI_MODE_CFG);
val &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON); val &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON);
writel(val, regs + S3C64XX_SPI_MODE_CFG); writel(val, regs + S3C64XX_SPI_MODE_CFG);
val = readl(regs + S3C64XX_SPI_CH_CFG);
val &= ~(S3C64XX_SPI_CH_RXCH_ON | S3C64XX_SPI_CH_TXCH_ON);
writel(val, regs + S3C64XX_SPI_CH_CFG);
} }
static void s3c64xx_spi_dmacb(void *data) static void s3c64xx_spi_dmacb(void *data)
...@@ -771,8 +771,6 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master, ...@@ -771,8 +771,6 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
if (list_is_last(&xfer->transfer_list, if (list_is_last(&xfer->transfer_list,
&msg->transfers)) &msg->transfers))
cs_toggle = 1; cs_toggle = 1;
else
disable_cs(sdd, spi);
} }
msg->actual_length += xfer->len; msg->actual_length += xfer->len;
......
...@@ -290,7 +290,7 @@ static int hspi_probe(struct platform_device *pdev) ...@@ -290,7 +290,7 @@ static int hspi_probe(struct platform_device *pdev)
} }
clk = clk_get(NULL, "shyway_clk"); clk = clk_get(NULL, "shyway_clk");
if (!clk) { if (IS_ERR(clk)) {
dev_err(&pdev->dev, "shyway_clk is required\n"); dev_err(&pdev->dev, "shyway_clk is required\n");
ret = -EINVAL; ret = -EINVAL;
goto error0; goto error0;
......
...@@ -824,6 +824,7 @@ static void of_register_spi_devices(struct spi_master *master) ...@@ -824,6 +824,7 @@ static void of_register_spi_devices(struct spi_master *master)
struct spi_device *spi; struct spi_device *spi;
struct device_node *nc; struct device_node *nc;
const __be32 *prop; const __be32 *prop;
char modalias[SPI_NAME_SIZE + 4];
int rc; int rc;
int len; int len;
...@@ -887,7 +888,9 @@ static void of_register_spi_devices(struct spi_master *master) ...@@ -887,7 +888,9 @@ static void of_register_spi_devices(struct spi_master *master)
spi->dev.of_node = nc; spi->dev.of_node = nc;
/* Register the new device */ /* Register the new device */
request_module(spi->modalias); snprintf(modalias, sizeof(modalias), "%s%s", SPI_MODULE_PREFIX,
spi->modalias);
request_module(modalias);
rc = spi_add_device(spi); rc = spi_add_device(spi);
if (rc) { if (rc) {
dev_err(&master->dev, "spi_device register error %s\n", dev_err(&master->dev, "spi_device register error %s\n",
......
...@@ -100,6 +100,7 @@ extern int of_platform_populate(struct device_node *root, ...@@ -100,6 +100,7 @@ extern int of_platform_populate(struct device_node *root,
#if !defined(CONFIG_OF_ADDRESS) #if !defined(CONFIG_OF_ADDRESS)
struct of_dev_auxdata; struct of_dev_auxdata;
struct device;
static inline int of_platform_populate(struct device_node *root, static inline int of_platform_populate(struct device_node *root,
const struct of_device_id *matches, const struct of_device_id *matches,
const struct of_dev_auxdata *lookup, const struct of_dev_auxdata *lookup,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment