Skip to content

Commit 0b382fb

Browse files
committed
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux into next
Freescale updates from Scott: "Includes a fix for a powerpc/next mm regression on 64e, a fix for a kernel hang on 64e when using a debugger inside a relocated kernel, a qman fix, and misc qe improvements."
2 parents 6102c00 + 61baf15 commit 0b382fb

File tree

11 files changed

+95
-30
lines changed

11 files changed

+95
-30
lines changed

Documentation/devicetree/bindings/soc/fsl/cpm_qe/gpio.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@ Required properties:
1313
- #gpio-cells : Should be two. The first cell is the pin number and the
1414
second cell is used to specify optional parameters (currently unused).
1515
- gpio-controller : Marks the port as GPIO controller.
16+
Optional properties:
17+
- fsl,cpm1-gpio-irq-mask : For banks having interrupt capability (like port C
18+
on CPM1), this item tells which ports have an associated interrupt (ports are
19+
listed in the same order as in PCINT register)
20+
- interrupts : This property provides the list of interrupt for each GPIO having
21+
one as described by the fsl,cpm1-gpio-irq-mask property. There should be as
22+
many interrupts as number of ones in the mask property. The first interrupt in
23+
the list corresponds to the most significant bit of the mask.
24+
- interrupt-parent : Parent for the above interrupt property.
1625

17-
Example of three SOC GPIO banks defined as gpio-controller nodes:
26+
Example of four SOC GPIO banks defined as gpio-controller nodes:
1827

1928
CPM1_PIO_A: gpio-controller@950 {
2029
#gpio-cells = <2>;
@@ -30,6 +39,16 @@ Example of three SOC GPIO banks defined as gpio-controller nodes:
3039
gpio-controller;
3140
};
3241

42+
CPM1_PIO_C: gpio-controller@960 {
43+
#gpio-cells = <2>;
44+
compatible = "fsl,cpm1-pario-bank-c";
45+
reg = <0x960 0x10>;
46+
fsl,cpm1-gpio-irq-mask = <0x0fff>;
47+
interrupts = <1 2 6 9 10 11 14 15 23 24 26 31>;
48+
interrupt-parent = <&CPM_PIC>;
49+
gpio-controller;
50+
};
51+
3352
CPM1_PIO_E: gpio-controller@ac8 {
3453
#gpio-cells = <2>;
3554
compatible = "fsl,cpm1-pario-bank-e";

arch/powerpc/include/asm/cpm1.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@ typedef struct risc_timer_pram {
560560
#define CPM_PIN_SECONDARY 2
561561
#define CPM_PIN_GPIO 4
562562
#define CPM_PIN_OPENDRAIN 8
563+
#define CPM_PIN_FALLEDGE 16
564+
#define CPM_PIN_ANYEDGE 0
563565

564566
enum cpm_port {
565567
CPM_PORTA,

arch/powerpc/include/asm/processor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,13 @@ void release_thread(struct task_struct *);
151151

152152
#ifdef __powerpc64__
153153

154+
#ifdef CONFIG_PPC_BOOK3S_64
154155
/* Limit stack to 128TB */
155156
#define STACK_TOP_USER64 TASK_SIZE_128TB
157+
#else
158+
#define STACK_TOP_USER64 TASK_SIZE_USER64
159+
#endif
160+
156161
#define STACK_TOP_USER32 TASK_SIZE_USER32
157162

158163
#define STACK_TOP (is_32bit_task() ? \

arch/powerpc/kernel/exceptions-64e.S

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
735735
andis. r15,r14,(DBSR_IC|DBSR_BT)@h
736736
beq+ 1f
737737

738+
#ifdef CONFIG_RELOCATABLE
739+
ld r15,PACATOC(r13)
740+
ld r14,interrupt_base_book3e@got(r15)
741+
ld r15,__end_interrupts@got(r15)
742+
#else
738743
LOAD_REG_IMMEDIATE(r14,interrupt_base_book3e)
739744
LOAD_REG_IMMEDIATE(r15,__end_interrupts)
745+
#endif
740746
cmpld cr0,r10,r14
741747
cmpld cr1,r10,r15
742748
blt+ cr0,1f
@@ -799,8 +805,14 @@ kernel_dbg_exc:
799805
andis. r15,r14,(DBSR_IC|DBSR_BT)@h
800806
beq+ 1f
801807

808+
#ifdef CONFIG_RELOCATABLE
809+
ld r15,PACATOC(r13)
810+
ld r14,interrupt_base_book3e@got(r15)
811+
ld r15,__end_interrupts@got(r15)
812+
#else
802813
LOAD_REG_IMMEDIATE(r14,interrupt_base_book3e)
803814
LOAD_REG_IMMEDIATE(r15,__end_interrupts)
815+
#endif
804816
cmpld cr0,r10,r14
805817
cmpld cr1,r10,r15
806818
blt+ cr0,1f

arch/powerpc/sysdev/cpm1.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,10 @@ static void cpm1_set_pin16(int port, int pin, int flags)
377377
setbits16(&iop->odr_sor, pin);
378378
else
379379
clrbits16(&iop->odr_sor, pin);
380+
if (flags & CPM_PIN_FALLEDGE)
381+
setbits16(&iop->intr, pin);
382+
else
383+
clrbits16(&iop->intr, pin);
380384
}
381385
}
382386

@@ -528,6 +532,9 @@ struct cpm1_gpio16_chip {
528532

529533
/* shadowed data register to clear/set bits safely */
530534
u16 cpdata;
535+
536+
/* IRQ associated with Pins when relevant */
537+
int irq[16];
531538
};
532539

533540
static void cpm1_gpio16_save_regs(struct of_mm_gpio_chip *mm_gc)
@@ -578,6 +585,14 @@ static void cpm1_gpio16_set(struct gpio_chip *gc, unsigned int gpio, int value)
578585
spin_unlock_irqrestore(&cpm1_gc->lock, flags);
579586
}
580587

