OMAP3x移植
================================音频驱动移植============================
1.添加内核配置选项
McSPI driver for OMAP24xx/OMAP34xx
SPI sound devices
2.修改arch/arm/mach-omap2/board-omap3beagle.c
static struct twl4030_codec_data beagle_codec_data = {
.audio_mclk = 26000000,
.audio = &beagle_audio_data,
};
static struct twl4030_platform_data beagle_twldata = {
.irq_base = TWL4030_IRQ_BASE,
.irq_end = TWL4030_IRQ_END,
/* platform_data for children goes here */
.usb = &beagle_usb_data,
.gpio = &beagle_gpio_data,
.codec = &beagle_codec_data, //添加项
.madc = &beagle_madc_data,
.vmmc1 = &beagle_vmmc1,
.vsim = &beagle_vsim,
.vdac = &beagle_vdac,
.vpll2 = &beagle_vpll2,
};
3.修改sound/soc/codec/twl4030.c 中寄存器配置
headset相关
PREDL_CTL Predriver class D left amplifier control register
PREDR_CTL Predriver class D right amplifier control register
mic_main相关
REG_MICBIAS_CTL Microphone bias and analog microphone amplifier power control register
REG_ANAMICL Analog microphone left control and offset cancellation control register
REG_ANAMICR Analog microphone right control register
============================GPIO 按键驱动移植 ========================================
1.配置内核选项
Device Drivers --->
Input device support --->
Keyboards --->
GPIO Buttons
2.修改arch/arm/mach-omap2/board-omap3beagle.c文件
static struct gpio_keys_button gpio_buttons[] = {
{
.code = KEY_MENU,
.gpio = 26,
.desc = "menu",
.wakeup = 1,
},
{
.code = KEY_UNKNOWN,
.gpio = 29,
.desc = "user",
.wakeup = 1,
},
};
static struct gpio_keys_platform_data gpio_key_info = {
.buttons = gpio_buttons,
.nbuttons = ARRAY_SIZE(gpio_buttons),
};
static struct platform_device keys_gpio = {
.name = "gpio-keys", //要根据drivers/input/keyboard/gpio_keys.c 来命名
.id = -1,
.dev = {
.platform_data = &gpio_key_info,
},
};
static struct platform_device *omap3_beagle_devices[] __initdata = {
&leds_gpio,
&keys_gpio, //添加项
&beagle_dss_device,
&omap_dm9000_dev,
};
=======================GPIO led的驱动移植====================================
1.内核配置
Device Drivers --->
LED Support --->
LED Support for GPIO connected LEDs
LED Trigger support
2.修改arch/arm/mach-omap2/board-omap3beagle.c文件
static struct gpio_led gpio_leds[] = {
{
.name = "sys_led",
.default_trigger = "default-on",
.gpio = 186,
.active_low = true,
},
....
};
static struct gpio_led_platform_data gpio_led_info = {
.leds = gpio_leds,
.num_leds = ARRAY_SIZE(gpio_leds),
};
static struct platform_device leds_gpio = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &gpio_led_info,
},
};
static struct platform_device *omap3_beagle_devices[] __initdata = {
&leds_gpio, //添加此项
&keys_gpio,
&beagle_dss_device,
&omap_dm9000_dev,
};
===========================DM9000网卡移植=======================================
u-boot修改相关:
1.board/ti/beagle/beagle.h 文件修改
MUX_VAL(CP(GPMC_NCS6), (IDIS | PTU | EN | M0)) /*GPMC_nCS6*//
MUX_VAL(CP(ETK_D11_ES2), (IEN | PTU | EN | M4)) /*GPIO_25*//
2.include/configs/omap3_beagle.h 添加
#define CONFIG_CMD_NET /* bootp, tftpboot, rarpboot */
#define CONFIG_CMD_NFS /* NFS support */
#define CONFIG_CMD_PING
#if defined(CONFIG_CMD_NET)
/* DM9000 */
#define CONFIG_NET_MULTI 1
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_DRIVER_DM9000 1
#define CONFIG_DM9000_BASE 0x2c000000
#define DM9000_IO CONFIG_DM9000_BASE
#define DM9000_DATA (CONFIG_DM9000_BASE + 0x400)
#define CONFIG_DM9000_USE_16BIT 1
#define CONFIG_DM9000_NO_SROM 1
#undef CONFIG_DM9000_DEBUG
#define CONFIG_ETHADDR aa:bb:cc:dd:ee:ff
#define CONFIG_ETHADDR aa:bb:cc:dd:ee:ff
#define CONFIG_IPADDR 192.192.192.200
#define CONFIG_SERVERIP 192.192.192.90
#define CONFIG_GATEWAYIP 192.192.192.101
#define CONFIG_NETMASK 255.255.255.0
#endif /* (CONFIG_CMD_NET) */
3.board/ti/beagle/beagle.c文件添加
static void setup_net_chip(void)
{
#ifdef CONFIG_DRIVER_DM9000
struct ctrl_id *id_base = (struct ctrl_id *)OMAP34XX_ID_L4_IO_BASE;
uchar enetaddr[6];
u32 die_id_0;
printf("calling setup_net_chip CONFIG_DRIVER_DM9000/n");
/* Configure GPMC registers for DM9000 */
writel(NET_GPMC_CONFIG1, &gpmc_cfg->cs[6].config1);
writel(NET_GPMC_CONFIG2, &gpmc_cfg->cs[6].config2);
writel(NET_GPMC_CONFIG3, &gpmc_cfg->cs[6].config3);
writel(NET_GPMC_CONFIG4, &gpmc_cfg->cs[6].config4);
writel(NET_GPMC_CONFIG5, &gpmc_cfg->cs[6].config5);
writel(NET_GPMC_CONFIG6, &gpmc_cfg->cs[6].config6);
writel(NET_GPMC_CONFIG7, &gpmc_cfg->cs[6].config7);
/* Use OMAP DIE_ID as MAC address */
if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
printf("ethaddr not set, using Die ID/n");
die_id_0 = readl(&id_base->die_id_0);
enetaddr[0] = 0x02; /* locally administered */
enetaddr[1] = readl(&id_base->die_id_1) & 0xff;
enetaddr[2] = (die_id_0 & 0xff000000) >> 24;
enetaddr[3] = (die_id_0 & 0x00ff0000) >> 16;
enetaddr[4] = (die_id_0 & 0x0000ff00) >> 8;
enetaddr[5] = (die_id_0 & 0x000000ff);
eth_setenv_enetaddr("ethaddr", enetaddr);
}
#endif
}
int board_eth_init(bd_t *bis)
{
int rc = 0;
#ifdef CONFIG_DRIVER_DM9000
rc = dm9000_initialize(bis);
#endif
return rc;
}
4.board/ti/beagle/beagle.c文件中,在misc_init_r 函数中调用setup_net_chip
内核修改相关:
1.在内核配置make menuconfig 选上DM9000 support 去掉omap_mux surport
2.在 arch/arm/mach-omap2/board-omap3beagle.c添加如下:
#include <linux/interrupt.h>
#include <linux/dm9000.h>
#define OMAP_DM9000_BASE 0x2c000000
#define OMAP_DM9000_GPIO_IRQ 25
static struct resource omap3beagle_dm9000_resources[] = {
[0] = {
.start = OMAP_DM9000_BASE,
.end = (OMAP_DM9000_BASE + 0x4 - 1),
.flags = IORESOURCE_MEM,
},
[1] = {
.start = (OMAP_DM9000_BASE + 0x400),
.end = (OMAP_DM9000_BASE + 0x400 + 0x4 - 1),
.flags = IORESOURCE_MEM,
},
[2] = {
.start = OMAP_GPIO_IRQ(OMAP_DM9000_GPIO_IRQ),
.end = OMAP_GPIO_IRQ(OMAP_DM9000_GPIO_IRQ),
.flags = IORESOURCE_IRQ,
},
};
static struct dm9000_plat_data omap_dm9000_platdata = {
.flags = DM9000_PLATF_16BITONLY,
};
static struct platform_device omap3beagle_dm9000_device = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(omap3beagle_dm9000_resources),
.resource = omap3beagle_dm9000_resources,
.dev = {
.platform_data = &omap_dm9000_platdata,
},
};
static inline void __init omap3beagle_init_dm9000(void)
{
if (omap_request_gpio(OMAP_DM9000_GPIO_IRQ) < 0) {
printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ/n",
OMAP_DM9000_GPIO_IRQ);
return;
}
omap_set_gpio_direction(OMAP_DM9000_GPIO_IRQ, 1);
}
3.
static struct platform_device *omap3evm_devices[] __initdata = {
......
&omap3beagle_dm9000_device,//添加此设备
};
4.在 arch/arm/mach-omap2/board-omap3beagle.c添加如下:
static void __init omap3_beagle_init_irq(void)
{
......
omap_gpio_init();
omap3beagle_init_dm9000();//这是添加的!!!
}
5.对Dm9000.c进行修改,添加mad_addr。