mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-12 17:31:25 +02:00
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
94 lines
2.1 KiB
C
94 lines
2.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2014 CompuLab, Ltd. <www.compulab.co.il>
|
|
*
|
|
* Authors: Igor Grinberg <grinberg@compulab.co.il>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <netdev.h>
|
|
#include <linux/delay.h>
|
|
|
|
#include <asm/io.h>
|
|
#include <linux/errno.h>
|
|
#include <asm/arch/cpu.h>
|
|
#include <asm/arch/mem.h>
|
|
#include <asm/arch/sys_proto.h>
|
|
#include <asm/gpio.h>
|
|
|
|
#include "common.h"
|
|
|
|
static u32 cl_omap3_smc911x_gpmc_net_config[GPMC_MAX_REG] = {
|
|
NET_GPMC_CONFIG1,
|
|
NET_GPMC_CONFIG2,
|
|
NET_GPMC_CONFIG3,
|
|
NET_GPMC_CONFIG4,
|
|
NET_GPMC_CONFIG5,
|
|
NET_GPMC_CONFIG6,
|
|
0
|
|
};
|
|
|
|
static void cl_omap3_smc911x_setup_net_chip_gmpc(int cs, u32 base_addr)
|
|
{
|
|
struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
|
|
|
|
enable_gpmc_cs_config(cl_omap3_smc911x_gpmc_net_config,
|
|
&gpmc_cfg->cs[cs], base_addr, GPMC_SIZE_16M);
|
|
|
|
/* Enable off mode for NWE in PADCONF_GPMC_NWE register */
|
|
writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
|
|
|
|
/* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
|
|
writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
|
|
|
|
/* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
|
|
writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
|
|
&ctrl_base->gpmc_nadv_ale);
|
|
}
|
|
|
|
#ifdef CONFIG_OMAP_GPIO
|
|
static int cl_omap3_smc911x_reset_net_chip(int gpio)
|
|
{
|
|
int err;
|
|
|
|
if (!gpio_is_valid(gpio))
|
|
return -EINVAL;
|
|
|
|
err = gpio_request(gpio, "eth rst");
|
|
if (err)
|
|
return err;
|
|
|
|
/* Set gpio as output and send a pulse */
|
|
gpio_direction_output(gpio, 1);
|
|
udelay(1);
|
|
gpio_set_value(gpio, 0);
|
|
mdelay(40);
|
|
gpio_set_value(gpio, 1);
|
|
mdelay(1);
|
|
|
|
return 0;
|
|
}
|
|
#else /* !CONFIG_OMAP_GPIO */
|
|
static inline int cl_omap3_smc911x_reset_net_chip(int gpio) { return 0; }
|
|
#endif /* CONFIG_OMAP_GPIO */
|
|
|
|
int cl_omap3_smc911x_init(int id, int cs, u32 base_addr,
|
|
int (*reset)(int), int rst_gpio)
|
|
{
|
|
int ret;
|
|
|
|
cl_omap3_smc911x_setup_net_chip_gmpc(cs, base_addr);
|
|
|
|
if (reset)
|
|
reset(rst_gpio);
|
|
else
|
|
cl_omap3_smc911x_reset_net_chip(rst_gpio);
|
|
|
|
ret = smc911x_initialize(id, base_addr);
|
|
if (ret > 0)
|
|
return ret;
|
|
|
|
printf("Failed initializing SMC911x! ");
|
|
return 0;
|
|
}
|