[U-Boot] [PATCH 4/9] MX51: Add pin and multiplexer definitions.

Wolfgang Denk
2010-01-17T11:19:56Z

Dear Stefano Babic,

In message <1263212760-27272-5-git-send-email-sbabic@denx.de> you wrote:
> The patch add header files to support the pin multiplexer
> of the the Freescale i.MX51 processor.
...
> +/*!
> + * various IOMUX pad functions
> + */
> +typedef enum iomux_pad_config {
> + PAD_CTL_SRE_SLOW = 0x0 << 0,
> + PAD_CTL_SRE_FAST = 0x1 << 0,
> + PAD_CTL_DRV_LOW = 0x0 << 1,
> + PAD_CTL_DRV_MEDIUM = 0x1 << 1,
> + PAD_CTL_DRV_HIGH = 0x2 << 1,
> + PAD_CTL_DRV_MAX = 0x3 << 1,
> + PAD_CTL_ODE_OPENDRAIN_NONE = 0x0 << 3,
> + PAD_CTL_ODE_OPENDRAIN_ENABLE = 0x1 << 3,
> + PAD_CTL_100K_PD = 0x0 << 4,
> + PAD_CTL_47K_PU = 0x1 << 4,
> + PAD_CTL_100K_PU = 0x2 << 4,
> + PAD_CTL_22K_PU = 0x3 << 4,
> + PAD_CTL_PUE_KEEPER = 0x0 << 6,
> + PAD_CTL_PUE_PULL = 0x1 << 6,
> + PAD_CTL_PKE_NONE = 0x0 << 7,
> + PAD_CTL_PKE_ENABLE = 0x1 << 7,
> + PAD_CTL_HYS_NONE = 0x0 << 8,
> + PAD_CTL_HYS_ENABLE = 0x1 << 8,
> + PAD_CTL_DDR_INPUT_CMOS = 0x0 << 9,
> + PAD_CTL_DDR_INPUT_DDR = 0x1 << 9,
> + PAD_CTL_DRV_VOT_LOW = 0x0 << 13,
> + PAD_CTL_DRV_VOT_HIGH = 0x1 << 13,
> +} iomux_pad_config_t;

Please add comments what these settings actually mean.

> +/*!
> + * Request ownership for an IO pin. This function has to be the first one
> + * being called before that pin is used. The caller has to check the
> + * return value to make sure it returns 0.
> + *
> + * @param pin a name defined by \b iomux_pin_name_t
> + * @param config config as defined in \b #iomux_pin_ocfg_t
> + *
> + * @return 0 if successful; Non-zero otherwise
> + */
> +void mxc_request_iomux(iomux_pin_name_t pin, iomux_pin_cfg_t config);
> +
> +/*!
> + * Release ownership for an IO pin
> + *
> + * @param pin a name defined by \b iomux_pin_name_t
> + * @param config config as defined in \b #iomux_pin_ocfg_t
> + */
> +void mxc_free_iomux(iomux_pin_name_t pin, iomux_pin_cfg_t config);

Please provide these comments where the code gets implemented, and
omit it here where we just have the prototype declarations.

...
> +#define _MXC_BUILD_GPIO_PIN(gp, gi, ga, mi, pi) \
> + _MXC_BUILD_PIN(gp, gi, ga, mi, pi)
> +
> +#define _MXC_BUILD_NON_GPIO_PIN(mi, pi) \
> + _MXC_BUILD_PIN(NON_GPIO_PORT, 0, 0, mi, pi)

Indentation by TAB, please. Please fix globally.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
...when fits of creativity run strong, more than one programmer or
writer has been known to abandon the desktop for the more spacious
floor. - Fred Brooks, Jr.