Skip to contentSkip to conversation

pinctrl: sh-pfc: Retain TDSELCTRL register across suspend/resume

PATCH Superseded [email protected] 2 participants 9 messages Feb 16, 2019 – Feb 18, 2019 Pin control

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: sh-pfc: Retain TDSELCTRL register across suspend/resume

From: Marek Vasut <[email protected]>

The TDSELCTRL register is responsible for configuring the SDHI clock return path delay and may be adjusted by the bootloader. Retain the value across suspend/resume to prevent hardware instability after resume.

Cc Geert Uytterhoeven <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Simon Horman <[email protected]>
Cc Wolfram Sang <[email protected]>

To: [email protected]

---
 drivers/pinctrl/sh-pfc/core.c            |  4 ++++
 drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c | 10 ++++++++++
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c     | 10 ++++++++++
 drivers/pinctrl/sh-pfc/pfc-r8a7796.c     | 11 +++++++++++
 drivers/pinctrl/sh-pfc/pfc-r8a77965.c    | 10 ++++++++++
 drivers/pinctrl/sh-pfc/pfc-r8a77970.c    |  9 +++++++++
 drivers/pinctrl/sh-pfc/pfc-r8a77980.c    |  9 +++++++++
 drivers/pinctrl/sh-pfc/pfc-r8a77990.c    | 11 +++++++++++
 drivers/pinctrl/sh-pfc/sh_pfc.h          |  5 +++++
 9 files changed, 79 insertions(+)
drivers/pinctrl/sh-pfc/core.c +4 -0
index f1cfcc8c6544..d23cedbd58d4 100644
@@ -657,6 +657,10 @@ static unsigned int sh_pfc_walk_regs(struct sh_pfc *pfc,
 		for (i = 0; pfc->info->ioctrl_regs[i].reg; i++)
 			do_reg(pfc, pfc->info->ioctrl_regs[i].reg, n++);
 
+	if (pfc->info->tdsel_regs)
+		for (i = 0; pfc->info->tdsel_regs[i].reg; i++)
+			do_reg(pfc, pfc->info->tdsel_regs[i].reg, n++);
+
 	return n;
 }
 
drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c +10 -0
index 287cfbb7e992..d5aa18705b6c 100644
@@ -5570,6 +5570,15 @@ static int r8a7795es1_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
 	return bit;
 }
 
+enum tdsel_regs {
+	TDSELCTRL0,
+};
+
+static const struct pinmux_tdsel_reg pinmux_tdsel_regs[] = {
+	[TDSELCTRL0] = { 0xe60603c0, },
+	{ /* sentinel */ },
+};
+
 static const struct pinmux_bias_reg pinmux_bias_regs[] = {
 	{ PINMUX_BIAS_REG("PUEN0", 0xe6060400, "PUD0", 0xe6060440) {
 		[ 0] = PIN_NUMBER('W', 3),	/* QSPI0_SPCLK */
@@ -5877,6 +5886,7 @@ const struct sh_pfc_soc_info r8a7795es1_pinmux_info = {
 	.drive_regs = pinmux_drive_regs,
 	.bias_regs = pinmux_bias_regs,
 	.ioctrl_regs = pinmux_ioctrl_regs,
+	.tdsel_regs = pinmux_tdsel_regs,
 
 	.pinmux_data = pinmux_data,
 	.pinmux_data_size = ARRAY_SIZE(pinmux_data),
drivers/pinctrl/sh-pfc/pfc-r8a7795.c +10 -0
index db9add1405c5..7c21186cf624 100644
@@ -5919,6 +5919,15 @@ static int r8a7795_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *poc
 	return bit;
 }
 
+enum tdsel_regs {
+	TDSELCTRL0,
+};
+
+static const struct pinmux_tdsel_reg pinmux_tdsel_regs[] = {
+	[TDSELCTRL0] = { 0xe60603c0, },
+	{ /* sentinel */ },
+};
+
 static const struct pinmux_bias_reg pinmux_bias_regs[] = {
 	{ PINMUX_BIAS_REG("PUEN0", 0xe6060400, "PUD0", 0xe6060440) {
 		[ 0] = PIN_NUMBER('W', 3),	/* QSPI0_SPCLK */
@@ -6240,6 +6249,7 @@ const struct sh_pfc_soc_info r8a7795_pinmux_info = {
 	.drive_regs = pinmux_drive_regs,
 	.bias_regs = pinmux_bias_regs,
 	.ioctrl_regs = pinmux_ioctrl_regs,
+	.tdsel_regs = pinmux_tdsel_regs,
 
 	.pinmux_data = pinmux_data,
 	.pinmux_data_size = ARRAY_SIZE(pinmux_data),
drivers/pinctrl/sh-pfc/pfc-r8a7796.c +11 -0
index 72348a4f2ece..1e4854ae2262 100644
@@ -5877,6 +5877,15 @@ static int r8a7796_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *poc
 	return bit;
 }
 
+enum tdsel_regs {
+	TDSELCTRL0,
+};
+
+static const struct pinmux_tdsel_reg pinmux_tdsel_regs[] = {
+	[TDSELCTRL0] = { 0xe60603c0, },
+	{ /* sentinel */ },
+};
+
 static const struct pinmux_bias_reg pinmux_bias_regs[] = {
 	{ PINMUX_BIAS_REG("PUEN0", 0xe6060400, "PUD0", 0xe6060440) {
 		[ 0] = PIN_NUMBER('W', 3),	/* QSPI0_SPCLK */
@@ -6185,6 +6194,7 @@ const struct sh_pfc_soc_info r8a774a1_pinmux_info = {
 	.drive_regs = pinmux_drive_regs,
 	.bias_regs = pinmux_bias_regs,
 	.ioctrl_regs = pinmux_ioctrl_regs,
+	.tdsel_regs = pinmux_tdsel_regs,
 
 	.pinmux_data = pinmux_data,
 	.pinmux_data_size = ARRAY_SIZE(pinmux_data),
@@ -6212,6 +6222,7 @@ const struct sh_pfc_soc_info r8a7796_pinmux_info = {
 	.drive_regs = pinmux_drive_regs,
 	.bias_regs = pinmux_bias_regs,
 	.ioctrl_regs = pinmux_ioctrl_regs,
+	.tdsel_regs = pinmux_tdsel_regs,
 
 	.pinmux_data = pinmux_data,
 	.pinmux_data_size = ARRAY_SIZE(pinmux_data),
drivers/pinctrl/sh-pfc/pfc-r8a77965.c +10 -0
index 14c4b671cddf..e3447fe7b7ae 100644
@@ -6034,6 +6034,15 @@ static int r8a77965_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *po
 	return bit;
 }
 
+enum tdsel_regs {
+	TDSELCTRL0,
+};
+
+static const struct pinmux_tdsel_reg pinmux_tdsel_regs[] = {
+	[TDSELCTRL0] = { 0xe60603c0, },
+	{ /* sentinel */ },
+};
+
 static const struct pinmux_bias_reg pinmux_bias_regs[] = {
 	{ PINMUX_BIAS_REG("PUEN0", 0xe6060400, "PUD0", 0xe6060440) {
 		[ 0] = PIN_NUMBER('W', 3),	/* QSPI0_SPCLK */
@@ -6341,6 +6350,7 @@ const struct sh_pfc_soc_info r8a77965_pinmux_info = {
 	.drive_regs = pinmux_drive_regs,
 	.bias_regs = pinmux_bias_regs,
 	.ioctrl_regs = pinmux_ioctrl_regs,
+	.tdsel_regs = pinmux_tdsel_regs,
 
 	.pinmux_data = pinmux_data,
 	.pinmux_data_size = ARRAY_SIZE(pinmux_data),
drivers/pinctrl/sh-pfc/pfc-r8a77970.c +9 -0
index c5e67ba29f7c..55f68e53caae 100644
@@ -2438,6 +2438,15 @@ static int r8a77970_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
 	return -EINVAL;
 }
 
+enum tdsel_regs {
+	TDSELCTRL0,
+};
+
+static const struct pinmux_tdsel_reg pinmux_tdsel_regs[] = {
+	[TDSELCTRL0] = { 0xe60603c0, },
+	{ /* sentinel */ },
+};
+
 static const struct sh_pfc_soc_operations pinmux_ops = {
 	.pin_to_pocctrl = r8a77970_pin_to_pocctrl,
 };
drivers/pinctrl/sh-pfc/pfc-r8a77980.c +9 -0
index b807b67ae143..e892c0eeb203 100644
@@ -2867,6 +2867,15 @@ static int r8a77980_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
 	return -EINVAL;
 }
 
+enum tdsel_regs {
+	TDSELCTRL0,
+};
+
+static const struct pinmux_tdsel_reg pinmux_tdsel_regs[] = {
+	[TDSELCTRL0] = { 0xe60603c0, },
+	{ /* sentinel */ },
+};
+
 static const struct sh_pfc_soc_operations pinmux_ops = {
 	.pin_to_pocctrl = r8a77980_pin_to_pocctrl,
 };
drivers/pinctrl/sh-pfc/pfc-r8a77990.c +11 -0
index 151640c30e9d..2a3f05c6b365 100644
@@ -5019,6 +5019,15 @@ static int r8a77990_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
 	return bit;
 }
 
+enum tdsel_regs {
+	TDSELCTRL0,
+};
+
+static const struct pinmux_tdsel_reg pinmux_tdsel_regs[] = {
+	[TDSELCTRL0] = { 0xe60603c0, },
+	{ /* sentinel */ },
+};
+
 static const struct pinmux_bias_reg pinmux_bias_regs[] = {
 	{ PINMUX_BIAS_REG("PUEN0", 0xe6060400, "PUD0", 0xe6060440) {
 		 [0] = RCAR_GP_PIN(2, 23),	/* RD# */
@@ -5292,6 +5301,7 @@ const struct sh_pfc_soc_info r8a774c0_pinmux_info = {
 	.cfg_regs = pinmux_config_regs,
 	.bias_regs = pinmux_bias_regs,
 	.ioctrl_regs = pinmux_ioctrl_regs,
+	.tdsel_regs = pinmux_tdsel_regs,
 
 	.pinmux_data = pinmux_data,
 	.pinmux_data_size = ARRAY_SIZE(pinmux_data),
@@ -5318,6 +5328,7 @@ const struct sh_pfc_soc_info r8a77990_pinmux_info = {
 	.cfg_regs = pinmux_config_regs,
 	.bias_regs = pinmux_bias_regs,
 	.ioctrl_regs = pinmux_ioctrl_regs,
+	.tdsel_regs = pinmux_tdsel_regs,
 
 	.pinmux_data = pinmux_data,
 	.pinmux_data_size = ARRAY_SIZE(pinmux_data),
drivers/pinctrl/sh-pfc/sh_pfc.h +5 -0
index 56016cb76769..56e08f2c5cbf 100644
@@ -176,6 +176,10 @@ struct pinmux_ioctrl_reg {
 	u32 reg;
 };
 
+struct pinmux_tdsel_reg {
+	u32 reg;
+};
+
 struct pinmux_data_reg {
 	u32 reg;
 	u8 reg_width;
@@ -270,6 +274,7 @@ struct sh_pfc_soc_info {
 	const struct pinmux_drive_reg *drive_regs;
 	const struct pinmux_bias_reg *bias_regs;
 	const struct pinmux_ioctrl_reg *ioctrl_regs;
+	const struct pinmux_tdsel_reg *tdsel_regs;
 	const struct pinmux_data_reg *data_regs;
 
 	const u16 *pinmux_data;
Signature · 1 line
2.19.2
#1 lore raw

Hi Marek,

Quoted 6 lines · On Sat, Feb 16, 2019 at 2:49 PM <[email protected]> wrote:

The TDSELCTRL register is responsible for configuring the SDHI clock return path delay and may be adjusted by the bootloader. Retain the value across suspend/resume to prevent hardware instability after resume.

Thanks for your patch!

Looks good to me. Two comments though.

R-Car D3 (r8a77995) also has a TDSEL register, but it is not handled by your patch. Adding that would mean s/SDHI/SDHI and MMC/.

Quoted 27 lines
drivers/pinctrl/sh-pfc/core.c +4 -0
@@ -657,6 +657,10 @@ static unsigned int sh_pfc_walk_regs(struct sh_pfc *pfc,
                for (i = 0; pfc->info->ioctrl_regs[i].reg; i++)
                        do_reg(pfc, pfc->info->ioctrl_regs[i].reg, n++);
 
+       if (pfc->info->tdsel_regs)
+               for (i = 0; pfc->info->tdsel_regs[i].reg; i++)
+                       do_reg(pfc, pfc->info->tdsel_regs[i].reg, n++);
+
        return n;
 }
 
drivers/pinctrl/sh-pfc/sh_pfc.h +4 -0
@@ -176,6 +176,10 @@ struct pinmux_ioctrl_reg {
        u32 reg;
 };
 
+struct pinmux_tdsel_reg {
+       u32 reg;
+};
+
 struct pinmux_data_reg {
        u32 reg;
        u8 reg_width;

drivers/pinctrl/sh-pfc/sh_pfc.h struct sh_pfc_soc_info { · line 280

Quoted 7 lines
drivers/pinctrl/sh-pfc/sh_pfc.h +1 -0
@@ -270,6 +274,7 @@ struct sh_pfc_soc_info {
        const struct pinmux_drive_reg *drive_regs;
        const struct pinmux_bias_reg *bias_regs;
        const struct pinmux_ioctrl_reg *ioctrl_regs;
+       const struct pinmux_tdsel_reg *tdsel_regs;
        const struct pinmux_data_reg *data_regs;
 
        const u16 *pinmux_data;

Is there any special reason why you added a new block of registers with separate handling, instead of adding TDSEL to the existing pinmux_ioctrl_reg[] arrays, which list other IOCTRL registers like POCCTRL?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
Quoted 1 line · Geert Uytterhoeven

Hi Marek,

Hi,

Quoted 6 lines · On Sat, Feb 16, 2019 at 2:49 PM <[email protected]> wrote:
Quoted 5 lines

The TDSELCTRL register is responsible for configuring the SDHI clock return path delay and may be adjusted by the bootloader. Retain the value across suspend/resume to prevent hardware instability after resume.

Quoted 8 lines
Quoted 1 line

Thanks for your patch!

Looks good to me. Two comments though.

R-Car D3 (r8a77995) also has a TDSEL register, but it is not handled by your patch. Adding that would mean s/SDHI/SDHI and MMC/.

Added

Quoted 33 lines
Quoted 33 lines
drivers/pinctrl/sh-pfc/core.c +4 -0
@@ -657,6 +657,10 @@ static unsigned int sh_pfc_walk_regs(struct sh_pfc *pfc,
                for (i = 0; pfc->info->ioctrl_regs[i].reg; i++)
                        do_reg(pfc, pfc->info->ioctrl_regs[i].reg, n++);
 
+       if (pfc->info->tdsel_regs)
+               for (i = 0; pfc->info->tdsel_regs[i].reg; i++)
+                       do_reg(pfc, pfc->info->tdsel_regs[i].reg, n++);
+
        return n;
 }
 
drivers/pinctrl/sh-pfc/sh_pfc.h +5 -0
@@ -176,6 +176,10 @@ struct pinmux_ioctrl_reg {
        u32 reg;
 };
 
+struct pinmux_tdsel_reg {
+       u32 reg;
+};
+
 struct pinmux_data_reg {
        u32 reg;
        u8 reg_width;
@@ -270,6 +274,7 @@ struct sh_pfc_soc_info {
        const struct pinmux_drive_reg *drive_regs;
        const struct pinmux_bias_reg *bias_regs;
        const struct pinmux_ioctrl_reg *ioctrl_regs;
+       const struct pinmux_tdsel_reg *tdsel_regs;
        const struct pinmux_data_reg *data_regs;
 
Quoted 6 lines

drivers/pinctrl/sh-pfc/sh_pfc.h struct sh_pfc_soc_info { · line 280

Quoted 1 line
drivers/pinctrl/sh-pfc/sh_pfc.h +0 -0
        const u16 *pinmux_data;

Is there any special reason why you added a new block of registers with separate handling, instead of adding TDSEL to the existing pinmux_ioctrl_reg[] arrays, which list other IOCTRL registers like POCCTRL?

For one, It's unrelated register to POCCTRL, so I don't want to mix them together. The other reason is this r8a779*_pin_to_pocctrl(), which uses the ioctrl_regs[] array ; if I added the TDSEL there, that'd just make things extra confusing.

Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw

Hi Marek,

Quoted 9 lines · Marek Vasut
Quoted 8 lines · Geert Uytterhoeven
Quoted 6 lines · On Sat, Feb 16, 2019 at 2:49 PM <[email protected]> wrote:

The TDSELCTRL register is responsible for configuring the SDHI clock return path delay and may be adjusted by the bootloader. Retain the value across suspend/resume to prevent hardware instability after resume.

Quoted 8 lines
Quoted 6 lines

Thanks for your patch!

Looks good to me. Two comments though.

R-Car D3 (r8a77995) also has a TDSEL register, but it is not handled by your patch. Adding that would mean s/SDHI/SDHI and MMC/.

Added

Thanks!

Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
drivers/pinctrl/sh-pfc/core.c +4 -0
@@ -657,6 +657,10 @@ static unsigned int sh_pfc_walk_regs(struct sh_pfc *pfc,
                for (i = 0; pfc->info->ioctrl_regs[i].reg; i++)
                        do_reg(pfc, pfc->info->ioctrl_regs[i].reg, n++);
 
+       if (pfc->info->tdsel_regs)
+               for (i = 0; pfc->info->tdsel_regs[i].reg; i++)
+                       do_reg(pfc, pfc->info->tdsel_regs[i].reg, n++);
+
        return n;
 }
 
drivers/pinctrl/sh-pfc/sh_pfc.h +5 -0
@@ -176,6 +176,10 @@ struct pinmux_ioctrl_reg {
        u32 reg;
 };
 
+struct pinmux_tdsel_reg {
+       u32 reg;
+};
+
 struct pinmux_data_reg {
        u32 reg;
        u8 reg_width;
@@ -270,6 +274,7 @@ struct sh_pfc_soc_info {
        const struct pinmux_drive_reg *drive_regs;
        const struct pinmux_bias_reg *bias_regs;
        const struct pinmux_ioctrl_reg *ioctrl_regs;
+       const struct pinmux_tdsel_reg *tdsel_regs;
        const struct pinmux_data_reg *data_regs;
 
Quoted 8 lines
Quoted 6 lines

drivers/pinctrl/sh-pfc/sh_pfc.h struct sh_pfc_soc_info { · line 280

Quoted 1 line
drivers/pinctrl/sh-pfc/sh_pfc.h +0 -0
        const u16 *pinmux_data;

Is there any special reason why you added a new block of registers with separate handling, instead of adding TDSEL to the existing pinmux_ioctrl_reg[] arrays, which list other IOCTRL registers like POCCTRL?

For one, It's unrelated register to POCCTRL, so I don't want to mix them

That's why the array is called pinmux_ioctrl_reg[], not pinmux_pocctrl_reg[]:
it is meant to cover various I/O control registers, including POCCTRL and TDSEL, to be saved/restored for PSCI system suspend.

Quoted 3 lines

together. The other reason is this r8a779*_pin_to_pocctrl(), which uses the ioctrl_regs[] array ; if I added the TDSEL there, that'd just make things extra confusing.

How r8a779*_pin_to_pocctrl() gets the registers is an implementation detail, IMHO (The function used to contain hardcoded register addresses).

So I think you should just add the TDSEL registers to pinmux_ioctrl_reg[].

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#4 lore raw
Quoted 1 line · Geert Uytterhoeven

Hi Marek,

Hi,

[...]

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines

drivers/pinctrl/sh-pfc/sh_pfc.h struct sh_pfc_soc_info { · line 280

Quoted 11 lines
 struct pinmux_data_reg {
        u32 reg;
        u8 reg_width;
drivers/pinctrl/sh-pfc/sh_pfc.h +1 -0
@@ -270,6 +274,7 @@ struct sh_pfc_soc_info {
        const struct pinmux_drive_reg *drive_regs;
        const struct pinmux_bias_reg *bias_regs;
        const struct pinmux_ioctrl_reg *ioctrl_regs;
+       const struct pinmux_tdsel_reg *tdsel_regs;
        const struct pinmux_data_reg *data_regs;
 
        const u16 *pinmux_data;

Is there any special reason why you added a new block of registers with separate handling, instead of adding TDSEL to the existing pinmux_ioctrl_reg[] arrays, which list other IOCTRL registers like POCCTRL?

Quoted 5 lines
Quoted 1 line

For one, It's unrelated register to POCCTRL, so I don't want to mix them

That's why the array is called pinmux_ioctrl_reg[], not pinmux_pocctrl_reg[]:
it is meant to cover various I/O control registers, including POCCTRL and TDSEL, to be saved/restored for PSCI system suspend.

I thought the array is called pinmux_ioctrl_reg[] because that's what the pocctrl was called in older datasheets ? At least that's how you explained it on IRC last time.

Quoted 8 lines
Quoted 3 lines

together. The other reason is this r8a779*_pin_to_pocctrl(), which uses the ioctrl_regs[] array ; if I added the TDSEL there, that'd just make things extra confusing.

How r8a779*_pin_to_pocctrl() gets the registers is an implementation detail, IMHO (The function used to contain hardcoded register addresses).

So I think you should just add the TDSEL registers to pinmux_ioctrl_reg[].

If that's what you think is better and makes the driver less confusing, sure ...

Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

Hi Marek,

Quoted 20 lines · Marek Vasut
Quoted 19 lines · Geert Uytterhoeven
Quoted 18 lines
Quoted 10 lines
Quoted 10 lines
 struct pinmux_data_reg {
        u32 reg;
        u8 reg_width;
drivers/pinctrl/sh-pfc/sh_pfc.h +1 -0
@@ -270,6 +274,7 @@ struct sh_pfc_soc_info {
        const struct pinmux_drive_reg *drive_regs;
        const struct pinmux_bias_reg *bias_regs;
        const struct pinmux_ioctrl_reg *ioctrl_regs;
+       const struct pinmux_tdsel_reg *tdsel_regs;
        const struct pinmux_data_reg *data_regs;
 
Quoted 6 lines

drivers/pinctrl/sh-pfc/sh_pfc.h struct sh_pfc_soc_info { · line 280

Quoted 1 line
drivers/pinctrl/sh-pfc/sh_pfc.h +0 -0
        const u16 *pinmux_data;

Is there any special reason why you added a new block of registers with separate handling, instead of adding TDSEL to the existing pinmux_ioctrl_reg[] arrays, which list other IOCTRL registers like POCCTRL?

For one, It's unrelated register to POCCTRL, so I don't want to mix them

Quoted 7 lines
Quoted 3 lines

That's why the array is called pinmux_ioctrl_reg[], not pinmux_pocctrl_reg[]:
it is meant to cover various I/O control registers, including POCCTRL and TDSEL, to be saved/restored for PSCI system suspend.

I thought the array is called pinmux_ioctrl_reg[] because that's what the pocctrl was called in older datasheets ? At least that's how you explained it on IRC last time.

Ah, that's where the misunderstanding comes from: both POCCTRLx and TDSELy registers are sometimes called IOCTRLz registers.

Quoted 11 lines
Quoted 8 lines
Quoted 3 lines

together. The other reason is this r8a779*_pin_to_pocctrl(), which uses the ioctrl_regs[] array ; if I added the TDSEL there, that'd just make things extra confusing.

How r8a779*_pin_to_pocctrl() gets the registers is an implementation detail, IMHO (The function used to contain hardcoded register addresses).

So I think you should just add the TDSEL registers to pinmux_ioctrl_reg[].

If that's what you think is better and makes the driver less confusing, sure ...

Thanks!

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#8 lore raw
In reply to Geert Uytterhoeven
Quoted 1 line · Geert Uytterhoeven

Hi Marek,

Hi,

Quoted 31 lines · Marek Vasut
Quoted 30 lines · Geert Uytterhoeven
Quoted 29 lines · Marek Vasut
Quoted 27 lines · Geert Uytterhoeven
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines

Review struct sh_pfc_soc_info { · line 280

Quoted 11 lines
 struct pinmux_data_reg {
        u32 reg;
        u8 reg_width;
(quoted diff) +1 -0
@@ -270,6 +274,7 @@ struct sh_pfc_soc_info {
        const struct pinmux_drive_reg *drive_regs;
        const struct pinmux_bias_reg *bias_regs;
        const struct pinmux_ioctrl_reg *ioctrl_regs;
+       const struct pinmux_tdsel_reg *tdsel_regs;
        const struct pinmux_data_reg *data_regs;
 
        const u16 *pinmux_data;

Is there any special reason why you added a new block of registers with separate handling, instead of adding TDSEL to the existing pinmux_ioctrl_reg[] arrays, which list other IOCTRL registers like POCCTRL?

Quoted 5 lines
Quoted 1 line

For one, It's unrelated register to POCCTRL, so I don't want to mix them

That's why the array is called pinmux_ioctrl_reg[], not pinmux_pocctrl_reg[]:
it is meant to cover various I/O control registers, including POCCTRL and TDSEL, to be saved/restored for PSCI system suspend.

I thought the array is called pinmux_ioctrl_reg[] because that's what the pocctrl was called in older datasheets ? At least that's how you explained it on IRC last time.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Ah, that's where the misunderstanding comes from: both POCCTRLx and TDSELy registers are sometimes called IOCTRLz registers.

Then shouldn't we rename IOCTRL30 to POCCTRL first, and then add TDSEL into the list ?

Sure. I've already done so, but haven't sent out the patches yet.

Then we'll have a conflict once I add the TDSEL. I can either cook similar patch and send two patches or you send yours and I'll send this one later. I'd prefer the former to make conflict resolution easier .

Signature · 2 lines
Best regards,
Marek Vasut
#7 lore raw
In reply to Marek Vasut

Hi Marek,

Quoted 30 lines · Marek Vasut
Quoted 29 lines · Geert Uytterhoeven
Quoted 27 lines · Marek Vasut
Quoted 17 lines · Geert Uytterhoeven
Quoted 17 lines
Quoted 16 lines

Review struct sh_pfc_soc_info { · line 280

Quoted 11 lines
 struct pinmux_data_reg {
        u32 reg;
        u8 reg_width;
(quoted diff) +1 -0
@@ -270,6 +274,7 @@ struct sh_pfc_soc_info {
        const struct pinmux_drive_reg *drive_regs;
        const struct pinmux_bias_reg *bias_regs;
        const struct pinmux_ioctrl_reg *ioctrl_regs;
+       const struct pinmux_tdsel_reg *tdsel_regs;
        const struct pinmux_data_reg *data_regs;
 
        const u16 *pinmux_data;

Is there any special reason why you added a new block of registers with separate handling, instead of adding TDSEL to the existing pinmux_ioctrl_reg[] arrays, which list other IOCTRL registers like POCCTRL?

Quoted 5 lines
Quoted 1 line

For one, It's unrelated register to POCCTRL, so I don't want to mix them

That's why the array is called pinmux_ioctrl_reg[], not pinmux_pocctrl_reg[]:
it is meant to cover various I/O control registers, including POCCTRL and TDSEL, to be saved/restored for PSCI system suspend.

I thought the array is called pinmux_ioctrl_reg[] because that's what the pocctrl was called in older datasheets ? At least that's how you explained it on IRC last time.

Quoted 6 lines
Quoted 3 lines

Ah, that's where the misunderstanding comes from: both POCCTRLx and TDSELy registers are sometimes called IOCTRLz registers.

Then shouldn't we rename IOCTRL30 to POCCTRL first, and then add TDSEL into the list ?

Sure. I've already done so, but haven't sent out the patches yet.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#6 lore raw
In reply to Geert Uytterhoeven
Quoted 1 line · Geert Uytterhoeven

Hi Marek,

Hi,

Quoted 25 lines · Marek Vasut
Quoted 24 lines · Geert Uytterhoeven
Quoted 22 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
 struct pinmux_data_reg {
        u32 reg;
        u8 reg_width;
drivers/pinctrl/sh-pfc/sh_pfc.h +1 -0
@@ -270,6 +274,7 @@ struct sh_pfc_soc_info {
        const struct pinmux_drive_reg *drive_regs;
        const struct pinmux_bias_reg *bias_regs;
        const struct pinmux_ioctrl_reg *ioctrl_regs;
+       const struct pinmux_tdsel_reg *tdsel_regs;
        const struct pinmux_data_reg *data_regs;
 
Quoted 8 lines
Quoted 6 lines

drivers/pinctrl/sh-pfc/sh_pfc.h struct sh_pfc_soc_info { · line 280

Quoted 1 line
drivers/pinctrl/sh-pfc/sh_pfc.h +0 -0
        const u16 *pinmux_data;

Is there any special reason why you added a new block of registers with separate handling, instead of adding TDSEL to the existing pinmux_ioctrl_reg[] arrays, which list other IOCTRL registers like POCCTRL?

For one, It's unrelated register to POCCTRL, so I don't want to mix them

That's why the array is called pinmux_ioctrl_reg[], not pinmux_pocctrl_reg[]:
it is meant to cover various I/O control registers, including POCCTRL and TDSEL, to be saved/restored for PSCI system suspend.

Quoted 7 lines
Quoted 3 lines

I thought the array is called pinmux_ioctrl_reg[] because that's what the pocctrl was called in older datasheets ? At least that's how you explained it on IRC last time.

Ah, that's where the misunderstanding comes from: both POCCTRLx and TDSELy registers are sometimes called IOCTRLz registers.

Then shouldn't we rename IOCTRL30 to POCCTRL first, and then add TDSEL into the list ?

Signature · 2 lines
Best regards,
Marek Vasut