588+
static int cpm1_gpio16_to_irq(struct gpio_chip *gc, unsigned int gpio)
589+
{
590+
struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
591+
struct cpm1_gpio16_chip *cpm1_gc = gpiochip_get_data(&mm_gc->gc);
592+
593+
return cpm1_gc->irq[gpio] ? : -ENXIO;
594+
}
595+
581596
static int cpm1_gpio16_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
582597
{
583598
struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
@@ -618,13 +633,22 @@ int cpm1_gpiochip_add16(struct device_node *np)
618633
struct cpm1_gpio16_chip *cpm1_gc;
619634
struct of_mm_gpio_chip *mm_gc;
620635
struct gpio_chip *gc;
636+
u16 mask;
621637

622638
cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
623639
if (!cpm1_gc)
624640
return -ENOMEM;
625641

626642
spin_lock_init(&cpm1_gc->lock);
627643

644+
if (!of_property_read_u16(np, "fsl,cpm1-gpio-irq-mask", &mask)) {
645+
int i, j;
646+
647+
for (i = 0, j = 0; i < 16; i++)
648+
if (mask & (1 << (15 - i)))
649+
cpm1_gc->irq[i] = irq_of_parse_and_map(np, j++);
650+
}
651+
628652
mm_gc = &cpm1_gc->mm_gc;
629653
gc = &mm_gc->gc;
630654

@@ -634,6 +658,7 @@ int cpm1_gpiochip_add16(struct device_node *np)
634658
gc->direction_output = cpm1_gpio16_dir_out;
635659
gc->get = cpm1_gpio16_get;
636660
gc->set = cpm1_gpio16_set;
661+
gc->to_irq = cpm1_gpio16_to_irq;
637662

638663
return of_mm_gpiochip_add_data(np, mm_gc, cpm1_gc);
639664
}

