SoC updates for DaVinci. Changes include:
1) Support for PRUSS UIO driver for DA850 SoC and related SRAM support updates. 2) Prepration for common clock migration 3) Serial support related changes for DA850 DT boot -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAABAgAGBQJQj9ToAAoJEGFBu2jqvgRNbg0P/RUXgLAiHJWsjDnHviCZjlNE VamdGJJ14acGZ0As6KHEfAhSisarCuCtwTl7gibULt1XF7TB1m/1zpmvhnRkS96d 5CZ8l60dkoW/A5FdxR0a/hysNBkfRgchf4beUfh0dzP9wZ1O9FuT7mTyis1NBk/a ZjJHAvzcPQA7Ikmp3OYvRRsJSKCX82omsrt6yI/0mbyz2eWJkRKkzMq8qx9ZPChN mKi6z3Ah5hag+Bpac2dJ9VaZG5YHeZZqYglslNbx0Z01EMhmjDpSLRUHghT/zTpZ jKdqsu80xO+G2vlSp7rB/W/3KS5ZHXvRXYMyntrx7HSG3T+CaTbt6ngByKViGhtV znDEi7JGL6JcbNEI+i75gcCfRrk62DxLz6gyg4+cMYQhJZ07+gsYYVr1JBdXFs0C O5eszB+tpAyldmuS7WxPWALUIOAX2PNVpZR8F8qyUqQ6OEGCtfPWTJ+Cc6/odbW3 W7q6X+WcqUFjVt99dAiStZtGr/8SKSzDR+f2vdvVKuVtd+3dStzmTUg1RXoTo6yA 0YcOeM5yOVt90WVXHNqdo8yjZgXZ57Ruc2RyRLE8nKT70bNYFYq6wCXii57AbyI+ ra/g3R3heA6FfeDXL9/kuTSUypRgNlIS2dYfMXTHYze0lWu0j+ohZIaURYNQeEA/ WEpammCK9AKgd3b98p0u =Z2vS -----END PGP SIGNATURE----- Merge tag 'davinci-for-v3.8/soc' of git://gitorious.org/linux-davinci/linux-davinci into next/soc From Sekhar Nori: SoC updates for DaVinci. Changes include: 1) Support for PRUSS UIO driver for DA850 SoC and related SRAM support updates. 2) Prepration for common clock migration 3) Serial support related changes for DA850 DT boot * tag 'davinci-for-v3.8/soc' of git://gitorious.org/linux-davinci/linux-davinci: ARM: davinci: da8xx: add DA850 PRUSS support ARM: davinci: add platform hook to fetch the SRAM pool ARM: davinci: da850: changed SRAM allocator to shared ram. ARM: davinci: sram: switch from iotable to ioremapped regions uio: uio_pruss: replace private SRAM API with genalloc ARM: davinci: serial: provide API to initialze UART clocks ARM: davinci: convert platform code to use clk_prepare/clk_unprepare Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
Коммит
0056a985fa
|
@ -324,7 +324,7 @@ static __init void dm355_evm_init(void)
|
||||||
if (IS_ERR(aemif))
|
if (IS_ERR(aemif))
|
||||||
WARN("%s: unable to get AEMIF clock\n", __func__);
|
WARN("%s: unable to get AEMIF clock\n", __func__);
|
||||||
else
|
else
|
||||||
clk_enable(aemif);
|
clk_prepare_enable(aemif);
|
||||||
|
|
||||||
platform_add_devices(davinci_evm_devices,
|
platform_add_devices(davinci_evm_devices,
|
||||||
ARRAY_SIZE(davinci_evm_devices));
|
ARRAY_SIZE(davinci_evm_devices));
|
||||||
|
|
|
@ -246,7 +246,7 @@ static __init void dm355_leopard_init(void)
|
||||||
if (IS_ERR(aemif))
|
if (IS_ERR(aemif))
|
||||||
WARN("%s: unable to get AEMIF clock\n", __func__);
|
WARN("%s: unable to get AEMIF clock\n", __func__);
|
||||||
else
|
else
|
||||||
clk_enable(aemif);
|
clk_prepare_enable(aemif);
|
||||||
|
|
||||||
platform_add_devices(davinci_leopard_devices,
|
platform_add_devices(davinci_leopard_devices,
|
||||||
ARRAY_SIZE(davinci_leopard_devices));
|
ARRAY_SIZE(davinci_leopard_devices));
|
||||||
|
|
|
@ -478,7 +478,7 @@ static void __init evm_init_cpld(void)
|
||||||
aemif_clk = clk_get(NULL, "aemif");
|
aemif_clk = clk_get(NULL, "aemif");
|
||||||
if (IS_ERR(aemif_clk))
|
if (IS_ERR(aemif_clk))
|
||||||
return;
|
return;
|
||||||
clk_enable(aemif_clk);
|
clk_prepare_enable(aemif_clk);
|
||||||
|
|
||||||
if (request_mem_region(DM365_ASYNC_EMIF_DATA_CE1_BASE, SECTION_SIZE,
|
if (request_mem_region(DM365_ASYNC_EMIF_DATA_CE1_BASE, SECTION_SIZE,
|
||||||
"cpld") == NULL)
|
"cpld") == NULL)
|
||||||
|
@ -489,7 +489,7 @@ static void __init evm_init_cpld(void)
|
||||||
SECTION_SIZE);
|
SECTION_SIZE);
|
||||||
fail:
|
fail:
|
||||||
pr_err("ERROR: can't map CPLD\n");
|
pr_err("ERROR: can't map CPLD\n");
|
||||||
clk_disable(aemif_clk);
|
clk_disable_unprepare(aemif_clk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -776,7 +776,7 @@ static __init void davinci_evm_init(void)
|
||||||
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
||||||
|
|
||||||
aemif_clk = clk_get(NULL, "aemif");
|
aemif_clk = clk_get(NULL, "aemif");
|
||||||
clk_enable(aemif_clk);
|
clk_prepare_enable(aemif_clk);
|
||||||
|
|
||||||
if (HAS_ATA) {
|
if (HAS_ATA) {
|
||||||
if (HAS_NAND || HAS_NOR)
|
if (HAS_NAND || HAS_NOR)
|
||||||
|
|
|
@ -188,7 +188,7 @@ static __init void davinci_ntosd2_init(void)
|
||||||
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
||||||
|
|
||||||
aemif_clk = clk_get(NULL, "aemif");
|
aemif_clk = clk_get(NULL, "aemif");
|
||||||
clk_enable(aemif_clk);
|
clk_prepare_enable(aemif_clk);
|
||||||
|
|
||||||
if (HAS_ATA) {
|
if (HAS_ATA) {
|
||||||
if (HAS_NAND)
|
if (HAS_NAND)
|
||||||
|
|
|
@ -212,6 +212,12 @@ static struct clk tptc2_clk = {
|
||||||
.flags = ALWAYS_ENABLED,
|
.flags = ALWAYS_ENABLED,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct clk pruss_clk = {
|
||||||
|
.name = "pruss",
|
||||||
|
.parent = &pll0_sysclk2,
|
||||||
|
.lpsc = DA8XX_LPSC0_PRUSS,
|
||||||
|
};
|
||||||
|
|
||||||
static struct clk uart0_clk = {
|
static struct clk uart0_clk = {
|
||||||
.name = "uart0",
|
.name = "uart0",
|
||||||
.parent = &pll0_sysclk2,
|
.parent = &pll0_sysclk2,
|
||||||
|
@ -385,6 +391,7 @@ static struct clk_lookup da850_clks[] = {
|
||||||
CLK(NULL, "tptc1", &tptc1_clk),
|
CLK(NULL, "tptc1", &tptc1_clk),
|
||||||
CLK(NULL, "tpcc1", &tpcc1_clk),
|
CLK(NULL, "tpcc1", &tpcc1_clk),
|
||||||
CLK(NULL, "tptc2", &tptc2_clk),
|
CLK(NULL, "tptc2", &tptc2_clk),
|
||||||
|
CLK("pruss_uio", "pruss", &pruss_clk),
|
||||||
CLK(NULL, "uart0", &uart0_clk),
|
CLK(NULL, "uart0", &uart0_clk),
|
||||||
CLK(NULL, "uart1", &uart1_clk),
|
CLK(NULL, "uart1", &uart1_clk),
|
||||||
CLK(NULL, "uart2", &uart2_clk),
|
CLK(NULL, "uart2", &uart2_clk),
|
||||||
|
@ -781,12 +788,6 @@ static struct map_desc da850_io_desc[] = {
|
||||||
.length = DA8XX_CP_INTC_SIZE,
|
.length = DA8XX_CP_INTC_SIZE,
|
||||||
.type = MT_DEVICE
|
.type = MT_DEVICE
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.virtual = SRAM_VIRT,
|
|
||||||
.pfn = __phys_to_pfn(DA8XX_ARM_RAM_BASE),
|
|
||||||
.length = SZ_8K,
|
|
||||||
.type = MT_DEVICE
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
|
static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
|
||||||
|
@ -1239,8 +1240,8 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
|
||||||
.gpio_irq = IRQ_DA8XX_GPIO0,
|
.gpio_irq = IRQ_DA8XX_GPIO0,
|
||||||
.serial_dev = &da8xx_serial_device,
|
.serial_dev = &da8xx_serial_device,
|
||||||
.emac_pdata = &da8xx_emac_pdata,
|
.emac_pdata = &da8xx_emac_pdata,
|
||||||
.sram_dma = DA8XX_ARM_RAM_BASE,
|
.sram_dma = DA8XX_SHARED_RAM_BASE,
|
||||||
.sram_len = SZ_8K,
|
.sram_len = SZ_128K,
|
||||||
};
|
};
|
||||||
|
|
||||||
void __init da850_init(void)
|
void __init da850_init(void)
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <mach/time.h>
|
#include <mach/time.h>
|
||||||
#include <mach/da8xx.h>
|
#include <mach/da8xx.h>
|
||||||
#include <mach/cpuidle.h>
|
#include <mach/cpuidle.h>
|
||||||
|
#include <mach/sram.h>
|
||||||
|
|
||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
#include "asp.h"
|
#include "asp.h"
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
#define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */
|
#define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */
|
||||||
#define DA8XX_I2C0_BASE 0x01c22000
|
#define DA8XX_I2C0_BASE 0x01c22000
|
||||||
#define DA8XX_RTC_BASE 0x01c23000
|
#define DA8XX_RTC_BASE 0x01c23000
|
||||||
|
#define DA8XX_PRUSS_MEM_BASE 0x01c30000
|
||||||
#define DA8XX_MMCSD0_BASE 0x01c40000
|
#define DA8XX_MMCSD0_BASE 0x01c40000
|
||||||
#define DA8XX_SPI0_BASE 0x01c41000
|
#define DA8XX_SPI0_BASE 0x01c41000
|
||||||
#define DA830_SPI1_BASE 0x01e12000
|
#define DA830_SPI1_BASE 0x01e12000
|
||||||
|
@ -518,6 +520,75 @@ void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct resource da8xx_pruss_resources[] = {
|
||||||
|
{
|
||||||
|
.start = DA8XX_PRUSS_MEM_BASE,
|
||||||
|
.end = DA8XX_PRUSS_MEM_BASE + 0xFFFF,
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.start = IRQ_DA8XX_EVTOUT0,
|
||||||
|
.end = IRQ_DA8XX_EVTOUT0,
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.start = IRQ_DA8XX_EVTOUT1,
|
||||||
|
.end = IRQ_DA8XX_EVTOUT1,
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.start = IRQ_DA8XX_EVTOUT2,
|
||||||
|
.end = IRQ_DA8XX_EVTOUT2,
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.start = IRQ_DA8XX_EVTOUT3,
|
||||||
|
.end = IRQ_DA8XX_EVTOUT3,
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.start = IRQ_DA8XX_EVTOUT4,
|
||||||
|
.end = IRQ_DA8XX_EVTOUT4,
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.start = IRQ_DA8XX_EVTOUT5,
|
||||||
|
.end = IRQ_DA8XX_EVTOUT5,
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.start = IRQ_DA8XX_EVTOUT6,
|
||||||
|
.end = IRQ_DA8XX_EVTOUT6,
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.start = IRQ_DA8XX_EVTOUT7,
|
||||||
|
.end = IRQ_DA8XX_EVTOUT7,
|
||||||
|
.flags = IORESOURCE_IRQ,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct uio_pruss_pdata da8xx_uio_pruss_pdata = {
|
||||||
|
.pintc_base = 0x4000,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct platform_device da8xx_uio_pruss_dev = {
|
||||||
|
.name = "pruss_uio",
|
||||||
|
.id = -1,
|
||||||
|
.num_resources = ARRAY_SIZE(da8xx_pruss_resources),
|
||||||
|
.resource = da8xx_pruss_resources,
|
||||||
|
.dev = {
|
||||||
|
.coherent_dma_mask = DMA_BIT_MASK(32),
|
||||||
|
.platform_data = &da8xx_uio_pruss_pdata,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int __init da8xx_register_uio_pruss(void)
|
||||||
|
{
|
||||||
|
da8xx_uio_pruss_pdata.sram_pool = sram_get_gen_pool();
|
||||||
|
return platform_device_register(&da8xx_uio_pruss_dev);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct display_panel disp_panel = {
|
static const struct display_panel disp_panel = {
|
||||||
QVGA,
|
QVGA,
|
||||||
16,
|
16,
|
||||||
|
@ -900,7 +971,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr)
|
||||||
if (IS_ERR(da850_sata_clk))
|
if (IS_ERR(da850_sata_clk))
|
||||||
return PTR_ERR(da850_sata_clk);
|
return PTR_ERR(da850_sata_clk);
|
||||||
|
|
||||||
ret = clk_enable(da850_sata_clk);
|
ret = clk_prepare_enable(da850_sata_clk);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err0;
|
goto err0;
|
||||||
|
|
||||||
|
@ -931,7 +1002,7 @@ static int da850_sata_init(struct device *dev, void __iomem *addr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err1:
|
err1:
|
||||||
clk_disable(da850_sata_clk);
|
clk_disable_unprepare(da850_sata_clk);
|
||||||
err0:
|
err0:
|
||||||
clk_put(da850_sata_clk);
|
clk_put(da850_sata_clk);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -939,7 +1010,7 @@ err0:
|
||||||
|
|
||||||
static void da850_sata_exit(struct device *dev)
|
static void da850_sata_exit(struct device *dev)
|
||||||
{
|
{
|
||||||
clk_disable(da850_sata_clk);
|
clk_disable_unprepare(da850_sata_clk);
|
||||||
clk_put(da850_sata_clk);
|
clk_put(da850_sata_clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -758,12 +758,6 @@ static struct map_desc dm355_io_desc[] = {
|
||||||
.length = IO_SIZE,
|
.length = IO_SIZE,
|
||||||
.type = MT_DEVICE
|
.type = MT_DEVICE
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.virtual = SRAM_VIRT,
|
|
||||||
.pfn = __phys_to_pfn(0x00010000),
|
|
||||||
.length = SZ_32K,
|
|
||||||
.type = MT_MEMORY_NONCACHED,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Contents of JTAG ID register used to identify exact cpu type */
|
/* Contents of JTAG ID register used to identify exact cpu type */
|
||||||
|
|
|
@ -985,12 +985,6 @@ static struct map_desc dm365_io_desc[] = {
|
||||||
.length = IO_SIZE,
|
.length = IO_SIZE,
|
||||||
.type = MT_DEVICE
|
.type = MT_DEVICE
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.virtual = SRAM_VIRT,
|
|
||||||
.pfn = __phys_to_pfn(0x00010000),
|
|
||||||
.length = SZ_32K,
|
|
||||||
.type = MT_MEMORY_NONCACHED,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct resource dm365_ks_resources[] = {
|
static struct resource dm365_ks_resources[] = {
|
||||||
|
|
|
@ -786,12 +786,6 @@ static struct map_desc dm644x_io_desc[] = {
|
||||||
.length = IO_SIZE,
|
.length = IO_SIZE,
|
||||||
.type = MT_DEVICE
|
.type = MT_DEVICE
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.virtual = SRAM_VIRT,
|
|
||||||
.pfn = __phys_to_pfn(0x00008000),
|
|
||||||
.length = SZ_16K,
|
|
||||||
.type = MT_MEMORY_NONCACHED,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Contents of JTAG ID register used to identify exact cpu type */
|
/* Contents of JTAG ID register used to identify exact cpu type */
|
||||||
|
|
|
@ -756,12 +756,6 @@ static struct map_desc dm646x_io_desc[] = {
|
||||||
.length = IO_SIZE,
|
.length = IO_SIZE,
|
||||||
.type = MT_DEVICE
|
.type = MT_DEVICE
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.virtual = SRAM_VIRT,
|
|
||||||
.pfn = __phys_to_pfn(0x00010000),
|
|
||||||
.length = SZ_32K,
|
|
||||||
.type = MT_MEMORY_NONCACHED,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Contents of JTAG ID register used to identify exact cpu type */
|
/* Contents of JTAG ID register used to identify exact cpu type */
|
||||||
|
|
|
@ -104,8 +104,6 @@ int davinci_pm_init(void);
|
||||||
static inline int davinci_pm_init(void) { return 0; }
|
static inline int davinci_pm_init(void) { return 0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* standard place to map on-chip SRAMs; they *may* support DMA */
|
|
||||||
#define SRAM_VIRT 0xfffe0000
|
|
||||||
#define SRAM_SIZE SZ_128K
|
#define SRAM_SIZE SZ_128K
|
||||||
|
|
||||||
#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
|
#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <linux/platform_data/mmc-davinci.h>
|
#include <linux/platform_data/mmc-davinci.h>
|
||||||
#include <linux/platform_data/usb-davinci.h>
|
#include <linux/platform_data/usb-davinci.h>
|
||||||
#include <linux/platform_data/spi-davinci.h>
|
#include <linux/platform_data/spi-davinci.h>
|
||||||
|
#include <linux/platform_data/uio_pruss.h>
|
||||||
|
|
||||||
#include <media/davinci/vpif_types.h>
|
#include <media/davinci/vpif_types.h>
|
||||||
|
|
||||||
|
@ -72,6 +73,7 @@ extern unsigned int da850_max_speed;
|
||||||
#define DA8XX_AEMIF_CS2_BASE 0x60000000
|
#define DA8XX_AEMIF_CS2_BASE 0x60000000
|
||||||
#define DA8XX_AEMIF_CS3_BASE 0x62000000
|
#define DA8XX_AEMIF_CS3_BASE 0x62000000
|
||||||
#define DA8XX_AEMIF_CTL_BASE 0x68000000
|
#define DA8XX_AEMIF_CTL_BASE 0x68000000
|
||||||
|
#define DA8XX_SHARED_RAM_BASE 0x80000000
|
||||||
#define DA8XX_ARM_RAM_BASE 0xffff0000
|
#define DA8XX_ARM_RAM_BASE 0xffff0000
|
||||||
|
|
||||||
void __init da830_init(void);
|
void __init da830_init(void);
|
||||||
|
@ -86,6 +88,7 @@ int da8xx_register_watchdog(void);
|
||||||
int da8xx_register_usb20(unsigned mA, unsigned potpgt);
|
int da8xx_register_usb20(unsigned mA, unsigned potpgt);
|
||||||
int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
|
int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
|
||||||
int da8xx_register_emac(void);
|
int da8xx_register_emac(void);
|
||||||
|
int da8xx_register_uio_pruss(void);
|
||||||
int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
|
int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
|
||||||
int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
|
int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
|
||||||
int da850_register_mmcsd1(struct davinci_mmc_config *config);
|
int da850_register_mmcsd1(struct davinci_mmc_config *config);
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct davinci_uart_config {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int davinci_serial_init(struct davinci_uart_config *);
|
extern int davinci_serial_init(struct davinci_uart_config *);
|
||||||
|
extern int davinci_serial_setup_clk(unsigned instance, unsigned int *rate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __ASM_ARCH_SERIAL_H */
|
#endif /* __ASM_ARCH_SERIAL_H */
|
||||||
|
|
|
@ -24,4 +24,7 @@
|
||||||
extern void *sram_alloc(size_t len, dma_addr_t *dma);
|
extern void *sram_alloc(size_t len, dma_addr_t *dma);
|
||||||
extern void sram_free(void *addr, size_t len);
|
extern void sram_free(void *addr, size_t len);
|
||||||
|
|
||||||
|
/* Get the struct gen_pool * for use in platform data */
|
||||||
|
extern struct gen_pool *sram_get_gen_pool(void);
|
||||||
|
|
||||||
#endif /* __MACH_SRAM_H */
|
#endif /* __MACH_SRAM_H */
|
||||||
|
|
|
@ -70,11 +70,33 @@ static void __init davinci_serial_reset(struct plat_serial8250_port *p)
|
||||||
UART_DM646X_SCR_TX_WATERMARK);
|
UART_DM646X_SCR_TX_WATERMARK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Enable UART clock and obtain its rate */
|
||||||
|
int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
|
||||||
|
{
|
||||||
|
char name[16];
|
||||||
|
struct clk *clk;
|
||||||
|
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
||||||
|
struct device *dev = &soc_info->serial_dev->dev;
|
||||||
|
|
||||||
|
sprintf(name, "uart%d", instance);
|
||||||
|
clk = clk_get(dev, name);
|
||||||
|
if (IS_ERR(clk)) {
|
||||||
|
pr_err("%s:%d: failed to get UART%d clock\n",
|
||||||
|
__func__, __LINE__, instance);
|
||||||
|
return PTR_ERR(clk);
|
||||||
|
}
|
||||||
|
|
||||||
|
clk_prepare_enable(clk);
|
||||||
|
|
||||||
|
if (rate)
|
||||||
|
*rate = clk_get_rate(clk);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int __init davinci_serial_init(struct davinci_uart_config *info)
|
int __init davinci_serial_init(struct davinci_uart_config *info)
|
||||||
{
|
{
|
||||||
int i;
|
int i, ret;
|
||||||
char name[16];
|
|
||||||
struct clk *uart_clk;
|
|
||||||
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
struct davinci_soc_info *soc_info = &davinci_soc_info;
|
||||||
struct device *dev = &soc_info->serial_dev->dev;
|
struct device *dev = &soc_info->serial_dev->dev;
|
||||||
struct plat_serial8250_port *p = dev->platform_data;
|
struct plat_serial8250_port *p = dev->platform_data;
|
||||||
|
@ -87,16 +109,9 @@ int __init davinci_serial_init(struct davinci_uart_config *info)
|
||||||
if (!(info->enabled_uarts & (1 << i)))
|
if (!(info->enabled_uarts & (1 << i)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sprintf(name, "uart%d", i);
|
ret = davinci_serial_setup_clk(i, &p->uartclk);
|
||||||
uart_clk = clk_get(dev, name);
|
if (ret)
|
||||||
if (IS_ERR(uart_clk)) {
|
|
||||||
printk(KERN_ERR "%s:%d: failed to get UART%d clock\n",
|
|
||||||
__func__, __LINE__, i);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
clk_enable(uart_clk);
|
|
||||||
p->uartclk = clk_get_rate(uart_clk);
|
|
||||||
|
|
||||||
if (!p->membase && p->mapbase) {
|
if (!p->membase && p->mapbase) {
|
||||||
p->membase = ioremap(p->mapbase, SZ_4K);
|
p->membase = ioremap(p->mapbase, SZ_4K);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*/
|
*/
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
#include <linux/io.h>
|
||||||
#include <linux/genalloc.h>
|
#include <linux/genalloc.h>
|
||||||
|
|
||||||
#include <mach/common.h>
|
#include <mach/common.h>
|
||||||
|
@ -17,6 +18,11 @@
|
||||||
|
|
||||||
static struct gen_pool *sram_pool;
|
static struct gen_pool *sram_pool;
|
||||||
|
|
||||||
|
struct gen_pool *sram_get_gen_pool(void)
|
||||||
|
{
|
||||||
|
return sram_pool;
|
||||||
|
}
|
||||||
|
|
||||||
void *sram_alloc(size_t len, dma_addr_t *dma)
|
void *sram_alloc(size_t len, dma_addr_t *dma)
|
||||||
{
|
{
|
||||||
unsigned long vaddr;
|
unsigned long vaddr;
|
||||||
|
@ -32,7 +38,7 @@ void *sram_alloc(size_t len, dma_addr_t *dma)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (dma)
|
if (dma)
|
||||||
*dma = dma_base + (vaddr - SRAM_VIRT);
|
*dma = gen_pool_virt_to_phys(sram_pool, vaddr);
|
||||||
return (void *)vaddr;
|
return (void *)vaddr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,8 +59,10 @@ EXPORT_SYMBOL(sram_free);
|
||||||
*/
|
*/
|
||||||
static int __init sram_init(void)
|
static int __init sram_init(void)
|
||||||
{
|
{
|
||||||
|
phys_addr_t phys = davinci_soc_info.sram_dma;
|
||||||
unsigned len = davinci_soc_info.sram_len;
|
unsigned len = davinci_soc_info.sram_len;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
void *addr;
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
len = min_t(unsigned, len, SRAM_SIZE);
|
len = min_t(unsigned, len, SRAM_SIZE);
|
||||||
|
@ -62,8 +70,17 @@ static int __init sram_init(void)
|
||||||
if (!sram_pool)
|
if (!sram_pool)
|
||||||
status = -ENOMEM;
|
status = -ENOMEM;
|
||||||
}
|
}
|
||||||
if (sram_pool)
|
|
||||||
status = gen_pool_add(sram_pool, SRAM_VIRT, len, -1);
|
if (sram_pool) {
|
||||||
|
addr = ioremap(phys, len);
|
||||||
|
if (!addr)
|
||||||
|
return -ENOMEM;
|
||||||
|
status = gen_pool_add_virt(sram_pool, (unsigned)addr,
|
||||||
|
phys, len, -1);
|
||||||
|
if (status < 0)
|
||||||
|
iounmap(addr);
|
||||||
|
}
|
||||||
|
|
||||||
WARN_ON(status < 0);
|
WARN_ON(status < 0);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,7 @@ static void __init davinci_timer_init(void)
|
||||||
|
|
||||||
timer_clk = clk_get(NULL, "timer0");
|
timer_clk = clk_get(NULL, "timer0");
|
||||||
BUG_ON(IS_ERR(timer_clk));
|
BUG_ON(IS_ERR(timer_clk));
|
||||||
clk_enable(timer_clk);
|
clk_prepare_enable(timer_clk);
|
||||||
|
|
||||||
/* init timer hw */
|
/* init timer hw */
|
||||||
timer_init();
|
timer_init();
|
||||||
|
@ -429,7 +429,7 @@ void davinci_watchdog_reset(struct platform_device *pdev)
|
||||||
wd_clk = clk_get(&pdev->dev, NULL);
|
wd_clk = clk_get(&pdev->dev, NULL);
|
||||||
if (WARN_ON(IS_ERR(wd_clk)))
|
if (WARN_ON(IS_ERR(wd_clk)))
|
||||||
return;
|
return;
|
||||||
clk_enable(wd_clk);
|
clk_prepare_enable(wd_clk);
|
||||||
|
|
||||||
/* disable, internal clock source */
|
/* disable, internal clock source */
|
||||||
__raw_writel(0, base + TCR);
|
__raw_writel(0, base + TCR);
|
||||||
|
|
|
@ -97,6 +97,7 @@ config UIO_NETX
|
||||||
config UIO_PRUSS
|
config UIO_PRUSS
|
||||||
tristate "Texas Instruments PRUSS driver"
|
tristate "Texas Instruments PRUSS driver"
|
||||||
depends on ARCH_DAVINCI_DA850
|
depends on ARCH_DAVINCI_DA850
|
||||||
|
select GENERIC_ALLOCATOR
|
||||||
help
|
help
|
||||||
PRUSS driver for OMAPL138/DA850/AM18XX devices
|
PRUSS driver for OMAPL138/DA850/AM18XX devices
|
||||||
PRUSS driver requires user space components, examples and user space
|
PRUSS driver requires user space components, examples and user space
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <mach/sram.h>
|
#include <linux/genalloc.h>
|
||||||
|
|
||||||
#define DRV_NAME "pruss_uio"
|
#define DRV_NAME "pruss_uio"
|
||||||
#define DRV_VERSION "1.0"
|
#define DRV_VERSION "1.0"
|
||||||
|
@ -65,10 +65,11 @@ struct uio_pruss_dev {
|
||||||
dma_addr_t sram_paddr;
|
dma_addr_t sram_paddr;
|
||||||
dma_addr_t ddr_paddr;
|
dma_addr_t ddr_paddr;
|
||||||
void __iomem *prussio_vaddr;
|
void __iomem *prussio_vaddr;
|
||||||
void *sram_vaddr;
|
unsigned long sram_vaddr;
|
||||||
void *ddr_vaddr;
|
void *ddr_vaddr;
|
||||||
unsigned int hostirq_start;
|
unsigned int hostirq_start;
|
||||||
unsigned int pintc_base;
|
unsigned int pintc_base;
|
||||||
|
struct gen_pool *sram_pool;
|
||||||
};
|
};
|
||||||
|
|
||||||
static irqreturn_t pruss_handler(int irq, struct uio_info *info)
|
static irqreturn_t pruss_handler(int irq, struct uio_info *info)
|
||||||
|
@ -106,7 +107,9 @@ static void pruss_cleanup(struct platform_device *dev,
|
||||||
gdev->ddr_paddr);
|
gdev->ddr_paddr);
|
||||||
}
|
}
|
||||||
if (gdev->sram_vaddr)
|
if (gdev->sram_vaddr)
|
||||||
sram_free(gdev->sram_vaddr, sram_pool_sz);
|
gen_pool_free(gdev->sram_pool,
|
||||||
|
gdev->sram_vaddr,
|
||||||
|
sram_pool_sz);
|
||||||
kfree(gdev->info);
|
kfree(gdev->info);
|
||||||
clk_put(gdev->pruss_clk);
|
clk_put(gdev->pruss_clk);
|
||||||
kfree(gdev);
|
kfree(gdev);
|
||||||
|
@ -152,11 +155,18 @@ static int __devinit pruss_probe(struct platform_device *dev)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdev->sram_vaddr = sram_alloc(sram_pool_sz, &(gdev->sram_paddr));
|
if (pdata->sram_pool) {
|
||||||
|
gdev->sram_pool = pdata->sram_pool;
|
||||||
|
gdev->sram_vaddr =
|
||||||
|
gen_pool_alloc(gdev->sram_pool, sram_pool_sz);
|
||||||
if (!gdev->sram_vaddr) {
|
if (!gdev->sram_vaddr) {
|
||||||
dev_err(&dev->dev, "Could not allocate SRAM pool\n");
|
dev_err(&dev->dev, "Could not allocate SRAM pool\n");
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
gdev->sram_paddr =
|
||||||
|
gen_pool_virt_to_phys(gdev->sram_pool,
|
||||||
|
gdev->sram_vaddr);
|
||||||
|
}
|
||||||
|
|
||||||
gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz,
|
gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz,
|
||||||
&(gdev->ddr_paddr), GFP_KERNEL | GFP_DMA);
|
&(gdev->ddr_paddr), GFP_KERNEL | GFP_DMA);
|
||||||
|
|
|
@ -21,5 +21,6 @@
|
||||||
/* To configure the PRUSS INTC base offset for UIO driver */
|
/* To configure the PRUSS INTC base offset for UIO driver */
|
||||||
struct uio_pruss_pdata {
|
struct uio_pruss_pdata {
|
||||||
u32 pintc_base;
|
u32 pintc_base;
|
||||||
|
struct gen_pool *sram_pool;
|
||||||
};
|
};
|
||||||
#endif /* _UIO_PRUSS_H_ */
|
#endif /* _UIO_PRUSS_H_ */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче