Tegra114: Dalmore: Add pad config tables/code based on pinmux code
Subsystems (2)
PATCH 1/1 Tegra114: Dalmore: Add pad config tables/code based on pinmux code
Pad config registers exist in APB_MISC_GP space, and control slew rate, drive strengh, schmidt, high-speed, and low-power modes for all of the pingroups in Tegra30. This builds off of the pinmux way of constructing init tables to configure select pads (SDIOCFG, for instance) during pinmux_init().
Currently, no padcfg entries exist. SDIO3CFG will be added when the MMC driver is added as per the TRM to work with the SD-card slot on Dalmore E1611.
--- arch/arm/cpu/tegra114-common/pinmux.c | 188 ++++++++++++++++++++++++++ arch/arm/include/asm/arch-tegra114/pinmux.h | 75 ++++++++++- board/nvidia/dalmore/pinmux-config-dalmore.h | 16 +++ 3 files changed, 274 insertions(+), 5 deletions(-)
arch/arm/cpu/tegra114-common/pinmux.c +188 -0
@@ -39,6 +39,19 @@ struct tegra_pingroup_desc {#define PMUX_IO_RESET_SHIFT 8#define PMUX_RCV_SEL_SHIFT 9 +#define PGRP_HSM_SHIFT 2 +#define PGRP_SCHMT_SHIFT 3 +#define PGRP_LPMD_SHIFT 4 +#define PGRP_LPMD_MASK (3 << PGRP_LPMD_SHIFT) +#define PGRP_DRVDN_SHIFT 12 +#define PGRP_DRVDN_MASK (0x7F << PGRP_DRVDN_SHIFT) +#define PGRP_DRVUP_SHIFT 20 +#define PGRP_DRVUP_MASK (0x7F << PGRP_DRVUP_SHIFT) +#define PGRP_SLWR_SHIFT 28 +#define PGRP_SLWR_MASK (3 << PGRP_SLWR_SHIFT) +#define PGRP_SLWF_SHIFT 30 +#define PGRP_SLWF_MASK (3 << PGRP_SLWF_SHIFT) +/* Convenient macro for defining pin group properties */ #define PIN (pg_name, vdd, f0, f1, f2, f3, iod) \ { \
@@ -544,3 +557,178 @@ void pinmux_config_table(struct pingroup_config *config, int len)for (i =0 ; i < len; i++)pinmux_config_pingroup (&config[i]); } + +static int padgrp_set_drvup_slwf (enum pdrive_pingrp pad, +int slwf) +{ +struct pmux_tri_ctlr *pmt = + (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 *pad_slwf = &pmt->pmt_drive[pad]; +u32 reg; + +/* Error check on pad and slwf */ +assert (pmux_padgrp_isvalid (pad)); +assert (pmux_pad_slw_isvalid (slwf)); + +/* NONE means unspecified/do not change/use POR value */ +if (slwf ==PGRP_SLWF_NONE ) +return 0 ; + + reg =readl (pad_slwf); + reg &= ~PGRP_SLWF_MASK ; + reg |= (slwf <<PGRP_SLWF_SHIFT ); +writel (reg, pad_slwf); + +return 0 ; +} + +static int padgrp_set_drvdn_slwr (enum pdrive_pingrp pad,int slwr) +{ +struct pmux_tri_ctlr *pmt = + (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 *pad_slwr = &pmt->pmt_drive[pad]; +u32 reg; + +/* Error check on pad and slwr */ +assert (pmux_padgrp_isvalid (pad)); +assert (pmux_pad_slw_isvalid (slwr)); + +/* NONE means unspecified/do not change/use POR value */ +if (slwr ==PGRP_SLWR_NONE ) +return 0 ; + + reg =readl (pad_slwr); + reg &= ~PGRP_SLWR_MASK ; + reg |= (slwr <<PGRP_SLWR_SHIFT ); +writel (reg, pad_slwr); + +return 0 ; +} + +static int padgrp_set_drvup (enum pdrive_pingrp pad,int drvup) +{ +struct pmux_tri_ctlr *pmt = + (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 *pad_drvup = &pmt->pmt_drive[pad]; +u32 reg; + +/* Error check on pad and drvup */ +assert (pmux_padgrp_isvalid (pad)); +assert (pmux_pad_drv_isvalid (drvup)); + +/* NONE means unspecified/do not change/use POR value */ +if (drvup ==PGRP_DRVUP_NONE ) +return 0 ; + + reg =readl (pad_drvup); + reg &= ~PGRP_DRVUP_MASK ; + reg |= (drvup <<PGRP_DRVUP_SHIFT ); +writel (reg, pad_drvup); + +return 0 ; +} + +static int padgrp_set_drvdn (enum pdrive_pingrp pad,int drvdn) +{ +struct pmux_tri_ctlr *pmt = + (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 *pad_drvdn = &pmt->pmt_drive[pad]; +u32 reg; + +/* Error check on pad and drvdn */ +assert (pmux_padgrp_isvalid (pad)); +assert (pmux_pad_drv_isvalid (drvdn)); + +/* NONE means unspecified/do not change/use POR value */ +if (drvdn ==PGRP_DRVDN_NONE ) +return 0 ; + + reg =readl (pad_drvdn); + reg &= ~PGRP_DRVDN_MASK ; + reg |= (drvdn <<PGRP_DRVDN_SHIFT ); +writel (reg, pad_drvdn); + +return 0 ; +} + +static int padgrp_set_lpmd (enum pdrive_pingrp pad,enum pgrp_lpmd lpmd) +{ +struct pmux_tri_ctlr *pmt = + (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 *pad_lpmd = &pmt->pmt_drive[pad]; +u32 reg; + +/* Error check pad and lpmd value */ +assert (pmux_padgrp_isvalid (pad)); +assert (pmux_pad_lpmd_isvalid (lpmd)); + +/* NONE means unspecified/do not change/use POR value */ +if (lpmd ==PGRP_LPMD_NONE ) +return 0 ; + + reg =readl (pad_lpmd); + reg &= ~PGRP_LPMD_MASK ; + reg |= (lpmd <<PGRP_LPMD_SHIFT ); +writel (reg, pad_lpmd); + +return 0 ; +} + +static int padgrp_set_schmt (enum pdrive_pingrp pad,enum pgrp_schmt schmt) +{ +struct pmux_tri_ctlr *pmt = + (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 *pad_schmt = &pmt->pmt_drive[pad]; +u32 reg; + +/* Error check pad */ +assert (pmux_padgrp_isvalid (pad)); + + reg =readl (pad_schmt); + reg &= ~(1 <<PGRP_SCHMT_SHIFT ); +if (schmt ==PGRP_SCHMT_ENABLE ) + reg |= (0x1 <<PGRP_SCHMT_SHIFT ); +writel (reg, pad_schmt); + +return 0 ; +} +static int padgrp_set_hsm (enum pdrive_pingrp pad, +enum pgrp_hsm hsm) +{ +struct pmux_tri_ctlr *pmt = + (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 *pad_hsm = &pmt->pmt_drive[pad]; +u32 reg; + +/* Error check pad */ +assert (pmux_padgrp_isvalid (pad)); + + reg =readl (pad_hsm); + reg &= ~(1 <<PGRP_HSM_SHIFT ); +if (hsm ==PGRP_HSM_ENABLE ) + reg |= (0x1 <<PGRP_HSM_SHIFT ); +writel (reg, pad_hsm); + +return 0 ; +} + +void padctrl_config_pingroup (struct padctrl_config *config) +{ +enum pdrive_pingrp pad = config->padgrp; + +padgrp_set_drvup_slwf (pad, config->slwf); +padgrp_set_drvdn_slwr (pad, config->slwr); +padgrp_set_drvup (pad, config->drvup); +padgrp_set_drvdn (pad, config->drvdn); +padgrp_set_lpmd (pad, config->lpmd); +padgrp_set_schmt (pad, config->schmt); +padgrp_set_hsm (pad, config->hsm); +} + +void padgrp_config_table (struct padctrl_config *config,int len) +{ +int i; + +for (i =0 ; i < len; i++) +padctrl_config_pingroup (&config[i]); +}
arch/arm/include/asm/arch-tegra114/pinmux.h +70 -5
84 lines not on this page · raw message
board/nvidia/dalmore/pinmux-config-dalmore.h +16 -0
@@ -79,6 +79,18 @@#define USB_PINMUX CEC_PINMUX +#define DEFAULT_PADCFG (_padgrp, _slwf, _slwr, _drvup, _drvdn, _lpmd, _schmt, _hsm) \ + { \ + .padgrp = PDRIVE_PINGROUP_##_padgrp, \ + .slwf = _slwf, \ + .slwr = _slwr, \ + .drvup = _drvup, \ + .drvdn = _drvdn, \ + .lpmd = PGRP_LPMD_##_lpmd, \ + .schmt = PGRP_SCHMT_##_schmt, \ + .hsm = PGRP_HSM_##_hsm, \ + } +static struct pingroup_config tegra114_pinmux_common[] = {/* EXTPERIPH1 pinmux */ DEFAULT_PINMUX (CLK1_OUT ,EXTPERIPH1 ,NORMAL ,NORMAL ,OUTPUT ),
@@ -349,4 +361,8 @@ static struct pingroup_config tegra114_pinmux_set_nontristate[] = { DEFAULT_PINMUX(SDMMC3_CD_N, SDMMC3, UP, NORMAL, INPUT), }; + +static struct padctrl_config dalmore_padctrl[] = { +/* (_padgrp, _slwf, _slwr, _drvup, _drvdn, _lpmd, _schmt, _hsm) */ +};#endif /* PINMUX_CONFIG_COMMON_H */
Signature · 1 line
1.7.0.4
PATCH 1/1 Tegra114: Dalmore: Add pad config tables/code based on pinmux code
Quoted 9 lines · Tom Warren
Pad config registers exist in
APB_MISC_GPspace, and control slew rate, drive strengh, schmidt, high-speed, and low-power modes for all of the pingroups in Tegra30. This builds off of the pinmux way of constructing init tables to configure select pads (SDIOCFG, for instance) duringpinmux_init().Currently, no padcfg entries exist. SDIO3CFG will be added when the MMC driver is added as per the TRM to work with the SD-card slot on Dalmore E1611.
Much of the pinmux driver code here is common with Tegra30. We should at least file a bug to move it to a common file at some point.
arch/arm/include/asm/arch-tegra114/pinmux.h enum pmux_vddio { · line 481
Quoted 11 lines
arch/arm/include/asm/arch-tegra114/pinmux.h +9
-0+#define PGRP_SLWF_NONE -1 +#define PGRP_SLWF_MAX 3 +#define PGRP_SLWR_NONE PGRP_SLWF_NONE +#define PGRP_SLWR_MAX PGRP_SLWF_MAX + +#define PGRP_DRVUP_NONE -1 +#define PGRP_DRVUP_MAX 127 +#define PGRP_DRVDN_NONE PGRP_DRVUP_NONE +#define PGRP_DRVDN_MAX PGRP_DRVUP_MAX
There seems to be some mixed use of TABs/spaces there. Feel free to fix up when you apply it.
Aside from that,
PATCH 1/1 Tegra114: Dalmore: Add pad config tables/code based on pinmux code
Stephen,
Quoted 15 lines
-----Original Message-----
From: Stephen Warren [mailto:swarren at wwwdotorg.org]
Sent: Tuesday, March 12, 2013 10:41 AM
To: Tom Warren
Cc: u-boot at lists.denx.de; Stephen Warren; Tom Warren
Subject: Re: [U-Boot] [PATCH] Tegra114: Dalmore: Add pad config tables/code based on pinmux codeQuoted 6 lines · Tom Warren
Pad config registers exist in
APB_MISC_GPspace, and control slew rate, drive strengh, schmidt, high-speed, and low-power modes for all of the pingroups in Tegra30. This builds off of the pinmux way of constructing init tables to configure select pads (SDIOCFG, for instance) duringpinmux_init().
Quoted 6 lines
Quoted 3 lines
Currently, no padcfg entries exist. SDIO3CFG will be added when the MMC driver is added as per the TRM to work with the SD-card slot on Dalmore E1611.
Much of the pinmux driver code here is common with Tegra30. We should at least file a bug to move it to a common file at some point.
I'd planned on sending a patchset after this was reviewed/accepted, but I'll file a bug as a reminder.
Quoted 4 lines
Quoted 3 lines
arch/arm/include/asm/arch-tegra114/pinmux.h +0
-0
Quoted 12 lines
arch/arm/include/asm/arch-tegra114/pinmux.h enum pmux_vddio { · line 481
Quoted 9 lines
arch/arm/include/asm/arch-tegra114/pinmux.h +9
-0+#define PGRP_SLWF_NONE -1 +#define PGRP_SLWF_MAX 3 +#define PGRP_SLWR_NONE PGRP_SLWF_NONE +#define PGRP_SLWR_MAX PGRP_SLWF_MAX + +#define PGRP_DRVUP_NONE -1 +#define PGRP_DRVUP_MAX 127 +#define PGRP_DRVDN_NONE PGRP_DRVUP_NONE +#define PGRP_DRVDN_MAX PGRP_DRVUP_MAXThere seems to be some mixed use of TABs/spaces there. Feel free to fix up when you apply it.
Will do. Thanks.
Quoted 3 lines
Aside from that,
Reviewed-by Stephen Warren <[email protected]>
--
nvpublic