aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/pl330.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/pl330.c')
-rw-r--r--drivers/dma/pl330.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 7ec82f0667eb..593827b3fdd4 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -157,7 +157,6 @@ enum pl330_reqtype {
157#define PERIPH_REV_R0P0 0 157#define PERIPH_REV_R0P0 0
158#define PERIPH_REV_R1P0 1 158#define PERIPH_REV_R1P0 1
159#define PERIPH_REV_R1P1 2 159#define PERIPH_REV_R1P1 2
160#define PCELL_ID 0xff0
161 160
162#define CR0_PERIPH_REQ_SET (1 << 0) 161#define CR0_PERIPH_REQ_SET (1 << 0)
163#define CR0_BOOT_EN_SET (1 << 1) 162#define CR0_BOOT_EN_SET (1 << 1)
@@ -193,8 +192,6 @@ enum pl330_reqtype {
193#define INTEG_CFG 0x0 192#define INTEG_CFG 0x0
194#define PERIPH_ID_VAL ((PART << 0) | (DESIGNER << 12)) 193#define PERIPH_ID_VAL ((PART << 0) | (DESIGNER << 12))
195 194
196#define PCELL_ID_VAL 0xb105f00d
197
198#define PL330_STATE_STOPPED (1 << 0) 195#define PL330_STATE_STOPPED (1 << 0)
199#define PL330_STATE_EXECUTING (1 << 1) 196#define PL330_STATE_EXECUTING (1 << 1)
200#define PL330_STATE_WFE (1 << 2) 197#define PL330_STATE_WFE (1 << 2)
@@ -292,7 +289,6 @@ static unsigned cmd_line;
292/* Populated by the PL330 core driver for DMA API driver's info */ 289/* Populated by the PL330 core driver for DMA API driver's info */
293struct pl330_config { 290struct pl330_config {
294 u32 periph_id; 291 u32 periph_id;
295 u32 pcell_id;
296#define DMAC_MODE_NS (1 << 0) 292#define DMAC_MODE_NS (1 << 0)
297 unsigned int mode; 293 unsigned int mode;
298 unsigned int data_bus_width:10; /* In number of bits */ 294 unsigned int data_bus_width:10; /* In number of bits */
@@ -505,7 +501,7 @@ struct pl330_dmac {
505 /* Maximum possible events/irqs */ 501 /* Maximum possible events/irqs */
506 int events[32]; 502 int events[32];
507 /* BUS address of MicroCode buffer */ 503 /* BUS address of MicroCode buffer */
508 u32 mcode_bus; 504 dma_addr_t mcode_bus;
509 /* CPU address of MicroCode buffer */ 505 /* CPU address of MicroCode buffer */
510 void *mcode_cpu; 506 void *mcode_cpu;
511 /* List of all Channel threads */ 507 /* List of all Channel threads */
@@ -650,19 +646,6 @@ static inline bool _manager_ns(struct pl330_thread *thrd)
650 return (pl330->pinfo->pcfg.mode & DMAC_MODE_NS) ? true : false; 646 return (pl330->pinfo->pcfg.mode & DMAC_MODE_NS) ? true : false;
651} 647}
652 648
653static inline u32 get_id(struct pl330_info *pi, u32 off)
654{
655 void __iomem *regs = pi->base;
656 u32 id = 0;
657
658 id |= (readb(regs + off + 0x0) << 0);
659 id |= (readb(regs + off + 0x4) << 8);
660 id |= (readb(regs + off + 0x8) << 16);
661 id |= (readb(regs + off + 0xc) << 24);
662
663 return id;
664}
665
666static inline u32 get_revision(u32 periph_id) 649static inline u32 get_revision(u32 periph_id)
667{ 650{
668 return (periph_id >> PERIPH_REV_SHIFT) & PERIPH_REV_MASK; 651 return (periph_id >> PERIPH_REV_SHIFT) & PERIPH_REV_MASK;
@@ -1986,9 +1969,6 @@ static void read_dmac_config(struct pl330_info *pi)
1986 pi->pcfg.num_events = val; 1969 pi->pcfg.num_events = val;
1987 1970
1988 pi->pcfg.irq_ns = readl(regs + CR3); 1971 pi->pcfg.irq_ns = readl(regs + CR3);
1989
1990 pi->pcfg.periph_id = get_id(pi, PERIPH_ID);
1991 pi->pcfg.pcell_id = get_id(pi, PCELL_ID);
1992} 1972}
1993 1973
1994static inline void _reset_thread(struct pl330_thread *thrd) 1974static inline void _reset_thread(struct pl330_thread *thrd)
@@ -2098,10 +2078,8 @@ static int pl330_add(struct pl330_info *pi)
2098 regs = pi->base; 2078 regs = pi->base;
2099 2079
2100 /* Check if we can handle this DMAC */ 2080 /* Check if we can handle this DMAC */
2101 if ((get_id(pi, PERIPH_ID) & 0xfffff) != PERIPH_ID_VAL 2081 if ((pi->pcfg.periph_id & 0xfffff) != PERIPH_ID_VAL) {
2102 || get_id(pi, PCELL_ID) != PCELL_ID_VAL) { 2082 dev_err(pi->dev, "PERIPH_ID 0x%x !\n", pi->pcfg.periph_id);
2103 dev_err(pi->dev, "PERIPH_ID 0x%x, PCELL_ID 0x%x !\n",
2104 get_id(pi, PERIPH_ID), get_id(pi, PCELL_ID));
2105 return -EINVAL; 2083 return -EINVAL;
2106 } 2084 }
2107 2085
@@ -2916,6 +2894,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
2916 if (ret) 2894 if (ret)
2917 return ret; 2895 return ret;
2918 2896
2897 pi->pcfg.periph_id = adev->periphid;
2919 ret = pl330_add(pi); 2898 ret = pl330_add(pi);
2920 if (ret) 2899 if (ret)
2921 goto probe_err1; 2900 goto probe_err1;