This is my source code of board-9607.c
Tell me if you see a error.
/*
- Copyright © 2015, The Linux Foundation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 and
- only version 2 as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
*/
#include <linux/kernel.h>
#include <asm/mach/map.h>
#include <asm/mach/arch.h>
#include “board-dt.h”
#ifdef CONFIG_WL_TI
#include <linux/wl12xx.h>
#endif
#include <linux/irq.h>
#include <linux/can/platform/mcp251x.h>
#include <linux/gpio.h>
/*
- CAN bus GPIO interrupt line uses kernel GPIO73 which maps to user space
- GPIO42
*/
#define MCP2515_CAN_IRQGPIO_PIN 79
static const char *mdm9607_dt_match[] __initconst = {
“qcom,mdm9607”,
NULL
};
static void __init mdm9607_init(void)
{
board_dt_populate(NULL);
}
/* CAN driver modification /
static struct mcp251x_platform_data msm_mcp2515_pdata = {
.oscillator_frequency = 161000*1000,
};
/* CAN driver modification /
static struct spi_board_info msm_spi_mcp2515_board_info[] = {
[0] = {
.modalias = “mcp2515”,
.platform_data = &msm_mcp2515_pdata,
.max_speed_hz = 21000*1000,
.mode = SPI_MODE_0,
.bus_num = 0,
.chip_select = 0,
},
};
static void __init msm9615_mcp2515_init(void)
{
if ((gpio_request(MCP2515_CAN_IRQGPIO_PIN, “can_irq”) == 0) &&
(gpio_direction_input(MCP2515_CAN_IRQGPIO_PIN) == 0)) {
gpio_export(MCP2515_CAN_IRQGPIO_PIN, 0);
irq_set_irq_type(gpio_to_irq(MCP2515_CAN_IRQGPIO_PIN), IRQ_TYPE_EDGE_FALLING);
} else {
printk(KERN_ERR “Could not obtain gpio for MCP251X CAN bus interrupt\n”);
return;
}
msm_spi_mcp2515_board_info[0].irq = gpio_to_irq(MCP2515_CAN_IRQGPIO_PIN);
pr_notice(
“msm9615_mcp2515_init init done(gpio:%d irq:%d).\n”,
MCP2515_CAN_IRQGPIO_PIN,
msm_spi_mcp2515_board_info[0].irq);
}
#ifdef CONFIG_WL_TI
#define MSM_WIFI_IRQ_GPIO 79
#endif
/* CAN driver modification */
static void __init msm9615_common_init(void)
{
pr_notice(“Kernel with CANBUS support initializing\n”);
msm9615_mcp2515_init();
spi_register_board_info(
msm_spi_mcp2515_board_info,
ARRAY_SIZE(msm_spi_mcp2515_board_info));
}
/* CAN driver modification */
static void __init msm9615_mtp_init(void)
{
msm9615_common_init();
}
#ifdef CONFIG_WL_TI
static void __init mdm9607_wl18xx_init(void)
{
struct wl12xx_platform_data msm_wl12xx_pdata;
int ret;
memset(&msm_wl12xx_pdata, 0, sizeof(msm_wl12xx_pdata));
msm_wl12xx_pdata.irq = gpio_to_irq(MSM_WIFI_IRQ_GPIO);
printk(KERN_ERR "wl12xx GPIO: %d\n", msm_wl12xx_pdata.irq);
if (msm_wl12xx_pdata.irq < 0)
goto fail;
msm_wl12xx_pdata.use_eeprom = true;
msm_wl12xx_pdata.board_ref_clock = WL12XX_REFCLOCK_38;
msm_wl12xx_pdata.board_tcxo_clock = 0;
ret = wl12xx_set_platform_data(&msm_wl12xx_pdata);
if (ret < 0)
goto fail;
pr_info("wl18xx board initialization done\n");
return;
fail:
pr_err("%s: wl12xx board initialisation failed\n", func);
}
#endif
DT_MACHINE_START(MDM9607_DT,
“Qualcomm Technologies, Inc. MDM 9607 (Flattened Device Tree)”)
.init_machine = mdm9607_init,
.dt_compat = mdm9607_dt_match,
.init_machine = msm9615_mtp_init, /* CAN driver modification */
#ifdef CONFIG_WL_TI
.init_late = mdm9607_wl18xx_init,
#endif
MACHINE_END