serial-sh7720.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <linux/serial_sci.h>
  2. #include <linux/serial_core.h>
  3. #include <linux/io.h>
  4. #include <cpu/serial.h>
  5. #include <cpu/gpio.h>
  6. static void sh7720_sci_init_pins(struct uart_port *port, unsigned int cflag)
  7. {
  8. unsigned short data;
  9. if (cflag & CRTSCTS) {
  10. /* enable RTS/CTS */
  11. if (port->mapbase == 0xa4430000) { /* SCIF0 */
  12. /* Clear PTCR bit 9-2; enable all scif pins but sck */
  13. data = __raw_readw(PORT_PTCR);
  14. __raw_writew((data & 0xfc03), PORT_PTCR);
  15. } else if (port->mapbase == 0xa4438000) { /* SCIF1 */
  16. /* Clear PVCR bit 9-2 */
  17. data = __raw_readw(PORT_PVCR);
  18. __raw_writew((data & 0xfc03), PORT_PVCR);
  19. }
  20. } else {
  21. if (port->mapbase == 0xa4430000) { /* SCIF0 */
  22. /* Clear PTCR bit 5-2; enable only tx and rx */
  23. data = __raw_readw(PORT_PTCR);
  24. __raw_writew((data & 0xffc3), PORT_PTCR);
  25. } else if (port->mapbase == 0xa4438000) { /* SCIF1 */
  26. /* Clear PVCR bit 5-2 */
  27. data = __raw_readw(PORT_PVCR);
  28. __raw_writew((data & 0xffc3), PORT_PVCR);
  29. }
  30. }
  31. }
  32. struct plat_sci_port_ops sh7720_sci_port_ops = {
  33. .init_pins = sh7720_sci_init_pins,
  34. };