Chaithrika U S <[email protected]> writes:
> DA850/OMAP-L138 EVM has a RMII Ethernet PHY on the UI daughter card. The PHY
> is enabled by proper programming of the IO Expander (TCA6416) ports. Also for
> RMII PHY to work, the MDIO clock of MII PHY has to be disabled since both the
> PHYs have the same address. This is done via the GPIO2[6] pin. This patch adds
> support for RMII PHY.
>
> This patch also adds a menuconfig option to select UI card and peripherals
> present on it. Currently, the only sub-option in this menu is RMII.
> This menuconfig option is similar to the one present for UI card on
> DA830/OMAP-L137 EVM.
>
> Signed-off-by: Chaithrika U S <[email protected]>
Looks good, a couple Kconfig questions/comments below...
> ---
> arch/arm/mach-davinci/Kconfig | 24 +++++
> arch/arm/mach-davinci/board-da850-evm.c | 148
> +++++++++++++++++++++++++++-
> arch/arm/mach-davinci/da850.c | 17 +++
> arch/arm/mach-davinci/include/mach/da8xx.h | 1 +
> arch/arm/mach-davinci/include/mach/mux.h | 9 ++
> 5 files changed, 194 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
> index 7b6dddf..665e7b1 100644
> --- a/arch/arm/mach-davinci/Kconfig
> +++ b/arch/arm/mach-davinci/Kconfig
> @@ -129,6 +129,30 @@ config MACH_DAVINCI_DA850_EVM
> help
> Say Y here to select the TI DA850/OMAP-L138 Evaluation Module.
>
> +config DA850_UI_EXP
> + bool "DA850/OMAP-L138 UI (User Interface) board expander configuration"
> + depends on MACH_DAVINCI_DA850_EVM
For the GPIO expander, it probably makes sense to automatically enable the
GPIO expander driver too by adding the following here:
select CONFIG_GPIO_PCA953X
> + help
> + Say Y here if you have the DA850/OMAP-L138 UI
> + (User Interface) board installed and you want to
> + enable the peripherals located on User Interface
> + board contorlled by TCA6416 expander.
> +
> +choice
> + prompt "Select peripherals connected to expander on UI board"
> + depends on DA850_UI_EXP
> +
The use of 'choice' here with only a single option means that you
cannot disable the RMII. It will always be enabled if the UI board is
selected. Is that intended?
If the various other UI device options that are coming really are
mutually exclusive, you should probably have a 'DA850_UI_NONE' option
or something similar so they all can be disabled.
> +config DA850_UI_RMII
> + bool "RMII Ethernet PHY"
> + help
> + Say Y if you want to use the RMII PHY on the DA850/OMAP-L138 EVM.
> + This PHY is found on the UI daughter card that is supplied with
> + the EVM.
> + NOTE: Please take care while choosing this option, MII PHY will
> + not be functional if RMII mode is selected.
> +
> +endchoice
> +
> config DAVINCI_MUX
> bool "DAVINCI multiplexing support"
> depends on ARCH_DAVINCI
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c
> b/arch/arm/mach-davinci/board-da850-evm.c
> index 25ae007..5f9512c 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -17,6 +17,7 @@
> #include <linux/console.h>
> #include <linux/i2c.h>
> #include <linux/i2c/at24.h>
> +#include <linux/i2c/pca953x.h>
> #include <linux/gpio.h>
> #include <linux/platform_device.h>
> #include <linux/mtd/mtd.h>
> @@ -43,6 +44,8 @@
> #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0)
> #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1)
>
> +#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
> +
> static struct mtd_partition da850_evm_norflash_partition[] = {
> {
> .name = "NOR filesystem",
> @@ -270,11 +273,148 @@ static const short da850_evm_lcdc_pins[] = {
> -1
> };
>
> +#ifdef CONFIG_DA850_UI_EXP
> +static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned
> gpio,
> + unsigned ngpio, void *c)
> +{
> + struct davinci_soc_info *soc_info = &davinci_soc_info;
> + int sel_a, sel_b, sel_c, ret;
> +
> + sel_a = gpio + 7;
> + sel_b = gpio + 6;
> + sel_c = gpio + 5;
> +
> + ret = gpio_request(sel_a, "sel_a");
> + if (ret) {
> + pr_warning("Cannot open UI expander pin %d\n", sel_a);
> + goto exp_setup_sela_fail;
> + }
> +
> + ret = gpio_request(sel_b, "sel_b");
> + if (ret) {
> + pr_warning("Cannot open UI expander pin %d\n", sel_b);
> + goto exp_setup_selb_fail;
> + }
> +
> + ret = gpio_request(sel_c, "sel_c");
> + if (ret) {
> + pr_warning("Cannot open UI expander pin %d\n", sel_c);
> + goto exp_setup_selc_fail;
> + }
> +
> + /* deselect all functionalities */
> + gpio_direction_output(sel_a, 1);
> + gpio_direction_output(sel_b, 1);
> + gpio_direction_output(sel_c, 1);
> +
> + if (soc_info->emac_pdata->rmii_en)
> + /* enable RMII */
> + gpio_set_value(sel_a, 0);
> +
> + return 0;
> +
> +exp_setup_selc_fail:
> + gpio_free(sel_b);
> +exp_setup_selb_fail:
> + gpio_free(sel_a);
> +exp_setup_sela_fail:
> + return ret;
> +}
> +
> +static int da850_evm_ui_expander_teardown(struct i2c_client *client,
> + unsigned gpio, unsigned ngpio, void *c)
> +{
> + /* deselect all functionalities */
> + gpio_set_value(gpio + 5, 1);
> + gpio_set_value(gpio + 6, 1);
> + gpio_set_value(gpio + 7, 1);
> +
> + gpio_free(gpio + 5);
> + gpio_free(gpio + 6);
> + gpio_free(gpio + 7);
> +
> + return 0;
> +}
> +
> +static struct pca953x_platform_data da850_evm_ui_expander_info = {
> + .gpio_base = DAVINCI_N_GPIO,
> + .setup = da850_evm_ui_expander_setup,
> + .teardown = da850_evm_ui_expander_teardown,
> +};
#else
static struct __init pca953x_platform_data da850_evm_ui_expander_info;
> +#endif
> +
> +static struct i2c_board_info __initdata i2c_info[] = {
> +#ifdef CONFIG_DA850_UI_EXP
> + {
> + I2C_BOARD_INFO("tca6416", 0x20),
> + .platform_data = &da850_evm_ui_expander_info,
> + },
> +#endif
then, you can drop the #ifdef here.
Kevin
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source