Skip to content

Commit e327955

Browse files
committed
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
4 parents dcd6a97 + ab28698 + bc1008c + d3601e5 commit e327955

File tree

12 files changed

+57
-29
lines changed

12 files changed

+57
-29
lines changed

Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Recommended properties:
1313

1414
Example:
1515

16-
spi@7000d600 {
16+
spi@7000c380 {
1717
compatible = "nvidia,tegra20-sflash";
1818
reg = <0x7000c380 0x80>;
1919
interrupts = <0 39 0x04>;

Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Recommended properties:
1313

1414
Example:
1515

16-
slink@7000d600 {
16+
spi@7000d600 {
1717
compatible = "nvidia,tegra20-slink";
1818
reg = <0x7000d600 0x200>;
1919
interrupts = <0 82 0x04>;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Atmel SPI device
2+
3+
Required properties:
4+
- compatible : should be "atmel,at91rm9200-spi".
5+
- reg: Address and length of the register set for the device
6+
- interrupts: Should contain spi interrupt
7+
- cs-gpios: chipselects
8+
9+
Example:
10+
11+
spi1: spi@fffcc000 {
12+
compatible = "atmel,at91rm9200-spi";
13+
reg = <0xfffcc000 0x4000>;
14+
interrupts = <13 4 5>;
15+
#address-cells = <1>;
16+
#size-cells = <0>;
17+
cs-gpios = <&pioB 3 0>;
18+
status = "okay";
19+
20+
mmc-slot@0 {
21+
compatible = "mmc-spi-slot";
22+
reg = <0>;
23+
gpios = <&pioC 4 0>; /* CD */
24+
spi-max-frequency = <25000000>;
25+
};
26+
};

drivers/gpio/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ config GPIO_MSM_V2
172172
config GPIO_MVEBU
173173
def_bool y
174174
depends on PLAT_ORION
175+
depends on OF
175176
select GPIO_GENERIC
176177
select GENERIC_IRQ_CHIP
177178

drivers/gpio/gpio-ich.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ static int ichx_gpio_probe(struct platform_device *pdev)
390390
return -ENODEV;
391391
}
392392

393+
spin_lock_init(&ichx_priv.lock);
393394
res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO);
394395
ichx_priv.use_gpio = ich_info->use_gpio;
395396
err = ichx_gpio_request_regions(res_base, pdev->name,

drivers/gpio/gpio-mvebu.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include <linux/io.h>
4242
#include <linux/of_irq.h>
4343
#include <linux/of_device.h>
44-
#include <linux/platform_device.h>
4544
#include <linux/pinctrl/consumer.h>
4645

4746
/*
@@ -469,19 +468,6 @@ static void mvebu_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
469468
}
470469
}
471470

472-
static struct platform_device_id mvebu_gpio_ids[] = {
473-
{
474-
.name = "orion-gpio",
475-
}, {
476-
.name = "mv78200-gpio",
477-
}, {
478-
.name = "armadaxp-gpio",
479-
}, {
480-
/* sentinel */
481-
},
482-
};
483-
MODULE_DEVICE_TABLE(platform, mvebu_gpio_ids);
484-
485471
static struct of_device_id mvebu_gpio_of_match[] = {
486472
{
487473
.compatible = "marvell,orion-gpio",
@@ -555,9 +541,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
555541
mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK;
556542
mvchip->chip.ngpio = ngpios;
557543
mvchip->chip.can_sleep = 0;
558-
#ifdef CONFIG_OF
559544
mvchip->chip.of_node = np;
560-
#endif
561545

562546
spin_lock_init(&mvchip->lock);
563547
mvchip->membase = devm_request_and_ioremap(&pdev->dev, res);
@@ -698,7 +682,6 @@ static struct platform_driver mvebu_gpio_driver = {
698682
.of_match_table = mvebu_gpio_of_match,
699683
},
700684
.probe = mvebu_gpio_probe,
701-
.id_table = mvebu_gpio_ids,
702685
};
703686

704687
static int __init mvebu_gpio_init(void)

drivers/of/base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
629629
read_unlock(&devtree_lock);
630630
return np;
631631
}
632-
EXPORT_SYMBOL(of_find_matching_node);
632+
EXPORT_SYMBOL(of_find_matching_node_and_match);
633633

634634
/**
635635
* of_modalias_node - Lookup appropriate modalias for a device node

drivers/spi/spi-atmel.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/spi/spi.h>
2121
#include <linux/slab.h>
2222
#include <linux/platform_data/atmel.h>
23+
#include <linux/of.h>
2324

2425
#include <asm/io.h>
2526
#include <asm/gpio.h>
@@ -768,6 +769,10 @@ static int atmel_spi_setup(struct spi_device *spi)
768769

769770
/* chipselect must have been muxed as GPIO (e.g. in board setup) */
770771
npcs_pin = (unsigned int)spi->controller_data;
772+
773+
if (gpio_is_valid(spi->cs_gpio))
774+
npcs_pin = spi->cs_gpio;
775+
771776
asd = spi->controller_state;
772777
if (!asd) {
773778
asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL);
@@ -937,8 +942,9 @@ static int atmel_spi_probe(struct platform_device *pdev)
937942
/* the spi->mode bits understood by this driver: */
938943
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
939944

945+
master->dev.of_node = pdev->dev.of_node;
940946
master->bus_num = pdev->id;
941-
master->num_chipselect = 4;
947+
master->num_chipselect = master->dev.of_node ? 0 : 4;
942948
master->setup = atmel_spi_setup;
943949
master->transfer = atmel_spi_transfer;
944950
master->cleanup = atmel_spi_cleanup;
@@ -1064,11 +1070,20 @@ static int atmel_spi_resume(struct platform_device *pdev)
10641070
#define atmel_spi_resume NULL
10651071
#endif
10661072

1073+
#if defined(CONFIG_OF)
1074+
static const struct of_device_id atmel_spi_dt_ids[] = {
1075+
{ .compatible = "atmel,at91rm9200-spi" },
1076+
{ /* sentinel */ }
1077+
};
1078+
1079+
MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
1080+
#endif
10671081

10681082
static struct platform_driver atmel_spi_driver = {
10691083
.driver = {
10701084
.name = "atmel_spi",
10711085
.owner = THIS_MODULE,
1086+
.of_match_table = of_match_ptr(atmel_spi_dt_ids),
10721087
},
10731088
.suspend = atmel_spi_suspend,
10741089
.resume = atmel_spi_resume,

drivers/spi/spi-s3c64xx.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
214214

215215
writel(0, regs + S3C64XX_SPI_PACKET_CNT);
216216

217+
val = readl(regs + S3C64XX_SPI_CH_CFG);
218+
val &= ~(S3C64XX_SPI_CH_RXCH_ON | S3C64XX_SPI_CH_TXCH_ON);
219+
writel(val, regs + S3C64XX_SPI_CH_CFG);
220+
217221
val = readl(regs + S3C64XX_SPI_CH_CFG);
218222
val |= S3C64XX_SPI_CH_SW_RST;
219223
val &= ~S3C64XX_SPI_CH_HS_EN;
@@ -248,10 +252,6 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
248252
val = readl(regs + S3C64XX_SPI_MODE_CFG);
249253
val &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON);
250254
writel(val, regs + S3C64XX_SPI_MODE_CFG);
251-
252-
val = readl(regs + S3C64XX_SPI_CH_CFG);
253-
val &= ~(S3C64XX_SPI_CH_RXCH_ON | S3C64XX_SPI_CH_TXCH_ON);
254-
writel(val, regs + S3C64XX_SPI_CH_CFG);
255255
}
256256

