@@ -1633,8 +1633,10 @@ static int sam_interrupt(int irq, void *context, void *arg)
1633
1633
1634
1634
static int sam_ioctl (struct file * filep , int cmd , unsigned long arg )
1635
1635
{
1636
+ #if defined(CONFIG_SERIAL_TERMIOS ) || defined(CONFIG_SERIAL_TIOCSERGSTRUCT )
1636
1637
struct inode * inode = filep -> f_inode ;
1637
1638
struct uart_dev_s * dev = inode -> i_private ;
1639
+ #endif
1638
1640
int ret = OK ;
1639
1641
1640
1642
switch (cmd )
@@ -1814,62 +1816,6 @@ static int sam_ioctl(struct file *filep, int cmd, unsigned long arg)
1814
1816
break ;
1815
1817
#endif /* CONFIG_SERIAL_TERMIOS */
1816
1818
1817
- case TIOCSLINID :
1818
- {
1819
- /* Switch USART to LIN mode -> Set identifier register -> This will
1820
- * issue a LIN header -> Restore USART mode
1821
- */
1822
-
1823
- struct sam_dev_s * priv = (struct sam_dev_s * )dev -> priv ;
1824
- uint32_t regvalsave = 0 ;
1825
- uint32_t regval = 0 ;
1826
-
1827
- /* Save actual configuration */
1828
-
1829
- regvalsave = sam_serialin (priv , SAM_UART_MR_OFFSET );
1830
-
1831
- /* Issue a LIN header (Master mode only) */
1832
-
1833
- regval = regvalsave & ~UART_MR_MODE_MASK ;
1834
- regval |= UART_MR_MODE_LINMSTR ;
1835
- sam_serialout (priv , SAM_UART_MR_OFFSET , regval );
1836
-
1837
- /* Reset transaction status bits */
1838
-
1839
- sam_serialout (priv , SAM_UART_CR_OFFSET , UART_CR_RSTSTA );
1840
-
1841
- /* Write LIN ID to trigger header transmission */
1842
-
1843
- regval = UART_LINIR_MASK & (uint8_t )arg ;
1844
- sam_serialout (priv , SAM_UART_LINIR_OFFSET , regval );
1845
-
1846
- /* Wait until the header is on the wire */
1847
-
1848
- do
1849
- {
1850
- /* Header takes 34 bits to transmit so poll with 34 / 4 = 8 bits
1851
- * cycle time
1852
- *
1853
- * TODO: Interrupt + semaphore can be used instead of busy
1854
- * waiting to improve CPU utilization
1855
- */
1856
-
1857
- nxsig_usleep ((8 * 1000 * 1000 ) / priv -> baud );
1858
-
1859
- regval = sam_serialin (priv , SAM_UART_SR_OFFSET );
1860
- }
1861
- while ((regval & UART_INT_LINID ) == 0 );
1862
-
1863
- /* Reset transaction status bits */
1864
-
1865
- sam_serialout (priv , SAM_UART_CR_OFFSET , UART_CR_RSTSTA );
1866
-
1867
- /* Restore USART mode */
1868
-
1869
- sam_serialout (priv , SAM_UART_MR_OFFSET , regvalsave );
1870
- }
1871
- break ;
1872
-
1873
1819
default :
1874
1820
ret = - ENOTTY ;
1875
1821
break ;
0 commit comments