drivers/net/ethernet/freescale/ucc_geth.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,11 +2594,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
25942594
} else if (ugeth->ug_info->uf_info.bd_mem_part ==
25952595
MEM_PART_MURAM) {
25962596
out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
2597-
(u32) immrbar_virt_to_phys(ugeth->
2598-
p_tx_bd_ring[i]));
2597+
(u32)qe_muram_dma(ugeth->p_tx_bd_ring[i]));
25992598
out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].
26002599
last_bd_completed_address,
2601-
(u32) immrbar_virt_to_phys(endOfRing));
2600+
(u32)qe_muram_dma(endOfRing));
26022601
}
26032602
}
26042603

@@ -2844,8 +2843,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
28442843
} else if (ugeth->ug_info->uf_info.bd_mem_part ==
28452844
MEM_PART_MURAM) {
28462845
out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr,
2847-
(u32) immrbar_virt_to_phys(ugeth->
2848-
p_rx_bd_ring[i]));
2846+
(u32)qe_muram_dma(ugeth->p_rx_bd_ring[i]));
28492847
}
28502848
/* rest of fields handled by QE */
28512849
}

drivers/soc/fsl/qbman/qman.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,7 @@ static void qm_congestion_task(struct work_struct *work)
13441344
if (!qm_mc_result_timeout(&p->p, &mcr)) {
13451345
spin_unlock(&p->cgr_lock);
13461346
dev_crit(p->config->dev, "QUERYCONGESTION timeout\n");
1347+
qman_p_irqsource_add(p, QM_PIRQ_CSCI);
13471348
return;
13481349
}
13491350
/* mask out the ones I'm not interested in */
@@ -1358,6 +1359,7 @@ static void qm_congestion_task(struct work_struct *work)
13581359
if (cgr->cb && qman_cgrs_get(&c, cgr->cgrid))
13591360
cgr->cb(p, cgr, qman_cgrs_get(&rr, cgr->cgrid));
13601361
spin_unlock(&p->cgr_lock);
1362+
qman_p_irqsource_add(p, QM_PIRQ_CSCI);
13611363
}
13621364

13631365
static void qm_mr_process_task(struct work_struct *work)
@@ -1417,12 +1419,14 @@ static void qm_mr_process_task(struct work_struct *work)
14171419
}
14181420

14191421
qm_mr_cci_consume(&p->p, num);
1422+
qman_p_irqsource_add(p, QM_PIRQ_MRI);
14201423
preempt_enable();
14211424
}
14221425

14231426
static u32 __poll_portal_slow(struct qman_portal *p, u32 is)
14241427
{
14251428
if (is & QM_PIRQ_CSCI) {
1429+
qman_p_irqsource_remove(p, QM_PIRQ_CSCI);
14261430
queue_work_on(smp_processor_id(), qm_portal_wq,
14271431
&p->congestion_work);
14281432
}
@@ -1434,6 +1438,7 @@ static u32 __poll_portal_slow(struct qman_portal *p, u32 is)
14341438
}
14351439

14361440
if (is & QM_PIRQ_MRI) {
1441+
qman_p_irqsource_remove(p, QM_PIRQ_MRI);
14371442
queue_work_on(smp_processor_id(), qm_portal_wq,
14381443
&p->mr_work);
14391444
}

drivers/soc/fsl/qe/qe.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static unsigned int qe_num_of_snum;
6666

6767
static phys_addr_t qebase = -1;
6868

69-
phys_addr_t get_qe_base(void)
69+
static phys_addr_t get_qe_base(void)
7070
{
7171
struct device_node *qe;
7272
int ret;
@@ -90,8 +90,6 @@ phys_addr_t get_qe_base(void)
9090
return qebase;
9191
}
9292

