Skip to contentSkip to conversation

serial: sh-sci: Add support SCIF of SH7723

PATCH In review Nobuhiro Iwamatsu 2 participants 2 messages Oct 3, 2008 – Oct 20, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: sh-sci: Add support SCIF of SH7723

SH7723 has two types of SCIF (SCIF and SCIFA).
The current sh-sci driver supports only SCIFA, and calculation methods of SCBRR are different.
This patch support this methods.

---
 drivers/serial/sh-sci.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/serial/sh-sci.h +8 -1
index 8a0749e..0dfd966 100644
@@ -791,7 +791,14 @@ static inline int sci_rxd_in(struct uart_port *port)
       defined(CONFIG_CPU_SUBTYPE_SH7721)
 #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
 #elif defined(CONFIG_CPU_SUBTYPE_SH7723)
-#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(16*bps)-1)
+static inline int scbrr_calc(struct uart_port *port, int bps, int clk)
+{
+	if (port->type = PORT_SCIF)
+		return (clk+16*bps)/(32*bps)-1;
+	else
+		return ((clk*2)+16*bps)/(16*bps)-1;
+}
+#define SCBRR_VALUE(bps, clk) scbrr_calc(port, bps, clk)
 #elif defined(__H8300H__) || defined(__H8300S__)
 #define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1)
 #elif defined(CONFIG_SUPERH64)

-- 1.5.6.3

#1 lore raw
Quoted 6 lines · Nobuhiro Iwamatsu

SH7723 has two types of SCIF (SCIF and SCIFA).
The current sh-sci driver supports only SCIFA, and calculation methods of SCBRR are different.
This patch support this methods.

Ok, applied. I have a large rewrite of sh-sci pending, but there is no harm in merging this for 2.6.28.