Question: What steps should be followed for the configuration of a particular GSBI for I2C on 8660 ?
Answer: Steps to be followed for the GSBI configuration for I2C:
Suppose the GSBIx is to be configured:
1) In file devices-msm8x60.c, add: 
static struct resource gsbix_qup_i2c_resources[] = { 
{ 
.name = "qup_phys_addr", 
.start = MSM_GSBIx_QUP_PHYS, 
.end = MSM_GSBIx_QUP_PHYS + SZ_4K - 1, 
.flags = IORESOURCE_MEM, 
}, 
{ 
.name = "gsbi_qup_i2c_addr", 
.start = MSM_GSBIx_PHYS, 
.end = MSM_GSBIx_PHYS + 4 - 1, 
.flags = IORESOURCE_MEM, 
}, 
{ 
.name = "qup_err_intr", 
.start = GSBIx_QUP_IRQ, 
.end = GSBIx_QUP_IRQ, 
.flags = IORESOURCE_IRQ, 
}, 
}; 
/* Use GSBIx QUP for /dev/i2c-5 (i.e. if i2c-5 has not been used before else choose the next number) */ 
struct platform_device msm_gsbix_qup_i2c_device = { 
.name = "qup_i2c", 
/* this BUS_ID has been mapped to 5 inside the file  devices-msm8x60.h. this part has been explained below */
.id = MSM_GSBIx_QUP_I2C_BUS_ID,
.num_resources = ARRAY_SIZE(gsbix_qup_i2c_resources), 
.resource = gsbix_qup_i2c_resources, 
}; 
In the same file, inside the structure, struct clk msm_clocks_8x60[] = { 
/* change the following : */ 
CLK_8X60("gsbi_qup_clk", GSBIx_QUP_CLK, NULL , 0), 
/* to: */
CLK_8X60("gsbi_qup_clk", GSBIx_QUP_CLK, &msm_gsbix_qup_i2c_device.dev, 0), 
/* and change the following: */
CLK_8X60("gsbi_pclk", GSBIx_P_CLK, NULL , 0), 
/* to: */
CLK_8X60("gsbi_pclk", GSBIx_P_CLK, &msm_gsbix_qup_i2c_device.dev, 0), 
2) In file board-msm8x60.c: 
A) Add
static struct msm_i2c_platform_data msm_gsbix_qup_i2c_pdata = { 
.clk_freq = 100000, 
.src_clk_rate = 24000000, 
.clk = "gsbi_qup_clk", 
.pclk = "gsbi_pclk", 
.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, 
}; 
B) Modify
static struct platform_device *surf_devices[] __initdata = { 
/* add the following: */
&msm_gsbix_qup_i2c_device, 
C) Add
/* in section #ifdef CONFIG_I2C_QUP of msm8x60_init_buses() , add */ 
msm_gsbix_qup_i2c_device.dev.platform_data = &msm_gsbix_qup_i2c_pdata; 
3) In file devices.h, add: 
extern struct platform_device msm_gsbix_qup_i2c_device; 
4) in file devices-msm8x60.h, add: 
/* if 5 has already been used, then the next consecutive number */
#define MSM_GSBIx_QUP_I2C_BUS_ID 5
No comments:
Post a Comment