diff options
author | Olof Johansson <olof@lixom.net> | 2013-05-27 23:09:53 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2013-05-27 23:10:04 -0400 |
commit | 6f39ef575df368ed77fcaa2f1d0f28191c7414fc (patch) | |
tree | e64a261770acf65a32e498f5b8f1f8323e14fbb7 /drivers/crypto | |
parent | e4aa937ec75df0eea0bee03bffa3303ad36c986b (diff) | |
parent | 95e4bf98520c9a92cd1b87d12c89e8c60c5fe2ca (diff) |
Merge tag 'ux500-dma40-for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson into next/drivers
From Linus Walleij:
This is a set of patches from Lee Jones to start converting
the ux500 to fetch DMA channels from the device tree:
- Full DT support and channel mapping in the DMA40 driver
- Dropping of platform data for migrated devices on the DT
boot path.
* tag 'ux500-dma40-for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson: (36 commits)
ARM: ux500: Register Cryp and Hash platform drivers on Snowball
crypto: ux500/[cryp|hash] - Show successful start-up in the bootlog
ARM: ux500: Stop passing Cryp DMA channel config information though pdata
crypto: ux500/cryp - Set DMA configuration though dma_slave_config()
crypto: ux500/cryp - Prepare clock before enabling it
ARM: ux500: Stop passing Hash DMA channel config information though pdata
crypto: ux500/hash - Set DMA configuration though dma_slave_config()
crypto: ux500/hash - Prepare clock before enabling it
ARM: ux500: Remove unnecessary attributes from DMA channel request pdata
dmaengine: ste_dma40: Correct copy/paste error
ARM: ux500: Remove DMA address look-up table
dmaengine: ste_dma40: Remove redundant address fetching function
dmaengine: ste_dma40: Only use addresses passed as configuration information
ARM: ux500: Stop passing UART's platform data for Device Tree boots
dmaengine: ste_dma40: Don't configure runtime configurable setup during allocate
dmaengine: ste_dma40: Remove unnecessary call to d40_phy_cfg()
dmaengine: ste_dma40: Separate Logical Global Interrupt Mask (GIM) unmasking
ARM: ux500: Pass remnant platform data though to DMA40 driver
dmaengine: ste_dma40: Supply full Device Tree parsing support
dmaengine: ste_dma40: Allow driver to be probe()able when DT is enabled
...
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/ux500/cryp/cryp.h | 7 | ||||
-rw-r--r-- | drivers/crypto/ux500/cryp/cryp_core.c | 31 | ||||
-rw-r--r-- | drivers/crypto/ux500/hash/hash_alg.h | 5 | ||||
-rw-r--r-- | drivers/crypto/ux500/hash/hash_core.c | 24 |
4 files changed, 62 insertions, 5 deletions
diff --git a/drivers/crypto/ux500/cryp/cryp.h b/drivers/crypto/ux500/cryp/cryp.h index 14cfd05b777a..d1d6606fe56c 100644 --- a/drivers/crypto/ux500/cryp/cryp.h +++ b/drivers/crypto/ux500/cryp/cryp.h | |||
@@ -114,6 +114,9 @@ enum cryp_status_id { | |||
114 | }; | 114 | }; |
115 | 115 | ||
116 | /* Cryp DMA interface */ | 116 | /* Cryp DMA interface */ |
117 | #define CRYP_DMA_TX_FIFO 0x08 | ||
118 | #define CRYP_DMA_RX_FIFO 0x10 | ||
119 | |||
117 | enum cryp_dma_req_type { | 120 | enum cryp_dma_req_type { |
118 | CRYP_DMA_DISABLE_BOTH, | 121 | CRYP_DMA_DISABLE_BOTH, |
119 | CRYP_DMA_ENABLE_IN_DATA, | 122 | CRYP_DMA_ENABLE_IN_DATA, |
@@ -217,7 +220,8 @@ struct cryp_dma { | |||
217 | 220 | ||
218 | /** | 221 | /** |
219 | * struct cryp_device_data - structure for a cryp device. | 222 | * struct cryp_device_data - structure for a cryp device. |
220 | * @base: Pointer to the hardware base address. | 223 | * @base: Pointer to virtual base address of the cryp device. |
224 | * @phybase: Pointer to physical memory location of the cryp device. | ||
221 | * @dev: Pointer to the devices dev structure. | 225 | * @dev: Pointer to the devices dev structure. |
222 | * @clk: Pointer to the device's clock control. | 226 | * @clk: Pointer to the device's clock control. |
223 | * @pwr_regulator: Pointer to the device's power control. | 227 | * @pwr_regulator: Pointer to the device's power control. |
@@ -232,6 +236,7 @@ struct cryp_dma { | |||
232 | */ | 236 | */ |
233 | struct cryp_device_data { | 237 | struct cryp_device_data { |
234 | struct cryp_register __iomem *base; | 238 | struct cryp_register __iomem *base; |
239 | phys_addr_t phybase; | ||
235 | struct device *dev; | 240 | struct device *dev; |
236 | struct clk *clk; | 241 | struct clk *clk; |
237 | struct regulator *pwr_regulator; | 242 | struct regulator *pwr_regulator; |
diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index 32f480622b97..4f8b11af29a6 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c | |||
@@ -475,6 +475,19 @@ static int cryp_get_device_data(struct cryp_ctx *ctx, | |||
475 | static void cryp_dma_setup_channel(struct cryp_device_data *device_data, | 475 | static void cryp_dma_setup_channel(struct cryp_device_data *device_data, |
476 | struct device *dev) | 476 | struct device *dev) |
477 | { | 477 | { |
478 | struct dma_slave_config mem2cryp = { | ||
479 | .direction = DMA_MEM_TO_DEV, | ||
480 | .dst_addr = device_data->phybase + CRYP_DMA_TX_FIFO, | ||
481 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, | ||
482 | .dst_maxburst = 4, | ||
483 | }; | ||
484 | struct dma_slave_config cryp2mem = { | ||
485 | .direction = DMA_DEV_TO_MEM, | ||
486 | .src_addr = device_data->phybase + CRYP_DMA_RX_FIFO, | ||
487 | .src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, | ||
488 | .src_maxburst = 4, | ||
489 | }; | ||
490 | |||
478 | dma_cap_zero(device_data->dma.mask); | 491 | dma_cap_zero(device_data->dma.mask); |
479 | dma_cap_set(DMA_SLAVE, device_data->dma.mask); | 492 | dma_cap_set(DMA_SLAVE, device_data->dma.mask); |
480 | 493 | ||
@@ -490,6 +503,9 @@ static void cryp_dma_setup_channel(struct cryp_device_data *device_data, | |||
490 | stedma40_filter, | 503 | stedma40_filter, |
491 | device_data->dma.cfg_cryp2mem); | 504 | device_data->dma.cfg_cryp2mem); |
492 | 505 | ||
506 | dmaengine_slave_config(device_data->dma.chan_mem2cryp, &mem2cryp); | ||
507 | dmaengine_slave_config(device_data->dma.chan_cryp2mem, &cryp2mem); | ||
508 | |||
493 | init_completion(&device_data->dma.cryp_dma_complete); | 509 | init_completion(&device_data->dma.cryp_dma_complete); |
494 | } | 510 | } |
495 | 511 | ||
@@ -1431,6 +1447,7 @@ static int ux500_cryp_probe(struct platform_device *pdev) | |||
1431 | goto out_kfree; | 1447 | goto out_kfree; |
1432 | } | 1448 | } |
1433 | 1449 | ||
1450 | device_data->phybase = res->start; | ||
1434 | device_data->base = ioremap(res->start, resource_size(res)); | 1451 | device_data->base = ioremap(res->start, resource_size(res)); |
1435 | if (!device_data->base) { | 1452 | if (!device_data->base) { |
1436 | dev_err(dev, "[%s]: ioremap failed!", __func__); | 1453 | dev_err(dev, "[%s]: ioremap failed!", __func__); |
@@ -1458,11 +1475,17 @@ static int ux500_cryp_probe(struct platform_device *pdev) | |||
1458 | goto out_regulator; | 1475 | goto out_regulator; |
1459 | } | 1476 | } |
1460 | 1477 | ||
1478 | ret = clk_prepare(device_data->clk); | ||
1479 | if (ret) { | ||
1480 | dev_err(dev, "[%s]: clk_prepare() failed!", __func__); | ||
1481 | goto out_clk; | ||
1482 | } | ||
1483 | |||
1461 | /* Enable device power (and clock) */ | 1484 | /* Enable device power (and clock) */ |
1462 | ret = cryp_enable_power(device_data->dev, device_data, false); | 1485 | ret = cryp_enable_power(device_data->dev, device_data, false); |
1463 | if (ret) { | 1486 | if (ret) { |
1464 | dev_err(dev, "[%s]: cryp_enable_power() failed!", __func__); | 1487 | dev_err(dev, "[%s]: cryp_enable_power() failed!", __func__); |
1465 | goto out_clk; | 1488 | goto out_clk_unprepare; |
1466 | } | 1489 | } |
1467 | 1490 | ||
1468 | cryp_error = cryp_check(device_data); | 1491 | cryp_error = cryp_check(device_data); |
@@ -1518,11 +1541,16 @@ static int ux500_cryp_probe(struct platform_device *pdev) | |||
1518 | goto out_power; | 1541 | goto out_power; |
1519 | } | 1542 | } |
1520 | 1543 | ||
1544 | dev_info(dev, "successfully registered\n"); | ||
1545 | |||
1521 | return 0; | 1546 | return 0; |
1522 | 1547 | ||
1523 | out_power: | 1548 | out_power: |
1524 | cryp_disable_power(device_data->dev, device_data, false); | 1549 | cryp_disable_power(device_data->dev, device_data, false); |
1525 | 1550 | ||
1551 | out_clk_unprepare: | ||
1552 | clk_unprepare(device_data->clk); | ||
1553 | |||
1526 | out_clk: | 1554 | out_clk: |
1527 | clk_put(device_data->clk); | 1555 | clk_put(device_data->clk); |
1528 | 1556 | ||
@@ -1593,6 +1621,7 @@ static int ux500_cryp_remove(struct platform_device *pdev) | |||
1593 | dev_err(&pdev->dev, "[%s]: cryp_disable_power() failed", | 1621 | dev_err(&pdev->dev, "[%s]: cryp_disable_power() failed", |
1594 | __func__); | 1622 | __func__); |
1595 | 1623 | ||
1624 | clk_unprepare(device_data->clk); | ||
1596 | clk_put(device_data->clk); | 1625 | clk_put(device_data->clk); |
1597 | regulator_put(device_data->pwr_regulator); | 1626 | regulator_put(device_data->pwr_regulator); |
1598 | 1627 | ||
diff --git a/drivers/crypto/ux500/hash/hash_alg.h b/drivers/crypto/ux500/hash/hash_alg.h index cd9351cb24df..be6eb54da40f 100644 --- a/drivers/crypto/ux500/hash/hash_alg.h +++ b/drivers/crypto/ux500/hash/hash_alg.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/bitops.h> | 11 | #include <linux/bitops.h> |
12 | 12 | ||
13 | #define HASH_BLOCK_SIZE 64 | 13 | #define HASH_BLOCK_SIZE 64 |
14 | #define HASH_DMA_FIFO 4 | ||
14 | #define HASH_DMA_ALIGN_SIZE 4 | 15 | #define HASH_DMA_ALIGN_SIZE 4 |
15 | #define HASH_DMA_PERFORMANCE_MIN_SIZE 1024 | 16 | #define HASH_DMA_PERFORMANCE_MIN_SIZE 1024 |
16 | #define HASH_BYTES_PER_WORD 4 | 17 | #define HASH_BYTES_PER_WORD 4 |
@@ -347,7 +348,8 @@ struct hash_req_ctx { | |||
347 | 348 | ||
348 | /** | 349 | /** |
349 | * struct hash_device_data - structure for a hash device. | 350 | * struct hash_device_data - structure for a hash device. |
350 | * @base: Pointer to the hardware base address. | 351 | * @base: Pointer to virtual base address of the hash device. |
352 | * @phybase: Pointer to physical memory location of the hash device. | ||
351 | * @list_node: For inclusion in klist. | 353 | * @list_node: For inclusion in klist. |
352 | * @dev: Pointer to the device dev structure. | 354 | * @dev: Pointer to the device dev structure. |
353 | * @ctx_lock: Spinlock for current_ctx. | 355 | * @ctx_lock: Spinlock for current_ctx. |
@@ -361,6 +363,7 @@ struct hash_req_ctx { | |||
361 | */ | 363 | */ |
362 | struct hash_device_data { | 364 | struct hash_device_data { |
363 | struct hash_register __iomem *base; | 365 | struct hash_register __iomem *base; |
366 | phys_addr_t phybase; | ||
364 | struct klist_node list_node; | 367 | struct klist_node list_node; |
365 | struct device *dev; | 368 | struct device *dev; |
366 | struct spinlock ctx_lock; | 369 | struct spinlock ctx_lock; |
diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index cf5508967539..9ca6fbb5e30d 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c | |||
@@ -122,6 +122,13 @@ static void hash_dma_setup_channel(struct hash_device_data *device_data, | |||
122 | struct device *dev) | 122 | struct device *dev) |
123 | { | 123 | { |
124 | struct hash_platform_data *platform_data = dev->platform_data; | 124 | struct hash_platform_data *platform_data = dev->platform_data; |
125 | struct dma_slave_config conf = { | ||
126 | .direction = DMA_MEM_TO_DEV, | ||
127 | .dst_addr = device_data->phybase + HASH_DMA_FIFO, | ||
128 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, | ||
129 | .dst_maxburst = 16, | ||
130 | }; | ||
131 | |||
125 | dma_cap_zero(device_data->dma.mask); | 132 | dma_cap_zero(device_data->dma.mask); |
126 | dma_cap_set(DMA_SLAVE, device_data->dma.mask); | 133 | dma_cap_set(DMA_SLAVE, device_data->dma.mask); |
127 | 134 | ||
@@ -131,6 +138,8 @@ static void hash_dma_setup_channel(struct hash_device_data *device_data, | |||
131 | platform_data->dma_filter, | 138 | platform_data->dma_filter, |
132 | device_data->dma.cfg_mem2hash); | 139 | device_data->dma.cfg_mem2hash); |
133 | 140 | ||
141 | dmaengine_slave_config(device_data->dma.chan_mem2hash, &conf); | ||
142 | |||
134 | init_completion(&device_data->dma.complete); | 143 | init_completion(&device_data->dma.complete); |
135 | } | 144 | } |
136 | 145 | ||
@@ -1699,6 +1708,7 @@ static int ux500_hash_probe(struct platform_device *pdev) | |||
1699 | goto out_kfree; | 1708 | goto out_kfree; |
1700 | } | 1709 | } |
1701 | 1710 | ||
1711 | device_data->phybase = res->start; | ||
1702 | device_data->base = ioremap(res->start, resource_size(res)); | 1712 | device_data->base = ioremap(res->start, resource_size(res)); |
1703 | if (!device_data->base) { | 1713 | if (!device_data->base) { |
1704 | dev_err(dev, "[%s] ioremap() failed!", | 1714 | dev_err(dev, "[%s] ioremap() failed!", |
@@ -1726,11 +1736,17 @@ static int ux500_hash_probe(struct platform_device *pdev) | |||
1726 | goto out_regulator; | 1736 | goto out_regulator; |
1727 | } | 1737 | } |
1728 | 1738 | ||
1739 | ret = clk_prepare(device_data->clk); | ||
1740 | if (ret) { | ||
1741 | dev_err(dev, "[%s] clk_prepare() failed!", __func__); | ||
1742 | goto out_clk; | ||
1743 | } | ||
1744 | |||
1729 | /* Enable device power (and clock) */ | 1745 | /* Enable device power (and clock) */ |
1730 | ret = hash_enable_power(device_data, false); | 1746 | ret = hash_enable_power(device_data, false); |
1731 | if (ret) { | 1747 | if (ret) { |
1732 | dev_err(dev, "[%s]: hash_enable_power() failed!", __func__); | 1748 | dev_err(dev, "[%s]: hash_enable_power() failed!", __func__); |
1733 | goto out_clk; | 1749 | goto out_clk_unprepare; |
1734 | } | 1750 | } |
1735 | 1751 | ||
1736 | ret = hash_check_hw(device_data); | 1752 | ret = hash_check_hw(device_data); |
@@ -1756,12 +1772,15 @@ static int ux500_hash_probe(struct platform_device *pdev) | |||
1756 | goto out_power; | 1772 | goto out_power; |
1757 | } | 1773 | } |
1758 | 1774 | ||
1759 | dev_info(dev, "[%s] successfully probed\n", __func__); | 1775 | dev_info(dev, "successfully registered\n"); |
1760 | return 0; | 1776 | return 0; |
1761 | 1777 | ||
1762 | out_power: | 1778 | out_power: |
1763 | hash_disable_power(device_data, false); | 1779 | hash_disable_power(device_data, false); |
1764 | 1780 | ||
1781 | out_clk_unprepare: | ||
1782 | clk_unprepare(device_data->clk); | ||
1783 | |||
1765 | out_clk: | 1784 | out_clk: |
1766 | clk_put(device_data->clk); | 1785 | clk_put(device_data->clk); |
1767 | 1786 | ||
@@ -1826,6 +1845,7 @@ static int ux500_hash_remove(struct platform_device *pdev) | |||
1826 | dev_err(dev, "[%s]: hash_disable_power() failed", | 1845 | dev_err(dev, "[%s]: hash_disable_power() failed", |
1827 | __func__); | 1846 | __func__); |
1828 | 1847 | ||
1848 | clk_unprepare(device_data->clk); | ||
1829 | clk_put(device_data->clk); | 1849 | clk_put(device_data->clk); |
1830 | regulator_put(device_data->regulator); | 1850 | regulator_put(device_data->regulator); |
1831 | 1851 | ||