From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Simon Horman <horms@verge.net.au>,
Magnus Damm <magnus.damm@gmail.com>,
Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: linux-serial@vger.kernel.org, linux-sh@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH v3 17/27] serial: sh-sci: Add BRG register definitions
Date: Mon, 14 Dec 2015 18:57:26 +0000 [thread overview]
Message-ID: <1450119456-964-18-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1450119456-964-1-git-send-email-geert+renesas@glider.be>
Add register definitions for the Baud Rate Generator for External Clock
(BRG), as found in some SCIF and in HSCIF, including a new regtype for
the "SH-4(A)"-derived SCIF variant with BRG.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
v3:
- Add Acked-by,
- Add comment clarifying frequency divided SC_CLK vs. undivided
(H)SCK.
---
drivers/tty/serial/sh-sci.c | 46 +++++++++++++++++++++++++++++++++++++++++++++
drivers/tty/serial/sh-sci.h | 10 ++++++++++
include/linux/serial_sci.h | 1 +
3 files changed, 57 insertions(+)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 5b120757c02a555a..fb5eac2e3182304d 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -161,6 +161,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = sci_reg_invalid,
[SCPDR] = sci_reg_invalid,
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
},
/*
@@ -183,6 +185,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = sci_reg_invalid,
[SCPDR] = sci_reg_invalid,
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
},
/*
@@ -204,6 +208,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = { 0x30, 16 },
[SCPDR] = { 0x34, 16 },
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
},
/*
@@ -225,6 +231,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = { 0x30, 16 },
[SCPDR] = { 0x34, 16 },
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
},
/*
@@ -247,6 +255,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = sci_reg_invalid,
[SCPDR] = sci_reg_invalid,
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
},
/*
@@ -268,6 +278,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = sci_reg_invalid,
[SCPDR] = sci_reg_invalid,
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
},
/*
@@ -289,6 +301,32 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = sci_reg_invalid,
[SCPDR] = sci_reg_invalid,
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
+ },
+
+ /*
+ * Common SCIF definitions for ports with a Baud Rate Generator for
+ * External Clock (BRG).
+ */
+ [SCIx_SH4_SCIF_BRG_REGTYPE] = {
+ [SCSMR] = { 0x00, 16 },
+ [SCBRR] = { 0x04, 8 },
+ [SCSCR] = { 0x08, 16 },
+ [SCxTDR] = { 0x0c, 8 },
+ [SCxSR] = { 0x10, 16 },
+ [SCxRDR] = { 0x14, 8 },
+ [SCFCR] = { 0x18, 16 },
+ [SCFDR] = { 0x1c, 16 },
+ [SCTFDR] = sci_reg_invalid,
+ [SCRFDR] = sci_reg_invalid,
+ [SCSPTR] = { 0x20, 16 },
+ [SCLSR] = { 0x24, 16 },
+ [HSSRR] = sci_reg_invalid,
+ [SCPCR] = sci_reg_invalid,
+ [SCPDR] = sci_reg_invalid,
+ [SCDL] = { 0x30, 16 },
+ [SCCKS] = { 0x34, 16 },
},
/*
@@ -310,6 +348,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = { 0x40, 16 },
[SCPCR] = sci_reg_invalid,
[SCPDR] = sci_reg_invalid,
+ [SCDL] = { 0x30, 16 },
+ [SCCKS] = { 0x34, 16 },
},
/*
@@ -332,6 +372,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = sci_reg_invalid,
[SCPDR] = sci_reg_invalid,
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
},
/*
@@ -354,6 +396,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = sci_reg_invalid,
[SCPDR] = sci_reg_invalid,
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
},
/*
@@ -376,6 +420,8 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
[HSSRR] = sci_reg_invalid,
[SCPCR] = sci_reg_invalid,
[SCPDR] = sci_reg_invalid,
+ [SCDL] = sci_reg_invalid,
+ [SCCKS] = sci_reg_invalid,
},
};
diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
index bf69bbdcc1f9aa39..fb176025042185c4 100644
--- a/drivers/tty/serial/sh-sci.h
+++ b/drivers/tty/serial/sh-sci.h
@@ -27,6 +27,8 @@ enum {
HSSRR, /* Sampling Rate Register */
SCPCR, /* Serial Port Control Register */
SCPDR, /* Serial Port Data Register */
+ SCDL, /* BRG Frequency Division Register */
+ SCCKS, /* BRG Clock Select Register */
SCIx_NR_REGS,
};
@@ -109,6 +111,14 @@ enum {
#define SCPDR_RTSD BIT(4) /* Serial Port RTS Output Pin Data */
#define SCPDR_CTSD BIT(3) /* Serial Port CTS Input Pin Data */
+/*
+ * BRG Clock Select Register (Some SCIF and HSCIF)
+ * The Baud Rate Generator for external clock can provide a clock source for
+ * the sampling clock. It outputs either its frequency divided clock, or the
+ * (undivided) (H)SCK external clock.
+ */
+#define SCCKS_CKS BIT(15) /* Select (H)SCK (1) or divided SC_CLK (0) */
+#define SCCKS_XIN BIT(14) /* SC_CLK uses bus clock (1) or SCIF_CLK (0) */
#define SCxSR_TEND(port) (((port)->type = PORT_SCI) ? SCI_TEND : SCIF_TEND)
#define SCxSR_RDxF(port) (((port)->type = PORT_SCI) ? SCI_RDRF : SCIF_RDF)
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 7c536ac5be05d3aa..9f2bfd0557429ac3 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -32,6 +32,7 @@ enum {
SCIx_SH2_SCIF_FIFODATA_REGTYPE,
SCIx_SH3_SCIF_REGTYPE,
SCIx_SH4_SCIF_REGTYPE,
+ SCIx_SH4_SCIF_BRG_REGTYPE,
SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
SCIx_SH4_SCIF_FIFODATA_REGTYPE,
SCIx_SH7705_SCIF_REGTYPE,
--
1.9.1
next prev parent reply other threads:[~2015-12-14 18:57 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-14 18:57 [PATCH v3 00/27] serial: sh-sci: External Clock Support Geert Uytterhoeven
[not found] ` <1450119456-964-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2015-12-14 18:57 ` [PATCH v3 01/27] serial: sh-sci: Drop the interface clock Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 20/27] serial: sh-sci: Correct SCIF type on R-Car for BRG Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 02/27] serial: sh-sci: Add fallback compatibility strings Geert Uytterhoeven
2015-12-20 3:39 ` Rob Herring
2015-12-14 18:57 ` [PATCH v3 03/27] serial: sh-sci: Update DT binding documentation for external clock input Geert Uytterhoeven
2015-12-20 3:39 ` Rob Herring
2015-12-14 18:57 ` [PATCH v3 04/27] serial: sh-sci: Update DT binding documentation for BRG support Geert Uytterhoeven
2015-12-20 3:39 ` Rob Herring
2015-12-14 18:57 ` [PATCH v3 05/27] serial: sh-sci: Drop useless check for zero sampling_rate Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 06/27] serial: sh-sci: Grammar s/Get ... for/Get ... from/ Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 07/27] serial: sh-sci: Use existing local variable in sci_parse_dt() Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 08/27] serial: sh-sci: Drop unused frame_len parameter for sci_baud_calc_hscif() Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 09/27] serial: sh-sci: Don't overwrite clock selection in serial_console_write() Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 10/27] serial: sh-sci: Convert from clk_get() to devm_clk_get() Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 11/27] serial: sh-sci: Make unsigned values in sci_baud_calc_hscif() unsigned Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 12/27] serial: sh-sci: Avoid overflow in sci_baud_calc_hscif() Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 13/27] serial: sh-sci: Improve bit rate error calculation for HSCIF Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 14/27] serial: sh-sci: Avoid calculating the receive margin " Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 15/27] serial: sh-sci: Merge sci_scbrr_calc() and sci_baud_calc_hscif() Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 16/27] serial: sh-sci: Take into account sampling rate for max baud rate Geert Uytterhoeven
2015-12-14 18:57 ` Geert Uytterhoeven [this message]
2015-12-14 18:57 ` [PATCH v3 18/27] serial: sh-sci: Replace struct sci_port_info by type/regtype encoding Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 19/27] serial: sh-sci: Correct SCIF type on RZ/A1H Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 21/27] serial: sh-sci: Prepare for multiple sampling clock sources Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 22/27] serial: sh-sci: Add support for optional external (H)SCK input Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 23/27] serial: sh-sci: Add support for optional BRG on (H)SCIF Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 24/27] sh: Rename sci_ick and sci_fck clock to fck Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 25/27] sh: Remove sci_ick clock alias Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 26/27] sh: sh7734: Correct SCIF type for BRG Geert Uytterhoeven
2015-12-14 18:57 ` [PATCH v3 27/27] serial: sh-sci: Drop the sci_fck clock fallback Geert Uytterhoeven
2015-12-15 4:53 ` [PATCH v3 00/27] serial: sh-sci: External Clock Support Simon Horman
2015-12-15 5:23 ` Greg Kroah-Hartman
2015-12-15 13:54 ` Geert Uytterhoeven
2015-12-17 10:28 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450119456-964-18-git-send-email-geert+renesas@glider.be \
--to=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=horms@verge.net.au \
--cc=linux-serial@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).