[U-Boot] [PATCH v2 1/3] misc:pmic:core New generic PMIC driver
Stefano Babic
sbabic at denx.de
Thu Oct 6 11:48:50 CEST 2011
On 10/04/2011 07:45 AM, Lukasz Majewski wrote:
> I2C or SPI PMIC devices can be accessed.
> Separate files: pmic_i2c.c and pmic_spi.c are responsible
> for handling transmission over I2C or SPI bus.
>
> New flags:
> CONFIG_PMIC - enable PMIC general device.
> CONFIG_PMIC_I2C/SPI - specify the interface to be used.
>
> Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
> Cc: Stefano Babic <sbabic at denx.de>
> ---
Hi Lukasz,
> +
> +struct p_spi {
> + unsigned char cs;
> + unsigned char mode;
> + unsigned char bitlen;
> + unsigned int clk;
> + unsigned int flags;
> + u32 (*prepare_tx)(u32 reg, u32 *val, u32 write);
> +};
> +
> +struct pmic {
> + const char *name;
> + unsigned char bus;
> + unsigned char interface;
> + unsigned char number_of_regs;
> + union hw {
> + struct p_i2c i2c;
> + struct p_spi spi;
> + } hw;
> +};
I have found an issue with this structure. In some case a char is not
enough. The i.MX SPI driver uses the LSB byte to set a chipselect
provided directly by the controller, and the MSB if a GPIO is selected.
You can see an example in efikamx.h. It is better to replace all
unsigned char in this structure with unsigned int to avoid these problems.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
More information about the U-Boot
mailing list