257257
static void s3c64xx_spi_dmacb(void *data)
@@ -771,8 +771,6 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
771771
if (list_is_last(&xfer->transfer_list,
772772
&msg->transfers))
773773
cs_toggle = 1;
774-
else
775-
disable_cs(sdd, spi);
776774
}
777775

778776
msg->actual_length += xfer->len;

drivers/spi/spi-sh-hspi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static int hspi_probe(struct platform_device *pdev)
290290
}
291291

292292
clk = clk_get(NULL, "shyway_clk");
293-
if (!clk) {
293+
if (IS_ERR(clk)) {
294294
dev_err(&pdev->dev, "shyway_clk is required\n");
295295
ret = -EINVAL;
296296
goto error0;

drivers/spi/spi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,7 @@ static void of_register_spi_devices(struct spi_master *master)
824824
struct spi_device *spi;
825825
struct device_node *nc;
826826
const __be32 *prop;
827+
char modalias[SPI_NAME_SIZE + 4];
827828
int rc;
828829
int len;
829830

@@ -887,7 +888,9 @@ static void of_register_spi_devices(struct spi_master *master)
887888
spi->dev.of_node = nc;
888889

889890
/* Register the new device */
890-
request_module(spi->modalias);
891+
snprintf(modalias, sizeof(modalias), "%s%s", SPI_MODULE_PREFIX,
892+
spi->modalias);
893+
request_module(modalias);
891894
rc = spi_add_device(spi);
892895
if (rc) {
893896
dev_err(&master->dev, "spi_device register error %s\n",

include/linux/of_platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ extern int of_platform_populate(struct device_node *root,
100100

101101
#if !defined(CONFIG_OF_ADDRESS)
102102
struct of_dev_auxdata;
103+
struct device;
103104
static inline int of_platform_populate(struct device_node *root,
104105
const struct of_device_id *matches,
105106
const struct of_dev_auxdata *lookup,

0 commit comments

Comments
 (0)