mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 22:52:35 +02:00
gps:add gps support for rk2928 and rk3066b
This commit is contained in:
parent
47ea370224
commit
2c70c8f5df
|
|
@ -53,6 +53,10 @@
|
|||
#if defined(CONFIG_SPIM_RK29)
|
||||
#include "../../../drivers/spi/rk29_spim.h"
|
||||
#endif
|
||||
#if defined(CONFIG_GPS_RK)
|
||||
#include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_THREE_FB_BUFFER
|
||||
#define RK30_FB0_MEM_SIZE 12*SZ_1M
|
||||
|
|
@ -687,6 +691,92 @@ static struct platform_device device_acodec = {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_GPS_RK)
|
||||
int rk_gps_io_init(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
rk30_mux_api_set(GPIO1B1_SPI_TXD_UART1_SOUT_NAME, GPIO1B_GPIO1B1);//VCC_EN
|
||||
gpio_request(RK2928_PIN1_PB1, NULL);
|
||||
gpio_direction_output(RK2928_PIN1_PB1, GPIO_LOW);
|
||||
|
||||
rk30_mux_api_set(GPIO1A2_I2S_LRCKRX_GPS_CLK_NAME, GPIO1A_GPS_CLK);//GPS_CLK
|
||||
rk30_mux_api_set(GPIO1A4_I2S_SDO_GPS_MAG_NAME, GPIO1A_GPS_MAG);//GPS_MAG
|
||||
rk30_mux_api_set(GPIO1A5_I2S_SDI_GPS_SIGN_NAME, GPIO1A_GPS_SIGN);//GPS_SIGN
|
||||
|
||||
rk30_mux_api_set(GPIO1B0_SPI_CLK_UART1_CTSN_NAME, GPIO1B_GPIO1B0);//SPI_CLK
|
||||
gpio_request(RK2928_PIN1_PB0, NULL);
|
||||
gpio_direction_output(RK2928_PIN1_PB0, GPIO_LOW);
|
||||
|
||||
rk30_mux_api_set(GPIO1B2_SPI_RXD_UART1_SIN_NAME, GPIO1B_GPIO1B2);//SPI_MOSI
|
||||
gpio_request(RK2928_PIN1_PB2, NULL);
|
||||
gpio_direction_output(RK2928_PIN1_PB2, GPIO_LOW);
|
||||
|
||||
rk30_mux_api_set(GPIO1B3_SPI_CSN0_UART1_RTSN_NAME, GPIO1B_GPIO1B3);//SPI_CS
|
||||
gpio_request(RK2928_PIN1_PB3, NULL);
|
||||
gpio_direction_output(RK2928_PIN1_PB3, GPIO_LOW);
|
||||
return 0;
|
||||
}
|
||||
int rk_gps_power_up(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rk_gps_power_down(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rk_gps_reset_set(int level)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int rk_enable_hclk_gps(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
clk_enable(clk_get(NULL, "aclk_gps"));
|
||||
return 0;
|
||||
}
|
||||
int rk_disable_hclk_gps(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
clk_disable(clk_get(NULL, "aclk_gps"));
|
||||
return 0;
|
||||
}
|
||||
struct rk_gps_data rk_gps_info = {
|
||||
.io_init = rk_gps_io_init,
|
||||
.power_up = rk_gps_power_up,
|
||||
.power_down = rk_gps_power_down,
|
||||
.reset = rk_gps_reset_set,
|
||||
.enable_hclk_gps = rk_enable_hclk_gps,
|
||||
.disable_hclk_gps = rk_disable_hclk_gps,
|
||||
.GpsSign = RK2928_PIN1_PA5,
|
||||
.GpsMag = RK2928_PIN1_PA4, //GPIO index
|
||||
.GpsClk = RK2928_PIN1_PA2, //GPIO index
|
||||
.GpsVCCEn = RK2928_PIN1_PB1, //GPIO index
|
||||
.GpsSpi_CSO = RK2928_PIN1_PB3, //GPIO index
|
||||
.GpsSpiClk = RK2928_PIN1_PB0, //GPIO index
|
||||
.GpsSpiMOSI = RK2928_PIN1_PB2, //GPIO index
|
||||
.GpsIrq = IRQ_GPS,
|
||||
.GpsSpiEn = 1,
|
||||
.GpsAdcCh = 2,
|
||||
.u32GpsPhyAddr = RK2928_GPS_PHYS,
|
||||
.u32GpsPhySize = RK2928_GPS_SIZE,
|
||||
};
|
||||
|
||||
struct platform_device rk_device_gps = {
|
||||
.name = "gps_hv5820b",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &rk_gps_info,
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
#ifdef CONFIG_FB_ROCKCHIP
|
||||
&device_fb,
|
||||
|
|
@ -709,6 +799,10 @@ static struct platform_device *devices[] __initdata = {
|
|||
#ifdef CONFIG_SND_SOC_RK2928
|
||||
&device_acodec,
|
||||
#endif
|
||||
#ifdef CONFIG_GPS_RK
|
||||
&rk_device_gps,
|
||||
#endif
|
||||
|
||||
};
|
||||
//i2c
|
||||
#ifdef CONFIG_I2C0_RK30
|
||||
|
|
@ -875,6 +969,12 @@ static void __init rk2928_reserve(void)
|
|||
#ifdef CONFIG_VIDEO_RK29
|
||||
rk30_camera_request_reserve_mem();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GPS_RK
|
||||
//it must be more than 8MB
|
||||
rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
|
||||
#endif
|
||||
|
||||
board_mem_reserved();
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@
|
|||
#if defined(CONFIG_SPIM_RK29)
|
||||
#include "../../../drivers/spi/rk29_spim.h"
|
||||
#endif
|
||||
#if defined(CONFIG_GPS_RK)
|
||||
#include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MU509)
|
||||
#include <linux/mu509.h>
|
||||
#endif
|
||||
|
|
@ -1081,6 +1085,93 @@ static struct platform_device device_rfkill_rk = {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_GPS_RK)
|
||||
int rk_gps_io_init(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
|
||||
rk30_mux_api_set(GPIO1B5_UART3RTSN_NAME, GPIO1B_GPIO1B5);//VCC_EN
|
||||
gpio_request(RK30_PIN1_PB5, NULL);
|
||||
gpio_direction_output(RK30_PIN1_PB5, GPIO_LOW);
|
||||
|
||||
rk30_mux_api_set(GPIO1B4_UART3CTSN_GPSRFCLK_NAME, GPIO1B_GPSRFCLK);//GPS_CLK
|
||||
rk30_mux_api_set(GPIO1B2_UART3SIN_GPSMAG_NAME, GPIO1B_GPSMAG);//GPS_MAG
|
||||
rk30_mux_api_set(GPIO1B3_UART3SOUT_GPSSIG_NAME, GPIO1B_GPSSIG);//GPS_SIGN
|
||||
|
||||
rk30_mux_api_set(GPIO1A6_UART1CTSN_SPI0CLK_NAME, GPIO1A_GPIO1A6);//SPI_CLK
|
||||
gpio_request(RK30_PIN1_PA6, NULL);
|
||||
gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
|
||||
|
||||
rk30_mux_api_set(GPIO1A5_UART1SOUT_SPI0TXD_NAME, GPIO1A_GPIO1A5);//SPI_MOSI
|
||||
gpio_request(RK30_PIN1_PA5, NULL);
|
||||
gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW);
|
||||
|
||||
rk30_mux_api_set(GPIO1A7_UART1RTSN_SPI0CSN0_NAME, GPIO1A_GPIO1A7);//SPI_CS
|
||||
gpio_request(RK30_PIN1_PA7, NULL);
|
||||
gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);
|
||||
return 0;
|
||||
}
|
||||
int rk_gps_power_up(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rk_gps_power_down(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rk_gps_reset_set(int level)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int rk_enable_hclk_gps(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
clk_enable(clk_get(NULL, "hclk_gps"));
|
||||
return 0;
|
||||
}
|
||||
int rk_disable_hclk_gps(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
clk_disable(clk_get(NULL, "hclk_gps"));
|
||||
return 0;
|
||||
}
|
||||
struct rk_gps_data rk_gps_info = {
|
||||
.io_init = rk_gps_io_init,
|
||||
.power_up = rk_gps_power_up,
|
||||
.power_down = rk_gps_power_down,
|
||||
.reset = rk_gps_reset_set,
|
||||
.enable_hclk_gps = rk_enable_hclk_gps,
|
||||
.disable_hclk_gps = rk_disable_hclk_gps,
|
||||
.GpsSign = RK30_PIN1_PB3,
|
||||
.GpsMag = RK30_PIN1_PB2, //GPIO index
|
||||
.GpsClk = RK30_PIN1_PB4, //GPIO index
|
||||
.GpsVCCEn = RK30_PIN1_PB5, //GPIO index
|
||||
.GpsSpi_CSO = RK30_PIN1_PA4, //GPIO index
|
||||
.GpsSpiClk = RK30_PIN1_PA5, //GPIO index
|
||||
.GpsSpiMOSI = RK30_PIN1_PA7, //GPIO index
|
||||
.GpsIrq = IRQ_GPS,
|
||||
.GpsSpiEn = 0,
|
||||
.GpsAdcCh = 2,
|
||||
.u32GpsPhyAddr = RK30_GPS_PHYS,
|
||||
.u32GpsPhySize = RK30_GPS_SIZE,
|
||||
};
|
||||
|
||||
struct platform_device rk_device_gps = {
|
||||
.name = "gps_hv5820b",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &rk_gps_info,
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
#ifdef CONFIG_FB_ROCKCHIP
|
||||
&device_fb,
|
||||
|
|
@ -1129,6 +1220,10 @@ static struct platform_device *devices[] __initdata = {
|
|||
#ifdef CONFIG_RFKILL_RK
|
||||
&device_rfkill_rk,
|
||||
#endif
|
||||
#ifdef CONFIG_GPS_RK
|
||||
&rk_device_gps,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
// i2c
|
||||
|
|
@ -1459,6 +1554,11 @@ static void __init rk30_reserve(void)
|
|||
#ifdef CONFIG_VIDEO_RK29
|
||||
rk30_camera_request_reserve_mem();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GPS_RK
|
||||
//it must be more than 8MB
|
||||
rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
|
||||
#endif
|
||||
board_mem_reserved();
|
||||
}
|
||||
|
||||
|
|
|
|||
2
drivers/misc/Makefile
Normal file → Executable file
2
drivers/misc/Makefile
Normal file → Executable file
|
|
@ -54,7 +54,7 @@ obj-$(CONFIG_MTK23D) += mtk23d.o
|
|||
obj-$(CONFIG_FM580X) += fm580x.o
|
||||
obj-$(CONFIG_RK29_SUPPORT_MODEM) += rk29_modem/
|
||||
obj-$(CONFIG_3G_MODULE) += 3g_module/
|
||||
obj-$(CONFIG_GPS_GNS7560) += gps/
|
||||
obj-$(CONFIG_GPS_DEVICES) += gps/
|
||||
obj-y += inv_mpu/
|
||||
obj-$(CONFIG_TDSC8800) += tdsc8800.o
|
||||
obj-$(CONFIG_RK29_SC8800) += sc8800.o
|
||||
|
|
|
|||
11
drivers/misc/gps/Kconfig
Normal file → Executable file
11
drivers/misc/gps/Kconfig
Normal file → Executable file
|
|
@ -2,17 +2,20 @@
|
|||
# gps device configuration
|
||||
#
|
||||
|
||||
menuconfig RK29_GPS
|
||||
bool "RK29 support GPS"
|
||||
menuconfig GPS_DEVICES
|
||||
bool "support GPS devices"
|
||||
default n
|
||||
---help---
|
||||
Say Y here if you have a support modem
|
||||
Say Y here if you support gps
|
||||
|
||||
if RK29_GPS
|
||||
if GPS_DEVICES
|
||||
|
||||
source "drivers/misc/gps/rk_gps/Kconfig"
|
||||
|
||||
config GPS_GNS7560
|
||||
bool "gns7560 support"
|
||||
default n
|
||||
|
||||
|
||||
endif # RK29_GPS
|
||||
|
||||
|
|
|
|||
3
drivers/misc/gps/Makefile
Normal file → Executable file
3
drivers/misc/gps/Makefile
Normal file → Executable file
|
|
@ -1,3 +1,2 @@
|
|||
obj-$(CONFIG_GPS_DEVICES) += rk_gps/
|
||||
obj-$(CONFIG_GPS_GNS7560) += rk29_gps.o
|
||||
|
||||
|
||||
|
|
|
|||
13
drivers/misc/gps/rk_gps/Kconfig
Executable file
13
drivers/misc/gps/rk_gps/Kconfig
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# gps device configuration
|
||||
#
|
||||
|
||||
|
||||
|
||||
config GPS_RK
|
||||
tristate "rk gps support"
|
||||
default M
|
||||
|
||||
|
||||
|
||||
|
||||
4
drivers/misc/gps/rk_gps/Makefile
Executable file
4
drivers/misc/gps/rk_gps/Makefile
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
# All selected in one module named smsmdtv
|
||||
gps-objs := rk_gps_null.o
|
||||
obj-$(CONFIG_GPS_RK) += gps.o
|
||||
|
||||
34
drivers/misc/gps/rk_gps/rk_gps.h
Executable file
34
drivers/misc/gps/rk_gps/rk_gps.h
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
2012.07.25 lby@rock-chips.com
|
||||
*/
|
||||
|
||||
#ifndef __RK_GPS_H__
|
||||
#define __RK_GPS_H__
|
||||
|
||||
struct rk_gps_data {
|
||||
int (*io_init)(void);
|
||||
int (*power_up)(void);
|
||||
int (*power_down)(void);
|
||||
int (*reset)(int);
|
||||
int (*enable_hclk_gps)(void);
|
||||
int (*disable_hclk_gps)(void);
|
||||
int GpsSign;
|
||||
int GpsMag; //GPIO index
|
||||
int GpsClk; //GPIO index
|
||||
int GpsVCCEn; //GPIO index
|
||||
int GpsSpi_CSO; //GPIO index
|
||||
int GpsSpiClk; //GPIO index
|
||||
int GpsSpiMOSI; //GPIO index
|
||||
int GpsSpiEn; //USE SPI
|
||||
int GpsAdcCh; //ADC CHANNEL
|
||||
int GpsIrq;
|
||||
|
||||
unsigned long u32GpsPhyAddr;
|
||||
int u32GpsPhySize;
|
||||
unsigned long u32MemoryPhyAddr; //must reserved 8MB memory for GPS
|
||||
unsigned long u32MemoryVirAddr;
|
||||
unsigned long u32GpsRegBase; //GPS register base virtual address
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
1
drivers/misc/gps/rk_gps/rk_gps_null.c
Normal file
1
drivers/misc/gps/rk_gps/rk_gps_null.c
Normal file
|
|
@ -0,0 +1 @@
|
|||
//for rk_gps building
|
||||
Loading…
Reference in New Issue
Block a user