93-
EXPORT_SYMBOL(get_qe_base);
94-
9593
void qe_reset(void)
9694
{
9795
if (qe_immr == NULL)
@@ -163,11 +161,15 @@ EXPORT_SYMBOL(qe_issue_cmd);
163161
*/
164162
static unsigned int brg_clk = 0;
165163

164+
#define CLK_GRAN (1000)
165+
#define CLK_GRAN_LIMIT (5)
166+
166167
unsigned int qe_get_brg_clk(void)
167168
{
168169
struct device_node *qe;
169170
int size;
170171
const u32 *prop;
172+
unsigned int mod;
171173

172174
if (brg_clk)
173175
return brg_clk;
@@ -185,10 +187,22 @@ unsigned int qe_get_brg_clk(void)
185187

186188
of_node_put(qe);
187189

190+
/* round this if near to a multiple of CLK_GRAN */
191+
mod = brg_clk % CLK_GRAN;
192+
if (mod) {
193+
if (mod < CLK_GRAN_LIMIT)
194+
brg_clk -= mod;
195+
else if (mod > (CLK_GRAN - CLK_GRAN_LIMIT))
196+
brg_clk += CLK_GRAN - mod;
197+
}
198+
188199
return brg_clk;
189200
}
190201
EXPORT_SYMBOL(qe_get_brg_clk);
191202

203+
#define PVR_VER_836x 0x8083
204+
#define PVR_VER_832x 0x8084
205+
192206
/* Program the BRG to the given sampling rate and multiplier
193207
*
194208
* @brg: the BRG, QE_BRG1 - QE_BRG16
@@ -215,8 +229,9 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier)
215229
/* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says
216230
that the BRG divisor must be even if you're not using divide-by-16
217231
mode. */
218-
if (!div16 && (divisor & 1) && (divisor > 3))
219-
divisor++;
232+
if (pvr_version_is(PVR_VER_836x) || pvr_version_is(PVR_VER_832x))
233+
if (!div16 && (divisor & 1) && (divisor > 3))
234+
divisor++;
220235

221236
tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) |
222237
QE_BRGC_ENABLE | div16;

drivers/soc/fsl/qe/qe_tdm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm,
177177
devm_iounmap(&pdev->dev, utdm->si_regs);
178178
return ret;
179179
}
180+
EXPORT_SYMBOL(ucc_of_parse_tdm);
180181

181182
void ucc_tdm_init(struct ucc_tdm *utdm, struct ucc_tdm_info *ut_info)
182183
{
@@ -274,3 +275,4 @@ void ucc_tdm_init(struct ucc_tdm *utdm, struct ucc_tdm_info *ut_info)
274275
break;
275276
}
276277
}
278+
EXPORT_SYMBOL(ucc_tdm_init);

include/soc/fsl/qe/immap_qe.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -464,25 +464,6 @@ struct qe_immap {
464464
} __attribute__ ((packed));
465465

466466
extern struct qe_immap __iomem *qe_immr;
467-
extern phys_addr_t get_qe_base(void);
468-
469-
/*
470-
* Returns the offset within the QE address space of the given pointer.
471-
*
472-
* Note that the QE does not support 36-bit physical addresses, so if
473-
* get_qe_base() returns a number above 4GB, the caller will probably fail.
474-
*/
475-
static inline phys_addr_t immrbar_virt_to_phys(void *address)
476-
{
477-
void *q = (void *)qe_immr;
478-
479-
/* Is it a MURAM address? */
480-
if ((address >= q) && (address < (q + QE_IMMAP_SIZE)))
481-
return get_qe_base() + (address - q);
482-
483-
/* It's an address returned by kmalloc */
484-
return virt_to_phys(address);
485-
}
486467

487468
#endif /* __KERNEL__ */
488469
#endif /* _ASM_POWERPC_IMMAP_QE_H */

include/soc/fsl/qe/qe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ static inline int qe_alive_during_sleep(void)
243243
#define qe_muram_free cpm_muram_free
244244
#define qe_muram_addr cpm_muram_addr
245245
#define qe_muram_offset cpm_muram_offset
246+
#define qe_muram_dma cpm_muram_dma
246247

247248
#define qe_setbits32(_addr, _v) iowrite32be(ioread32be(_addr) | (_v), (_addr))
248249
#define qe_clrbits32(_addr, _v) iowrite32be(ioread32be(_addr) & ~(_v), (_addr))

0 commit comments

Comments
 (0)