Sudhakar Rajashekhara <[email protected]> writes:

> There are two instances of MMC/SD on da850/omap-l138.
> Connector for the first instance is available on the
> EVM. This patch adds support for this instance.
>
> This patch also adds support for card detect and write
> protect switches on da850/omap-l138 EVM.
>
> Signed-off-by: Sudhakar Rajashekhara <[email protected]>
> ---
>  Since the previous version, following are the modifications:
>  1. Defined the macros for the GPIO pins.
>  2. Moved calls to gpio_request() and gpio_direction_input()
>     to da850_evm_init() function.
>  3. Added the GPIO pins used for Card detect and Write protect
>     features to the mux table.
>
>  This patch depends on the following patches which I have
>  submitted to davinci git:
>  [PATCH v2] davinci: Configure MDIO pins for EMAC
>  [PATCH v2] davinci: Add platform support for da850/omap-l138 GLCD 
>
>  arch/arm/mach-davinci/board-da850-evm.c    |   54 
> ++++++++++++++++++++++++++++
>  arch/arm/mach-davinci/da850.c              |   23 ++++++++++++
>  arch/arm/mach-davinci/devices-da8xx.c      |   38 +++++++++++++++++++
>  arch/arm/mach-davinci/include/mach/da8xx.h |    4 ++
>  arch/arm/mach-davinci/include/mach/mux.h   |   10 +++++
>  5 files changed, 129 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c 
> b/arch/arm/mach-davinci/board-da850-evm.c
> index b05b7f5..97251c3 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -37,6 +37,11 @@
>  /* GPIO 8[10] is used for LCD Power - 16 * 8 + 10 = 138 */
>  #define DA850_LCD_PWR_PIN            138     
>  
> +/* GPIO 4[0] is used for MMC/SD CD - 16 * 4 + 0 = 64 */
> +#define DA850_MMCSD_CD_PIN           64
> +/* GPIO 4[1] is used for MMC/SD WP - 16 * 4 + 1 = 65 */
> +#define DA850_MMCSD_WP_PIN           65
> +

How about creating a macro in mach/gpio.h that takes a bank number 
and a GPIO number and returns (16 * bank + gpio).  That way
you don't have to keep adding comments for these.

Then use the macro for these as well as in the GLCD patch.

>  static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
>       .bus_freq       = 100,  /* kHz */
>       .bus_delay      = 0,    /* usec */
> @@ -46,6 +51,31 @@ static struct davinci_uart_config da850_evm_uart_config 
> __initdata = {
>       .enabled_uarts = 0x7,
>  };
>  
> +#if defined(CONFIG_MMC_DAVINCI) || defined(CONFIG_MMC_DAVINCI_MODULE)
> +static int da850_evm_mmc_get_ro(int index)
> +{
> +     int val;
> +
> +     val = gpio_get_value(DA850_MMCSD_WP_PIN);
> +     return val;
> +}

Drop the 'val' and make this a one-liner: 'return 
gpio_get_value(DA850_MMCSD_WP_PIN);'

> +static int da850_evm_mmc_get_cd(int index)
> +{
> +     int val;
> +
> +     val = gpio_get_value(DA850_MMCSD_CD_PIN);
> +     return !val;
> +}

ditto

otherwise, looks ok.

Kevin

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to