Hemant Pedanekar <[email protected]> writes:
> Controls ATA_RSTn and ATA_PWD through CPLD register 0 to enable ATA. An I2C
> driver is added for the same. Calls ide init if enabled in configuration.
>
> Signed-off-by: Hemant Pedanekar <[email protected]>
> ---
> arch/arm/mach-davinci/board-dm646x-evm.c | 69
> ++++++++++++++++++++++++++++++
> 1 files changed, 69 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c
> b/arch/arm/mach-davinci/board-dm646x-evm.c
> index 575c6ca..86419fb 100644
> --- a/arch/arm/mach-davinci/board-dm646x-evm.c
> +++ b/arch/arm/mach-davinci/board-dm646x-evm.c
> @@ -49,6 +49,13 @@
> #include <mach/emac.h>
> #include <mach/common.h>
>
> +#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
> + defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
> +#define HAS_ATA 1
> +#else
> +#define HAS_ATA 0
> +#endif
> +
> #define DM646X_EVM_PHY_MASK (0x2)
> #define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
>
> @@ -56,6 +63,61 @@ static struct davinci_uart_config uart_config __initdata =
> {
> .enabled_uarts = (1 << 0),
> };
>
> +/* CPLD Register 0: used for I/O Control */
> +static struct i2c_client *cpld_reg0_client;
Why do you need this global? It's only used in _probe (then set to
NULL in _remove)
I suggest dropping it and just using 'client' in _probe.
> +static int cpld_reg0_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
alignment
> +{
> + cpld_reg0_client = client;
> + if (HAS_ATA) {
> + u8 data;
> + struct i2c_msg msg[2] = {
> + {
> + .addr = cpld_reg0_client->addr,
> + .flags = I2C_M_RD,
> + .len = 1,
> + .buf = &data,
> + },
> + {
> + .addr = cpld_reg0_client->addr,
> + .flags = 0,
> + .len = 1,
> + .buf = &data,
> + },
> + };
> +
> + /*
> + * Set ATA_RSTn (bit-0) and ATA_PWD (bit-1) to '0' for ATA
Can you define these as BIT(x) values...
> + * operation.
> + */
> + i2c_transfer(cpld_reg0_client->adapter, msg, 1);
> + data &= ~3;
then use them here instad of hard-coded constant.
> + i2c_transfer(cpld_reg0_client->adapter, msg + 1, 1);
> + }
> +
> + return 0;
> +}
> +
> +static int cpld_reg0_remove(struct i2c_client *client)
> +{
> + cpld_reg0_client = NULL;
> + return 0;
> +}
with global var gone, you can drop _remove hook
Kevin
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source