serial-sh7720.c 1.1 KB

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