davinci queue for 2.6.37
Subsystems (8)
cover davinci queue for 2.6.37
Here is the queue of davinci related changes that are currently staged in linux-next and will be submitted for 2.6.37.
Note that the drivers/[input,net,mtd] changes all have acks/signoffs from those maintainers, but they are merging through the davinci tree along with platform related changes.
Kevin
Cyril Chemparathy (17):
Davinci: tnetv107x: retain psc reg base after init
davinci: add idcode for tnetv107x rev 1.1/1.2
net: davinci_emac: separate out davinci mdio
davinci: add mdio platform devices
omap: add mdio platform devices
net: davinci_emac: switch to new mdio
davinci: cleanup mdio arch code and switch to phy_id
omap: cleanup unused davinci mdio arch code
net: davinci_emac: cleanup unused mdio emac code
net: davinci_emac: separate out cpdma code
net: davinci_emac: switch to new cpdma layer
net: davinci_emac: cleanup unused cpdma code
input: add driver for tnetv107x on-chip keypad controller
davinci: add tnetv107x keypad platform device
davinci: add keypad config for tnetv107x evm board
input: add driver for tnetv107x touchscreen controller
davinci: add tnetv107x touchscreen platform device
Juha Kuikka (3):
DA850: Add LPSC id for MMCSD1 peripheral
DA850: Split MMCSD clock into two to support both MMCSD peripherals
DA850: Add MMCSD1 resources, platform device and convenience
registration function
Kevin Hilman (1):
davinci: clock: make 'disable unused clocks' printk debug only
Kulikov Vasiliy (1):
arm: mach-davinci: check irq2ctlr() result
Michael Williamson (5):
davinci: Add machine checks to DA8XX serial console init routines
davinci: Add CONFIG_REGULATOR_DUMMY to DA8XX defconfig file.
davinci: Initial support for MityDSP-L138/MityARM-1808
davinci: Add I2C0 devices to MityDSP-L138/MityARM-1808 platform
davinci: MityDSP-L138/MityARM-1808 read MAC address from I2C Prom
Sekhar Nori (16):
davinci: da850 evm: sparse cleanup: make file local variables static
MAINTAINERS: Add Kevin's e-mail in entry for TI DaVinci
davinci: cpufreq: bailout on regulator errors
davinci: clean up inconsistent usage of spaces in Kconfig
davinci: introduce support for AM1x ARM9 microprocessors
davinci: am18x/da850/omap-l138: use 'NOM' voltage defined in
datasheet as min voltage
davinci: dm365: disable pulldowns for all MMC/SD1 pins.
davinci: clock: add support for setting sysclk rate
davinci: cpufreq: add support for keeping an additional clock
constant
davinci: am18x/da850/omap-l138: keep async clock constant with
cpufreq
davinci: dm365 evm: use EDMAQ_3 as the audio DMA queue
davinci: add support for aemif timing configuration
nand: davinci: add support for timing configuration
davinci: dm644x evm: setup NAND flash timing
davinci: am18x/da850/omap-l138 evm: setup NAND flash timing
davinci: dm6467t evm: setup NAND flash timing
Sergei Shtylyov (2):
DA850: move NAND/NOR pin lists to the board file
DA850: move MII/RMII pin lists to the board file
Sudhakar Rajashekhara (1):
davinci: am17x/da830/omap-l137 evm: setup NAND flash timing
Victor Rodriguez (1):
davinci: Initial support for Omapl138-Hawkboard
MAINTAINERS | 4 +- arch/arm/configs/da8xx_omapl_defconfig | 3 + arch/arm/mach-davinci/Kconfig | 76 +- arch/arm/mach-davinci/Makefile | 4 +- arch/arm/mach-davinci/aemif.c | 133 +++ arch/arm/mach-davinci/board-da830-evm.c | 24 +- arch/arm/mach-davinci/board-da850-evm.c | 91 ++- arch/arm/mach-davinci/board-dm365-evm.c | 11 +- arch/arm/mach-davinci/board-dm644x-evm.c | 20 +- arch/arm/mach-davinci/board-dm646x-evm.c | 21 +- arch/arm/mach-davinci/board-mityomapl138.c | 424 +++++++ arch/arm/mach-davinci/board-neuros-osd2.c | 7 +- arch/arm/mach-davinci/board-omapl138-hawk.c | 64 ++ arch/arm/mach-davinci/board-sffsdr.c | 7 +- arch/arm/mach-davinci/board-tnetv107x-evm.c | 56 + arch/arm/mach-davinci/clock.c | 75 ++- arch/arm/mach-davinci/clock.h | 5 + arch/arm/mach-davinci/cpufreq.c | 28 +- arch/arm/mach-davinci/da850.c | 76 +- arch/arm/mach-davinci/devices-da8xx.c | 70 ++- arch/arm/mach-davinci/devices-tnetv107x.c | 50 + arch/arm/mach-davinci/devices.c | 2 +- arch/arm/mach-davinci/dm365.c | 23 +- arch/arm/mach-davinci/dm644x.c | 23 +- arch/arm/mach-davinci/dm646x.c | 22 +- arch/arm/mach-davinci/dma.c | 8 +- arch/arm/mach-davinci/include/mach/aemif.h | 36 + arch/arm/mach-davinci/include/mach/da8xx.h | 7 +- arch/arm/mach-davinci/include/mach/dm365.h | 2 +- arch/arm/mach-davinci/include/mach/dm644x.h | 2 +- arch/arm/mach-davinci/include/mach/dm646x.h | 2 +- arch/arm/mach-davinci/include/mach/nand.h | 6 +- arch/arm/mach-davinci/include/mach/psc.h | 1 + arch/arm/mach-davinci/include/mach/tnetv107x.h | 3 + arch/arm/mach-davinci/include/mach/uncompress.h | 2 + arch/arm/mach-davinci/tnetv107x.c | 11 +- arch/arm/mach-omap2/board-am3517evm.c | 31 +- drivers/input/keyboard/Kconfig | 9 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/tnetv107x-keypad.c | 340 ++++++ drivers/input/touchscreen/Kconfig | 9 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/tnetv107x-ts.c | 396 +++++++ drivers/mtd/nand/davinci_nand.c | 61 +- drivers/net/Kconfig | 21 + drivers/net/Makefile | 2 + drivers/net/davinci_cpdma.c | 965 ++++++++++++++++ drivers/net/davinci_cpdma.h | 108 ++ drivers/net/davinci_emac.c | 1338 +++-------------------- drivers/net/davinci_mdio.c | 475 ++++++++ include/linux/davinci_emac.h | 16 +- 51 files changed, 3814 insertions(+), 1358 deletions(-) create mode 100644 arch/arm/mach-davinci/aemif.c create mode 100644 arch/arm/mach-davinci/board-mityomapl138.c create mode 100644 arch/arm/mach-davinci/board-omapl138-hawk.c create mode 100644 arch/arm/mach-davinci/include/mach/aemif.h create mode 100644 drivers/input/keyboard/tnetv107x-keypad.c create mode 100644 drivers/input/touchscreen/tnetv107x-ts.c create mode 100644 drivers/net/davinci_cpdma.c create mode 100644 drivers/net/davinci_cpdma.h create mode 100644 drivers/net/davinci_mdio.c
Signature · 1 line
1.7.2.1
PATCH 1/47 davinci: da850 evm: sparse cleanup: make file local variables static
From: Sekhar Nori <[email protected]>
Without this cleanup, sparse checker reports warnings of the type:
CHECK arch/arm/mach-davinci/board-da850-evm.carch/arm/mach-davinci/board-da850-evm.c:112:22: warning: symbol 'da850_evm_nandflash_partition' was not declared. Should it be static?
The nand flash partitions and regulator supplies are used within the EVM file and so should have been static
This patch has been boot tested on DA830 and DA850 EVMs.
--- arch/arm/mach-davinci/board-da850-evm.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +7 -7
@@ -110,7 +110,7 @@ static struct platform_device da850_pm_device = {* to boot, using TI's tools to install the secondary boot loader * (UBL) and U-Boot. */ -struct mtd_partition da850_evm_nandflash_partition[] = { +static struct mtd_partition da850_evm_nandflash_partition[] = { { .name ="u-boot env" , .offset =0 ,
@@ -406,7 +406,7 @@ static int da850_lcd_hw_init(void)/* TPS65070 voltage regulator support */ /* 3.3V */ -struct regulator_consumer_supply tps65070_dcdc1_consumers[] = { +static struct regulator_consumer_supply tps65070_dcdc1_consumers[] = { { .supply ="usb0_vdda33" , },
@@ -416,7 +416,7 @@ struct regulator_consumer_supply tps65070_dcdc1_consumers[] = { };/* 3.3V or 1.8V */ -struct regulator_consumer_supply tps65070_dcdc2_consumers[] = { +static struct regulator_consumer_supply tps65070_dcdc2_consumers[] = { { .supply ="dvdd3318_a" , },
@@ -429,14 +429,14 @@ struct regulator_consumer_supply tps65070_dcdc2_consumers[] = { };/* 1.2V */ -struct regulator_consumer_supply tps65070_dcdc3_consumers[] = { +static struct regulator_consumer_supply tps65070_dcdc3_consumers[] = { { .supply ="cvdd" , }, };/* 1.8V LDO */ -struct regulator_consumer_supply tps65070_ldo1_consumers[] = { +static struct regulator_consumer_supply tps65070_ldo1_consumers[] = { { .supply ="sata_vddr" , },
@@ -452,7 +452,7 @@ struct regulator_consumer_supply tps65070_ldo1_consumers[] = { };/* 1.2V LDO */ -struct regulator_consumer_supply tps65070_ldo2_consumers[] = { +static struct regulator_consumer_supply tps65070_ldo2_consumers[] = { { .supply ="sata_vdd" , },
@@ -475,7 +475,7 @@ static struct tps6507x_reg_platform_data tps6507x_platform_data = { .defdcdc_default = true, }; -struct regulator_init_data tps65070_regulator_data[] = { +static struct regulator_init_data tps65070_regulator_data[] = {/* dcdc1 */ { .constraints = {
Signature · 1 line
1.7.2.1
PATCH 2/47 MAINTAINERS: Add Kevin's e-mail in entry for TI DaVinci
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
In absence of Kevin's e-mail address, using get_maintaner.pl in git-send-email --cc-cmd option is not CCing Kevin at all.
While at it, mark davinci-linux-open-source at linux.davincidsp.com as a list in line with what is being done for other maintainer entries.
--- MAINTAINERS | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
@@ -5247,8 +5247,8 @@ F: drivers/*/*s3c2410* F: drivers/*/*/*s3c2410* TI DAVINCI MACHINE SUPPORT -P: Kevin Hilman -M: davinci-linux-open-source at linux.davincidsp.com +M: Kevin Hilman <[email protected]> +L: davinci-linux-open-source at linux.davincidsp.com (subscribers-only) Q: http://patchwork.kernel.org/project/linux-davinci/list/ S: Supported F: arch/arm/mach-davinci
Signature · 1 line
1.7.2.1
PATCH 3/47 davinci: clock: make 'disable unused clocks' printk debug only
In reply to Kevin HilmanThe long list of clocks being disabled on boot is noisy and not needed
for standard boots. Make this a debug printk instead.
--- arch/arm/mach-davinci/clock.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/clock.c +1 -1
@@ -236,7 +236,7 @@ static int __init clk_disable_unused(void)if (!davinci_psc_is_clk_active (ck->gpsc, ck->lpsc))continue ; -pr_info ("Clocks: disable unused %s\n" , ck->name); +pr_debug ("Clocks: disable unused %s\n" , ck->name); davinci_psc_config(psc_domain(ck), ck->gpsc, ck->lpsc, (ck->flags & PSC_SWRSTDISABLE) ?
Signature · 1 line
1.7.2.1
PATCH 4/47 davinci: cpufreq: bailout on regulator errors
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
Current cpufreq code does not consider errors that can occur while changing voltage. Code to increase CPU frequency goes ahead even in the case the regulator has failed to increase the voltage. This leads to hard error since lower voltages cannot support increased frequency.
Prevent this by not increasing frequency in case increasing voltage is not successful.
Also, do not lower the voltage if changing the cpu frequency has failed for some reason.
Note that we do not return error on failure to decrease voltage as that is not a hard error.
Build fix for non-cpufreq kernels by Caglar Akyuz.
--- arch/arm/mach-davinci/cpufreq.c | 10 ++++++++-- arch/arm/mach-davinci/da850.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-davinci/cpufreq.c +8 -2
@@ -104,15 +104,21 @@ static int davinci_target(struct cpufreq_policy *policy,cpufreq_notify_transition (&freqs,CPUFREQ_PRECHANGE );/* if moving to higher frequency, up the voltage beforehand */ -if (pdata->set_voltage && freqs.new > freqs.old) - pdata->set_voltage (idx); +if (pdata->set_voltage && freqs.new > freqs.old) { + ret = pdata->set_voltage (idx); +if (ret) + goto out; + } ret =clk_set_rate (armclk, idx); +if (ret) + goto out;/* if moving to lower freq, lower the voltage after lowering freq */ if (pdata->set_voltage && freqs.new < freqs.old) pdata->set_voltage (idx); +out:cpufreq_notify_transition (&freqs,CPUFREQ_POSTCHANGE );return ret;
arch/arm/mach-davinci/da850.c +1 -1
@@ -983,7 +983,7 @@ static int da850_set_pll0rate(struct clk *clk, unsigned long index) return 0; }#else -int __init da850_register_cpufreq (void ) +int __init da850_register_cpufreq (char *async_clk) {return 0 ; }
Signature · 1 line
1.7.2.1
PATCH 5/47 davinci: clean up inconsistent usage of spaces in Kconfig
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
In arch/arm/mach-davinci/Kconfig, some of the configuration items are indented with multiple spaces instead of tabs.
Also, in couple of places, two spaces are used in the middle of help text where one should do.
This patch fixes both issues.
--- arch/arm/mach-davinci/Kconfig | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/mach-davinci/Kconfig +16 -16
@@ -20,17 +20,17 @@ config ARCH_DAVINCI_DM644x select ARCH_DAVINCI_DMx config ARCH_DAVINCI_DM355 - bool "DaVinci 355 based system" + bool "DaVinci 355 based system" select AINTC select ARCH_DAVINCI_DMx config ARCH_DAVINCI_DM646x - bool "DaVinci 646x based system" + bool "DaVinci 646x based system" select AINTC select ARCH_DAVINCI_DMx config ARCH_DAVINCI_DA830 - bool "DA830/OMAP-L137 based system" + bool "DA830/OMAP-L137 based system" select CP_INTC select ARCH_DAVINCI_DA8XX select CPU_DCACHE_WRITETHROUGH # needed on silicon revs 1.0, 1.1
@@ -140,7 +140,7 @@ config DA830_UI_LCD config DA830_UI_NAND bool "NAND flash" help - Say Y here to use the NAND flash. Do not forget to setup + Say Y here to use the NAND flash. Do not forget to setup the switch correctly. endchoice
@@ -195,20 +195,20 @@ config DAVINCI_MUX say Y. config DAVINCI_MUX_DEBUG - bool "Multiplexing debug output" - depends on DAVINCI_MUX - help - Makes the multiplexing functions print out a lot of debug info. - This is useful if you want to find out the correct values of the - multiplexing registers. + bool "Multiplexing debug output" + depends on DAVINCI_MUX + help + Makes the multiplexing functions print out a lot of debug info. + This is useful if you want to find out the correct values of the + multiplexing registers. config DAVINCI_MUX_WARNINGS - bool "Warn about pins the bootloader didn't set up" - depends on DAVINCI_MUX - help - Choose Y here to warn whenever driver initialization logic needs - to change the pin multiplexing setup. When there are no warnings - printed, it's safe to deselect DAVINCI_MUX for your product. + bool "Warn about pins the bootloader didn't set up" + depends on DAVINCI_MUX + help + Choose Y here to warn whenever driver initialization logic needs + to change the pin multiplexing setup. When there are no warnings + printed, it's safe to deselect DAVINCI_MUX for your product. config DAVINCI_RESET_CLOCKS bool "Reset unused clocks during boot"
Signature · 1 line
1.7.2.1
PATCH 6/47 davinci: introduce support for AM1x ARM9 microprocessors
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
The Sitara AM17x SoCs from TI are an OMAP-L137 pin-to-pin compatible ARM9 microprocessor offering from TI.
The Sitara AM18x SoCs from TI are an OMAP-L138 pin-to-pin compatible ARM9 microprocessor offering from TI.
More information about these processors available at:
www.ti.com/am1x
Because of their compatibiliy with OMAP-L1x, the kernel support for OMAP-L1x is fully relevant to AM1x processors.
This patch updates the Kconfig prompt and help text to include the AM1x part names to help users select configurations required for these parts easily.
Also, the hardware information that shows up in /proc/cpuinfo is updated to show applicability of the respective OMAP-L1x EVMs for AM1x parts.
--- arch/arm/mach-davinci/Kconfig | 30 +++++++++++++++--------------- arch/arm/mach-davinci/board-da830-evm.c | 2 +- arch/arm/mach-davinci/board-da850-evm.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-)
arch/arm/mach-davinci/Kconfig +15 -15
@@ -30,13 +30,13 @@ config ARCH_DAVINCI_DM646x select ARCH_DAVINCI_DMx config ARCH_DAVINCI_DA830 - bool "DA830/OMAP-L137 based system" + bool "DA830/OMAP-L137/AM17x based system" select CP_INTC select ARCH_DAVINCI_DA8XX select CPU_DCACHE_WRITETHROUGH # needed on silicon revs 1.0, 1.1 config ARCH_DAVINCI_DA850 - bool "DA850/OMAP-L138 based system" + bool "DA850/OMAP-L138/AM18x based system" select CP_INTC select ARCH_DAVINCI_DA8XX select ARCH_HAS_CPUFREQ
@@ -115,21 +115,21 @@ config MACH_DAVINCI_DM365_EVM for development is a DM365 EVM config MACH_DAVINCI_DA830_EVM - bool "TI DA830/OMAP-L137 Reference Platform" + bool "TI DA830/OMAP-L137/AM17x Reference Platform" default ARCH_DAVINCI_DA830 depends on ARCH_DAVINCI_DA830 select GPIO_PCF857X help - Say Y here to select the TI DA830/OMAP-L137 Evaluation Module. + Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module. choice - prompt "Select DA830/OMAP-L137 UI board peripheral" + prompt "Select DA830/OMAP-L137/AM17x UI board peripheral" depends on MACH_DAVINCI_DA830_EVM help - The presence of UI card on the DA830/OMAP-L137 EVM is detected - automatically based on successful probe of the I2C based GPIO - expander on that board. This option selected in this menu has - an effect only in case of a successful UI card detection. + The presence of UI card on the DA830/OMAP-L137/AM17x EVM is + detected automatically based on successful probe of the I2C + based GPIO expander on that board. This option selected in this + menu has an effect only in case of a successful UI card detection. config DA830_UI_LCD bool "LCD"
@@ -145,18 +145,18 @@ config DA830_UI_NAND endchoice config MACH_DAVINCI_DA850_EVM - bool "TI DA850/OMAP-L138 Reference Platform" + bool "TI DA850/OMAP-L138/AM18x Reference Platform" default ARCH_DAVINCI_DA850 depends on ARCH_DAVINCI_DA850 select GPIO_PCA953X help - Say Y here to select the TI DA850/OMAP-L138 Evaluation Module. + Say Y here to select the TI DA850/OMAP-L138/AM18x Evaluation Module. choice prompt "Select peripherals connected to expander on UI board" depends on MACH_DAVINCI_DA850_EVM help - The presence of User Interface (UI) card on the DA850/OMAP-L138 + The presence of User Interface (UI) card on the DA850/OMAP-L138/AM18x EVM is detected automatically based on successful probe of the I2C based GPIO expander on that card. This option selected in this menu has an effect only in case of a successful UI card detection.
@@ -165,13 +165,13 @@ config DA850_UI_NONE bool "No peripheral is enabled" help Say Y if you do not want to enable any of the peripherals connected - to TCA6416 expander on DA850/OMAP-L138 EVM UI card + to TCA6416 expander on DA850/OMAP-L138/AM18x EVM UI card config DA850_UI_RMII bool "RMII Ethernet PHY" help - Say Y if you want to use the RMII PHY on the DA850/OMAP-L138 EVM. - This PHY is found on the UI daughter card that is supplied with + Say Y if you want to use the RMII PHY on the DA850/OMAP-L138/AM18x + EVM. This PHY is found on the UI daughter card that is supplied with the EVM. NOTE: Please take care while choosing this option, MII PHY will not be functional if RMII mode is selected.
arch/arm/mach-davinci/board-da830-evm.c +1 -1
@@ -596,7 +596,7 @@ static void __init da830_evm_map_io(void)da830_init (); } -MACHINE_START (DAVINCI_DA830_EVM ,"DaVinci DA830/OMAP-L137 EVM" ) +MACHINE_START (DAVINCI_DA830_EVM ,"DaVinci DA830/OMAP-L137/AM17x EVM" ) .phys_io = IO_PHYS, .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc, .boot_params = (DA8XX_DDR_BASE + 0x100),
arch/arm/mach-davinci/board-da850-evm.c +1 -1
@@ -816,7 +816,7 @@ static void __init da850_evm_map_io(void)da850_init (); } -MACHINE_START (DAVINCI_DA850_EVM ,"DaVinci DA850/OMAP-L138 EVM" ) +MACHINE_START (DAVINCI_DA850_EVM ,"DaVinci DA850/OMAP-L138/AM18x EVM" ) .phys_io = IO_PHYS, .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc, .boot_params = (DA8XX_DDR_BASE + 0x100),
Signature · 1 line
1.7.2.1
PATCH 7/47 davinci: am18x/da850/omap-l138: use 'NOM' voltage defined in datasheet as min voltage
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
For each DA850 OPP, the normal ('NOM') voltage defined in the tecnical reference manual (TRM) is actually the minimum voltage the frequency is supported at.
The minimum ('MIN') voltage defined in TRM is meant to take care of voltage fluctuations and the device should not be run at this voltage for extended periods of time.
Fix the OPP definitions to define the cvdd_min as the normal voltage defined in the datasheet.
--- arch/arm/mach-davinci/da850.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-davinci/da850.c +3 -3
@@ -851,7 +851,7 @@ static const struct da850_opp da850_opp_300 = { .prediv = 1, .mult = 25, .postdiv = 2, - .cvdd_min = 1140000, + .cvdd_min = 1200000, .cvdd_max = 1320000, };
@@ -860,7 +860,7 @@ static const struct da850_opp da850_opp_200 = { .prediv = 1, .mult = 25, .postdiv = 3, - .cvdd_min = 1050000, + .cvdd_min = 1100000, .cvdd_max = 1160000, };
@@ -869,7 +869,7 @@ static const struct da850_opp da850_opp_96 = { .prediv = 1, .mult = 20, .postdiv = 5, - .cvdd_min = 950000, + .cvdd_min = 1000000, .cvdd_max = 1050000, };
Signature · 1 line
1.7.2.1
PATCH 8/47 davinci: dm365: disable pulldowns for all MMC/SD1 pins.
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
This patch disables internal pulldowns for all MMC/SD1 pins. Presently only MMCSD1_CMD pin's pull down is disabled, but with this some MMC/SD cards do not get detected on MMC/SD1 slot of the EVM.
The problem was reproducible with SanDisk 4GB SDHC card.
--- arch/arm/mach-davinci/devices.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/devices.c +1 -1
@@ -213,7 +213,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)IO_ADDRESS (DAVINCI_SYSTEM_MODULE_BASE +0x7c );/* Configure pull down control */ -__raw_writel ((__raw_readl (pupdctl1) & ~0x400 ), +__raw_writel ((__raw_readl (pupdctl1) & ~0xfc0 ), pupdctl1); mmcsd1_resources[0 ].start =DM365_MMCSD1_BASE ;
Signature · 1 line
1.7.2.1
PATCH 9/47 davinci: clock: add support for setting sysclk rate
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
Setting sysclk rate will be useful in cases where the sysclk is not at a fixed ratio to the PLL output but can asynchronously be changed.
This support forms the basis of attempt to keep the AEMIF clock constant on OMAP-L138 even as PLL0 output changes as ARM clock is changed to save power.
This patch has been tested on OMAP-L138.
--- arch/arm/mach-davinci/clock.c | 73 +++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-davinci/clock.h | 5 +++ 2 files changed, 78 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/clock.c +73 -0
@@ -287,6 +287,79 @@ static unsigned long clk_sysclk_recalc(struct clk *clk)return rate; } +int davinci_set_sysclk_rate (struct clk *clk,unsigned long rate) +{ +unsigned v; +struct pll_data *pll; +unsigned long input; +unsigned ratio =0 ; + +/* If this is the PLL base clock, wrong function to call */ +if (clk->pll_data) +return -EINVAL ; + +/* There must be a parent... */ +if (WARN_ON (!clk->parent)) +return -EINVAL ; + +/* ... the parent must be a PLL... */ +if (WARN_ON (!clk->parent->pll_data)) +return -EINVAL ; + +/* ... and this clock must have a divider. */ +if (WARN_ON (!clk->div_reg)) +return -EINVAL ; + + pll = clk->parent->pll_data; + + input = clk->parent->rate; + +/* If pre-PLL, source clock is before the multiplier and divider(s) */ +if (clk->flags &PRE_PLL ) + input = pll->input_rate; + +if (input > rate) { +/* +* Can afford to provide an output little higher than requested +* only if maximum rate supported by hardware on this sysclk +* is known. +*/ +if (clk->maxrate) { + ratio =DIV_ROUND_CLOSEST (input, rate); +if (input / ratio > clk->maxrate) + ratio =0 ; + } + +if (ratio ==0 ) + ratio =DIV_ROUND_UP (input, rate); + + ratio--; + } + +if (ratio >PLLDIV_RATIO_MASK ) +return -EINVAL ; + +do { + v =__raw_readl (pll->base +PLLSTAT ); + }while (v &PLLSTAT_GOSTAT ); + + v =__raw_readl (pll->base + clk->div_reg); + v &= ~PLLDIV_RATIO_MASK ; + v |= ratio |PLLDIV_EN ; +__raw_writel (v, pll->base + clk->div_reg); + + v =__raw_readl (pll->base +PLLCMD ); + v |=PLLCMD_GOSET ; +__raw_writel (v, pll->base +PLLCMD ); + +do { + v =__raw_readl (pll->base +PLLSTAT ); + }while (v &PLLSTAT_GOSTAT ); + +return 0 ; +} +EXPORT_SYMBOL (davinci_set_sysclk_rate); +static unsigned long clk_leafclk_recalc (struct clk *clk) {if (WARN_ON (!clk->parent))
arch/arm/mach-davinci/clock.h +5 -0
@@ -70,6 +70,9 @@#include <linux/list.h> #include <asm/clkdev.h> +#define PLLSTAT_GOSTAT BIT(0) +#define PLLCMD_GOSET BIT(0) +struct pll_data {u32 phys_base;void __iomem *base;
@@ -86,6 +89,7 @@ struct clk {struct module *owner;const char *name;unsigned long rate; +unsigned long maxrate;/* H/W supported max rate */ u8 usecount;u8 lpsc;u8 gpsc;
@@ -118,6 +122,7 @@ struct clk {int davinci_clk_init (struct clk_lookup *clocks);int davinci_set_pllrate (struct pll_data *pll,unsigned int prediv,unsigned int mult,unsigned int postdiv); +int davinci_set_sysclk_rate (struct clk *clk,unsigned long rate);extern struct platform_device davinci_wdt_device;extern void davinci_watchdog_reset (struct platform_device *);
Signature · 1 line
1.7.2.1
PATCH 10/47 davinci: cpufreq: add support for keeping an additional clock constant
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
On OMAP-L138 SoC, some of the sysclks need not be at a fixed ratio to CPU clock and can be kept at a relatively constant rate by adjusting the PLLDIVn ratio even as cpufreq goes ahead and changes the CPU clock.
This feature can be used to keep the EMIFA (PLL0 SYSCLK3) clock at a constant rate so that the EMIF timings need not be re-programmed whenever the CPU frequency changes.
This patch adds the required suppport to cpufreq driver.
--- arch/arm/mach-davinci/cpufreq.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/cpufreq.c +18 -0
@@ -34,6 +34,8 @@struct davinci_cpufreq {struct device *dev;struct clk *armclk; +struct clk *asyncclk; +unsigned long asyncrate; };static struct davinci_cpufreq cpufreq;
@@ -114,6 +116,12 @@ static int davinci_target(struct cpufreq_policy *policy,if (ret) goto out; +if (cpufreq.asyncclk) { + ret =clk_set_rate (cpufreq.asyncclk, cpufreq.asyncrate); +if (ret) + goto out; + } +/* if moving to lower freq, lower the voltage after lowering freq */ if (pdata->set_voltage && freqs.new < freqs.old) pdata->set_voltage (idx);
@@ -191,6 +199,7 @@ static struct cpufreq_driver davinci_driver = {static int __init davinci_cpufreq_probe (struct platform_device *pdev) {struct davinci_cpufreq_config *pdata = pdev->dev.platform_data; +struct clk *asyncclk;if (!pdata)return -EINVAL ;
@@ -205,6 +214,12 @@ static int __init davinci_cpufreq_probe(struct platform_device *pdev)return PTR_ERR (cpufreq.armclk); } + asyncclk =clk_get (cpufreq.dev,"async" ); +if (!IS_ERR (asyncclk)) { + cpufreq.asyncclk = asyncclk; + cpufreq.asyncrate =clk_get_rate (asyncclk); + } +return cpufreq_register_driver (&davinci_driver); }
@@ -212,6 +227,9 @@ static int __exit davinci_cpufreq_remove(struct platform_device *pdev) {clk_put (cpufreq.armclk); +if (cpufreq.asyncclk) +clk_put (cpufreq.asyncclk); +return cpufreq_unregister_driver (&davinci_driver); }
Signature · 1 line
1.7.2.1
PATCH 11/47 davinci: am18x/da850/omap-l138: keep async clock constant with cpufreq
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
Keep PLL0 SYSCLK3 at a constant rate of 100MHz. This enables the AEMIF timing to remain valid even as the PLL0 output is changed by cpufreq driver to save power.
--- arch/arm/mach-davinci/board-da850-evm.c | 2 +- arch/arm/mach-davinci/da850.c | 10 +++++++++- arch/arm/mach-davinci/include/mach/da8xx.h | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +1 -1
@@ -787,7 +787,7 @@ static __init void da850_evm_init(void)if (ret)pr_warning ("da850_evm_init: rtc setup failed: %d\n" , ret); - ret =da850_register_cpufreq (); + ret =da850_register_cpufreq ("pll0_sysclk3" );if (ret)pr_warning ("da850_evm_init: cpufreq registration failed: %d\n" , ret);
arch/arm/mach-davinci/da850.c +9 -1
@@ -86,6 +86,8 @@ static struct clk pll0_sysclk3 = { .parent = &pll0_clk, .flags = CLK_PLL, .div_reg = PLLDIV3, + .set_rate = davinci_set_sysclk_rate, + .maxrate = 100000000, };static struct clk pll0_sysclk4 = {
@@ -929,10 +931,16 @@ static struct platform_device da850_cpufreq_device = { .dev = { .platform_data = &cpufreq_info, }, + .id = -1, }; -int __init da850_register_cpufreq (void ) +int __init da850_register_cpufreq (char *async_clk) { +/* cpufreq driver can help keep an "async" clock constant */ +if (async_clk) +clk_add_alias ("async" , da850_cpufreq_device.name, + async_clk,NULL ); +return platform_device_register (&da850_cpufreq_device); }
arch/arm/mach-davinci/include/mach/da8xx.h +1 -1
@@ -78,7 +78,7 @@ int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);int da8xx_register_mmcsd0 (struct davinci_mmc_config *config);void __init da8xx_register_mcasp (int id,struct snd_platform_data *pdata);int da8xx_register_rtc (void ); -int da850_register_cpufreq (void ); +int da850_register_cpufreq (char *async_clk);int da8xx_register_cpuidle (void );void __iomem *__init da8xx_get_mem_ctlr (void );int da850_register_pm (struct platform_device *pdev);
Signature · 1 line
1.7.2.1
PATCH 12/47 Davinci: tnetv107x: retain psc reg base after init
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This is a bugfix for the original tnetv107x submission series. The psc_regs base array was being discarded post-init, and this was causing a crash during post-init clock enable/disable.
--- arch/arm/mach-davinci/tnetv107x.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/tnetv107x.c +1 -1
@@ -104,7 +104,7 @@ static u32 pll_ext_freq[] = { };/* PSC control registers */ -static u32 psc_regs[]__initconst = {TNETV107X_PSC_BASE }; +static u32 psc_regs[] = {TNETV107X_PSC_BASE };/* Host map for interrupt controller */ static u32 intc_host_map[] = {0x01010000 ,0x01010101 ,-1 };
Signature · 1 line
1.7.2.1
PATCH 13/47 DA850: move NAND/NOR pin lists to the board file
In reply to Kevin HilmanFrom: Sergei Shtylyov <[email protected]>
The NAND/NOR flash pin lists (da850_nand_pins/da850_nor_pins) are purely board specific and as such shouldn't be in da850.c -- copy them to board-da850-evm.c, renaming to da850_evm_nand_pins/da850_evm_nor_pins respectively, and merge the two lists in da850.c into one, representing the EMIF 2.5 module as a whole, just like we have it in da830.c...
While at it, remove the '__init' modifier from da850_evm_setup_nor_nand() as this function is called from non '__init' code...
--- arch/arm/mach-davinci/board-da850-evm.c | 30 +++++++++++++++++++++++-- arch/arm/mach-davinci/da850.c | 32 ++++++++++----------------- arch/arm/mach-davinci/include/mach/da8xx.h | 3 +- 3 files changed, 40 insertions(+), 25 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +27 -3
@@ -196,6 +196,30 @@ static void __init da850_evm_init_nor(void)iounmap (aemif_addr); } +static const short da850_evm_nand_pins[] = { +DA850_EMA_D_0 ,DA850_EMA_D_1 ,DA850_EMA_D_2 ,DA850_EMA_D_3 , +DA850_EMA_D_4 ,DA850_EMA_D_5 ,DA850_EMA_D_6 ,DA850_EMA_D_7 , +DA850_EMA_A_1 ,DA850_EMA_A_2 ,DA850_NEMA_CS_3 ,DA850_NEMA_CS_4 , +DA850_NEMA_WE ,DA850_NEMA_OE , +-1 +}; + +static const short da850_evm_nor_pins[] = { +DA850_EMA_BA_1 ,DA850_EMA_CLK ,DA850_EMA_WAIT_1 ,DA850_NEMA_CS_2 , +DA850_NEMA_WE ,DA850_NEMA_OE ,DA850_EMA_D_0 ,DA850_EMA_D_1 , +DA850_EMA_D_2 ,DA850_EMA_D_3 ,DA850_EMA_D_4 ,DA850_EMA_D_5 , +DA850_EMA_D_6 ,DA850_EMA_D_7 ,DA850_EMA_D_8 ,DA850_EMA_D_9 , +DA850_EMA_D_10 ,DA850_EMA_D_11 ,DA850_EMA_D_12 ,DA850_EMA_D_13 , +DA850_EMA_D_14 ,DA850_EMA_D_15 ,DA850_EMA_A_0 ,DA850_EMA_A_1 , +DA850_EMA_A_2 ,DA850_EMA_A_3 ,DA850_EMA_A_4 ,DA850_EMA_A_5 , +DA850_EMA_A_6 ,DA850_EMA_A_7 ,DA850_EMA_A_8 ,DA850_EMA_A_9 , +DA850_EMA_A_10 ,DA850_EMA_A_11 ,DA850_EMA_A_12 ,DA850_EMA_A_13 , +DA850_EMA_A_14 ,DA850_EMA_A_15 ,DA850_EMA_A_16 ,DA850_EMA_A_17 , +DA850_EMA_A_18 ,DA850_EMA_A_19 ,DA850_EMA_A_20 ,DA850_EMA_A_21 , +DA850_EMA_A_22 ,DA850_EMA_A_23 , +-1 +}; +static u32 ui_card_detected; #if defined(CONFIG_MMC_DAVINCI) || \
@@ -205,17 +229,17 @@ static u32 ui_card_detected;#define HAS_MMC 0#endif -static __init void da850_evm_setup_nor_nand (void ) +static inline void da850_evm_setup_nor_nand (void ) {int ret =0 ;if (ui_card_detected & !HAS_MMC ) { - ret =davinci_cfg_reg_list (da850_nand_pins); + ret =davinci_cfg_reg_list (da850_evm_nand_pins);if (ret)pr_warning ("da850_evm_init: nand mux setup failed: " "%d\n" , ret); - ret =davinci_cfg_reg_list (da850_nor_pins); + ret =davinci_cfg_reg_list (da850_evm_nor_pins);if (ret)pr_warning ("da850_evm_init: nor mux setup failed: %d\n" , ret);
arch/arm/mach-davinci/da850.c +12 -20
@@ -609,27 +609,19 @@ const short da850_mmcsd0_pins[] __initdata = { -1 }; -const short da850_nand_pins[]__initdata = { -DA850_EMA_D_7 ,DA850_EMA_D_6 ,DA850_EMA_D_5 ,DA850_EMA_D_4 , -DA850_EMA_D_3 ,DA850_EMA_D_2 ,DA850_EMA_D_1 ,DA850_EMA_D_0 , -DA850_EMA_A_1 ,DA850_EMA_A_2 ,DA850_NEMA_CS_3 ,DA850_NEMA_CS_4 , -DA850_NEMA_WE ,DA850_NEMA_OE , --1 -}; - -const short da850_nor_pins[]__initdata = { +const short da850_emif25_pins[]__initdata = {DA850_EMA_BA_1 ,DA850_EMA_CLK ,DA850_EMA_WAIT_1 ,DA850_NEMA_CS_2 , -DA850_NEMA_WE ,DA850_NEMA_OE ,DA850_EMA_D_0 ,DA850_EMA_D_1 , -DA850_EMA_D_2 ,DA850_EMA_D_3 ,DA850_EMA_D_4 ,DA850_EMA_D_5 , -DA850_EMA_D_6 ,DA850_EMA_D_7 ,DA850_EMA_D_8 ,DA850_EMA_D_9 , -DA850_EMA_D_10 ,DA850_EMA_D_11 ,DA850_EMA_D_12 ,DA850_EMA_D_13 , -DA850_EMA_D_14 ,DA850_EMA_D_15 ,DA850_EMA_A_0 ,DA850_EMA_A_1 , -DA850_EMA_A_2 ,DA850_EMA_A_3 ,DA850_EMA_A_4 ,DA850_EMA_A_5 , -DA850_EMA_A_6 ,DA850_EMA_A_7 ,DA850_EMA_A_8 ,DA850_EMA_A_9 , -DA850_EMA_A_10 ,DA850_EMA_A_11 ,DA850_EMA_A_12 ,DA850_EMA_A_13 , -DA850_EMA_A_14 ,DA850_EMA_A_15 ,DA850_EMA_A_16 ,DA850_EMA_A_17 , -DA850_EMA_A_18 ,DA850_EMA_A_19 ,DA850_EMA_A_20 ,DA850_EMA_A_21 , -DA850_EMA_A_22 ,DA850_EMA_A_23 , +DA850_NEMA_CS_3 ,DA850_NEMA_CS_4 ,DA850_NEMA_WE ,DA850_NEMA_OE , +DA850_EMA_D_0 ,DA850_EMA_D_1 ,DA850_EMA_D_2 ,DA850_EMA_D_3 , +DA850_EMA_D_4 ,DA850_EMA_D_5 ,DA850_EMA_D_6 ,DA850_EMA_D_7 , +DA850_EMA_D_8 ,DA850_EMA_D_9 ,DA850_EMA_D_10 ,DA850_EMA_D_11 , +DA850_EMA_D_12 ,DA850_EMA_D_13 ,DA850_EMA_D_14 ,DA850_EMA_D_15 , +DA850_EMA_A_0 ,DA850_EMA_A_1 ,DA850_EMA_A_2 ,DA850_EMA_A_3 , +DA850_EMA_A_4 ,DA850_EMA_A_5 ,DA850_EMA_A_6 ,DA850_EMA_A_7 , +DA850_EMA_A_8 ,DA850_EMA_A_9 ,DA850_EMA_A_10 ,DA850_EMA_A_11 , +DA850_EMA_A_12 ,DA850_EMA_A_13 ,DA850_EMA_A_14 ,DA850_EMA_A_15 , +DA850_EMA_A_16 ,DA850_EMA_A_17 ,DA850_EMA_A_18 ,DA850_EMA_A_19 , +DA850_EMA_A_20 ,DA850_EMA_A_21 ,DA850_EMA_A_22 ,DA850_EMA_A_23 ,-1 };
arch/arm/mach-davinci/include/mach/da8xx.h +1 -2
@@ -125,7 +125,6 @@ extern const short da850_rmii_pins[];extern const short da850_mcasp_pins[];extern const short da850_lcdcntl_pins[];extern const short da850_mmcsd0_pins[]; -extern const short da850_nand_pins[]; -extern const short da850_nor_pins[]; +extern const short da850_emif25_pins[];#endif /* __ASM_ARCH_DAVINCI_DA8XX_H */
Signature · 1 line
1.7.2.1
PATCH 14/47 DA850: move MII/RMII pin lists to the board file
In reply to Kevin HilmanFrom: Sergei Shtylyov <[email protected]>
The CPGMAC pin list in da850.c was incorrectly split into two MII/RMII mode specific pin lists, while what pin group is used is a function of how the board is wired. Copy the pin lists to board-da850-evm.c, renaming them accordingly, and merge the two lists in da850.c into one, da850_cpgmac_pins[], representing the CPGMAC module as a whole...
--- arch/arm/mach-davinci/board-da850-evm.c | 21 +++++++++++++++++++-- arch/arm/mach-davinci/da850.c | 12 +++--------- arch/arm/mach-davinci/include/mach/da8xx.h | 1 - 3 files changed, 22 insertions(+), 12 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +19 -2
@@ -600,6 +600,23 @@ static const short da850_evm_lcdc_pins[] = { -1 }; +static const short da850_evm_mii_pins[] = { +DA850_MII_TXEN ,DA850_MII_TXCLK ,DA850_MII_COL ,DA850_MII_TXD_3 , +DA850_MII_TXD_2 ,DA850_MII_TXD_1 ,DA850_MII_TXD_0 ,DA850_MII_RXER , +DA850_MII_CRS ,DA850_MII_RXCLK ,DA850_MII_RXDV ,DA850_MII_RXD_3 , +DA850_MII_RXD_2 ,DA850_MII_RXD_1 ,DA850_MII_RXD_0 ,DA850_MDIO_CLK , +DA850_MDIO_D , +-1 +}; + +static const short da850_evm_rmii_pins[] = { +DA850_RMII_TXD_0 ,DA850_RMII_TXD_1 ,DA850_RMII_TXEN , +DA850_RMII_CRS_DV ,DA850_RMII_RXD_0 ,DA850_RMII_RXD_1 , +DA850_RMII_RXER ,DA850_RMII_MHZ_50_CLK ,DA850_MDIO_CLK , +DA850_MDIO_D , +-1 +}; +static int __init da850_evm_config_emac (void ) {void __iomem *cfg_chip3_base;
@@ -617,12 +634,12 @@ static int __init da850_evm_config_emac(void)if (rmii_en) { val |=BIT (8 ); - ret =davinci_cfg_reg_list (da850_rmii_pins); + ret =davinci_cfg_reg_list (da850_evm_rmii_pins);pr_info ("EMAC: RMII PHY configured, MII PHY will not be" " functional\n" ); }else { val &= ~BIT (8 ); - ret =davinci_cfg_reg_list (da850_cpgmac_pins); + ret =davinci_cfg_reg_list (da850_evm_mii_pins);pr_info ("EMAC: MII PHY configured, RMII PHY will not be" " functional\n" ); }
arch/arm/mach-davinci/da850.c +3 -9
@@ -574,15 +574,9 @@ const short da850_cpgmac_pins[] __initdata = {DA850_MII_TXD_2 ,DA850_MII_TXD_1 ,DA850_MII_TXD_0 ,DA850_MII_RXER ,DA850_MII_CRS ,DA850_MII_RXCLK ,DA850_MII_RXDV ,DA850_MII_RXD_3 ,DA850_MII_RXD_2 ,DA850_MII_RXD_1 ,DA850_MII_RXD_0 ,DA850_MDIO_CLK , -DA850_MDIO_D , --1 -}; - -const short da850_rmii_pins[]__initdata = { -DA850_RMII_TXD_0 ,DA850_RMII_TXD_1 ,DA850_RMII_TXEN , -DA850_RMII_CRS_DV ,DA850_RMII_RXD_0 ,DA850_RMII_RXD_1 , -DA850_RMII_RXER ,DA850_RMII_MHZ_50_CLK ,DA850_MDIO_CLK , -DA850_MDIO_D , +DA850_MDIO_D ,DA850_RMII_TXD_0 ,DA850_RMII_TXD_1 ,DA850_RMII_TXEN , +DA850_RMII_CRS_DV ,DA850_RMII_RXD_0 ,DA850_RMII_RXD_1 ,DA850_RMII_RXER , +DA850_RMII_MHZ_50_CLK ,-1 };
arch/arm/mach-davinci/include/mach/da8xx.h +0 -1
@@ -121,7 +121,6 @@ extern const short da850_uart2_pins[];extern const short da850_i2c0_pins[];extern const short da850_i2c1_pins[];extern const short da850_cpgmac_pins[]; -extern const short da850_rmii_pins[];extern const short da850_mcasp_pins[];extern const short da850_lcdcntl_pins[];extern const short da850_mmcsd0_pins[];
Signature · 1 line
1.7.2.1
PATCH 15/47 arm: mach-davinci: check irq2ctlr() result
In reply to Kevin HilmanFrom: Kulikov Vasiliy <[email protected]>
If irq2ctlr() fails return IRQ_NONE.
Also as it can fail make 'ctlr' signed.
The semantic patch that finds this problem (many false-positive results):
(http://coccinelle.lip6.fr/)
// <smpl>
@ r1 @
identifier f;
@@
int f(...) { ... }
@@
identifier r1.f;
type T;
unsigned T x;
@@
*x = f(...)
...
*x > 0
--- arch/arm/mach-davinci/dma.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/dma.c +6 -2
@@ -354,10 +354,12 @@ static int irq2ctlr(int irq)static irqreturn_t dma_irq_handler (int irq,void *data) {int i; -unsigned ctlr; +int ctlr;unsigned int cnt =0 ; ctlr =irq2ctlr (irq); +if (ctlr <0 ) +return IRQ_NONE ;dev_dbg (data,"dma_irq_handler\n" );
@@ -408,10 +410,12 @@ static irqreturn_t dma_irq_handler(int irq, void *data)static irqreturn_t dma_ccerr_handler (int irq,void *data) {int i; -unsigned ctlr; +int ctlr;unsigned int cnt =0 ; ctlr =irq2ctlr (irq); +if (ctlr <0 ) +return IRQ_NONE ;dev_dbg (data,"dma_ccerr_handler\n" );
Signature · 1 line
1.7.2.1
PATCH 16/47 DA850: Add LPSC id for MMCSD1 peripheral
In reply to Kevin HilmanFrom: Juha Kuikka <[email protected]>
Add LPSC id for DA850's MMCSD1 peripheral.
--- arch/arm/mach-davinci/include/mach/psc.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/include/mach/psc.h +1 -0
@@ -172,6 +172,7 @@#define DA8XX_LPSC1_UART2 13#define DA8XX_LPSC1_LCDC 16#define DA8XX_LPSC1_PWM 17 +#define DA850_LPSC1_MMC_SD1 18#define DA8XX_LPSC1_ECAP 20#define DA830_LPSC1_EQEP 21#define DA850_LPSC1_TPTC2 21
Signature · 1 line
1.7.2.1
PATCH 17/47 DA850: Split MMCSD clock into two to support both MMCSD peripherals
In reply to Kevin HilmanFrom: Juha Kuikka <[email protected]>
Split mmcsd_clk into mmcsd0_clk and mmcsd1_clk and add davinci_mmc.1 in preparation for adding support for MMCSD1 peripheral in DA850.
--- arch/arm/mach-davinci/da850.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
arch/arm/mach-davinci/da850.c +11 -3
@@ -325,12 +325,19 @@ static struct clk lcdc_clk = { .gpsc = 1, }; -static struct clk mmcsd_clk = { - .name ="mmcsd" , +static struct clk mmcsd0_clk = { + .name ="mmcsd0" , .parent = &pll0_sysclk2, .lpsc =DA8XX_LPSC0_MMC_SD , }; +static struct clk mmcsd1_clk = { + .name ="mmcsd1" , + .parent = &pll0_sysclk2, + .lpsc =DA850_LPSC1_MMC_SD1 , + .gpsc =1 , +}; +static struct clk aemif_clk = { .name ="aemif" , .parent = &pll0_sysclk3,
@@ -377,7 +384,8 @@ static struct clk_lookup da850_clks[] = {CLK ("davinci_emac.1" ,NULL , &emac_clk),CLK ("davinci-mcasp.0" ,NULL , &mcasp_clk),CLK ("da8xx_lcdc.0" ,NULL , &lcdc_clk), -CLK ("davinci_mmc.0" ,NULL , &mmcsd_clk), +CLK ("davinci_mmc.0" ,NULL , &mmcsd0_clk), +CLK ("davinci_mmc.1" ,NULL , &mmcsd1_clk),CLK (NULL ,"aemif" , &aemif_clk), CLK(NULL, NULL, NULL), };
Signature · 1 line
1.7.2.1
PATCH 18/47 DA850: Add MMCSD1 resources, platform device and convenience registration function
In reply to Kevin HilmanFrom: Juha Kuikka <[email protected]>
Add resources, platform device and convenience registration function for DA850's second MMC/SD controller (MMCSD1).
--- arch/arm/mach-davinci/devices-da8xx.c | 39 ++++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 1 + 2 files changed, 40 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/devices-da8xx.c +39 -0
@@ -24,6 +24,7 @@#include "clock.h" #define DA8XX_TPCC_BASE 0x01c00000 +#define DA850_MMCSD1_BASE 0x01e1b000#define DA850_TPCC1_BASE 0x01e30000#define DA8XX_TPTC0_BASE 0x01c08000#define DA8XX_TPTC1_BASE 0x01c08400
@@ -566,6 +567,44 @@ int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config)return platform_device_register (&da8xx_mmcsd0_device); } +#ifdef CONFIG_ARCH_DAVINCI_DA850 +static struct resource da850_mmcsd1_resources[] = { + {/* registers */ + .start =DA850_MMCSD1_BASE , + .end =DA850_MMCSD1_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, + {/* interrupt */ + .start =IRQ_DA850_MMCSDINT0_1 , + .end =IRQ_DA850_MMCSDINT0_1 , + .flags =IORESOURCE_IRQ , + }, + {/* DMA RX */ + .start =EDMA_CTLR_CHAN (1 ,28 ), + .end =EDMA_CTLR_CHAN (1 ,28 ), + .flags =IORESOURCE_DMA , + }, + {/* DMA TX */ + .start =EDMA_CTLR_CHAN (1 ,29 ), + .end =EDMA_CTLR_CHAN (1 ,29 ), + .flags =IORESOURCE_DMA , + }, +}; + +static struct platform_device da850_mmcsd1_device = { + .name ="davinci_mmc" , + .id =1 , + .num_resources =ARRAY_SIZE (da850_mmcsd1_resources), + .resource = da850_mmcsd1_resources, +}; + +int __init da850_register_mmcsd1 (struct davinci_mmc_config *config) +{ + da850_mmcsd1_device.dev.platform_data = config; +return platform_device_register (&da850_mmcsd1_device); +} +#endif +static struct resource da8xx_rtc_resources[] = { { .start =DA8XX_RTC_BASE ,
arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
@@ -76,6 +76,7 @@ int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);int da8xx_register_emac (void );int da8xx_register_lcdc (struct da8xx_lcdc_platform_data *pdata);int da8xx_register_mmcsd0 (struct davinci_mmc_config *config); +int da850_register_mmcsd1 (struct davinci_mmc_config *config);void __init da8xx_register_mcasp (int id,struct snd_platform_data *pdata);int da8xx_register_rtc (void );int da850_register_cpufreq (char *async_clk);
Signature · 1 line
1.7.2.1
PATCH 19/47 davinci: dm365 evm: use EDMAQ_3 as the audio DMA queue
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
By default the audio driver uses EDMAQ_0 as the DMA queue, but on DM365 this queue is specially designed for video transfers with a large fifo size. Having both audio and video transfers on the same queue leads to noise on the audio side.
This patch changes the audio queue number for DM365 to EDMAQ_3.
--- arch/arm/mach-davinci/board-dm365-evm.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/board-dm365-evm.c +3 -1
@@ -175,7 +175,9 @@ static struct at24_platform_data eeprom_info = { .context = (void *)0x7f00, }; -static struct snd_platform_data dm365_evm_snd_data; +static struct snd_platform_data dm365_evm_snd_data = { + .asp_chan_q =EVENTQ_3 , +};static struct i2c_board_info i2c_info[] = { {
Signature · 1 line
1.7.2.1
PATCH 20/47 davinci: add support for aemif timing configuration
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
This patch adds support to configure the AEMIF interface with supplied timing values.
Since this capability is useful both from NOR and NAND flashes, it is provided as a new interface and in a file of its own.
AEMIF timing configuration is required in cases:
1) Where the AEMIF clock rate can change at runtime (a side affect of cpu frequency change).
2) Where U-Boot does not support NAND/NOR but supports other media like SPI Flash or MMC/SD and thus does not care about setting up the AEMIF timing for kernel to use.
3) Where U-Boot just hasn't configured the timing values and cannot be upgraded because the box is already in the field.
Since there is now a header file for AEMIF interface, the common (non-NAND specific) defines for AEMIF registers have been moved from nand.h into the newly created aemif.h
--- arch/arm/mach-davinci/Makefile | 2 +- arch/arm/mach-davinci/aemif.c | 133 ++++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/aemif.h | 36 ++++++++ arch/arm/mach-davinci/include/mach/nand.h | 3 - drivers/mtd/nand/davinci_nand.c | 1 + 5 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-davinci/aemif.c create mode 100644 arch/arm/mach-davinci/include/mach/aemif.h
arch/arm/mach-davinci/Makefile +1 -1
@@ -5,7 +5,7 @@ # Common objects obj-y := time.o clock.o serial.o io.o psc.o \ - gpio.o dma.o usb.o common.o sram.o + gpio.o dma.o usb.o common.o sram.o aemif.o obj-$(CONFIG_DAVINCI_MUX) += mux.o
arch/arm/mach-davinci/aemif.c new file +133 -0
133 lines not on this page · raw message
arch/arm/mach-davinci/include/mach/aemif.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* TI DaVinci AEMIF support +* +* Copyright 2010 (C) Texas Instruments, Inc. http://www.ti.com/ +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +*/ +#ifndef _MACH_DAVINCI_AEMIF_H +#define _MACH_DAVINCI_AEMIF_H + +#define NRCSR_OFFSET 0x00 +#define AWCCR_OFFSET 0x04 +#define A1CR_OFFSET 0x10 + +#define ACR_ASIZE_MASK 0x3 +#define ACR_EW_MASK BIT(30) +#define ACR_SS_MASK BIT(31) + +/* All timings in nanoseconds */ +struct davinci_aemif_timing { +u8 wsetup; +u8 wstrobe; +u8 whold; + +u8 rsetup; +u8 rstrobe; +u8 rhold; + +u8 ta; +}; + +int davinci_aemif_setup_timing (struct davinci_aemif_timing *t, +void __iomem *base,unsigned cs); +#endif
arch/arm/mach-davinci/include/mach/nand.h +0 -3
@@ -30,9 +30,6 @@#include <linux/mtd/nand.h> -#define NRCSR_OFFSET 0x00 -#define AWCCR_OFFSET 0x04 -#define A1CR_OFFSET 0x10#define NANDFCR_OFFSET 0x60#define NANDFSR_OFFSET 0x64#define NANDF1ECC_OFFSET 0x70
drivers/mtd/nand/davinci_nand.c +1 -0
@@ -35,6 +35,7 @@#include <linux/slab.h> #include <mach/nand.h> +#include <mach/aemif.h> #include <asm/mach-types.h>
Signature · 1 line
1.7.2.1
PATCH 21/47 nand: davinci: add support for timing configuration
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
This patch modifies the DaVinci NAND driver to use the new AEMIF timing setup API to configure the NAND access timings.
Earlier, AEMIF configuration was being done as a special case for DM644x board, but now more boards emerge which have capability to boot for other media (SPI flash, NOR flash) and have the kernel access NAND flash. This means that kernel cannot always depend on the bootloader to setup the NAND.
Also, on platforms such as da850/omap-l138, the aemif input frequency changes as cpu frequency changes; necessiating re-calculation of timimg values as part of cpufreq transtitions. This patch forms the basis for adding that support.
--- arch/arm/mach-davinci/include/mach/nand.h | 3 + drivers/mtd/nand/davinci_nand.c | 60 ++++++++++------------------ 2 files changed, 25 insertions(+), 38 deletions(-)
arch/arm/mach-davinci/include/mach/nand.h +3 -0
@@ -80,6 +80,9 @@ struct davinci_nand_pdata { /* platform_data *//* Main and mirror bbt descriptor overrides */ struct nand_bbt_descr *bbt_td;struct nand_bbt_descr *bbt_md; + +/* Access timings */ + struct davinci_aemif_timing *timing; };#endif /* __ARCH_ARM_DAVINCI_NAND_H */
drivers/mtd/nand/davinci_nand.c +22 -38
91 lines not on this page · raw message
Signature · 1 line
1.7.2.1
PATCH 22/47 davinci: dm644x evm: setup NAND flash timing
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
The DM644x EVM nand flash timing was earlier being done as a special case in the NAND driver itself.
With the NAND driver now capable of progamming the AEMIF interface using timing data passed from the platform, the timing values are being moved into their rightful place in the EVM specific board file.
The values being programmed match what was being done earlier and thus do not represent any change in performance/functionality.
--- arch/arm/mach-davinci/board-dm644x-evm.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-dm644x-evm.c +12 -0
@@ -37,6 +37,7 @@#include <mach/nand.h> #include <mach/mmc.h> #include <mach/usb.h> +#include <mach/aemif.h> #define DM644X_EVM_PHY_MASK (0x2)#define DM644X_EVM_MDIO_FREQUENCY (2200000)/* PHY bus frequency */
@@ -137,11 +138,22 @@ static struct mtd_partition davinci_evm_nandflash_partition[] = {*/ }; +static struct davinci_aemif_timing davinci_evm_nandflash_timing = { + .wsetup =20 , + .wstrobe =40 , + .whold =20 , + .rsetup =10 , + .rstrobe =40 , + .rhold =10 , + .ta =40 , +}; +static struct davinci_nand_pdata davinci_evm_nandflash_data = { .parts = davinci_evm_nandflash_partition, .nr_parts =ARRAY_SIZE (davinci_evm_nandflash_partition), .ecc_mode =NAND_ECC_HW , .options =NAND_USE_FLASH_BBT , + .timing = &davinci_evm_nandflash_timing, };static struct resource davinci_evm_nandflash_resource[] = {
Signature · 1 line
1.7.2.1
PATCH 23/47 davinci: am17x/da830/omap-l137 evm: setup NAND flash timing
In reply to Kevin HilmanFrom: Sudhakar Rajashekhara <[email protected]>
Setup the NAND flash timings for DA830 EVM.
Before configuring the timing values, throughput calculation using dd command yielded 477 kB/s write and 970 kB/s read speed.
After the timing configuration, the throughput was measured to be 2.5 MB/s write and 5.1 MB/s read.
[Mukul Bhatnagar: actual calculation of timing values from the NAND datasheet]
--- arch/arm/mach-davinci/board-da830-evm.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +12 -0
@@ -29,6 +29,7 @@#include <mach/nand.h> #include <mach/da8xx.h> #include <mach/usb.h> +#include <mach/aemif.h> #define DA830_EVM_PHY_MASK 0x0#define DA830_EVM_MDIO_FREQUENCY 2200000/* PHY bus frequency */
@@ -360,6 +361,16 @@ static struct nand_bbt_descr da830_evm_nand_bbt_mirror_descr = { .pattern = da830_evm_nand_mirror_pattern }; +static struct davinci_aemif_timing da830_evm_nandflash_timing = { + .wsetup =24 , + .wstrobe =21 , + .whold =14 , + .rsetup =19 , + .rstrobe =50 , + .rhold =0 , + .ta =20 , +}; +static struct davinci_nand_pdata da830_evm_nand_pdata = { .parts = da830_evm_nand_partitions, .nr_parts =ARRAY_SIZE (da830_evm_nand_partitions),
@@ -368,6 +379,7 @@ static struct davinci_nand_pdata da830_evm_nand_pdata = { .options = NAND_USE_FLASH_BBT, .bbt_td = &da830_evm_nand_bbt_main_descr, .bbt_md = &da830_evm_nand_bbt_mirror_descr, + .timing = &da830_evm_nandflash_timing, };static struct resource da830_evm_nand_resources[] = {
Signature · 1 line
1.7.2.1
PATCH 24/47 davinci: am18x/da850/omap-l138 evm: setup NAND flash timing
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
Setup the NAND flash timings for DA850 EVM
Before configuring the timing values, throughput calculation using dd command yielded 469 kB/s write and 966 kB/s read speed.
After the timing configuration, the throughput was measured to be 2.4 MB/s write and 5 MB/s read.
[Mukul Bhatnagar: actual calculation of timing values from the NAND datasheet]
--- arch/arm/mach-davinci/board-da850-evm.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +12 -0
@@ -36,6 +36,7 @@#include <mach/da8xx.h> #include <mach/nand.h> #include <mach/mux.h> +#include <mach/aemif.h> #define DA850_EVM_PHY_MASK 0x1#define DA850_EVM_MDIO_FREQUENCY 2200000/* PHY bus frequency */
@@ -143,12 +144,23 @@ static struct mtd_partition da850_evm_nandflash_partition[] = { }, }; +static struct davinci_aemif_timing da850_evm_nandflash_timing = { + .wsetup =24 , + .wstrobe =21 , + .whold =14 , + .rsetup =19 , + .rstrobe =50 , + .rhold =0 , + .ta =20 , +}; +static struct davinci_nand_pdata da850_evm_nandflash_data = { .parts = da850_evm_nandflash_partition, .nr_parts =ARRAY_SIZE (da850_evm_nandflash_partition), .ecc_mode =NAND_ECC_HW , .ecc_bits =4 , .options =NAND_USE_FLASH_BBT , + .timing = &da850_evm_nandflash_timing, };static struct resource da850_evm_nandflash_resource[] = {
Signature · 1 line
1.7.2.1
PATCH 25/47 davinci: dm6467t evm: setup NAND flash timing
In reply to Kevin HilmanFrom: Sekhar Nori <[email protected]>
Setup NAND flash timing on DM6467T EVM.
Without the timing setup, the NAND flash on DM6467T RevC EVM reports a number of random bad blocks because of read errors.
Also, with this, copying a 100M file on RevB EVM takes ~35 sec against 1 minute 30 seconds earlier.
--- arch/arm/mach-davinci/board-dm646x-evm.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-dm646x-evm.c +14 -0
@@ -42,6 +42,7 @@#include <mach/nand.h> #include <mach/clock.h> #include <mach/cdce949.h> +#include <mach/aemif.h> #include "clock.h"
@@ -71,6 +72,16 @@ static struct mtd_partition davinci_nand_partitions[] = { } }; +static struct davinci_aemif_timing dm6467tevm_nandflash_timing = { + .wsetup =29 , + .wstrobe =24 , + .whold =14 , + .rsetup =19 , + .rstrobe =33 , + .rhold =0 , + .ta =29 , +}; +static struct davinci_nand_pdata davinci_nand_data = { .mask_cle =0x80000 , .mask_ale =0x40000 ,
@@ -763,6 +774,9 @@ static __init void evm_init(void)dm646x_init_mcasp0 (&dm646x_evm_snd_data[0 ]);dm646x_init_mcasp1 (&dm646x_evm_snd_data[1 ]); +if (machine_is_davinci_dm6467tevm ()) + davinci_nand_data.timing = &dm6467tevm_nandflash_timing; +platform_device_register (&davinci_nand_device);dm646x_init_edma (dm646x_edma_rsv);
Signature · 1 line
1.7.2.1
PATCH 26/47 davinci: Add machine checks to DA8XX serial console init routines
In reply to Kevin HilmanFrom: Michael Williamson <[email protected]>
This patch adds machine checks in the serial console init routines for the DA8XX EVM boards. This is needed because there are other DA8XX based machines that use a different UART/tty as the console and may be included in a common kernel build.
--- arch/arm/mach-davinci/board-da830-evm.c | 3 +++ arch/arm/mach-davinci/board-da850-evm.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +3 -0
@@ -598,6 +598,9 @@ static __init void da830_evm_init(void)#ifdef CONFIG_SERIAL_8250_CONSOLE static int __init da830_evm_console_init (void ) { +if (!machine_is_davinci_da830_evm ()) +return 0 ; +return add_preferred_console ("ttyS" ,2 ,"115200" ); }console_initcall (da830_evm_console_init);
arch/arm/mach-davinci/board-da850-evm.c +3 -0
@@ -859,6 +859,9 @@ static __init void da850_evm_init(void)#ifdef CONFIG_SERIAL_8250_CONSOLE static int __init da850_evm_console_init (void ) { +if (!machine_is_davinci_da850_evm ()) +return 0 ; +return add_preferred_console ("ttyS" ,2 ,"115200" ); }console_initcall (da850_evm_console_init);
Signature · 1 line
1.7.2.1
PATCH 27/47 davinci: Add CONFIG_REGULATOR_DUMMY to DA8XX defconfig file.
In reply to Kevin HilmanFrom: Michael Williamson <[email protected]>
In order to support reference DA8XX machines not providing a voltage regulator control for the core voltage, the REGULATOR_DUMMY option is required.
--- arch/arm/configs/da8xx_omapl_defconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/configs/da8xx_omapl_defconfig +1 -0
@@ -79,6 +79,7 @@ CONFIG_I2C_DAVINCI=y # CONFIG_HWMON is not set CONFIG_WATCHDOG=y CONFIG_REGULATOR=y +CONFIG_REGULATOR_DUMMY=y CONFIG_REGULATOR_TPS6507X=y CONFIG_FB=y CONFIG_FB_DA8XX=y
Signature · 1 line
1.7.2.1
PATCH 28/47 davinci: Initial support for MityDSP-L138/MityARM-1808
In reply to Kevin HilmanFrom: Michael Williamson <[email protected]>
This patch adds initial support for the MityDSP-L138 and MityDSP-1808 system on Module (SOM) under the machine name "mityomapl138". These SOMs are based on the da850 davinci CPU architecture. Information on these SOMs may be found at http://www.mitydsp.com.
Basic support for the console UART, NAND, and EMAC (MII interface) is included in this patch.
--- arch/arm/configs/da8xx_omapl_defconfig | 1 + arch/arm/mach-davinci/Kconfig | 8 + arch/arm/mach-davinci/Makefile | 1 + arch/arm/mach-davinci/board-mityomapl138.c | 221 +++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/uncompress.h | 1 + 5 files changed, 232 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-davinci/board-mityomapl138.c
arch/arm/configs/da8xx_omapl_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_MODVERSIONS=y CONFIG_ARCH_DAVINCI=y CONFIG_ARCH_DAVINCI_DA830=y CONFIG_ARCH_DAVINCI_DA850=y +CONFIG_MACH_MITYOMAPL138=y CONFIG_DAVINCI_RESET_CLOCKS=y CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y
arch/arm/mach-davinci/Kconfig +8 -0
@@ -185,6 +185,14 @@ config MACH_TNETV107X help Say Y here to select the TI TNETV107X Evaluation Module. +config MACH_MITYOMAPL138 + bool "Critical Link MityDSP-L138/MityARM-1808 SoM" + depends on ARCH_DAVINCI_DA850 + help + Say Y here to select the Critical Link MityDSP-L138/MityARM-1808 + System on Module. Information on this SoM may be found at + http://www.mitydsp.com + config DAVINCI_MUX bool "DAVINCI multiplexing support" depends on ARCH_DAVINCI
arch/arm/mach-davinci/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_MACH_DAVINCI_DM365_EVM) += board-dm365-evm.o obj-$(CONFIG_MACH_DAVINCI_DA830_EVM) += board-da830-evm.o obj-$(CONFIG_MACH_DAVINCI_DA850_EVM) += board-da850-evm.o obj-$(CONFIG_MACH_TNETV107X) += board-tnetv107x-evm.o +obj-$(CONFIG_MACH_MITYOMAPL138) += board-mityomapl138.o # Power Management obj-$(CONFIG_CPU_FREQ) += cpufreq.o
arch/arm/mach-davinci/board-mityomapl138.c new file +221 -0
221 lines not on this page · raw message
arch/arm/mach-davinci/include/mach/uncompress.h +1 -0
@@ -88,6 +88,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)/* DA8xx boards */ DEBUG_LL_DA8XX (davinci_da830_evm,2 );DEBUG_LL_DA8XX (davinci_da850_evm,2 ); +DEBUG_LL_DA8XX (mityomapl138,1 );/* TNETV107x boards */ DEBUG_LL_TNETV107X (tnetv107x,1 );
Signature · 1 line
1.7.2.1
PATCH 29/47 davinci: add idcode for tnetv107x rev 1.1/1.2
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch adds an entry into the idcode table for tnetv107x silicon revision 1.1 and 1.2 devices.
--- arch/arm/mach-davinci/tnetv107x.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/tnetv107x.c +8 -1
@@ -581,7 +581,14 @@ static struct davinci_id ids[] = { .part_no = 0xb8a1, .manufacturer = 0x017, .cpu_id = DAVINCI_CPU_ID_TNETV107X, - .name = "tnetv107x rev1.0", + .name = "tnetv107x rev 1.0", + }, + { + .variant = 0x1, + .part_no = 0xb8a1, + .manufacturer = 0x017, + .cpu_id = DAVINCI_CPU_ID_TNETV107X, + .name = "tnetv107x rev 1.1/1.2", }, };
Signature · 1 line
1.7.2.1
PATCH 30/47 davinci: Add I2C0 devices to MityDSP-L138/MityARM-1808 platform
In reply to Kevin HilmanFrom: Michael Williamson <[email protected]>
This patch adds the i2c0 bus and attached devices to the MityDSP-L138 and MityARM-1808 davinci SoM. Included is a TPS65023 voltage regulator needed for power management and a small 24c02 EPROM that contains factory configuration data.
--- arch/arm/mach-davinci/board-mityomapl138.c | 145 ++++++++++++++++++++++++++++ 1 files changed, 145 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-mityomapl138.c +145 -0
@@ -13,6 +13,8 @@#include <linux/console.h> #include <linux/platform_device.h> #include <linux/mtd/partitions.h> +#include <linux/regulator/machine.h> +#include <linux/i2c.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -25,6 +27,141 @@#define MITYOMAPL138_PHY_MASK 0x08/* hardcoded for now */ #define MITYOMAPL138_MDIO_FREQUENCY (2200000)/* PHY bus frequency */ +static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = { + .bus_freq =100 ,/* kHz */ + .bus_delay =0 ,/* usec */ +}; + +/* TPS65023 voltage regulator support */ +/* 1.2V Core */ +struct regulator_consumer_supply tps65023_dcdc1_consumers[] = { + { + .supply ="cvdd" , + }, +}; + +/* 1.8V */ +struct regulator_consumer_supply tps65023_dcdc2_consumers[] = { + { + .supply ="usb0_vdda18" , + }, + { + .supply ="usb1_vdda18" , + }, + { + .supply ="ddr_dvdd18" , + }, + { + .supply ="sata_vddr" , + }, +}; + +/* 1.2V */ +struct regulator_consumer_supply tps65023_dcdc3_consumers[] = { + { + .supply ="sata_vdd" , + }, + { + .supply ="usb_cvdd" , + }, + { + .supply ="pll0_vdda" , + }, + { + .supply ="pll1_vdda" , + }, +}; + +/* 1.8V Aux LDO, not used */ +struct regulator_consumer_supply tps65023_ldo1_consumers[] = { + { + .supply ="1.8v_aux" , + }, +}; + +/* FPGA VCC Aux (2.5 or 3.3) LDO */ +struct regulator_consumer_supply tps65023_ldo2_consumers[] = { + { + .supply ="vccaux" , + }, +}; + +struct regulator_init_data tps65023_regulator_data[] = { +/* dcdc1 */ + { + .constraints = { + .min_uV =1150000 , + .max_uV =1350000 , + .valid_ops_mask =REGULATOR_CHANGE_VOLTAGE | +REGULATOR_CHANGE_STATUS , + .boot_on =1 , + }, + .num_consumer_supplies =ARRAY_SIZE (tps65023_dcdc1_consumers), + .consumer_supplies = tps65023_dcdc1_consumers, + }, +/* dcdc2 */ + { + .constraints = { + .min_uV =1800000 , + .max_uV =1800000 , + .valid_ops_mask =REGULATOR_CHANGE_STATUS , + .boot_on =1 , + }, + .num_consumer_supplies =ARRAY_SIZE (tps65023_dcdc2_consumers), + .consumer_supplies = tps65023_dcdc2_consumers, + }, +/* dcdc3 */ + { + .constraints = { + .min_uV =1200000 , + .max_uV =1200000 , + .valid_ops_mask =REGULATOR_CHANGE_STATUS , + .boot_on =1 , + }, + .num_consumer_supplies =ARRAY_SIZE (tps65023_dcdc3_consumers), + .consumer_supplies = tps65023_dcdc3_consumers, + }, +/* ldo1 */ + { + .constraints = { + .min_uV =1800000 , + .max_uV =1800000 , + .valid_ops_mask =REGULATOR_CHANGE_STATUS , + .boot_on =1 , + }, + .num_consumer_supplies =ARRAY_SIZE (tps65023_ldo1_consumers), + .consumer_supplies = tps65023_ldo1_consumers, + }, +/* ldo2 */ + { + .constraints = { + .min_uV =2500000 , + .max_uV =3300000 , + .valid_ops_mask =REGULATOR_CHANGE_VOLTAGE | +REGULATOR_CHANGE_STATUS , + .boot_on =1 , + }, + .num_consumer_supplies =ARRAY_SIZE (tps65023_ldo2_consumers), + .consumer_supplies = tps65023_ldo2_consumers, + }, +}; + +static struct i2c_board_info __initdata mityomap_tps65023_info[] = { + { +I2C_BOARD_INFO ("tps65023" ,0x48 ), + .platform_data = &tps65023_regulator_data[0 ], + }, + { +I2C_BOARD_INFO ("24c02" ,0x50 ), + }, +}; + +static int __init pmic_tps65023_init (void ) +{ +return i2c_register_board_info (1 , mityomap_tps65023_info, +ARRAY_SIZE (mityomap_tps65023_info)); +} +/* * MityDSP-L138 includes a 256 MByte large-page NAND flash * (128K blocks).
@@ -172,6 +309,14 @@ static void __init mityomapl138_init(void)davinci_serial_init (&mityomapl138_uart_config); + ret =da8xx_register_i2c (0 , &mityomap_i2c_0_pdata); +if (ret) +pr_warning ("i2c0 registration failed: %d\n" , ret); + + ret =pmic_tps65023_init (); +if (ret) +pr_warning ("TPS65023 PMIC init failed: %d\n" , ret); +mityomapl138_setup_nand ();mityomapl138_config_emac ();
Signature · 1 line
1.7.2.1
PATCH 31/47 net: davinci_emac: separate out davinci mdio
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
Davinci's MDIO controller is present on other TI devices, without an accompanying EMAC. For example, on tnetv107x, the same MDIO module is used in conjunction with a 3-port switch hardware.
By separating the MDIO controller code into its own platform driver, this patch allows common logic to be reused on such platforms.
--- drivers/net/Kconfig | 10 + drivers/net/Makefile | 1 + drivers/net/davinci_mdio.c | 475 ++++++++++++++++++++++++++++++++++++++++++ include/linux/davinci_emac.h | 4 + 4 files changed, 490 insertions(+), 0 deletions(-) create mode 100644 drivers/net/davinci_mdio.c
drivers/net/Kconfig +10 -0
@@ -958,6 +958,16 @@ config TI_DAVINCI_EMAC To compile this driver as a module, choose M here: the module will be called davinci_emac_driver. This is recommended. +config TI_DAVINCI_MDIO + tristate "TI DaVinci MDIO Support" + depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 ) + select PHYLIB + help + This driver supports TI's DaVinci MDIO module. + + To compile this driver as a module, choose M here: the module + will be called davinci_mdio. This is recommended. + config DM9000 tristate "DM9000 support" depends on ARM || BLACKFIN || MIPS
drivers/net/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_MDIO) += mdio.o obj-$(CONFIG_PHYLIB) += phy/ obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o +obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o obj-$(CONFIG_E1000) += e1000/ obj-$(CONFIG_E1000E) += e1000e/
drivers/net/davinci_mdio.c new file +475 -0
475 lines not on this page · raw message
include/linux/davinci_emac.h +4 -0
@@ -14,6 +14,10 @@#include <linux/if_ether.h> #include <linux/memory.h> +struct mdio_platform_data { +unsigned long bus_freq; +}; +struct emac_platform_data {char mac_addr[ETH_ALEN ];u32 ctrl_reg_offset;
Signature · 1 line
1.7.2.1
PATCH 32/47 davinci: add mdio platform devices
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch adds mdio platform devices on SoCs that have the necessary hardware. Clock lookup entries (aliases) have also been added, so that the MDIO and EMAC drivers can independently enable/disable a shared underlying clock. Further, the EMAC MMR region has been split down into separate MDIO and EMAC regions.
--- arch/arm/mach-davinci/devices-da8xx.c | 29 +++++++++++++++++++++++++- arch/arm/mach-davinci/dm365.c | 22 +++++++++++++++++++- arch/arm/mach-davinci/dm644x.c | 22 +++++++++++++++++++- arch/arm/mach-davinci/dm646x.c | 21 ++++++++++++++++++- arch/arm/mach-davinci/include/mach/dm365.h | 1 + arch/arm/mach-davinci/include/mach/dm644x.h | 1 + arch/arm/mach-davinci/include/mach/dm646x.h | 1 + 7 files changed, 92 insertions(+), 5 deletions(-)
arch/arm/mach-davinci/devices-da8xx.c +27 -2
@@ -352,7 +352,7 @@ int __init da8xx_register_watchdog(void)static struct resource da8xx_emac_resources[] = { { .start =DA8XX_EMAC_CPPI_PORT_BASE , - .end =DA8XX_EMAC_CPPI_PORT_BASE +0x5000 -1 , + .end =DA8XX_EMAC_CPPI_PORT_BASE +SZ_16K -1 , .flags =IORESOURCE_MEM , }, {
@@ -396,9 +396,34 @@ static struct platform_device da8xx_emac_device = { .resource = da8xx_emac_resources, }; +static struct resource da8xx_mdio_resources[] = { + { + .start =DA8XX_EMAC_MDIO_BASE , + .end =DA8XX_EMAC_MDIO_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +static struct platform_device da8xx_mdio_device = { + .name ="davinci_mdio" , + .id =0 , + .num_resources =ARRAY_SIZE (da8xx_mdio_resources), + .resource = da8xx_mdio_resources, +}; +int __init da8xx_register_emac (void ) { -return platform_device_register (&da8xx_emac_device); +int ret; + + ret =platform_device_register (&da8xx_mdio_device); +if (ret <0 ) +return ret; + ret =platform_device_register (&da8xx_emac_device); +if (ret <0 ) +return ret; + ret =clk_add_alias (NULL ,dev_name (&da8xx_mdio_device.dev), +NULL , &da8xx_emac_device.dev); +return ret; }static struct resource da830_mcasp1_resources[] = {
arch/arm/mach-davinci/dm365.c +21 -1
@@ -699,7 +699,7 @@ static struct emac_platform_data dm365_emac_pdata = {static struct resource dm365_emac_resources[] = { { .start =DM365_EMAC_BASE , - .end =DM365_EMAC_BASE +0x47ff , + .end =DM365_EMAC_BASE +SZ_16K -1 , .flags =IORESOURCE_MEM , }, {
@@ -734,6 +734,21 @@ static struct platform_device dm365_emac_device = { .resource = dm365_emac_resources, }; +static struct resource dm365_mdio_resources[] = { + { + .start =DM365_EMAC_MDIO_BASE , + .end =DM365_EMAC_MDIO_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +static struct platform_device dm365_mdio_device = { + .name ="davinci_mdio" , + .id =0 , + .num_resources =ARRAY_SIZE (dm365_mdio_resources), + .resource = dm365_mdio_resources, +}; +static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ ] = { [IRQ_VDINT0 ] =2 , [IRQ_VDINT1 ] =6 ,
@@ -1220,7 +1235,12 @@ static int __init dm365_init_devices(void)davinci_cfg_reg (DM365_INT_EDMA_CC );platform_device_register (&dm365_edma_device); + +platform_device_register (&dm365_mdio_device);platform_device_register (&dm365_emac_device); +clk_add_alias (NULL ,dev_name (&dm365_mdio_device.dev), +NULL , &dm365_emac_device.dev); +/* Add isif clock alias */ clk_add_alias ("master" , dm365_isif_dev.name,"vpss_master" ,NULL );platform_device_register (&dm365_vpss_device);
arch/arm/mach-davinci/dm644x.c +21 -1
@@ -330,7 +330,7 @@ static struct emac_platform_data dm644x_emac_pdata = {static struct resource dm644x_emac_resources[] = { { .start =DM644X_EMAC_BASE , - .end =DM644X_EMAC_BASE +0x47ff , + .end =DM644X_EMAC_BASE +SZ_16K -1 , .flags =IORESOURCE_MEM , }, {
@@ -350,6 +350,21 @@ static struct platform_device dm644x_emac_device = { .resource = dm644x_emac_resources, }; +static struct resource dm644x_mdio_resources[] = { + { + .start =DM644X_EMAC_MDIO_BASE , + .end =DM644X_EMAC_MDIO_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +static struct platform_device dm644x_mdio_device = { + .name ="davinci_mdio" , + .id =0 , + .num_resources =ARRAY_SIZE (dm644x_mdio_resources), + .resource = dm644x_mdio_resources, +}; +/* * Device specific mux setup *
@@ -777,7 +792,12 @@ static int __init dm644x_init_devices(void)clk_add_alias ("master" , dm644x_ccdc_dev.name,"vpss_master" ,NULL );clk_add_alias ("slave" , dm644x_ccdc_dev.name,"vpss_slave" ,NULL );platform_device_register (&dm644x_edma_device); + +platform_device_register (&dm644x_mdio_device);platform_device_register (&dm644x_emac_device); +clk_add_alias (NULL ,dev_name (&dm644x_mdio_device.dev), +NULL , &dm644x_emac_device.dev); +platform_device_register (&dm644x_vpss_device);platform_device_register (&dm644x_ccdc_dev);platform_device_register (&vpfe_capture_dev);
arch/arm/mach-davinci/dm646x.c +20 -1
@@ -366,7 +366,7 @@ static struct emac_platform_data dm646x_emac_pdata = {static struct resource dm646x_emac_resources[] = { { .start =DM646X_EMAC_BASE , - .end =DM646X_EMAC_BASE +0x47ff , + .end =DM646X_EMAC_BASE +SZ_16K -1 , .flags =IORESOURCE_MEM , }, {
@@ -401,6 +401,21 @@ static struct platform_device dm646x_emac_device = { .resource = dm646x_emac_resources, }; +static struct resource dm646x_mdio_resources[] = { + { + .start =DM646X_EMAC_MDIO_BASE , + .end =DM646X_EMAC_MDIO_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +static struct platform_device dm646x_mdio_device = { + .name ="davinci_mdio" , + .id =0 , + .num_resources =ARRAY_SIZE (dm646x_mdio_resources), + .resource = dm646x_mdio_resources, +}; +/* * Device specific mux setup *
@@ -897,7 +912,11 @@ static int __init dm646x_init_devices(void)if (!cpu_is_davinci_dm646x ())return 0 ; +platform_device_register (&dm646x_mdio_device);platform_device_register (&dm646x_emac_device); +clk_add_alias (NULL ,dev_name (&dm646x_mdio_device.dev), +NULL , &dm646x_emac_device.dev); +return 0 ; }postcore_initcall (dm646x_init_devices);
arch/arm/mach-davinci/include/mach/dm365.h +1 -0
@@ -21,6 +21,7 @@#include <media/davinci/vpfe_capture.h> #define DM365_EMAC_BASE (0x01D07000) +#define DM365_EMAC_MDIO_BASE (DM365_EMAC_BASE + 0x4000)#define DM365_EMAC_CNTRL_OFFSET (0x0000)#define DM365_EMAC_CNTRL_MOD_OFFSET (0x3000)#define DM365_EMAC_CNTRL_RAM_OFFSET (0x1000)
arch/arm/mach-davinci/include/mach/dm644x.h +1 -0
@@ -28,6 +28,7 @@#include <media/davinci/vpfe_capture.h> #define DM644X_EMAC_BASE (0x01C80000) +#define DM644X_EMAC_MDIO_BASE (DM644X_EMAC_BASE + 0x4000)#define DM644X_EMAC_CNTRL_OFFSET (0x0000)#define DM644X_EMAC_CNTRL_MOD_OFFSET (0x1000)#define DM644X_EMAC_CNTRL_RAM_OFFSET (0x2000)
arch/arm/mach-davinci/include/mach/dm646x.h +1 -0
@@ -19,6 +19,7 @@#include <linux/davinci_emac.h> #define DM646X_EMAC_BASE (0x01C80000) +#define DM646X_EMAC_MDIO_BASE (DM646X_EMAC_BASE + 0x4000)#define DM646X_EMAC_CNTRL_OFFSET (0x0000)#define DM646X_EMAC_CNTRL_MOD_OFFSET (0x1000)#define DM646X_EMAC_CNTRL_RAM_OFFSET (0x2000)
Signature · 1 line
1.7.2.1
PATCH 33/47 omap: add mdio platform devices
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch adds mdio platform devices on SoCs that have the necessary hardware. Clock lookup entries (aliases) have also been added, so that the MDIO and EMAC drivers can independently enable/disable a shared underlying clock. Further, the EMAC MMR region has been split down into separate MDIO and EMAC regions.
--- arch/arm/mach-omap2/board-am3517evm.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-am3517evm.c +26 -1
@@ -18,6 +18,7 @@#include <linux/kernel.h> #include <linux/init.h> +#include <linux/clk.h> #include <linux/platform_device.h> #include <linux/gpio.h> #include <linux/i2c/pca953x.h>
@@ -41,6 +42,27 @@#define AM35XX_EVM_PHY_MASK (0xF)#define AM35XX_EVM_MDIO_FREQUENCY (1000000) +static struct mdio_platform_data am3517_evm_mdio_pdata = { + .bus_freq =AM35XX_EVM_MDIO_FREQUENCY , +}; + +static struct resource am3517_mdio_resources[] = { + { + .start =AM35XX_IPSS_EMAC_BASE +AM35XX_EMAC_MDIO_OFFSET , + .end =AM35XX_IPSS_EMAC_BASE +AM35XX_EMAC_MDIO_OFFSET + +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +static struct platform_device am3517_mdio_device = { + .name ="davinci_mdio" , + .id =0 , + .num_resources =ARRAY_SIZE (am3517_mdio_resources), + .resource = am3517_mdio_resources, + .dev.platform_data = &am3517_evm_mdio_pdata, +}; +static struct emac_platform_data am3517_evm_emac_pdata = { .phy_mask =AM35XX_EVM_PHY_MASK , .mdio_max_freq =AM35XX_EVM_MDIO_FREQUENCY ,
@@ -50,7 +72,7 @@ static struct emac_platform_data am3517_evm_emac_pdata = {static struct resource am3517_emac_resources[] = { { .start =AM35XX_IPSS_EMAC_BASE , - .end =AM35XX_IPSS_EMAC_BASE +0x3FFFF , + .end =AM35XX_IPSS_EMAC_BASE +0x2FFFF , .flags =IORESOURCE_MEM , }, {
@@ -121,6 +143,9 @@ void am3517_evm_ethernet_init(struct emac_platform_data *pdata) pdata->interrupt_disable = am3517_disable_ethernet_int; am3517_emac_device.dev.platform_data = pdata;platform_device_register (&am3517_emac_device); +platform_device_register (&am3517_mdio_device); +clk_add_alias (NULL ,dev_name (&am3517_mdio_device.dev), +NULL , &am3517_emac_device.dev); regval =omap_ctrl_readl (AM35XX_CONTROL_IP_SW_RESET ); regval = regval & (~(AM35XX_CPGMACSS_SW_RST ));
Signature · 1 line
1.7.2.1
PATCH 34/47 net: davinci_emac: switch to new mdio
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch switches the emac implementation over to the newly separated MDIO driver.
With this, the mdio bus frequency defaults to a safe 2.2MHz. Boards may optionally specify a bus frequency via platform data.
The phy identification scheme has been modified to use a phy bus id instead of a mask. This largely serves to eliminate the "phy search" code in emac init.
--- drivers/net/Kconfig | 1 + drivers/net/davinci_emac.c | 88 ++++++++++++++--------------------------- include/linux/davinci_emac.h | 9 ++++ 3 files changed, 40 insertions(+), 58 deletions(-)
drivers/net/Kconfig +1 -0
@@ -951,6 +951,7 @@ config NET_NETX config TI_DAVINCI_EMAC tristate "TI DaVinci EMAC Support" depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 ) + select TI_DAVINCI_MDIO select PHYLIB help This driver supports TI's DaVinci Ethernet .
drivers/net/davinci_emac.c +30 -58
175 lines not on this page · raw message
include/linux/davinci_emac.h +9 -0
@@ -28,6 +28,15 @@ struct emac_platform_data {u32 ctrl_ram_size;u32 phy_mask;u32 mdio_max_freq; + +/* +* phy_id can be one of the following: +* - NULL : use the first phy on the bus, +* - "" : force to 100/full, no mdio control +* - "<bus>:<addr>" : use the specified bus and phy +*/ +const char *phy_id; +u8 rmii_en;u8 version;void (*interrupt_enable) (void );
Signature · 1 line
1.7.2.1
PATCH 35/47 davinci: cleanup mdio arch code and switch to phy_id
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch removes davinci architecture code that has now been rendered useless by the previous patches in the MDIO separation series.
In addition, the earlier phy_mask definitions have been replaced with corresponding phy_id definitions.
--- arch/arm/mach-davinci/board-da830-evm.c | 7 ++----- arch/arm/mach-davinci/board-da850-evm.c | 7 ++----- arch/arm/mach-davinci/board-dm365-evm.c | 7 ++----- arch/arm/mach-davinci/board-dm644x-evm.c | 8 ++------ arch/arm/mach-davinci/board-dm646x-evm.c | 7 ++----- arch/arm/mach-davinci/board-mityomapl138.c | 8 ++------ arch/arm/mach-davinci/board-neuros-osd2.c | 7 ++----- arch/arm/mach-davinci/board-sffsdr.c | 7 ++----- arch/arm/mach-davinci/devices-da8xx.c | 2 -- arch/arm/mach-davinci/dm365.c | 1 - arch/arm/mach-davinci/dm644x.c | 1 - arch/arm/mach-davinci/dm646x.c | 1 - arch/arm/mach-davinci/include/mach/dm365.h | 1 - arch/arm/mach-davinci/include/mach/dm644x.h | 1 - arch/arm/mach-davinci/include/mach/dm646x.h | 1 - 15 files changed, 16 insertions(+), 50 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +2 -5
@@ -31,9 +31,7 @@#include <mach/usb.h> #include <mach/aemif.h> -#define DA830_EVM_PHY_MASK 0x0 -#define DA830_EVM_MDIO_FREQUENCY 2200000/* PHY bus frequency */ - +#define DA830_EVM_PHY_ID ""/* * USB1 VBUS is controlled by GPIO1[15], over-current is reported on GPIO2[4]. */
@@ -558,9 +556,8 @@ static __init void da830_evm_init(void)da830_evm_usb_init (); - soc_info->emac_pdata->phy_mask =DA830_EVM_PHY_MASK ; - soc_info->emac_pdata->mdio_max_freq =DA830_EVM_MDIO_FREQUENCY ; soc_info->emac_pdata->rmii_en =1 ; + soc_info->emac_pdata->phy_id =DA830_EVM_PHY_ID ; ret =davinci_cfg_reg_list (da830_cpgmac_pins);if (ret)
arch/arm/mach-davinci/board-da850-evm.c +2 -5
@@ -38,9 +38,7 @@#include <mach/mux.h> #include <mach/aemif.h> -#define DA850_EVM_PHY_MASK 0x1 -#define DA850_EVM_MDIO_FREQUENCY 2200000/* PHY bus frequency */ - +#define DA850_EVM_PHY_ID "0:00"#define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)
@@ -678,8 +676,7 @@ static int __init da850_evm_config_emac(void)/* Enable/Disable MII MDIO clock */ gpio_direction_output (DA850_MII_MDIO_CLKEN_PIN , rmii_en); - soc_info->emac_pdata->phy_mask =DA850_EVM_PHY_MASK ; - soc_info->emac_pdata->mdio_max_freq =DA850_EVM_MDIO_FREQUENCY ; + soc_info->emac_pdata->phy_id =DA850_EVM_PHY_ID ; ret =da8xx_register_emac ();if (ret)
arch/arm/mach-davinci/board-dm365-evm.c +2 -5
@@ -54,9 +54,7 @@ static inline int have_tvp7002(void)return 0 ; } -#define DM365_EVM_PHY_MASK (0x2) -#define DM365_EVM_MDIO_FREQUENCY (2200000)/* PHY bus frequency */ - +#define DM365_EVM_PHY_ID "0:01"/* * A MAX-II CPLD is used for various board control functions. */
@@ -535,8 +533,7 @@ fail:/* ... and ENET ... */ dm365evm_emac_configure (); - soc_info->emac_pdata->phy_mask =DM365_EVM_PHY_MASK ; - soc_info->emac_pdata->mdio_max_freq =DM365_EVM_MDIO_FREQUENCY ; + soc_info->emac_pdata->phy_id =DM365_EVM_PHY_ID ; resets &= ~BIT (3 );/* ... and AIC33 */
arch/arm/mach-davinci/board-dm644x-evm.c +2 -6
@@ -39,9 +39,7 @@#include <mach/usb.h> #include <mach/aemif.h> -#define DM644X_EVM_PHY_MASK (0x2) -#define DM644X_EVM_MDIO_FREQUENCY (2200000)/* PHY bus frequency */ - +#define DM644X_EVM_PHY_ID "0:01"#define LXT971_PHY_ID (0x001378e2)#define LXT971_PHY_MASK (0xfffffff0)
@@ -707,9 +705,7 @@ static __init void davinci_evm_init(void)davinci_serial_init (&uart_config);dm644x_init_asp (&dm644x_evm_snd_data); - soc_info->emac_pdata->phy_mask =DM644X_EVM_PHY_MASK ; - soc_info->emac_pdata->mdio_max_freq =DM644X_EVM_MDIO_FREQUENCY ; - + soc_info->emac_pdata->phy_id =DM644X_EVM_PHY_ID ;/* Register the fixup for PHY on DaVinci */ phy_register_fixup_for_uid (LXT971_PHY_ID ,LXT971_PHY_MASK , davinci_phy_fixup);
arch/arm/mach-davinci/board-dm646x-evm.c +2 -5
@@ -729,9 +729,7 @@ static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0), }; -#define DM646X_EVM_PHY_MASK (0x2) -#define DM646X_EVM_MDIO_FREQUENCY (2200000)/* PHY bus frequency */ - +#define DM646X_EVM_PHY_ID "0:01"/* * The following EDMA channels/slots are not being used by drivers (for * example: Timer, GPIO, UART events etc) on dm646x, hence they are being
@@ -784,8 +782,7 @@ static __init void evm_init(void)if (HAS_ATA )davinci_init_ide (); - soc_info->emac_pdata->phy_mask =DM646X_EVM_PHY_MASK ; - soc_info->emac_pdata->mdio_max_freq =DM646X_EVM_MDIO_FREQUENCY ; + soc_info->emac_pdata->phy_id =DM646X_EVM_PHY_ID ; }#define DM646X_EVM_REF_FREQ 27000000
arch/arm/mach-davinci/board-mityomapl138.c +2 -6
@@ -24,9 +24,7 @@#include <mach/nand.h> #include <mach/mux.h> -#define MITYOMAPL138_PHY_MASK 0x08/* hardcoded for now */ -#define MITYOMAPL138_MDIO_FREQUENCY (2200000)/* PHY bus frequency */ - +#define MITYOMAPL138_PHY_ID "0:03"static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = { .bus_freq =100 ,/* kHz */ .bus_delay =0 ,/* usec */
@@ -273,9 +271,7 @@ static void __init mityomapl138_config_emac(void)/* configure the CFGCHIP3 register for RMII or MII */ __raw_writel (val, cfg_chip3_base); - soc_info->emac_pdata->phy_mask =MITYOMAPL138_PHY_MASK ; -pr_debug ("setting phy_mask to %x\n" , soc_info->emac_pdata->phy_mask); - soc_info->emac_pdata->mdio_max_freq =MITYOMAPL138_MDIO_FREQUENCY ; + soc_info->emac_pdata->phy_id =MITYOMAPL138_PHY_ID ; ret =da8xx_register_emac ();if (ret)
arch/arm/mach-davinci/board-neuros-osd2.c +2 -5
@@ -39,9 +39,7 @@#include <mach/mmc.h> #include <mach/usb.h> -#define NEUROS_OSD2_PHY_MASK 0x2 -#define NEUROS_OSD2_MDIO_FREQUENCY 2200000/* PHY bus frequency */ - +#define NEUROS_OSD2_PHY_ID "0:01"#define LXT971_PHY_ID 0x001378e2#define LXT971_PHY_MASK 0xfffffff0
@@ -252,8 +250,7 @@ static __init void davinci_ntosd2_init(void)davinci_serial_init (&uart_config);dm644x_init_asp (&dm644x_ntosd2_snd_data); - soc_info->emac_pdata->phy_mask =NEUROS_OSD2_PHY_MASK ; - soc_info->emac_pdata->mdio_max_freq =NEUROS_OSD2_MDIO_FREQUENCY ; + soc_info->emac_pdata->phy_id =NEUROS_OSD2_PHY_ID ;davinci_setup_usb (1000 ,8 );/*
arch/arm/mach-davinci/board-sffsdr.c +2 -5
@@ -42,9 +42,7 @@#include <mach/mux.h> #include <mach/usb.h> -#define SFFSDR_PHY_MASK (0x2) -#define SFFSDR_MDIO_FREQUENCY (2200000)/* PHY bus frequency */ - +#define SFFSDR_PHY_ID "0:01"static struct mtd_partition davinci_sffsdr_nandflash_partition[] = {/* U-Boot Environment: Block 0 * UBL: Block 1
@@ -143,8 +141,7 @@ static __init void davinci_sffsdr_init(void) ARRAY_SIZE(davinci_sffsdr_devices));sffsdr_init_i2c ();davinci_serial_init (&uart_config); - soc_info->emac_pdata->phy_mask =SFFSDR_PHY_MASK ; - soc_info->emac_pdata->mdio_max_freq =SFFSDR_MDIO_FREQUENCY ; + soc_info->emac_pdata->phy_id =SFFSDR_PHY_ID ;davinci_setup_usb (0 ,0 );/* We support only peripheral mode. */ /* mux VLYNQ pins */
arch/arm/mach-davinci/devices-da8xx.c +0 -2
@@ -42,7 +42,6 @@#define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000#define DA8XX_EMAC_MOD_REG_OFFSET 0x2000#define DA8XX_EMAC_RAM_OFFSET 0x0000 -#define DA8XX_MDIO_REG_OFFSET 0x4000#define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8Kvoid __iomem *da8xx_syscfg0_base;
@@ -381,7 +380,6 @@ struct emac_platform_data da8xx_emac_pdata = { .ctrl_reg_offset = DA8XX_EMAC_CTRL_REG_OFFSET, .ctrl_mod_reg_offset = DA8XX_EMAC_MOD_REG_OFFSET, .ctrl_ram_offset = DA8XX_EMAC_RAM_OFFSET, - .mdio_reg_offset = DA8XX_MDIO_REG_OFFSET, .ctrl_ram_size = DA8XX_EMAC_CTRL_RAM_SIZE, .version = EMAC_VERSION_2, };
arch/arm/mach-davinci/dm365.c +0 -1
@@ -691,7 +691,6 @@ static struct emac_platform_data dm365_emac_pdata = { .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET, .ctrl_ram_offset = DM365_EMAC_CNTRL_RAM_OFFSET, - .mdio_reg_offset = DM365_EMAC_MDIO_OFFSET, .ctrl_ram_size = DM365_EMAC_CNTRL_RAM_SIZE, .version = EMAC_VERSION_2, };
arch/arm/mach-davinci/dm644x.c +0 -1
@@ -322,7 +322,6 @@ static struct emac_platform_data dm644x_emac_pdata = { .ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET, .ctrl_mod_reg_offset = DM644X_EMAC_CNTRL_MOD_OFFSET, .ctrl_ram_offset = DM644X_EMAC_CNTRL_RAM_OFFSET, - .mdio_reg_offset = DM644X_EMAC_MDIO_OFFSET, .ctrl_ram_size = DM644X_EMAC_CNTRL_RAM_SIZE, .version = EMAC_VERSION_1, };
arch/arm/mach-davinci/dm646x.c +0 -1
@@ -358,7 +358,6 @@ static struct emac_platform_data dm646x_emac_pdata = { .ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET, .ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET, .ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET, - .mdio_reg_offset = DM646X_EMAC_MDIO_OFFSET, .ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE, .version = EMAC_VERSION_2, };
arch/arm/mach-davinci/include/mach/dm365.h +0 -1
@@ -25,7 +25,6 @@#define DM365_EMAC_CNTRL_OFFSET (0x0000)#define DM365_EMAC_CNTRL_MOD_OFFSET (0x3000)#define DM365_EMAC_CNTRL_RAM_OFFSET (0x1000) -#define DM365_EMAC_MDIO_OFFSET (0x4000)#define DM365_EMAC_CNTRL_RAM_SIZE (0x2000)/* Base of key scan register bank */
arch/arm/mach-davinci/include/mach/dm644x.h +0 -1
@@ -32,7 +32,6 @@#define DM644X_EMAC_CNTRL_OFFSET (0x0000)#define DM644X_EMAC_CNTRL_MOD_OFFSET (0x1000)#define DM644X_EMAC_CNTRL_RAM_OFFSET (0x2000) -#define DM644X_EMAC_MDIO_OFFSET (0x4000)#define DM644X_EMAC_CNTRL_RAM_SIZE (0x2000)#define DM644X_ASYNC_EMIF_CONTROL_BASE 0x01E00000
arch/arm/mach-davinci/include/mach/dm646x.h +0 -1
@@ -23,7 +23,6 @@#define DM646X_EMAC_CNTRL_OFFSET (0x0000)#define DM646X_EMAC_CNTRL_MOD_OFFSET (0x1000)#define DM646X_EMAC_CNTRL_RAM_OFFSET (0x2000) -#define DM646X_EMAC_MDIO_OFFSET (0x4000)#define DM646X_EMAC_CNTRL_RAM_SIZE (0x2000)#define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000
Signature · 1 line
1.7.2.1
PATCH 36/47 omap: cleanup unused davinci mdio arch code
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch removes davinci architecture code that has now been rendered useless by the previous patches in the MDIO separation series.
--- arch/arm/mach-omap2/board-am3517evm.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/board-am3517evm.c +0 -4
@@ -39,7 +39,6 @@#include "mux.h" -#define AM35XX_EVM_PHY_MASK (0xF)#define AM35XX_EVM_MDIO_FREQUENCY (1000000)static struct mdio_platform_data am3517_evm_mdio_pdata = {
@@ -64,8 +63,6 @@ static struct platform_device am3517_mdio_device = { };static struct emac_platform_data am3517_evm_emac_pdata = { - .phy_mask =AM35XX_EVM_PHY_MASK , - .mdio_max_freq =AM35XX_EVM_MDIO_FREQUENCY , .rmii_en =1 , };
@@ -135,7 +132,6 @@ void am3517_evm_ethernet_init(struct emac_platform_data *pdata) pdata->ctrl_reg_offset =AM35XX_EMAC_CNTRL_OFFSET ; pdata->ctrl_mod_reg_offset =AM35XX_EMAC_CNTRL_MOD_OFFSET ; pdata->ctrl_ram_offset =AM35XX_EMAC_CNTRL_RAM_OFFSET ; - pdata->mdio_reg_offset =AM35XX_EMAC_MDIO_OFFSET ; pdata->ctrl_ram_size =AM35XX_EMAC_CNTRL_RAM_SIZE ; pdata->version =EMAC_VERSION_2 ; pdata->hw_ram_addr =AM35XX_EMAC_HW_RAM_ADDR ;
Signature · 1 line
1.7.2.1
PATCH 37/47 net: davinci_emac: cleanup unused mdio emac code
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch removes code that has been rendered useless by the previous patches in this series.
--- drivers/net/davinci_emac.c | 107 ------------------------------------------ include/linux/davinci_emac.h | 3 - 2 files changed, 0 insertions(+), 110 deletions(-)
drivers/net/davinci_emac.c +0 -107
@@ -113,7 +113,6 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";#define EMAC_DEF_MAX_FRAME_SIZE (1500 + 14 + 4 + 4)#define EMAC_DEF_TX_CH (0)/* Default 0th channel */ #define EMAC_DEF_RX_CH (0)/* Default 0th channel */ -#define EMAC_DEF_MDIO_TICK_MS (10)/* typically 1 tick=1 ms) */ #define EMAC_DEF_MAX_TX_CH (1)/* Max TX channels configured */ #define EMAC_DEF_MAX_RX_CH (1)/* Max RX channels configured */ #define EMAC_POLL_WEIGHT (64)/* Default NAPI poll weight */
@@ -303,25 +302,6 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";#define EMAC_DM644X_INTMIN_INTVL 0x1#define EMAC_DM644X_INTMAX_INTVL (EMAC_DM644X_EWINTCNT_MASK) -/* EMAC MDIO related */ -/* Mask & Control defines */ -#define MDIO_CONTROL_CLKDIV (0xFF) -#define MDIO_CONTROL_ENABLE BIT(30) -#define MDIO_USERACCESS_GO BIT(31) -#define MDIO_USERACCESS_WRITE BIT(30) -#define MDIO_USERACCESS_READ (0) -#define MDIO_USERACCESS_REGADR (0x1F << 21) -#define MDIO_USERACCESS_PHYADR (0x1F << 16) -#define MDIO_USERACCESS_DATA (0xFFFF) -#define MDIO_USERPHYSEL_LINKSEL BIT(7) -#define MDIO_VER_MODID (0xFFFF << 16) -#define MDIO_VER_REVMAJ (0xFF << 8) -#define MDIO_VER_REVMIN (0xFF) - -#define MDIO_USERACCESS (inst) (0x80 + (inst * 8)) -#define MDIO_USERPHYSEL (inst) (0x84 + (inst * 8)) -#define MDIO_CONTROL (0x04) -/* EMAC DM646X control module registers */ #define EMAC_DM646X_CMINTCTRL 0x0C#define EMAC_DM646X_CMRXINTEN 0x14
@@ -493,13 +473,6 @@ struct emac_priv {u32 mac_hash2;u32 multicast_hash_cnt[EMAC_NUM_MULTICAST_BITS ];u32 rx_addr_type; -/* periodic timer required for MDIO polling */ -struct timer_list periodic_timer; -u32 periodic_ticks; -u32 timer_active; -u32 phy_mask; -/* mii_bus,phy members */ -struct mii_bus *mii_bus;const char *phy_id;struct phy_device *phydev;spinlock_t lock;
@@ -511,7 +484,6 @@ struct emac_priv {/* clock frequency for EMAC */ static struct clk *emac_clk;static unsigned long emac_bus_frequency; -static unsigned long mdio_max_freq;#define emac_virt_to_phys (addr, priv) \ (((u32 __force)(addr) - (u32 __force)(priv->emac_ctrl_ram)) \
@@ -549,9 +521,6 @@ static char *emac_rxhost_errcodes[16] = {#define emac_ctrl_read (reg) ioread32((priv->ctrl_base + (reg)))#define emac_ctrl_write (reg, val) iowrite32(val, (priv->ctrl_base + (reg))) -#define emac_mdio_read (reg) ioread32(bus->priv + (reg)) -#define emac_mdio_write (reg, val) iowrite32(val, (bus->priv + (reg))) -/** * emac_dump_regs: Dump important EMAC registers to debug terminal * @priv: The DaVinci EMAC private adapter structure
@@ -657,9 +626,6 @@ static void emac_dump_regs(struct emac_priv *priv) emac_read(EMAC_RXDMAOVERRUNS)); } -/************************************************************************* -* EMAC MDIO/Phy Functionality -*************************************************************************/ /** * emac_get_drvinfo: Get EMAC driver information * @ndev: The DaVinci EMAC network adapter
@@ -2349,79 +2315,6 @@ void emac_poll_controller(struct net_device *ndev) }#endif -/* PHY/MII bus related */ - -/* Wait until mdio is ready for next command */ -#define MDIO_WAIT_FOR_USER_ACCESS \ - while ((emac_mdio_read((MDIO_USERACCESS(0))) &\ - MDIO_USERACCESS_GO) != 0) - -static int emac_mii_read (struct mii_bus *bus,int phy_id,int phy_reg) -{ -unsigned int phy_data =0 ; -unsigned int phy_control; - -/* Wait until mdio is ready for next command */ -MDIO_WAIT_FOR_USER_ACCESS ; - - phy_control = (MDIO_USERACCESS_GO | -MDIO_USERACCESS_READ | - ((phy_reg <<21 ) &MDIO_USERACCESS_REGADR ) | - ((phy_id <<16 ) &MDIO_USERACCESS_PHYADR ) | - (phy_data &MDIO_USERACCESS_DATA )); -emac_mdio_write (MDIO_USERACCESS (0 ), phy_control); - -/* Wait until mdio is ready for next command */ -MDIO_WAIT_FOR_USER_ACCESS ; - -return emac_mdio_read (MDIO_USERACCESS (0 )) &MDIO_USERACCESS_DATA ; - -} - -static int emac_mii_write (struct mii_bus *bus,int phy_id, -int phy_reg,u16 phy_data) -{ - -unsigned int control; - -/* until mdio is ready for next command */ -MDIO_WAIT_FOR_USER_ACCESS ; - - control = (MDIO_USERACCESS_GO | -MDIO_USERACCESS_WRITE | - ((phy_reg <<21 ) &MDIO_USERACCESS_REGADR ) | - ((phy_id <<16 ) &MDIO_USERACCESS_PHYADR ) | - (phy_data &MDIO_USERACCESS_DATA )); -emac_mdio_write (MDIO_USERACCESS (0 ), control); - -return 0 ; -} - -static int emac_mii_reset (struct mii_bus *bus) -{ -unsigned int clk_div; -int mdio_bus_freq = emac_bus_frequency; - -if (mdio_max_freq && mdio_bus_freq) - clk_div = ((mdio_bus_freq / mdio_max_freq) -1 ); -else - clk_div =0xFF ; - - clk_div &=MDIO_CONTROL_CLKDIV ; - -/* Set enable and clock divider in MDIOControl */ -emac_mdio_write (MDIO_CONTROL , (clk_div |MDIO_CONTROL_ENABLE )); - -return 0 ; - -} - -static int mii_irqs[PHY_MAX_ADDR ] = {PHY_POLL ,PHY_POLL }; - -/* emac_driver: EMAC MII bus structure */ - -static struct mii_bus *emac_mii; -static void emac_adjust_link (struct net_device *ndev) {struct emac_priv *priv =netdev_priv (ndev);
include/linux/davinci_emac.h +0 -3
@@ -24,10 +24,7 @@ struct emac_platform_data {u32 ctrl_mod_reg_offset;u32 ctrl_ram_offset;u32 hw_ram_addr; -u32 mdio_reg_offset;u32 ctrl_ram_size; -u32 phy_mask; -u32 mdio_max_freq;/* * phy_id can be one of the following:
Signature · 1 line
1.7.2.1
PATCH 38/47 net: davinci_emac: separate out cpdma code
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
In addition to being embedded into the EMAC controller, the CPDMA hardware block is used in TI's CPSW switch controller. Fortunately, the programming interface to this hardware block remains pretty nicely consistent across these devices.
This patch adds a new CPDMA services layer, which can then be reused across EMAC and CPSW drivers.
--- drivers/net/Kconfig | 10 + drivers/net/Makefile | 1 + drivers/net/davinci_cpdma.c | 965 +++++++++++++++++++++++++++++++++++++++++++ drivers/net/davinci_cpdma.h | 108 +++++ 4 files changed, 1084 insertions(+), 0 deletions(-) create mode 100644 drivers/net/davinci_cpdma.c create mode 100644 drivers/net/davinci_cpdma.h
drivers/net/Kconfig +10 -0
@@ -952,6 +952,7 @@ config TI_DAVINCI_EMAC tristate "TI DaVinci EMAC Support" depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 ) select TI_DAVINCI_MDIO + select TI_DAVINCI_CPDMA select PHYLIB help This driver supports TI's DaVinci Ethernet .
@@ -969,6 +970,15 @@ config TI_DAVINCI_MDIO To compile this driver as a module, choose M here: the module will be called davinci_mdio. This is recommended. +config TI_DAVINCI_CPDMA + tristate "TI DaVinci CPDMA Support" + depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 ) + help + This driver supports TI's DaVinci CPDMA dma engine. + + To compile this driver as a module, choose M here: the module + will be called davinci_cpdma. This is recommended. + config DM9000 tristate "DM9000 support" depends on ARM || BLACKFIN || MIPS
drivers/net/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_PHYLIB) += phy/ obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o +obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o obj-$(CONFIG_E1000) += e1000/ obj-$(CONFIG_E1000E) += e1000e/
drivers/net/davinci_cpdma.c new file +965 -0
965 lines not on this page · raw message
drivers/net/davinci_cpdma.h new file +108 -0
108 lines not on this page · raw message
Signature · 1 line
1.7.2.1
PATCH 39/47 net: davinci_emac: switch to new cpdma layer
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch hooks up the emac driver with the newly separated cpdma driver.
Key differences introduced here:
- The old buffer list scheme is no longer required
- The original code maintained mac address per rx channel, even if only one rx channel was being used. With this change, mac address is maintained device wide. If support for multiple rx channels is added in future, this will need to be reworked a bit.
- The new CPDMA code handles short packets better than before. The earlier code was adjusting the length up, without ensuring that the tail end of the padding was cleared - a possible security issue. This has been fixed to use skb_padto().
--- drivers/net/davinci_emac.c | 249 +++++++++++++++++++++++++++++--------------- 1 files changed, 164 insertions(+), 85 deletions(-)
drivers/net/davinci_emac.c +164 -85
@@ -63,6 +63,8 @@#include <asm/irq.h> #include <asm/page.h> +#include "davinci_cpdma.h" +static int debug_level;module_param (debug_level, int,0 );MODULE_PARM_DESC (debug_level,"DaVinci EMAC debug level (NETIF_MSG bits)" );
@@ -113,6 +115,7 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";#define EMAC_DEF_MAX_FRAME_SIZE (1500 + 14 + 4 + 4)#define EMAC_DEF_TX_CH (0)/* Default 0th channel */ #define EMAC_DEF_RX_CH (0)/* Default 0th channel */ +#define EMAC_DEF_RX_NUM_DESC (128)#define EMAC_DEF_MAX_TX_CH (1)/* Max TX channels configured */ #define EMAC_DEF_MAX_RX_CH (1)/* Max RX channels configured */ #define EMAC_POLL_WEIGHT (64)/* Default NAPI poll weight */
@@ -460,6 +463,9 @@ struct emac_priv {u32 hw_ram_addr;struct emac_txch *txch[EMAC_DEF_MAX_TX_CH ];struct emac_rxch *rxch[EMAC_DEF_MAX_RX_CH ]; +struct cpdma_ctlr *dma; +struct cpdma_chan *txchan; +struct cpdma_chan *rxchan;u32 link;/* 1=link on, 0=link off */ u32 speed;/* 0=Auto Neg, 1=No PHY, 10,100, 1000 - mbps */ u32 duplex;/* Link duplex: 0=Half, 1=Full */
@@ -624,6 +630,8 @@ static void emac_dump_regs(struct emac_priv *priv) emac_read(EMAC_RXMOFOVERRUNS));dev_info (emac_dev,"EMAC: rx_dma_overruns:%d\n" ,emac_read (EMAC_RXDMAOVERRUNS )); + +cpdma_ctlr_dump (priv->dma); }/**
@@ -1151,6 +1159,70 @@ static irqreturn_t emac_irq(int irq, void *dev_id)return IRQ_HANDLED ; } +static struct sk_buff *emac_rx_alloc (struct emac_priv *priv) +{ +struct sk_buff *skb =dev_alloc_skb (priv->rx_buf_size); +if (WARN_ON (!skb)) +return NULL ; + skb->dev = priv->ndev; +skb_reserve (skb,NET_IP_ALIGN ); +return skb; +} + +static void emac_rx_handler (void *token,int len,int status) +{ +struct sk_buff *skb = token; +struct net_device *ndev = skb->dev; +struct emac_priv *priv =netdev_priv (ndev); +struct device *emac_dev = &ndev->dev; +int ret; + +/* free and bail if we are shutting down */ +if (unlikely (!netif_running (ndev))) { +dev_kfree_skb_any (skb); +return ; + } + +/* recycle on recieve error */ +if (status <0 ) { + ndev->stats.rx_errors++; + goto recycle; + } + +/* feed received packet up the stack */ +skb_put (skb, len); + skb->protocol =eth_type_trans (skb, ndev); +netif_receive_skb (skb); + ndev->stats.rx_bytes += len; + ndev->stats.rx_packets++; + +/* alloc a new packet for receive */ + skb =emac_rx_alloc (priv); +if (!skb) { +if (netif_msg_rx_err (priv) &&net_ratelimit ()) +dev_err (emac_dev,"failed rx buffer alloc\n" ); +return ; + } + +recycle: + ret =cpdma_chan_submit (priv->rxchan, skb, skb->data, +skb_tailroom (skb),GFP_KERNEL ); +if (WARN_ON (ret <0 )) +dev_kfree_skb_any (skb); +} + +static void emac_tx_handler (void *token,int len,int status) +{ +struct sk_buff *skb = token; +struct net_device *ndev = skb->dev; + +if (unlikely (netif_queue_stopped (ndev))) +netif_start_queue (ndev); + ndev->stats.tx_packets++; + ndev->stats.tx_bytes += len; +dev_kfree_skb_any (skb); +} +/** EMAC on-chip buffer descriptor memory * * WARNING: Please note that the on chip memory is used for both TX and RX
@@ -1532,42 +1604,36 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev) {struct device *emac_dev = &ndev->dev;int ret_code; -struct emac_netbufobj tx_buf;/* buffer obj-only single frame support */ -struct emac_netpktobj tx_packet;/* packet object */ struct emac_priv *priv =netdev_priv (ndev);/* If no link, return */ if (unlikely (!priv->link)) {if (netif_msg_tx_err (priv) &&net_ratelimit ())dev_err (emac_dev,"DaVinci EMAC: No link to transmit" ); -return NETDEV_TX_BUSY ; + goto fail_tx; } -/* Build the buffer and packet objects - Since only single fragment is -* supported, need not set length and token in both packet & object. -* Doing so for completeness sake & to show that this needs to be done -* in multifragment case -*/ - tx_packet.buf_list = &tx_buf; - tx_packet.num_bufs =1 ;/* only single fragment supported */ - tx_packet.pkt_length = skb->len; - tx_packet.pkt_token = (void *)skb; - tx_buf.length = skb->len; - tx_buf.buf_token = (void *)skb; - tx_buf.data_ptr = skb->data; - ret_code =emac_send (priv, &tx_packet,EMAC_DEF_TX_CH ); + ret_code =skb_padto (skb,EMAC_DEF_MIN_ETHPKTSIZE ); +if (unlikely (ret_code <0 )) { +if (netif_msg_tx_err (priv) &&net_ratelimit ()) +dev_err (emac_dev,"DaVinci EMAC: packet pad failed" ); + goto fail_tx; + } + + ret_code =cpdma_chan_submit (priv->txchan, skb, skb->data, skb->len, +GFP_KERNEL );if (unlikely (ret_code !=0 )) { -if (ret_code ==EMAC_ERR_TX_OUT_OF_BD ) { -if (netif_msg_tx_err (priv) &&net_ratelimit ()) -dev_err (emac_dev,"DaVinci EMAC: xmit() fatal" \ -" err. Out of TX BD's" ); -netif_stop_queue (priv->ndev); - } - ndev->stats.tx_dropped++; -return NETDEV_TX_BUSY ; +if (netif_msg_tx_err (priv) &&net_ratelimit ()) +dev_err (emac_dev,"DaVinci EMAC: desc submit failed" ); + goto fail_tx; }return NETDEV_TX_OK ; + +fail_tx: + ndev->stats.tx_dropped++; +netif_stop_queue (ndev); +return NETDEV_TX_BUSY ; }/**
@@ -1588,13 +1654,12 @@ static void emac_dev_tx_timeout(struct net_device *ndev)if (netif_msg_tx_err (priv))dev_err (emac_dev,"DaVinci EMAC: xmit timeout, restarting TX" ); +emac_dump_regs (priv); + ndev->stats.tx_errors++;emac_int_disable (priv); -emac_stop_txch (priv,EMAC_DEF_TX_CH ); -emac_cleanup_txch (priv,EMAC_DEF_TX_CH ); -emac_init_txch (priv,EMAC_DEF_TX_CH ); -emac_write (EMAC_TXHDP (0 ),0 ); -emac_write (EMAC_TXINTMASKSET ,BIT (EMAC_DEF_TX_CH )); +cpdma_chan_stop (priv->txchan); +cpdma_chan_start (priv->txchan);emac_int_enable (priv); }
@@ -1915,7 +1980,6 @@ static void emac_setmac(struct emac_priv *priv, u32 ch, char *mac_addr)static int emac_dev_setmac_addr (struct net_device *ndev,void *addr) {struct emac_priv *priv =netdev_priv (ndev); -struct emac_rxch *rxch = priv->rxch[EMAC_DEF_RX_CH ];struct device *emac_dev = &priv->ndev->dev;struct sockaddr *sa = addr;
@@ -1926,11 +1990,10 @@ static int emac_dev_setmac_addr(struct net_device *ndev, void *addr)memcpy (priv->mac_addr, sa->sa_data, ndev->addr_len);memcpy (ndev->dev_addr, sa->sa_data, ndev->addr_len); -/* If the interface is down - rxch is NULL. */ /* MAC address is configured only after the interface is enabled. */ if (netif_running (ndev)) { -memcpy (rxch->mac_addr, sa->sa_data, ndev->addr_len); -emac_setmac (priv,EMAC_DEF_RX_CH , rxch->mac_addr); +memcpy (priv->mac_addr, sa->sa_data, ndev->addr_len); +emac_setmac (priv,EMAC_DEF_RX_CH , priv->mac_addr); }if (netif_msg_drv (priv))
@@ -2139,7 +2202,7 @@ end_emac_rx_bdproc:*/ static int emac_hw_enable (struct emac_priv *priv) { -u32 ch, val, mbp_enable, mac_control; +u32 val, mbp_enable, mac_control;/* Soft reset */ emac_write (EMAC_SOFTRESET ,1 );
@@ -2182,26 +2245,9 @@ static int emac_hw_enable(struct emac_priv *priv)emac_write (EMAC_RXUNICASTCLEAR ,EMAC_RX_UNICAST_CLEAR_ALL ); priv->rx_addr_type = (emac_read (EMAC_MACCONFIG ) >>8 ) &0xFF ; - val =emac_read (EMAC_TXCONTROL ); - val |=EMAC_TX_CONTROL_TX_ENABLE_VAL ; -emac_write (EMAC_TXCONTROL , val); - val =emac_read (EMAC_RXCONTROL ); - val |=EMAC_RX_CONTROL_RX_ENABLE_VAL ; -emac_write (EMAC_RXCONTROL , val);emac_write (EMAC_MACINTMASKSET ,EMAC_MAC_HOST_ERR_INTMASK_VAL ); -for (ch =0 ; ch <EMAC_DEF_MAX_TX_CH ; ch++) { -emac_write (EMAC_TXHDP (ch),0 ); -emac_write (EMAC_TXINTMASKSET ,BIT (ch)); - } -for (ch =0 ; ch <EMAC_DEF_MAX_RX_CH ; ch++) { -struct emac_rxch *rxch = priv->rxch[ch]; -emac_setmac (priv, ch, rxch->mac_addr); -emac_write (EMAC_RXINTMASKSET ,BIT (ch)); - rxch->queue_active =1 ; -emac_write (EMAC_RXHDP (ch), -emac_virt_to_phys (rxch->active_queue_head, priv)); - } +emac_setmac (priv,EMAC_DEF_RX_CH , priv->mac_addr);/* Enable MII */ val =emac_read (EMAC_MACCONTROL );
@@ -2246,8 +2292,8 @@ static int emac_poll(struct napi_struct *napi, int budget) mask =EMAC_DM646X_MAC_IN_VECTOR_TX_INT_VEC ;if (status & mask) { - num_tx_pkts =emac_tx_bdproc (priv,EMAC_DEF_TX_CH , -EMAC_DEF_TX_MAX_SERVICE ); + num_tx_pkts =cpdma_chan_process (priv->txchan, +EMAC_DEF_TX_MAX_SERVICE ); }/* TX processing */ mask =EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC ;
@@ -2256,7 +2302,7 @@ static int emac_poll(struct napi_struct *napi, int budget) mask =EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC ;if (status & mask) { - num_rx_pkts =emac_rx_bdproc (priv,EMAC_DEF_RX_CH , budget); + num_rx_pkts =cpdma_chan_process (priv->rxchan, budget); }/* RX processing */ mask =EMAC_DM644X_MAC_IN_VECTOR_HOST_INT ;
@@ -2397,9 +2443,9 @@ static int match_first_device(struct device *dev, void *data)static int emac_dev_open (struct net_device *ndev) {struct device *emac_dev = &ndev->dev; -u32 rc, cnt, ch; +u32 cnt;struct resource *res; -int q, m; +int q, m, ret;int i =0 ;int k =0 ;struct emac_priv *priv =netdev_priv (ndev);
@@ -2411,29 +2457,21 @@ static int emac_dev_open(struct net_device *ndev)/* Configuration items */ priv->rx_buf_size =EMAC_DEF_MAX_FRAME_SIZE +NET_IP_ALIGN ; -/* Clear basic hardware */ -for (ch =0 ; ch <EMAC_MAX_TXRX_CHANNELS ; ch++) { -emac_write (EMAC_TXHDP (ch),0 ); -emac_write (EMAC_RXHDP (ch),0 ); -emac_write (EMAC_RXHDP (ch),0 ); -emac_write (EMAC_RXINTMASKCLEAR ,EMAC_INT_MASK_CLEAR ); -emac_write (EMAC_TXINTMASKCLEAR ,EMAC_INT_MASK_CLEAR ); - } priv->mac_hash1 =0 ; priv->mac_hash2 =0 ;emac_write (EMAC_MACHASH1 ,0 );emac_write (EMAC_MACHASH2 ,0 ); -/* multi ch not supported - open 1 TX, 1RX ch by default */ - rc =emac_init_txch (priv,EMAC_DEF_TX_CH ); -if (0 != rc) { -dev_err (emac_dev,"DaVinci EMAC: emac_init_txch() failed" ); -return rc; - } - rc =emac_init_rxch (priv,EMAC_DEF_RX_CH , priv->mac_addr); -if (0 != rc) { -dev_err (emac_dev,"DaVinci EMAC: emac_init_rxch() failed" ); -return rc; +for (i =0 ; i <EMAC_DEF_RX_NUM_DESC ; i++) { +struct sk_buff *skb =emac_rx_alloc (priv); + +if (!skb) +break ; + + ret =cpdma_chan_submit (priv->rxchan, skb, skb->data, +skb_tailroom (skb),GFP_KERNEL ); +if (WARN_ON (ret <0 )) +break ; }/* Request IRQ */
@@ -2458,6 +2496,8 @@ static int emac_dev_open(struct net_device *ndev)emac_set_coalesce (ndev, &coal); } +cpdma_ctlr_start (priv->dma); + priv->phydev =NULL ;/* use the first phy on the bus if pdata did not give us a phy id */ if (!priv->phy_id) {
@@ -2545,10 +2585,7 @@ static int emac_dev_stop(struct net_device *ndev)netif_carrier_off (ndev);emac_int_disable (priv); -emac_stop_txch (priv,EMAC_DEF_TX_CH ); -emac_stop_rxch (priv,EMAC_DEF_RX_CH ); -emac_cleanup_txch (priv,EMAC_DEF_TX_CH ); -emac_cleanup_rxch (priv,EMAC_DEF_RX_CH ); +cpdma_ctlr_stop (priv->dma);emac_write (EMAC_SOFTRESET ,1 );if (priv->phydev)
@@ -2653,9 +2690,10 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)struct resource *res;struct net_device *ndev;struct emac_priv *priv; -unsigned long size; +unsigned long size, hw_ram_addr;struct emac_platform_data *pdata;struct device *emac_dev; +struct cpdma_params dma_params;/* obtain emac clock from kernel */ emac_clk =clk_get (&pdev->dev,NULL );
@@ -2731,11 +2769,40 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) priv->ctrl_ram_size = pdata->ctrl_ram_size; priv->emac_ctrl_ram = priv->remap_addr + pdata->ctrl_ram_offset; -if (pdata->hw_ram_addr) - priv->hw_ram_addr = pdata->hw_ram_addr; -else - priv->hw_ram_addr = (u32 __force )res->start + - pdata->ctrl_ram_offset; + hw_ram_addr = pdata->hw_ram_addr; +if (!hw_ram_addr) + hw_ram_addr = (u32 __force )res->start + pdata->ctrl_ram_offset; + +memset (&dma_params,0 ,sizeof (dma_params)); + dma_params.dev = emac_dev; + dma_params.dmaregs = priv->emac_base; + dma_params.rxthresh = priv->emac_base +0x120 ; + dma_params.rxfree = priv->emac_base +0x140 ; + dma_params.txhdp = priv->emac_base +0x600 ; + dma_params.rxhdp = priv->emac_base +0x620 ; + dma_params.txcp = priv->emac_base +0x640 ; + dma_params.rxcp = priv->emac_base +0x660 ; + dma_params.num_chan =EMAC_MAX_TXRX_CHANNELS ; + dma_params.min_packet_size =EMAC_DEF_MIN_ETHPKTSIZE ; + dma_params.desc_mem_phys = hw_ram_addr; + dma_params.desc_mem_size = pdata->ctrl_ram_size; + dma_params.desc_align =16 ; + + priv->dma =cpdma_ctlr_create (&dma_params); +if (!priv->dma) { +dev_err (emac_dev,"DaVinci EMAC: Error initializing DMA\n" ); + rc = -ENOMEM ; + goto no_dma; + } + + priv->txchan =cpdma_chan_create (priv->dma,tx_chan_num (EMAC_DEF_TX_CH ), + emac_tx_handler); + priv->rxchan =cpdma_chan_create (priv->dma,rx_chan_num (EMAC_DEF_RX_CH ), + emac_rx_handler); +if (WARN_ON (!priv->txchan || !priv->rxchan)) { + rc = -ENOMEM ; + goto no_irq_res; + } res =platform_get_resource (pdev,IORESOURCE_IRQ ,0 );if (!res) {
@@ -2778,6 +2845,12 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) netdev_reg_err:clk_disable (emac_clk); no_irq_res: +if (priv->txchan) +cpdma_chan_destroy (priv->txchan); +if (priv->rxchan) +cpdma_chan_destroy (priv->rxchan); +cpdma_ctlr_destroy (priv->dma); +no_dma: res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );release_mem_region (res->start, res->end - res->start +1 );iounmap (priv->remap_addr);
@@ -2806,6 +2879,12 @@ static int __devexit davinci_emac_remove(struct platform_device *pdev)platform_set_drvdata (pdev,NULL ); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (priv->txchan) +cpdma_chan_destroy (priv->txchan); +if (priv->rxchan) +cpdma_chan_destroy (priv->rxchan); +cpdma_ctlr_destroy (priv->dma); +release_mem_region (res->start, res->end - res->start +1 );unregister_netdev (ndev);
Signature · 1 line
1.7.2.1
PATCH 40/47 net: davinci_emac: cleanup unused cpdma code
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
Having switched over to the newly introduced cpdma layer, this patch now removes a whole bunch of code that is now unused. This patch has been maintained separate strictly for reasons of readability.
--- drivers/net/davinci_emac.c | 930 -------------------------------------------- 1 files changed, 0 insertions(+), 930 deletions(-)
drivers/net/davinci_emac.c +0 -930
@@ -127,7 +127,6 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";/* EMAC register related defines */ #define EMAC_ALL_MULTI_REG_VALUE (0xFFFFFFFF)#define EMAC_NUM_MULTICAST_BITS (64) -#define EMAC_TEARDOWN_VALUE (0xFFFFFFFC)#define EMAC_TX_CONTROL_TX_ENABLE_VAL (0x1)#define EMAC_RX_CONTROL_RX_ENABLE_VAL (0x1)#define EMAC_MAC_HOST_ERR_INTMASK_VAL (0x2)
@@ -214,24 +213,10 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";#define EMAC_DEF_MAX_MULTICAST_ADDRESSES (64)/* Max mcast addr's */ /* EMAC Peripheral Device Register Memory Layout structure */ -#define EMAC_TXIDVER 0x0 -#define EMAC_TXCONTROL 0x4 -#define EMAC_TXTEARDOWN 0x8 -#define EMAC_RXIDVER 0x10 -#define EMAC_RXCONTROL 0x14 -#define EMAC_RXTEARDOWN 0x18 -#define EMAC_TXINTSTATRAW 0x80 -#define EMAC_TXINTSTATMASKED 0x84 -#define EMAC_TXINTMASKSET 0x88 -#define EMAC_TXINTMASKCLEAR 0x8C#define EMAC_MACINVECTOR 0x90#define EMAC_DM646X_MACEOIVECTOR 0x94 -#define EMAC_RXINTSTATRAW 0xA0 -#define EMAC_RXINTSTATMASKED 0xA4 -#define EMAC_RXINTMASKSET 0xA8 -#define EMAC_RXINTMASKCLEAR 0xAC#define EMAC_MACINTSTATRAW 0xB0#define EMAC_MACINTSTATMASKED 0xB4#define EMAC_MACINTMASKSET 0xB8
@@ -258,12 +243,6 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";#define EMAC_MACADDRHI 0x504#define EMAC_MACINDEX 0x508 -/* EMAC HDP and Completion registors */ -#define EMAC_TXHDP (ch) (0x600 + (ch * 4)) -#define EMAC_RXHDP (ch) (0x620 + (ch * 4)) -#define EMAC_TXCP (ch) (0x640 + (ch * 4)) -#define EMAC_RXCP (ch) (0x660 + (ch * 4)) -/* EMAC statistics registers */ #define EMAC_RXGOODFRAMES 0x200#define EMAC_RXBCASTFRAMES 0x204
@@ -328,120 +307,6 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";/* EMAC Stats Clear Mask */ #define EMAC_STATS_CLR_MASK (0xFFFFFFFF) -/** net_buf_obj: EMAC network bufferdata structure -* -* EMAC network buffer data structure -*/ -struct emac_netbufobj { -void *buf_token; -char *data_ptr; -int length; -}; - -/** net_pkt_obj: EMAC network packet data structure -* -* EMAC network packet data structure - supports buffer list (for future) -*/ -struct emac_netpktobj { -void *pkt_token;/* data token may hold tx/rx chan id */ -struct emac_netbufobj *buf_list;/* array of network buffer objects */ -int num_bufs; -int pkt_length; -}; - -/** emac_tx_bd: EMAC TX Buffer descriptor data structure -* -* EMAC TX Buffer descriptor data structure -*/ -struct emac_tx_bd { -int h_next; -int buff_ptr; -int off_b_len; -int mode;/* SOP, EOP, ownership, EOQ, teardown,Qstarv, length */ -struct emac_tx_bd __iomem *next; -void *buf_token; -}; - -/** emac_txch: EMAC TX Channel data structure -* -* EMAC TX Channel data structure -*/ -struct emac_txch { -/* Config related */ -u32 num_bd; -u32 service_max; - -/* CPPI specific */ -u32 alloc_size; -void __iomem *bd_mem; -struct emac_tx_bd __iomem *bd_pool_head; -struct emac_tx_bd __iomem *active_queue_head; -struct emac_tx_bd __iomem *active_queue_tail; -struct emac_tx_bd __iomem *last_hw_bdprocessed; -u32 queue_active; -u32 teardown_pending; -u32 *tx_complete; - -/** statistics */ -u32 proc_count;/* TX: # of times emac_tx_bdproc is called */ -u32 mis_queued_packets; -u32 queue_reinit; -u32 end_of_queue_add; -u32 out_of_tx_bd; -u32 no_active_pkts;/* IRQ when there were no packets to process */ -u32 active_queue_count; -}; - -/** emac_rx_bd: EMAC RX Buffer descriptor data structure -* -* EMAC RX Buffer descriptor data structure -*/ -struct emac_rx_bd { -int h_next; -int buff_ptr; -int off_b_len; -int mode; -struct emac_rx_bd __iomem *next; -void *data_ptr; -void *buf_token; -}; - -/** emac_rxch: EMAC RX Channel data structure -* -* EMAC RX Channel data structure -*/ -struct emac_rxch { -/* configuration info */ -u32 num_bd; -u32 service_max; -u32 buf_size; -char mac_addr[6 ]; - -/** CPPI specific */ -u32 alloc_size; -void __iomem *bd_mem; -struct emac_rx_bd __iomem *bd_pool_head; -struct emac_rx_bd __iomem *active_queue_head; -struct emac_rx_bd __iomem *active_queue_tail; -u32 queue_active; -u32 teardown_pending; - -/* packet and buffer objects */ -struct emac_netpktobj pkt_queue; -struct emac_netbufobj buf_queue; - -/** statistics */ -u32 proc_count;/* number of times emac_rx_bdproc is called */ -u32 processed_bd; -u32 recycled_bd; -u32 out_of_rx_bd; -u32 out_of_rx_buffers; -u32 queue_reinit; -u32 end_of_queue_add; -u32 end_of_queue; -u32 mis_queued_packets; -}; -/* emac_priv: EMAC private data structure * * EMAC adapter private data structure
@@ -452,17 +317,10 @@ struct emac_priv {struct platform_device *pdev;struct napi_struct napi;char mac_addr[6 ]; -spinlock_t tx_lock; -spinlock_t rx_lock;void __iomem *remap_addr;u32 emac_base_phys;void __iomem *emac_base;void __iomem *ctrl_base; -void __iomem *emac_ctrl_ram; -u32 ctrl_ram_size; -u32 hw_ram_addr; -struct emac_txch *txch[EMAC_DEF_MAX_TX_CH ]; -struct emac_rxch *rxch[EMAC_DEF_MAX_RX_CH ];struct cpdma_ctlr *dma;struct cpdma_chan *txchan;struct cpdma_chan *rxchan;
@@ -491,18 +349,6 @@ struct emac_priv {static struct clk *emac_clk;static unsigned long emac_bus_frequency; -#define emac_virt_to_phys (addr, priv) \ - (((u32 __force)(addr) - (u32 __force)(priv->emac_ctrl_ram)) \ - + priv->hw_ram_addr) - -/* Cache macros - Packet buffers would be from skb pool which is cached */ -#define EMAC_VIRT_NOCACHE (addr) (addr) - -/* DM644x does not have BD's in cached memory - so no cache functions */ -#define BD_CACHE_INVALIDATE (addr, size) -#define BD_CACHE_WRITEBACK (addr, size) -#define BD_CACHE_WRITEBACK_INVALIDATE (addr, size) -/* EMAC TX Host Error description strings */ static char *emac_txhost_errcodes[16 ] = {"No error" ,"SOP error" ,"Ownership bit not set in SOP buffer" ,
@@ -545,20 +391,6 @@ static void emac_dump_regs(struct emac_priv *priv)emac_ctrl_read (EMAC_CTRL_EWCTL ), emac_ctrl_read(EMAC_CTRL_EWINTTCNT)); } -dev_info (emac_dev,"EMAC: TXID: %08X %s, RXID: %08X %s\n" , -emac_read (EMAC_TXIDVER ), - ((emac_read (EMAC_TXCONTROL )) ?"enabled" :"disabled" ), -emac_read (EMAC_RXIDVER ), - ((emac_read (EMAC_RXCONTROL )) ?"enabled" :"disabled" )); -dev_info (emac_dev,"EMAC: TXIntRaw:%08X, TxIntMasked: %08X, " \ -"TxIntMasSet: %08X\n" ,emac_read (EMAC_TXINTSTATRAW ), -emac_read (EMAC_TXINTSTATMASKED ),emac_read (EMAC_TXINTMASKSET )); -dev_info (emac_dev,"EMAC: RXIntRaw:%08X, RxIntMasked: %08X, " \ -"RxIntMasSet: %08X\n" ,emac_read (EMAC_RXINTSTATRAW ), -emac_read (EMAC_RXINTSTATMASKED ),emac_read (EMAC_RXINTMASKSET )); -dev_info (emac_dev,"EMAC: MacIntRaw:%08X, MacIntMasked: %08X, " \ -"MacInVector=%08X\n" ,emac_read (EMAC_MACINTSTATRAW ), -emac_read (EMAC_MACINTSTATMASKED ),emac_read (EMAC_MACINVECTOR ));dev_info (emac_dev,"EMAC: EmuControl:%08X, FifoControl: %08X\n" ,emac_read (EMAC_EMCONTROL ),emac_read (EMAC_FIFOCONTROL )); dev_info(emac_dev, "EMAC: MBPEnable:%08X, RXUnicastSet: %08X, "\
@@ -567,8 +399,6 @@ static void emac_dump_regs(struct emac_priv *priv)dev_info (emac_dev,"EMAC: MacControl:%08X, MacStatus: %08X, " \"MacConfig=%08X\n" ,emac_read (EMAC_MACCONTROL ),emac_read (EMAC_MACSTATUS ),emac_read (EMAC_MACCONFIG )); -dev_info (emac_dev,"EMAC: TXHDP[0]:%08X, RXHDP[0]: %08X\n" , -emac_read (EMAC_TXHDP (0 )),emac_read (EMAC_RXHDP (0 )));dev_info (emac_dev,"EMAC Statistics\n" );dev_info (emac_dev,"EMAC: rx_good_frames:%d\n" ,emac_read (EMAC_RXGOODFRAMES ));
@@ -1223,373 +1053,6 @@ static void emac_tx_handler(void *token, int len, int status)dev_kfree_skb_any (skb); } -/** EMAC on-chip buffer descriptor memory -* -* WARNING: Please note that the on chip memory is used for both TX and RX -* buffer descriptor queues and is equally divided between TX and RX desc's -* If the number of TX or RX descriptors change this memory pointers need -* to be adjusted. If external memory is allocated then these pointers can -* pointer to the memory -* -*/ -#define EMAC_TX_BD_MEM (priv) ((priv)->emac_ctrl_ram) -#define EMAC_RX_BD_MEM (priv) ((priv)->emac_ctrl_ram + \ - (((priv)->ctrl_ram_size) >> 1)) - -/** -* emac_init_txch: TX channel initialization -* @priv: The DaVinci EMAC private adapter structure -* @ch: RX channel number -* -* Called during device init to setup a TX channel (allocate buffer desc -* create free pool and keep ready for transmission -* -* Returns success(0) or mem alloc failures error code -*/ -static int emac_init_txch (struct emac_priv *priv,u32 ch) -{ -struct device *emac_dev = &priv->ndev->dev; -u32 cnt, bd_size; -void __iomem *mem; -struct emac_tx_bd __iomem *curr_bd; -struct emac_txch *txch =NULL ; - - txch =kzalloc (sizeof (struct emac_txch ),GFP_KERNEL ); -if (NULL == txch) { -dev_err (emac_dev,"DaVinci EMAC: TX Ch mem alloc failed" ); -return -ENOMEM ; - } - priv->txch[ch] = txch; - txch->service_max =EMAC_DEF_TX_MAX_SERVICE ; - txch->active_queue_head =NULL ; - txch->active_queue_tail =NULL ; - txch->queue_active =0 ; - txch->teardown_pending =0 ; - -/* allocate memory for TX CPPI channel on a 4 byte boundry */ - txch->tx_complete =kzalloc (txch->service_max *sizeof (u32), -GFP_KERNEL ); -if (NULL == txch->tx_complete) { -dev_err (emac_dev,"DaVinci EMAC: Tx service mem alloc failed" ); -kfree (txch); -return -ENOMEM ; - } - -/* allocate buffer descriptor pool align every BD on four word -* boundry for future requirements */ - bd_size = (sizeof (struct emac_tx_bd ) +0xF ) & ~0xF ; - txch->num_bd = (priv->ctrl_ram_size >>1 ) / bd_size; - txch->alloc_size = (((bd_size * txch->num_bd) +0xF ) & ~0xF ); - -/* alloc TX BD memory */ - txch->bd_mem =EMAC_TX_BD_MEM (priv); -__memzero ((void __force *)txch->bd_mem, txch->alloc_size); - -/* initialize the BD linked list */ - mem = (void __force __iomem *) - (((u32 __force ) txch->bd_mem +0xF ) & ~0xF ); - txch->bd_pool_head =NULL ; -for (cnt =0 ; cnt < txch->num_bd; cnt++) { - curr_bd = mem + (cnt * bd_size); - curr_bd->next = txch->bd_pool_head; - txch->bd_pool_head = curr_bd; - } - -/* reset statistics counters */ - txch->out_of_tx_bd =0 ; - txch->no_active_pkts =0 ; - txch->active_queue_count =0 ; - -return 0 ; -} - -/** -* emac_cleanup_txch: Book-keep function to clean TX channel resources -* @priv: The DaVinci EMAC private adapter structure -* @ch: TX channel number -* -* Called to clean up TX channel resources -* -*/ -static void emac_cleanup_txch (struct emac_priv *priv,u32 ch) -{ -struct emac_txch *txch = priv->txch[ch]; - -if (txch) { -if (txch->bd_mem) - txch->bd_mem =NULL ; -kfree (txch->tx_complete); -kfree (txch); - priv->txch[ch] =NULL ; - } -} - -/** -* emac_net_tx_complete: TX packet completion function -* @priv: The DaVinci EMAC private adapter structure -* @net_data_tokens: packet token - skb pointer -* @num_tokens: number of skb's to free -* @ch: TX channel number -* -* Frees the skb once packet is transmitted -* -*/ -static int emac_net_tx_complete (struct emac_priv *priv, -void **net_data_tokens, -int num_tokens,u32 ch) -{ -struct net_device *ndev = priv->ndev; -u32 cnt; - -if (unlikely (num_tokens &&netif_queue_stopped (ndev))) -netif_start_queue (ndev); -for (cnt =0 ; cnt < num_tokens; cnt++) { -struct sk_buff *skb = (struct sk_buff *)net_data_tokens[cnt]; -if (skb ==NULL ) -continue ; - ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; -dev_kfree_skb_any (skb); - } -return 0 ; -} - -/** -* emac_txch_teardown: TX channel teardown -* @priv: The DaVinci EMAC private adapter structure -* @ch: TX channel number -* -* Called to teardown TX channel -* -*/ -static void emac_txch_teardown (struct emac_priv *priv,u32 ch) -{ -struct device *emac_dev = &priv->ndev->dev; -u32 teardown_cnt =0xFFFFFFF0 ;/* Some high value */ -struct emac_txch *txch = priv->txch[ch]; -struct emac_tx_bd __iomem *curr_bd; - -while ((emac_read (EMAC_TXCP (ch)) &EMAC_TEARDOWN_VALUE ) != -EMAC_TEARDOWN_VALUE ) { -/* wait till tx teardown complete */ -cpu_relax ();/* TODO: check if this helps ... */ - --teardown_cnt; -if (0 == teardown_cnt) { -dev_err (emac_dev,"EMAC: TX teardown aborted\n" ); -break ; - } - } -emac_write (EMAC_TXCP (ch),EMAC_TEARDOWN_VALUE ); - -/* process sent packets and return skb's to upper layer */ -if (1 == txch->queue_active) { - curr_bd = txch->active_queue_head; -while (curr_bd !=NULL ) { -dma_unmap_single (emac_dev, curr_bd->buff_ptr, - curr_bd->off_b_len &EMAC_RX_BD_BUF_SIZE , -DMA_TO_DEVICE ); - -emac_net_tx_complete (priv, (void __force *) - &curr_bd->buf_token,1 , ch); -if (curr_bd != txch->active_queue_tail) - curr_bd = curr_bd->next; -else -break ; - } - txch->bd_pool_head = txch->active_queue_head; - txch->active_queue_head = - txch->active_queue_tail =NULL ; - } -} - -/** -* emac_stop_txch: Stop TX channel operation -* @priv: The DaVinci EMAC private adapter structure -* @ch: TX channel number -* -* Called to stop TX channel operation -* -*/ -static void emac_stop_txch (struct emac_priv *priv,u32 ch) -{ -struct emac_txch *txch = priv->txch[ch]; - -if (txch) { - txch->teardown_pending =1 ; -emac_write (EMAC_TXTEARDOWN ,0 ); -emac_txch_teardown (priv, ch); - txch->teardown_pending =0 ; -emac_write (EMAC_TXINTMASKCLEAR ,BIT (ch)); - } -} - -/** -* emac_tx_bdproc: TX buffer descriptor (packet) processing -* @priv: The DaVinci EMAC private adapter structure -* @ch: TX channel number to process buffer descriptors for -* @budget: number of packets allowed to process -* @pending: indication to caller that packets are pending to process -* -* Processes TX buffer descriptors after packets are transmitted - checks -* ownership bit on the TX * descriptor and requeues it to free pool & frees -* the SKB buffer. Only "budget" number of packets are processed and -* indication of pending packets provided to the caller -* -* Returns number of packets processed -*/ -static int emac_tx_bdproc (struct emac_priv *priv,u32 ch,u32 budget) -{ -struct device *emac_dev = &priv->ndev->dev; -unsigned long flags; -u32 frame_status; -u32 pkts_processed =0 ; -u32 tx_complete_cnt =0 ; -struct emac_tx_bd __iomem *curr_bd; -struct emac_txch *txch = priv->txch[ch]; -u32 *tx_complete_ptr = txch->tx_complete; - -if (unlikely (1 == txch->teardown_pending)) { -if (netif_msg_tx_err (priv) &&net_ratelimit ()) { -dev_err (emac_dev,"DaVinci EMAC:emac_tx_bdproc: " \ -"teardown pending\n" ); - } -return 0 ;/* dont handle any pkt completions */ - } - - ++txch->proc_count; -spin_lock_irqsave (&priv->tx_lock, flags); - curr_bd = txch->active_queue_head; -if (NULL == curr_bd) { -emac_write (EMAC_TXCP (ch), -emac_virt_to_phys (txch->last_hw_bdprocessed, priv)); - txch->no_active_pkts++; -spin_unlock_irqrestore (&priv->tx_lock, flags); -return 0 ; - } -BD_CACHE_INVALIDATE (curr_bd,EMAC_BD_LENGTH_FOR_CACHE ); - frame_status = curr_bd->mode; -while ((curr_bd) && - ((frame_status &EMAC_CPPI_OWNERSHIP_BIT ) ==0 ) && - (pkts_processed < budget)) { -emac_write (EMAC_TXCP (ch),emac_virt_to_phys (curr_bd, priv)); - txch->active_queue_head = curr_bd->next; -if (frame_status &EMAC_CPPI_EOQ_BIT ) { -if (curr_bd->next) {/* misqueued packet */ -emac_write (EMAC_TXHDP (ch), curr_bd->h_next); - ++txch->mis_queued_packets; - }else { - txch->queue_active =0 ;/* end of queue */ - } - } - -dma_unmap_single (emac_dev, curr_bd->buff_ptr, - curr_bd->off_b_len &EMAC_RX_BD_BUF_SIZE , -DMA_TO_DEVICE ); - - *tx_complete_ptr = (u32 ) curr_bd->buf_token; - ++tx_complete_ptr; - ++tx_complete_cnt; - curr_bd->next = txch->bd_pool_head; - txch->bd_pool_head = curr_bd; - --txch->active_queue_count; - pkts_processed++; - txch->last_hw_bdprocessed = curr_bd; - curr_bd = txch->active_queue_head; -if (curr_bd) { -BD_CACHE_INVALIDATE (curr_bd,EMAC_BD_LENGTH_FOR_CACHE ); - frame_status = curr_bd->mode; - } - }/* end of pkt processing loop */ - -emac_net_tx_complete (priv, - (void *)&txch->tx_complete[0 ], - tx_complete_cnt, ch); -spin_unlock_irqrestore (&priv->tx_lock, flags); -return pkts_processed; -} - -#define EMAC_ERR_TX_OUT_OF_BD -1 - -/** -* emac_send: EMAC Transmit function (internal) -* @priv: The DaVinci EMAC private adapter structure -* @pkt: packet pointer (contains skb ptr) -* @ch: TX channel number -* -* Called by the transmit function to queue the packet in EMAC hardware queue -* -* Returns success(0) or error code (typically out of desc's) -*/ -static int emac_send (struct emac_priv *priv,struct emac_netpktobj *pkt,u32 ch) -{ -unsigned long flags; -struct emac_tx_bd __iomem *curr_bd; -struct emac_txch *txch; -struct emac_netbufobj *buf_list; - - txch = priv->txch[ch]; - buf_list = pkt->buf_list;/* get handle to the buffer array */ - -/* check packet size and pad if short */ -if (pkt->pkt_length <EMAC_DEF_MIN_ETHPKTSIZE ) { - buf_list->length += (EMAC_DEF_MIN_ETHPKTSIZE - pkt->pkt_length); - pkt->pkt_length =EMAC_DEF_MIN_ETHPKTSIZE ; - } - -spin_lock_irqsave (&priv->tx_lock, flags); - curr_bd = txch->bd_pool_head; -if (curr_bd ==NULL ) { - txch->out_of_tx_bd++; -spin_unlock_irqrestore (&priv->tx_lock, flags); -return EMAC_ERR_TX_OUT_OF_BD ; - } - - txch->bd_pool_head = curr_bd->next; - curr_bd->buf_token = buf_list->buf_token; - curr_bd->buff_ptr =dma_map_single (&priv->ndev->dev, buf_list->data_ptr, - buf_list->length,DMA_TO_DEVICE ); - curr_bd->off_b_len = buf_list->length; - curr_bd->h_next =0 ; - curr_bd->next =NULL ; - curr_bd->mode = (EMAC_CPPI_SOP_BIT |EMAC_CPPI_OWNERSHIP_BIT | -EMAC_CPPI_EOP_BIT | pkt->pkt_length); - -/* flush the packet from cache if write back cache is present */ -BD_CACHE_WRITEBACK_INVALIDATE (curr_bd,EMAC_BD_LENGTH_FOR_CACHE ); - -/* send the packet */ -if (txch->active_queue_head ==NULL ) { - txch->active_queue_head = curr_bd; - txch->active_queue_tail = curr_bd; -if (1 != txch->queue_active) { -emac_write (EMAC_TXHDP (ch), -emac_virt_to_phys (curr_bd, priv)); - txch->queue_active =1 ; - } - ++txch->queue_reinit; - }else { - registerstruct emac_tx_bd __iomem *tail_bd; - registeru32 frame_status; - - tail_bd = txch->active_queue_tail; - tail_bd->next = curr_bd; - txch->active_queue_tail = curr_bd; - tail_bd =EMAC_VIRT_NOCACHE (tail_bd); - tail_bd->h_next = (int )emac_virt_to_phys (curr_bd, priv); - frame_status = tail_bd->mode; -if (frame_status &EMAC_CPPI_EOQ_BIT ) { -emac_write (EMAC_TXHDP (ch), -emac_virt_to_phys (curr_bd, priv)); - frame_status &= ~(EMAC_CPPI_EOQ_BIT ); - tail_bd->mode = frame_status; - ++txch->end_of_queue_add; - } - } - txch->active_queue_count++; -spin_unlock_irqrestore (&priv->tx_lock, flags); -return 0 ; -} -/** * emac_dev_xmit: EMAC Transmit function * @skb: SKB pointer
@@ -1664,207 +1127,6 @@ static void emac_dev_tx_timeout(struct net_device *ndev) }/** -* emac_net_alloc_rx_buf: Allocate a skb for RX -* @priv: The DaVinci EMAC private adapter structure -* @buf_size: size of SKB data buffer to allocate -* @data_token: data token returned (skb handle for storing in buffer desc) -* @ch: RX channel number -* -* Called during RX channel setup - allocates skb buffer of required size -* and provides the skb handle and allocated buffer data pointer to caller -* -* Returns skb data pointer or 0 on failure to alloc skb -*/ -static void *emac_net_alloc_rx_buf (struct emac_priv *priv,int buf_size, -void **data_token,u32 ch) -{ -struct net_device *ndev = priv->ndev; -struct device *emac_dev = &ndev->dev; -struct sk_buff *p_skb; - - p_skb =dev_alloc_skb (buf_size); -if (unlikely (NULL == p_skb)) { -if (netif_msg_rx_err (priv) &&net_ratelimit ()) -dev_err (emac_dev,"DaVinci EMAC: failed to alloc skb" ); -return NULL ; - } - -/* set device pointer in skb and reserve space for extra bytes */ - p_skb->dev = ndev; -skb_reserve (p_skb,NET_IP_ALIGN ); - *data_token = (void *) p_skb; -return p_skb->data; -} - -/** -* emac_init_rxch: RX channel initialization -* @priv: The DaVinci EMAC private adapter structure -* @ch: RX channel number -* @param: mac address for RX channel -* -* Called during device init to setup a RX channel (allocate buffers and -* buffer descriptors, create queue and keep ready for reception -* -* Returns success(0) or mem alloc failures error code -*/ -static int emac_init_rxch (struct emac_priv *priv,u32 ch,char *param) -{ -struct device *emac_dev = &priv->ndev->dev; -u32 cnt, bd_size; -void __iomem *mem; -struct emac_rx_bd __iomem *curr_bd; -struct emac_rxch *rxch =NULL ; - - rxch =kzalloc (sizeof (struct emac_rxch ),GFP_KERNEL ); -if (NULL == rxch) { -dev_err (emac_dev,"DaVinci EMAC: RX Ch mem alloc failed" ); -return -ENOMEM ; - } - priv->rxch[ch] = rxch; - rxch->buf_size = priv->rx_buf_size; - rxch->service_max =EMAC_DEF_RX_MAX_SERVICE ; - rxch->queue_active =0 ; - rxch->teardown_pending =0 ; - -/* save mac address */ -for (cnt =0 ; cnt <6 ; cnt++) - rxch->mac_addr[cnt] = param[cnt]; - -/* allocate buffer descriptor pool align every BD on four word -* boundry for future requirements */ - bd_size = (sizeof (struct emac_rx_bd ) +0xF ) & ~0xF ; - rxch->num_bd = (priv->ctrl_ram_size >>1 ) / bd_size; - rxch->alloc_size = (((bd_size * rxch->num_bd) +0xF ) & ~0xF ); - rxch->bd_mem =EMAC_RX_BD_MEM (priv); -__memzero ((void __force *)rxch->bd_mem, rxch->alloc_size); - rxch->pkt_queue.buf_list = &rxch->buf_queue; - -/* allocate RX buffer and initialize the BD linked list */ - mem = (void __force __iomem *) - (((u32 __force ) rxch->bd_mem +0xF ) & ~0xF ); - rxch->active_queue_head =NULL ; - rxch->active_queue_tail = mem; -for (cnt =0 ; cnt < rxch->num_bd; cnt++) { - curr_bd = mem + (cnt * bd_size); -/* for future use the last parameter contains the BD ptr */ - curr_bd->data_ptr =emac_net_alloc_rx_buf (priv, - rxch->buf_size, - (void __force **)&curr_bd->buf_token, -EMAC_DEF_RX_CH ); -if (curr_bd->data_ptr ==NULL ) { -dev_err (emac_dev,"DaVinci EMAC: RX buf mem alloc " \ -"failed for ch %d\n" , ch); -kfree (rxch); -return -ENOMEM ; - } - -/* populate the hardware descriptor */ - curr_bd->h_next =emac_virt_to_phys (rxch->active_queue_head, - priv); - curr_bd->buff_ptr =dma_map_single (emac_dev, curr_bd->data_ptr, - rxch->buf_size,DMA_FROM_DEVICE ); - curr_bd->off_b_len = rxch->buf_size; - curr_bd->mode =EMAC_CPPI_OWNERSHIP_BIT ; - -/* write back to hardware memory */ -BD_CACHE_WRITEBACK_INVALIDATE ((u32 ) curr_bd, -EMAC_BD_LENGTH_FOR_CACHE ); - curr_bd->next = rxch->active_queue_head; - rxch->active_queue_head = curr_bd; - } - -/* At this point rxCppi->activeQueueHead points to the first -RX BD ready to be given to RX HDP and rxch->active_queue_tail -points to the last RX BD -*/ -return 0 ; -} - -/** -* emac_rxch_teardown: RX channel teardown -* @priv: The DaVinci EMAC private adapter structure -* @ch: RX channel number -* -* Called during device stop to teardown RX channel -* -*/ -static void emac_rxch_teardown (struct emac_priv *priv,u32 ch) -{ -struct device *emac_dev = &priv->ndev->dev; -u32 teardown_cnt =0xFFFFFFF0 ;/* Some high value */ - -while ((emac_read (EMAC_RXCP (ch)) &EMAC_TEARDOWN_VALUE ) != -EMAC_TEARDOWN_VALUE ) { -/* wait till tx teardown complete */ -cpu_relax ();/* TODO: check if this helps ... */ - --teardown_cnt; -if (0 == teardown_cnt) { -dev_err (emac_dev,"EMAC: RX teardown aborted\n" ); -break ; - } - } -emac_write (EMAC_RXCP (ch),EMAC_TEARDOWN_VALUE ); -} - -/** -* emac_stop_rxch: Stop RX channel operation -* @priv: The DaVinci EMAC private adapter structure -* @ch: RX channel number -* -* Called during device stop to stop RX channel operation -* -*/ -static void emac_stop_rxch (struct emac_priv *priv,u32 ch) -{ -struct emac_rxch *rxch = priv->rxch[ch]; - -if (rxch) { - rxch->teardown_pending =1 ; -emac_write (EMAC_RXTEARDOWN , ch); -/* wait for teardown complete */ -emac_rxch_teardown (priv, ch); - rxch->teardown_pending =0 ; -emac_write (EMAC_RXINTMASKCLEAR ,BIT (ch)); - } -} - -/** -* emac_cleanup_rxch: Book-keep function to clean RX channel resources -* @priv: The DaVinci EMAC private adapter structure -* @ch: RX channel number -* -* Called during device stop to clean up RX channel resources -* -*/ -static void emac_cleanup_rxch (struct emac_priv *priv,u32 ch) -{ -struct emac_rxch *rxch = priv->rxch[ch]; -struct emac_rx_bd __iomem *curr_bd; - -if (rxch) { -/* free the receive buffers previously allocated */ - curr_bd = rxch->active_queue_head; -while (curr_bd) { -if (curr_bd->buf_token) { -dma_unmap_single (&priv->ndev->dev, - curr_bd->buff_ptr, - curr_bd->off_b_len - &EMAC_RX_BD_BUF_SIZE , -DMA_FROM_DEVICE ); - -dev_kfree_skb_any ((struct sk_buff *)\ - curr_bd->buf_token); - } - curr_bd = curr_bd->next; - } -if (rxch->bd_mem) - rxch->bd_mem =NULL ; -kfree (rxch); - priv->rxch[ch] =NULL ; - } -} - -/** * emac_set_type0addr: Set EMAC Type0 mac address * @priv: The DaVinci EMAC private adapter structure * @ch: RX channel number
@@ -2004,194 +1266,6 @@ static int emac_dev_setmac_addr(struct net_device *ndev, void *addr) }/** -* emac_addbd_to_rx_queue: Recycle RX buffer descriptor -* @priv: The DaVinci EMAC private adapter structure -* @ch: RX channel number to process buffer descriptors for -* @curr_bd: current buffer descriptor -* @buffer: buffer pointer for descriptor -* @buf_token: buffer token (stores skb information) -* -* Prepares the recycled buffer descriptor and addes it to hardware -* receive queue - if queue empty this descriptor becomes the head -* else addes the descriptor to end of queue -* -*/ -static void emac_addbd_to_rx_queue (struct emac_priv *priv,u32 ch, -struct emac_rx_bd __iomem *curr_bd, -char *buffer,void *buf_token) -{ -struct emac_rxch *rxch = priv->rxch[ch]; - -/* populate the hardware descriptor */ - curr_bd->h_next =0 ; - curr_bd->buff_ptr =dma_map_single (&priv->ndev->dev, buffer, - rxch->buf_size,DMA_FROM_DEVICE ); - curr_bd->off_b_len = rxch->buf_size; - curr_bd->mode =EMAC_CPPI_OWNERSHIP_BIT ; - curr_bd->next =NULL ; - curr_bd->data_ptr = buffer; - curr_bd->buf_token = buf_token; - -/* write back */ -BD_CACHE_WRITEBACK_INVALIDATE (curr_bd,EMAC_BD_LENGTH_FOR_CACHE ); -if (rxch->active_queue_head ==NULL ) { - rxch->active_queue_head = curr_bd; - rxch->active_queue_tail = curr_bd; -if (0 != rxch->queue_active) { -emac_write (EMAC_RXHDP (ch), -emac_virt_to_phys (rxch->active_queue_head, priv)); - rxch->queue_active =1 ; - } - }else { -struct emac_rx_bd __iomem *tail_bd; -u32 frame_status; - - tail_bd = rxch->active_queue_tail; - rxch->active_queue_tail = curr_bd; - tail_bd->next = curr_bd; - tail_bd =EMAC_VIRT_NOCACHE (tail_bd); - tail_bd->h_next =emac_virt_to_phys (curr_bd, priv); - frame_status = tail_bd->mode; -if (frame_status &EMAC_CPPI_EOQ_BIT ) { -emac_write (EMAC_RXHDP (ch), -emac_virt_to_phys (curr_bd, priv)); - frame_status &= ~(EMAC_CPPI_EOQ_BIT ); - tail_bd->mode = frame_status; - ++rxch->end_of_queue_add; - } - } - ++rxch->recycled_bd; -} - -/** -* emac_net_rx_cb: Prepares packet and sends to upper layer -* @priv: The DaVinci EMAC private adapter structure -* @net_pkt_list: Network packet list (received packets) -* -* Invalidates packet buffer memory and sends the received packet to upper -* layer -* -* Returns success or appropriate error code (none as of now) -*/ -static int emac_net_rx_cb (struct emac_priv *priv, -struct emac_netpktobj *net_pkt_list) -{ -struct net_device *ndev = priv->ndev; -struct sk_buff *p_skb = net_pkt_list->pkt_token; -/* set length of packet */ -skb_put (p_skb, net_pkt_list->pkt_length); - p_skb->protocol =eth_type_trans (p_skb, priv->ndev); -netif_receive_skb (p_skb); - ndev->stats.rx_bytes += net_pkt_list->pkt_length; - ndev->stats.rx_packets++; -return 0 ; -} - -/** -* emac_rx_bdproc: RX buffer descriptor (packet) processing -* @priv: The DaVinci EMAC private adapter structure -* @ch: RX channel number to process buffer descriptors for -* @budget: number of packets allowed to process -* @pending: indication to caller that packets are pending to process -* -* Processes RX buffer descriptors - checks ownership bit on the RX buffer -* descriptor, sends the receive packet to upper layer, allocates a new SKB -* and recycles the buffer descriptor (requeues it in hardware RX queue). -* Only "budget" number of packets are processed and indication of pending -* packets provided to the caller. -* -* Returns number of packets processed (and indication of pending packets) -*/ -static int emac_rx_bdproc (struct emac_priv *priv,u32 ch,u32 budget) -{ -unsigned long flags; -u32 frame_status; -u32 pkts_processed =0 ; -char *new_buffer; -struct emac_rx_bd __iomem *curr_bd; -struct emac_rx_bd __iomem *last_bd; -struct emac_netpktobj *curr_pkt, pkt_obj; -struct emac_netbufobj buf_obj; -struct emac_netbufobj *rx_buf_obj; -void *new_buf_token; -struct emac_rxch *rxch = priv->rxch[ch]; - -if (unlikely (1 == rxch->teardown_pending)) -return 0 ; - ++rxch->proc_count; -spin_lock_irqsave (&priv->rx_lock, flags); - pkt_obj.buf_list = &buf_obj; - curr_pkt = &pkt_obj; - curr_bd = rxch->active_queue_head; -BD_CACHE_INVALIDATE (curr_bd,EMAC_BD_LENGTH_FOR_CACHE ); - frame_status = curr_bd->mode; - -while ((curr_bd) && - ((frame_status &EMAC_CPPI_OWNERSHIP_BIT ) ==0 ) && - (pkts_processed < budget)) { - - new_buffer =emac_net_alloc_rx_buf (priv, rxch->buf_size, - &new_buf_token,EMAC_DEF_RX_CH ); -if (unlikely (NULL == new_buffer)) { - ++rxch->out_of_rx_buffers; - goto end_emac_rx_bdproc; - } - -/* populate received packet data structure */ - rx_buf_obj = &curr_pkt->buf_list[0 ]; - rx_buf_obj->data_ptr = (char *)curr_bd->data_ptr; - rx_buf_obj->length = curr_bd->off_b_len &EMAC_RX_BD_BUF_SIZE ; - rx_buf_obj->buf_token = curr_bd->buf_token; - -dma_unmap_single (&priv->ndev->dev, curr_bd->buff_ptr, - curr_bd->off_b_len &EMAC_RX_BD_BUF_SIZE , -DMA_FROM_DEVICE ); - - curr_pkt->pkt_token = curr_pkt->buf_list->buf_token; - curr_pkt->num_bufs =1 ; - curr_pkt->pkt_length = - (frame_status &EMAC_RX_BD_PKT_LENGTH_MASK ); -emac_write (EMAC_RXCP (ch),emac_virt_to_phys (curr_bd, priv)); - ++rxch->processed_bd; - last_bd = curr_bd; - curr_bd = last_bd->next; - rxch->active_queue_head = curr_bd; - -/* check if end of RX queue ? */ -if (frame_status &EMAC_CPPI_EOQ_BIT ) { -if (curr_bd) { - ++rxch->mis_queued_packets; -emac_write (EMAC_RXHDP (ch), -emac_virt_to_phys (curr_bd, priv)); - }else { - ++rxch->end_of_queue; - rxch->queue_active =0 ; - } - } - -/* recycle BD */ -emac_addbd_to_rx_queue (priv, ch, last_bd, new_buffer, - new_buf_token); - -/* return the packet to the user - BD ptr passed in -* last parameter for potential *future* use */ -spin_unlock_irqrestore (&priv->rx_lock, flags); -emac_net_rx_cb (priv, curr_pkt); -spin_lock_irqsave (&priv->rx_lock, flags); - curr_bd = rxch->active_queue_head; -if (curr_bd) { -BD_CACHE_INVALIDATE (curr_bd,EMAC_BD_LENGTH_FOR_CACHE ); - frame_status = curr_bd->mode; - } - ++pkts_processed; - } - -end_emac_rx_bdproc: -spin_unlock_irqrestore (&priv->rx_lock, flags); -return pkts_processed; -} - -/** * emac_hw_enable: Enable EMAC hardware for packet transmission/reception * @priv: The DaVinci EMAC private adapter structure *
@@ -2717,8 +1791,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) priv->ndev = ndev; priv->msg_enable =netif_msg_init (debug_level,DAVINCI_EMAC_DEBUG ); -spin_lock_init (&priv->tx_lock); -spin_lock_init (&priv->rx_lock);spin_lock_init (&priv->lock); pdata = pdev->dev.platform_data;
@@ -2766,8 +1838,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ndev->base_addr = (unsigned long )priv->remap_addr; priv->ctrl_base = priv->remap_addr + pdata->ctrl_mod_reg_offset; - priv->ctrl_ram_size = pdata->ctrl_ram_size; - priv->emac_ctrl_ram = priv->remap_addr + pdata->ctrl_ram_offset; hw_ram_addr = pdata->hw_ram_addr;if (!hw_ram_addr)
Signature · 1 line
1.7.2.1
PATCH 41/47 input: add driver for tnetv107x on-chip keypad controller
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch adds support for tnetv107x's on-chip keypad controller.
--- drivers/input/keyboard/Kconfig | 9 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/tnetv107x-keypad.c | 340 +++++++++++++++++++++++++++++ 3 files changed, 350 insertions(+), 0 deletions(-) create mode 100644 drivers/input/keyboard/tnetv107x-keypad.c
drivers/input/keyboard/Kconfig +9 -0
@@ -424,6 +424,15 @@ config KEYBOARD_OMAP To compile this driver as a module, choose M here: the module will be called omap-keypad. +config KEYBOARD_TNETV107X + tristate "TI TNETV107X keypad support" + depends on ARCH_DAVINCI_TNETV107X + help + Say Y here if you want to use the TNETV107X keypad. + + To compile this driver as a module, choose M here: the + module will be called tnetv107x-keypad. + config KEYBOARD_TWL4030 tristate "TI TWL4030/TWL5030/TPS659x0 keypad support" depends on TWL4030_CORE
drivers/input/keyboard/Makefile +1 -0
@@ -38,6 +38,7 @@ obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o obj-$(CONFIG_KEYBOARD_STMPE) += stmpe-keypad.o obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o +obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o obj-$(CONFIG_KEYBOARD_W90P910) += w90p910_keypad.o
drivers/input/keyboard/tnetv107x-keypad.c new file +340 -0
340 lines not on this page · raw message
Signature · 1 line
1.7.2.1
PATCH 42/47 davinci: add tnetv107x keypad platform device
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch adds a platform device definition for tnetv107x's keypad controller.
--- arch/arm/mach-davinci/devices-tnetv107x.c | 30 ++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/tnetv107x.h | 3 ++ 2 files changed, 33 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/devices-tnetv107x.c +30 -0
@@ -33,6 +33,7 @@#define TNETV107X_WDOG_BASE 0x08086700#define TNETV107X_SDIO0_BASE 0x08088700#define TNETV107X_SDIO1_BASE 0x08088800 +#define TNETV107X_KEYPAD_BASE 0x08088a00#define TNETV107X_ASYNC_EMIF_CNTRL_BASE 0x08200000#define TNETV107X_ASYNC_EMIF_DATA_CE0_BASE 0x30000000#define TNETV107X_ASYNC_EMIF_DATA_CE1_BASE 0x40000000
@@ -298,6 +299,30 @@ static int __init nand_init(int chipsel, struct davinci_nand_pdata *data)return platform_device_register (pdev); } +static struct resource keypad_resources[] = { + { + .start =TNETV107X_KEYPAD_BASE , + .end =TNETV107X_KEYPAD_BASE +0xff , + .flags =IORESOURCE_MEM , + }, + { + .start =IRQ_TNETV107X_KEYPAD , + .flags =IORESOURCE_IRQ , + .name ="press" , + }, + { + .start =IRQ_TNETV107X_KEYPAD_FREE , + .flags =IORESOURCE_IRQ , + .name ="release" , + }, +}; + +static struct platform_device keypad_device = { + .name ="tnetv107x-keypad" , + .num_resources =ARRAY_SIZE (keypad_resources), + .resource = keypad_resources, +}; +void __init tnetv107x_devices_init (struct tnetv107x_device_info *info) {int i;
@@ -317,4 +342,9 @@ void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)for (i =0 ; i <4 ; i++)if (info->nand_config[i])nand_init (i, info->nand_config[i]); + +if (info->keypad_config) { + keypad_device.dev.platform_data = info->keypad_config; +platform_device_register (&keypad_device); + } }
arch/arm/mach-davinci/include/mach/tnetv107x.h +3 -0
@@ -33,6 +33,8 @@#ifndef __ASSEMBLY__#include <linux/serial_8250.h> +#include <linux/input/matrix_keypad.h> +#include <mach/mmc.h> #include <mach/nand.h> #include <mach/serial.h>
@@ -41,6 +43,7 @@ struct tnetv107x_device_info {struct davinci_uart_config *serial_config;struct davinci_mmc_config *mmc_config[2 ];/* 2 controllers */ struct davinci_nand_pdata *nand_config[4 ];/* 4 chipsels */ +struct matrix_keypad_platform_data *keypad_config; };extern struct platform_device tnetv107x_wdt_device;
Signature · 1 line
1.7.2.1
PATCH 43/47 davinci: add keypad config for tnetv107x evm board
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch adds evm board specific keymap definitions and controller configuration data for on-chip keypad controller on tnetv107x silicon.
--- arch/arm/mach-davinci/board-tnetv107x-evm.c | 56 +++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-tnetv107x-evm.c +56 -0
@@ -23,6 +23,9 @@#include <linux/ratelimit.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> +#include <linux/input.h> +#include <linux/input/matrix_keypad.h> +#include <asm/mach/arch.h> #include <asm/mach-types.h>
@@ -141,10 +144,63 @@ static struct davinci_uart_config serial_config __initconst = { .enabled_uarts = BIT(1), }; +static const uint32_t keymap[] = { +KEY (0 ,0 ,KEY_NUMERIC_1 ), +KEY (0 ,1 ,KEY_NUMERIC_2 ), +KEY (0 ,2 ,KEY_NUMERIC_3 ), +KEY (0 ,3 ,KEY_FN_F1 ), +KEY (0 ,4 ,KEY_MENU ), + +KEY (1 ,0 ,KEY_NUMERIC_4 ), +KEY (1 ,1 ,KEY_NUMERIC_5 ), +KEY (1 ,2 ,KEY_NUMERIC_6 ), +KEY (1 ,3 ,KEY_UP ), +KEY (1 ,4 ,KEY_FN_F2 ), + +KEY (2 ,0 ,KEY_NUMERIC_7 ), +KEY (2 ,1 ,KEY_NUMERIC_8 ), +KEY (2 ,2 ,KEY_NUMERIC_9 ), +KEY (2 ,3 ,KEY_LEFT ), +KEY (2 ,4 ,KEY_ENTER ), + +KEY (3 ,0 ,KEY_NUMERIC_STAR ), +KEY (3 ,1 ,KEY_NUMERIC_0 ), +KEY (3 ,2 ,KEY_NUMERIC_POUND ), +KEY (3 ,3 ,KEY_DOWN ), +KEY (3 ,4 ,KEY_RIGHT ), + +KEY (4 ,0 ,KEY_FN_F3 ), +KEY (4 ,1 ,KEY_FN_F4 ), +KEY (4 ,2 ,KEY_MUTE ), +KEY (4 ,3 ,KEY_HOME ), +KEY (4 ,4 ,KEY_BACK ), + +KEY (5 ,0 ,KEY_VOLUMEDOWN ), +KEY (5 ,1 ,KEY_VOLUMEUP ), +KEY (5 ,2 ,KEY_F1 ), +KEY (5 ,3 ,KEY_F2 ), +KEY (5 ,4 ,KEY_F3 ), +}; + +static const struct matrix_keymap_data keymap_data = { + .keymap = keymap, + .keymap_size =ARRAY_SIZE (keymap), +}; + +static struct matrix_keypad_platform_data keypad_config = { + .keymap_data = &keymap_data, + .num_row_gpios =6 , + .num_col_gpios =5 , + .debounce_ms =0 ,/* minimum */ + .active_low =0 ,/* pull up realization */ + .no_autorepeat =0 , +}; +static struct tnetv107x_device_info evm_device_info__initconst = { .serial_config = &serial_config, .mmc_config[1 ] = &mmc_config,/* controller 1 */ .nand_config[0 ] = &nand_config,/* chip select 0 */ + .keypad_config = &keypad_config, };static __init void tnetv107x_evm_board_init (void )
Signature · 1 line
1.7.2.1
PATCH 44/47 input: add driver for tnetv107x touchscreen controller
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch adds support for tnetv107x's on-chip touchscreen controller.
--- drivers/input/touchscreen/Kconfig | 9 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/tnetv107x-ts.c | 396 ++++++++++++++++++++++++++++++ 3 files changed, 406 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/tnetv107x-ts.c
drivers/input/touchscreen/Kconfig +9 -0
@@ -328,6 +328,15 @@ config TOUCHSCREEN_MIGOR To compile this driver as a module, choose M here: the module will be called migor_ts. +config TOUCHSCREEN_TNETV107X + tristate "TI TNETV107X touchscreen support" + depends on ARCH_DAVINCI_TNETV107X + help + Say Y here if you want to use the TNETV107X touchscreen. + + To compile this driver as a module, choose M here: the + module will be called tnetv107x-ts. + config TOUCHSCREEN_TOUCHRIGHT tristate "Touchright serial touchscreen" select SERIO
drivers/input/touchscreen/Makefile +1 -0
@@ -37,6 +37,7 @@ obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o obj-$(CONFIG_TOUCHSCREEN_QT602240) += qt602240_ts.o obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o +obj-$(CONFIG_TOUCHSCREEN_TNETV107X) += tnetv107x-ts.o obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
drivers/input/touchscreen/tnetv107x-ts.c new file +396 -0
396 lines not on this page · raw message
Signature · 1 line
1.7.2.1
PATCH 45/47 davinci: add tnetv107x touchscreen platform device
In reply to Kevin HilmanFrom: Cyril Chemparathy <[email protected]>
This patch adds a platform device definition for tnetv107x's touchscreen controller.
--- arch/arm/mach-davinci/devices-tnetv107x.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/devices-tnetv107x.c +20 -0
@@ -31,6 +31,7 @@#define TNETV107X_TPTC0_BASE 0x01c10000#define TNETV107X_TPTC1_BASE 0x01c10400#define TNETV107X_WDOG_BASE 0x08086700 +#define TNETV107X_TSC_BASE 0x08088500#define TNETV107X_SDIO0_BASE 0x08088700#define TNETV107X_SDIO1_BASE 0x08088800#define TNETV107X_KEYPAD_BASE 0x08088a00
@@ -323,12 +324,31 @@ static struct platform_device keypad_device = { .resource = keypad_resources, }; +static struct resource tsc_resources[] = { + { + .start =TNETV107X_TSC_BASE , + .end =TNETV107X_TSC_BASE +0xff , + .flags =IORESOURCE_MEM , + }, + { + .start =IRQ_TNETV107X_TSC , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device tsc_device = { + .name ="tnetv107x-ts" , + .num_resources =ARRAY_SIZE (tsc_resources), + .resource = tsc_resources, +}; +void __init tnetv107x_devices_init (struct tnetv107x_device_info *info) {int i;platform_device_register (&edma_device);platform_device_register (&tnetv107x_wdt_device); +platform_device_register (&tsc_device);if (info->serial_config)davinci_serial_init (info->serial_config);
Signature · 1 line
1.7.2.1
PATCH 46/47 davinci: MityDSP-L138/MityARM-1808 read MAC address from I2C Prom
In reply to Kevin HilmanFrom: Michael Williamson <[email protected]>
For the MityDSP-L138/MityARM-1808 SOMS, read the factory assigned MAC address from the onboard I2C EPROM and assign it to the emac device during platform initialization.
--- arch/arm/mach-davinci/board-mityomapl138.c | 62 ++++++++++++++++++++++++++++ 1 files changed, 62 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-mityomapl138.c +62 -0
@@ -15,6 +15,8 @@#include <linux/mtd/partitions.h> #include <linux/regulator/machine.h> #include <linux/i2c.h> +#include <linux/i2c/at24.h> +#include <linux/etherdevice.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -25,6 +27,65 @@#include <mach/mux.h> #define MITYOMAPL138_PHY_ID "0:03" + +#define FACTORY_CONFIG_MAGIC 0x012C0138 +#define FACTORY_CONFIG_VERSION 0x00010001 + +/* Data Held in On-Board I2C device */ +struct factory_config { +u32 magic; +u32 version; +u8 mac[6 ]; +u32 fpga_type; +u32 spare; +u32 serialnumber; +char partnum[32 ]; +}; + +static struct factory_config factory_config; + +static void read_factory_config (struct memory_accessor *a,void *context) +{ +int ret; +struct davinci_soc_info *soc_info = &davinci_soc_info; + + ret = a->read (a, (char *)&factory_config,0 ,sizeof (factory_config)); +if (ret !=sizeof (struct factory_config )) { +pr_warning ("MityOMAPL138: Read Factory Config Failed: %d\n" , + ret); +return ; + } + +if (factory_config.magic !=FACTORY_CONFIG_MAGIC ) { +pr_warning ("MityOMAPL138: Factory Config Magic Wrong (%X)\n" , + factory_config.magic); +return ; + } + +if (factory_config.version !=FACTORY_CONFIG_VERSION ) { +pr_warning ("MityOMAPL138: Factory Config Version Wrong (%X)\n" , + factory_config.version); +return ; + } + +pr_info ("MityOMAPL138: Found MAC = %pM\n" , factory_config.mac); +pr_info ("MityOMAPL138: Part Number = %s\n" , factory_config.partnum); +if (is_valid_ether_addr (factory_config.mac)) +memcpy (soc_info->emac_pdata->mac_addr, + factory_config.mac,ETH_ALEN ); +else +pr_warning ("MityOMAPL138: Invalid MAC found " +"in factory config block\n" ); +} + +static struct at24_platform_data mityomapl138_fd_chip = { + .byte_len =256 , + .page_size =8 , + .flags =AT24_FLAG_READONLY |AT24_FLAG_IRUGO , + .setup = read_factory_config, + .context =NULL , +}; +static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = { .bus_freq =100 ,/* kHz */ .bus_delay =0 ,/* usec */
@@ -151,6 +212,7 @@ static struct i2c_board_info __initdata mityomap_tps65023_info[] = { }, { I2C_BOARD_INFO("24c02", 0x50), + .platform_data = &mityomapl138_fd_chip, }, };
Signature · 1 line
1.7.2.1
PATCH 47/47 davinci: Initial support for Omapl138-Hawkboard
In reply to Kevin HilmanFrom: Victor Rodriguez <[email protected]>
This patch adds initial support for the Hawkboard-L138 system It is under the machine name "omapl138_hawkboard".
This system is based on the da850 davinci CPU architecture. Information on these system may be found at http://www.hawkboard.org.
Basic support for the UART console is included in this patch. It's tested with latest Angstrom File Systems like ramdisk from http://alturl.com/imb45.
--- arch/arm/configs/da8xx_omapl_defconfig | 1 + arch/arm/mach-davinci/Kconfig | 8 +++ arch/arm/mach-davinci/Makefile | 1 + arch/arm/mach-davinci/board-omapl138-hawk.c | 64 +++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/uncompress.h | 1 + 5 files changed, 75 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-davinci/board-omapl138-hawk.c
arch/arm/configs/da8xx_omapl_defconfig +1 -0
@@ -18,6 +18,7 @@ CONFIG_ARCH_DAVINCI=y CONFIG_ARCH_DAVINCI_DA830=y CONFIG_ARCH_DAVINCI_DA850=y CONFIG_MACH_MITYOMAPL138=y +CONFIG_MACH_OMAPL138_HAWKBOARD=y CONFIG_DAVINCI_RESET_CLOCKS=y CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y
arch/arm/mach-davinci/Kconfig +8 -0
@@ -193,6 +193,14 @@ config MACH_MITYOMAPL138 System on Module. Information on this SoM may be found at http://www.mitydsp.com +config MACH_OMAPL138_HAWKBOARD + bool "TI AM1808 / OMAPL-138 Hawkboard platform" + depends on ARCH_DAVINCI_DA850 + help + Say Y here to select the TI AM1808 / OMAPL-138 Hawkboard platform . + Information of this board may be found at + http://www.hawkboard.org/ + config DAVINCI_MUX bool "DAVINCI multiplexing support" depends on ARCH_DAVINCI
arch/arm/mach-davinci/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_MACH_DAVINCI_DA830_EVM) += board-da830-evm.o obj-$(CONFIG_MACH_DAVINCI_DA850_EVM) += board-da850-evm.o obj-$(CONFIG_MACH_TNETV107X) += board-tnetv107x-evm.o obj-$(CONFIG_MACH_MITYOMAPL138) += board-mityomapl138.o +obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD) += board-omapl138-hawk.o # Power Management obj-$(CONFIG_CPU_FREQ) += cpufreq.o
arch/arm/mach-davinci/board-omapl138-hawk.c new file +64 -0
64 lines not on this page · raw message
arch/arm/mach-davinci/include/mach/uncompress.h +1 -0
@@ -89,6 +89,7 @@ static inline void __arch_decomp_setup(unsigned long arch_id)DEBUG_LL_DA8XX (davinci_da830_evm,2 );DEBUG_LL_DA8XX (davinci_da850_evm,2 );DEBUG_LL_DA8XX (mityomapl138,1 ); +DEBUG_LL_DA8XX (omapl138_hawkboard,2 );/* TNETV107x boards */ DEBUG_LL_TNETV107X (tnetv107x,1 );
Signature · 1 line
1.7.2.1