serial-sh770x.c 838 B

123456789101112131415161718192021222324252627282930313233
  1. #include <linux/serial_sci.h>
  2. #include <linux/serial_core.h>
  3. #include <linux/io.h>
  4. #include <cpu/serial.h>
  5. #define SCPCR 0xA4000116
  6. #define SCPDR 0xA4000136
  7. static void sh770x_sci_init_pins(struct uart_port *port, unsigned int cflag)
  8. {
  9. unsigned short data;
  10. /* We need to set SCPCR to enable RTS/CTS */
  11. data = __raw_readw(SCPCR);
  12. /* Clear out SCP7MD1,0, SCP6MD1,0, SCP4MD1,0*/
  13. __raw_writew(data & 0x0fcf, SCPCR);
  14. if (!(cflag & CRTSCTS)) {
  15. /* We need to set SCPCR to enable RTS/CTS */
  16. data = __raw_readw(SCPCR);
  17. /* Clear out SCP7MD1,0, SCP4MD1,0,
  18. Set SCP6MD1,0 = {01} (output) */
  19. __raw_writew((data & 0x0fcf) | 0x1000, SCPCR);
  20. data = __raw_readb(SCPDR);
  21. /* Set /RTS2 (bit6) = 0 */
  22. __raw_writeb(data & 0xbf, SCPDR);
  23. }
  24. }
  25. struct plat_sci_port_ops sh770x_sci_port_ops = {
  26. .init_pins = sh770x_sci_init_pins,
  27. };