diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-02-28 03:36:21 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-02-28 03:36:21 -0500 |
commit | 38a5d6736e7f714cc56d58692001e66dcbb98799 (patch) | |
tree | 337d32375e10b04642013710c2c424514474b32c /drivers/spi | |
parent | 0bfd95a2a104dfc2469d68de52df99939371c0d4 (diff) | |
parent | f5412be599602124d2bdd49947b231dd77c0bf99 (diff) |
Merge commit 'v2.6.38-rc6' into devicetree/next
Conflicts:
drivers/spi/pxa2xx_spi_pci.c
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/pxa2xx_spi_pci.c | 61 | ||||
-rw-r--r-- | drivers/spi/spi_sh_msiof.c | 6 |
2 files changed, 25 insertions, 42 deletions
diff --git a/drivers/spi/pxa2xx_spi_pci.c b/drivers/spi/pxa2xx_spi_pci.c index b6589bb3a6c3..378e504f89eb 100644 --- a/drivers/spi/pxa2xx_spi_pci.c +++ b/drivers/spi/pxa2xx_spi_pci.c | |||
@@ -7,10 +7,9 @@ | |||
7 | #include <linux/of_device.h> | 7 | #include <linux/of_device.h> |
8 | #include <linux/spi/pxa2xx_spi.h> | 8 | #include <linux/spi/pxa2xx_spi.h> |
9 | 9 | ||
10 | struct awesome_struct { | 10 | struct ce4100_info { |
11 | struct ssp_device ssp; | 11 | struct ssp_device ssp; |
12 | struct platform_device spi_pdev; | 12 | struct platform_device *spi_pdev; |
13 | struct pxa2xx_spi_master spi_pdata; | ||
14 | }; | 13 | }; |
15 | 14 | ||
16 | static DEFINE_MUTEX(ssp_lock); | 15 | static DEFINE_MUTEX(ssp_lock); |
@@ -51,23 +50,15 @@ void pxa_ssp_free(struct ssp_device *ssp) | |||
51 | } | 50 | } |
52 | EXPORT_SYMBOL_GPL(pxa_ssp_free); | 51 | EXPORT_SYMBOL_GPL(pxa_ssp_free); |
53 | 52 | ||
54 | static void plat_dev_release(struct device *dev) | ||
55 | { | ||
56 | struct awesome_struct *as = container_of(dev, | ||
57 | struct awesome_struct, spi_pdev.dev); | ||
58 | |||
59 | of_device_node_put(&as->spi_pdev.dev); | ||
60 | } | ||
61 | |||
62 | static int __devinit ce4100_spi_probe(struct pci_dev *dev, | 53 | static int __devinit ce4100_spi_probe(struct pci_dev *dev, |
63 | const struct pci_device_id *ent) | 54 | const struct pci_device_id *ent) |
64 | { | 55 | { |
65 | int ret; | 56 | int ret; |
66 | resource_size_t phys_beg; | 57 | resource_size_t phys_beg; |
67 | resource_size_t phys_len; | 58 | resource_size_t phys_len; |
68 | struct awesome_struct *spi_info; | 59 | struct ce4100_info *spi_info; |
69 | struct platform_device *pdev; | 60 | struct platform_device *pdev; |
70 | struct pxa2xx_spi_master *spi_pdata; | 61 | struct pxa2xx_spi_master spi_pdata; |
71 | struct ssp_device *ssp; | 62 | struct ssp_device *ssp; |
72 | 63 | ||
73 | ret = pci_enable_device(dev); | 64 | ret = pci_enable_device(dev); |
@@ -84,31 +75,28 @@ static int __devinit ce4100_spi_probe(struct pci_dev *dev, | |||
84 | return ret; | 75 | return ret; |
85 | } | 76 | } |
86 | 77 | ||
78 | pdev = platform_device_alloc("pxa2xx-spi", dev->devfn); | ||
87 | spi_info = kzalloc(sizeof(*spi_info), GFP_KERNEL); | 79 | spi_info = kzalloc(sizeof(*spi_info), GFP_KERNEL); |
88 | if (!spi_info) { | 80 | if (!pdev || !spi_info ) { |
89 | ret = -ENOMEM; | 81 | ret = -ENOMEM; |
90 | goto err_kz; | 82 | goto err_nomem; |
91 | } | 83 | } |
92 | ssp = &spi_info->ssp; | 84 | memset(&spi_pdata, 0, sizeof(spi_pdata)); |
93 | pdev = &spi_info->spi_pdev; | 85 | spi_pdata.num_chipselect = dev->devfn; |
94 | spi_pdata = &spi_info->spi_pdata; | ||
95 | 86 | ||
96 | pdev->name = "pxa2xx-spi"; | 87 | ret = platform_device_add_data(pdev, &spi_pdata, sizeof(spi_pdata)); |
97 | pdev->id = dev->devfn; | 88 | if (ret) |
98 | pdev->dev.parent = &dev->dev; | 89 | goto err_nomem; |
99 | pdev->dev.platform_data = &spi_info->spi_pdata; | ||
100 | 90 | ||
91 | pdev->dev.parent = &dev->dev; | ||
101 | pdev->dev.of_node = dev->dev.of_node; | 92 | pdev->dev.of_node = dev->dev.of_node; |
102 | pdev->dev.release = plat_dev_release; | 93 | ssp = &spi_info->ssp; |
103 | |||
104 | spi_pdata->num_chipselect = dev->devfn; | ||
105 | |||
106 | ssp->phys_base = pci_resource_start(dev, 0); | 94 | ssp->phys_base = pci_resource_start(dev, 0); |
107 | ssp->mmio_base = ioremap(phys_beg, phys_len); | 95 | ssp->mmio_base = ioremap(phys_beg, phys_len); |
108 | if (!ssp->mmio_base) { | 96 | if (!ssp->mmio_base) { |
109 | dev_err(&pdev->dev, "failed to ioremap() registers\n"); | 97 | dev_err(&pdev->dev, "failed to ioremap() registers\n"); |
110 | ret = -EIO; | 98 | ret = -EIO; |
111 | goto err_remap; | 99 | goto err_nomem; |
112 | } | 100 | } |
113 | ssp->irq = dev->irq; | 101 | ssp->irq = dev->irq; |
114 | ssp->port_id = pdev->id; | 102 | ssp->port_id = pdev->id; |
@@ -120,7 +108,7 @@ static int __devinit ce4100_spi_probe(struct pci_dev *dev, | |||
120 | 108 | ||
121 | pci_set_drvdata(dev, spi_info); | 109 | pci_set_drvdata(dev, spi_info); |
122 | 110 | ||
123 | ret = platform_device_register(pdev); | 111 | ret = platform_device_add(pdev); |
124 | if (ret) | 112 | if (ret) |
125 | goto err_dev_add; | 113 | goto err_dev_add; |
126 | 114 | ||
@@ -133,27 +121,21 @@ err_dev_add: | |||
133 | mutex_unlock(&ssp_lock); | 121 | mutex_unlock(&ssp_lock); |
134 | iounmap(ssp->mmio_base); | 122 | iounmap(ssp->mmio_base); |
135 | 123 | ||
136 | err_remap: | 124 | err_nomem: |
137 | kfree(spi_info); | ||
138 | |||
139 | err_kz: | ||
140 | release_mem_region(phys_beg, phys_len); | 125 | release_mem_region(phys_beg, phys_len); |
141 | 126 | platform_device_put(pdev); | |
127 | kfree(spi_info); | ||
142 | return ret; | 128 | return ret; |
143 | } | 129 | } |
144 | 130 | ||
145 | static void __devexit ce4100_spi_remove(struct pci_dev *dev) | 131 | static void __devexit ce4100_spi_remove(struct pci_dev *dev) |
146 | { | 132 | { |
147 | struct awesome_struct *spi_info; | 133 | struct ce4100_info *spi_info; |
148 | struct platform_device *pdev; | ||
149 | struct ssp_device *ssp; | 134 | struct ssp_device *ssp; |
150 | 135 | ||
151 | spi_info = pci_get_drvdata(dev); | 136 | spi_info = pci_get_drvdata(dev); |
152 | |||
153 | ssp = &spi_info->ssp; | 137 | ssp = &spi_info->ssp; |
154 | pdev = &spi_info->spi_pdev; | 138 | platform_device_unregister(spi_info->spi_pdev); |
155 | |||
156 | platform_device_unregister(pdev); | ||
157 | 139 | ||
158 | iounmap(ssp->mmio_base); | 140 | iounmap(ssp->mmio_base); |
159 | release_mem_region(pci_resource_start(dev, 0), | 141 | release_mem_region(pci_resource_start(dev, 0), |
@@ -169,7 +151,6 @@ static void __devexit ce4100_spi_remove(struct pci_dev *dev) | |||
169 | } | 151 | } |
170 | 152 | ||
171 | static struct pci_device_id ce4100_spi_devices[] __devinitdata = { | 153 | static struct pci_device_id ce4100_spi_devices[] __devinitdata = { |
172 | |||
173 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) }, | 154 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e6a) }, |
174 | { }, | 155 | { }, |
175 | }; | 156 | }; |
diff --git a/drivers/spi/spi_sh_msiof.c b/drivers/spi/spi_sh_msiof.c index 56f60c8ea0ab..2c665fceaac7 100644 --- a/drivers/spi/spi_sh_msiof.c +++ b/drivers/spi/spi_sh_msiof.c | |||
@@ -509,9 +509,11 @@ static int sh_msiof_spi_txrx(struct spi_device *spi, struct spi_transfer *t) | |||
509 | bytes_done = 0; | 509 | bytes_done = 0; |
510 | 510 | ||
511 | while (bytes_done < t->len) { | 511 | while (bytes_done < t->len) { |
512 | void *rx_buf = t->rx_buf ? t->rx_buf + bytes_done : NULL; | ||
513 | const void *tx_buf = t->tx_buf ? t->tx_buf + bytes_done : NULL; | ||
512 | n = sh_msiof_spi_txrx_once(p, tx_fifo, rx_fifo, | 514 | n = sh_msiof_spi_txrx_once(p, tx_fifo, rx_fifo, |
513 | t->tx_buf + bytes_done, | 515 | tx_buf, |
514 | t->rx_buf + bytes_done, | 516 | rx_buf, |
515 | words, bits); | 517 | words, bits); |
516 | if (n < 0) | 518 | if (n < 0) |
517 | break; | 519 | break; |