65
65
SCIx_RXI_IRQ ,
66
66
SCIx_TXI_IRQ ,
67
67
SCIx_BRI_IRQ ,
68
- SCIx_TEIDRI_IRQ ,
68
+ SCIx_DRI_IRQ ,
69
+ SCIx_TEI_IRQ ,
69
70
SCIx_NR_IRQS ,
70
71
71
72
SCIx_MUX_IRQ = SCIx_NR_IRQS , /* special case */
77
78
((port)->irqs[SCIx_ERI_IRQ] && \
78
79
((port)->irqs[SCIx_RXI_IRQ] < 0))
79
80
80
- #define SCIx_TEIDRI_IRQ_EXISTS (port ) \
81
- ((port)->irqs[SCIx_TEIDRI_IRQ] > 0)
82
-
83
81
enum SCI_CLKS {
84
82
SCI_FCK , /* Functional Clock */
85
83
SCI_SCK , /* Optional External Clock */
@@ -1685,14 +1683,23 @@ static irqreturn_t sci_tx_interrupt(int irq, void *ptr)
1685
1683
return IRQ_HANDLED ;
1686
1684
}
1687
1685
1688
- static irqreturn_t sci_br_interrupt (int irq , void * ptr );
1686
+ static irqreturn_t sci_br_interrupt (int irq , void * ptr )
1687
+ {
1688
+ struct uart_port * port = ptr ;
1689
+
1690
+ /* Handle BREAKs */
1691
+ sci_handle_breaks (port );
1692
+ sci_clear_SCxSR (port , SCxSR_BREAK_CLEAR (port ));
1693
+
1694
+ return IRQ_HANDLED ;
1695
+ }
1689
1696
1690
1697
static irqreturn_t sci_er_interrupt (int irq , void * ptr )
1691
1698
{
1692
1699
struct uart_port * port = ptr ;
1693
1700
struct sci_port * s = to_sci_port (port );
1694
1701
1695
- if (SCIx_TEIDRI_IRQ_EXISTS ( s ) ) {
1702
+ if (s -> irqs [ SCIx_ERI_IRQ ] == s -> irqs [ SCIx_BRI_IRQ ] ) {
1696
1703
/* Break and Error interrupts are muxed */
1697
1704
unsigned short ssr_status = serial_port_in (port , SCxSR );
1698
1705
@@ -1727,17 +1734,6 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr)
1727
1734
return IRQ_HANDLED ;
1728
1735
}
1729
1736
1730
- static irqreturn_t sci_br_interrupt (int irq , void * ptr )
1731
- {
1732
- struct uart_port * port = ptr ;
1733
-
1734
- /* Handle BREAKs */
1735
- sci_handle_breaks (port );
1736
- sci_clear_SCxSR (port , SCxSR_BREAK_CLEAR (port ));
1737
-
1738
- return IRQ_HANDLED ;
1739
- }
1740
-
1741
1737
static irqreturn_t sci_mpxed_interrupt (int irq , void * ptr )
1742
1738
{
1743
1739
unsigned short ssr_status , scr_status , err_enabled , orer_status = 0 ;
@@ -1811,6 +1807,16 @@ static const struct sci_irq_desc {
1811
1807
.handler = sci_br_interrupt ,
1812
1808
},
1813
1809
1810
+ [SCIx_DRI_IRQ ] = {
1811
+ .desc = "rx ready" ,
1812
+ .handler = sci_rx_interrupt ,
1813
+ },
1814
+
1815
+ [SCIx_TEI_IRQ ] = {
1816
+ .desc = "tx end" ,
1817
+ .handler = sci_tx_interrupt ,
1818
+ },
1819
+
1814
1820
/*
1815
1821
* Special muxed handler.
1816
1822
*/
@@ -1823,12 +1829,19 @@ static const struct sci_irq_desc {
1823
1829
static int sci_request_irq (struct sci_port * port )
1824
1830
{
1825
1831
struct uart_port * up = & port -> port ;
1826
- int i , j , ret = 0 ;
1832
+ int i , j , w , ret = 0 ;
1827
1833
1828
1834
for (i = j = 0 ; i < SCIx_NR_IRQS ; i ++ , j ++ ) {
1829
1835
const struct sci_irq_desc * desc ;
1830
1836
int irq ;
1831
1837
1838
+ /* Check if already registered (muxed) */
1839
+ for (w = 0 ; w < i ; w ++ )
1840
+ if (port -> irqs [w ] == port -> irqs [i ])
1841
+ w = i + 1 ;
1842
+ if (w > i )
1843
+ continue ;
1844
+
1832
1845
if (SCIx_IRQ_IS_MUXED (port )) {
1833
1846
i = SCIx_MUX_IRQ ;
1834
1847
irq = up -> irq ;
@@ -1844,32 +1857,8 @@ static int sci_request_irq(struct sci_port *port)
1844
1857
}
1845
1858
1846
1859
desc = sci_irq_desc + i ;
1847
- port -> irqstr [j ] = NULL ;
1848
- if (SCIx_TEIDRI_IRQ_EXISTS (port )) {
1849
- /*
1850
- * ERI and BRI are muxed, just register ERI and
1851
- * ignore BRI.
1852
- * TEI and DRI are muxed, but only DRI
1853
- * is enabled, so use RXI handler
1854
- */
1855
- if (i == SCIx_ERI_IRQ )
1856
- port -> irqstr [j ] = kasprintf (GFP_KERNEL ,
1857
- "%s:err + break" ,
1858
- dev_name (up -> dev ));
1859
- if (i == SCIx_BRI_IRQ )
1860
- continue ;
1861
- if (i == SCIx_TEIDRI_IRQ ) {
1862
- port -> irqstr [j ] = kasprintf (GFP_KERNEL ,
1863
- "%s:tx end + rx ready" ,
1864
- dev_name (up -> dev ));
1865
- desc = sci_irq_desc + SCIx_RXI_IRQ ;
1866
- }
1867
- }
1868
-
1869
- if (!port -> irqstr [j ])
1870
- port -> irqstr [j ] = kasprintf (GFP_KERNEL , "%s:%s" ,
1871
- dev_name (up -> dev ),
1872
- desc -> desc );
1860
+ port -> irqstr [j ] = kasprintf (GFP_KERNEL , "%s:%s" ,
1861
+ dev_name (up -> dev ), desc -> desc );
1873
1862
if (!port -> irqstr [j ]) {
1874
1863
ret = - ENOMEM ;
1875
1864
goto out_nomem ;
@@ -2842,17 +2831,17 @@ static int sci_init_single(struct platform_device *dev,
2842
2831
2843
2832
/* The SCI generates several interrupts. They can be muxed together or
2844
2833
* connected to different interrupt lines. In the muxed case only one
2845
- * interrupt resource is specified. In the non-muxed case three or four
2846
- * interrupt resources are specified, as the BRI interrupt is optional.
2834
+ * interrupt resource is specified as there is only one interrupt ID.
2835
+ * In the non-muxed case, up to 6 interrupt signals might be generated
2836
+ * from the SCI, however those signals might have their own individual
2837
+ * interrupt ID numbers, or muxed together with another interrupt.
2847
2838
*/
2848
2839
if (sci_port -> irqs [0 ] < 0 )
2849
2840
return - ENXIO ;
2850
2841
2851
- if (sci_port -> irqs [1 ] < 0 ) {
2852
- sci_port -> irqs [1 ] = sci_port -> irqs [0 ];
2853
- sci_port -> irqs [2 ] = sci_port -> irqs [0 ];
2854
- sci_port -> irqs [3 ] = sci_port -> irqs [0 ];
2855
- }
2842
+ if (sci_port -> irqs [1 ] < 0 )
2843
+ for (i = 1 ; i < ARRAY_SIZE (sci_port -> irqs ); i ++ )
2844
+ sci_port -> irqs [i ] = sci_port -> irqs [0 ];
2856
2845
2857
2846
sci_port -> params = sci_probe_regmap (p );
2858
2847
if (unlikely (sci_port -> params == NULL ))
0 commit comments