Skip to contentSkip to conversation

Updating SPEAr Support

PATCH New Viresh KUMAR 25 participants 207 messages Aug 30, 2010 – Oct 1, 2010 Page 1 of 3

Subsystems (15)
lore
Share & tools
lore
#0 lore raw

cover Updating SPEAr Support

Following set of patches:
- updates SPEAr3xx, 6xx support
- Adds support for SPEAr13xx
- Removes Multiple defconfigs per machine family

Bhupesh Sharma (2):
ST SPEAr 13xx : Adding support for SPEAr1310
ST SPEAr : Adding CAN platform support for SPEAr320 and SPEAr1310

Deepak Sikri (7):
ST SPEAr: Adding USB Host support
SPEAr Clock Framework: Adding support for PLL frequency change SPEAr Power Management: Added the support for Standby mode.
GIC: Added dummy handlers for Power Management Suspend Resume SPEAr CPU freq: Adding support for CPU Freq framework ST SPEAr13xx: Adding CPU hotplug support added for SMP platforms
SPEAr13xx: Adding and Updating Clock definitions

Pratyush Anand (2):
ST SPEAr: Added PCIE host controller base driver support. ST SPEAr: PCIE gadget suppport

Rajeev Kumar (3):
ST SPEAr: adding support for rtc
ST SPEAr: adding support for synopsis i2c designware ST SPEAr : Added keyboard support

Ryan Mallon (5):
SPEAr3xx: Make local structres static
SPEAR3xx: Rename register/irq defines to remove naming conflicts
SPEAr3xx: Rework pmx_dev code to remove conflicts
SPEAr3xx: Rework KConfig to allow all boards to be compiled in
SPEAr3xx: Replace defconfigs with single unfied defconfig

Shiraz Hashim (16):
ST SPEAr: Formalized timer support
ST SPEAr13XX: Adding machine specific header files
ST SPEAr13XX: Adding machine specific src files
ST SPEAr: Adding support for SPEAr13xx SoC in spear generic plat/ ST SPEAr13XX: Added compilation support in arch/arm/
ST SPEAr1300: Adding default config file
ST SPEAr: Adding information in Documentation/ and MAINTAINERS ST SPEAr: Update clock framework and definitions
ST SPEAr: enhanced spear clock framework
ST SPEAr: Adding Debugfs support on clock framework
ST SPEAr: Add smi driver for serial NOR flash
ST SPEAr: Adding support for serial nor flash in all spear platforms ST SPEAr: Replacing SIZE macro's with actual required size
SPEAr: removing size based macros except those necessary ST SPEAr13xx: add l2 cache support
ST SPEAr13xx: Modified static mappings

Vipin Kumar (10):
ST SPEAr : NAND interface driver for spear platforms Incrementing the ecc_pos array to contain 128 char Newly erased page read workaround
ST SPEAr : EMI (Extrenal Memory Interface) controller driver ST SPEAr : FSMC (Flexible Static Memory Controller) NOR interface
driver
SPEAr : SEV Send event to secondary CPUs
ST SPEAr1310: Adding fsmc nor support
SPEAr : Pad multiplexing handling modified
SPEAr13xx : Fixed part devices in SPEAr13xx addded to the generic
implementation
SPEAr : Adding SPEAr1310 pad multiplexing devices

Vipul-kumar Samar (1):
ST SPEAr: Adding support for CLCD on SPEAr3xx/6xx

Viresh Kumar (28):
ST SPEAr: Padmux code Updated
ST SPEAr: Making clock functions more generic
ST SPEAr: Adding support for divisor per parent clock
ST SPEAr: Correcting SOC Config base address for spear320 ST SPEAr: Adding PLGPIO driver for spear platform
Clock Framework: Adding ENABLED_ON_INIT feature in clk
ST SPEAr: Added ARM PL061 GPIO Support on SPEAr13xx and modified
resource size
ST SPEAr: Adding support for ST's PWM IP
ST SPEAr: Adding Watchdog support
ST SPEAr: Adding support for SSP PL022
ST SPEAr: Adding clk_set_rate support
ST SPEAr: Adding support for SDHCI (SDIO)
ST SPEAr: Changing resource size of amba devices to SZ_4K ST SPEAr: Enabling clocks before amba device registeration ST SPEAr3xx: Rearranging declarations in clock.c file
ST SPEAr: Adding miscellaneous devices and clocks
ST SPEAr: Adding support for DDR in clock framework
ST SPEAr: SDHCI- selecting SD_MMC from misc and fixing sdhci_synth
rate to 48 MHz
ST SPEAr3xx: Passing pmx devices address from machine *.c files ST SPEAr: Appending spear3** with global structures
ST SPEAr3xx: Updating plgpio and emi source to make it compliant with
single image strategy
SPEAr6xx: Rework Kconfig for single image solution
ST SPEAR6xx: renaming spear600_defconfig as spear6xx_defconfig
SPEAr13XX: Update register/macros/devices/routine names and pmx dev
registration to implement single image for multiple boards.
SPEAr13xx: Rework KConfig to allow all boards to be compiled in
SPEAr13xx: Replace defconfigs with single unfied defconfig ST SPEAr: Updating defconfigs
ST SPEAr: Enabling devices in various evb.c files

 Documentation/arm/SPEAr/overview.txt               |   33 +-
 MAINTAINERS                                        |    6 +
 arch/arm/Kconfig                                   |   19 +-
 arch/arm/Makefile                                  |    2 +
 arch/arm/common/gic.c                              |   13 +
 arch/arm/configs/spear13xx_defconfig               | 1769 ++++++++++++++++++++
 arch/arm/configs/spear300_defconfig                |   51 -
 arch/arm/configs/spear310_defconfig                |   52 -
 arch/arm/configs/spear320_defconfig                |   52 -
 arch/arm/configs/spear3xx_defconfig                | 1615 ++++++++++++++++++
 arch/arm/configs/spear600_defconfig                |   49 -
 arch/arm/configs/spear6xx_defconfig                | 1606 ++++++++++++++++++
 arch/arm/mach-spear13xx/Kconfig                    |   32 +
 arch/arm/mach-spear13xx/Makefile                   |   21 +
 arch/arm/mach-spear13xx/Makefile.boot              |    3 +
 arch/arm/mach-spear13xx/clock.c                    | 1140 +++++++++++++
 arch/arm/mach-spear13xx/fsmc-nor.c                 |   81 +
 arch/arm/mach-spear13xx/headsmp.S                  |   95 ++
 arch/arm/mach-spear13xx/hotplug.c                  |  146 ++
 arch/arm/mach-spear13xx/include/mach/clkdev.h      |   19 +
 arch/arm/mach-spear13xx/include/mach/debug-macro.S |   14 +
 arch/arm/mach-spear13xx/include/mach/entry-macro.S |   88 +
 arch/arm/mach-spear13xx/include/mach/generic.h     |  275 +++
 arch/arm/mach-spear13xx/include/mach/gpio.h        |   37 +
 arch/arm/mach-spear13xx/include/mach/hardware.h    |   37 +
 arch/arm/mach-spear13xx/include/mach/io.h          |   19 +
 arch/arm/mach-spear13xx/include/mach/irqs.h        |  152 ++
 arch/arm/mach-spear13xx/include/mach/memory.h      |   19 +
 arch/arm/mach-spear13xx/include/mach/misc_regs.h   |  386 +++++
 arch/arm/mach-spear13xx/include/mach/pcie.h        |  169 ++
 arch/arm/mach-spear13xx/include/mach/smp.h         |   39 +
 arch/arm/mach-spear13xx/include/mach/spear.h       |   95 ++
 arch/arm/mach-spear13xx/include/mach/spear1300.h   |   21 +
 arch/arm/mach-spear13xx/include/mach/spear1310.h   |   46 +
 arch/arm/mach-spear13xx/include/mach/suspend.h     |   47 +
 arch/arm/mach-spear13xx/include/mach/system.h      |   43 +
 arch/arm/mach-spear13xx/include/mach/timex.h       |   19 +
 arch/arm/mach-spear13xx/include/mach/uncompress.h  |   19 +
 arch/arm/mach-spear13xx/include/mach/vmalloc.h     |   18 +
 arch/arm/mach-spear13xx/localtimer.c               |   25 +
 arch/arm/mach-spear13xx/pcie.c                     |  881 ++++++++++
 arch/arm/mach-spear13xx/platsmp.c                  |  220 +++
 arch/arm/mach-spear13xx/pm.c                       |  107 ++
 arch/arm/mach-spear13xx/sleep.S                    |  435 +++++
 arch/arm/mach-spear13xx/spear1300.c                |   38 +
 arch/arm/mach-spear13xx/spear1300_evb.c            |  212 +++
 arch/arm/mach-spear13xx/spear1310.c                |  468 ++++++
 arch/arm/mach-spear13xx/spear1310_evb.c            |  217 +++
 arch/arm/mach-spear13xx/spear13xx.c                | 1163 +++++++++++++
 arch/arm/mach-spear3xx/Kconfig                     |   30 +-
 arch/arm/mach-spear3xx/Kconfig300                  |   17 -
 arch/arm/mach-spear3xx/Kconfig310                  |   17 -
 arch/arm/mach-spear3xx/Kconfig320                  |   17 -
 arch/arm/mach-spear3xx/Makefile                    |    4 +
 arch/arm/mach-spear3xx/clock.c                     |  563 ++++++-
 arch/arm/mach-spear3xx/emi.c                       |  102 ++
 arch/arm/mach-spear3xx/include/mach/emi.h          |   80 +
 arch/arm/mach-spear3xx/include/mach/generic.h      |  282 ++--
 arch/arm/mach-spear3xx/include/mach/gpio.h         |  143 ++
 arch/arm/mach-spear3xx/include/mach/irqs.h         |  206 ++--
 arch/arm/mach-spear3xx/include/mach/misc_regs.h    |   12 +-
 arch/arm/mach-spear3xx/include/mach/spear.h        |  134 +--
 arch/arm/mach-spear3xx/include/mach/spear300.h     |   86 +-
 arch/arm/mach-spear3xx/include/mach/spear310.h     |   85 +-
 arch/arm/mach-spear3xx/include/mach/spear320.h     |  121 +-
 arch/arm/mach-spear3xx/include/mach/suspend.h      |   44 +
 arch/arm/mach-spear3xx/spear300.c                  |  640 ++++++--
 arch/arm/mach-spear3xx/spear300_evb.c              |  138 ++-
 arch/arm/mach-spear3xx/spear310.c                  |  434 ++++--
 arch/arm/mach-spear3xx/spear310_evb.c              |  137 ++-
 arch/arm/mach-spear3xx/spear320.c                  |  855 ++++++++---
 arch/arm/mach-spear3xx/spear320_evb.c              |  154 ++-
 arch/arm/mach-spear3xx/spear3xx.c                  |  742 +++++++--
 arch/arm/mach-spear6xx/Kconfig                     |   15 +-
 arch/arm/mach-spear6xx/Kconfig600                  |   17 -
 arch/arm/mach-spear6xx/clock.c                     |  438 ++++-
 arch/arm/mach-spear6xx/include/mach/generic.h      |   21 +-
 arch/arm/mach-spear6xx/include/mach/gpio.h         |   27 +
 arch/arm/mach-spear6xx/include/mach/misc_regs.h    |   12 +-
 arch/arm/mach-spear6xx/include/mach/spear.h        |  174 +--
 arch/arm/mach-spear6xx/include/mach/suspend.h      |   44 +
 arch/arm/mach-spear6xx/spear600_evb.c              |   80 +-
 arch/arm/mach-spear6xx/spear6xx.c                  |  341 ++++-
 arch/arm/mm/Kconfig                                |    2 +-
 arch/arm/plat-spear/Kconfig                        |   16 +
 arch/arm/plat-spear/Makefile                       |   21 +-
 arch/arm/plat-spear/clcd.c                         |  126 ++
 arch/arm/plat-spear/clock.c                        |  911 +++++++++--
 arch/arm/plat-spear/cpufreq.c                      |  160 ++
 arch/arm/plat-spear/i2c_eval_board.c               |   29 +
 arch/arm/plat-spear/include/plat/clock.h           |  187 ++-
 arch/arm/plat-spear/include/plat/device.h          |   37 +
 arch/arm/plat-spear/include/plat/fsmc.h            |  158 ++
 arch/arm/plat-spear/include/plat/gpio.h            |   35 +
 arch/arm/plat-spear/include/plat/keyboard.h        |  154 ++
 arch/arm/plat-spear/include/plat/nand.h            |   76 +
 arch/arm/plat-spear/include/plat/padmux.h          |   34 +-
 arch/arm/plat-spear/include/plat/smi.h             |   71 +
 arch/arm/plat-spear/include/plat/spi.h             |   77 +
 arch/arm/plat-spear/padmux.c                       |   54 +-
 arch/arm/plat-spear/plgpio.c                       |  475 ++++++
 arch/arm/plat-spear/pll_clk.S                      |  187 ++
 arch/arm/plat-spear/pm.c                           |  104 ++
 arch/arm/plat-spear/pwm.c                          |  484 ++++++
 arch/arm/plat-spear/sleep.S                        |  288 ++++
 arch/arm/plat-spear/smi.c                          |   63 +
 arch/arm/plat-spear/time.c                         |   34 +-
 drivers/input/keyboard/Kconfig                     |    8 +
 drivers/input/keyboard/Makefile                    |    1 +
 drivers/input/keyboard/spear-keyboard.c            |  335 ++++
 drivers/misc/Kconfig                               |   10 +
 drivers/misc/Makefile                              |    1 +
 drivers/misc/spear13xx_pcie_gadget.c               |  888 ++++++++++
 drivers/mtd/devices/Kconfig                        |    7 +
 drivers/mtd/devices/Makefile                       |    1 +
 drivers/mtd/devices/spear_smi.c                    | 1122 +++++++++++++
 drivers/mtd/nand/Kconfig                           |    6 +
 drivers/mtd/nand/Makefile                          |    1 +
 drivers/mtd/nand/spear_nand.c                      |  876 ++++++++++
 drivers/rtc/Kconfig                                |    7 +
 drivers/rtc/Makefile                               |    1 +
 drivers/rtc/rtc-spear.c                            |  598 +++++++
 drivers/usb/Kconfig                                |    2 +
 drivers/usb/host/ehci-hcd.c                        |    5 +
 drivers/usb/host/ehci-spear.c                      |  210 +++
 drivers/usb/host/ohci-hcd.c                        |    5 +
 drivers/usb/host/ohci-spear.c                      |  240 +++
 drivers/video/Kconfig                              |   14 +-
 include/mtd/mtd-abi.h                              |    2 +-
 129 files changed, 24444 insertions(+), 2004 deletions(-)
 create mode 100644 arch/arm/configs/spear13xx_defconfig
 delete mode 100644 arch/arm/configs/spear300_defconfig
 delete mode 100644 arch/arm/configs/spear310_defconfig
 delete mode 100644 arch/arm/configs/spear320_defconfig
 create mode 100644 arch/arm/configs/spear3xx_defconfig
 delete mode 100644 arch/arm/configs/spear600_defconfig
 create mode 100644 arch/arm/configs/spear6xx_defconfig
 create mode 100644 arch/arm/mach-spear13xx/Kconfig
 create mode 100644 arch/arm/mach-spear13xx/Makefile
 create mode 100644 arch/arm/mach-spear13xx/Makefile.boot
 create mode 100644 arch/arm/mach-spear13xx/clock.c
 create mode 100644 arch/arm/mach-spear13xx/fsmc-nor.c
 create mode 100644 arch/arm/mach-spear13xx/headsmp.S
 create mode 100644 arch/arm/mach-spear13xx/hotplug.c
 create mode 100644 arch/arm/mach-spear13xx/include/mach/clkdev.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/debug-macro.S
 create mode 100644 arch/arm/mach-spear13xx/include/mach/entry-macro.S
 create mode 100644 arch/arm/mach-spear13xx/include/mach/generic.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/gpio.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/hardware.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/io.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/irqs.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/memory.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/misc_regs.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/pcie.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/smp.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/spear.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/spear1300.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/spear1310.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/suspend.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/system.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/timex.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/uncompress.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/vmalloc.h
 create mode 100644 arch/arm/mach-spear13xx/localtimer.c
 create mode 100644 arch/arm/mach-spear13xx/pcie.c
 create mode 100644 arch/arm/mach-spear13xx/platsmp.c
 create mode 100644 arch/arm/mach-spear13xx/pm.c
 create mode 100644 arch/arm/mach-spear13xx/sleep.S
 create mode 100644 arch/arm/mach-spear13xx/spear1300.c
 create mode 100644 arch/arm/mach-spear13xx/spear1300_evb.c
 create mode 100644 arch/arm/mach-spear13xx/spear1310.c
 create mode 100644 arch/arm/mach-spear13xx/spear1310_evb.c
 create mode 100644 arch/arm/mach-spear13xx/spear13xx.c
 delete mode 100644 arch/arm/mach-spear3xx/Kconfig300
 delete mode 100644 arch/arm/mach-spear3xx/Kconfig310
 delete mode 100644 arch/arm/mach-spear3xx/Kconfig320
 create mode 100644 arch/arm/mach-spear3xx/emi.c
 create mode 100644 arch/arm/mach-spear3xx/include/mach/emi.h
 create mode 100644 arch/arm/mach-spear3xx/include/mach/suspend.h
 delete mode 100644 arch/arm/mach-spear6xx/Kconfig600
 create mode 100644 arch/arm/mach-spear6xx/include/mach/suspend.h
 create mode 100644 arch/arm/plat-spear/clcd.c
 create mode 100644 arch/arm/plat-spear/cpufreq.c
 create mode 100644 arch/arm/plat-spear/i2c_eval_board.c
 create mode 100644 arch/arm/plat-spear/include/plat/device.h
 create mode 100644 arch/arm/plat-spear/include/plat/fsmc.h
 create mode 100644 arch/arm/plat-spear/include/plat/keyboard.h
 create mode 100644 arch/arm/plat-spear/include/plat/nand.h
 create mode 100644 arch/arm/plat-spear/include/plat/smi.h
 create mode 100644 arch/arm/plat-spear/include/plat/spi.h
 create mode 100644 arch/arm/plat-spear/plgpio.c
 create mode 100644 arch/arm/plat-spear/pll_clk.S
 create mode 100644 arch/arm/plat-spear/pm.c
 create mode 100644 arch/arm/plat-spear/pwm.c
 create mode 100644 arch/arm/plat-spear/sleep.S
 create mode 100644 arch/arm/plat-spear/smi.c
 create mode 100644 drivers/input/keyboard/spear-keyboard.c
 create mode 100644 drivers/misc/spear13xx_pcie_gadget.c
 create mode 100644 drivers/mtd/devices/spear_smi.c
 create mode 100644 drivers/mtd/nand/spear_nand.c
 create mode 100644 drivers/rtc/rtc-spear.c
 create mode 100644 drivers/usb/host/ehci-spear.c
 create mode 100644 drivers/usb/host/ohci-spear.c
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 1/74 ST SPEAr: Padmux code Updated

- compiling padmux only for spear3xx
- padmux initialization code rearranged in evaluation board and machine files.

---
 arch/arm/mach-spear3xx/include/mach/generic.h |    7 -------
 arch/arm/mach-spear3xx/spear300.c             |   13 +++++++++----
 arch/arm/mach-spear3xx/spear300_evb.c         |    9 ++++-----
 arch/arm/mach-spear3xx/spear310.c             |   11 ++++++-----
 arch/arm/mach-spear3xx/spear310_evb.c         |    9 ++++-----
 arch/arm/mach-spear3xx/spear320.c             |   11 ++++++-----
 arch/arm/mach-spear3xx/spear320_evb.c         |    9 ++++-----
 arch/arm/mach-spear3xx/spear3xx.c             |   21 ---------------------
 arch/arm/plat-spear/Makefile                  |    4 ++--
 9 files changed, 35 insertions(+), 59 deletions(-)
arch/arm/mach-spear3xx/include/mach/generic.h +0 -7
index af7e02c..c16d2f8 100644
@@ -40,7 +40,6 @@ void __init clk_init(void);
 void __init spear3xx_map_io(void);
 void __init spear3xx_init_irq(void);
 void __init spear3xx_init(void);
-void spear_pmx_init(struct pmx_driver *pmx_driver, uint base, uint size);
 
 /* pad mux declarations */
 #define PMX_FIRDA_MASK		(1 << 14)
@@ -133,8 +132,6 @@ extern struct pmx_dev pmx_telecom_sdio_4bit;
 extern struct pmx_dev pmx_telecom_sdio_8bit;
 extern struct pmx_dev pmx_gpio1;
 
-void spear300_pmx_init(void);
-
 /* Add spear300 machine function declarations here */
 void __init spear300_init(void);
 
@@ -154,8 +151,6 @@ extern struct pmx_dev pmx_fsmc;
 extern struct pmx_dev pmx_rs485_0_1;
 extern struct pmx_dev pmx_tdm0;
 
-void spear310_pmx_init(void);
-
 /* Add spear310 machine function declarations here */
 void __init spear310_init(void);
 
@@ -195,8 +190,6 @@ extern struct pmx_dev pmx_smii0;
 extern struct pmx_dev pmx_smii1;
 extern struct pmx_dev pmx_i2c1;
 
-void spear320_pmx_init(void);
-
 /* Add spear320 machine function declarations here */
 void __init spear320_init(void);
 
arch/arm/mach-spear3xx/spear300.c +9 -4
index 3560f8c..7e0ca5d 100644
@@ -459,10 +459,15 @@ void __init spear300_init(void)
 		if (ret)
 			printk(KERN_ERR "Error registering Shared IRQ\n");
 	}
-}
 
-void spear300_pmx_init(void)
-{
-	spear_pmx_init(&pmx_driver, SPEAR300_SOC_CONFIG_BASE,
+	/* pmx initialization */
+	pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE,
 			SPEAR300_SOC_CONFIG_SIZE);
+	if (pmx_driver.base) {
+		ret = pmx_register(&pmx_driver);
+		if (ret)
+			printk(KERN_ERR "padmux: registeration failed. err no"
+					": %d\n", ret);
+		iounmap(pmx_driver.base);
+	}
 }
arch/arm/mach-spear3xx/spear300_evb.c +4 -5
index bb21db1..2c90663 100644
@@ -51,14 +51,13 @@ static void __init spear300_evb_init(void)
 {
 	unsigned int i;
 
-	/* call spear300 machine init function */
-	spear300_init();
-
-	/* padmux initialization */
+	/* padmux initialization, must be done before spear300_init */
 	pmx_driver.mode = &photo_frame_mode;
 	pmx_driver.devs = pmx_devs;
 	pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
-	spear300_pmx_init();
+
+	/* call spear300 machine init function */
+	spear300_init();
 
 	/* Add Platform Devices */
 	platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
arch/arm/mach-spear3xx/spear310.c +6 -5
index 96a1ab8..576bc57 100644
@@ -293,10 +293,11 @@ void __init spear310_init(void)
 		if (ret)
 			printk(KERN_ERR "Error registering Shared IRQ 4\n");
 	}
-}
 
-void spear310_pmx_init(void)
-{
-	spear_pmx_init(&pmx_driver, SPEAR310_SOC_CONFIG_BASE,
-			SPEAR310_SOC_CONFIG_SIZE);
+	/* pmx initialization */
+	pmx_driver.base = base;
+	ret = pmx_register(&pmx_driver);
+	if (ret)
+		printk(KERN_ERR "padmux: registeration failed. err no: %d\n",
+				ret);
 }
arch/arm/mach-spear3xx/spear310_evb.c +4 -5
index 7facf66..4e55e55 100644
@@ -58,14 +58,13 @@ static void __init spear310_evb_init(void)
 {
 	unsigned int i;
 
-	/* call spear310 machine init function */
-	spear310_init();
-
-	/* padmux initialization */
+	/* padmux initialization, must be done before spear310_init */
 	pmx_driver.mode = NULL;
 	pmx_driver.devs = pmx_devs;
 	pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
-	spear310_pmx_init();
+
+	/* call spear310 machine init function */
+	spear310_init();
 
 	/* Add Platform Devices */
 	platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
arch/arm/mach-spear3xx/spear320.c +6 -5
index 6a12195..2886bb2 100644
@@ -540,10 +540,11 @@ void __init spear320_init(void)
 		if (ret)
 			printk(KERN_ERR "Error registering Shared IRQ 4\n");
 	}
-}
 
-void spear320_pmx_init(void)
-{
-	spear_pmx_init(&pmx_driver, SPEAR320_SOC_CONFIG_BASE,
-			SPEAR320_SOC_CONFIG_SIZE);
+	/* pmx initialization */
+	pmx_driver.base = base;
+	ret = pmx_register(&pmx_driver);
+	if (ret)
+		printk(KERN_ERR "padmux: registeration failed. err no: %d\n",
+				ret);
 }
arch/arm/mach-spear3xx/spear320_evb.c +4 -5
index 62ac685..7083a06 100644
@@ -55,14 +55,13 @@ static void __init spear320_evb_init(void)
 {
 	unsigned int i;
 
-	/* call spear320 machine init function */
-	spear320_init();
-
-	/* padmux initialization */
+	/* padmux initialization, must be done before spear320_init */
 	pmx_driver.mode = &auto_net_mii_mode;
 	pmx_driver.devs = pmx_devs;
 	pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
-	spear320_pmx_init();
+
+	/* call spear320 machine init function */
+	spear320_init();
 
 	/* Add Platform Devices */
 	platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
arch/arm/mach-spear3xx/spear3xx.c +0 -21
index e87313a..efd2e17 100644
@@ -525,24 +525,3 @@ struct pmx_dev pmx_plgpio_45_46_49_50 = {
 };
 
 #endif
-
-/* spear padmux initialization function */
-void spear_pmx_init(struct pmx_driver *pmx_driver, uint base, uint size)
-{
-	int ret = 0;
-
-	/* pad mux initialization */
-	pmx_driver->base = ioremap(base, size);
-	if (!pmx_driver->base) {
-		ret = -ENOMEM;
-		goto pmx_fail;
-	}
-
-	ret = pmx_register(pmx_driver);
-	iounmap(pmx_driver->base);
-
-pmx_fail:
-	if (ret)
-		printk(KERN_ERR "padmux: registeration failed. err no: %d\n",
-				ret);
-}
arch/arm/plat-spear/Makefile +2 -2
index eb89540..b4f340b 100644
@@ -3,6 +3,6 @@
 #
 
 # Common support
-obj-y	:= clock.o padmux.o time.o
+obj-y	:= clock.o time.o
 
-obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o
+obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o padmux.o
Signature · 1 line
1.7.2.2
#2 lore raw

PATCH 1/74 ST SPEAr: Padmux code Updated

arch/arm/mach-spear3xx/spear300.c void __init spear300_init(void) · line 471

Quoted 13 lines
arch/arm/mach-spear3xx/spear300.c +8 -3
-void spear300_pmx_init(void)
-{
-	spear_pmx_init(&pmx_driver, SPEAR300_SOC_CONFIG_BASE,
+	/* pmx initialization */
+	pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE,
 			SPEAR300_SOC_CONFIG_SIZE);
+	if (pmx_driver.base) {
+		ret = pmx_register(&pmx_driver);
+		if (ret)
+			printk(KERN_ERR "padmux: registeration failed. err no"
+					": %d\n", ret);
+		iounmap(pmx_driver.base);

why unmap it?

Best Regards,
J.

#3 lore raw

PATCH 1/74 ST SPEAr: Padmux code Updated

Quoted 14 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 13 lines

arch/arm/mach-spear3xx/spear300.c void __init spear300_init(void) · line 471

Quoted 13 lines
arch/arm/mach-spear3xx/spear300.c +8 -3
-void spear300_pmx_init(void)
-{
-	spear_pmx_init(&pmx_driver, SPEAR300_SOC_CONFIG_BASE,
+	/* pmx initialization */
+	pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE,
 			SPEAR300_SOC_CONFIG_SIZE);
+	if (pmx_driver.base) {
+		ret = pmx_register(&pmx_driver);
+		if (ret)
+			printk(KERN_ERR "padmux: registeration failed. err no"
+					": %d\n", ret);
+		iounmap(pmx_driver.base);

why unmap it?

pmx_register will actually enable all selected devices and configure padmux. After this we will never change device configuration again. So don't need this mapping.

viresh.

#4 lore raw

PATCH 1/74 ST SPEAr: Padmux code Updated

Quoted 16 lines · viresh kumar
Quoted 14 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 13 lines

arch/arm/mach-spear3xx/spear300.c void __init spear300_init(void) · line 471

Quoted 13 lines
arch/arm/mach-spear3xx/spear300.c +8 -3
-void spear300_pmx_init(void)
-{
-	spear_pmx_init(&pmx_driver, SPEAR300_SOC_CONFIG_BASE,
+	/* pmx initialization */
+	pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE,
 			SPEAR300_SOC_CONFIG_SIZE);
+	if (pmx_driver.base) {
+		ret = pmx_register(&pmx_driver);
+		if (ret)
+			printk(KERN_ERR "padmux: registeration failed. err no"
+					": %d\n", ret);
+		iounmap(pmx_driver.base);

why unmap it?

Quoted 3 lines

pmx_register will actually enable all selected devices and configure padmux. After this we will never change device configuration again. So don't need this mapping.

so put a comment in the code

Best Regards,
J.

#5 lore raw

PATCH 1/74 ST SPEAr: Padmux code Updated

Quoted 17 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · viresh kumar
Quoted 14 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 13 lines

arch/arm/mach-spear3xx/spear300.c void __init spear300_init(void) · line 471

Quoted 13 lines
arch/arm/mach-spear3xx/spear300.c +8 -3
-void spear300_pmx_init(void)
-{
-	spear_pmx_init(&pmx_driver, SPEAR300_SOC_CONFIG_BASE,
+	/* pmx initialization */
+	pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE,
 			SPEAR300_SOC_CONFIG_SIZE);
+	if (pmx_driver.base) {
+		ret = pmx_register(&pmx_driver);
+		if (ret)
+			printk(KERN_ERR "padmux: registeration failed. err no"
+					": %d\n", ret);
+		iounmap(pmx_driver.base);

why unmap it?

Quoted 5 lines
Quoted 3 lines

pmx_register will actually enable all selected devices and configure padmux. After this we will never change device configuration again. So don't need this mapping.

so put a comment in the code

Will do that.

#6 lore raw

PATCH 2/74 ST SPEAr: Making clock functions more generic

In reply to Viresh KUMAR

Modifications include:
- Adding dummy clk_set_rate function. Required for compilation of few drivers
- Making function present in plat-spear/clock.c more generic over all platforms
- Added div_factor filed in struct clk for clks with .recalc = follow_parent

---
 arch/arm/mach-spear3xx/clock.c           |   66 ++++++++++++++++++++++++++----
 arch/arm/mach-spear6xx/clock.c           |   67 ++++++++++++++++++++++++++----
 arch/arm/plat-spear/clock.c              |   59 ++++++++++++++++++--------
 arch/arm/plat-spear/include/plat/clock.h |   64 ++++++++++++++++++++++++----
 4 files changed, 212 insertions(+), 44 deletions(-)
arch/arm/mach-spear3xx/clock.c +58 -8
index 18febf9..7ea8749 100644
@@ -39,10 +39,25 @@ static struct clk rtc_clk = {
 };
 
 /* clock derived from 24 MHz osc clk */
+/* pll masks structure */
+static struct pll_clk_masks pll1_masks = {
+	.mode_mask = PLL_MODE_MASK,
+	.mode_shift = PLL_MODE_SHIFT,
+	.norm_fdbk_m_mask = PLL_NORM_FDBK_M_MASK,
+	.norm_fdbk_m_shift = PLL_NORM_FDBK_M_SHIFT,
+	.dith_fdbk_m_mask = PLL_DITH_FDBK_M_MASK,
+	.dith_fdbk_m_shift = PLL_DITH_FDBK_M_SHIFT,
+	.div_p_mask = PLL_DIV_P_MASK,
+	.div_p_shift = PLL_DIV_P_SHIFT,
+	.div_n_mask = PLL_DIV_N_MASK,
+	.div_n_shift = PLL_DIV_N_SHIFT,
+};
+
 /* pll1 configuration structure */
 static struct pll_clk_config pll1_config = {
 	.mode_reg = PLL1_CTR,
 	.cfg_reg = PLL1_FRQ,
+	.masks = &pll1_masks,
 };
 
 /* PLL1 clock */
@@ -50,7 +65,7 @@ static struct clk pll1_clk = {
 	.pclk = &osc_24m_clk,
 	.en_reg = PLL1_CTR,
 	.en_reg_bit = PLL_ENABLE,
-	.recalc = &pll1_clk_recalc,
+	.recalc = &pll_clk_recalc,
 	.private_data = &pll1_config,
 };
 
@@ -76,11 +91,16 @@ static struct clk cpu_clk = {
 	.recalc = &follow_parent,
 };
 
+/* ahb masks structure */
+static struct bus_clk_masks ahb_masks = {
+	.mask = PLL_HCLK_RATIO_MASK,
+	.shift = PLL_HCLK_RATIO_SHIFT,
+};
+
 /* ahb configuration structure */
 static struct bus_clk_config ahb_config = {
 	.reg = CORE_CLK_CFG,
-	.mask = PLL_HCLK_RATIO_MASK,
-	.shift = PLL_HCLK_RATIO_SHIFT,
+	.masks = &ahb_masks,
 };
 
 /* ahb clock */
@@ -91,9 +111,22 @@ static struct clk ahb_clk = {
 	.private_data = &ahb_config,
 };
 
+/* auxiliary synthesizers masks */
+static struct aux_clk_masks aux_masks = {
+	.eq_sel_mask = AUX_EQ_SEL_MASK,
+	.eq_sel_shift = AUX_EQ_SEL_SHIFT,
+	.eq1_mask = AUX_EQ1_SEL,
+	.eq2_mask = AUX_EQ2_SEL,
+	.xscale_sel_mask = AUX_XSCALE_MASK,
+	.xscale_sel_shift = AUX_XSCALE_SHIFT,
+	.yscale_sel_mask = AUX_YSCALE_MASK,
+	.yscale_sel_shift = AUX_YSCALE_SHIFT,
+};
+
 /* uart configurations */
 static struct aux_clk_config uart_config = {
 	.synth_reg = UART_CLK_SYNT,
+	.masks = &aux_masks,
 };
 
 /* uart parents */
@@ -130,6 +163,7 @@ static struct clk uart_clk = {
 /* firda configurations */
 static struct aux_clk_config firda_config = {
 	.synth_reg = FIRDA_CLK_SYNT,
+	.masks = &aux_masks,
 };
 
 /* firda parents */
@@ -184,9 +218,18 @@ static struct pclk_sel gpt_pclk_sel = {
 	.pclk_sel_mask = GPT_CLK_MASK,
 };
 
+/* gpt synthesizer masks */
+static struct gpt_clk_masks gpt_masks = {
+	.mscale_sel_mask = GPT_MSCALE_MASK,
+	.mscale_sel_shift = GPT_MSCALE_SHIFT,
+	.nscale_sel_mask = GPT_NSCALE_MASK,
+	.nscale_sel_shift = GPT_NSCALE_SHIFT,
+};
+
 /* gpt0 configurations */
-static struct aux_clk_config gpt0_config = {
+static struct gpt_clk_config gpt0_config = {
 	.synth_reg = PRSC1_CLK_CFG,
+	.masks = &gpt_masks,
 };
 
 /* gpt0 timer clock */
@@ -199,8 +242,9 @@ static struct clk gpt0_clk = {
 };
 
 /* gpt1 configurations */
-static struct aux_clk_config gpt1_config = {
+static struct gpt_clk_config gpt1_config = {
 	.synth_reg = PRSC2_CLK_CFG,
+	.masks = &gpt_masks,
 };
 
 /* gpt1 timer clock */
@@ -214,8 +258,9 @@ static struct clk gpt1_clk = {
 };
 
 /* gpt2 configurations */
-static struct aux_clk_config gpt2_config = {
+static struct gpt_clk_config gpt2_config = {
 	.synth_reg = PRSC3_CLK_CFG,
+	.masks = &gpt_masks,
 };
 
 /* gpt2 timer clock */
@@ -253,11 +298,16 @@ static struct clk clcd_clk = {
 };
 
 /* clock derived from ahb clk */
+/* apb masks structure */
+static struct bus_clk_masks apb_masks = {
+	.mask = HCLK_PCLK_RATIO_MASK,
+	.shift = HCLK_PCLK_RATIO_SHIFT,
+};
+
 /* apb configuration structure */
 static struct bus_clk_config apb_config = {
 	.reg = CORE_CLK_CFG,
-	.mask = HCLK_PCLK_RATIO_MASK,
-	.shift = HCLK_PCLK_RATIO_SHIFT,
+	.masks = &apb_masks,
 };
 
 /* apb clock */
arch/arm/mach-spear6xx/clock.c +59 -8

144 lines not on this page · raw message

arch/arm/plat-spear/clock.c +41 -18

141 lines not on this page · raw message

arch/arm/plat-spear/include/plat/clock.h +54 -10

96 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#7 lore raw

PATCH 3/74 ST SPEAr: Formalized timer support

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

---
 arch/arm/mach-spear3xx/include/mach/generic.h |    3 +-
 arch/arm/mach-spear3xx/spear300_evb.c         |    2 +-
 arch/arm/mach-spear3xx/spear310_evb.c         |    2 +-
 arch/arm/mach-spear3xx/spear320_evb.c         |    2 +-
 arch/arm/mach-spear3xx/spear3xx.c             |   10 ++++++-
 arch/arm/mach-spear6xx/include/mach/generic.h |    3 +-
 arch/arm/mach-spear6xx/spear600_evb.c         |    3 +-
 arch/arm/mach-spear6xx/spear6xx.c             |    9 ++++++
 arch/arm/plat-spear/time.c                    |   34 +++++++++++++++++-------
 9 files changed, 51 insertions(+), 17 deletions(-)
arch/arm/mach-spear3xx/include/mach/generic.h +2 -1
index c16d2f8..e7d2de8 100644
@@ -33,10 +33,11 @@
 /* Add spear3xx family device structure declarations here */
 extern struct amba_device gpio_device;
 extern struct amba_device uart_device;
-extern struct sys_timer spear_sys_timer;
+extern struct sys_timer spear3xx_timer;
 
 /* Add spear3xx family function declarations here */
 void __init clk_init(void);
+void __init spear_setup_timer(void);
 void __init spear3xx_map_io(void);
 void __init spear3xx_init_irq(void);
 void __init spear3xx_init(void);
arch/arm/mach-spear3xx/spear300_evb.c +1 -1
index 2c90663..cd23c98 100644
@@ -71,6 +71,6 @@ MACHINE_START(SPEAR300, "ST-SPEAR300-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear3xx_map_io,
 	.init_irq	=	spear3xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear3xx_timer,
 	.init_machine	=	spear300_evb_init,
 MACHINE_END
arch/arm/mach-spear3xx/spear310_evb.c +1 -1
index 4e55e55..3855431 100644
@@ -78,6 +78,6 @@ MACHINE_START(SPEAR310, "ST-SPEAR310-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear3xx_map_io,
 	.init_irq	=	spear3xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear3xx_timer,
 	.init_machine	=	spear310_evb_init,
 MACHINE_END
arch/arm/mach-spear3xx/spear320_evb.c +1 -1
index 7083a06..4a7ce35 100644
@@ -75,6 +75,6 @@ MACHINE_START(SPEAR320, "ST-SPEAR320-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear3xx_map_io,
 	.init_irq	=	spear3xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear3xx_timer,
 	.init_machine	=	spear320_evb_init,
 MACHINE_END
arch/arm/mach-spear3xx/spear3xx.c +9 -1
index efd2e17..89cf8ea 100644
@@ -523,5 +523,13 @@ struct pmx_dev pmx_plgpio_45_46_49_50 = {
 	.mode_count = ARRAY_SIZE(pmx_plgpio_45_46_49_50_modes),
 	.enb_on_reset = 1,
 };
+#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */
 
-#endif
+static void __init spear3xx_timer_init(void)
+{
+	spear_setup_timer();
+}
+
+struct sys_timer spear3xx_timer = {
+	.init = spear3xx_timer_init,
+};
arch/arm/mach-spear6xx/include/mach/generic.h +2 -1
index 16205a5..e5967ed 100644
@@ -31,9 +31,10 @@
 /* Add spear6xx family device structure declarations here */
 extern struct amba_device gpio_device[];
 extern struct amba_device uart_device[];
-extern struct sys_timer spear_sys_timer;
+extern struct sys_timer spear6xx_timer;
 
 /* Add spear6xx family function declarations here */
+void __init spear_setup_timer(void);
 void __init spear6xx_map_io(void);
 void __init spear6xx_init_irq(void);
 void __init spear6xx_init(void);
arch/arm/mach-spear6xx/spear600_evb.c +2 -1
index daff8d0..bdd5b76 100644
@@ -42,10 +42,11 @@ static void __init spear600_evb_init(void)
 		amba_device_register(amba_devs[i], &iomem_resource);
 }
 
+
 MACHINE_START(SPEAR600, "ST-SPEAR600-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear6xx_map_io,
 	.init_irq	=	spear6xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear6xx_timer,
 	.init_machine	=	spear600_evb_init,
 MACHINE_END
arch/arm/mach-spear6xx/spear6xx.c +9 -0
index baf6bcc..88a82ca 100644
@@ -155,3 +155,12 @@ void __init spear6xx_map_io(void)
 	/* This will initialize clock framework */
 	clk_init();
 }
+
+static void __init spear6xx_timer_init(void)
+{
+	spear_setup_timer();
+}
+
+struct sys_timer spear6xx_timer = {
+	.init = spear6xx_timer_init,
+};
arch/arm/plat-spear/time.c +24 -10
index ab21165..850d0cf 100644
@@ -66,6 +66,13 @@
 static __iomem void *gpt_base;
 static struct clk *gpt_clk;
 
+/* following defines the parent clock to be used */
+#ifdef CONFIG_ARCH_SPEAR13XX
+static char pclk_name[] = "osc1_24m_clk";
+#else
+static char pclk_name[] = "pll3_48m_clk";
+#endif
+
 static void clockevent_set_mode(enum clock_event_mode mode,
 				struct clock_event_device *clk_event_dev);
 static int clockevent_next_event(unsigned long evt,
@@ -215,7 +222,8 @@ static void __init spear_clockevent_init(void)
 
 void __init spear_setup_timer(void)
 {
-	struct clk *pll3_clk;
+	struct clk *clk;
+	int ret;
 
 	if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) {
 		pr_err("%s:cannot get IO addr\n", __func__);
@@ -234,26 +242,32 @@ void __init spear_setup_timer(void)
 		goto err_iomap;
 	}
 
-	pll3_clk = clk_get(NULL, "pll3_48m_clk");
-	if (!pll3_clk) {
-		pr_err("%s:couldn't get PLL3 as parent for gpt\n", __func__);
+	/* get the parent clock */
+	clk = clk_get(NULL, pclk_name);
+
+	if (!clk) {
+		pr_err("%s:couldn't get %s as parent for gpt\n",
+				__func__, pclk_name);
 		goto err_iomap;
 	}
 
-	clk_set_parent(gpt_clk, pll3_clk);
+	clk_set_parent(gpt_clk, clk);
+
+	ret = clk_enable(gpt_clk);
+	if (ret < 0) {
+		pr_err("%s:couldn't enable gpt clock\n", __func__);
+		goto err_clk;
+	}
 
 	spear_clockevent_init();
 	spear_clocksource_init();
 
 	return;
 
+err_clk:
+	clk_put(gpt_clk);
 err_iomap:
 	iounmap(gpt_base);
-
 err_mem:
 	release_mem_region(SPEAR_GPT0_BASE, SZ_1K);
 }
-
-struct sys_timer spear_sys_timer = {
-	.init = spear_setup_timer,
-};
Signature · 1 line
1.7.2.2
#8 lore raw

PATCH 3/74 ST SPEAr: Formalized timer support

arch/arm/mach-spear3xx/spear3xx.c struct pmx_dev pmx_plgpio_45_46_49_50 = { · line 530

Quoted 5 lines
arch/arm/mach-spear3xx/spear3xx.c +3 -1
-#endif
+static void __init spear3xx_timer_init(void)
+{
+	spear_setup_timer();

why not call it directly?

Quoted 26 lines
arch/arm/mach-spear3xx/spear3xx.c +5 -0
+}
+
+struct sys_timer spear3xx_timer = {
+	.init = spear3xx_timer_init,
+};
arch/arm/mach-spear6xx/include/mach/generic.h +2 -1
index 16205a5..e5967ed 100644
@@ -31,9 +31,10 @@
 /* Add spear6xx family device structure declarations here */
 extern struct amba_device gpio_device[];
 extern struct amba_device uart_device[];
-extern struct sys_timer spear_sys_timer;
+extern struct sys_timer spear6xx_timer;
 
 /* Add spear6xx family function declarations here */
+void __init spear_setup_timer(void);
 void __init spear6xx_map_io(void);
 void __init spear6xx_init_irq(void);
 void __init spear6xx_init(void);
arch/arm/mach-spear6xx/spear600_evb.c +0 -0
index daff8d0..bdd5b76 100644

arch/arm/mach-spear6xx/spear600_evb.c static void __init spear600_evb_init(void) · line 45

Quoted 4 lines
arch/arm/mach-spear6xx/spear600_evb.c +1 -0
@@ -42,10 +42,11 @@ static void __init spear600_evb_init(void)
 		amba_device_register(amba_devs[i], &iomem_resource);
 }
 
+

please remove

Quoted 30 lines
arch/arm/mach-spear6xx/spear600_evb.c +1 -1
 MACHINE_START(SPEAR600, "ST-SPEAR600-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear6xx_map_io,
 	.init_irq	=	spear6xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear6xx_timer,
 	.init_machine	=	spear600_evb_init,
 MACHINE_END
arch/arm/mach-spear6xx/spear6xx.c +9 -0
index baf6bcc..88a82ca 100644
@@ -155,3 +155,12 @@ void __init spear6xx_map_io(void)
 	/* This will initialize clock framework */
 	clk_init();
 }
+
+static void __init spear6xx_timer_init(void)
+{
+	spear_setup_timer();
+}
+
+struct sys_timer spear6xx_timer = {
+	.init = spear6xx_timer_init,
+};
arch/arm/plat-spear/time.c +0 -0
index ab21165..850d0cf 100644

arch/arm/plat-spear/time.c line 74

Quoted 9 lines
arch/arm/plat-spear/time.c +6 -0
@@ -66,6 +66,13 @@
 static __iomem void *gpt_base;
 static struct clk *gpt_clk;
 
+/* following defines the parent clock to be used */
+#ifdef CONFIG_ARCH_SPEAR13XX
+static char pclk_name[] = "osc1_24m_clk";
+#else
+static char pclk_name[] = "pll3_48m_clk";
+#endif

why 2 name?
it will be better to use clkdev and create an alias btw how about move the timer to drivers/clocksource?

Quoted 22 lines
arch/arm/plat-spear/time.c +4 -4
+
 static void clockevent_set_mode(enum clock_event_mode mode,
 				struct clock_event_device *clk_event_dev);
 static int clockevent_next_event(unsigned long evt,
@@ -215,7 +222,8 @@ static void __init spear_clockevent_init(void)
 
 void __init spear_setup_timer(void)
 {
-	struct clk *pll3_clk;
+	struct clk *clk;
+	int ret;
 
 	if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) {
 		pr_err("%s:cannot get IO addr\n", __func__);
@@ -234,26 +242,32 @@ void __init spear_setup_timer(void)
 		goto err_iomap;
 	}
 
-	pll3_clk = clk_get(NULL, "pll3_48m_clk");
-	if (!pll3_clk) {
-		pr_err("%s:couldn't get PLL3 as parent for gpt\n", __func__);
+	/* get the parent clock */

arch/arm/plat-spear/time.c void __init spear_setup_timer(void) · line 254

Quoted 10 lines
arch/arm/plat-spear/time.c +6 -1
+	clk = clk_get(NULL, pclk_name);
+
+	if (!clk) {
+		pr_err("%s:couldn't get %s as parent for gpt\n",
+				__func__, pclk_name);
 		goto err_iomap;
 	}
 
-	clk_set_parent(gpt_clk, pll3_clk);
+	clk_set_parent(gpt_clk, clk);

??
why not do this in the clock file?

Best Regards,
J.

#9 lore raw

PATCH 3/74 ST SPEAr: Formalized timer support

Dear Jean,

Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD

arch/arm/mach-spear3xx/spear3xx.c struct pmx_dev pmx_plgpio_45_46_49_50 = { · line 530

Quoted 5 lines
arch/arm/mach-spear3xx/spear3xx.c +3 -1
-#endif
+static void __init spear3xx_timer_init(void)
+{
+	spear_setup_timer();

why not call it directly?

A single level of abstraction was provided so that if archs (spear3xx/6xx/13xx) required to do something extra.

Quoted 29 lines
Quoted 29 lines
arch/arm/mach-spear3xx/spear3xx.c +5 -0
+}
+
+struct sys_timer spear3xx_timer = {
+	.init = spear3xx_timer_init,
+};
arch/arm/mach-spear6xx/include/mach/generic.h +2 -1
index 16205a5..e5967ed 100644
@@ -31,9 +31,10 @@
 /* Add spear6xx family device structure declarations here */
 extern struct amba_device gpio_device[];
 extern struct amba_device uart_device[];
-extern struct sys_timer spear_sys_timer;
+extern struct sys_timer spear6xx_timer;
 
 /* Add spear6xx family function declarations here */
+void __init spear_setup_timer(void);
 void __init spear6xx_map_io(void);
 void __init spear6xx_init_irq(void);
 void __init spear6xx_init(void);
arch/arm/mach-spear6xx/spear600_evb.c +0 -0
index daff8d0..bdd5b76 100644
@@ -42,10 +42,11 @@ static void __init spear600_evb_init(void)
 		amba_device_register(amba_devs[i], &iomem_resource);
 }
 
Quoted 2 lines

arch/arm/mach-spear6xx/spear600_evb.c static void __init spear600_evb_init(void) · line 45

Quoted 1 line
arch/arm/mach-spear6xx/spear600_evb.c +1 -0
+

please remove

OK

Quoted 33 lines
Quoted 33 lines
arch/arm/mach-spear6xx/spear600_evb.c +1 -1
 MACHINE_START(SPEAR600, "ST-SPEAR600-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear6xx_map_io,
 	.init_irq	=	spear6xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear6xx_timer,
 	.init_machine	=	spear600_evb_init,
 MACHINE_END
arch/arm/mach-spear6xx/spear6xx.c +9 -0
index baf6bcc..88a82ca 100644
@@ -155,3 +155,12 @@ void __init spear6xx_map_io(void)
 	/* This will initialize clock framework */
 	clk_init();
 }
+
+static void __init spear6xx_timer_init(void)
+{
+	spear_setup_timer();
+}
+
+struct sys_timer spear6xx_timer = {
+	.init = spear6xx_timer_init,
+};
arch/arm/plat-spear/time.c +0 -0
index ab21165..850d0cf 100644
@@ -66,6 +66,13 @@
 static __iomem void *gpt_base;
 static struct clk *gpt_clk;
 
Quoted 7 lines

arch/arm/plat-spear/time.c line 74

Quoted 6 lines
arch/arm/plat-spear/time.c +6 -0
+/* following defines the parent clock to be used */
+#ifdef CONFIG_ARCH_SPEAR13XX
+static char pclk_name[] = "osc1_24m_clk";
+#else
+static char pclk_name[] = "pll3_48m_clk";
+#endif

why 2 name?

spear13xx has different parent clock for gpt than spear3xx/6xx.

Quoted 1 line

it will be better to use clkdev and create an alias

This is specifically to chose parent clock, which can be different in different architectures. clkdev corresponding to parent clock is already defined. We use name here to get the clock.

Quoted 1 line

btw how about move the timer to drivers/clocksource?

I don't know whether this is the right place. Every body else has placed timer code in his respective mach/plat directory.

Quoted 30 lines
Quoted 30 lines
arch/arm/plat-spear/time.c +9 -4
+
 static void clockevent_set_mode(enum clock_event_mode mode,
 				struct clock_event_device *clk_event_dev);
 static int clockevent_next_event(unsigned long evt,
@@ -215,7 +222,8 @@ static void __init spear_clockevent_init(void)
 
 void __init spear_setup_timer(void)
 {
-	struct clk *pll3_clk;
+	struct clk *clk;
+	int ret;
 
 	if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) {
 		pr_err("%s:cannot get IO addr\n", __func__);
@@ -234,26 +242,32 @@ void __init spear_setup_timer(void)
 		goto err_iomap;
 	}
 
-	pll3_clk = clk_get(NULL, "pll3_48m_clk");
-	if (!pll3_clk) {
-		pr_err("%s:couldn't get PLL3 as parent for gpt\n", __func__);
+	/* get the parent clock */
+	clk = clk_get(NULL, pclk_name);
+
+	if (!clk) {
+		pr_err("%s:couldn't get %s as parent for gpt\n",
+				__func__, pclk_name);
 		goto err_iomap;
 	}
 
Quoted 4 lines

arch/arm/plat-spear/time.c void __init spear_setup_timer(void) · line 254

Quoted 2 lines
arch/arm/plat-spear/time.c +1 -1
-	clk_set_parent(gpt_clk, pll3_clk);
+	clk_set_parent(gpt_clk, clk);

??
why not do this in the clock file?

The functional clock of the timer very much depends on the parent clock it selects. This is a part of the timer itself, hence it is kept here.

regards
Shiraz

#10 lore raw

PATCH 3/74 ST SPEAr: Formalized timer support

Quoted 4 lines · Shiraz Hashim

Dear Jean,

Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line
Quoted 8 lines
Quoted 5 lines

arch/arm/mach-spear3xx/spear3xx.c struct pmx_dev pmx_plgpio_45_46_49_50 = { · line 530

Quoted 4 lines
arch/arm/mach-spear3xx/spear3xx.c +3 -1
-#endif
+static void __init spear3xx_timer_init(void)
+{
+	spear_setup_timer();

why not call it directly?

A single level of abstraction was provided so that if archs (spear3xx/6xx/13xx) required to do something extra.

it does not seems to be needed at all so for now call it directly is enough

Quoted 9 lines
Quoted 7 lines

arch/arm/plat-spear/time.c line 74

Quoted 6 lines
arch/arm/plat-spear/time.c +6 -0
+/* following defines the parent clock to be used */
+#ifdef CONFIG_ARCH_SPEAR13XX
+static char pclk_name[] = "osc1_24m_clk";
+#else
+static char pclk_name[] = "pll3_48m_clk";
+#endif

why 2 name?

spear13xx has different parent clock for gpt than spear3xx/6xx.

so use a generic name which will be an alias specify on the soc clock so here no need to do the ifdef specially if you want to support both of them in the same kernel

Quoted 42 lines
Quoted 2 lines

it will be better to use clkdev and create an alias

This is specifically to chose parent clock, which can be different in different architectures. clkdev corresponding to parent clock is already defined. We use name here to get the clock.

Quoted 1 line

btw how about move the timer to drivers/clocksource?

I don't know whether this is the right place. Every body else has placed timer code in his respective mach/plat directory.

Quoted 30 lines
Quoted 30 lines
arch/arm/plat-spear/time.c +9 -4
+
 static void clockevent_set_mode(enum clock_event_mode mode,
 				struct clock_event_device *clk_event_dev);
 static int clockevent_next_event(unsigned long evt,
@@ -215,7 +222,8 @@ static void __init spear_clockevent_init(void)
 
 void __init spear_setup_timer(void)
 {
-	struct clk *pll3_clk;
+	struct clk *clk;
+	int ret;
 
 	if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) {
 		pr_err("%s:cannot get IO addr\n", __func__);
@@ -234,26 +242,32 @@ void __init spear_setup_timer(void)
 		goto err_iomap;
 	}
 
-	pll3_clk = clk_get(NULL, "pll3_48m_clk");
-	if (!pll3_clk) {
-		pr_err("%s:couldn't get PLL3 as parent for gpt\n", __func__);
+	/* get the parent clock */
+	clk = clk_get(NULL, pclk_name);
+
+	if (!clk) {
+		pr_err("%s:couldn't get %s as parent for gpt\n",
+				__func__, pclk_name);
 		goto err_iomap;
 	}
 
Quoted 7 lines
Quoted 4 lines

arch/arm/plat-spear/time.c void __init spear_setup_timer(void) · line 254

Quoted 2 lines
arch/arm/plat-spear/time.c +1 -1
-	clk_set_parent(gpt_clk, pll3_clk);
+	clk_set_parent(gpt_clk, clk);

??
why not do this in the clock file?

The functional clock of the timer very much depends on the parent clock it selects. This is a part of the timer itself, hence it is kept here.

it's seems to be more soc depends than timer

Best Regards,
J.

#11 lore raw

PATCH 3/74 ST SPEAr: Formalized timer support

Dear Jean,

Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines · Shiraz Hashim

Dear Jean,

Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD

arch/arm/mach-spear3xx/spear3xx.c struct pmx_dev pmx_plgpio_45_46_49_50 = { · line 530

Quoted 5 lines
arch/arm/mach-spear3xx/spear3xx.c +3 -1
-#endif
+static void __init spear3xx_timer_init(void)
+{
+	spear_setup_timer();

why not call it directly?

Quoted 5 lines
Quoted 2 lines

A single level of abstraction was provided so that if archs (spear3xx/6xx/13xx) required to do something extra.

it does not seems to be needed at all so for now call it directly is enough

OK. So, I think what could be better is to set the parent clock of the gpt in the arch specific function like spear3xx_timer_init. This would also remove this part from the timer code.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

arch/arm/plat-spear/time.c line 74

Quoted 6 lines
arch/arm/plat-spear/time.c +6 -0
+/* following defines the parent clock to be used */
+#ifdef CONFIG_ARCH_SPEAR13XX
+static char pclk_name[] = "osc1_24m_clk";
+#else
+static char pclk_name[] = "pll3_48m_clk";
+#endif

why 2 name?

Quoted 4 lines
Quoted 1 line

spear13xx has different parent clock for gpt than spear3xx/6xx.

so use a generic name which will be an alias specify on the soc clock so here no need to do the ifdef specially if you want to support both of them in the same kernel

As described above would move the parent clock selection to the respective timer init function for archs. Would that be fine ?

Quoted 42 lines
Quoted 42 lines
Quoted 2 lines

it will be better to use clkdev and create an alias

This is specifically to chose parent clock, which can be different in different architectures. clkdev corresponding to parent clock is already defined. We use name here to get the clock.

Quoted 1 line

btw how about move the timer to drivers/clocksource?

I don't know whether this is the right place. Every body else has placed timer code in his respective mach/plat directory.

Quoted 30 lines
Quoted 30 lines
arch/arm/plat-spear/time.c +9 -4
+
 static void clockevent_set_mode(enum clock_event_mode mode,
 				struct clock_event_device *clk_event_dev);
 static int clockevent_next_event(unsigned long evt,
@@ -215,7 +222,8 @@ static void __init spear_clockevent_init(void)
 
 void __init spear_setup_timer(void)
 {
-	struct clk *pll3_clk;
+	struct clk *clk;
+	int ret;
 
 	if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) {
 		pr_err("%s:cannot get IO addr\n", __func__);
@@ -234,26 +242,32 @@ void __init spear_setup_timer(void)
 		goto err_iomap;
 	}
 
-	pll3_clk = clk_get(NULL, "pll3_48m_clk");
-	if (!pll3_clk) {
-		pr_err("%s:couldn't get PLL3 as parent for gpt\n", __func__);
+	/* get the parent clock */
+	clk = clk_get(NULL, pclk_name);
+
+	if (!clk) {
+		pr_err("%s:couldn't get %s as parent for gpt\n",
+				__func__, pclk_name);
 		goto err_iomap;
 	}
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

arch/arm/plat-spear/time.c void __init spear_setup_timer(void) · line 254

Quoted 2 lines
arch/arm/plat-spear/time.c +1 -1
-	clk_set_parent(gpt_clk, pll3_clk);
+	clk_set_parent(gpt_clk, clk);

??
why not do this in the clock file?

Better to be done in timer init function of respective archs like spear3xx_timer_init

Quoted 6 lines
Quoted 3 lines

The functional clock of the timer very much depends on the parent clock it selects. This is a part of the timer itself, hence it is kept here.

it's seems to be more soc depends than timer

yes, OK, would above solution be fine.

regards
Shiraz

#12 lore raw

PATCH 3/74 ST SPEAr: Formalized timer support

Quoted 17 lines · Shiraz Hashim

Dear Jean,

Quoted 14 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Shiraz Hashim

Dear Jean,

Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD

arch/arm/mach-spear3xx/spear3xx.c struct pmx_dev pmx_plgpio_45_46_49_50 = { · line 530

Quoted 5 lines
arch/arm/mach-spear3xx/spear3xx.c +3 -1
-#endif
+static void __init spear3xx_timer_init(void)
+{
+	spear_setup_timer();

why not call it directly?

A single level of abstraction was provided so that if archs (spear3xx/6xx/13xx) required to do something extra.

Quoted 6 lines
Quoted 2 lines

it does not seems to be needed at all so for now call it directly is enough

OK. So, I think what could be better is to set the parent clock of the gpt in the arch specific function like spear3xx_timer_init. This would also remove this part from the timer code.

ok

Best Regards,
J.

#13 lore raw

PATCH 3/74 ST SPEAr: Formalized timer support

In reply to Shiraz Hashim
Quoted 4 lines · Shiraz Hashim

Dear Jean,

Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line
Quoted 8 lines
Quoted 5 lines

arch/arm/mach-spear3xx/spear3xx.c struct pmx_dev pmx_plgpio_45_46_49_50 = { · line 530

Quoted 4 lines
arch/arm/mach-spear3xx/spear3xx.c +3 -1
-#endif
+static void __init spear3xx_timer_init(void)
+{
+	spear_setup_timer();

why not call it directly?

A single level of abstraction was provided so that if archs (spear3xx/6xx/13xx) required to do something extra.

Please don't build abstraction layers on top of abstraction layers. Use what's already provided instead.

#14 lore raw

PATCH 4/74 ST SPEAr13XX: Adding machine specific header files

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

---
 arch/arm/mach-spear13xx/include/mach/clkdev.h      |   19 ++
 arch/arm/mach-spear13xx/include/mach/debug-macro.S |   14 +
 arch/arm/mach-spear13xx/include/mach/entry-macro.S |   88 ++++++
 arch/arm/mach-spear13xx/include/mach/generic.h     |   46 +++
 arch/arm/mach-spear13xx/include/mach/gpio.h        |   19 ++
 arch/arm/mach-spear13xx/include/mach/hardware.h    |   25 ++
 arch/arm/mach-spear13xx/include/mach/io.h          |   19 ++
 arch/arm/mach-spear13xx/include/mach/irqs.h        |   91 ++++++
 arch/arm/mach-spear13xx/include/mach/memory.h      |   19 ++
 arch/arm/mach-spear13xx/include/mach/misc_regs.h   |  301 ++++++++++++++++++++
 arch/arm/mach-spear13xx/include/mach/smp.h         |   33 +++
 arch/arm/mach-spear13xx/include/mach/spear.h       |   93 ++++++
 arch/arm/mach-spear13xx/include/mach/spear1300.h   |   21 ++
 arch/arm/mach-spear13xx/include/mach/system.h      |   43 +++
 arch/arm/mach-spear13xx/include/mach/timex.h       |   19 ++
 arch/arm/mach-spear13xx/include/mach/uncompress.h  |   19 ++
 arch/arm/mach-spear13xx/include/mach/vmalloc.h     |   18 ++
 17 files changed, 887 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-spear13xx/include/mach/clkdev.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/debug-macro.S
 create mode 100644 arch/arm/mach-spear13xx/include/mach/entry-macro.S
 create mode 100644 arch/arm/mach-spear13xx/include/mach/generic.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/gpio.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/hardware.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/io.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/irqs.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/memory.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/misc_regs.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/smp.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/spear.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/spear1300.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/system.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/timex.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/uncompress.h
 create mode 100644 arch/arm/mach-spear13xx/include/mach/vmalloc.h
arch/arm/mach-spear13xx/include/mach/clkdev.h new file +19 -0
new file mode 100644
index 0000000..effdb81
@@ -0,0 +1,19 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/clkdev.h
+ *
+ * Clock Dev framework definitions for spear13xx machine family
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_CLKDEV_H
+#define __MACH_CLKDEV_H
+
+#include <plat/clkdev.h>
+
+#endif /* __MACH_CLKDEV_H */
arch/arm/mach-spear13xx/include/mach/debug-macro.S new file +14 -0
new file mode 100644
index 0000000..3933edc
@@ -0,0 +1,14 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/debug-macro.S
+ *
+ * Debugging macro include header spear13xx machine family
+ *
+ * Copyright (C) 2009 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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.
+ */
+
+#include <plat/debug-macro.S>
arch/arm/mach-spear13xx/include/mach/entry-macro.S new file +88 -0

88 lines not on this page · raw message

arch/arm/mach-spear13xx/include/mach/generic.h new file +46 -0

46 lines not on this page · raw message

arch/arm/mach-spear13xx/include/mach/gpio.h new file +19 -0
new file mode 100644
index 0000000..43fa541
@@ -0,0 +1,19 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/gpio.h
+ *
+ * GPIO macros for spear13xx machine family
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_GPIO_H
+#define __MACH_GPIO_H
+
+#include <plat/gpio.h>
+
+#endif /* __MACH_GPIO_H */
arch/arm/mach-spear13xx/include/mach/hardware.h new file +25 -0
new file mode 100644
index 0000000..0047d75
@@ -0,0 +1,25 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/hardware.h
+ *
+ * Hardware definitions for spear13xx machine family
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_HARDWARE_H
+#define __MACH_HARDWARE_H
+
+#include <mach/spear.h>
+
+/* Vitual to physical translation of statically mapped space */
+#define IO_ADDRESS(x)		(x | 0xF0000000)
+
+/* typesafe io address */
+#define __io_address(n)		__io(IO_ADDRESS(n))
+
+#endif /* __MACH_HARDWARE_H */
arch/arm/mach-spear13xx/include/mach/io.h new file +19 -0
new file mode 100644
index 0000000..2fe3503
@@ -0,0 +1,19 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/io.h
+ *
+ * IO definitions for spear13xx machine family
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_IO_H
+#define __MACH_IO_H
+
+#include <plat/io.h>
+
+#endif /* __MACH_IO_H */
arch/arm/mach-spear13xx/include/mach/irqs.h new file +91 -0

91 lines not on this page · raw message

arch/arm/mach-spear13xx/include/mach/memory.h new file +19 -0
new file mode 100644
index 0000000..200257c
@@ -0,0 +1,19 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/memory.h
+ *
+ * Memory map for spear13xx machine family
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_MEMORY_H
+#define __MACH_MEMORY_H
+
+#include <plat/memory.h>
+
+#endif /* __MACH_MEMORY_H */
arch/arm/mach-spear13xx/include/mach/misc_regs.h new file +301 -0

301 lines not on this page · raw message

arch/arm/mach-spear13xx/include/mach/smp.h new file +33 -0
new file mode 100644
index 0000000..6e028a1
@@ -0,0 +1,33 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/smp.h
+ *
+ * Few SMP related definitions for spear13xx machine family
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_SMP_H
+#define __MACH_SMP_H
+
+#include <asm/hardware/gic.h>
+
+#define hard_smp_processor_id()			\
+	({						\
+		unsigned int cpunum;			\
+		__asm__("mrc p15, 0, %0, c0, c0, 5"	\
+			: "=r" (cpunum));		\
+		cpunum &= 0x0F;				\
+	})
+
+/* We use IRQ1 as the IPI */
+static inline void smp_cross_call(const struct cpumask *mask)
+{
+	gic_raise_softirq(mask, 1);
+}
+
+#endif
arch/arm/mach-spear13xx/include/mach/spear.h new file +93 -0

93 lines not on this page · raw message

arch/arm/mach-spear13xx/include/mach/spear1300.h new file +21 -0
new file mode 100644
index 0000000..b3ba267
@@ -0,0 +1,21 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/spear1300.h
+ *
+ * SPEAr1300 Machine specific definition
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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.
+ */
+
+#ifdef	CONFIG_MACH_SPEAR1300
+
+#ifndef __MACH_SPEAR1300_H
+#define __MACH_SPEAR1300_H
+
+#endif /* __MACH_SPEAR1300_H */
+
+#endif /* CONFIG_MACH_SPEAR1300 */
arch/arm/mach-spear13xx/include/mach/system.h new file +43 -0

43 lines not on this page · raw message

arch/arm/mach-spear13xx/include/mach/timex.h new file +19 -0
new file mode 100644
index 0000000..0a81490
@@ -0,0 +1,19 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/timex.h
+ *
+ * spear13xx machine family specific timex definitions
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_TIMEX_H
+#define __MACH_TIMEX_H
+
+#define CLOCK_TICK_RATE			24000000
+
+#endif /* __MACH_TIMEX_H */
arch/arm/mach-spear13xx/include/mach/uncompress.h new file +19 -0
new file mode 100644
index 0000000..3c27f25
@@ -0,0 +1,19 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/uncompress.h
+ *
+ * Serial port stubs for kernel decompress status messages
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_UNCOMPRESS_H
+#define __MACH_UNCOMPRESS_H
+
+#include <plat/uncompress.h>
+
+#endif /* __MACH_UNCOMPRESS_H */
arch/arm/mach-spear13xx/include/mach/vmalloc.h new file +18 -0
new file mode 100644
index 0000000..85ad57e
@@ -0,0 +1,18 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/vmalloc.h
+ *
+ * Defining Vmalloc area for spear13xx machine family
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ *
+ * 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_VMALLOC_H
+#define __MACH_VMALLOC_H
+
+#include <plat/vmalloc.h>
+
+#endif /* __MACH_VMALLOC_H */
Signature · 1 line
1.7.2.2
#15 lore raw

PATCH 4/74 ST SPEAr13XX: Adding machine specific header files

arch/arm/mach-spear13xx/include/mach/generic.h line 21

Quoted 8 lines · Viresh KUMAR
arch/arm/mach-spear13xx/include/mach/generic.h new file +8 -0
+#ifndef __MACH_GENERIC_H
+#define __MACH_GENERIC_H
+
+#include <asm/mach/time.h>
+#include <asm/mach/map.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/amba/bus.h>

linux/ before asm/ please.

arch/arm/mach-spear13xx/include/mach/hardware.h line 23

Quoted 10 lines
arch/arm/mach-spear13xx/include/mach/hardware.h new file +10 -0
+#ifndef __MACH_HARDWARE_H
+#define __MACH_HARDWARE_H
+
+#include <mach/spear.h>
+
+/* Vitual to physical translation of statically mapped space */
+#define IO_ADDRESS(x)		(x | 0xF0000000)
+
+/* typesafe io address */
+#define __io_address(n)		__io(IO_ADDRESS(n))

Wrong use of __io(). __io() is just a macro for asm/io.h to make use of, and in any case should be defined in your mach/io.h file.

Quoted 28 lines
arch/arm/mach-spear13xx/include/mach/system.h new file +22 -0
new file mode 100644
index 0000000..6ce0819
@@ -0,0 +1,43 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/system.h
+ *
+ * spear13xx Machine family specific architecture functions
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_SYSTEM_H
+#define __MACH_SYSTEM_H
+
+#include <linux/io.h>
+#include <mach/hardware.h>
+#include <mach/misc_regs.h>
+
+static inline void arch_idle(void)
+{

arch/arm/mach-spear13xx/include/mach/system.h line 32

Quoted 10 lines
arch/arm/mach-spear13xx/include/mach/system.h new file +10 -0
+	/*
+	 * This should do all the clock switching
+	 * and wait for interrupt tricks
+	 */
+	cpu_do_idle();
+}
+
+static inline void arch_reset(char mode, const char *cmd)
+{
+	pr_info("Going to reboot...\n");

The kernel already prints a message for reboot, so this is superfluous.

#16 lore raw

PATCH 4/74 ST SPEAr13XX: Adding machine specific header files

Hello Russel,

Quoted 12 lines · Russell King - ARM Linux

arch/arm/mach-spear13xx/include/mach/generic.h line 21

Quoted 8 lines · Viresh KUMAR
arch/arm/mach-spear13xx/include/mach/generic.h new file +8 -0
+#ifndef __MACH_GENERIC_H
+#define __MACH_GENERIC_H
+
+#include <asm/mach/time.h>
+#include <asm/mach/map.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/amba/bus.h>

linux/ before asm/ please.

OK, would correct it.

Quoted 5 lines
Quoted 5 lines
arch/arm/mach-spear13xx/include/mach/hardware.h new file +5 -0
+#ifndef __MACH_HARDWARE_H
+#define __MACH_HARDWARE_H
+
+#include <mach/spear.h>
+
Quoted 8 lines

arch/arm/mach-spear13xx/include/mach/hardware.h line 23

Quoted 5 lines
arch/arm/mach-spear13xx/include/mach/hardware.h new file +5 -0
+/* Vitual to physical translation of statically mapped space */
+#define IO_ADDRESS(x)		(x | 0xF0000000)
+
+/* typesafe io address */
+#define __io_address(n)		__io(IO_ADDRESS(n))

Wrong use of __io(). __io() is just a macro for asm/io.h to make use of, and in any case should be defined in your mach/io.h file.

__io is defined in plat/io.h which is included in mach/io.h. I see other machs (ux500, realview, versatile) also defining __io_address like this for typesafe access. Is it wrong ?

Quoted 33 lines
Quoted 33 lines
arch/arm/mach-spear13xx/include/mach/system.h new file +27 -0
new file mode 100644
index 0000000..6ce0819
@@ -0,0 +1,43 @@
+/*
+ * arch/arm/mach-spear13xx/include/mach/system.h
+ *
+ * spear13xx Machine family specific architecture functions
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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_SYSTEM_H
+#define __MACH_SYSTEM_H
+
+#include <linux/io.h>
+#include <mach/hardware.h>
+#include <mach/misc_regs.h>
+
+static inline void arch_idle(void)
+{
+	/*
+	 * This should do all the clock switching
+	 * and wait for interrupt tricks
+	 */
+	cpu_do_idle();
Quoted 8 lines

arch/arm/mach-spear13xx/include/mach/system.h line 32

Quoted 5 lines
arch/arm/mach-spear13xx/include/mach/system.h new file +5 -0
+}
+
+static inline void arch_reset(char mode, const char *cmd)
+{
+	pr_info("Going to reboot...\n");

The kernel already prints a message for reboot, so this is superfluous. .

OK, would remove this.

regards
Shiraz

#17 lore raw

PATCH 5/74 ST SPEAr13XX: Adding machine specific src files

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

---
 arch/arm/mach-spear13xx/Kconfig         |   21 ++
 arch/arm/mach-spear13xx/Kconfig1300     |   17 ++
 arch/arm/mach-spear13xx/Makefile        |   14 ++
 arch/arm/mach-spear13xx/Makefile.boot   |    3 +
 arch/arm/mach-spear13xx/clock.c         |  352 +++++++++++++++++++++++++++++++
 arch/arm/mach-spear13xx/headsmp.S       |   95 +++++++++
 arch/arm/mach-spear13xx/localtimer.c    |   25 +++
 arch/arm/mach-spear13xx/platsmp.c       |  203 ++++++++++++++++++
 arch/arm/mach-spear13xx/spear1300.c     |   23 ++
 arch/arm/mach-spear13xx/spear1300_evb.c |   48 +++++
 arch/arm/mach-spear13xx/spear13xx.c     |   98 +++++++++
 11 files changed, 899 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-spear13xx/Kconfig
 create mode 100644 arch/arm/mach-spear13xx/Kconfig1300
 create mode 100644 arch/arm/mach-spear13xx/Makefile
 create mode 100644 arch/arm/mach-spear13xx/Makefile.boot
 create mode 100644 arch/arm/mach-spear13xx/clock.c
 create mode 100644 arch/arm/mach-spear13xx/headsmp.S
 create mode 100644 arch/arm/mach-spear13xx/localtimer.c
 create mode 100644 arch/arm/mach-spear13xx/platsmp.c
 create mode 100644 arch/arm/mach-spear13xx/spear1300.c
 create mode 100644 arch/arm/mach-spear13xx/spear1300_evb.c
 create mode 100644 arch/arm/mach-spear13xx/spear13xx.c
arch/arm/mach-spear13xx/Kconfig new file +21 -0
new file mode 100644
index 0000000..e285d87
@@ -0,0 +1,21 @@
+#
+# SPEAr13XX Machine configuration file
+#
+
+if ARCH_SPEAR13XX
+
+choice
+	prompt "SPEAr13XX Family"
+	default MACH_SPEAR1300
+
+config MACH_SPEAR1300
+	bool "SPEAr1300"
+	help
+	  Supports ST SPEAr1300 Machine
+
+endchoice
+
+# Adding SPEAr13XX machine specific configuration files
+source "arch/arm/mach-spear13xx/Kconfig1300"
+
+endif #ARCH_SPEAR13XX
arch/arm/mach-spear13xx/Kconfig1300 new file +17 -0
new file mode 100644
index 0000000..5d6feb1
@@ -0,0 +1,17 @@
+#
+# SPEAr1300 machine configuration file
+#
+
+if MACH_SPEAR1300
+
+choice
+	prompt "SPEAr1300 Boards"
+	default BOARD_SPEAR1300_EVB
+
+config BOARD_SPEAR1300_EVB
+	bool "SPEAr1300 Evaluation Board"
+	help
+	  Supports ST SPEAr1300 Evaluation Board
+endchoice
+
+endif #MACH_SPEAR1300
arch/arm/mach-spear13xx/Makefile new file +14 -0
new file mode 100644
index 0000000..cb5ae9e
@@ -0,0 +1,14 @@
+#
+# Makefile for SPEAr13XX machine series
+#
+
+# common files
+obj-y					+= spear13xx.o clock.o
+obj-$(CONFIG_SMP)			+= platsmp.o headsmp.o
+obj-$(CONFIG_LOCAL_TIMERS)		+= localtimer.o
+
+# spear1300 specific files
+obj-$(CONFIG_MACH_SPEAR1300)		+= spear1300.o
+
+# spear1300 boards files
+obj-$(CONFIG_BOARD_SPEAR1300_EVB)	+= spear1300_evb.o
arch/arm/mach-spear13xx/Makefile.boot new file +3 -0
new file mode 100644
index 0000000..7a1f3c0
@@ -0,0 +1,3 @@
+zreladdr-y	:= 0x00008000
+params_phys-y	:= 0x00000100
+initrd_phys-y	:= 0x00800000
arch/arm/mach-spear13xx/clock.c new file +352 -0

352 lines not on this page · raw message

arch/arm/mach-spear13xx/headsmp.S new file +95 -0

95 lines not on this page · raw message

arch/arm/mach-spear13xx/localtimer.c new file +25 -0
new file mode 100644
index 0000000..816b08c
@@ -0,0 +1,25 @@
+/*
+ * arch/arm/mach-spear13xx/localtimer.c
+ * Directly picked from realview
+ *
+ * Copyright (C) 2010 ST Microelectronics Ltd.
+ * Shiraz Hashim <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/clockchips.h>
+#include <asm/irq.h>
+#include <asm/smp_twd.h>
+#include <asm/localtimer.h>
+
+/* Setup the local clock events for a CPU. */
+void __cpuinit local_timer_setup(struct clock_event_device *evt)
+{
+	evt->irq = IRQ_LOCALTIMER;
+	twd_timer_setup(evt);
+}
arch/arm/mach-spear13xx/platsmp.c new file +203 -0

203 lines not on this page · raw message

arch/arm/mach-spear13xx/spear1300.c new file +23 -0
new file mode 100644
index 0000000..c1b82f1
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-spear13xx/spear1300.c
+ *
+ * SPEAr1300 machine source file
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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.
+ */
+
+#include <mach/generic.h>
+#include <mach/spear.h>
+
+/* Add spear1300 specific devices here */
+
+void __init spear1300_init(void)
+{
+	/* call spear13xx family common init function */
+	spear13xx_init();
+}
arch/arm/mach-spear13xx/spear1300_evb.c new file +48 -0

48 lines not on this page · raw message

arch/arm/mach-spear13xx/spear13xx.c new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#18 lore raw

PATCH 5/74 ST SPEAr13XX: Adding machine specific src files

Quoted 24 lines · Viresh KUMAR
arch/arm/mach-spear13xx/platsmp.c new file +18 -0
new file mode 100644
index 0000000..8b75d1b
@@ -0,0 +1,203 @@
+/*
+ * arch/arm/mach-spear13xx/platsmp.c
+ *
+ * based upon linux/arch/arm/mach-realview/platsmp.c
+ *
+ * Copyright (C) 2010 ST Microelectronics Ltd.
+ * Shiraz Hashim <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <asm/cacheflush.h>
+#include <asm/hardware/gic.h>
+#include <asm/localtimer.h>
+#include <asm/mach-types.h>
+#include <asm/smp_scu.h>

arch/arm/mach-spear13xx/platsmp.c line 28

Quoted 10 lines
arch/arm/mach-spear13xx/platsmp.c new file +10 -0
+#include <asm/unified.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/smp.h>
+#include <mach/generic.h>
+#include <mach/hardware.h>

linux/ before asm/ before mach/ please.

Quoted 62 lines
arch/arm/mach-spear13xx/platsmp.c new file +62 -0
+
+/*
+ * control for which core is the next to come out of the secondary
+ * boot "holding pen"
+ */
+volatile int __cpuinitdata pen_release = -1;
+static DEFINE_SPINLOCK(boot_lock);
+
+static void __iomem *scu_base_addr(void)
+{
+	return __io_address(SPEAR13XX_SCU_BASE);
+}
+
+static inline unsigned int get_core_count(void)
+{
+	void __iomem *scu_base = scu_base_addr();
+
+	if (scu_base)
+		return scu_get_core_count(scu_base);
+	return 1;
+}
+
+void __cpuinit platform_secondary_init(unsigned int cpu)
+{
+	trace_hardirqs_off();
+
+	/*
+	 * if any interrupts are already enabled for the primary
+	 * core (e.g. timer irq), then they will not have been enabled
+	 * for us: do so
+	 */
+	gic_cpu_init(0, __io_address(SPEAR13XX_GIC_CPU_BASE));
+
+	/*
+	 * let the primary processor know we're out of the
+	 * pen, then head off into the C entry point
+	 */
+	pen_release = -1;
+	smp_wmb();
+
+	/*
+	 * Synchronise with the boot thread.
+	 */
+	spin_lock(&boot_lock);
+	spin_unlock(&boot_lock);
+}
+
+int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	unsigned long timeout;
+
+	/*
+	 * set synchronisation state between this boot processor
+	 * and the secondary one
+	 */
+	spin_lock(&boot_lock);
+
+	/*
+	 * The secondary processor is waiting to be released from
+	 * the holding pen - release it, then wait for it to flag
+	 * that it has been released by resetting pen_release.
+	 *

arch/arm/mach-spear13xx/platsmp.c line 100

Quoted 10 lines
arch/arm/mach-spear13xx/platsmp.c new file +10 -0
+	 * Note that "pen_release" is the hardware CPU ID, whereas
+	 * "cpu" is Linux's internal ID.
+	 */
+
+	/*
+	 * Note: Following is important otherwise cpu2 doesn't come up
+	 * as secondary_data must be flushed before pen_release also
+	 */
+
+	flush_cache_all();

You don't need this. secondary_data is already taken care of as of a few kernel releases ago.

Quoted 25 lines
arch/arm/mach-spear13xx/platsmp.c new file +25 -0
+	pen_release = cpu;
+	flush_cache_all();
+
+	timeout = jiffies + (1 * HZ);
+	while (time_before(jiffies, timeout)) {
+		smp_rmb();
+		if (pen_release == -1)
+			break;
+
+		udelay(10);
+	}
+
+	/*
+	 * now the secondary core is starting up let it run its
+	 * calibrations, then wait for it to finish
+	 */
+	spin_unlock(&boot_lock);
+
+	return pen_release != -1 ? -ENOSYS : 0;
+}
+
+static void __init poke_milo(void)
+{
+	/* nobody is to be released from the pen yet */
+	pen_release = -1;

arch/arm/mach-spear13xx/platsmp.c line 135

Quoted 10 lines
arch/arm/mach-spear13xx/platsmp.c new file +10 -0
+
+	/*
+	 * Write the address of secondary startup into the system-wide
+	 * location (presently it is in SRAM). The BootMonitor waits
+	 * for this register to become non-zero.
+	 */
+	__raw_writel(BSYM(virt_to_phys(spear13xx_secondary_startup)),
+			__io_address(SPEAR13XX_SYS_LOCATION));
+
+	mb();

Please get rid of this function. You don't have milo, and milo is pretty much dead anyway. Please read the Versatile Express SMP code and base your version off that (cleaned up) version instead.

Quoted 171 lines
arch/arm/mach-spear13xx/platsmp.c new file +68 -0
+}
+
+/*
+ * Initialise the CPU possible map early - this describes the CPUs
+ * which may be present or become present in the system.
+ */
+void __init smp_init_cpus(void)
+{
+	unsigned int i, ncores = get_core_count();
+
+	for (i = 0; i < ncores; i++)
+		set_cpu_possible(i, true);
+}
+
+void __init smp_prepare_cpus(unsigned int max_cpus)
+{
+	unsigned int ncores = get_core_count();
+	unsigned int cpu = smp_processor_id();
+	int i;
+
+	/* sanity check */
+	if (ncores == 0) {
+		pr_err("Realview: strange CM count of 0? Default to 1\n");
+
+		ncores = 1;
+	}
+
+	if (ncores > num_possible_cpus()) {
+		ncores = num_possible_cpus();
+		pr_err(
+		       "spear13xx: no. of cores (%d) greater than configured "
+		       "maximum of %d - clipping\n",
+		       ncores, ncores);
+	}
+
+	smp_store_cpu_info(cpu);
+
+	/*
+	 * are we trying to boot more cores than exist?
+	 */
+	if (max_cpus > ncores)
+		max_cpus = ncores;
+
+	/*
+	 * Initialise the present map, which describes the set of CPUs
+	 * actually populated at the present time.
+	 */
+	for (i = 0; i < max_cpus; i++)
+		set_cpu_present(i, true);
+
+	/*
+	 * Initialise the SCU if there are more than one CPU and let
+	 * them know where to start. Note that, on modern versions of
+	 * MILO, the "poke" doesn't actually do anything until each
+	 * individual core is sent a soft interrupt to get it out of
+	 * WFI
+	 */
+	if (max_cpus > 1) {
+		/*
+		 * Enable the local timer or broadcast device for the
+		 * boot CPU, but only if we have more than one CPU.
+		 */
+		percpu_timer_setup();
+
+		scu_enable(scu_base_addr());
+		poke_milo();
+	}
+}
arch/arm/mach-spear13xx/spear1300.c new file +23 -0
new file mode 100644
index 0000000..c1b82f1
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-spear13xx/spear1300.c
+ *
+ * SPEAr1300 machine source file
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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.
+ */
+
+#include <mach/generic.h>
+#include <mach/spear.h>
+
+/* Add spear1300 specific devices here */
+
+void __init spear1300_init(void)
+{
+	/* call spear13xx family common init function */
+	spear13xx_init();
+}
arch/arm/mach-spear13xx/spear1300_evb.c new file +48 -0
new file mode 100644
index 0000000..d72c8a8
@@ -0,0 +1,48 @@
+/*
+ * arch/arm/mach-spear13xx/spear1300_evb.c
+ *
+ * SPEAr1300 evaluation board source file
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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.
+ */
+
+#include <linux/types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach-types.h>
+#include <mach/generic.h>
+#include <mach/spear.h>
+
+static struct amba_device *amba_devs[] __initdata = {
+	&uart_device,
+};
+
+static struct platform_device *plat_devs[] __initdata = {
+};
+
+static void __init spear1300_evb_init(void)
+{
+	unsigned int i;
+
+	/* call spear1300 machine init function */
+	spear1300_init();
+
+	/* Add Platform Devices */
+	platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
+
+	/* Add Amba Devices */
+	for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
+		amba_device_register(amba_devs[i], &iomem_resource);
+}
+
+MACHINE_START(SPEAR1300, "ST-SPEAR1300-EVB")
+	.boot_params	=	0x00000100,
+	.map_io		=	spear13xx_map_io,
+	.init_irq	=	spear13xx_init_irq,
+	.timer		=	&spear13xx_timer,
+	.init_machine	=	spear1300_evb_init,
+MACHINE_END
arch/arm/mach-spear13xx/spear13xx.c new file +14 -0
new file mode 100644
index 0000000..d11e300
@@ -0,0 +1,98 @@
+/*
+ * arch/arm/mach-spear13xx/spear13xx.c
+ *
+ * SPEAr13XX machines common source file
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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.
+ */
+
+#include <linux/types.h>

arch/arm/mach-spear13xx/spear13xx.c line 24

Quoted 10 lines
arch/arm/mach-spear13xx/spear13xx.c new file +10 -0
+#include <linux/ptrace.h>
+#include <linux/io.h>
+#include <asm/hardware/gic.h>
+#include <asm/irq.h>
+#include <asm/localtimer.h>
+#include <asm/mach/arch.h>
+#include <asm/smp_twd.h>
+#include <mach/irqs.h>
+#include <mach/generic.h>
+#include <mach/hardware.h>

So do you need all these includes?

Quoted 82 lines
arch/arm/mach-spear13xx/spear13xx.c new file +74 -0
+
+/* Add spear13xx machines common devices here */
+/* uart device registeration */
+struct amba_device uart_device = {
+	.dev = {
+		.init_name = "uart",
+	},
+	.res = {
+		.start = SPEAR13XX_UART_BASE,
+		.end = SPEAR13XX_UART_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	.irq = {IRQ_UART, NO_IRQ},
+};
+
+/* Do spear13xx familiy common initialization part here */
+void __init spear13xx_init(void)
+{
+	/* nothing to do for now */
+}
+
+/* This will initialize vic */
+void __init spear13xx_init_irq(void)
+{
+	gic_dist_init(0, __io_address(SPEAR13XX_GIC_DIST_BASE), 29);
+	gic_cpu_init(0, __io_address(SPEAR13XX_GIC_CPU_BASE));
+}
+
+/* Following will create static virtual/physical mappings */
+struct map_desc spear13xx_io_desc[] __initdata = {
+	{
+		.virtual	= IO_ADDRESS(SPEAR13XX_UART_BASE),
+		.pfn		= __phys_to_pfn(SPEAR13XX_UART_BASE),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE
+	}, {
+		.virtual	= IO_ADDRESS(SPEAR13XX_A9SM_PERIP_BASE),
+		.pfn		= __phys_to_pfn(SPEAR13XX_A9SM_PERIP_BASE),
+		.length		= SZ_8K,
+		.type		= MT_DEVICE
+	}, {
+		.virtual	= IO_ADDRESS(SPEAR13XX_MISC_BASE),
+		.pfn		= __phys_to_pfn(SPEAR13XX_MISC_BASE),
+		.length		= SZ_8K,
+		.type		= MT_DEVICE
+	}, {
+		.virtual	= IO_ADDRESS(SPEAR13XX_SYSRAM0_BASE),
+		.pfn		= __phys_to_pfn(SPEAR13XX_SYSRAM0_BASE),
+		.length		= SZ_32K,
+		.type		= MT_DEVICE
+	},
+};
+
+/* This will create static memory mapping for selected devices */
+void __init spear13xx_map_io(void)
+{
+	iotable_init(spear13xx_io_desc, ARRAY_SIZE(spear13xx_io_desc));
+
+	/* This will initialize clock framework */
+	clk_init();
+}
+
+static void __init spear13xx_timer_init(void)
+{
+#ifdef CONFIG_LOCAL_TIMERS
+	/* Setup the local timer base */
+	twd_base = __io_address(SPEAR13XX_LOCAL_TMR_BASE);
+#endif
+	spear_setup_timer();
+}
+
+struct sys_timer spear13xx_timer = {
+	.init = spear13xx_timer_init,
+};
Signature · 7 lines
1.7.2.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#19 lore raw

PATCH 5/74 ST SPEAr13XX: Adding machine specific src files

Hello Russell,

Quoted 29 lines · Russell King - ARM Linux
Quoted 28 lines · Viresh KUMAR
arch/arm/mach-spear13xx/platsmp.c new file +22 -0
new file mode 100644
index 0000000..8b75d1b
@@ -0,0 +1,203 @@
+/*
+ * arch/arm/mach-spear13xx/platsmp.c
+ *
+ * based upon linux/arch/arm/mach-realview/platsmp.c
+ *
+ * Copyright (C) 2010 ST Microelectronics Ltd.
+ * Shiraz Hashim <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <asm/cacheflush.h>
+#include <asm/hardware/gic.h>
+#include <asm/localtimer.h>
+#include <asm/mach-types.h>
+#include <asm/smp_scu.h>
+#include <asm/unified.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/errno.h>
Quoted 8 lines

arch/arm/mach-spear13xx/platsmp.c line 28

Quoted 6 lines
arch/arm/mach-spear13xx/platsmp.c new file +6 -0
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/smp.h>
+#include <mach/generic.h>
+#include <mach/hardware.h>

linux/ before asm/ before mach/ please.

OK. Would check it across.

Quoted 67 lines
Quoted 67 lines
arch/arm/mach-spear13xx/platsmp.c new file +67 -0
+
+/*
+ * control for which core is the next to come out of the secondary
+ * boot "holding pen"
+ */
+volatile int __cpuinitdata pen_release = -1;
+static DEFINE_SPINLOCK(boot_lock);
+
+static void __iomem *scu_base_addr(void)
+{
+     return __io_address(SPEAR13XX_SCU_BASE);
+}
+
+static inline unsigned int get_core_count(void)
+{
+     void __iomem *scu_base = scu_base_addr();
+
+     if (scu_base)
+             return scu_get_core_count(scu_base);
+     return 1;
+}
+
+void __cpuinit platform_secondary_init(unsigned int cpu)
+{
+     trace_hardirqs_off();
+
+     /*
+      * if any interrupts are already enabled for the primary
+      * core (e.g. timer irq), then they will not have been enabled
+      * for us: do so
+      */
+     gic_cpu_init(0, __io_address(SPEAR13XX_GIC_CPU_BASE));
+
+     /*
+      * let the primary processor know we're out of the
+      * pen, then head off into the C entry point
+      */
+     pen_release = -1;
+     smp_wmb();
+
+     /*
+      * Synchronise with the boot thread.
+      */
+     spin_lock(&boot_lock);
+     spin_unlock(&boot_lock);
+}
+
+int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+     unsigned long timeout;
+
+     /*
+      * set synchronisation state between this boot processor
+      * and the secondary one
+      */
+     spin_lock(&boot_lock);
+
+     /*
+      * The secondary processor is waiting to be released from
+      * the holding pen - release it, then wait for it to flag
+      * that it has been released by resetting pen_release.
+      *
+      * Note that "pen_release" is the hardware CPU ID, whereas
+      * "cpu" is Linux's internal ID.
+      */
+
+     /*
Quoted 9 lines

arch/arm/mach-spear13xx/platsmp.c line 100

Quoted 5 lines
arch/arm/mach-spear13xx/platsmp.c new file +5 -0
+      * Note: Following is important otherwise cpu2 doesn't come up
+      * as secondary_data must be flushed before pen_release also
+      */
+
+     flush_cache_all();

You don't need this. secondary_data is already taken care of as of a few kernel releases ago.

OK.

Quoted 31 lines
Quoted 31 lines
arch/arm/mach-spear13xx/platsmp.c new file +31 -0
+     pen_release = cpu;
+     flush_cache_all();
+
+     timeout = jiffies + (1 * HZ);
+     while (time_before(jiffies, timeout)) {
+             smp_rmb();
+             if (pen_release == -1)
+                     break;
+
+             udelay(10);
+     }
+
+     /*
+      * now the secondary core is starting up let it run its
+      * calibrations, then wait for it to finish
+      */
+     spin_unlock(&boot_lock);
+
+     return pen_release != -1 ? -ENOSYS : 0;
+}
+
+static void __init poke_milo(void)
+{
+     /* nobody is to be released from the pen yet */
+     pen_release = -1;
+
+     /*
+      * Write the address of secondary startup into the system-wide
+      * location (presently it is in SRAM). The BootMonitor waits
+      * for this register to become non-zero.
+      */
Quoted 9 lines

arch/arm/mach-spear13xx/platsmp.c line 135

Quoted 4 lines
arch/arm/mach-spear13xx/platsmp.c new file +4 -0
+     __raw_writel(BSYM(virt_to_phys(spear13xx_secondary_startup)),
+                     __io_address(SPEAR13XX_SYS_LOCATION));
+
+     mb();

Please get rid of this function. You don't have milo, and milo is pretty much dead anyway. Please read the Versatile Express SMP code and base your version off that (cleaned up) version instead.

OK. I would refer the code.

Quoted 175 lines
Quoted 175 lines
arch/arm/mach-spear13xx/platsmp.c new file +68 -0
+}
+
+/*
+ * Initialise the CPU possible map early - this describes the CPUs
+ * which may be present or become present in the system.
+ */
+void __init smp_init_cpus(void)
+{
+     unsigned int i, ncores = get_core_count();
+
+     for (i = 0; i < ncores; i++)
+             set_cpu_possible(i, true);
+}
+
+void __init smp_prepare_cpus(unsigned int max_cpus)
+{
+     unsigned int ncores = get_core_count();
+     unsigned int cpu = smp_processor_id();
+     int i;
+
+     /* sanity check */
+     if (ncores == 0) {
+             pr_err("Realview: strange CM count of 0? Default to 1\n");
+
+             ncores = 1;
+     }
+
+     if (ncores > num_possible_cpus()) {
+             ncores = num_possible_cpus();
+             pr_err(
+                    "spear13xx: no. of cores (%d) greater than configured "
+                    "maximum of %d - clipping\n",
+                    ncores, ncores);
+     }
+
+     smp_store_cpu_info(cpu);
+
+     /*
+      * are we trying to boot more cores than exist?
+      */
+     if (max_cpus > ncores)
+             max_cpus = ncores;
+
+     /*
+      * Initialise the present map, which describes the set of CPUs
+      * actually populated at the present time.
+      */
+     for (i = 0; i < max_cpus; i++)
+             set_cpu_present(i, true);
+
+     /*
+      * Initialise the SCU if there are more than one CPU and let
+      * them know where to start. Note that, on modern versions of
+      * MILO, the "poke" doesn't actually do anything until each
+      * individual core is sent a soft interrupt to get it out of
+      * WFI
+      */
+     if (max_cpus > 1) {
+             /*
+              * Enable the local timer or broadcast device for the
+              * boot CPU, but only if we have more than one CPU.
+              */
+             percpu_timer_setup();
+
+             scu_enable(scu_base_addr());
+             poke_milo();
+     }
+}
arch/arm/mach-spear13xx/spear1300.c new file +23 -0
new file mode 100644
index 0000000..c1b82f1
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-spear13xx/spear1300.c
+ *
+ * SPEAr1300 machine source file
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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.
+ */
+
+#include <mach/generic.h>
+#include <mach/spear.h>
+
+/* Add spear1300 specific devices here */
+
+void __init spear1300_init(void)
+{
+     /* call spear13xx family common init function */
+     spear13xx_init();
+}
arch/arm/mach-spear13xx/spear1300_evb.c new file +48 -0
new file mode 100644
index 0000000..d72c8a8
@@ -0,0 +1,48 @@
+/*
+ * arch/arm/mach-spear13xx/spear1300_evb.c
+ *
+ * SPEAr1300 evaluation board source file
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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.
+ */
+
+#include <linux/types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach-types.h>
+#include <mach/generic.h>
+#include <mach/spear.h>
+
+static struct amba_device *amba_devs[] __initdata = {
+     &uart_device,
+};
+
+static struct platform_device *plat_devs[] __initdata = {
+};
+
+static void __init spear1300_evb_init(void)
+{
+     unsigned int i;
+
+     /* call spear1300 machine init function */
+     spear1300_init();
+
+     /* Add Platform Devices */
+     platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
+
+     /* Add Amba Devices */
+     for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
+             amba_device_register(amba_devs[i], &iomem_resource);
+}
+
+MACHINE_START(SPEAR1300, "ST-SPEAR1300-EVB")
+     .boot_params    =       0x00000100,
+     .map_io         =       spear13xx_map_io,
+     .init_irq       =       spear13xx_init_irq,
+     .timer          =       &spear13xx_timer,
+     .init_machine   =       spear1300_evb_init,
+MACHINE_END
arch/arm/mach-spear13xx/spear13xx.c new file +18 -0
new file mode 100644
index 0000000..d11e300
@@ -0,0 +1,98 @@
+/*
+ * arch/arm/mach-spear13xx/spear13xx.c
+ *
+ * SPEAr13XX machines common source file
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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.
+ */
+
+#include <linux/types.h>
+#include <linux/ptrace.h>
+#include <linux/io.h>
+#include <asm/hardware/gic.h>
+#include <asm/irq.h>
Quoted 9 lines

arch/arm/mach-spear13xx/spear13xx.c line 24

Quoted 6 lines
arch/arm/mach-spear13xx/spear13xx.c new file +6 -0
+#include <asm/localtimer.h>
+#include <asm/mach/arch.h>
+#include <asm/smp_twd.h>
+#include <mach/irqs.h>
+#include <mach/generic.h>
+#include <mach/hardware.h>

So do you need all these includes?

I would cross check and eliminate un-necessary ones.

Quoted 68 lines
Quoted 68 lines
arch/arm/mach-spear13xx/spear13xx.c new file +68 -0
+
+/* Add spear13xx machines common devices here */
+/* uart device registeration */
+struct amba_device uart_device = {
+     .dev = {
+             .init_name = "uart",
+     },
+     .res = {
+             .start = SPEAR13XX_UART_BASE,
+             .end = SPEAR13XX_UART_BASE + SZ_4K - 1,
+             .flags = IORESOURCE_MEM,
+     },
+     .irq = {IRQ_UART, NO_IRQ},
+};
+
+/* Do spear13xx familiy common initialization part here */
+void __init spear13xx_init(void)
+{
+     /* nothing to do for now */
+}
+
+/* This will initialize vic */
+void __init spear13xx_init_irq(void)
+{
+     gic_dist_init(0, __io_address(SPEAR13XX_GIC_DIST_BASE), 29);
+     gic_cpu_init(0, __io_address(SPEAR13XX_GIC_CPU_BASE));
+}
+
+/* Following will create static virtual/physical mappings */
+struct map_desc spear13xx_io_desc[] __initdata = {
+     {
+             .virtual        = IO_ADDRESS(SPEAR13XX_UART_BASE),
+             .pfn            = __phys_to_pfn(SPEAR13XX_UART_BASE),
+             .length         = SZ_4K,
+             .type           = MT_DEVICE
+     }, {
+             .virtual        = IO_ADDRESS(SPEAR13XX_A9SM_PERIP_BASE),
+             .pfn            = __phys_to_pfn(SPEAR13XX_A9SM_PERIP_BASE),
+             .length         = SZ_8K,
+             .type           = MT_DEVICE
+     }, {
+             .virtual        = IO_ADDRESS(SPEAR13XX_MISC_BASE),
+             .pfn            = __phys_to_pfn(SPEAR13XX_MISC_BASE),
+             .length         = SZ_8K,
+             .type           = MT_DEVICE
+     }, {
+             .virtual        = IO_ADDRESS(SPEAR13XX_SYSRAM0_BASE),
+             .pfn            = __phys_to_pfn(SPEAR13XX_SYSRAM0_BASE),
+             .length         = SZ_32K,
+             .type           = MT_DEVICE
+     },
+};
+
+/* This will create static memory mapping for selected devices */
+void __init spear13xx_map_io(void)
+{
+     iotable_init(spear13xx_io_desc, ARRAY_SIZE(spear13xx_io_desc));
+
+     /* This will initialize clock framework */
+     clk_init();
+}
+
+static void __init spear13xx_timer_init(void)
+{
+#ifdef CONFIG_LOCAL_TIMERS
+     /* Setup the local timer base */
+     twd_base = __io_address(SPEAR13XX_LOCAL_TMR_BASE);
+#endif
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-spear13xx/spear13xx.c new file +6 -1
+     spear_setup_timer();
+}
+
+struct sys_timer spear13xx_timer = {
+     .init = spear13xx_timer_init,
+};
--

1.7.2.2

regards
Shiraz

#20 lore raw

PATCH 6/74 ST SPEAr: Adding support for SPEAr13xx SoC in spear generic plat/

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

---
 arch/arm/plat-spear/Kconfig |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/plat-spear/Kconfig +8 -0
index 1bb3dbc..29a25d2 100644
@@ -8,6 +8,13 @@ choice
 	prompt "ST SPEAr Family"
 	default ARCH_SPEAR3XX
 
+config ARCH_SPEAR13XX
+	bool "SPEAr13XX"
+	select ARM_GIC
+	select CPU_V7
+	help
+	  Supports for ARM's SPEAR13XX family
+
 config ARCH_SPEAR3XX
 	bool "SPEAr3XX"
 	select ARM_VIC
@@ -25,6 +32,7 @@ config ARCH_SPEAR6XX
 endchoice
 
 # Adding SPEAr machine specific configuration files
+source "arch/arm/mach-spear13xx/Kconfig"
 source "arch/arm/mach-spear3xx/Kconfig"
 source "arch/arm/mach-spear6xx/Kconfig"
 
Signature · 1 line
1.7.2.2
#21 lore raw

PATCH 7/74 ST SPEAr13XX: Added compilation support in arch/arm/

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

---
 arch/arm/Kconfig  |   12 ++++++++----
 arch/arm/Makefile |    1 +
 2 files changed, 9 insertions(+), 4 deletions(-)
arch/arm/Kconfig +8 -4
index 9295110..950c045 100644
@@ -1144,11 +1144,13 @@ config SMP
 	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
 		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
-		 ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
+		 ARCH_S5PV310 || ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
+		 ARCH_VEXPRESS_CA9X4)
 	depends on GENERIC_CLOCKEVENTS
 	select USE_GENERIC_SMP_HELPERS
 	select HAVE_ARM_SCU if ARCH_REALVIEW || ARCH_OMAP4 || ARCH_S5PV310 ||\
-		 ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4
+		 ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
+		 ARCH_VEXPRESS_CA9X4
 	help
 	  This enables support for systems with more than one CPU. If you have
 	  a system with only one CPU, like most personal computers, say N. If
@@ -1218,10 +1220,11 @@ config LOCAL_TIMERS
 	bool "Use local timer interrupts"
 	depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || \
 		REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
-		ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
+		ARCH_S5PV310 || ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
+		ARCH_VEXPRESS_CA9X4)
 	default y
 	select HAVE_ARM_TWD if ARCH_REALVIEW || ARCH_OMAP4 || ARCH_S5PV310 || \
-		ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS
+		ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS
 	help
 	  Enable support for local timers on SMP platforms, rather then the
 	  legacy IPI broadcast method.  Local timers allows the system
@@ -1599,6 +1602,7 @@ config ZRELADDR
 		ARCH_NUC93X ||\
 		ARCH_NS9XXX ||\
 		ARCH_ORION5X ||\
+		ARCH_SPEAR13XX ||\
 		ARCH_SPEAR3XX ||\
 		ARCH_SPEAR6XX ||\
 		ARCH_U8500 ||\
arch/arm/Makefile +1 -0
index 59c1ce8..d5177d7 100644
@@ -191,6 +191,7 @@ machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
 machine-$(CONFIG_ARCH_W90X900)		:= w90x900
 machine-$(CONFIG_ARCH_NUC93X)		:= nuc93x
 machine-$(CONFIG_FOOTBRIDGE)		:= footbridge
+machine-$(CONFIG_MACH_SPEAR1300)	:= spear13xx
 machine-$(CONFIG_MACH_SPEAR300)		:= spear3xx
 machine-$(CONFIG_MACH_SPEAR310)		:= spear3xx
 machine-$(CONFIG_MACH_SPEAR320)		:= spear3xx
Signature · 1 line
1.7.2.2
#22 lore raw

PATCH 7/74 ST SPEAr13XX: Added compilation support in arch/arm/

Quoted 1 line · Viresh KUMAR

From: Shiraz Hashim <[email protected]>

missing patch descriptin

Quoted 13 lines
---
 arch/arm/Kconfig  |   12 ++++++++----
 arch/arm/Makefile |    1 +
 2 files changed, 9 insertions(+), 4 deletions(-)
arch/arm/Kconfig +0 -0
index 9295110..950c045 100644

arch/arm/Kconfig config SMP · line 1148

Quoted 6 lines
arch/arm/Kconfig +2 -1
@@ -1144,11 +1144,13 @@ config SMP
 	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
 		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
-		 ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
+		 ARCH_S5PV310 || ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
+		 ARCH_VEXPRESS_CA9X4)

can we get rid of such long list by introducing a HAVE somthing etc....

Best Regards,
J.

#23 lore raw

PATCH 7/74 ST SPEAr13XX: Added compilation support in arch/arm/

Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line · Viresh KUMAR
Quoted 1 line

From: Shiraz Hashim <[email protected]>

missing patch descriptin

Sorry!!

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
---
 arch/arm/Kconfig  |   12 ++++++++----
 arch/arm/Makefile |    1 +
 2 files changed, 9 insertions(+), 4 deletions(-)
Quoted 13 lines
Quoted 11 lines

arch/arm/Kconfig config SMP · line 1148

Quoted 11 lines
arch/arm/Kconfig +2 -1
index 9295110..950c045 100644
@@ -1144,11 +1144,13 @@ config SMP
 	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
 		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
-		 ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
+		 ARCH_S5PV310 || ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
+		 ARCH_VEXPRESS_CA9X4)

can we get rid of such long list by introducing a HAVE somthing etc....

Yes. We can select SMP from different Architecture config's. Will do this in a separate patch.

viresh.

#24 lore raw

PATCH 7/74 ST SPEAr13XX: Added compilation support in arch/arm/

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines
arch/arm/Kconfig +0 -0

arch/arm/Kconfig config SMP · line 1148

Quoted 10 lines

index 9295110..950c045 100644

arch/arm/Kconfig +2 -1
@@ -1144,11 +1144,13 @@ config SMP
 	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
 		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
-		 ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
+		 ARCH_S5PV310 || ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
+		 ARCH_VEXPRESS_CA9X4)

can we get rid of such long list by introducing a HAVE somthing etc....

I tried to do this, but have some doubts. With this change architectures can not disable features selected using select statement. So, if i want image without SMP for SPEAr13xx now, i can't do it.

Please correct me if this is not the right way of doing it.

regards,
viresh.
--------------------------------------

[PATCH] arch/arm/Kconfig: removing arch/machine dependencies from SMP, LOCAL_TIMERS, HAVE_ARM_SCU AND HAVE_ARM_TWD

Individual architectures/machines should select SMP, LOCAL_TIMERS, HAVE_ARM_SCU AND HAVE_ARM_TWD from there config options

---
 arch/arm/Kconfig               |   30 +++++++++++++++++-------------
 arch/arm/mach-omap2/Kconfig    |    4 ++++
 arch/arm/mach-realview/Kconfig |    8 ++++++++
 arch/arm/mach-vexpress/Kconfig |    3 +++
 arch/arm/plat-spear/Kconfig    |    4 ++++
 5 files changed, 36 insertions(+), 13 deletions(-)
arch/arm/Kconfig +17 -13
index f6ec629..4617efa 100644
@@ -238,6 +238,8 @@ config ARCH_REALVIEW
 	select PLAT_VERSATILE
 	select ARM_TIMER_SP804
 	select GPIO_PL061 if GPIOLIB
+	select HAVE_ARM_SCU if SMP
+	select HAVE_ARM_TWD if LOCAL_TIMERS
 	help
 	  This enables support for ARM Ltd RealView boards.
 
@@ -261,6 +263,7 @@ config ARCH_VEXPRESS
 	select ARM_TIMER_SP804
 	select COMMON_CLKDEV
 	select GENERIC_CLOCKEVENTS
+	select HAVE_ARM_TWD if LOCAL_TIMERS
 	select HAVE_CLK
 	select ICST
 	select PLAT_VERSATILE
@@ -566,6 +569,10 @@ config ARCH_TEGRA
 	select HAVE_CLK
 	select COMMON_CLKDEV
 	select ARCH_HAS_BARRIERS if CACHE_L2X0
+	select SMP
+	select HAVE_ARM_SCU if SMP
+	select LOCAL_TIMERS
+	select HAVE_ARM_TWD if LOCAL_TIMERS
 	help
 	  This enables support for NVIDIA Tegra based systems (Tegra APX,
 	  Tegra 6xx and Tegra 2 series).
@@ -733,6 +740,10 @@ config ARCH_S5PV310
 	select GENERIC_GPIO
 	select HAVE_CLK
 	select GENERIC_CLOCKEVENTS
+	select SMP
+	select HAVE_ARM_SCU if SMP
+	select LOCAL_TIMERS
+	select HAVE_ARM_TWD if LOCAL_TIMERS
 	help
 	  Samsung S5PV310 series based systems
 
@@ -779,6 +790,10 @@ config ARCH_U8500
 	select GENERIC_CLOCKEVENTS
 	select COMMON_CLKDEV
 	select ARCH_REQUIRE_GPIOLIB
+	select SMP
+	select HAVE_ARM_SCU if SMP
+	select LOCAL_TIMERS
+	select HAVE_ARM_TWD if LOCAL_TIMERS
 	help
 	  Support for ST-Ericsson's Ux500 architecture
 
@@ -1146,15 +1161,9 @@ source "kernel/time/Kconfig"
 
 config SMP
 	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
-	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
-		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
-		 ARCH_S5PV310 || ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
-		 ARCH_VEXPRESS_CA9X4)
+	depends on EXPERIMENTAL
 	depends on GENERIC_CLOCKEVENTS
 	select USE_GENERIC_SMP_HELPERS
-	select HAVE_ARM_SCU if ARCH_REALVIEW || ARCH_OMAP4 || ARCH_S5PV310 ||\
-		 ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
-		 ARCH_VEXPRESS_CA9X4
 	help
 	  This enables support for systems with more than one CPU. If you have
 	  a system with only one CPU, like most personal computers, say N. If
@@ -1222,13 +1231,8 @@ config HOTPLUG_CPU
 
 config LOCAL_TIMERS
 	bool "Use local timer interrupts"
-	depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || \
-		REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
-		ARCH_S5PV310 || ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
-		ARCH_VEXPRESS_CA9X4)
+	depends on SMP
 	default y
-	select HAVE_ARM_TWD if ARCH_REALVIEW || ARCH_OMAP4 || ARCH_S5PV310 || \
-		ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS
 	help
 	  Enable support for local timers on SMP platforms, rather then the
 	  legacy IPI broadcast method.  Local timers allows the system
arch/arm/mach-omap2/Kconfig +4 -0
index b48bacf..674bb71 100644
@@ -43,6 +43,10 @@ config ARCH_OMAP4
 	depends on ARCH_OMAP2PLUS
 	select CPU_V7
 	select ARM_GIC
+	select SMP
+	select HAVE_ARM_SCU if SMP
+	select LOCAL_TIMERS
+	select HAVE_ARM_TWD if LOCAL_TIMERS
 
 comment "OMAP Core Type"
 	depends on ARCH_OMAP2
arch/arm/mach-realview/Kconfig +8 -0
index b4575ae..30a06ff 100644
@@ -11,6 +11,8 @@ config REALVIEW_EB_A9MP
 	bool "Support Multicore Cortex-A9"
 	depends on MACH_REALVIEW_EB
 	select CPU_V7
+	select SMP
+	select LOCAL_TIMERS
 	help
 	  Enable support for the Cortex-A9MPCore tile on the Realview platform.
 
@@ -18,6 +20,8 @@ config REALVIEW_EB_ARM11MP
 	bool "Support ARM11MPCore tile"
 	depends on MACH_REALVIEW_EB
 	select CPU_V6
+	select SMP
+	select LOCAL_TIMERS
 	select ARCH_HAS_BARRIERS if SMP
 	help
 	  Enable support for the ARM11MPCore tile on the Realview platform.
@@ -36,6 +40,8 @@ config MACH_REALVIEW_PB11MP
 	select CPU_V6
 	select ARM_GIC
 	select HAVE_PATA_PLATFORM
+	select SMP
+	select LOCAL_TIMERS
 	select ARCH_HAS_BARRIERS if SMP
 	help
 	  Include support for the ARM(R) RealView MPCore Platform Baseboard.
@@ -73,6 +79,8 @@ config MACH_REALVIEW_PBX
 	select ARM_GIC
 	select HAVE_PATA_PLATFORM
 	select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !REALVIEW_HIGH_PHYS_OFFSET
+	select SMP
+	select LOCAL_TIMERS
 	select ZONE_DMA if SPARSEMEM
 	help
 	  Include support for the ARM(R) RealView PBX platform.
arch/arm/mach-vexpress/Kconfig +3 -0
index 3f19b66..8475646 100644
@@ -5,5 +5,8 @@ config ARCH_VEXPRESS_CA9X4
 	bool "Versatile Express Cortex-A9x4 tile"
 	select CPU_V7
 	select ARM_GIC
+	select SMP
+	select HAVE_ARM_SCU if SMP
+	select LOCAL_TIMERS
 
 endmenu
arch/arm/plat-spear/Kconfig +4 -0
index b8e4988..18e2229 100644
@@ -13,6 +13,10 @@ config ARCH_SPEAR13XX
 	select ARM_GIC
 	select CPU_V7
 	select ARCH_SUPPORTS_MSI
+	select SMP
+	select HAVE_ARM_SCU if SMP
+	select LOCAL_TIMERS
+	select HAVE_ARM_TWD if LOCAL_TIMERS
 	help
 	  Supports for ARM's SPEAR13XX family
#25 lore raw

PATCH 7/74 ST SPEAr13XX: Added compilation support in arch/arm/

Quoted 23 lines · viresh kumar
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines
arch/arm/Kconfig +0 -0

arch/arm/Kconfig config SMP · line 1148

Quoted 10 lines

index 9295110..950c045 100644

arch/arm/Kconfig +2 -1
@@ -1144,11 +1144,13 @@ config SMP
 	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
 		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
-		 ARCH_S5PV310 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
+		 ARCH_S5PV310 || ARCH_SPEAR13XX || ARCH_TEGRA || ARCH_U8500 ||\
+		 ARCH_VEXPRESS_CA9X4)

can we get rid of such long list by introducing a HAVE somthing etc....

I tried to do this, but have some doubts. With this change architectures can not disable features selected using select statement. So, if i want image without SMP for SPEAr13xx now, i can't do it.

Please correct me if this is not the right way of doing it.

Quoted 8 lines

regards,
viresh.
--------------------------------------

[PATCH] arch/arm/Kconfig: removing arch/machine dependencies from SMP, LOCAL_TIMERS, HAVE_ARM_SCU AND HAVE_ARM_TWD

Individual architectures/machines should select SMP, LOCAL_TIMERS, HAVE_ARM_SCU AND HAVE_ARM_TWD from there config options

I've already killed most of this off.

#26 lore raw

PATCH 8/74 ST SPEAr1300: Adding default config file

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

---
 arch/arm/configs/spear1300-smp_defconfig |  875 ++++++++++++++++++++++++++++++
 1 files changed, 875 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/configs/spear1300-smp_defconfig
arch/arm/configs/spear1300-smp_defconfig new file +875 -0
new file mode 100644
index 0000000..98502da
@@ -0,0 +1,875 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.32
+# Mon Apr 19 15:37:56 2010
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=17
+# CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
+# CONFIG_RELAY is not set
+CONFIG_NAMESPACES=y
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+# CONFIG_EMBEDDED is not set
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+CONFIG_KALLSYMS_EXTRA_PASS=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+CONFIG_HAVE_CLK=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+# CONFIG_SLOW_WORK is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_STOP_MACHINE=y
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_AS is not set
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_CFQ=y
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+# CONFIG_FREEZER is not set
+
+#
+# System Type
+#
+CONFIG_MMU=y
+# CONFIG_ARCH_AAEC2000 is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_STMP3XXX is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_NOMADIK is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_LOKI is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+# CONFIG_ARCH_MSM is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_S5PC1XX is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_U300 is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_ARCH_BCMRING is not set
+CONFIG_PLAT_SPEAR=y
+# CONFIG_ARCH_SPEAR3XX is not set
+# CONFIG_ARCH_SPEAR6XX is not set
+CONFIG_ARCH_SPEAR13XX=y
+CONFIG_MACH_SPEAR1300=y
+CONFIG_BOARD_SPEAR1300_EVB=y
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_V7=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_HAS_ASID=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+CONFIG_ARM_THUMB=y
+# CONFIG_ARM_THUMBEE is not set
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+CONFIG_HAS_TLS_REG=y
+CONFIG_ARM_L1_CACHE_SHIFT=5
+# CONFIG_ARM_ERRATA_430973 is not set
+# CONFIG_ARM_ERRATA_458693 is not set
+# CONFIG_ARM_ERRATA_460075 is not set
+CONFIG_ARM_GIC=y
+CONFIG_COMMON_CLKDEV=y
+
+#
+# Bus support
+#
+CONFIG_ARM_AMBA=y
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_SMP=y
+CONFIG_HAVE_ARM_SCU=y
+CONFIG_HAVE_ARM_TWD=y
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_NR_CPUS=2
+# CONFIG_HOTPLUG_CPU is not set
+CONFIG_LOCAL_TIMERS=y
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_HZ=100
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_AEABI=y
+CONFIG_OABI_COMPAT=y
+# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
+# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
+# CONFIG_HIGHMEM is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+CONFIG_HAVE_MLOCK=y
+CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+
+#
+# Boot options
+#
+CONFIG_ZBOOT_ROM_TEXT=0
+CONFIG_ZBOOT_ROM_BSS=0
+CONFIG_CMDLINE=""
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+
+#
+# CPU Power Management
+#
+# CONFIG_CPU_IDLE is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+# CONFIG_FPE_NWFPE is not set
+# CONFIG_FPE_FASTFPE is not set
+# CONFIG_VFP is not set
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+CONFIG_BINFMT_MISC=y
+
+#
+# Power management options
+#
+# CONFIG_PM is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+# CONFIG_NET is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_TESTS is not set
+CONFIG_MTD_CONCAT=y
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_AR7_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+# CONFIG_MTD_CFI is not set
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=16384
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_MG_DISK is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+CONFIG_HAVE_IDE=y
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+CONFIG_INPUT_FF_MEMLESS=y
+# CONFIG_INPUT_POLLDEV is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_AMBAKMI is not set
+# CONFIG_SERIO_RAW is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+CONFIG_DEVKMEM=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_AMBA_PL010 is not set
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=m
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
+# CONFIG_R3964 is not set
+CONFIG_RAW_DRIVER=y
+CONFIG_MAX_RAW_DEVS=8192
+# CONFIG_TCG_TPM is not set
+# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+# CONFIG_DEBUG_GPIO is not set
+# CONFIG_GPIO_SYSFS is not set
+
+#
+# Memory mapped GPIO expanders:
+#
+# CONFIG_GPIO_PL061 is not set
+
+#
+# I2C GPIO expanders:
+#
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+
+#
+# AC97 GPIO expanders:
+#
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+# CONFIG_FB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_SOUND is not set
+# CONFIG_HID_SUPPORT is not set
+# CONFIG_USB_SUPPORT is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+# CONFIG_RTC_CLASS is not set
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
+# CONFIG_STAGING is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+# CONFIG_EXT2_FS_POSIX_ACL is not set
+CONFIG_EXT2_FS_SECURITY=y
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+CONFIG_EXT3_FS_SECURITY=y
+# CONFIG_EXT4_FS is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_FS_POSIX_ACL is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+# CONFIG_INOTIFY is not set
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+CONFIG_AUTOFS4_FS=m
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
+# CONFIG_JFFS2_SUMMARY is not set
+# CONFIG_JFFS2_FS_XATTR is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+# CONFIG_JFFS2_LZO is not set
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+# CONFIG_SYSV68_PARTITION is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="utf8"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=m
+# CONFIG_NLS_ISO8859_1 is not set
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
+CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
+CONFIG_SCHED_DEBUG=y
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+CONFIG_DEBUG_SPINLOCK=y
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+CONFIG_DEBUG_SPINLOCK_SLEEP=y
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+CONFIG_RCU_CPU_STALL_DETECTOR=y
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+# CONFIG_PAGE_POISONING is not set
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_ENABLE_DEFAULT_TRACERS is not set
+# CONFIG_BOOT_TRACER is not set
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+CONFIG_ARM_UNWIND=y
+# CONFIG_DEBUG_USER is not set
+# CONFIG_DEBUG_ERRORS is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_LL is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_CRYPTO is not set
+# CONFIG_BINARY_PRINTF is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
Signature · 1 line
1.7.2.2
#27 lore raw

PATCH 8/74 ST SPEAr1300: Adding default config file

Quoted 1 line · Viresh KUMAR

From: Shiraz Hashim <[email protected]>

This defconfig is too large and verbose to go anywhere near mainline, even temporarily. You need to talk to Uwe about how to shrink it down.

#28 lore raw

PATCH 8/74 ST SPEAr1300: Adding default config file

Quoted 5 lines · Russell King - ARM Linux
Quoted 1 line · Viresh KUMAR

From: Shiraz Hashim <[email protected]>

This defconfig is too large and verbose to go anywhere near mainline, even temporarily. You need to talk to Uwe about how to shrink it down.

These days, all you need to do is:

make savedefconfig

and look for a defconfig file in the current directory.

Nicolas

#29 lore raw

PATCH 8/74 ST SPEAr1300: Adding default config file

Quoted 5 lines · Nicolas Pitre
Quoted 3 lines · Russell King - ARM Linux
Quoted 1 line · Viresh KUMAR

From: Shiraz Hashim <[email protected]>

Quoted 8 lines
Quoted 2 lines

This defconfig is too large and verbose to go anywhere near mainline, even temporarily. You need to talk to Uwe about how to shrink it down.

These days, all you need to do is:

make savedefconfig

and look for a defconfig file in the current directory.

Ah right. Wonder why no one documented that.

#30 lore raw

PATCH 8/74 ST SPEAr1300: Adding default config file

Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines

These days, all you need to do is:

Quoted 4 lines

make savedefconfig

and look for a defconfig file in the current directory.

Ah right. Wonder why no one documented that.

Thanks for the info. It was really helpful.

viresh.

#31 lore raw

PATCH 9/74 ST SPEAr: Adding information in Documentation/ and MAINTAINERS

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

---
 Documentation/arm/SPEAr/overview.txt |   33 +++++++++++++++++++++++----------
 MAINTAINERS                          |    6 ++++++
 2 files changed, 29 insertions(+), 10 deletions(-)
Documentation/arm/SPEAr/overview.txt +23 -10
index 253a35c..0e91cbf 100644
@@ -9,8 +9,9 @@ Introduction
 
   The ST Microelectronics SPEAr range of ARM9/CortexA9 System-on-Chip CPUs are
   supported by the 'spear' platform of ARM Linux. Currently SPEAr300,
-  SPEAr310, SPEAr320 and SPEAr600 SOCs are supported. Support for the SPEAr13XX
-  series is in progress.
+  SPEAr310, SPEAr320, SPEAr600 and SPEAr1300 SOCs are supported.
+  SPEAr3XX and SPEAr6XX are based on ARM9 whereas SPEAr13XX is based on latest
+  ARM Cortex A9 CPUs.
 
   Hierarchy in SPEAr is as follows:
 
@@ -27,16 +28,26 @@ Introduction
 			- SPEAr600_EVB (Evaluation Board)
 	- SPEAr13XX (13XX SOC series, based on ARM CORTEXA9)
 		- SPEAr1300 (SOC)
+			- SPEAr1300_EVB (Evaluation Board)
 
   Configuration
   -------------
 
   A generic configuration is provided for each machine, and can be used as the
   default by
-	make spear600_defconfig
-	make spear300_defconfig
-	make spear310_defconfig
-	make spear320_defconfig
+	#make ARCH=arm spear600_defconfig
+	#make ARCH=arm spear300_defconfig
+	#make ARCH=arm spear310_defconfig
+	#make ARCH=arm spear320_defconfig
+	#make ARCH=arm spear1300_defconfig
+	#make ARCH=arm spear1300-smp_defconfig (for SMP based configuration)
+
+  Compilation
+  -----------
+
+  After applying default configuration, Linux kernel for SPEAr architecture
+  can be compiled as
+	#make ARCH=arm CROSS_COMPILE=arm-linux- uImage
 
   Layout
   ------
@@ -48,13 +59,15 @@ Introduction
   Each machine series have a directory with name arch/arm/mach-spear followed by
   series name. Like mach-spear3xx, mach-spear6xx and mach-spear13xx.
 
-  Common file for machines of spear3xx family is mach-spear3xx/spear3xx.c and for
-  spear6xx is mach-spear6xx/spear6xx.c. mach-spear* also contain soc/machine
+  Common file for machines of spear3xx family is mach-spear3xx/spear3xx.c, for
+  spear6xx is mach-spear6xx/spear6xx.c and similarly for spear13xx is
+  mach-spear13xx/spear13xx.c. mach-spear* also contain soc/machine
   specific files, like spear300.c, spear310.c, spear320.c and spear600.c.
-  mach-spear* also contains board specific files for each machine type.
+  Board specific files for each machine type is also contained in mach-spear*
+  folder.
 
 
   Document Author
   ---------------
 
-  Viresh Kumar, (c) 2010 ST Microelectronics
+  Viresh Kumar, Shiraz Hashim (c) 2010 ST Microelectronics
MAINTAINERS +6 -0
index a1df54b..257e396 100644
@@ -5434,6 +5434,12 @@ W:	http://www.st.com/spear
 S:	Maintained
 F:	arch/arm/plat-spear/
 
+SPEAR13XX MACHINE SUPPORT
+M:	Shiraz Hashim <[email protected]>
+W:	http://www.st.com/spear
+S:	Maintained
+F:	arch/arm/mach-spear13xx/
+
 SPEAR3XX MACHINE SUPPORT
 M:	Viresh Kumar <[email protected]>
 W:	http://www.st.com/spear
Signature · 1 line
1.7.2.2
#32 lore raw

PATCH 10/74 ST SPEAr: Adding support for CLCD on SPEAr3xx/6xx

In reply to Viresh KUMAR

From: Vipul-kumar Samar <[email protected]>

---
 arch/arm/mach-spear3xx/include/mach/generic.h |    6 +
 arch/arm/mach-spear3xx/spear300.c             |   17 ++++
 arch/arm/mach-spear3xx/spear300_evb.c         |    1 +
 arch/arm/mach-spear3xx/spear320.c             |   16 +++
 arch/arm/mach-spear3xx/spear320_evb.c         |    1 +
 arch/arm/mach-spear6xx/include/mach/generic.h |    4 +
 arch/arm/mach-spear6xx/spear600_evb.c         |    1 +
 arch/arm/mach-spear6xx/spear6xx.c             |   17 ++++
 arch/arm/plat-spear/Makefile                  |    2 +-
 arch/arm/plat-spear/clcd.c                    |  126 +++++++++++++++++++++++++
 drivers/video/Kconfig                         |   14 +++-
 11 files changed, 203 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/plat-spear/clcd.c
arch/arm/mach-spear3xx/include/mach/generic.h +6 -0
index e7d2de8..1c8f9f1 100644
@@ -100,6 +100,7 @@ extern struct pmx_driver pmx_driver;
 /* spear300 declarations */
 #ifdef CONFIG_MACH_SPEAR300
 /* Add spear300 machine device structure declarations here */
+extern struct amba_device clcd_device;
 extern struct amba_device gpio1_device;
 
 /* pad mux modes */
@@ -136,6 +137,8 @@ extern struct pmx_dev pmx_gpio1;
 /* Add spear300 machine function declarations here */
 void __init spear300_init(void);
 
+/* Add misc structure declarations here */
+extern struct clcd_board clcd_plat_data;
 #endif /* CONFIG_MACH_SPEAR300 */
 
 /* spear310 declarations */
@@ -160,6 +163,7 @@ void __init spear310_init(void);
 /* spear320 declarations */
 #ifdef CONFIG_MACH_SPEAR320
 /* Add spear320 machine device structure declarations here */
+extern struct amba_device clcd_device;
 
 /* pad mux modes */
 extern struct pmx_mode auto_net_smii_mode;
@@ -194,6 +198,8 @@ extern struct pmx_dev pmx_i2c1;
 /* Add spear320 machine function declarations here */
 void __init spear320_init(void);
 
+/* Add misc structure declarations here */
+extern struct clcd_board clcd_plat_data;
 #endif /* CONFIG_MACH_SPEAR320 */
 
 #endif /* __MACH_GENERIC_H */
arch/arm/mach-spear3xx/spear300.c +17 -0
index 7e0ca5d..5d8df00 100644
@@ -371,6 +371,23 @@ struct pmx_driver pmx_driver = {
 };
 
 /* Add spear300 specific devices here */
+
+/* CLCD device registration */
+struct amba_device clcd_device = {
+	.dev = {
+		.init_name = "clcd",
+		.coherent_dma_mask = ~0,
+		.platform_data = &clcd_plat_data,
+	},
+	.res = {
+		.start = SPEAR300_CLCD_BASE,
+		.end = SPEAR300_CLCD_BASE + SPEAR300_CLCD_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	.dma_mask = ~0,
+	.irq = {IRQ_CLCD, NO_IRQ},
+};
+
 /* arm gpio1 device registeration */
 static struct pl061_platform_data gpio1_plat_data = {
 	.gpio_base	= 8,
arch/arm/mach-spear3xx/spear300_evb.c +1 -0
index cd23c98..3bb7fbc 100644
@@ -38,6 +38,7 @@ static struct amba_device *amba_devs[] __initdata = {
 	&uart_device,
 
 	/* spear300 specific devices */
+	&clcd_device,
 	&gpio1_device,
 };
 
arch/arm/mach-spear3xx/spear320.c +16 -0
index 2886bb2..e5baa00 100644
@@ -386,6 +386,22 @@ struct pmx_driver pmx_driver = {
 
 /* Add spear320 specific devices here */
 
+/* CLCD device registration */
+struct amba_device clcd_device = {
+	.dev = {
+		.init_name = "clcd",
+		.coherent_dma_mask = ~0,
+		.platform_data = &clcd_plat_data,
+	},
+	.res = {
+		.start = SPEAR320_CLCD_BASE,
+		.end = SPEAR320_CLCD_BASE + SPEAR320_CLCD_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	.dma_mask = ~0,
+	.irq = {VIRQ_CLCD, NO_IRQ},
+};
+
 /* spear3xx shared irq */
 struct shirq_dev_config shirq_ras1_config[] = {
 	{
arch/arm/mach-spear3xx/spear320_evb.c +1 -0
index 4a7ce35..821e806 100644
@@ -43,6 +43,7 @@ static struct amba_device *amba_devs[] __initdata = {
 	&uart_device,
 
 	/* spear320 specific devices */
+	&clcd_device,
 };
 
 static struct platform_device *plat_devs[] __initdata = {
arch/arm/mach-spear6xx/include/mach/generic.h +4 -0
index e5967ed..d6a04f2 100644
@@ -29,6 +29,7 @@
 #define SPEAR_GPT0_CHAN1_IRQ	IRQ_CPU_GPT1_2
 
 /* Add spear6xx family device structure declarations here */
+extern struct amba_device clcd_device;
 extern struct amba_device gpio_device[];
 extern struct amba_device uart_device[];
 extern struct sys_timer spear6xx_timer;
@@ -43,4 +44,7 @@ void __init clk_init(void);
 
 /* Add spear600 machine device structure declarations here */
 
+/* Add misc structure declarations here */
+extern struct clcd_board clcd_plat_data;
+
 #endif /* __MACH_GENERIC_H */
arch/arm/mach-spear6xx/spear600_evb.c +1 -0
index bdd5b76..88e69f4 100644
@@ -17,6 +17,7 @@
 #include <mach/spear.h>
 
 static struct amba_device *amba_devs[] __initdata = {
+	&clcd_device,
 	&gpio_device[0],
 	&gpio_device[1],
 	&gpio_device[2],
arch/arm/mach-spear6xx/spear6xx.c +17 -0
index 88a82ca..d0f6b9d 100644
@@ -23,6 +23,23 @@
 #include <mach/spear.h>
 
 /* Add spear6xx machines common devices here */
+
+/* CLCD device registration */
+struct amba_device clcd_device = {
+	.dev = {
+		.init_name = "clcd",
+		.coherent_dma_mask = ~0,
+		.platform_data = &clcd_plat_data,
+	},
+	.res = {
+		.start = SPEAR6XX_ICM3_CLCD_BASE,
+		.end = SPEAR6XX_ICM3_CLCD_BASE + SPEAR6XX_ICM3_CLCD_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	.dma_mask = ~0,
+	.irq = {IRQ_BASIC_CLCD, NO_IRQ},
+};
+
 /* uart device registeration */
 struct amba_device uart_device[] = {
 	{
arch/arm/plat-spear/Makefile +1 -1
index b4f340b..01a4a91 100644
@@ -3,6 +3,6 @@
 #
 
 # Common support
-obj-y	:= clock.o time.o
+obj-y	:= clcd.o clock.o time.o
 
 obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o padmux.o
arch/arm/plat-spear/clcd.c new file +126 -0

126 lines not on this page · raw message

drivers/video/Kconfig +13 -1
index 8b31fdf..24c919e 100644
@@ -307,10 +307,22 @@ config FB_ARMCLCD
 
 choice
 
-	depends on FB_ARMCLCD && (ARCH_LH7A40X || ARCH_LH7952X)
+	depends on FB_ARMCLCD && (ARCH_LH7A40X || ARCH_LH7952X || ARCH_SPEAR6XX || MACH_SPEAR300 || MACH_SPEAR320)
 	prompt "LCD Panel"
 	default FB_ARMCLCD_SHARP_LQ035Q7DB02
 
+config FB_ARMCLCD_SHARP_LQ043T1DG01
+	bool "SHARP LQ043T1DG01 CLCD 4.2\" TFT(480x272)"
+	help
+	  This is an implementation of the Sharp LQ043T1DG01, a 4.2"
+	  color TFT panel. The native resolution is 480x272.
+
+config FB_ARMCLCD_SAMSUNG_LMS700
+	bool "SAMSUNG CLCD 7\" TFT(800x480)"
+	help
+	  This is an implementation of the Samsung LMS700, a 7"
+	  color TFT panel. The native resolution is 800x480.
+
 config FB_ARMCLCD_SHARP_LQ035Q7DB02_HRTFT
 	bool "LogicPD LCD 3.5\" QVGA w/HRTFT IC"
 	help
Signature · 1 line
1.7.2.2
#33 lore raw

PATCH 10/74 ST SPEAr: Adding support for CLCD on SPEAr3xx/6xx

arch/arm/plat-spear/clcd.c line 100

Quoted 8 lines
arch/arm/plat-spear/clcd.c new file +8 -0
+static int clcd_check(struct clcd_fb *fb, struct fb_var_screeninfo
+		*var)
+{
+	var->xres_virtual = var->xres = (var->xres + 15) & ~15;
+	var->yres_virtual = var->yres = (var->yres + 1) & ~1;
+
+	var->nonstd = 0;
+	var->accel_flags = 0;

This looks insufficient.

#34 lore raw

PATCH 10/74 ST SPEAr: Adding support for CLCD on SPEAr3xx/6xx

Quoted 12 lines · Russell King - ARM Linux

arch/arm/plat-spear/clcd.c line 100

Quoted 8 lines
arch/arm/plat-spear/clcd.c new file +8 -0
+static int clcd_check(struct clcd_fb *fb, struct fb_var_screeninfo
+		*var)
+{
+	var->xres_virtual = var->xres = (var->xres + 15) & ~15;
+	var->yres_virtual = var->yres = (var->yres + 1) & ~1;
+
+	var->nonstd = 0;
+	var->accel_flags = 0;

This looks insufficient.
.

Ok. will use clcdfb_check.

#35 lore raw

PATCH 11/74 ST SPEAr: Adding support for divisor per parent clock

In reply to Viresh KUMAR

This patch was intended to provide support for clocks with multiple parents, where clock derived from any parent can be divided by a fixed number or can be passed to synthesizer. For this clock framework is reorganized to make behaviour of functions more closer to their name.

---
 arch/arm/plat-spear/clock.c              |  249 +++++++++++++++++++-----------
 arch/arm/plat-spear/include/plat/clock.h |    6 +-
 2 files changed, 162 insertions(+), 93 deletions(-)
arch/arm/plat-spear/clock.c +157 -92
index f1cf832..ab29353 100644
@@ -64,6 +64,40 @@ static struct clkops generic_clkops = {
 	.disable = generic_clk_disable,
 };
 
+/* returns current programmed clocks clock info structure */
+static struct pclk_info *pclk_info_get(struct clk *clk)
+{
+	unsigned int mask, i;
+	struct pclk_info *info = NULL;
+
+	mask = (readl(clk->pclk_sel->pclk_sel_reg) >> clk->pclk_sel_shift)
+		& clk->pclk_sel->pclk_sel_mask;
+
+	for (i = 0; i < clk->pclk_sel->pclk_count; i++) {
+		if (clk->pclk_sel->pclk_info[i].pclk_mask == mask)
+			info = &clk->pclk_sel->pclk_info[i];
+	}
+
+	return info;
+}
+
+/*
+ * Set Update pclk, and pclk_info of clk and add clock sibling node to current
+ * parents children list
+ */
+static void update_clk_tree(struct clk *clk, struct pclk_info *pclk_info)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&clocks_lock, flags);
+	list_del(&clk->sibling);
+	list_add(&clk->sibling, &pclk_info->pclk->children);
+
+	clk->pclk = pclk_info->pclk;
+	clk->pclk_info = pclk_info;
+	spin_unlock_irqrestore(&clocks_lock, flags);
+}
+
 /*
  * clk_enable - inform the system when the clock source should be running.
  * @clk: clock source
@@ -161,6 +195,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 	if (clk->pclk == parent)
 		return 0;
 
+	/* check if requested parent is in clk parent list */
 	for (i = 0; i < clk->pclk_sel->pclk_count; i++) {
 		if (clk->pclk_sel->pclk_info[i].pclk == parent) {
 			found = 1;
@@ -180,8 +215,11 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 	spin_unlock_irqrestore(&clocks_lock, flags);
 
 	/* reflect parent change in software */
+	update_clk_tree(clk, &clk->pclk_sel->pclk_info[i]);
+
 	clk->recalc(clk);
 	propagate_rate(&clk->children);
+
 	return 0;
 }
 EXPORT_SYMBOL(clk_set_parent);
@@ -220,14 +258,23 @@ void clk_register(struct clk_lookup *cl)
 	/* root clock don't have any parents */
 	if (!clk->pclk && !clk->pclk_sel) {
 		list_add(&clk->sibling, &root_clks);
-		/* add clocks with only one parent to parent's children list */
 	} else if (clk->pclk && !clk->pclk_sel) {
+		/* add clocks with only one parent to parent's children list */
 		list_add(&clk->sibling, &clk->pclk->children);
 	} else {
-		/* add clocks with > 1 parent to 1st parent's children list */
-		clk->pclk = clk->pclk_sel->pclk_info[0].pclk;
-		list_add(&clk->sibling,
-			 &clk->pclk_sel->pclk_info[0].pclk->children);
+		/* clocks with more than one parent */
+		struct pclk_info *pclk_info;
+
+		pclk_info = pclk_info_get(clk);
+		if (!pclk_info) {
+			printk(KERN_ERR "CLKDEV: invalid pclk info of clk with"
+					" %s dev_id and %s con_id\n",
+					cl->dev_id, cl->con_id);
+		} else {
+			clk->pclk = pclk_info->pclk;
+			clk->pclk_info = pclk_info;
+			list_add(&clk->sibling, &pclk_info->pclk->children);
+		}
 	}
 	spin_unlock_irqrestore(&clocks_lock, flags);
 
@@ -252,42 +299,6 @@ static void propagate_rate(struct list_head *lhead)
 	}
 }
 
-/* returns current programmed clocks clock info structure */
-static struct pclk_info *pclk_info_get(struct clk *clk)
-{
-	unsigned int mask, i;
-	unsigned long flags;
-	struct pclk_info *info = NULL;
-
-	spin_lock_irqsave(&clocks_lock, flags);
-	mask = (readl(clk->pclk_sel->pclk_sel_reg) >> clk->pclk_sel_shift)
-			& clk->pclk_sel->pclk_sel_mask;
-
-	for (i = 0; i < clk->pclk_sel->pclk_count; i++) {
-		if (clk->pclk_sel->pclk_info[i].pclk_mask == mask)
-			info = &clk->pclk_sel->pclk_info[i];
-	}
-	spin_unlock_irqrestore(&clocks_lock, flags);
-
-	return info;
-}
-
-/*
- * Set pclk as cclk's parent and add clock sibling node to current parents
- * children list
- */
-static void change_parent(struct clk *cclk, struct clk *pclk)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&clocks_lock, flags);
-	list_del(&cclk->sibling);
-	list_add(&cclk->sibling, &pclk->children);
-
-	cclk->pclk = pclk;
-	spin_unlock_irqrestore(&clocks_lock, flags);
-}
-
 /*
  * calculates current programmed rate of pll1
  *
@@ -304,28 +315,53 @@ void pll_clk_recalc(struct clk *clk)
 	unsigned long flags;
 
 	spin_lock_irqsave(&clocks_lock, flags);
-	mode = (readl(config->mode_reg) >> config->masks->mode_shift) &
-		config->masks->mode_mask;
-
-	val = readl(config->cfg_reg);
-	/* calculate denominator */
-	den = (val >> config->masks->div_p_shift) & config->masks->div_p_mask;
-	den = 1 << den;
-	den *= (val >> config->masks->div_n_shift) & config->masks->div_n_mask;
-
-	/* calculate numerator & denominator */
-	if (!mode) {
-		/* Normal mode */
-		num *= (val >> config->masks->norm_fdbk_m_shift) &
-			config->masks->norm_fdbk_m_mask;
+
+	/*
+	 * read divisor from hardware, only in two cases:
+	 * - There is only parent to clk and it requires *_clk_recalc
+	 * - There are two parents of a clock and current pclk requires
+	 *   *_clk_recalc
+	 */
+	if (!clk->pclk_info || clk->pclk_info->scalable) {
+		mode = (readl(config->mode_reg) >> config->masks->mode_shift) &
+			config->masks->mode_mask;
+
+		val = readl(config->cfg_reg);
+		spin_unlock_irqrestore(&clocks_lock, flags);
+
+		/* calculate denominator */
+		den = (val >> config->masks->div_p_shift) &
+			config->masks->div_p_mask;
+		den = 1 << den;
+		den *= (val >> config->masks->div_n_shift) &
+			config->masks->div_n_mask;
+
+		/* calculate numerator & denominator */
+		if (!mode) {
+			/* Normal mode */
+			num *= (val >> config->masks->norm_fdbk_m_shift) &
+				config->masks->norm_fdbk_m_mask;
+		} else {
+			/* Dithered mode */
+			num *= (val >> config->masks->dith_fdbk_m_shift) &
+				config->masks->dith_fdbk_m_mask;
+			den *= 256;
+		}
+
+		spin_lock_irqsave(&clocks_lock, flags);
+		val = (((clk->pclk->rate/10000) * num) / den) * 10000;
 	} else {
-		/* Dithered mode */
-		num *= (val >> config->masks->dith_fdbk_m_shift) &
-			config->masks->dith_fdbk_m_mask;
-		den *= 256;
+		int div = 0;
+		/*
+		 * only if there are two parents and current parent requires
+		 * simple division
+		 */
+		div = (clk->pclk_info->div_factor < 1) ? 1 :
+			clk->pclk_info->div_factor;
+		val = clk->pclk->rate/div;
 	}
 
-	clk->rate = (((clk->pclk->rate/10000) * num) / den) * 10000;
+	clk->rate = val;
 	spin_unlock_irqrestore(&clocks_lock, flags);
 }
 
@@ -337,8 +373,23 @@ void bus_clk_recalc(struct clk *clk)
 	unsigned long flags;
 
 	spin_lock_irqsave(&clocks_lock, flags);
-	div = ((readl(config->reg) >> config->masks->shift) &
-			config->masks->mask) + 1;
+	/*
+	 * read divisor from hardware, only in two cases:
+	 * - There is only parent to clk and it requires *_clk_recalc
+	 * - There are two parents of a clock and current pclk requires
+	 *   *_clk_recalc
+	 */
+	if (!clk->pclk_info || clk->pclk_info->scalable) {
+		div = ((readl(config->reg) >> config->masks->shift) &
+				config->masks->mask) + 1;
+	} else {
+		/*
+		 * only if there are two parents and current parent requires
+		 * simple division
+		 */
+		div = (clk->pclk_info->div_factor < 1) ? 1 :
+			clk->pclk_info->div_factor;
+	}
 	clk->rate = (unsigned long)clk->pclk->rate / div;
 	spin_unlock_irqrestore(&clocks_lock, flags);
 }
@@ -356,25 +407,19 @@ void bus_clk_recalc(struct clk *clk)
 void aux_clk_recalc(struct clk *clk)
 {
 	struct aux_clk_config *config = clk->private_data;
-	struct pclk_info *pclk_info = NULL;
 	unsigned int num = 1, den = 1, val, eqn;
 	unsigned long flags;
 
-	/* get current programmed parent */
-	pclk_info = pclk_info_get(clk);
-	if (!pclk_info) {
-		spin_lock_irqsave(&clocks_lock, flags);
-		clk->pclk = NULL;
-		clk->rate = 0;
-		spin_unlock_irqrestore(&clocks_lock, flags);
-		return;
-	}
-
-	change_parent(clk, pclk_info->pclk);
-
 	spin_lock_irqsave(&clocks_lock, flags);
-	if (pclk_info->scalable) {
+	/*
+	 * read divisor from hardware, only in two cases:
+	 * - There is only parent to clk and it requires *_clk_recalc
+	 * - There are two parents of a clock and current pclk requires
+	 *   *_clk_recalc
+	 */
+	if (!clk->pclk_info || clk->pclk_info->scalable) {
 		val = readl(config->synth_reg);
+		spin_unlock_irqrestore(&clocks_lock, flags);
 
 		eqn = (val >> config->masks->eq_sel_shift) &
 			config->masks->eq_sel_mask;
@@ -388,9 +433,19 @@ void aux_clk_recalc(struct clk *clk)
 		/* calculate denominator */
 		den *= (val >> config->masks->yscale_sel_shift) &
 			config->masks->yscale_sel_mask;
+
+		spin_lock_irqsave(&clocks_lock, flags);
 		val = (((clk->pclk->rate/10000) * num) / den) * 10000;
-	} else
-		val = clk->pclk->rate;
+	} else {
+		/*
+		 * only if there are two parents and current parent requires
+		 * simple division
+		 */
+		int div_factor = (clk->pclk_info->div_factor < 1) ? 1 :
+			clk->pclk_info->div_factor;
+
+		val = clk->pclk->rate/div_factor;
+	}
 
 	clk->rate = val;
 	spin_unlock_irqrestore(&clocks_lock, flags);
@@ -404,28 +459,32 @@ void aux_clk_recalc(struct clk *clk)
 void gpt_clk_recalc(struct clk *clk)
 {
 	struct gpt_clk_config *config = clk->private_data;
-	struct pclk_info *pclk_info = NULL;
 	unsigned int div = 1, val;
 	unsigned long flags;
 
-	pclk_info = pclk_info_get(clk);
-	if (!pclk_info) {
-		spin_lock_irqsave(&clocks_lock, flags);
-		clk->pclk = NULL;
-		clk->rate = 0;
-		spin_unlock_irqrestore(&clocks_lock, flags);
-		return;
-	}
-
-	change_parent(clk, pclk_info->pclk);
-
 	spin_lock_irqsave(&clocks_lock, flags);
-	if (pclk_info->scalable) {
+	/*
+	 * read divisor from hardware, only in two cases:
+	 * - There is only parent to clk and it requires *_clk_recalc
+	 * - There are two parents of a clock and current pclk requires
+	 *   *_clk_recalc
+	 */
+	if (!clk->pclk_info || clk->pclk_info->scalable) {
 		val = readl(config->synth_reg);
+		spin_unlock_irqrestore(&clocks_lock, flags);
+
 		div += (val >> config->masks->mscale_sel_shift) &
 			config->masks->mscale_sel_mask;
 		div *= 1 << (((val >> config->masks->nscale_sel_shift) &
 					config->masks->nscale_sel_mask) + 1);
+		spin_lock_irqsave(&clocks_lock, flags);
+	} else {
+		/*
+		 * only if there are two parents and current parent requires
+		 * simple division
+		 */
+		div = (clk->pclk_info->div_factor < 1) ? 1 :
+			clk->pclk_info->div_factor;
 	}
 
 	clk->rate = (unsigned long)clk->pclk->rate / div;
@@ -439,9 +498,15 @@ void gpt_clk_recalc(struct clk *clk)
 void follow_parent(struct clk *clk)
 {
 	unsigned long flags;
-	unsigned int div_factor = (clk->div_factor < 1) ? 1 : clk->div_factor;
+	unsigned int div_factor;
 
 	spin_lock_irqsave(&clocks_lock, flags);
+	if (clk->pclk_info)
+		div_factor = clk->pclk_info->div_factor;
+	else
+		div_factor = clk->div_factor;
+	div_factor = (div_factor < 1) ? 1 : div_factor;
+
 	clk->rate = clk->pclk->rate/div_factor;
 	spin_unlock_irqrestore(&clocks_lock, flags);
 }
arch/arm/plat-spear/include/plat/clock.h +5 -1
index e08b58c..d8d0856 100644
@@ -37,11 +37,13 @@ struct clkops {
  * @pclk: pointer to parent clk
  * @pclk_mask: value to be written for selecting this parent
  * @scalable: Is parent scalable (1 - YES, 0 - NO)
+ * @div_factor: div factor for pclk
  */
 struct pclk_info {
 	struct clk *pclk;
 	u8 pclk_mask;
 	u8 scalable;
+	u8 div_factor;
 };
 
 /**
@@ -67,8 +69,9 @@ struct pclk_sel {
  * @en_reg_bit: clk enable/disable bit
  * @ops: clk enable/disable ops - generic_clkops selected if NULL
  * @recalc: pointer to clock rate recalculate function
- * @div_factor: division factor to parent clock. Only for recalc = follow_parent
+ * @div_factor: division factor to parent clock. Only for clks with one parent
  * @pclk: current parent clk
+ * @pclk_info: current parent clk's pclk_info
  * @pclk_sel: pointer to parent selection structure
  * @pclk_sel_shift: register shift for selecting parent of this clock
  * @children: list for childrens or this clock
@@ -86,6 +89,7 @@ struct clk {
 	unsigned int div_factor;
 
 	struct clk *pclk;
+	struct pclk_info *pclk_info;
 	struct pclk_sel *pclk_sel;
 	unsigned int pclk_sel_shift;
 
Signature · 1 line
1.7.2.2
#36 lore raw

PATCH 12/74 ST SPEAr: Correcting SOC Config base address for spear320

In reply to Viresh KUMAR
---
 arch/arm/mach-spear3xx/include/mach/spear320.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-spear3xx/include/mach/spear320.h +1 -1
index cacf17a..53677e4 100644
@@ -62,7 +62,7 @@
 #define SPEAR320_SMII1_BASE		0xAB000000
 #define SPEAR320_SMII1_SIZE		0x01000000
 
-#define SPEAR320_SOC_CONFIG_BASE	0xB4000000
+#define SPEAR320_SOC_CONFIG_BASE	0xB3000000
 #define SPEAR320_SOC_CONFIG_SIZE	0x00000070
 /* Interrupt registers offsets and masks */
 #define INT_STS_MASK_REG		0x04
Signature · 1 line
1.7.2.2
#37 lore raw

PATCH 12/74 ST SPEAr: Correcting SOC Config base address for spear320

Hi,

not relased to this patch series

Best Regards,
J.

Quoted 26 lines · Viresh KUMAR
---
 arch/arm/mach-spear3xx/include/mach/spear320.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-spear3xx/include/mach/spear320.h +1 -1
index cacf17a..53677e4 100644
@@ -62,7 +62,7 @@
 #define SPEAR320_SMII1_BASE		0xAB000000
 #define SPEAR320_SMII1_SIZE		0x01000000
 
-#define SPEAR320_SOC_CONFIG_BASE	0xB4000000
+#define SPEAR320_SOC_CONFIG_BASE	0xB3000000
 #define SPEAR320_SOC_CONFIG_SIZE	0x00000070
 /* Interrupt registers offsets and masks */
 #define INT_STS_MASK_REG		0x04
Signature · 7 lines
1.7.2.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#38 lore raw

PATCH 12/74 ST SPEAr: Correcting SOC Config base address for spear320

Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

not relased to this patch series

Jean,

Current patch series is named "Updating SPEAr Support".
This patch is just an bug fix. Why shouldn't it be part of this series.

regards,
viresh

Quoted 29 lines · Viresh KUMAR
Quoted 26 lines
---
 arch/arm/mach-spear3xx/include/mach/spear320.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-spear3xx/include/mach/spear320.h +1 -1
index cacf17a..53677e4 100644
@@ -62,7 +62,7 @@
 #define SPEAR320_SMII1_BASE		0xAB000000
 #define SPEAR320_SMII1_SIZE		0x01000000
 
-#define SPEAR320_SOC_CONFIG_BASE	0xB4000000
+#define SPEAR320_SOC_CONFIG_BASE	0xB3000000
 #define SPEAR320_SOC_CONFIG_SIZE	0x00000070
 /* Interrupt registers offsets and masks */
 #define INT_STS_MASK_REG		0x04
Signature · 7 lines
1.7.2.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

.

#39 lore raw

PATCH 13/74 ST SPEAr: Update clock framework and definitions

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

- Defined clks for synthesizers and prescalers as they were shared among IPs
- Simplified clk_recalc functions
- Keep divisor only at 1 level i.e. during clk defn
- Added missing clock definitions

---
 arch/arm/mach-spear13xx/clock.c                  |  510 +++++++++++++++++++++-
 arch/arm/mach-spear13xx/include/mach/misc_regs.h |   99 +++--
 arch/arm/mach-spear3xx/clock.c                   |  176 ++++++---
 arch/arm/mach-spear3xx/include/mach/misc_regs.h  |    5 +-
 arch/arm/mach-spear6xx/clock.c                   |  256 ++++++++----
 arch/arm/mach-spear6xx/include/mach/misc_regs.h  |    5 +-
 arch/arm/plat-spear/clock.c                      |  208 ++++------
 arch/arm/plat-spear/include/plat/clock.h         |   24 +-
 8 files changed, 940 insertions(+), 343 deletions(-)
arch/arm/mach-spear13xx/clock.c +486 -24
index 280eb5b..cef3b13 100644
@@ -52,10 +52,10 @@ static struct clk rtc_clk = {
 static struct pclk_info pll_pclk_info[] = {
 	{
 		.pclk = &osc1_24m_clk,
-		.pclk_mask = OSC_24M_MASK,
+		.pclk_val = OSC_24M_VAL,
 	}, {
 		.pclk = &osc3_25m_clk,
-		.pclk_mask = OSC_25M_MASK,
+		.pclk_val = OSC_25M_VAL,
 	},
 };
 
@@ -97,6 +97,22 @@ static struct clk pll1_clk = {
 	.private_data = &pll1_config,
 };
 
+/* pll1div2 clock */
+static struct clk pll1div2_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &pll1_clk,
+	.div_factor = 2,
+	.recalc = &follow_parent,
+};
+
+/* pll1div4 clock */
+static struct clk pll1div4_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &pll1_clk,
+	.div_factor = 4,
+	.recalc = &follow_parent,
+};
+
 /* pll2 configuration structure */
 static struct pll_clk_config pll2_config = {
 	.mode_reg = PLL2_CTR,
@@ -191,10 +207,10 @@ static struct clk apb_clk = {
 static struct pclk_info gpt_pclk_info[] = {
 	{
 		.pclk = &osc1_24m_clk,
-		.pclk_mask = GPT_OSC24_MASK,
+		.pclk_val = GPT_OSC24_VAL,
 	}, {
 		.pclk = &apb_clk,
-		.pclk_mask = GPT_APB_MASK,
+		.pclk_val = GPT_APB_VAL,
 	},
 };
 
@@ -249,14 +265,6 @@ static struct clk wdt_clk = {
 	.recalc = &follow_parent,
 };
 
-/* smi clock */
-static struct clk smi_clk = {
-	.pclk = &ahb_clk,
-	.en_reg = PERIP1_CLK_ENB,
-	.en_reg_bit = SMI_CLK_ENB,
-	.recalc = &follow_parent,
-};
-
 /* auxiliary synthesizers masks */
 static struct aux_clk_masks aux_masks = {
 	.eq_sel_mask = AUX_EQ_SEL_MASK,
@@ -269,22 +277,30 @@ static struct aux_clk_masks aux_masks = {
 	.yscale_sel_shift = AUX_YSCALE_SHIFT,
 };
 
+/* clocks derived multiple parents (pll1, pll5, synthesizers or others) */
 /* uart configurations */
-static struct aux_clk_config uart_config = {
+static struct aux_clk_config uart_synth_config = {
 	.synth_reg = UART_CLK_SYNT,
 	.masks = &aux_masks,
 };
 
-/* clocks derived from pll1 or pll5 */
+/* uart synth clock */
+static struct clk uart_synth_clk = {
+	.en_reg = UART_CLK_SYNT,
+	.en_reg_bit = AUX_SYNT_ENB,
+	.pclk = &pll1div2_clk,
+	.recalc = &aux_clk_recalc,
+	.private_data = &uart_synth_config,
+};
+
 /* uart parents */
 static struct pclk_info uart_pclk_info[] = {
 	{
 		.pclk = &pll5_clk,
-		.pclk_mask = AUX_CLK_PLL5_MASK,
+		.pclk_val = AUX_CLK_PLL5_VAL,
 	}, {
-		.pclk = &pll1_clk,
-		.pclk_mask = AUX_CLK_PLL1_MASK,
-		.scalable = 1,
+		.pclk = &uart_synth_clk,
+		.pclk_val = AUX_CLK_SYNT_VAL,
 	},
 };
 
@@ -302,8 +318,414 @@ static struct clk uart_clk = {
 	.en_reg_bit = UART_CLK_ENB,
 	.pclk_sel = &uart_pclk_sel,
 	.pclk_sel_shift = UART_CLK_SHIFT,
+	.recalc = &follow_parent,
+};
+
+/* sd configurations */
+static struct aux_clk_config sd_synth_config = {
+	.synth_reg = SD_CLK_SYNT,
+	.masks = &aux_masks,
+};
+
+/* sd synth clock */
+static struct clk sd_synth_clk = {
+	.en_reg = SD_CLK_SYNT,
+	.en_reg_bit = AUX_SYNT_ENB,
+	.pclk = &pll1div2_clk,
+	.recalc = &aux_clk_recalc,
+	.private_data = &sd_synth_config,
+};
+
+/* sd clock */
+static struct clk sd_clk = {
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = SD_CLK_ENB,
+	.pclk = &sd_synth_clk,
+	.recalc = &follow_parent,
+};
+
+/* cfxd configurations */
+static struct aux_clk_config cfxd_synth_config = {
+	.synth_reg = CFXD_CLK_SYNT,
+	.masks = &aux_masks,
+};
+
+/* cfxd synth clock */
+static struct clk cfxd_synth_clk = {
+	.en_reg = CFXD_CLK_SYNT,
+	.en_reg_bit = AUX_SYNT_ENB,
+	.pclk = &pll1div2_clk,
+	.recalc = &aux_clk_recalc,
+	.private_data = &cfxd_synth_config,
+};
+
+/* cfxd clock */
+static struct clk cfxd_clk = {
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = CFXD_CLK_ENB,
+	.pclk = &cfxd_synth_clk,
+	.recalc = &follow_parent,
+};
+
+/* C3 clk configurations */
+static struct aux_clk_config c3_synth_config = {
+	.synth_reg = C3_CLK_SYNT,
+	.masks = &aux_masks,
+};
+
+/* c3 synth clock */
+static struct clk c3_synth_clk = {
+	.en_reg = C3_CLK_SYNT,
+	.en_reg_bit = AUX_SYNT_ENB,
+	.pclk = &pll1div2_clk,
 	.recalc = &aux_clk_recalc,
-	.private_data = &uart_config,
+	.private_data = &c3_synth_config,
+};
+
+/* c3 parents */
+static struct pclk_info c3_pclk_info[] = {
+	{
+		.pclk = &pll5_clk,
+		.pclk_val = AUX_CLK_PLL5_VAL,
+	}, {
+		.pclk = &c3_synth_clk,
+		.pclk_val = AUX_CLK_SYNT_VAL,
+	},
+};
+
+/* c3 parent select structure */
+static struct pclk_sel c3_pclk_sel = {
+	.pclk_info = c3_pclk_info,
+	.pclk_count = ARRAY_SIZE(c3_pclk_info),
+	.pclk_sel_reg = PERIP_CLK_CFG,
+	.pclk_sel_mask = C3_CLK_MASK,
+};
+
+/* c3 clock */
+static struct clk c3_clk = {
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = C3_CLK_ENB,
+	.pclk_sel = &c3_pclk_sel,
+	.pclk_sel_shift = C3_CLK_SHIFT,
+	.recalc = &follow_parent,
+};
+
+/* gmac phy clk configurations */
+static struct aux_clk_config gmac_phy_synth_config = {
+	.synth_reg = GMAC_CLK_SYNT,
+	.masks = &aux_masks,
+};
+
+/* gmii external pad clock for phy operation */
+static struct clk gmii_txclk125_pad = {
+	.flags = ALWAYS_ENABLED,
+	.rate = 125000000,
+};
+
+/* gmac phy set of input clks*/
+static struct pclk_info gmac_phy_input_pclk_info[] = {
+	{
+		.pclk = &gmii_txclk125_pad,
+		.pclk_val = GMAC_PHY_PAD_VAL,
+	}, {
+		.pclk = &pll2_clk,
+		.pclk_val = GMAC_PHY_PLL2_VAL,
+	}, {
+		.pclk = &osc3_25m_clk,
+		.pclk_val = GMAC_PHY_OSC3_VAL,
+	},
+};
+
+static struct pclk_sel gmac_phy_input_pclk_sel = {
+	.pclk_info = gmac_phy_input_pclk_info,
+	.pclk_count = ARRAY_SIZE(gmac_phy_input_pclk_info),
+	.pclk_sel_reg = GMAC_CLK_CFG,
+	.pclk_sel_mask = GMAC_PHY_INPUT_CLK_MASK,
+};
+
+static struct clk gmac_phy_input_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk_sel = &gmac_phy_input_pclk_sel,
+	.pclk_sel_shift = GMAC_PHY_INPUT_CLK_SHIFT,
+	.recalc = &follow_parent,
+};
+
+static struct clk gmac_phy_synth_clk = {
+	.en_reg = GMAC_CLK_CFG,
+	.en_reg_bit = GMAC_PHY_SYNT_ENB,
+	.pclk = &gmac_phy_input_clk,
+	.recalc = &aux_clk_recalc,
+	.private_data = &gmac_phy_synth_config,
+};
+
+/* gmac phy parents */
+static struct pclk_info gmac_phy_pclk_info[] = {
+	{
+		.pclk = &gmac_phy_input_clk,
+		.pclk_val = 0,
+	}, {
+		.pclk = &gmac_phy_synth_clk,
+		.pclk_val = 1,
+	}
+};
+
+/* gmac phy parent select structure */
+static struct pclk_sel gmac_phy_pclk_sel = {
+	.pclk_info = gmac_phy_pclk_info,
+	.pclk_count = ARRAY_SIZE(gmac_phy_pclk_info),
+	.pclk_sel_reg = GMAC_CLK_CFG,
+	.pclk_sel_mask = GMAC_PHY_CLK_MASK,
+};
+
+/* gmac phy clock */
+static struct clk gmac_phy_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk_sel = &gmac_phy_pclk_sel,
+	.pclk_sel_shift = GMAC_PHY_CLK_SHIFT,
+	.recalc = &follow_parent,
+};
+
+/* clcd synthesizers masks */
+static struct clcd_synth_masks clcd_masks = {
+	.div_factor_mask = CLCD_SYNT_DIV_FACTOR_MASK,
+	.div_factor_shift = CLCD_SYNT_DIV_FACTOR_SHIFT,
+};
+
+static struct clcd_clk_config clcd_synth_config = {
+	.synth_reg = CLCD_CLK_SYNT,
+	.masks = &clcd_masks,
+};
+
+/* clcd synth parents */
+static struct pclk_info clcd_synth_pclk_info[] = {
+	{
+		.pclk = &pll1div4_clk,
+		.pclk_val = CLCD_SYNT_PLL1_DIV4_VAL,
+	}, {
+		.pclk = &pll2_clk,
+		.pclk_val = CLCD_SYNT_PLL2_VAL,
+	},
+};
+
+/* clcd synth parent select structure */
+static struct pclk_sel clcd_synth_pclk_sel = {
+	.pclk_info = clcd_synth_pclk_info,
+	.pclk_count = ARRAY_SIZE(clcd_synth_pclk_info),
+	.pclk_sel_reg = PLL_CFG,
+	.pclk_sel_mask = CLCD_SYNT_CLK_MASK,
+};
+
+/* clcd synth clock */
+static struct clk clcd_synth_clk = {
+	.en_reg = CLCD_CLK_SYNT,
+	.en_reg_bit = CLCD_SYNT_ENB,
+	.pclk_sel = &clcd_synth_pclk_sel,
+	.pclk_sel_shift = CLCD_SYNT_CLK_SHIFT,
+	.recalc = &clcd_clk_recalc,
+	.private_data = &clcd_synth_config,
+};
+
+/* clcd clock parents */
+static struct pclk_info clcd_pclk_info[] = {
+	{
+		.pclk = &pll5_clk,
+		.pclk_val = AUX_CLK_PLL5_VAL,
+	}, {
+		.pclk = &clcd_synth_clk,
+		.pclk_val = AUX_CLK_SYNT_VAL,
+	},
+};
+
+/* clcd parent select structure */
+static struct pclk_sel clcd_pclk_sel = {
+	.pclk_info = clcd_pclk_info,
+	.pclk_count = ARRAY_SIZE(clcd_pclk_info),
+	.pclk_sel_reg = PERIP_CLK_CFG,
+	.pclk_sel_mask = CLCD_CLK_MASK,
+};
+
+/* clcd clock */
+static struct clk clcd_clk = {
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = CLCD_CLK_ENB,
+	.pclk_sel = &clcd_pclk_sel,
+	.pclk_sel_shift = CLCD_CLK_SHIFT,
+	.recalc = &follow_parent,
+};
+
+/* clock derived from ahb clk */
+
+/* i2c clock */
+static struct clk i2c_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = I2C_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* dma clock */
+static struct clk dma0_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = DMA0_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+static struct clk dma1_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = DMA1_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* jpeg clock */
+static struct clk jpeg_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = JPEG_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* gmac clock */
+static struct clk gmac_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = GMAC_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* fsmc clock */
+static struct clk fsmc_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = SMI_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* smi clock */
+static struct clk smi_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = SMI_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* uhc0 clock */
+static struct clk uhci0_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = UHC0_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* uhc1 clock */
+static struct clk uhci1_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = UHC1_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* usbd clock */
+static struct clk usbd_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = USBD_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* pci clocks */
+static struct clk pcie0_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = PCIE0_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+static struct clk pcie1_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = PCIE1_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+static struct clk pcie2_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = PCIE2_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* sysram clocks */
+static struct clk sysram0_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = SYSRAM0_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+static struct clk sysram1_clk = {
+	.pclk = &ahb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = SYSRAM1_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* clock derived from apb clk */
+/* adc clock */
+static struct clk adc_clk = {
+	.pclk = &apb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = ADC_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* ssp clock */
+static struct clk ssp_clk = {
+	.pclk = &apb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = SSP_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* gpio clock */
+static struct clk gpio0_clk = {
+	.pclk = &apb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = GPIO0_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* gpio clock */
+static struct clk gpio1_clk = {
+	.pclk = &apb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = GPIO1_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* i2s0 clock */
+static struct clk i2s0_clk = {
+	.pclk = &apb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = I2S0_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* i2s1 clock */
+static struct clk i2s1_clk = {
+	.pclk = &apb_clk,
+	.en_reg = PERIP1_CLK_ENB,
+	.en_reg_bit = I2S1_CLK_ENB,
+	.recalc = &follow_parent,
+};
+
+/* keyboard clock */
+static struct clk kbd_clk = {
+	.pclk = &apb_clk,
+	.en_reg = PERIP2_CLK_ENB,
+	.en_reg_bit = KBD_CLK_ENB,
+	.recalc = &follow_parent,
 };
 
 /* array of all spear 13xx clock lookups */
@@ -327,18 +749,58 @@ static struct clk_lookup spear_clk_lookups[] = {
 	/* clock derived from pll1 clk */
 	{.con_id = "cpu_clk",		.clk = &cpu_clk},
 	{.con_id = "ahb_clk",		.clk = &ahb_clk},
-	{ .con_id = "apb_clk",		.clk = &apb_clk},
+	{.con_id = "apb_clk",		.clk = &apb_clk},
+
+	/* synthesizers/prescaled clocks */
+	{.con_id = "pll1div2_clk",		.clk = &pll1div2_clk},
+	{.con_id = "pll1div4_clk",		.clk = &pll1div4_clk},
+	{.con_id = "c3_synth_clk",		.clk = &c3_synth_clk},
+	{.con_id = "gmii_txclk123_pad_clk",	.clk = &gmii_txclk125_pad},
+	{.con_id = "clcd_synth_clk",		.clk = &clcd_synth_clk},
+	{.con_id = "uart_synth_clk",		.clk = &uart_synth_clk},
+	{.con_id = "sd_synth_clk",		.clk = &sd_synth_clk},
+	{.con_id = "cfxd_synth_clk",		.clk = &cfxd_synth_clk},
+	{.con_id = "gmac_phy_input_clk",	.clk = &gmac_phy_input_clk},
+	{.con_id = "gmac_phy_synth_clk",	.clk = &gmac_phy_synth_clk},
+	{.con_id = "gmac_phy_clk",		.clk = &gmac_phy_clk},
 
 	/* clocks having multiple parent source from above clocks */
-	{.dev_id = "uart",		.clk = &uart_clk},
+	{.dev_id = "clcd",		.clk = &clcd_clk},
 	{.dev_id = "gpt0",		.clk = &gpt0_clk},
 	{.dev_id = "gpt1",		.clk = &gpt1_clk},
 	{.dev_id = "gpt2",		.clk = &gpt2_clk},
 	{.dev_id = "gpt3",		.clk = &gpt3_clk},
+	{.dev_id = "uart",		.clk = &uart_clk},
 
-	/* clock derived from ahb/apb clk */
-	{ .dev_id = "smi",		.clk = &smi_clk},
-	{ .dev_id = "wdt",		.clk = &wdt_clk},
+	/* clock derived from ahb clk */
+	{.dev_id = "smi",		.clk = &smi_clk},
+	{.dev_id = "uhci0",		.clk = &uhci0_clk},
+	{.dev_id = "uhci1",		.clk = &uhci1_clk},
+	{.dev_id = "usbd",		.clk = &usbd_clk},
+	{.dev_id = "i2c",		.clk = &i2c_clk},
+	{.dev_id = "dma0",		.clk = &dma0_clk},
+	{.dev_id = "dma1",		.clk = &dma1_clk},
+	{.dev_id = "jpeg",		.clk = &jpeg_clk},
+	{.dev_id = "gmac",		.clk = &gmac_clk},
+	{.dev_id = "c3",		.clk = &c3_clk},
+	{.dev_id = "pcie0",		.clk = &pcie0_clk},
+	{.dev_id = "pcie1",		.clk = &pcie1_clk},
+	{.dev_id = "pcie2",		.clk = &pcie2_clk},
+	{.dev_id = "cfxd",		.clk = &cfxd_clk},
+	{.dev_id = "sd",		.clk = &sd_clk},
+	{.dev_id = "fsmc",		.clk = &fsmc_clk},
+	{.dev_id = "sysram0",		.clk = &sysram0_clk},
+	{.dev_id = "sysram1",		.clk = &sysram1_clk},
+
+	/* clock derived from apb clk */
+	{.dev_id = "i2s0",		.clk = &i2s0_clk},
+	{.dev_id = "i2s1",		.clk = &i2s1_clk},
+	{.dev_id = "adc",		.clk = &adc_clk},
+	{.dev_id = "ssp",		.clk = &ssp_clk},
+	{.dev_id = "gpio0",		.clk = &gpio0_clk},
+	{.dev_id = "gpio1",		.clk = &gpio1_clk},
+	{.dev_id = "kbd",		.clk = &kbd_clk},
+	{.dev_id = "wdt",		.clk = &wdt_clk},
 };
 
 void __init clk_init(void)
arch/arm/mach-spear13xx/include/mach/misc_regs.h +63 -36

148 lines not on this page · raw message

arch/arm/mach-spear3xx/clock.c +124 -52

262 lines not on this page · raw message

arch/arm/mach-spear3xx/include/mach/misc_regs.h +3 -2
index 38d767a..6cb4f3c 100644
@@ -63,8 +63,8 @@
 #define GPT1_CLK_SHIFT		11
 #define GPT2_CLK_SHIFT		12
 #define GPT_CLK_MASK		0x1
-#define AUX_CLK_PLL3_MASK	0
-#define AUX_CLK_PLL1_MASK	1
+#define AUX_CLK_PLL3_VAL	0
+#define AUX_CLK_PLL1_VAL	1
 
 #define PERIP1_CLK_ENB		((unsigned int *)(MISC_BASE + 0x02C))
 /* PERIP1_CLK_ENB register masks */
@@ -113,6 +113,7 @@
 #define RAS3_CLK_SYNT		((unsigned int *)(MISC_BASE + 0x074))
 #define RAS4_CLK_SYNT		((unsigned int *)(MISC_BASE + 0x078))
 /* aux clk synthesiser register masks for irda to ras4 */
+#define AUX_SYNT_ENB		31
 #define AUX_EQ_SEL_SHIFT	30
 #define AUX_EQ_SEL_MASK		1
 #define AUX_EQ1_SEL		0
arch/arm/mach-spear6xx/clock.c +171 -85

364 lines not on this page · raw message

arch/arm/mach-spear6xx/include/mach/misc_regs.h +3 -2
index 0390803..bd71e72 100644
@@ -66,8 +66,8 @@
 #define GPT2_CLK_SHIFT		11
 #define GPT3_CLK_SHIFT		12
 #define GPT_CLK_MASK		0x1
-#define AUX_CLK_PLL3_MASK	0
-#define AUX_CLK_PLL1_MASK	1
+#define AUX_CLK_PLL3_VAL	0
+#define AUX_CLK_PLL1_VAL	1
 
 #define PERIP1_CLK_ENB		((unsigned int *)(MISC_BASE + 0x02C))
 /* PERIP1_CLK_ENB register masks */
@@ -123,6 +123,7 @@
 #define RAS3_CLK_SYNT		((unsigned int *)(MISC_BASE + 0x074))
 #define RAS4_CLK_SYNT		((unsigned int *)(MISC_BASE + 0x078))
 /* aux clk synthesiser register masks for irda to ras4 */
+#define AUX_SYNT_ENB		31
 #define AUX_EQ_SEL_SHIFT	30
 #define AUX_EQ_SEL_MASK		1
 #define AUX_EQ1_SEL		0
arch/arm/plat-spear/clock.c +75 -133

284 lines not on this page · raw message

arch/arm/plat-spear/include/plat/clock.h +15 -9
index d8d0856..019d308 100644
@@ -35,15 +35,11 @@ struct clkops {
 /**
  * struct pclk_info - parents info
  * @pclk: pointer to parent clk
- * @pclk_mask: value to be written for selecting this parent
- * @scalable: Is parent scalable (1 - YES, 0 - NO)
- * @div_factor: div factor for pclk
+ * @pclk_val: value to be written for selecting this parent
  */
 struct pclk_info {
 	struct clk *pclk;
-	u8 pclk_mask;
-	u8 scalable;
-	u8 div_factor;
+	u8 pclk_val;
 };
 
 /**
@@ -69,9 +65,8 @@ struct pclk_sel {
  * @en_reg_bit: clk enable/disable bit
  * @ops: clk enable/disable ops - generic_clkops selected if NULL
  * @recalc: pointer to clock rate recalculate function
- * @div_factor: division factor to parent clock. Only for clks with one parent
+ * @div_factor: division factor to parent clock.
  * @pclk: current parent clk
- * @pclk_info: current parent clk's pclk_info
  * @pclk_sel: pointer to parent selection structure
  * @pclk_sel_shift: register shift for selecting parent of this clock
  * @children: list for childrens or this clock
@@ -89,7 +84,6 @@ struct clk {
 	unsigned int div_factor;
 
 	struct clk *pclk;
-	struct pclk_info *pclk_info;
 	struct pclk_sel *pclk_sel;
 	unsigned int pclk_sel_shift;
 
@@ -160,6 +154,17 @@ struct gpt_clk_config {
 	struct gpt_clk_masks *masks;
 };
 
+/* clcd clk configuration structure */
+struct clcd_synth_masks {
+	u32 div_factor_mask;
+	u32 div_factor_shift;
+};
+
+struct clcd_clk_config {
+	u32 *synth_reg;
+	struct clcd_synth_masks *masks;
+};
+
 /* platform specific clock functions */
 void clk_register(struct clk_lookup *cl);
 void recalc_root_clocks(void);
@@ -170,5 +175,6 @@ void pll_clk_recalc(struct clk *clk);
 void bus_clk_recalc(struct clk *clk);
 void gpt_clk_recalc(struct clk *clk);
 void aux_clk_recalc(struct clk *clk);
+void clcd_clk_recalc(struct clk *clk);
 
 #endif /* __PLAT_CLOCK_H */
Signature · 1 line
1.7.2.2
#40 lore raw

PATCH 13/74 ST SPEAr: Update clock framework and definitions

arch/arm/mach-spear13xx/clock.c static struct clk_lookup spear_clk_lookups[] = { · line 753

Quoted 9 lines

/* array of all spear 13xx clock lookups */

arch/arm/mach-spear13xx/clock.c +2 -1
@@ -327,18 +749,58 @@ static struct clk_lookup spear_clk_lookups[] = {
 	/* clock derived from pll1 clk */
 	{.con_id = "cpu_clk",		.clk = &cpu_clk},
 	{.con_id = "ahb_clk",		.clk = &ahb_clk},
-	{ .con_id = "apb_clk",		.clk = &apb_clk},
+	{.con_id = "apb_clk",		.clk = &apb_clk},
+

how about use macro here to simplify the code

+#define CLKDEV_ID(__clk) { .con_id = #__clk, .clk = &(__clk) } and
+#define CLKDEV_ID_CLK(__clk) { .con_id = #__clk, .clk = &(__clk##_clk) }

arch/arm/mach-spear13xx/include/mach/misc_regs.h

Quoted 61 lines
arch/arm/mach-spear13xx/clock.c +43 -4
+	/* synthesizers/prescaled clocks */
+	{.con_id = "pll1div2_clk",		.clk = &pll1div2_clk},
+	{.con_id = "pll1div4_clk",		.clk = &pll1div4_clk},
+	{.con_id = "c3_synth_clk",		.clk = &c3_synth_clk},
+	{.con_id = "gmii_txclk123_pad_clk",	.clk = &gmii_txclk125_pad},
+	{.con_id = "clcd_synth_clk",		.clk = &clcd_synth_clk},
+	{.con_id = "uart_synth_clk",		.clk = &uart_synth_clk},
+	{.con_id = "sd_synth_clk",		.clk = &sd_synth_clk},
+	{.con_id = "cfxd_synth_clk",		.clk = &cfxd_synth_clk},
+	{.con_id = "gmac_phy_input_clk",	.clk = &gmac_phy_input_clk},
+	{.con_id = "gmac_phy_synth_clk",	.clk = &gmac_phy_synth_clk},
+	{.con_id = "gmac_phy_clk",		.clk = &gmac_phy_clk},
 
 	/* clocks having multiple parent source from above clocks */
-	{.dev_id = "uart",		.clk = &uart_clk},
+	{.dev_id = "clcd",		.clk = &clcd_clk},
 	{.dev_id = "gpt0",		.clk = &gpt0_clk},
 	{.dev_id = "gpt1",		.clk = &gpt1_clk},
 	{.dev_id = "gpt2",		.clk = &gpt2_clk},
 	{.dev_id = "gpt3",		.clk = &gpt3_clk},
+	{.dev_id = "uart",		.clk = &uart_clk},
 
-	/* clock derived from ahb/apb clk */
-	{ .dev_id = "smi",		.clk = &smi_clk},
-	{ .dev_id = "wdt",		.clk = &wdt_clk},
+	/* clock derived from ahb clk */
+	{.dev_id = "smi",		.clk = &smi_clk},
+	{.dev_id = "uhci0",		.clk = &uhci0_clk},
+	{.dev_id = "uhci1",		.clk = &uhci1_clk},
+	{.dev_id = "usbd",		.clk = &usbd_clk},
+	{.dev_id = "i2c",		.clk = &i2c_clk},
+	{.dev_id = "dma0",		.clk = &dma0_clk},
+	{.dev_id = "dma1",		.clk = &dma1_clk},
+	{.dev_id = "jpeg",		.clk = &jpeg_clk},
+	{.dev_id = "gmac",		.clk = &gmac_clk},
+	{.dev_id = "c3",		.clk = &c3_clk},
+	{.dev_id = "pcie0",		.clk = &pcie0_clk},
+	{.dev_id = "pcie1",		.clk = &pcie1_clk},
+	{.dev_id = "pcie2",		.clk = &pcie2_clk},
+	{.dev_id = "cfxd",		.clk = &cfxd_clk},
+	{.dev_id = "sd",		.clk = &sd_clk},
+	{.dev_id = "fsmc",		.clk = &fsmc_clk},
+	{.dev_id = "sysram0",		.clk = &sysram0_clk},
+	{.dev_id = "sysram1",		.clk = &sysram1_clk},
+
+	/* clock derived from apb clk */
+	{.dev_id = "i2s0",		.clk = &i2s0_clk},
+	{.dev_id = "i2s1",		.clk = &i2s1_clk},
+	{.dev_id = "adc",		.clk = &adc_clk},
+	{.dev_id = "ssp",		.clk = &ssp_clk},
+	{.dev_id = "gpio0",		.clk = &gpio0_clk},
+	{.dev_id = "gpio1",		.clk = &gpio1_clk},
+	{.dev_id = "kbd",		.clk = &kbd_clk},
+	{.dev_id = "wdt",		.clk = &wdt_clk},
 };
 
 void __init clk_init(void)
arch/arm/mach-spear13xx/include/mach/misc_regs.h +0 -0
index 2e87a07..c4dcab2 100644

how about clock.h header?

Quoted 6 lines
arch/arm/mach-spear13xx/include/mach/misc_regs.h +0 -2
@@ -36,12 +36,16 @@
 /* PLL related registers and bit values */
 #define PLL_CFG			((unsigned int *)(MISC_BASE + 0x210))
 	/* PLL_CFG bit values */
-	#define OSC_24M_MASK	0
-	#define OSC_25M_MASK	1

arch/arm/mach-spear13xx/include/mach/misc_regs.h line 44

Quoted 10 lines
arch/arm/mach-spear13xx/include/mach/misc_regs.h +6 -4
-	#define PLL_CLK_MASK	3
-	#define PLL1_CLK_SHIFT	20
-	#define PLL2_CLK_SHIFT	22
-	#define PLL3_CLK_SHIFT	24
+	#define OSC_24M_VAL			0
+	#define OSC_25M_VAL			1
+	#define PLL_CLK_MASK			3
+	#define PLL1_CLK_SHIFT			20
+	#define PLL2_CLK_SHIFT			22
+	#define PLL3_CLK_SHIFT			24

Best Regards,
J.

#41 lore raw

PATCH 13/74 ST SPEAr: Update clock framework and definitions

Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines

/* array of all spear 13xx clock lookups */

arch/arm/mach-spear13xx/clock.c static struct clk_lookup spear_clk_lookups[] = { · line 753

Quoted 7 lines
arch/arm/mach-spear13xx/clock.c +2 -1
@@ -327,18 +749,58 @@ static struct clk_lookup spear_clk_lookups[] = {
 	/* clock derived from pll1 clk */
 	{.con_id = "cpu_clk",		.clk = &cpu_clk},
 	{.con_id = "ahb_clk",		.clk = &ahb_clk},
-	{ .con_id = "apb_clk",		.clk = &apb_clk},
+	{.con_id = "apb_clk",		.clk = &apb_clk},
+

how about use macro here to simplify the code

Quoted 3 lines

+#define CLKDEV_ID(__clk) { .con_id = #__clk, .clk = &(__clk) } and
+#define CLKDEV_ID_CLK(__clk) { .con_id = #__clk, .clk = &(__clk##_clk) }

We had that in mind while designing but we chose it this way. There are not many fields to fill here, so it looks fine without macro's too. I didn't wanted to create an abstraction layer here.

Quoted 5 lines
Quoted 4 lines

arch/arm/mach-spear13xx/include/mach/misc_regs.h

Quoted 4 lines
arch/arm/mach-spear13xx/include/mach/misc_regs.h +0 -0
index 2e87a07..c4dcab2 100644

how about clock.h header?

If i understand correctly you want me to rename misc_regs.h as clock.h? Actually misc_regs.h have all miscellaneous registers for spear, like:
clock specific, reset register, some muxing registers too.. They are not only for "clock". So we kept this name.

viresh.

#42 lore raw

PATCH 13/74 ST SPEAr: Update clock framework and definitions

Quoted 11 lines · viresh kumar
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines

/* array of all spear 13xx clock lookups */

arch/arm/mach-spear13xx/clock.c static struct clk_lookup spear_clk_lookups[] = { · line 753

Quoted 7 lines
arch/arm/mach-spear13xx/clock.c +2 -1
@@ -327,18 +749,58 @@ static struct clk_lookup spear_clk_lookups[] = {
 	/* clock derived from pll1 clk */
 	{.con_id = "cpu_clk",		.clk = &cpu_clk},
 	{.con_id = "ahb_clk",		.clk = &ahb_clk},
-	{ .con_id = "apb_clk",		.clk = &apb_clk},
+	{.con_id = "apb_clk",		.clk = &apb_clk},
+

how about use macro here to simplify the code

Quoted 7 lines
Quoted 3 lines

+#define CLKDEV_ID(__clk) { .con_id = #__clk, .clk = &(__clk) } and
+#define CLKDEV_ID_CLK(__clk) { .con_id = #__clk, .clk = &(__clk##_clk) }

We had that in mind while designing but we chose it this way. There are not many fields to fill here, so it looks fine without macro's too. I didn't wanted to create an abstraction layer here.

the macro will also avoid human mistake

Quoted 11 lines
Quoted 6 lines
Quoted 5 lines

arch/arm/mach-spear13xx/include/mach/misc_regs.h

Quoted 5 lines
arch/arm/mach-spear13xx/include/mach/misc_regs.h +0 -0
index 2e87a07..c4dcab2 100644

how about clock.h header?

If i understand correctly you want me to rename misc_regs.h as clock.h? Actually misc_regs.h have all miscellaneous registers for spear, like:
clock specific, reset register, some muxing registers too.. They are not only for "clock". So we kept this name.

no split it

Best Regards,
J.

#43 lore raw

PATCH 13/74 ST SPEAr: Update clock framework and definitions

Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines · viresh kumar
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines

/* array of all spear 13xx clock lookups */

Quoted 7 lines

arch/arm/mach-spear13xx/clock.c static struct clk_lookup spear_clk_lookups[] = { · line 753

Quoted 7 lines
arch/arm/mach-spear13xx/clock.c +2 -1
@@ -327,18 +749,58 @@ static struct clk_lookup spear_clk_lookups[] = {
 	/* clock derived from pll1 clk */
 	{.con_id = "cpu_clk",		.clk = &cpu_clk},
 	{.con_id = "ahb_clk",		.clk = &ahb_clk},
-	{ .con_id = "apb_clk",		.clk = &apb_clk},
+	{.con_id = "apb_clk",		.clk = &apb_clk},
+

how about use macro here to simplify the code

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

+#define CLKDEV_ID(__clk) { .con_id = #__clk, .clk = &(__clk) } and
+#define CLKDEV_ID_CLK(__clk) { .con_id = #__clk, .clk = &(__clk##_clk) }

We had that in mind while designing but we chose it this way. There are not many fields to fill here, so it looks fine without macro's too. I didn't wanted to create an abstraction layer here.

the macro will also avoid human mistake

OK. Will do it in a separate patch.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

arch/arm/mach-spear13xx/include/mach/misc_regs.h

Quoted 5 lines
arch/arm/mach-spear13xx/include/mach/misc_regs.h +0 -0
index 2e87a07..c4dcab2 100644

how about clock.h header?

Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

If i understand correctly you want me to rename misc_regs.h as clock.h? Actually misc_regs.h have all miscellaneous registers for spear, like:
clock specific, reset register, some muxing registers too.. They are not only for "clock". So we kept this name.

no split it

We have "Miscellaneous Registers" as a seperate module in our device manuals and we don't want to break this terminology. Misc regs are intermixed, and it is difficult to separate the registers on basis of various system parameters (like clock, power etc.)

#44 lore raw

PATCH 13/74 ST SPEAr: Update clock framework and definitions

Quoted 20 lines · viresh kumar
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 18 lines · viresh kumar
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines

/* array of all spear 13xx clock lookups */

Quoted 7 lines

arch/arm/mach-spear13xx/clock.c static struct clk_lookup spear_clk_lookups[] = { · line 753

Quoted 7 lines
arch/arm/mach-spear13xx/clock.c +2 -1
@@ -327,18 +749,58 @@ static struct clk_lookup spear_clk_lookups[] = {
 	/* clock derived from pll1 clk */
 	{.con_id = "cpu_clk",		.clk = &cpu_clk},
 	{.con_id = "ahb_clk",		.clk = &ahb_clk},
-	{ .con_id = "apb_clk",		.clk = &apb_clk},
+	{.con_id = "apb_clk",		.clk = &apb_clk},
+

how about use macro here to simplify the code

Quoted 3 lines
Quoted 3 lines

+#define CLKDEV_ID(__clk) { .con_id = #__clk, .clk = &(__clk) } and
+#define CLKDEV_ID_CLK(__clk) { .con_id = #__clk, .clk = &(__clk##_clk) }

We had that in mind while designing but we chose it this way. There are not many fields to fill here, so it looks fine without macro's too. I didn't wanted to create an abstraction layer here.

Quoted 3 lines
Quoted 1 line

the macro will also avoid human mistake

OK. Will do it in a separate patch.

I'd suggest leaving it as is - presumably its already been tested and so works.

Adding that macro just encourages bad usage anyway - by encouraging people to name individual clocks by their source rather than by their consumer. Naming clocks by their source has been proven many times to make things more complicated and difficult in the long run.

#45 lore raw

PATCH 13/74 ST SPEAr: Update clock framework and definitions

Quoted 7 lines · Russell King - ARM Linux

I'd suggest leaving it as is - presumably its already been tested and so works.

Adding that macro just encourages bad usage anyway - by encouraging people to name individual clocks by their source rather than by their consumer. Naming clocks by their source has been proven many times to make things more complicated and difficult in the long run.

OK.

thanks
viresh.

#46 lore raw

PATCH 14/74 ST SPEAr: Adding PLGPIO driver for spear platform

In reply to Viresh KUMAR

Plgpio pads on few spear machines can be configured as gpios. This patch add support for configuring these PLGPIOs.

---
 arch/arm/mach-spear3xx/include/mach/generic.h |    2 +
 arch/arm/mach-spear3xx/include/mach/gpio.h    |  141 ++++++++
 arch/arm/mach-spear3xx/include/mach/irqs.h    |    9 +-
 arch/arm/mach-spear3xx/spear310.c             |   69 ++++
 arch/arm/mach-spear3xx/spear310_evb.c         |    1 +
 arch/arm/mach-spear3xx/spear320.c             |   30 ++-
 arch/arm/mach-spear3xx/spear320_evb.c         |    1 +
 arch/arm/mach-spear6xx/include/mach/gpio.h    |   27 ++
 arch/arm/plat-spear/Makefile                  |    2 +
 arch/arm/plat-spear/include/plat/gpio.h       |   35 ++
 arch/arm/plat-spear/plgpio.c                  |  453 +++++++++++++++++++++++++
 11 files changed, 765 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/plat-spear/plgpio.c
arch/arm/mach-spear3xx/include/mach/generic.h +2 -0
index 1c8f9f1..d76ee98 100644
@@ -144,6 +144,7 @@ extern struct clcd_board clcd_plat_data;
 /* spear310 declarations */
 #ifdef CONFIG_MACH_SPEAR310
 /* Add spear310 machine device structure declarations here */
+extern struct platform_device plgpio_device;
 
 /* pad mux devices */
 extern struct pmx_dev pmx_emi_cs_0_1_4_5;
@@ -164,6 +165,7 @@ void __init spear310_init(void);
 #ifdef CONFIG_MACH_SPEAR320
 /* Add spear320 machine device structure declarations here */
 extern struct amba_device clcd_device;
+extern struct platform_device plgpio_device;
 
 /* pad mux modes */
 extern struct pmx_mode auto_net_smii_mode;
arch/arm/mach-spear3xx/include/mach/gpio.h +141 -0

145 lines not on this page · raw message

arch/arm/mach-spear3xx/include/mach/irqs.h +5 -4
index 7f940b8..f1175b9 100644
@@ -141,12 +141,13 @@
 #endif
 
 /* PLGPIO Virtual IRQs */
+#define SPEAR_PLGPIO_COUNT	102
 #if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
-#define SPEAR_PLGPIO_INT_BASE			(SPEAR_GPIO_INT_BASE + 8)
-#define SPEAR_GPIO_INT_END			(SPEAR_PLGPIO_INT_BASE + 102)
+#define SPEAR_PLGPIO_INT_BASE	(SPEAR_GPIO_INT_BASE + 8)
+#define SPEAR_GPIO_INT_END	(SPEAR_PLGPIO_INT_BASE + SPEAR_PLGPIO_COUNT)
 #endif
 
-#define VIRQ_END				SPEAR_GPIO_INT_END
-#define NR_IRQS					VIRQ_END
+#define VIRQ_END		SPEAR_GPIO_INT_END
+#define NR_IRQS			VIRQ_END
 
 #endif /* __MACH_IRQS_H */
arch/arm/mach-spear3xx/spear310.c +69 -0

81 lines not on this page · raw message

arch/arm/mach-spear3xx/spear310_evb.c +1 -0
index 3855431..7dd93bd 100644
@@ -52,6 +52,7 @@ static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
 
 	/* spear310 specific devices */
+	&plgpio_device,
 };
 
 static void __init spear310_evb_init(void)
arch/arm/mach-spear3xx/spear320.c +29 -1
index e5baa00..2e388dd 100644
@@ -15,6 +15,7 @@
 #include <asm/irq.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
+#include <plat/gpio.h>
 #include <plat/shirq.h>
 
 /* pad multiplexing support */
@@ -385,7 +386,6 @@ struct pmx_driver pmx_driver = {
 };
 
 /* Add spear320 specific devices here */
-
 /* CLCD device registration */
 struct amba_device clcd_device = {
 	.dev = {
@@ -402,6 +402,34 @@ struct amba_device clcd_device = {
 	.irq = {VIRQ_CLCD, NO_IRQ},
 };
 
+/* plgpio device registeration */
+static struct plgpio_platform_data plgpio_plat_data = {
+	.gpio_base = 8,
+	.irq_base = SPEAR_PLGPIO_INT_BASE,
+	.gpio_count = SPEAR_PLGPIO_COUNT,
+};
+
+static struct resource plgpio_resources[] = {
+	{
+		.start = SPEAR320_SOC_CONFIG_BASE,
+		.end = SPEAR320_SOC_CONFIG_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = VIRQ_PLGPIO,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device plgpio_device = {
+	.name = "plgpio",
+	.id = -1,
+	.dev = {
+		.platform_data = &plgpio_plat_data,
+	},
+	.num_resources = ARRAY_SIZE(plgpio_resources),
+	.resource = plgpio_resources,
+};
+
 /* spear3xx shared irq */
 struct shirq_dev_config shirq_ras1_config[] = {
 	{
arch/arm/mach-spear3xx/spear320_evb.c +1 -0
index 821e806..82f4e76 100644
@@ -50,6 +50,7 @@ static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
 
 	/* spear320 specific devices */
+	&plgpio_device,
 };
 
 static void __init spear320_evb_init(void)
arch/arm/mach-spear6xx/include/mach/gpio.h +27 -0
index 3a789db..465b2e7 100644
@@ -16,4 +16,31 @@
 
 #include <plat/gpio.h>
 
+#define CPU_GPIO_0		0
+#define CPU_GPIO_1		1
+#define CPU_GPIO_2		2
+#define CPU_GPIO_3		3
+#define CPU_GPIO_4		4
+#define CPU_GPIO_5		5
+#define CPU_GPIO_6		6
+#define CPU_GPIO_7		7
+
+#define BASIC_GPIO_0		8
+#define BASIC_GPIO_1		9
+#define BASIC_GPIO_2		10
+#define BASIC_GPIO_3		11
+#define BASIC_GPIO_4		12
+#define BASIC_GPIO_5		13
+#define BASIC_GPIO_6		14
+#define BASIC_GPIO_7		15
+
+#define APPL_GPIO_0		16
+#define APPL_GPIO_1		17
+#define APPL_GPIO_2		18
+#define APPL_GPIO_3		19
+#define APPL_GPIO_4		20
+#define APPL_GPIO_5		21
+#define APPL_GPIO_6		22
+#define APPL_GPIO_7		23
+
 #endif /* __MACH_GPIO_H */
arch/arm/plat-spear/Makefile +2 -0
index 01a4a91..e66bc5f 100644
@@ -6,3 +6,5 @@
 obj-y	:= clcd.o clock.o time.o
 
 obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o padmux.o
+obj-$(CONFIG_MACH_SPEAR310)	+= plgpio.o
+obj-$(CONFIG_MACH_SPEAR320)	+= plgpio.o
arch/arm/plat-spear/include/plat/gpio.h +35 -0
index b857c91..450671e 100644
@@ -21,4 +21,39 @@
 #define gpio_cansleep	__gpio_cansleep
 #define gpio_to_irq	__gpio_to_irq
 
+/* plgpio driver declarations */
+/*
+ * plgpio pins in all machines are not one to one mapped, bitwise with
+ * registers bits. These set of macros define register masks for which below
+ * functions (pin_to_offset and offset_to_pin) are required to be called.
+ */
+#define PTO_ENB_REG		0x001
+#define PTO_WDATA_REG		0x002
+#define PTO_DIR_REG		0x004
+#define PTO_IE_REG		0x008
+#define PTO_RDATA_REG		0x010
+#define PTO_MIS_REG		0x020
+
+/* functions for converting pin to correct offset in register and vice versa */
+/**
+ * struct plgpio_platform_data: plgpio driver platform data
+ *
+ * gpio_base: gpio start number of plgpios
+ * irq_base: irq number of plgpio0
+ * gpio_count: total count of plgpios
+ * p2o: function ptr for pin to offset conversion. This is required only for
+ * machines where mapping b/w pin and offset is not 1-to-1.
+ * o2p: function ptr for offset to pin conversion. This is required only for
+ * machines where mapping b/w pin and offset is not 1-to-1.
+ * p2o_regs: mask of registers for which p2o and o2p are applicable
+ */
+struct plgpio_platform_data {
+	u32 gpio_base;
+	u32 irq_base;
+	u32 gpio_count;
+	int (*p2o)(int pin);		/* pin_to_offset */
+	int (*o2p)(int offset);		/* offset_to_pin */
+	u32 p2o_regs;
+};
+
 #endif /* __PLAT_GPIO_H */
arch/arm/plat-spear/plgpio.c new file +453 -0

453 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#47 lore raw

PATCH 14/74 ST SPEAr: Adding PLGPIO driver for spear platform

Quoted 21 lines · Viresh KUMAR
arch/arm/plat-spear/plgpio.c new file +15 -0
new file mode 100644
index 0000000..847ff9c
@@ -0,0 +1,453 @@
+/*
+ * arch/arm/plat-spear/plgpio.c
+ *
+ * SPEAr platform PLGPIO driver source file
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Viresh Kumar<[email protected]>
+ *
+ * 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.
+ */
+
+#include <linux/bitops.h>
+#include <linux/kernel.h>

arch/arm/plat-spear/plgpio.c line 25

Quoted 10 lines
arch/arm/plat-spear/plgpio.c new file +10 -0
+#include <linux/spinlock.h>
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/irq.h>
+#include <linux/gpio.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+#include <mach/gpio.h>

You're already including linux/gpio.h, which means mach/gpio.h will already be included.

#48 lore raw

PATCH 14/74 ST SPEAr: Adding PLGPIO driver for spear platform

Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines

+#include <linux/gpio.h>

arch/arm/plat-spear/plgpio.c line 25

Quoted 3 lines
arch/arm/plat-spear/plgpio.c new file +3 -0
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+#include <mach/gpio.h>

You're already including linux/gpio.h, which means mach/gpio.h will already be included.
.

Correct. Will remove mach/gpio.h

#49 lore raw

PATCH 15/74 ST SPEAr: adding support for rtc

In reply to Viresh KUMAR

From: Rajeev Kumar <[email protected]>

---
 arch/arm/mach-spear13xx/clock.c                |    2 +-
 arch/arm/mach-spear13xx/include/mach/generic.h |    1 +
 arch/arm/mach-spear13xx/spear1300_evb.c        |    1 +
 arch/arm/mach-spear13xx/spear13xx.c            |   19 +
 arch/arm/mach-spear3xx/clock.c                 |    2 +-
 arch/arm/mach-spear3xx/include/mach/generic.h  |    1 +
 arch/arm/mach-spear3xx/spear300_evb.c          |    1 +
 arch/arm/mach-spear3xx/spear310_evb.c          |    1 +
 arch/arm/mach-spear3xx/spear320_evb.c          |    1 +
 arch/arm/mach-spear3xx/spear3xx.c              |   19 +
 arch/arm/mach-spear6xx/clock.c                 |    2 +-
 arch/arm/mach-spear6xx/include/mach/generic.h  |    1 +
 arch/arm/mach-spear6xx/spear600_evb.c          |    1 +
 arch/arm/mach-spear6xx/spear6xx.c              |   19 +
 drivers/rtc/Kconfig                            |    7 +
 drivers/rtc/Makefile                           |    1 +
 drivers/rtc/rtc-spear.c                        |  598 ++++++++++++++++++++++++
 17 files changed, 674 insertions(+), 3 deletions(-)
 create mode 100644 drivers/rtc/rtc-spear.c
arch/arm/mach-spear13xx/clock.c +1 -1
index cef3b13..cc692cc 100644
@@ -736,7 +736,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{.con_id = "osc3_25m_clk",	.clk = &osc3_25m_clk},
 
 	/* clock derived from 32 KHz osc clk */
-	{.dev_id = "rtc",		.clk = &rtc_clk},
+	{.dev_id = "rtc-spear",		.clk = &rtc_clk},
 
 	/* clock derived from 24/25 MHz osc1/osc3 clk */
 	{.con_id = "pll1_clk",		.clk = &pll1_clk},
arch/arm/mach-spear13xx/include/mach/generic.h +1 -0
index 41c1a53..dc80421 100644
@@ -30,6 +30,7 @@
 
 /* Add spear13xx family device structure declarations here */
 extern struct amba_device uart_device;
+extern struct platform_device rtc_device;
 extern struct sys_timer spear13xx_timer;
 
 /* Add spear1300 machine device structure declarations here */
arch/arm/mach-spear13xx/spear1300_evb.c +1 -0
index d72c8a8..60c5fee 100644
@@ -22,6 +22,7 @@ static struct amba_device *amba_devs[] __initdata = {
 };
 
 static struct platform_device *plat_devs[] __initdata = {
+	&rtc_device,
 };
 
 static void __init spear1300_evb_init(void)
arch/arm/mach-spear13xx/spear13xx.c +19 -0
index d11e300..bdca713 100644
@@ -37,6 +37,25 @@ struct amba_device uart_device = {
 	.irq = {IRQ_UART, NO_IRQ},
 };
 
+/* rtc device registration */
+static struct resource rtc_resources[] = {
+	{
+		.start = SPEAR13XX_RTC_BASE,
+		.end = SPEAR13XX_RTC_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = IRQ_RTC,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device rtc_device = {
+	.name = "rtc-spear",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(rtc_resources),
+	.resource = rtc_resources,
+};
+
 /* Do spear13xx familiy common initialization part here */
 void __init spear13xx_init(void)
 {
arch/arm/mach-spear3xx/clock.c +1 -1
index dc19666..147d0a3 100644
@@ -467,7 +467,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .con_id = "osc_32k_clk",	.clk = &osc_32k_clk},
 	{ .con_id = "osc_24m_clk",	.clk = &osc_24m_clk},
 	/* clock derived from 32 KHz osc clk */
-	{ .dev_id = "rtc",		.clk = &rtc_clk},
+	{ .dev_id = "rtc-spear",	.clk = &rtc_clk},
 	/* clock derived from 24 MHz osc clk */
 	{ .con_id = "pll1_clk",		.clk = &pll1_clk},
 	{ .con_id = "pll3_48m_clk",	.clk = &pll3_48m_clk},
arch/arm/mach-spear3xx/include/mach/generic.h +1 -0
index d76ee98..408bb8d 100644
@@ -33,6 +33,7 @@
 /* Add spear3xx family device structure declarations here */
 extern struct amba_device gpio_device;
 extern struct amba_device uart_device;
+extern struct platform_device rtc_device;
 extern struct sys_timer spear3xx_timer;
 
 /* Add spear3xx family function declarations here */
arch/arm/mach-spear3xx/spear300_evb.c +1 -0
index 3bb7fbc..392ee4a 100644
@@ -44,6 +44,7 @@ static struct amba_device *amba_devs[] __initdata = {
 
 static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
+	&rtc_device,
 
 	/* spear300 specific devices */
 };
arch/arm/mach-spear3xx/spear310_evb.c +1 -0
index 7dd93bd..15ca8fc 100644
@@ -50,6 +50,7 @@ static struct amba_device *amba_devs[] __initdata = {
 
 static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
+	&rtc_device,
 
 	/* spear310 specific devices */
 	&plgpio_device,
arch/arm/mach-spear3xx/spear320_evb.c +1 -0
index 82f4e76..48155cc 100644
@@ -48,6 +48,7 @@ static struct amba_device *amba_devs[] __initdata = {
 
 static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
+	&rtc_device,
 
 	/* spear320 specific devices */
 	&plgpio_device,
arch/arm/mach-spear3xx/spear3xx.c +19 -0
index 89cf8ea..6d8791e 100644
@@ -54,6 +54,25 @@ struct amba_device uart_device = {
 	.irq = {IRQ_UART, NO_IRQ},
 };
 
+/* rtc device registration */
+static struct resource rtc_resources[] = {
+	{
+		.start = SPEAR3XX_ICM3_RTC_BASE,
+		.end = SPEAR3XX_ICM3_RTC_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = IRQ_BASIC_RTC,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device rtc_device = {
+	.name = "rtc-spear",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(rtc_resources),
+	.resource = rtc_resources,
+};
+
 /* Do spear3xx familiy common initialization part here */
 void __init spear3xx_init(void)
 {
arch/arm/mach-spear6xx/clock.c +1 -1
index 4a91991..66fc622 100644
@@ -569,7 +569,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .con_id = "osc_32k_clk",	.clk = &osc_32k_clk},
 	{ .con_id = "osc_30m_clk",	.clk = &osc_30m_clk},
 	/* clock derived from 32 KHz os		 clk */
-	{ .dev_id = "rtc",		.clk = &rtc_clk},
+	{ .dev_id = "rtc-spear",	.clk = &rtc_clk},
 	/* clock derived from 30 MHz os		 clk */
 	{ .con_id = "pll1_clk",		.clk = &pll1_clk},
 	{ .con_id = "pll3_48m_clk",	.clk = &pll3_48m_clk},
arch/arm/mach-spear6xx/include/mach/generic.h +1 -0
index d6a04f2..674b16c 100644
@@ -32,6 +32,7 @@
 extern struct amba_device clcd_device;
 extern struct amba_device gpio_device[];
 extern struct amba_device uart_device[];
+extern struct platform_device rtc_device;
 extern struct sys_timer spear6xx_timer;
 
 /* Add spear6xx family function declarations here */
arch/arm/mach-spear6xx/spear600_evb.c +1 -0
index 88e69f4..861e83d 100644
@@ -26,6 +26,7 @@ static struct amba_device *amba_devs[] __initdata = {
 };
 
 static struct platform_device *plat_devs[] __initdata = {
+	&rtc_device,
 };
 
 static void __init spear600_evb_init(void)
arch/arm/mach-spear6xx/spear6xx.c +19 -0
index d0f6b9d..1e403cb 100644
@@ -121,6 +121,25 @@ struct amba_device gpio_device[] = {
 	}
 };
 
+/* rtc device registration */
+static struct resource rtc_resources[] = {
+	{
+		.start = SPEAR6XX_ICM3_RTC_BASE,
+		.end = SPEAR6XX_ICM3_RTC_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = IRQ_BASIC_RTC,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device rtc_device = {
+	.name = "rtc-spear",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(rtc_resources),
+	.resource = rtc_resources,
+};
+
 /* This will add devices, and do machine specific tasks */
 void __init spear6xx_init(void)
 {
drivers/rtc/Kconfig +7 -0
index 48ca713..f099473 100644
@@ -625,6 +625,13 @@ config RTC_DRV_WM8350
 	  This driver can also be built as a module. If so, the module
 	  will be called "rtc-wm8350".
 
+config RTC_DRV_SPEAR
+	tristate "SPEAR ST RTC"
+	default y
+	help
+	 If you say Y here you will get support for the RTC found on
+	 spear
+
 config RTC_DRV_PCF50633
 	depends on MFD_PCF50633
 	tristate "NXP PCF50633 RTC"
drivers/rtc/Makefile +1 -0
index 0f207b3..44df01a 100644
@@ -86,6 +86,7 @@ obj-$(CONFIG_RTC_DRV_S35390A)	+= rtc-s35390a.o
 obj-$(CONFIG_RTC_DRV_S3C)	+= rtc-s3c.o
 obj-$(CONFIG_RTC_DRV_SA1100)	+= rtc-sa1100.o
 obj-$(CONFIG_RTC_DRV_SH)	+= rtc-sh.o
+obj-$(CONFIG_RTC_DRV_SPEAR)	+= rtc-spear.o
 obj-$(CONFIG_RTC_DRV_STARFIRE)	+= rtc-starfire.o
 obj-$(CONFIG_RTC_DRV_STK17TA8)	+= rtc-stk17ta8.o
 obj-$(CONFIG_RTC_DRV_STMP)	+= rtc-stmp3xxx.o
drivers/rtc/rtc-spear.c new file +598 -0

598 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#50 lore raw

PATCH 15/74 ST SPEAr: adding support for rtc

2010/8/30 Viresh KUMAR <[email protected]>:

Quoted 23 lines

From: Rajeev Kumar <[email protected]>

---

?arch/arm/mach-spear13xx/clock.c ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-spear13xx/include/mach/generic.h | ? ?1 +
?arch/arm/mach-spear13xx/spear1300_evb.c ? ? ? ?| ? ?1 +
?arch/arm/mach-spear13xx/spear13xx.c ? ? ? ? ? ?| ? 19 +
?arch/arm/mach-spear3xx/clock.c ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/mach-spear3xx/include/mach/generic.h ?| ? ?1 +
?arch/arm/mach-spear3xx/spear300_evb.c ? ? ? ? ?| ? ?1 +
?arch/arm/mach-spear3xx/spear310_evb.c ? ? ? ? ?| ? ?1 +
?arch/arm/mach-spear3xx/spear320_evb.c ? ? ? ? ?| ? ?1 +
?arch/arm/mach-spear3xx/spear3xx.c ? ? ? ? ? ? ?| ? 19 +
?arch/arm/mach-spear6xx/clock.c ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/mach-spear6xx/include/mach/generic.h ?| ? ?1 +
?arch/arm/mach-spear6xx/spear600_evb.c ? ? ? ? ?| ? ?1 +
?arch/arm/mach-spear6xx/spear6xx.c ? ? ? ? ? ? ?| ? 19 +
?drivers/rtc/Kconfig ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?7 +
?drivers/rtc/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 +
?drivers/rtc/rtc-spear.c ? ? ? ? ? ? ? ? ? ? ? ?| ?598 ++++++++++++++++++++++++
Quoted 3 lines

?17 files changed, 674 insertions(+), 3 deletions(-) ?create mode 100644 drivers/rtc/rtc-spear.c

Please split your this patch into two parts, one submitted to LAKM, the other submitted to Linux-rtc list.

Quoted 867 lines
arch/arm/mach-spear13xx/clock.c +0 -0
index cef3b13..cc692cc 100644
@@ -736,7 +736,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 ? ? ? ?{.con_id = "osc3_25m_clk", ? ? ?.clk = &osc3_25m_clk},
 

? ? ? ?/* clock derived from 32 KHz osc clk */
- ? ? ? {.dev_id = "rtc", ? ? ? ? ? ? ? .clk = &rtc_clk},
+ ? ? ? {.dev_id = "rtc-spear", ? ? ? ? .clk = &rtc_clk},

? ? ? ?/* clock derived from 24/25 MHz osc1/osc3 clk */ ? ? ? ?{.con_id = "pll1_clk", ? ? ? ? ?.clk = &pll1_clk},

arch/arm/mach-spear13xx/include/mach/generic.h +0 -0
index 41c1a53..dc80421 100644
@@ -30,6 +30,7 @@
 

?/* Add spear13xx family device structure declarations here */ ?extern struct amba_device uart_device;
+extern struct platform_device rtc_device;
?extern struct sys_timer spear13xx_timer;

?/* Add spear1300 machine device structure declarations here */

arch/arm/mach-spear13xx/spear1300_evb.c +1 -0
index d72c8a8..60c5fee 100644
@@ -22,6 +22,7 @@ static struct amba_device *amba_devs[] __initdata = {
 ?};
 
 ?static struct platform_device *plat_devs[] __initdata = {
+ ? ? ? &rtc_device,
 ?};
 
 ?static void __init spear1300_evb_init(void)
arch/arm/mach-spear13xx/spear13xx.c +19 -0
index d11e300..bdca713 100644
@@ -37,6 +37,25 @@ struct amba_device uart_device = {
 ? ? ? ?.irq = {IRQ_UART, NO_IRQ},
 ?};
 
+/* rtc device registration */
+static struct resource rtc_resources[] = {
+ ? ? ? {
+ ? ? ? ? ? ? ? .start = SPEAR13XX_RTC_BASE,
+ ? ? ? ? ? ? ? .end = SPEAR13XX_RTC_BASE + SZ_4K - 1,
+ ? ? ? ? ? ? ? .flags = IORESOURCE_MEM,
+ ? ? ? }, {
+ ? ? ? ? ? ? ? .start = IRQ_RTC,
+ ? ? ? ? ? ? ? .flags = IORESOURCE_IRQ,
+ ? ? ? },
+};
+
+struct platform_device rtc_device = {
+ ? ? ? .name = "rtc-spear",
+ ? ? ? .id = -1,
+ ? ? ? .num_resources = ARRAY_SIZE(rtc_resources),
+ ? ? ? .resource = rtc_resources,
+};
+

?/* Do spear13xx familiy common initialization part here */ ?void __init spear13xx_init(void)
?{

arch/arm/mach-spear3xx/clock.c +0 -0
index dc19666..147d0a3 100644
@@ -467,7 +467,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 ? ? ? ?{ .con_id = "osc_32k_clk", ? ? ?.clk = &osc_32k_clk},
 ? ? ? ?{ .con_id = "osc_24m_clk", ? ? ?.clk = &osc_24m_clk},

? ? ? ?/* clock derived from 32 KHz osc clk */
- ? ? ? { .dev_id = "rtc", ? ? ? ? ? ? ?.clk = &rtc_clk},
+ ? ? ? { .dev_id = "rtc-spear", ? ? ? ?.clk = &rtc_clk}, ? ? ? ?/* clock derived from 24 MHz osc clk */
? ? ? ?{ .con_id = "pll1_clk", ? ? ? ? .clk = &pll1_clk}, ? ? ? ?{ .con_id = "pll3_48m_clk", ? ? .clk = &pll3_48m_clk},

arch/arm/mach-spear3xx/include/mach/generic.h +0 -0
index d76ee98..408bb8d 100644
@@ -33,6 +33,7 @@

?/* Add spear3xx family device structure declarations here */ ?extern struct amba_device gpio_device;
?extern struct amba_device uart_device;
+extern struct platform_device rtc_device;
?extern struct sys_timer spear3xx_timer;

?/* Add spear3xx family function declarations here */

arch/arm/mach-spear3xx/spear300_evb.c +0 -0
index 3bb7fbc..392ee4a 100644
@@ -44,6 +44,7 @@ static struct amba_device *amba_devs[] __initdata = {
 
 ?static struct platform_device *plat_devs[] __initdata = {

? ? ? ?/* spear3xx specific devices */
+ ? ? ? &rtc_device,

? ? ? ?/* spear300 specific devices */
?};

arch/arm/mach-spear3xx/spear310_evb.c +0 -0
index 7dd93bd..15ca8fc 100644
@@ -50,6 +50,7 @@ static struct amba_device *amba_devs[] __initdata = {
 
 ?static struct platform_device *plat_devs[] __initdata = {

? ? ? ?/* spear3xx specific devices */
+ ? ? ? &rtc_device,

? ? ? ?/* spear310 specific devices */
? ? ? ?&plgpio_device,

arch/arm/mach-spear3xx/spear320_evb.c +0 -0
index 82f4e76..48155cc 100644
@@ -48,6 +48,7 @@ static struct amba_device *amba_devs[] __initdata = {
 
 ?static struct platform_device *plat_devs[] __initdata = {

? ? ? ?/* spear3xx specific devices */
+ ? ? ? &rtc_device,

? ? ? ?/* spear320 specific devices */
? ? ? ?&plgpio_device,

arch/arm/mach-spear3xx/spear3xx.c +19 -0
index 89cf8ea..6d8791e 100644
@@ -54,6 +54,25 @@ struct amba_device uart_device = {
 ? ? ? ?.irq = {IRQ_UART, NO_IRQ},
 ?};
 
+/* rtc device registration */
+static struct resource rtc_resources[] = {
+ ? ? ? {
+ ? ? ? ? ? ? ? .start = SPEAR3XX_ICM3_RTC_BASE,
+ ? ? ? ? ? ? ? .end = SPEAR3XX_ICM3_RTC_BASE + SZ_4K - 1,
+ ? ? ? ? ? ? ? .flags = IORESOURCE_MEM,
+ ? ? ? }, {
+ ? ? ? ? ? ? ? .start = IRQ_BASIC_RTC,
+ ? ? ? ? ? ? ? .flags = IORESOURCE_IRQ,
+ ? ? ? },
+};
+
+struct platform_device rtc_device = {
+ ? ? ? .name = "rtc-spear",
+ ? ? ? .id = -1,
+ ? ? ? .num_resources = ARRAY_SIZE(rtc_resources),
+ ? ? ? .resource = rtc_resources,
+};
+

?/* Do spear3xx familiy common initialization part here */ ?void __init spear3xx_init(void)
?{

arch/arm/mach-spear6xx/clock.c +0 -0
index 4a91991..66fc622 100644
@@ -569,7 +569,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 ? ? ? ?{ .con_id = "osc_32k_clk", ? ? ?.clk = &osc_32k_clk},
 ? ? ? ?{ .con_id = "osc_30m_clk", ? ? ?.clk = &osc_30m_clk},

? ? ? ?/* clock derived from 32 KHz os ? ? ? ? ?clk */
- ? ? ? { .dev_id = "rtc", ? ? ? ? ? ? ?.clk = &rtc_clk},
+ ? ? ? { .dev_id = "rtc-spear", ? ? ? ?.clk = &rtc_clk}, ? ? ? ?/* clock derived from 30 MHz os ? ? ? ? ?clk */ ? ? ? ?{ .con_id = "pll1_clk", ? ? ? ? .clk = &pll1_clk}, ? ? ? ?{ .con_id = "pll3_48m_clk", ? ? .clk = &pll3_48m_clk},

arch/arm/mach-spear6xx/include/mach/generic.h +1 -0
index d6a04f2..674b16c 100644
@@ -32,6 +32,7 @@
 ?extern struct amba_device clcd_device;
 ?extern struct amba_device gpio_device[];
 ?extern struct amba_device uart_device[];
+extern struct platform_device rtc_device;
 ?extern struct sys_timer spear6xx_timer;
 

?/* Add spear6xx family function declarations here */

arch/arm/mach-spear6xx/spear600_evb.c +1 -0
index 88e69f4..861e83d 100644
@@ -26,6 +26,7 @@ static struct amba_device *amba_devs[] __initdata = {
 ?};
 
 ?static struct platform_device *plat_devs[] __initdata = {
+ ? ? ? &rtc_device,
 ?};
 
 ?static void __init spear600_evb_init(void)
arch/arm/mach-spear6xx/spear6xx.c +19 -0
index d0f6b9d..1e403cb 100644
@@ -121,6 +121,25 @@ struct amba_device gpio_device[] = {
 ? ? ? ?}
 ?};
 
+/* rtc device registration */
+static struct resource rtc_resources[] = {
+ ? ? ? {
+ ? ? ? ? ? ? ? .start = SPEAR6XX_ICM3_RTC_BASE,
+ ? ? ? ? ? ? ? .end = SPEAR6XX_ICM3_RTC_BASE + SZ_4K - 1,
+ ? ? ? ? ? ? ? .flags = IORESOURCE_MEM,
+ ? ? ? }, {
+ ? ? ? ? ? ? ? .start = IRQ_BASIC_RTC,
+ ? ? ? ? ? ? ? .flags = IORESOURCE_IRQ,
+ ? ? ? },
+};
+
+struct platform_device rtc_device = {
+ ? ? ? .name = "rtc-spear",
+ ? ? ? .id = -1,
+ ? ? ? .num_resources = ARRAY_SIZE(rtc_resources),
+ ? ? ? .resource = rtc_resources,
+};
+

?/* This will add devices, and do machine specific tasks */ ?void __init spear6xx_init(void)
?{

drivers/rtc/Kconfig +0 -0
index 48ca713..f099473 100644
@@ -625,6 +625,13 @@ config RTC_DRV_WM8350

? ? ? ? ?This driver can also be built as a module. If so, the module ? ? ? ? ?will be called "rtc-wm8350".

drivers/rtc/Kconfig +7 -0
+config RTC_DRV_SPEAR
+ ? ? ? tristate "SPEAR ST RTC"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ?If you say Y here you will get support for the RTC found on
+ ? ? ? ?spear
+

?config RTC_DRV_PCF50633
? ? ? ?depends on MFD_PCF50633
? ? ? ?tristate "NXP PCF50633 RTC"

drivers/rtc/Makefile +0 -0
index 0f207b3..44df01a 100644
@@ -86,6 +86,7 @@ obj-$(CONFIG_RTC_DRV_S35390A) += rtc-s35390a.o

?obj-$(CONFIG_RTC_DRV_S3C) ? ? ?+= rtc-s3c.o
?obj-$(CONFIG_RTC_DRV_SA1100) ? += rtc-sa1100.o
?obj-$(CONFIG_RTC_DRV_SH) ? ? ? += rtc-sh.o
+obj-$(CONFIG_RTC_DRV_SPEAR) ? ?+= rtc-spear.o
?obj-$(CONFIG_RTC_DRV_STARFIRE) += rtc-starfire.o
?obj-$(CONFIG_RTC_DRV_STK17TA8) += rtc-stk17ta8.o
?obj-$(CONFIG_RTC_DRV_STMP) ? ? += rtc-stmp3xxx.o

drivers/rtc/rtc-spear.c new file +598 -1
new file mode 100644
index 0000000..5b49124
@@ -0,0 +1,598 @@
+/*
+ * drivers/rtc/rtc-spear.c
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Rajeev Kumar<[email protected]>
+ *
+ * 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.
+ */
+
+#include <linux/bcd.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/rtc.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+#include <linux/wait.h>
+#include <asm/mach/time.h>
+
+/* RTC registers */
+#define TIME_REG ? ? ? ? ? ? ? 0x00
+#define DATE_REG ? ? ? ? ? ? ? 0x04
+#define ALARM_TIME_REG ? ? ? ? 0x08
+#define ALARM_DATE_REG ? ? ? ? 0x0C
+#define CTRL_REG ? ? ? ? ? ? ? 0x10
+#define STATUS_REG ? ? ? ? ? ? 0x14
+
+/* TIME_REG & ALARM_TIME_REG */
+#define SECONDS_UNITS ? ? ? ? ?(0xf<<0) ? ? ? ?/* seconds units position */
+#define SECONDS_TENS ? ? ? ? ? (0x7<<4) ? ? ? ?/* seconds tens position */
+#define MINUTES_UNITS ? ? ? ? ?(0xf<<8) ? ? ? ?/* minutes units position */
+#define MINUTES_TENS ? ? ? ? ? (0x7<<12) ? ? ? /* minutes tens position */
+#define HOURS_UNITS ? ? ? ? ? ?(0xf<<16) ? ? ? /* hours units position */
+#define HOURS_TENS ? ? ? ? ? ? (0x3<<20) ? ? ? /* hours tens position */
+
+/* DATE_REG & ALARM_DATE_REG */
+#define DAYS_UNITS ? ? ? ? ? ? (0xf<<0) ? ? ? ?/* days units position */
+#define DAYS_TENS ? ? ? ? ? ? ?(0x3<<4) ? ? ? ?/* days tens position */
+#define MONTHS_UNITS ? ? ? ? ? (0xf<<8) ? ? ? ?/* months units position */
+#define MONTHS_TENS ? ? ? ? ? ?(0x1<<12) ? ? ? /* months tens position */
+#define YEARS_UNITS ? ? ? ? ? ?(0xf<<16) ? ? ? /* years units position */
+#define YEARS_TENS ? ? ? ? ? ? (0xf<<20) ? ? ? /* years tens position */
+#define YEARS_HUNDREDS ? ? ? ? (0xf<<24) ? ? ? /* years hundereds position */
+#define YEARS_MILLENIUMS ? ? ? (0xf<<28) ? ? ? /* years millenium position */
+
+/* MASK SHIFT TIME_REG & ALARM_TIME_REG*/
+#define SECOND_SHIFT ? ? ? ? ? 0x00 ? ? ? ? ? ?/* seconds units */
+#define MINUTE_SHIFT ? ? ? ? ? 0x08 ? ? ? ? ? ?/* minutes units position */
+#define HOUR_SHIFT ? ? ? ? ? ? 0x10 ? ? ? ? ? ?/* hours units position */
+#define MDAY_SHIFT ? ? ? ? ? ? 0x00 ? ? ? ? ? ?/* Month day shift */
+#define MONTH_SHIFT ? ? ? ? ? ?0x08 ? ? ? ? ? ?/* Month shift */
+#define YEAR_SHIFT ? ? ? ? ? ? 0x10 ? ? ? ? ? ?/* Year shift */
+
+#define SECOND_MASK ? ? ? ? ? ?0x7F
+#define MIN_MASK ? ? ? ? ? ? ? 0x7F
+#define HOUR_MASK ? ? ? ? ? ? ?0x3F
+#define DAY_MASK ? ? ? ? ? ? ? 0x3F
+#define MONTH_MASK ? ? ? ? ? ? 0x7F
+#define YEAR_MASK ? ? ? ? ? ? ?0xFFFF
+
+/* date reg equal to time reg, for debug only */
+#define TIME_BYP ? ? ? ? ? ? ? (1<<9)
+#define INT_ENABLE ? ? ? ? ? ? (1<<31) ? ? ? ? /* interrupt enable */
+
+/* STATUS_REG */
+#define CLK_UNCONNECTED ? ? ? ? ? ? ? ?(1<<0)
+#define PEND_WR_TIME ? ? ? ? ? (1<<2)
+#define PEND_WR_DATE ? ? ? ? ? (1<<3)
+#define LOST_WR_TIME ? ? ? ? ? (1<<4)
+#define LOST_WR_DATE ? ? ? ? ? (1<<5)
+#define RTC_INT_MASK ? ? ? ? ? (1<<31)
+#define STATUS_BUSY ? ? ? ? ? ?(PEND_WR_TIME | PEND_WR_DATE)
+#define STATUS_FAIL ? ? ? ? ? ?(LOST_WR_TIME | LOST_WR_DATE)
+
+struct spear_rtc_config {
+ ? ? ? struct clk *clk;
+ ? ? ? spinlock_t lock;
+ ? ? ? void __iomem *ioaddr;
+};
+
+static inline void spear_rtc_clear_interrupt(struct spear_rtc_config *config)
+{
+ ? ? ? unsigned int val;
+ ? ? ? unsigned long flags;
+
+ ? ? ? spin_lock_irqsave(&config->lock, flags);
+ ? ? ? val = readl(config->ioaddr + STATUS_REG);
+ ? ? ? val |= RTC_INT_MASK;
+ ? ? ? writel(val, config->ioaddr + STATUS_REG);
+ ? ? ? spin_unlock_irqrestore(&config->lock, flags);
+}
+
+static inline void spear_rtc_enable_interrupt(struct spear_rtc_config *config)
+{
+ ? ? ? unsigned int val;
+
+ ? ? ? val = readl(config->ioaddr + CTRL_REG);
+ ? ? ? if (!(val & INT_ENABLE)) {
+ ? ? ? ? ? ? ? spear_rtc_clear_interrupt(config);
+ ? ? ? ? ? ? ? val |= INT_ENABLE;
+ ? ? ? ? ? ? ? writel(val, config->ioaddr + CTRL_REG);
+ ? ? ? }
+}
+
+static inline void spear_rtc_disable_interrupt(struct spear_rtc_config *config)
+{
+ ? ? ? unsigned int val;
+
+ ? ? ? val = readl(config->ioaddr + CTRL_REG);
+ ? ? ? if (val & INT_ENABLE) {
+ ? ? ? ? ? ? ? val &= ~INT_ENABLE;
+ ? ? ? ? ? ? ? writel(val, config->ioaddr + CTRL_REG);
+ ? ? ? }
+}
+
+static inline int is_write_complete(struct spear_rtc_config *config)
+{
+ ? ? ? int ret = 0;
+ ? ? ? unsigned long flags;
+
+ ? ? ? spin_lock_irqsave(&config->lock, flags);
+ ? ? ? if ((readl(config->ioaddr + STATUS_REG)) & STATUS_FAIL)
+ ? ? ? ? ? ? ? ret = -EIO;
+ ? ? ? spin_unlock_irqrestore(&config->lock, flags);
+
+ ? ? ? return ret;
+}
+
+static void rtc_wait_not_busy(struct spear_rtc_config *config)
+{
+ ? ? ? int status, count = 0;
+ ? ? ? unsigned long flags;
+
+ ? ? ? /* Assuming BUSY may stay active for 80 msec) */
+ ? ? ? for (count = 0; count < 80; count++) {
+ ? ? ? ? ? ? ? spin_lock_irqsave(&config->lock, flags);
+ ? ? ? ? ? ? ? status = readl(config->ioaddr + STATUS_REG);
+ ? ? ? ? ? ? ? spin_unlock_irqrestore(&config->lock, flags);
+ ? ? ? ? ? ? ? if ((status & STATUS_BUSY) == 0)
+ ? ? ? ? ? ? ? ? ? ? ? break;
+ ? ? ? ? ? ? ? /* check status busy, after each msec */
+ ? ? ? ? ? ? ? msleep(1);
+ ? ? ? }
+}
+
+static irqreturn_t spear_rtc_irq(int irq, void *dev_id)
+{
+ ? ? ? struct rtc_device *rtc = (struct rtc_device *)dev_id;
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+ ? ? ? unsigned long flags, events = 0;
+ ? ? ? unsigned int irq_data;
+
+ ? ? ? spin_lock_irqsave(&config->lock, flags);
+ ? ? ? irq_data = readl(config->ioaddr + STATUS_REG);
+ ? ? ? spin_unlock_irqrestore(&config->lock, flags);
+
+ ? ? ? if ((irq_data & RTC_INT_MASK)) {
+ ? ? ? ? ? ? ? spear_rtc_clear_interrupt(config);
+ ? ? ? ? ? ? ? events = RTC_IRQF | RTC_AF;
+ ? ? ? ? ? ? ? rtc_update_irq(rtc, 1, events);
+ ? ? ? ? ? ? ? return IRQ_HANDLED;
+ ? ? ? } else
+ ? ? ? ? ? ? ? return IRQ_NONE;
+
+}
+
+static int tm2bcd(struct rtc_time *tm)
+{
+ ? ? ? if (rtc_valid_tm(tm) != 0)
+ ? ? ? ? ? ? ? return -EINVAL;
+ ? ? ? tm->tm_sec = bin2bcd(tm->tm_sec);
+ ? ? ? tm->tm_min = bin2bcd(tm->tm_min);
+ ? ? ? tm->tm_hour = bin2bcd(tm->tm_hour);
+ ? ? ? tm->tm_mday = bin2bcd(tm->tm_mday);
+ ? ? ? tm->tm_mon = bin2bcd(tm->tm_mon + 1);
+ ? ? ? tm->tm_year = bin2bcd(tm->tm_year);
+
+ ? ? ? return 0;
+}
+
+static void bcd2tm(struct rtc_time *tm)
+{
+ ? ? ? tm->tm_sec = bcd2bin(tm->tm_sec);
+ ? ? ? tm->tm_min = bcd2bin(tm->tm_min);
+ ? ? ? tm->tm_hour = bcd2bin(tm->tm_hour);
+ ? ? ? tm->tm_mday = bcd2bin(tm->tm_mday);
+ ? ? ? tm->tm_mon = bcd2bin(tm->tm_mon) - 1;
+ ? ? ? /* epoch == 1900 */
+ ? ? ? tm->tm_year = bcd2bin(tm->tm_year);
+}
+
+/*
+ * spear_rtc_read_time - set the time
+ * @dev: rtc device in use
+ * @tm: holds date and time
+ *
+ * This function read time and date. On success it will return 0
+ * otherwise -ve error is returned.
+ */
+static int spear_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+ ? ? ? struct platform_device *pdev = to_platform_device(dev);
+ ? ? ? struct rtc_device *rtc = platform_get_drvdata(pdev);
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+ ? ? ? unsigned int time, date;
+
+ ? ? ? /* we don't report wday/yday/isdst ... */
+ ? ? ? rtc_wait_not_busy(config);
+
+ ? ? ? time = readl(config->ioaddr + TIME_REG);
+ ? ? ? date = readl(config->ioaddr + DATE_REG);
+ ? ? ? tm->tm_sec = (time >> SECOND_SHIFT) & SECOND_MASK;
+ ? ? ? tm->tm_min = (time >> MINUTE_SHIFT) & MIN_MASK;
+ ? ? ? tm->tm_hour = (time >> HOUR_SHIFT) & HOUR_MASK;
+ ? ? ? tm->tm_mday = (date >> MDAY_SHIFT) & DAY_MASK;
+ ? ? ? tm->tm_mon = (date >> MONTH_SHIFT) & MONTH_MASK;
+ ? ? ? tm->tm_year = (date >> YEAR_SHIFT) & YEAR_MASK;
+
+ ? ? ? bcd2tm(tm);
+ ? ? ? return 0;
+}
+
+/*
+ * spear_rtc_set_time - set the time
+ * @dev: rtc device in use
+ * @tm: holds date and time
+ *
+ * This function set time and date. On success it will return 0
+ * otherwise -ve error is returned.
+ */
+static int spear_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+ ? ? ? struct platform_device *pdev = to_platform_device(dev);
+ ? ? ? struct rtc_device *rtc = platform_get_drvdata(pdev);
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+ ? ? ? unsigned int time, date, err = 0;
+
+ ? ? ? if (tm2bcd(tm) < 0)
+ ? ? ? ? ? ? ? return -EINVAL;
+
+ ? ? ? rtc_wait_not_busy(config);
+ ? ? ? time = (tm->tm_sec << SECOND_SHIFT) | (tm->tm_min << MINUTE_SHIFT) |
+ ? ? ? ? ? ? ? (tm->tm_hour << HOUR_SHIFT);
+ ? ? ? date = (tm->tm_mday << MDAY_SHIFT) | (tm->tm_mon << MONTH_SHIFT) |
+ ? ? ? ? ? ? ? (tm->tm_year << YEAR_SHIFT);
+ ? ? ? writel(time, config->ioaddr + TIME_REG);
+ ? ? ? writel(date, config->ioaddr + DATE_REG);
+ ? ? ? err = is_write_complete(config);
+ ? ? ? if (err < 0)
+ ? ? ? ? ? ? ? return err;
+
+ ? ? ? return 0;
+}
+
+/*
+ * spear_rtc_read_alarm - read the alarm time
+ * @dev: rtc device in use
+ * @alm: holds alarm date and time
+ *
+ * This function read alarm time and date. On success it will return 0
+ * otherwise -ve error is returned.
+ */
+static int spear_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
+{
+ ? ? ? struct platform_device *pdev = to_platform_device(dev);
+ ? ? ? struct rtc_device *rtc = platform_get_drvdata(pdev);
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+ ? ? ? unsigned int time, date;
+
+ ? ? ? rtc_wait_not_busy(config);
+
+ ? ? ? time = readl(config->ioaddr + ALARM_TIME_REG);
+ ? ? ? date = readl(config->ioaddr + ALARM_DATE_REG);
+ ? ? ? alm->time.tm_sec = (time >> SECOND_SHIFT) & SECOND_MASK;
+ ? ? ? alm->time.tm_min = (time >> MINUTE_SHIFT) & MIN_MASK;
+ ? ? ? alm->time.tm_hour = (time >> HOUR_SHIFT) & HOUR_MASK;
+ ? ? ? alm->time.tm_mday = (date >> MDAY_SHIFT) & DAY_MASK;
+ ? ? ? alm->time.tm_mon = (date >> MONTH_SHIFT) & MONTH_MASK;
+ ? ? ? alm->time.tm_year = (date >> YEAR_SHIFT) & YEAR_MASK;
+
+ ? ? ? bcd2tm(&alm->time);
+ ? ? ? alm->enabled = readl(config->ioaddr + CTRL_REG) & INT_ENABLE;
+
+ ? ? ? return 0;
+}
+
+/*
+ * spear_rtc_set_alarm - set the alarm time
+ * @dev: rtc device in use
+ * @alm: holds alarm date and time
+ *
+ * This function set alarm time and date. On success it will return 0
+ * otherwise -ve error is returned.
+ */
+static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
+{
+ ? ? ? struct platform_device *pdev = to_platform_device(dev);
+ ? ? ? struct rtc_device *rtc = platform_get_drvdata(pdev);
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+ ? ? ? unsigned int time, date, err = 0;
+
+ ? ? ? if (tm2bcd(&alm->time) < 0)
+ ? ? ? ? ? ? ? return -EINVAL;
+
+ ? ? ? rtc_wait_not_busy(config);
+
+ ? ? ? time = (alm->time.tm_sec << SECOND_SHIFT) | (alm->time.tm_min <<
+ ? ? ? ? ? ? ? ? ? ? ? MINUTE_SHIFT) | (alm->time.tm_hour << HOUR_SHIFT);
+ ? ? ? date = (alm->time.tm_mday << MDAY_SHIFT) | (alm->time.tm_mon <<
+ ? ? ? ? ? ? ? ? ? ? ? MONTH_SHIFT) | (alm->time.tm_year << YEAR_SHIFT);
+
+ ? ? ? writel(time, config->ioaddr + ALARM_TIME_REG);
+ ? ? ? writel(date, config->ioaddr + ALARM_DATE_REG);
+ ? ? ? err = is_write_complete(config);
+ ? ? ? if (err < 0)
+ ? ? ? ? ? ? ? return err;
+
+ ? ? ? if (alm->enabled)
+ ? ? ? ? ? ? ? spear_rtc_enable_interrupt(config);
+ ? ? ? else
+ ? ? ? ? ? ? ? spear_rtc_disable_interrupt(config);
+
+ ? ? ? return 0;
+}
+
+#ifdef CONFIG_RTC_INTF_DEV
+static int
+spear_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
+{
+ ? ? ? struct platform_device *pdev = to_platform_device(dev);
+ ? ? ? struct rtc_device *rtc = platform_get_drvdata(pdev);
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+ ? ? ? struct rtc_time tm;
+ ? ? ? struct rtc_wkalrm alm;
+ ? ? ? void __user *uarg = (void __user *)arg;
+ ? ? ? int err = 0;
+
+ ? ? ? switch (cmd) {
+ ? ? ? ? ? ? ? /* AIE = Alarm Interrupt Enable */
+ ? ? ? case RTC_AIE_OFF:
+ ? ? ? ? ? ? ? spear_rtc_disable_interrupt(config);
+ ? ? ? ? ? ? ? break;
+ ? ? ? case RTC_AIE_ON:
+ ? ? ? ? ? ? ? spear_rtc_enable_interrupt(config);
+ ? ? ? ? ? ? ? break;
+ ? ? ? case RTC_SET_TIME:
+ ? ? ? ? ? ? ? if (copy_from_user(&tm, uarg, sizeof(tm)))
+ ? ? ? ? ? ? ? ? ? ? ? return -EFAULT;
+ ? ? ? ? ? ? ? return spear_rtc_set_time(dev, &tm);
+ ? ? ? case RTC_RD_TIME:
+ ? ? ? ? ? ? ? err = spear_rtc_read_time(dev, &tm);
+ ? ? ? ? ? ? ? if (err < 0)
+ ? ? ? ? ? ? ? ? ? ? ? return err;
+
+ ? ? ? ? ? ? ? if (copy_to_user(uarg, &tm, sizeof(tm)))
+ ? ? ? ? ? ? ? ? ? ? ? return -EFAULT;
+ ? ? ? ? ? ? ? break;
+ ? ? ? case RTC_ALM_SET:
+ ? ? ? ? ? ? ? if (copy_from_user(&alm.time, uarg, sizeof(tm)))
+ ? ? ? ? ? ? ? ? ? ? ? return -EFAULT;
+ ? ? ? ? ? ? ? alm.enabled = 0;
+ ? ? ? ? ? ? ? alm.pending = 0;
+ ? ? ? ? ? ? ? spear_rtc_set_alarm(dev, &alm);
+ ? ? ? ? ? ? ? break;
+ ? ? ? case RTC_ALM_READ:
+ ? ? ? ? ? ? ? err = spear_rtc_read_alarm(dev, &alm);
+ ? ? ? ? ? ? ? if (err < 0)
+ ? ? ? ? ? ? ? ? ? ? ? return err;
+
+ ? ? ? ? ? ? ? if (copy_to_user(uarg, &alm.time, sizeof(tm)))
+ ? ? ? ? ? ? ? ? ? ? ? return -EFAULT;
+ ? ? ? ? ? ? ? break;
+ ? ? ? default:
+ ? ? ? ? ? ? ? return -ENOIOCTLCMD;
+ ? ? ? }
+
+ ? ? ? return 0;
+}
+
+#else
+#define spear_rtc_ioctl ? ? ? ?NULL
+#endif
+
+static struct rtc_class_ops spear_rtc_ops = {
+ ? ? ? .ioctl = spear_rtc_ioctl,
+ ? ? ? .read_time = spear_rtc_read_time,
+ ? ? ? .set_time = spear_rtc_set_time,
+ ? ? ? .read_alarm = spear_rtc_read_alarm,
+ ? ? ? .set_alarm = spear_rtc_set_alarm,
+};
+
+static int __devinit spear_rtc_probe(struct platform_device *pdev)
+{
+ ? ? ? struct resource *res;
+ ? ? ? struct rtc_device *rtc;
+ ? ? ? struct spear_rtc_config *config;
+ ? ? ? unsigned int status = 0;
+ ? ? ? int irq;
+
+ ? ? ? res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ ? ? ? if (!res) {
+ ? ? ? ? ? ? ? dev_err(&pdev->dev, "no resource defined\n");
+ ? ? ? ? ? ? ? return -EBUSY;
+ ? ? ? }
+ ? ? ? if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
+ ? ? ? ? ? ? ? dev_err(&pdev->dev, "rtc region already claimed\n");
+ ? ? ? ? ? ? ? return -EBUSY;
+ ? ? ? }
+
+ ? ? ? config = kzalloc(sizeof(*config), GFP_KERNEL);
+ ? ? ? if (!config) {
+ ? ? ? ? ? ? ? dev_err(&pdev->dev, "out of memory\n");
+ ? ? ? ? ? ? ? status = -ENOMEM;
+ ? ? ? ? ? ? ? goto err_release_region;
+ ? ? ? }
+
+ ? ? ? config->clk = clk_get(&pdev->dev, NULL);
+ ? ? ? if (IS_ERR(config->clk)) {
+ ? ? ? ? ? ? ? status = PTR_ERR(config->clk);
+ ? ? ? ? ? ? ? goto err_kfree;
+ ? ? ? }
+
+ ? ? ? status = clk_enable(config->clk);
+ ? ? ? if (status < 0)
+ ? ? ? ? ? ? ? goto err_clk_put;
+
+ ? ? ? config->ioaddr = ioremap(res->start, resource_size(res));
+ ? ? ? if (!config->ioaddr) {
+ ? ? ? ? ? ? ? dev_err(&pdev->dev, "ioremap fail\n");
+ ? ? ? ? ? ? ? status = -ENOMEM;
+ ? ? ? ? ? ? ? goto err_disable_clock;
+ ? ? ? }
+
+ ? ? ? rtc = rtc_device_register(pdev->name, &pdev->dev, &spear_rtc_ops,
+ ? ? ? ? ? ? ? ? ? ? ? THIS_MODULE);
+ ? ? ? if (IS_ERR(rtc)) {
+ ? ? ? ? ? ? ? dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PTR_ERR(rtc));
+ ? ? ? ? ? ? ? status = PTR_ERR(rtc);
+ ? ? ? ? ? ? ? goto err_iounmap;
+ ? ? ? }
+ ? ? ? platform_set_drvdata(pdev, rtc);
+ ? ? ? dev_set_drvdata(&rtc->dev, config);
+
+ ? ? ? spin_lock_init(&config->lock);
+
+ ? ? ? /* alarm irqs */
+ ? ? ? irq = platform_get_irq(pdev, 0);
+ ? ? ? if (irq < 0) {
+ ? ? ? ? ? ? ? dev_err(&pdev->dev, "no update irq?\n");
+ ? ? ? ? ? ? ? status = irq;
+ ? ? ? ? ? ? ? goto err_clear_platdata;
+ ? ? ? }
+
+ ? ? ? status = request_irq(irq, spear_rtc_irq, 0, pdev->name, rtc);
+ ? ? ? if (status) {
+ ? ? ? ? ? ? ? dev_err(&pdev->dev, "Alarm interrupt IRQ%d already \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? claimed\n", irq);
+ ? ? ? ? ? ? ? goto err_clear_platdata;
+ ? ? ? }
+
+ ? ? ? if (!device_can_wakeup(&pdev->dev))
+ ? ? ? ? ? ? ? device_init_wakeup(&pdev->dev, 1);
+
+ ? ? ? return 0;
+
+err_clear_platdata:
+ ? ? ? platform_set_drvdata(pdev, NULL);
+ ? ? ? dev_set_drvdata(&rtc->dev, NULL);
+ ? ? ? rtc_device_unregister(rtc);
+err_iounmap:
+ ? ? ? iounmap(config->ioaddr);
+err_disable_clock:
+ ? ? ? clk_disable(config->clk);
+err_clk_put:
+ ? ? ? clk_put(config->clk);
+err_kfree:
+ ? ? ? kfree(config);
+err_release_region:
+ ? ? ? release_mem_region(res->start, resource_size(res));
+
+ ? ? ? return status;
+}
+
+static int __devexit spear_rtc_remove(struct platform_device *pdev)
+{
+ ? ? ? struct rtc_device *rtc = platform_get_drvdata(pdev);
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+ ? ? ? int irq;
+ ? ? ? struct resource *res;
+
+ ? ? ? /* leave rtc running, but disable irqs */
+ ? ? ? spear_rtc_disable_interrupt(config);
+ ? ? ? device_init_wakeup(&pdev->dev, 0);
+ ? ? ? irq = platform_get_irq(pdev, 0);
+ ? ? ? if (irq)
+ ? ? ? ? ? ? ? free_irq(irq, pdev);
+ ? ? ? clk_disable(config->clk);
+ ? ? ? clk_put(config->clk);
+ ? ? ? iounmap(config->ioaddr);
+ ? ? ? kfree(config);
+ ? ? ? res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ ? ? ? if (res)
+ ? ? ? ? ? ? ? release_mem_region(res->start, resource_size(res));
+ ? ? ? platform_set_drvdata(pdev, NULL);
+ ? ? ? dev_set_drvdata(&rtc->dev, NULL);
+ ? ? ? rtc_device_unregister(rtc);
+
+ ? ? ? return 0;
+}
+
+#ifdef CONFIG_PM
+
+static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ ? ? ? struct rtc_device *rtc = platform_get_drvdata(pdev);
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+ ? ? ? int irq;
+
+ ? ? ? irq = platform_get_irq(pdev, 0);
+ ? ? ? if (device_may_wakeup(&pdev->dev))
+ ? ? ? ? ? ? ? enable_irq_wake(irq);
+ ? ? ? else {
+ ? ? ? ? ? ? ? spear_rtc_disable_interrupt(config);
+ ? ? ? ? ? ? ? clk_disable(config->clk);
+ ? ? ? }
+
+ ? ? ? return 0;
+}
+
+static int spear_rtc_resume(struct platform_device *pdev)
+{
+ ? ? ? struct rtc_device *rtc = platform_get_drvdata(pdev);
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+ ? ? ? int irq;
+
+ ? ? ? irq = platform_get_irq(pdev, 0);
+
+ ? ? ? if (device_may_wakeup(&pdev->dev))
+ ? ? ? ? ? ? ? disable_irq_wake(irq);
+ ? ? ? else {
+ ? ? ? ? ? ? ? clk_enable(config->clk);
+ ? ? ? ? ? ? ? spear_rtc_enable_interrupt(config);
+ ? ? ? }
+
+ ? ? ? return 0;
+}
+
+#else
+#define spear_rtc_suspend ? ? ?NULL
+#define spear_rtc_resume ? ? ? NULL
+#endif
+
+static void spear_rtc_shutdown(struct platform_device *pdev)
+{
+ ? ? ? struct rtc_device *rtc = platform_get_drvdata(pdev);
+ ? ? ? struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+
+ ? ? ? spear_rtc_disable_interrupt(config);
+ ? ? ? clk_disable(config->clk);
+}
+
+static struct platform_driver spear_rtc_driver = {
+ ? ? ? .probe = spear_rtc_probe,
+ ? ? ? .remove = __devexit_p(spear_rtc_remove),
+ ? ? ? .suspend = spear_rtc_suspend,
+ ? ? ? .resume = spear_rtc_resume,
+ ? ? ? .shutdown = spear_rtc_shutdown,
+ ? ? ? .driver = {
+ ? ? ? ? ? ? ? .name = "rtc-spear",
+ ? ? ? ? ? ? ? .owner = THIS_MODULE,
+ ? ? ? },
+};
+
+static int __init rtc_init(void)
+{
+ ? ? ? return platform_driver_register(&spear_rtc_driver);
+}
+module_init(rtc_init);
+
+static void __exit rtc_exit(void)
+{
+ ? ? ? platform_driver_unregister(&spear_rtc_driver);
+}
+module_exit(rtc_exit);
+
+MODULE_ALIAS("rtc-spear");
+MODULE_AUTHOR("Rajeev Kumar");
+MODULE_LICENSE("GPL");
--

1.7.2.2

--
You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.

Signature · 10 lines
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel at lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900 at googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com at gmail.com
#51 lore raw

PATCH 15/74 ST SPEAr: adding support for rtc

Quoted 7 lines · Wan ZongShun
Quoted 3 lines
Quoted 3 lines
 17 files changed, 674 insertions(+), 3 deletions(-)
 create mode 100644 drivers/rtc/rtc-spear.c

Please split your this patch into two parts, one submitted to LAKM, the other submitted to Linux-rtc list.

Will be done.

viresh

#54 lore raw

PATCH 15/74 ST SPEAr: adding support for rtc

In reply to Alessandro Zummo
Quoted 6 lines · Alessandro Zummo
Quoted 1 line · On Mon, 30 Aug 2010 16:11:00 +0530 Viresh KUMAR <[email protected]> wrote:
Quoted 1 line

From: Rajeev Kumar <[email protected]>

Hi, there are quite a few issues. Please read the checklist at http://groups.google.com/group/rtc-linux/web/checklist

Alessandro,

I tried to find issues in driver, with help of checklist. I could find very few changes initially, they are:
- Correct MODULE_* at end of file
- add platform dependency in Kconfig
- remove .owner
- removed few #includes.

If there are any more issues that you might have encountered, then please let me know before i send V2.

thanks
viresh.

#55 lore raw

PATCH 15/74 ST SPEAr: adding support for rtc

In reply to Viresh KUMAR
Quoted 44 lines · Viresh KUMAR

From: Rajeev Kumar <[email protected]>

---
 arch/arm/mach-spear13xx/clock.c                |    2 +-
 arch/arm/mach-spear13xx/include/mach/generic.h |    1 +
 arch/arm/mach-spear13xx/spear1300_evb.c        |    1 +
 arch/arm/mach-spear13xx/spear13xx.c            |   19 +
 arch/arm/mach-spear3xx/clock.c                 |    2 +-
 arch/arm/mach-spear3xx/include/mach/generic.h  |    1 +
 arch/arm/mach-spear3xx/spear300_evb.c          |    1 +
 arch/arm/mach-spear3xx/spear310_evb.c          |    1 +
 arch/arm/mach-spear3xx/spear320_evb.c          |    1 +
 arch/arm/mach-spear3xx/spear3xx.c              |   19 +
 arch/arm/mach-spear6xx/clock.c                 |    2 +-
 arch/arm/mach-spear6xx/include/mach/generic.h  |    1 +
 arch/arm/mach-spear6xx/spear600_evb.c          |    1 +
 arch/arm/mach-spear6xx/spear6xx.c              |   19 +
 drivers/rtc/Kconfig                            |    7 +
 drivers/rtc/Makefile                           |    1 +
 drivers/rtc/rtc-spear.c                        |  598 ++++++++++++++++++++++++
 17 files changed, 674 insertions(+), 3 deletions(-)
 create mode 100644 drivers/rtc/rtc-spear.c
arch/arm/mach-spear13xx/clock.c +1 -1
index cef3b13..cc692cc 100644
@@ -736,7 +736,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{.con_id = "osc3_25m_clk",	.clk = &osc3_25m_clk},
 
 	/* clock derived from 32 KHz osc clk */
-	{.dev_id = "rtc",		.clk = &rtc_clk},
+	{.dev_id = "rtc-spear",		.clk = &rtc_clk},
 
 	/* clock derived from 24/25 MHz osc1/osc3 clk */
 	{.con_id = "pll1_clk",		.clk = &pll1_clk},
arch/arm/mach-spear13xx/include/mach/generic.h +0 -0
index 41c1a53..dc80421 100644

arch/arm/mach-spear13xx/include/mach/generic.h line 33

Quoted 4 lines
arch/arm/mach-spear13xx/include/mach/generic.h +1 -0
@@ -30,6 +30,7 @@
 
 /* Add spear13xx family device structure declarations here */
 extern struct amba_device uart_device;
+extern struct platform_device rtc_device;

no need to export all theres platform devices

it will be better to export funtion as done on AT91

to register the device

as

spear_rtc_device_add();

and the sme for the other devices etc...

btw you do not respect the kernel coding style please check your patches

Best Regards,
J.

#56 lore raw

PATCH 15/74 ST SPEAr: adding support for rtc

Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 9 lines

arch/arm/mach-spear13xx/include/mach/generic.h line 33

Quoted 9 lines
arch/arm/mach-spear13xx/include/mach/generic.h +1 -0
index 41c1a53..dc80421 100644
@@ -30,6 +30,7 @@
 
 /* Add spear13xx family device structure declarations here */
 extern struct amba_device uart_device;
+extern struct platform_device rtc_device;

no need to export all theres platform devices

it will be better to export funtion as done on AT91

Quoted 7 lines

to register the device

as

spear_rtc_device_add();

and the sme for the other devices etc...

We don't want to create unnecessary abstraction. Even if we add functions then these function prototypes have to be added in generic.h. This will increase lines of code, without much advantages.

Quoted 2 lines

btw you do not respect the kernel coding style please check your patches

Sorry!! But we have been following coding style, have run checkpatch too... Can you please pin point where are we wrong, so that we don't commit same mistakes again next time.

regards,
viresh.

#57 lore raw

PATCH 16/74 ST SPEAr: adding support for synopsis i2c designware

In reply to Viresh KUMAR

From: Rajeev Kumar <[email protected]>

---
 arch/arm/mach-spear13xx/clock.c                |    2 +-
 arch/arm/mach-spear13xx/include/mach/generic.h |    2 +
 arch/arm/mach-spear13xx/spear1300_evb.c        |    4 +++
 arch/arm/mach-spear13xx/spear13xx.c            |   23 +++++++++++++++++++
 arch/arm/mach-spear3xx/clock.c                 |   14 ++++++++++-
 arch/arm/mach-spear3xx/include/mach/generic.h  |    3 ++
 arch/arm/mach-spear3xx/include/mach/irqs.h     |    2 +-
 arch/arm/mach-spear3xx/spear300_evb.c          |    4 +++
 arch/arm/mach-spear3xx/spear310_evb.c          |    4 +++
 arch/arm/mach-spear3xx/spear320.c              |   24 +++++++++++++++++++-
 arch/arm/mach-spear3xx/spear320_evb.c          |    5 ++++
 arch/arm/mach-spear3xx/spear3xx.c              |   22 ++++++++++++++++++
 arch/arm/mach-spear6xx/clock.c                 |    2 +-
 arch/arm/mach-spear6xx/include/mach/generic.h  |    2 +
 arch/arm/mach-spear6xx/spear600_evb.c          |    4 +++
 arch/arm/mach-spear6xx/spear6xx.c              |   22 ++++++++++++++++++
 arch/arm/plat-spear/Makefile                   |    6 +++++
 arch/arm/plat-spear/i2c_eval_board.c           |   29 ++++++++++++++++++++++++
 18 files changed, 169 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/plat-spear/i2c_eval_board.c
arch/arm/mach-spear13xx/clock.c +1 -1
index cc692cc..7f7330c 100644
@@ -777,7 +777,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{.dev_id = "uhci0",		.clk = &uhci0_clk},
 	{.dev_id = "uhci1",		.clk = &uhci1_clk},
 	{.dev_id = "usbd",		.clk = &usbd_clk},
-	{.dev_id = "i2c",		.clk = &i2c_clk},
+	{.dev_id = "i2c_designware.0",	.clk = &i2c_clk},
 	{.dev_id = "dma0",		.clk = &dma0_clk},
 	{.dev_id = "dma1",		.clk = &dma1_clk},
 	{.dev_id = "jpeg",		.clk = &jpeg_clk},
arch/arm/mach-spear13xx/include/mach/generic.h +2 -0
index dc80421..0ba99de 100644
@@ -30,6 +30,7 @@
 
 /* Add spear13xx family device structure declarations here */
 extern struct amba_device uart_device;
+extern struct platform_device i2c_device;
 extern struct platform_device rtc_device;
 extern struct sys_timer spear13xx_timer;
 
@@ -37,6 +38,7 @@ extern struct sys_timer spear13xx_timer;
 
 /* Add spear13xx family function declarations here */
 void __init clk_init(void);
+void __init i2c_register_board_devices(void);
 void __init spear_setup_timer(void);
 void __init spear1300_init(void);
 void __init spear13xx_map_io(void);
arch/arm/mach-spear13xx/spear1300_evb.c +4 -0
index 60c5fee..4bf908f 100644
@@ -22,6 +22,7 @@ static struct amba_device *amba_devs[] __initdata = {
 };
 
 static struct platform_device *plat_devs[] __initdata = {
+	&i2c_device,
 	&rtc_device,
 };
 
@@ -32,6 +33,9 @@ static void __init spear1300_evb_init(void)
 	/* call spear1300 machine init function */
 	spear1300_init();
 
+	/* Register slave devices on the I2C buses */
+	i2c_register_board_devices();
+
 	/* Add Platform Devices */
 	platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
 
arch/arm/mach-spear13xx/spear13xx.c +23 -0
index bdca713..5abdae8 100644
@@ -24,6 +24,7 @@
 #include <mach/hardware.h>
 
 /* Add spear13xx machines common devices here */
+
 /* uart device registeration */
 struct amba_device uart_device = {
 	.dev = {
@@ -37,6 +38,28 @@ struct amba_device uart_device = {
 	.irq = {IRQ_UART, NO_IRQ},
 };
 
+/* i2c device registeration */
+static struct resource i2c_resources[] = {
+	{
+		.start = SPEAR13XX_I2C_BASE,
+		.end = SPEAR13XX_I2C_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = IRQ_I2C,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device i2c_device = {
+	.name = "i2c_designware",
+	.id = 0,
+	.dev = {
+		.coherent_dma_mask = ~0,
+	},
+	.num_resources = ARRAY_SIZE(i2c_resources),
+	.resource = i2c_resources,
+};
+
 /* rtc device registration */
 static struct resource rtc_resources[] = {
 	{
arch/arm/mach-spear3xx/clock.c +13 -1
index 147d0a3..ae6c244 100644
@@ -460,6 +460,15 @@ static struct clk gpio_clk = {
 
 static struct clk dummy_apb_pclk;
 
+#ifdef CONFIG_MACH_SPEAR320
+/* i2c1 clock */
+static struct clk i2c1_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &ahb_clk,
+	.recalc = &follow_parent,
+};
+#endif
+
 /* array of all spear 3xx clock lookups */
 static struct clk_lookup spear_clk_lookups[] = {
 	{ .con_id = "apb_pclk",	.clk = &dummy_apb_pclk},
@@ -491,7 +500,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "clcd",		.clk = &clcd_clk},
 	/* clock derived from ahb clk */
 	{ .con_id = "apb_clk",		.clk = &apb_clk},
-	{ .dev_id = "i2c",		.clk = &i2c_clk},
+	{ .dev_id = "i2c_designware.0",	.clk = &i2c_clk},
 	{ .dev_id = "dma",		.clk = &dma_clk},
 	{ .dev_id = "jpeg",		.clk = &jpeg_clk},
 	{ .dev_id = "gmac",		.clk = &gmac_clk},
@@ -501,6 +510,9 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "adc",		.clk = &adc_clk},
 	{ .dev_id = "ssp",		.clk = &ssp_clk},
 	{ .dev_id = "gpio",		.clk = &gpio_clk},
+#ifdef CONFIG_MACH_SPEAR320
+	{ .dev_id = "i2c_designware.1",	.clk = &i2c1_clk},
+#endif
 };
 
 void __init clk_init(void)
arch/arm/mach-spear3xx/include/mach/generic.h +3 -0
index 408bb8d..162f33b 100644
@@ -33,11 +33,13 @@
 /* Add spear3xx family device structure declarations here */
 extern struct amba_device gpio_device;
 extern struct amba_device uart_device;
+extern struct platform_device i2c_device;
 extern struct platform_device rtc_device;
 extern struct sys_timer spear3xx_timer;
 
 /* Add spear3xx family function declarations here */
 void __init clk_init(void);
+void __init i2c_register_board_devices(void);
 void __init spear_setup_timer(void);
 void __init spear3xx_map_io(void);
 void __init spear3xx_init_irq(void);
@@ -166,6 +168,7 @@ void __init spear310_init(void);
 #ifdef CONFIG_MACH_SPEAR320
 /* Add spear320 machine device structure declarations here */
 extern struct amba_device clcd_device;
+extern struct platform_device i2c1_device;
 extern struct platform_device plgpio_device;
 
 /* pad mux modes */
arch/arm/mach-spear3xx/include/mach/irqs.h +1 -1
index f1175b9..5ad7574 100644
@@ -133,7 +133,7 @@
 #define VIRQ_MII1_SMII1				(VIRQ_START + 13)
 #define VIRQ_WAKEUP_SMII0			(VIRQ_START + 14)
 #define VIRQ_WAKEUP_MII1_SMII1			(VIRQ_START + 15)
-#define VIRQ_I2C				(VIRQ_START + 16)
+#define VIRQ_I2C1				(VIRQ_START + 16)
 
 /* GPIO pins virtual irqs */
 #define SPEAR_GPIO_INT_BASE			(VIRQ_START + 17)
arch/arm/mach-spear3xx/spear300_evb.c +4 -0
index 392ee4a..083f65c 100644
@@ -44,6 +44,7 @@ static struct amba_device *amba_devs[] __initdata = {
 
 static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
+	&i2c_device,
 	&rtc_device,
 
 	/* spear300 specific devices */
@@ -61,6 +62,9 @@ static void __init spear300_evb_init(void)
 	/* call spear300 machine init function */
 	spear300_init();
 
+	/* Register slave devices on the I2C buses */
+	i2c_register_board_devices();
+
 	/* Add Platform Devices */
 	platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
 
arch/arm/mach-spear3xx/spear310_evb.c +4 -0
index 15ca8fc..208a68ce1 100644
@@ -50,6 +50,7 @@ static struct amba_device *amba_devs[] __initdata = {
 
 static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
+	&i2c_device,
 	&rtc_device,
 
 	/* spear310 specific devices */
@@ -68,6 +69,9 @@ static void __init spear310_evb_init(void)
 	/* call spear310 machine init function */
 	spear310_init();
 
+	/* Register slave devices on the I2C buses */
+	i2c_register_board_devices();
+
 	/* Add Platform Devices */
 	platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
 
arch/arm/mach-spear3xx/spear320.c +23 -1
index 2e388dd..bfb21ae 100644
@@ -409,6 +409,28 @@ static struct plgpio_platform_data plgpio_plat_data = {
 	.gpio_count = SPEAR_PLGPIO_COUNT,
 };
 
+/* i2c1 device registeration */
+static struct resource i2c1_resources[] = {
+	{
+		.start = SPEAR320_I2C_BASE,
+		.end = SPEAR320_I2C_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = VIRQ_I2C1 ,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device i2c1_device = {
+	.name = "i2c_designware",
+	.id = 1,
+	.dev = {
+		.coherent_dma_mask = ~0,
+	},
+	.num_resources = ARRAY_SIZE(i2c1_resources),
+	.resource = i2c1_resources,
+};
+
 static struct resource plgpio_resources[] = {
 	{
 		.start = SPEAR320_SOC_CONFIG_BASE,
@@ -535,7 +557,7 @@ struct shirq_dev_config shirq_intrcomm_ras_config[] = {
 		.status_mask = WAKEUP_MII1_SMII1_IRQ_MASK,
 		.clear_mask = WAKEUP_MII1_SMII1_IRQ_MASK,
 	}, {
-		.virq = VIRQ_I2C,
+		.virq = VIRQ_I2C1,
 		.status_mask = I2C1_IRQ_MASK,
 		.clear_mask = I2C1_IRQ_MASK,
 	},
arch/arm/mach-spear3xx/spear320_evb.c +5 -0
index 48155cc..90d685e 100644
@@ -48,9 +48,11 @@ static struct amba_device *amba_devs[] __initdata = {
 
 static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
+	&i2c_device,
 	&rtc_device,
 
 	/* spear320 specific devices */
+	&i2c1_device,
 	&plgpio_device,
 };
 
@@ -66,6 +68,9 @@ static void __init spear320_evb_init(void)
 	/* call spear320 machine init function */
 	spear320_init();
 
+	/* Register slave devices on the I2C buses */
+	i2c_register_board_devices();
+
 	/* Add Platform Devices */
 	platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
 
arch/arm/mach-spear3xx/spear3xx.c +22 -0
index 6d8791e..34d22a5 100644
@@ -54,6 +54,28 @@ struct amba_device uart_device = {
 	.irq = {IRQ_UART, NO_IRQ},
 };
 
+/* i2c device registeration */
+static struct resource i2c_resources[] = {
+	{
+		.start = SPEAR3XX_ICM1_I2C_BASE,
+		.end = SPEAR3XX_ICM1_I2C_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = IRQ_I2C,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device i2c_device = {
+	.name = "i2c_designware",
+	.id = 0,
+	.dev = {
+		.coherent_dma_mask = ~0,
+	},
+	.num_resources = ARRAY_SIZE(i2c_resources),
+	.resource = i2c_resources,
+};
+
 /* rtc device registration */
 static struct resource rtc_resources[] = {
 	{
arch/arm/mach-spear6xx/clock.c +1 -1
index 66fc622..0972b8f 100644
@@ -596,7 +596,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "usbd",		.clk = &usbd_clk},
 	/* clock derived from ahb clk */
 	{ .con_id = "apb_clk",		.clk = &apb_clk},
-	{ .dev_id = "i2c",		.clk = &i2c_clk},
+	{ .dev_id = "i2c_designware.0",	.clk = &i2c_clk},
 	{ .dev_id = "dma",		.clk = &dma_clk},
 	{ .dev_id = "jpeg",		.clk = &jpeg_clk},
 	{ .dev_id = "gmac",		.clk = &gmac_clk},
arch/arm/mach-spear6xx/include/mach/generic.h +2 -0
index 674b16c..44a2f99 100644
@@ -32,10 +32,12 @@
 extern struct amba_device clcd_device;
 extern struct amba_device gpio_device[];
 extern struct amba_device uart_device[];
+extern struct platform_device i2c_device;
 extern struct platform_device rtc_device;
 extern struct sys_timer spear6xx_timer;
 
 /* Add spear6xx family function declarations here */
+void __init i2c_register_board_devices(void);
 void __init spear_setup_timer(void);
 void __init spear6xx_map_io(void);
 void __init spear6xx_init_irq(void);
arch/arm/mach-spear6xx/spear600_evb.c +4 -0
index 861e83d..6b0cf23 100644
@@ -26,6 +26,7 @@ static struct amba_device *amba_devs[] __initdata = {
 };
 
 static struct platform_device *plat_devs[] __initdata = {
+	&i2c_device,
 	&rtc_device,
 };
 
@@ -36,6 +37,9 @@ static void __init spear600_evb_init(void)
 	/* call spear600 machine init function */
 	spear600_init();
 
+	/* Register slave devices on the I2C buses */
+	i2c_register_board_devices();
+
 	/* Add Platform Devices */
 	platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
 
arch/arm/mach-spear6xx/spear6xx.c +22 -0
index 1e403cb..787de46 100644
@@ -121,6 +121,28 @@ struct amba_device gpio_device[] = {
 	}
 };
 
+/* i2c device registeration */
+static struct resource i2c_resources[] = {
+	{
+		.start = SPEAR6XX_ICM1_I2C_BASE,
+		.end = SPEAR6XX_ICM1_I2C_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = IRQ_I2C,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device i2c_device = {
+	.name = "i2c_designware",
+	.id = 0,
+	.dev = {
+		.coherent_dma_mask = ~0,
+	},
+	.num_resources = ARRAY_SIZE(i2c_resources),
+	.resource = i2c_resources,
+};
+
 /* rtc device registration */
 static struct resource rtc_resources[] = {
 	{
arch/arm/plat-spear/Makefile +6 -0
index e66bc5f..c31892a 100644
@@ -8,3 +8,9 @@ obj-y	:= clcd.o clock.o time.o
 obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o padmux.o
 obj-$(CONFIG_MACH_SPEAR310)	+= plgpio.o
 obj-$(CONFIG_MACH_SPEAR320)	+= plgpio.o
+
+obj-$(CONFIG_BOARD_SPEAR1300_EVB)	+= i2c_eval_board.o
+obj-$(CONFIG_BOARD_SPEAR300_EVB)	+= i2c_eval_board.o
+obj-$(CONFIG_BOARD_SPEAR310_EVB)	+= i2c_eval_board.o
+obj-$(CONFIG_BOARD_SPEAR320_EVB)	+= i2c_eval_board.o
+obj-$(CONFIG_BOARD_SPEAR600_EVB)	+= i2c_eval_board.o
arch/arm/plat-spear/i2c_eval_board.c new file +29 -0
new file mode 100644
index 0000000..a2473a8
@@ -0,0 +1,29 @@
+/*
+ * arch/arm/plat-spear/i2c_eval_board.c
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Rajeev Kumar<[email protected]>
+ *
+ * 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.
+ */
+
+#include <linux/i2c.h>
+#include <linux/kernel.h>
+
+static struct i2c_board_info __initdata i2c_board_info[] = {
+	{
+		.type = "eeprom",
+		.addr = 0x50,
+	}, {
+		.type = "eeprom",
+		.addr = 0x51,
+	},
+};
+
+void __init i2c_register_board_devices(void)
+{
+	i2c_register_board_info(0, i2c_board_info,
+				ARRAY_SIZE(i2c_board_info));
+}
Signature · 1 line
1.7.2.2
#58 lore raw

PATCH 16/74 ST SPEAr: adding support for synopsis i2c designware

Quoted 30 lines
arch/arm/mach-spear3xx/clock.c +10 -1
index 147d0a3..ae6c244 100644
@@ -460,6 +460,15 @@ static struct clk gpio_clk = {
 
 static struct clk dummy_apb_pclk;
 
+#ifdef CONFIG_MACH_SPEAR320
+/* i2c1 clock */
+static struct clk i2c1_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &ahb_clk,
+	.recalc = &follow_parent,
+};
+#endif
+
 /* array of all spear 3xx clock lookups */
 static struct clk_lookup spear_clk_lookups[] = {
 	{ .con_id = "apb_pclk",	.clk = &dummy_apb_pclk},
@@ -491,7 +500,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "clcd",		.clk = &clcd_clk},
 	/* clock derived from ahb clk */
 	{ .con_id = "apb_clk",		.clk = &apb_clk},
-	{ .dev_id = "i2c",		.clk = &i2c_clk},
+	{ .dev_id = "i2c_designware.0",	.clk = &i2c_clk},
 	{ .dev_id = "dma",		.clk = &dma_clk},
 	{ .dev_id = "jpeg",		.clk = &jpeg_clk},
 	{ .dev_id = "gmac",		.clk = &gmac_clk},

arch/arm/mach-spear3xx/clock.c static struct clk_lookup spear_clk_lookups[] = { · line 515

Quoted 6 lines
arch/arm/mach-spear3xx/clock.c +3 -0
@@ -501,6 +510,9 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "adc",		.clk = &adc_clk},
 	{ .dev_id = "ssp",		.clk = &ssp_clk},
 	{ .dev_id = "gpio",		.clk = &gpio_clk},
+#ifdef CONFIG_MACH_SPEAR320
+	{ .dev_id = "i2c_designware.1",	.clk = &i2c1_clk},
+#endif

how about split this file in 2
one for 320 and one for 310 so we can avoid all this ifdef

Best Regards,
J.

#59 lore raw

PATCH 16/74 ST SPEAr: adding support for synopsis i2c designware

Jean,

Thanks for reviewing our patches. Really appreciate your effort.

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines

arch/arm/mach-spear3xx/clock.c static struct clk_lookup spear_clk_lookups[] = { · line 515

Quoted 7 lines
arch/arm/mach-spear3xx/clock.c +3 -0
@@ -501,6 +510,9 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "adc",		.clk = &adc_clk},
 	{ .dev_id = "ssp",		.clk = &ssp_clk},
 	{ .dev_id = "gpio",		.clk = &gpio_clk},
+#ifdef CONFIG_MACH_SPEAR320
+	{ .dev_id = "i2c_designware.1",	.clk = &i2c1_clk},
+#endif

how about split this file in 2
one for 320 and one for 310 so we can avoid all this ifdef

There was a mistake in this patch series. As you can see in the last patches, we worked on single image solution for spear*xx family. When we select all machines then all clocks are getting registered. which is wrong?

I have corrected it in my local repo. Now i have created clk_lookup arrays for individual machines and one for common clk structures. So you will not find this mess finally in V2 release.

thanks
viresh.

#60 lore raw

PATCH 16/74 ST SPEAr: adding support for synopsis i2c designware

Quoted 15 lines · viresh kumar

Jean,

Thanks for reviewing our patches. Really appreciate your effort.

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines

arch/arm/mach-spear3xx/clock.c static struct clk_lookup spear_clk_lookups[] = { · line 515

Quoted 7 lines
arch/arm/mach-spear3xx/clock.c +3 -0
@@ -501,6 +510,9 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "adc",		.clk = &adc_clk},
 	{ .dev_id = "ssp",		.clk = &ssp_clk},
 	{ .dev_id = "gpio",		.clk = &gpio_clk},
+#ifdef CONFIG_MACH_SPEAR320
+	{ .dev_id = "i2c_designware.1",	.clk = &i2c1_clk},
+#endif

how about split this file in 2
one for 320 and one for 310 so we can avoid all this ifdef

Quoted 7 lines

There was a mistake in this patch series. As you can see in the last patches, we worked on single image solution for spear*xx family. When we select all machines then all clocks are getting registered. which is wrong?

I have corrected it in my local repo. Now i have created clk_lookup arrays for individual machines and one for common clk structures. So you will not find this mess finally in V2 release.

please split your v2 patch series in related changset it will simplify the review

Best Regards,
J.

#61 lore raw

PATCH 16/74 ST SPEAr: adding support for synopsis i2c designware

Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

please split your v2 patch series in related changset it will simplify the review

Jean,

I would prefer not to do this change in current series due to following reasons:
- Would make difficult for reviewers to locate V2 for V1 they have reviewed.
- My patches are intermixed, so would be difficult for me to create related change sets as currently patches are very much intermixed.

I will take care of this next time i send another patch series.

regards
viresh.

#62 lore raw

PATCH 16/74 ST SPEAr: adding support for synopsis i2c designware

Quoted 4 lines · viresh kumar
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

please split your v2 patch series in related changset it will simplify the review

Quoted 8 lines

Jean,

I would prefer not to do this change in current series due to following reasons:
- Would make difficult for reviewers to locate V2 for V1 they have reviewed.
- My patches are intermixed, so would be difficult for me to create related change sets as currently patches are very much intermixed.

I will take care of this next time i send another patch series.

It's really difficult to reiew it and take long time
so reduce the number of patch and by related changeset will help a lot

Best Regards,
J.

#63 lore raw

PATCH 16/74 ST SPEAr: adding support for synopsis i2c designware

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · viresh kumar
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines
Quoted 2 lines

please split your v2 patch series in related changset it will simplify the review

Jean,

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

I would prefer not to do this change in current series due to following reasons:
- Would make difficult for reviewers to locate V2 for V1 they have reviewed.
- My patches are intermixed, so would be difficult for me to create related change sets as currently patches are very much intermixed.

I will take care of this next time i send another patch series.

It's really difficult to reiew it and take long time
so reduce the number of patch and by related changeset will help a lot

Jean: I agree with what you are saying, but doing it in current patch series will be difficult.

Russell: Can we go ahead with a single patch set this time. By next time we will take care of this.

viresh.

#64 lore raw

PATCH 17/74 ST SPEAr: Adding USB Host support

In reply to Viresh KUMAR

From: Deepak Sikri <[email protected]>

---
 arch/arm/mach-spear13xx/clock.c                |    4 +-
 arch/arm/mach-spear13xx/include/mach/generic.h |    4 +
 arch/arm/mach-spear13xx/spear1300_evb.c        |    4 +
 arch/arm/mach-spear13xx/spear13xx.c            |  106 +++++++++++
 arch/arm/mach-spear3xx/clock.c                 |    2 +-
 arch/arm/mach-spear3xx/include/mach/generic.h  |    3 +
 arch/arm/mach-spear3xx/spear300_evb.c          |    3 +
 arch/arm/mach-spear3xx/spear310_evb.c          |    3 +
 arch/arm/mach-spear3xx/spear320_evb.c          |    3 +
 arch/arm/mach-spear3xx/spear3xx.c              |   80 ++++++++
 arch/arm/mach-spear6xx/clock.c                 |    4 +-
 arch/arm/mach-spear6xx/include/mach/generic.h  |    4 +
 arch/arm/mach-spear6xx/spear600_evb.c          |    4 +
 arch/arm/mach-spear6xx/spear6xx.c              |  108 +++++++++++
 drivers/usb/Kconfig                            |    2 +
 drivers/usb/host/ehci-hcd.c                    |    5 +
 drivers/usb/host/ehci-spear.c                  |  210 +++++++++++++++++++++
 drivers/usb/host/ohci-hcd.c                    |    5 +
 drivers/usb/host/ohci-spear.c                  |  240 ++++++++++++++++++++++++
 19 files changed, 789 insertions(+), 5 deletions(-)
 create mode 100644 drivers/usb/host/ehci-spear.c
 create mode 100644 drivers/usb/host/ohci-spear.c
arch/arm/mach-spear13xx/clock.c +2 -2
index 7f7330c..9d97c69 100644
@@ -774,8 +774,8 @@ static struct clk_lookup spear_clk_lookups[] = {
 
 	/* clock derived from ahb clk */
 	{.dev_id = "smi",		.clk = &smi_clk},
-	{.dev_id = "uhci0",		.clk = &uhci0_clk},
-	{.dev_id = "uhci1",		.clk = &uhci1_clk},
+	{.con_id = "usbh.0_clk",	.clk = &uhci0_clk},
+	{.con_id = "usbh.1_clk",	.clk = &uhci1_clk},
 	{.dev_id = "usbd",		.clk = &usbd_clk},
 	{.dev_id = "i2c_designware.0",	.clk = &i2c_clk},
 	{.dev_id = "dma0",		.clk = &dma0_clk},
arch/arm/mach-spear13xx/include/mach/generic.h +4 -0
index 0ba99de..7e5d7e1 100644
@@ -30,7 +30,11 @@
 
 /* Add spear13xx family device structure declarations here */
 extern struct amba_device uart_device;
+extern struct platform_device ehci0_device;
+extern struct platform_device ehci1_device;
 extern struct platform_device i2c_device;
+extern struct platform_device ohci0_device;
+extern struct platform_device ohci1_device;
 extern struct platform_device rtc_device;
 extern struct sys_timer spear13xx_timer;
 
arch/arm/mach-spear13xx/spear1300_evb.c +4 -0
index 4bf908f..0a6d26f 100644
@@ -22,7 +22,11 @@ static struct amba_device *amba_devs[] __initdata = {
 };
 
 static struct platform_device *plat_devs[] __initdata = {
+	&ehci0_device,
+	&ehci1_device,
 	&i2c_device,
+	&ohci0_device,
+	&ohci1_device,
 	&rtc_device,
 };
 
arch/arm/mach-spear13xx/spear13xx.c +106 -0

112 lines not on this page · raw message

arch/arm/mach-spear3xx/clock.c +1 -1
index ae6c244..5eb6ff6 100644
@@ -495,7 +495,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "gpt1",		.clk = &gpt1_clk},
 	{ .dev_id = "gpt2",		.clk = &gpt2_clk},
 	/* clock derived from pll3 clk */
-	{ .dev_id = "usbh",		.clk = &usbh_clk},
+	{ .con_id = "usbh_clk",		.clk = &usbh_clk},
 	{ .dev_id = "usbd",		.clk = &usbd_clk},
 	{ .dev_id = "clcd",		.clk = &clcd_clk},
 	/* clock derived from ahb clk */
arch/arm/mach-spear3xx/include/mach/generic.h +3 -0
index 162f33b..3eb2737 100644
@@ -33,7 +33,10 @@
 /* Add spear3xx family device structure declarations here */
 extern struct amba_device gpio_device;
 extern struct amba_device uart_device;
+extern struct platform_device ehci_device;
 extern struct platform_device i2c_device;
+extern struct platform_device ohci0_device;
+extern struct platform_device ohci1_device;
 extern struct platform_device rtc_device;
 extern struct sys_timer spear3xx_timer;
 
arch/arm/mach-spear3xx/spear300_evb.c +3 -0
index 083f65c..3b3c6ce 100644
@@ -44,7 +44,10 @@ static struct amba_device *amba_devs[] __initdata = {
 
 static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
+	&ehci_device,
 	&i2c_device,
+	&ohci0_device,
+	&ohci1_device,
 	&rtc_device,
 
 	/* spear300 specific devices */
arch/arm/mach-spear3xx/spear310_evb.c +3 -0
index 208a68ce1..d523040 100644
@@ -50,7 +50,10 @@ static struct amba_device *amba_devs[] __initdata = {
 
 static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
+	&ehci_device,
 	&i2c_device,
+	&ohci0_device,
+	&ohci1_device,
 	&rtc_device,
 
 	/* spear310 specific devices */
arch/arm/mach-spear3xx/spear320_evb.c +3 -0
index 90d685e..f90a9b8 100644
@@ -48,7 +48,10 @@ static struct amba_device *amba_devs[] __initdata = {
 
 static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
+	&ehci_device,
 	&i2c_device,
+	&ohci0_device,
+	&ohci1_device,
 	&rtc_device,
 
 	/* spear320 specific devices */
arch/arm/mach-spear3xx/spear3xx.c +80 -0

86 lines not on this page · raw message

arch/arm/mach-spear6xx/clock.c +2 -2
index 0972b8f..3caf91a 100644
@@ -591,8 +591,8 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "gpt2",		.clk = &gpt2_clk},
 	{ .dev_id = "gpt3",		.clk = &gpt3_clk},
 	/* clock derived from pll3 clk */
-	{ .dev_id = "usbh0",		.clk = &usbh0_clk},
-	{ .dev_id = "usbh1",		.clk = &usbh1_clk},
+	{ .con_id = "usbh.0_clk",	.clk = &usbh0_clk},
+	{ .con_id = "usbh.1_clk",	.clk = &usbh1_clk},
 	{ .dev_id = "usbd",		.clk = &usbd_clk},
 	/* clock derived from ahb clk */
 	{ .con_id = "apb_clk",		.clk = &apb_clk},
arch/arm/mach-spear6xx/include/mach/generic.h +4 -0
index 44a2f99..3b15289 100644
@@ -32,7 +32,11 @@
 extern struct amba_device clcd_device;
 extern struct amba_device gpio_device[];
 extern struct amba_device uart_device[];
+extern struct platform_device ehci0_device;
+extern struct platform_device ehci1_device;
 extern struct platform_device i2c_device;
+extern struct platform_device ohci0_device;
+extern struct platform_device ohci1_device;
 extern struct platform_device rtc_device;
 extern struct sys_timer spear6xx_timer;
 
arch/arm/mach-spear6xx/spear600_evb.c +4 -0
index 6b0cf23..b4dfd25 100644
@@ -26,7 +26,11 @@ static struct amba_device *amba_devs[] __initdata = {
 };
 
 static struct platform_device *plat_devs[] __initdata = {
+	&ehci0_device,
+	&ehci1_device,
 	&i2c_device,
+	&ohci0_device,
+	&ohci1_device,
 	&rtc_device,
 };
 
arch/arm/mach-spear6xx/spear6xx.c +108 -0

114 lines not on this page · raw message

drivers/usb/Kconfig +2 -0
index 4aa00e6..108f69d 100644
@@ -41,6 +41,7 @@ config USB_ARCH_HAS_OHCI
 	default y if MFD_TC6393XB
 	default y if ARCH_W90X900
 	default y if ARCH_DAVINCI_DA8XX
+	default y if PLAT_SPEAR
 	# PPC:
 	default y if STB03xxx
 	default y if PPC_MPC52xx
@@ -65,6 +66,7 @@ config USB_ARCH_HAS_EHCI
 	default y if ARCH_AT91SAM9G45
 	default y if ARCH_MXC
 	default y if ARCH_OMAP3
+	default y if PLAT_SPEAR
 	default PCI
 
 # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
drivers/usb/host/ehci-hcd.c +5 -0
index 34a928d..2101725 100644
@@ -1197,6 +1197,11 @@ MODULE_LICENSE ("GPL");
 #define	PLATFORM_DRIVER		ehci_atmel_driver
 #endif
 
+#ifdef CONFIG_PLAT_SPEAR
+#include "ehci-spear.c"
+#define PLATFORM_DRIVER		spear_ehci_hcd_driver
+#endif
+
 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
     !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \
     !defined(XILINX_OF_PLATFORM_DRIVER)
drivers/usb/host/ehci-spear.c new file +210 -0

210 lines not on this page · raw message

drivers/usb/host/ohci-hcd.c +5 -0
index c3b4ccc..8104fd3 100644
@@ -1075,6 +1075,11 @@ MODULE_LICENSE ("GPL");
 #define OF_PLATFORM_DRIVER	ohci_hcd_ppc_of_driver
 #endif
 
+#ifdef CONFIG_PLAT_SPEAR
+#include "ohci-spear.c"
+#define PLATFORM_DRIVER		spear_ohci_hcd_driver
+#endif
+
 #ifdef CONFIG_PPC_PS3
 #include "ohci-ps3.c"
 #define PS3_SYSTEM_BUS_DRIVER	ps3_ohci_driver
drivers/usb/host/ohci-spear.c new file +240 -0

240 lines not on this page · raw message

Signature · 1 line
1.7.2.2
maintainer
#65 lore raw

PATCH 17/74 ST SPEAr: Adding USB Host support

Quoted 2 lines · Viresh KUMAR

From: Deepak Sikri <[email protected]>

Missing patch description.

Quoted 10 lines

---

drivers/usb/host/ehci-spear.c new file +0 -0
@@ -0,0 +1,210 @@

...

Quoted 10 lines
drivers/usb/host/ehci-spear.c new file +10 -0
+static const struct hc_driver ehci_spear_hc_driver = {
+	.description		= hcd_name,
+	.product_desc		= "SPEAr EHCI",
+	.hcd_priv_size		= sizeof(struct spear_ehci),
+
+	/* generic hardware linkage */
+	.irq			= ehci_irq,
+	.flags			= HCD_MEMORY | HCD_USB2,
+
+	/* basic lifecycle operations */

drivers/usb/host/ehci-spear.c line 78

Quoted 10 lines
drivers/usb/host/ehci-spear.c new file +10 -0
+	.reset			= ehci_spear_setup,
+	.start			= ehci_run,
+	.stop			= ehci_stop,
+	.shutdown		= ehci_shutdown,
+
+	/* managing i/o requests and associated device resources */
+	.urb_enqueue		= ehci_urb_enqueue,
+	.urb_dequeue		= ehci_urb_dequeue,
+	.endpoint_disable	= ehci_endpoint_disable,
+

Missing .endpoint_reset.

Alan Stern

#66 lore raw

PATCH 17/74 ST SPEAr: Adding USB Host support

Quoted 6 lines · Alan Stern
Quoted 2 lines · Viresh KUMAR
Quoted 2 lines

From: Deepak Sikri <[email protected]>

Missing patch description.

Will add.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/usb/host/ehci-spear.c new file +13 -0
+static const struct hc_driver ehci_spear_hc_driver = {
+	.description		= hcd_name,
+	.product_desc		= "SPEAr EHCI",
+	.hcd_priv_size		= sizeof(struct spear_ehci),
+
+	/* generic hardware linkage */
+	.irq			= ehci_irq,
+	.flags			= HCD_MEMORY | HCD_USB2,
+
+	/* basic lifecycle operations */
+	.reset			= ehci_spear_setup,
+	.start			= ehci_run,
+	.stop			= ehci_stop,
Quoted 8 lines
Quoted 7 lines

drivers/usb/host/ehci-spear.c line 78

Quoted 7 lines
drivers/usb/host/ehci-spear.c new file +7 -0
+	.shutdown		= ehci_shutdown,
+
+	/* managing i/o requests and associated device resources */
+	.urb_enqueue		= ehci_urb_enqueue,
+	.urb_dequeue		= ehci_urb_dequeue,
+	.endpoint_disable	= ehci_endpoint_disable,
+

Missing .endpoint_reset.

Will add.

viresh.

#67 lore raw

PATCH 18/74 ST SPEAr: enhanced spear clock framework

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

Added support for
- recursive enabling of parent clock
- recursive disabling of parent clock
- recalc called only when clk is enabled in h/w

---
 arch/arm/plat-spear/clock.c |  199 +++++++++++++++++++++++++++++--------------
 1 files changed, 136 insertions(+), 63 deletions(-)
arch/arm/plat-spear/clock.c +136 -63
index 89a0434..b4d8110 100644
@@ -12,6 +12,7 @@
  */
 
 #include <linux/bug.h>
+#include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/list.h>
@@ -22,7 +23,24 @@
 static DEFINE_SPINLOCK(clocks_lock);
 static LIST_HEAD(root_clks);
 
-static void propagate_rate(struct list_head *);
+static void propagate_rate(struct clk *);
+
+static int clk_is_enabled(struct clk *clk)
+{
+	unsigned int val;
+
+	if (clk->flags & ALWAYS_ENABLED)
+		return 1;
+
+	BUG_ON(!clk->en_reg);
+	val = readl(clk->en_reg);
+	val = val & (1 << clk->en_reg_bit);
+
+	if (unlikely(clk->flags & RESET_TO_ENABLE))
+		return !val;
+	else
+		return !!val;
+}
 
 static int generic_clk_enable(struct clk *clk)
 {
@@ -85,7 +103,7 @@ static struct pclk_info *pclk_info_get(struct clk *clk)
  * Set Update pclk, and pclk_info of clk and add clock sibling node to current
  * parents children list
  */
-static void update_clk_tree(struct clk *clk, struct pclk_info *pclk_info)
+static void clk_reparent(struct clk *clk, struct pclk_info *pclk_info)
 {
 	unsigned long flags;
 
@@ -97,6 +115,64 @@ static void update_clk_tree(struct clk *clk, struct pclk_info *pclk_info)
 	spin_unlock_irqrestore(&clocks_lock, flags);
 }
 
+void do_clk_disable(struct clk *clk)
+{
+	if (!clk)
+		return;
+
+	if (!clk->usage_count) {
+		WARN_ON(1);
+		return;
+	}
+
+	clk->usage_count--;
+
+	if (clk->usage_count == 0) {
+		/*
+		 * Surely, there are no active childrens or direct users
+		 * of this clock
+		 */
+		if (clk->pclk)
+			do_clk_disable(clk->pclk);
+
+		if (clk->ops && clk->ops->disable)
+			clk->ops->disable(clk);
+	}
+}
+
+int do_clk_enable(struct clk *clk)
+{
+	int ret = 0;
+
+	if (!clk)
+		return -EFAULT;
+
+	if (clk->usage_count == 0) {
+		if (clk->pclk) {
+			ret = do_clk_enable(clk->pclk);
+			if (ret)
+				goto err;
+		}
+		if (clk->ops && clk->ops->enable) {
+			ret = clk->ops->enable(clk);
+			if (ret) {
+				if (clk->pclk)
+					do_clk_disable(clk->pclk);
+				goto err;
+			}
+		}
+		/*
+		 * Since the clock is going to be used for the first
+		 * time please reclac
+		 */
+		if (clk->recalc)
+			clk->recalc(clk);
+	}
+	clk->usage_count++;
+err:
+	return ret;
+}
+
 /*
  * clk_enable - inform the system when the clock source should be running.
  * @clk: clock source
@@ -110,17 +186,9 @@ int clk_enable(struct clk *clk)
 	unsigned long flags;
 	int ret = 0;
 
-	if (!clk || IS_ERR(clk))
-		return -EFAULT;
-
 	spin_lock_irqsave(&clocks_lock, flags);
-	if (clk->usage_count == 0) {
-		if (clk->ops && clk->ops->enable)
-			ret = clk->ops->enable(clk);
-	}
-	clk->usage_count++;
+	ret = do_clk_enable(clk);
 	spin_unlock_irqrestore(&clocks_lock, flags);
-
 	return ret;
 }
 EXPORT_SYMBOL(clk_enable);
@@ -141,17 +209,8 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
-	if (!clk || IS_ERR(clk))
-		return;
-
-	WARN_ON(clk->usage_count == 0);
-
 	spin_lock_irqsave(&clocks_lock, flags);
-	clk->usage_count--;
-	if (clk->usage_count == 0) {
-		if (clk->ops && clk->ops->disable)
-			clk->ops->disable(clk);
-	}
+	do_clk_disable(clk);
 	spin_unlock_irqrestore(&clocks_lock, flags);
 }
 EXPORT_SYMBOL(clk_disable);
@@ -178,21 +237,22 @@ EXPORT_SYMBOL(clk_get_rate);
  * @clk: clock source
  * @parent: parent clock source
  *
- * Returns success (0) or negative errno.
+ * Returns success (0) or negative errno. clk usage_count must be zero
+ * before calling this function.
  */
 int clk_set_parent(struct clk *clk, struct clk *parent)
 {
 	int i, found = 0, val = 0;
 	unsigned long flags;
 
-	if (!clk || IS_ERR(clk) || !parent || IS_ERR(parent))
+	if (!clk || !parent)
 		return -EFAULT;
 	if (clk->usage_count)
-		return -EBUSY;
-	if (!clk->pclk_sel)
 		return -EPERM;
 	if (clk->pclk == parent)
 		return 0;
+	if (!clk->pclk_sel)
+		return -EPERM;
 
 	/* check if requested parent is in clk parent list */
 	for (i = 0; i < clk->pclk_sel->pclk_count; i++) {
@@ -214,10 +274,8 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 	spin_unlock_irqrestore(&clocks_lock, flags);
 
 	/* reflect parent change in software */
-	update_clk_tree(clk, &clk->pclk_sel->pclk_info[i]);
+	clk_reparent(clk, &clk->pclk_sel->pclk_info[i]);
 
-	clk->recalc(clk);
-	propagate_rate(&clk->children);
 	return 0;
 }
 EXPORT_SYMBOL(clk_set_parent);
@@ -239,11 +297,12 @@ EXPORT_SYMBOL(clk_set_rate);
 /* registers clock in platform clock framework */
 void clk_register(struct clk_lookup *cl)
 {
-	struct clk *clk = cl->clk;
+	struct clk *clk;
 	unsigned long flags;
 
-	if (!clk || IS_ERR(clk))
+	if (!cl || !cl->clk)
 		return;
+	clk = cl->clk;
 
 	spin_lock_irqsave(&clocks_lock, flags);
 
@@ -265,7 +324,7 @@ void clk_register(struct clk_lookup *cl)
 
 		pclk_info = pclk_info_get(clk);
 		if (!pclk_info) {
-			printk(KERN_ERR "CLKDEV: invalid pclk info of clk with"
+			pr_err("CLKDEV: invalid pclk info of clk with"
 					" %s dev_id and %s con_id\n",
 					cl->dev_id, cl->con_id);
 		} else {
@@ -273,6 +332,7 @@ void clk_register(struct clk_lookup *cl)
 			list_add(&clk->sibling, &pclk_info->pclk->children);
 		}
 	}
+
 	spin_unlock_irqrestore(&clocks_lock, flags);
 
 	/* add clock to arm clockdev framework */
@@ -280,22 +340,26 @@ void clk_register(struct clk_lookup *cl)
 }
 
 /**
- * propagate_rate - recalculate and propagate all clocks in list head
+ * propagate_rate - recalculate and propagate all clocks to children
  *
- * Recalculates all root clocks in list head, which if the clock's .recalc is
- * set correctly, should also propagate their rates.
+ * Recalculates all children clocks
  */
-static void propagate_rate(struct list_head *lhead)
+void propagate_rate(struct clk *pclk)
 {
-	struct clk *clkp, *_temp;
-
-	list_for_each_entry_safe(clkp, _temp, lhead, sibling) {
-		if (clkp->recalc)
-			clkp->recalc(clkp);
-		propagate_rate(&clkp->children);
+	struct clk *clk, *_temp;
+
+	list_for_each_entry_safe(clk, _temp, &pclk->children, sibling) {
+		/* recalc and propogate only if clk is enabled */
+		if (clk_is_enabled(clk)) {
+			if (clk->recalc)
+				clk->recalc(clk);
+			propagate_rate(clk);
+		}
 	}
 }
 
+/*All recalc functions are called with lock held */
+
 /*
  * calculates current programmed rate of pll1
  *
@@ -309,9 +373,7 @@ void pll_clk_recalc(struct clk *clk)
 {
 	struct pll_clk_config *config = clk->private_data;
 	unsigned int num = 2, den = 0, val, mode = 0;
-	unsigned long flags;
 
-	spin_lock_irqsave(&clocks_lock, flags);
 	mode = (readl(config->mode_reg) >> config->masks->mode_shift) &
 		config->masks->mode_mask;
 
@@ -333,8 +395,9 @@ void pll_clk_recalc(struct clk *clk)
 		den *= 256;
 	}
 
+	BUG_ON(!den);
+
 	clk->rate = (((clk->pclk->rate/10000) * num) / den) * 10000;
-	spin_unlock_irqrestore(&clocks_lock, flags);
 }
 
 /* calculates current programmed rate of ahb or apb bus */
@@ -342,13 +405,13 @@ void bus_clk_recalc(struct clk *clk)
 {
 	struct bus_clk_config *config = clk->private_data;
 	unsigned int div;
-	unsigned long flags;
 
-	spin_lock_irqsave(&clocks_lock, flags);
 	div = ((readl(config->reg) >> config->masks->shift) &
 			config->masks->mask) + 1;
+
+	BUG_ON(!div);
+
 	clk->rate = (unsigned long)clk->pclk->rate / div;
-	spin_unlock_irqrestore(&clocks_lock, flags);
 }
 
 /*
@@ -365,9 +428,7 @@ void aux_clk_recalc(struct clk *clk)
 {
 	struct aux_clk_config *config = clk->private_data;
 	unsigned int num = 1, den = 1, val, eqn;
-	unsigned long flags;
 
-	spin_lock_irqsave(&clocks_lock, flags);
 	val = readl(config->synth_reg);
 
 	eqn = (val >> config->masks->eq_sel_shift) &
@@ -382,10 +443,10 @@ void aux_clk_recalc(struct clk *clk)
 	/* calculate denominator */
 	den *= (val >> config->masks->yscale_sel_shift) &
 		config->masks->yscale_sel_mask;
-	val = (((clk->pclk->rate/10000) * num) / den) * 10000;
 
-	clk->rate = val;
-	spin_unlock_irqrestore(&clocks_lock, flags);
+	BUG_ON(!den);
+
+	clk->rate = (((clk->pclk->rate/10000) * num) / den) * 10000;
 }
 
 /*
@@ -397,17 +458,16 @@ void gpt_clk_recalc(struct clk *clk)
 {
 	struct gpt_clk_config *config = clk->private_data;
 	unsigned int div = 1, val;
-	unsigned long flags;
 
-	spin_lock_irqsave(&clocks_lock, flags);
 	val = readl(config->synth_reg);
 	div += (val >> config->masks->mscale_sel_shift) &
 		config->masks->mscale_sel_mask;
 	div *= 1 << (((val >> config->masks->nscale_sel_shift) &
 				config->masks->nscale_sel_mask) + 1);
 
+	BUG_ON(!div);
+
 	clk->rate = (unsigned long)clk->pclk->rate / div;
-	spin_unlock_irqrestore(&clocks_lock, flags);
 }
 
 /*
@@ -425,18 +485,19 @@ void clcd_clk_recalc(struct clk *clk)
 {
 	struct clcd_clk_config *config = clk->private_data;
 	unsigned int div = 1;
-	unsigned long flags, prate;
+	unsigned long prate;
 	unsigned int val;
 
-	spin_lock_irqsave(&clocks_lock, flags);
 	val = readl(config->synth_reg);
 	div = (val >> config->masks->div_factor_shift) &
 		config->masks->div_factor_mask;
 
 	prate = clk->pclk->rate / 1000; /* first level division, make it KHz */
-	clk->rate = ((unsigned long)prate << 14 / 2 * div) >> 14;
+
+	BUG_ON(!div);
+
+	clk->rate = (((unsigned long)prate << 12) / (2 * div)) >> 12;
 	clk->rate *= 1000;
-	spin_unlock_irqrestore(&clocks_lock, flags);
 }
 
 /*
@@ -445,12 +506,9 @@ void clcd_clk_recalc(struct clk *clk)
  */
 void follow_parent(struct clk *clk)
 {
-	unsigned long flags;
 	unsigned int div_factor = (clk->div_factor < 1) ? 1 : clk->div_factor;
 
-	spin_lock_irqsave(&clocks_lock, flags);
 	clk->rate = clk->pclk->rate/div_factor;
-	spin_unlock_irqrestore(&clocks_lock, flags);
 }
 
 /**
@@ -461,5 +519,20 @@ void follow_parent(struct clk *clk)
  */
 void recalc_root_clocks(void)
 {
-	propagate_rate(&root_clks);
+	struct clk *pclk;
+	unsigned long flags;
+
+	spin_lock_irqsave(&clocks_lock, flags);
+	list_for_each_entry(pclk, &root_clks, sibling) {
+		/*
+		 * It doesn't make a sense to recalc and propogate rate
+		 * if clk is not enabled in hw.
+		 */
+		if (clk_is_enabled(pclk)) {
+			if (pclk->recalc)
+				pclk->recalc(pclk);
+			propagate_rate(pclk);
+		}
+	}
+	spin_unlock_irqrestore(&clocks_lock, flags);
 }
Signature · 1 line
1.7.2.2
#68 lore raw

PATCH 19/74 ST SPEAr: Adding Debugfs support on clock framework

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

---
 arch/arm/plat-spear/clock.c              |  116 ++++++++++++++++++++++++++++++
 arch/arm/plat-spear/include/plat/clock.h |    8 ++
 2 files changed, 124 insertions(+), 0 deletions(-)
arch/arm/plat-spear/clock.c +116 -0
index b4d8110..75c42a3 100644
@@ -13,6 +13,7 @@
 
 #include <linux/bug.h>
 #include <linux/clk.h>
+#include <linux/debugfs.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/list.h>
@@ -22,8 +23,14 @@
 
 static DEFINE_SPINLOCK(clocks_lock);
 static LIST_HEAD(root_clks);
+#ifdef CONFIG_DEBUG_FS
+static LIST_HEAD(clocks);
+#endif
 
 static void propagate_rate(struct clk *);
+#ifdef CONFIG_DEBUG_FS
+static int clk_debugfs_reparent(struct clk *);
+#endif
 
 static int clk_is_enabled(struct clk *clk)
 {
@@ -113,6 +120,10 @@ static void clk_reparent(struct clk *clk, struct pclk_info *pclk_info)
 
 	clk->pclk = pclk_info->pclk;
 	spin_unlock_irqrestore(&clocks_lock, flags);
+
+#ifdef CONFIG_DEBUG_FS
+	clk_debugfs_reparent(clk);
+#endif
 }
 
 void do_clk_disable(struct clk *clk)
@@ -335,6 +346,12 @@ void clk_register(struct clk_lookup *cl)
 
 	spin_unlock_irqrestore(&clocks_lock, flags);
 
+	/* debugfs specific */
+#ifdef CONFIG_DEBUG_FS
+	list_add(&clk->node, &clocks);
+	clk->cl = cl;
+#endif
+
 	/* add clock to arm clockdev framework */
 	clkdev_add(cl);
 }
@@ -536,3 +553,102 @@ void recalc_root_clocks(void)
 	}
 	spin_unlock_irqrestore(&clocks_lock, flags);
 }
+
+#ifdef CONFIG_DEBUG_FS
+/*
+ *	debugfs support to trace clock tree hierarchy and attributes
+ */
+static struct dentry *clk_debugfs_root;
+static int clk_debugfs_register_one(struct clk *c)
+{
+	int err;
+	struct dentry *d, *child;
+	struct clk *pa = c->pclk;
+	char s[255];
+	char *p = s;
+
+	if (c) {
+		if (c->cl->con_id)
+			p += sprintf(p, "%s", c->cl->con_id);
+		if (c->cl->dev_id)
+			p += sprintf(p, "%s", c->cl->dev_id);
+	}
+	d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
+	if (!d)
+		return -ENOMEM;
+	c->dent = d;
+
+	d = debugfs_create_u32("usage_count", S_IRUGO, c->dent,
+			(u32 *)&c->usage_count);
+	if (!d) {
+		err = -ENOMEM;
+		goto err_out;
+	}
+	d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
+	if (!d) {
+		err = -ENOMEM;
+		goto err_out;
+	}
+	d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
+	if (!d) {
+		err = -ENOMEM;
+		goto err_out;
+	}
+	return 0;
+
+err_out:
+	d = c->dent;
+	list_for_each_entry(child, &d->d_subdirs, d_u.d_child)
+		debugfs_remove(child);
+	debugfs_remove(c->dent);
+	return err;
+}
+
+static int clk_debugfs_register(struct clk *c)
+{
+	int err;
+	struct clk *pa = c->pclk;
+
+	if (pa && !pa->dent) {
+		err = clk_debugfs_register(pa);
+		if (err)
+			return err;
+	}
+
+	if (!c->dent) {
+		err = clk_debugfs_register_one(c);
+		if (err)
+			return err;
+	}
+	return 0;
+}
+
+static int __init clk_debugfs_init(void)
+{
+	struct clk *c;
+	struct dentry *d;
+	int err;
+
+	d = debugfs_create_dir("clock", NULL);
+	if (!d)
+		return -ENOMEM;
+	clk_debugfs_root = d;
+
+	list_for_each_entry(c, &clocks, node) {
+		err = clk_debugfs_register(c);
+		if (err)
+			goto err_out;
+	}
+	return 0;
+err_out:
+	debugfs_remove_recursive(clk_debugfs_root);
+	return err;
+}
+late_initcall(clk_debugfs_init);
+
+static int clk_debugfs_reparent(struct clk *c)
+{
+	debugfs_remove(c->dent);
+	return clk_debugfs_register_one(c);
+}
+#endif /* CONFIG_DEBUG_FS */
arch/arm/plat-spear/include/plat/clock.h +8 -0
index 019d308..2e55855 100644
@@ -72,6 +72,9 @@ struct pclk_sel {
  * @children: list for childrens or this clock
  * @sibling: node for list of clocks having same parents
  * @private_data: clock specific private data
+ * @node: list to maintain clocks linearly
+ * @cl: clocklook up assoicated with this clock
+ * @dent: object for debugfs
  */
 struct clk {
 	unsigned int usage_count;
@@ -90,6 +93,11 @@ struct clk {
 	struct list_head children;
 	struct list_head sibling;
 	void *private_data;
+#ifdef CONFIG_DEBUG_FS
+	struct list_head node;
+	struct clk_lookup *cl;
+	struct dentry *dent;
+#endif
 };
 
 /* pll configuration structure */
Signature · 1 line
1.7.2.2
#69 lore raw

PATCH 20/74 Clock Framework: Adding ENABLED_ON_INIT feature in clk

In reply to Viresh KUMAR
---
 arch/arm/mach-spear13xx/clock.c          |    2 ++
 arch/arm/mach-spear3xx/clock.c           |    1 +
 arch/arm/mach-spear6xx/clock.c           |    1 +
 arch/arm/plat-spear/clock.c              |    6 ++++++
 arch/arm/plat-spear/include/plat/clock.h |    1 +
 5 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/mach-spear13xx/clock.c +2 -0
index 9d97c69..9252940 100644
@@ -89,6 +89,7 @@ static struct pll_clk_config pll1_config = {
 
 /* pll1 clock */
 static struct clk pll1_clk = {
+	.flags = ENABLED_ON_INIT,
 	.pclk_sel = &pll_pclk_sel,
 	.pclk_sel_shift = PLL1_CLK_SHIFT,
 	.en_reg = PLL1_CTR,
@@ -156,6 +157,7 @@ static struct pll_clk_config pll4_config = {
 
 /* pll4 (DDR) clock */
 static struct clk pll4_clk = {
+	.flags = ENABLED_ON_INIT,
 	.pclk = &osc1_24m_clk,
 	.en_reg = PLL4_CTR,
 	.en_reg_bit = PLL_ENABLE,
arch/arm/mach-spear3xx/clock.c +1 -0
index 5eb6ff6..79f0159 100644
@@ -62,6 +62,7 @@ static struct pll_clk_config pll1_config = {
 
 /* PLL1 clock */
 static struct clk pll1_clk = {
+	.flags = ENABLED_ON_INIT,
 	.pclk = &osc_24m_clk,
 	.en_reg = PLL1_CTR,
 	.en_reg_bit = PLL_ENABLE,
arch/arm/mach-spear6xx/clock.c +1 -0
index 3caf91a..fb05ec8 100644
@@ -62,6 +62,7 @@ static struct pll_clk_config pll1_config = {
 
 /* PLL1 clock */
 static struct clk pll1_clk = {
+	.flags = ENABLED_ON_INIT,
 	.pclk = &osc_30m_clk,
 	.en_reg = PLL1_CTR,
 	.en_reg_bit = PLL_ENABLE,
arch/arm/plat-spear/clock.c +6 -0
index 75c42a3..e871016 100644
@@ -372,6 +372,9 @@ void propagate_rate(struct clk *pclk)
 				clk->recalc(clk);
 			propagate_rate(clk);
 		}
+		/* Enable clks enabled on init, in software view */
+		if (clk->flags & ENABLED_ON_INIT)
+			do_clk_enable(clk);
 	}
 }
 
@@ -550,6 +553,9 @@ void recalc_root_clocks(void)
 				pclk->recalc(pclk);
 			propagate_rate(pclk);
 		}
+		/* Enable clks enabled on init, in software view */
+		if (pclk->flags & ENABLED_ON_INIT)
+			do_clk_enable(pclk);
 	}
 	spin_unlock_irqrestore(&clocks_lock, flags);
 }
arch/arm/plat-spear/include/plat/clock.h +1 -0
index 2e55855..91f8e3f 100644
@@ -21,6 +21,7 @@
 /* clk structure flags */
 #define	ALWAYS_ENABLED		(1 << 0) /* clock always enabled */
 #define	RESET_TO_ENABLE		(1 << 1) /* reset register bit to enable clk */
+#define	ENABLED_ON_INIT		(1 << 2) /* clocks enabled@init */
 
 /**
  * struct clkops - clock operations
Signature · 1 line
1.7.2.2
#70 lore raw

PATCH 21/74 ST SPEAr : Added keyboard support

In reply to Viresh KUMAR

From: Rajeev Kumar <[email protected]>

---
 arch/arm/mach-spear13xx/clock.c                |    2 +-
 arch/arm/mach-spear13xx/include/mach/generic.h |    1 +
 arch/arm/mach-spear13xx/spear1300_evb.c        |   14 +
 arch/arm/mach-spear13xx/spear13xx.c            |   19 ++
 arch/arm/mach-spear3xx/clock.c                 |   12 +
 arch/arm/mach-spear3xx/include/mach/generic.h  |    1 +
 arch/arm/mach-spear3xx/spear300.c              |   19 ++
 arch/arm/mach-spear3xx/spear300_evb.c          |   14 +
 arch/arm/plat-spear/include/plat/keyboard.h    |  154 +++++++++++
 drivers/input/keyboard/Kconfig                 |    8 +
 drivers/input/keyboard/Makefile                |    1 +
 drivers/input/keyboard/spear-keyboard.c        |  335 ++++++++++++++++++++++++
 12 files changed, 579 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/plat-spear/include/plat/keyboard.h
 create mode 100644 drivers/input/keyboard/spear-keyboard.c
arch/arm/mach-spear13xx/clock.c +1 -1
index 9252940..c48b779 100644
@@ -801,7 +801,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{.dev_id = "ssp",		.clk = &ssp_clk},
 	{.dev_id = "gpio0",		.clk = &gpio0_clk},
 	{.dev_id = "gpio1",		.clk = &gpio1_clk},
-	{.dev_id = "kbd",		.clk = &kbd_clk},
+	{.dev_id = "keyboard",		.clk = &kbd_clk},
 	{.dev_id = "wdt",		.clk = &wdt_clk},
 };
 
arch/arm/mach-spear13xx/include/mach/generic.h +1 -0
index 7e5d7e1..19c5de0 100644
@@ -33,6 +33,7 @@ extern struct amba_device uart_device;
 extern struct platform_device ehci0_device;
 extern struct platform_device ehci1_device;
 extern struct platform_device i2c_device;
+extern struct platform_device kbd_device;
 extern struct platform_device ohci0_device;
 extern struct platform_device ohci1_device;
 extern struct platform_device rtc_device;
arch/arm/mach-spear13xx/spear1300_evb.c +14 -0
index 0a6d26f..0cdad7a 100644
@@ -16,6 +16,7 @@
 #include <asm/mach-types.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
+#include <plat/keyboard.h>
 
 static struct amba_device *amba_devs[] __initdata = {
 	&uart_device,
@@ -25,15 +26,28 @@ static struct platform_device *plat_devs[] __initdata = {
 	&ehci0_device,
 	&ehci1_device,
 	&i2c_device,
+	&kbd_device,
 	&ohci0_device,
 	&ohci1_device,
 	&rtc_device,
 };
 
+/* keyboard specific platform data */
+static DECLARE_KEYMAP(spear_keymap);
+
+static struct kbd_platform_data kbd_data = {
+	.keymap = spear_keymap,
+	.keymapsize = ARRAY_SIZE(spear_keymap),
+	.rep = 1,
+};
+
 static void __init spear1300_evb_init(void)
 {
 	unsigned int i;
 
+	/* set keyboard plat data */
+	kbd_set_plat_data(&kbd_device, &kbd_data);
+
 	/* call spear1300 machine init function */
 	spear1300_init();
 
arch/arm/mach-spear13xx/spear13xx.c +19 -0
index c8f1aff..342fcd9 100644
@@ -166,6 +166,25 @@ struct platform_device ohci1_device = {
 	.resource = ohci1_resources,
 };
 
+/* keyboard device registration */
+static struct resource kbd_resources[] = {
+	{
+		.start = SPEAR13XX_KBD_BASE,
+		.end = SPEAR13XX_KBD_BASE + SZ_1K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = IRQ_KBD,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device kbd_device = {
+	.name = "keyboard",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(kbd_resources),
+	.resource = kbd_resources,
+};
+
 /* rtc device registration */
 static struct resource rtc_resources[] = {
 	{
arch/arm/mach-spear3xx/clock.c +12 -0
index 79f0159..3a26622 100644
@@ -470,6 +470,15 @@ static struct clk i2c1_clk = {
 };
 #endif
 
+#ifdef CONFIG_MACH_SPEAR300
+/* keyboard clock */
+static struct clk kbd_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &apb_clk,
+	.recalc = &follow_parent,
+};
+#endif
+
 /* array of all spear 3xx clock lookups */
 static struct clk_lookup spear_clk_lookups[] = {
 	{ .con_id = "apb_pclk",	.clk = &dummy_apb_pclk},
@@ -511,6 +520,9 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "adc",		.clk = &adc_clk},
 	{ .dev_id = "ssp",		.clk = &ssp_clk},
 	{ .dev_id = "gpio",		.clk = &gpio_clk},
+#ifdef CONFIG_MACH_SPEAR300
+	{ .dev_id = "keyboard",		.clk = &kbd_clk},
+#endif
 #ifdef CONFIG_MACH_SPEAR320
 	{ .dev_id = "i2c_designware.1",	.clk = &i2c1_clk},
 #endif
arch/arm/mach-spear3xx/include/mach/generic.h +1 -0
index 3eb2737..70f7ee2 100644
@@ -108,6 +108,7 @@ extern struct pmx_driver pmx_driver;
 /* Add spear300 machine device structure declarations here */
 extern struct amba_device clcd_device;
 extern struct amba_device gpio1_device;
+extern struct platform_device kbd_device;
 
 /* pad mux modes */
 extern struct pmx_mode nand_mode;
arch/arm/mach-spear3xx/spear300.c +19 -0
index 5d8df00..fa314e9 100644
@@ -407,6 +407,25 @@ struct amba_device gpio1_device = {
 	.irq = {VIRQ_GPIO1, NO_IRQ},
 };
 
+/* keyboard device registration */
+static struct resource kbd_resources[] = {
+	{
+		.start = SPEAR300_KEYBOARD_BASE,
+		.end = SPEAR300_KEYBOARD_BASE + SZ_1K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = VIRQ_KEYBOARD,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device kbd_device = {
+	.name = "keyboard",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(kbd_resources),
+	.resource = kbd_resources,
+};
+
 /* spear3xx shared irq */
 struct shirq_dev_config shirq_ras1_config[] = {
 	{
arch/arm/mach-spear3xx/spear300_evb.c +14 -0
index 3b3c6ce..afb773e 100644
@@ -15,6 +15,7 @@
 #include <asm/mach-types.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
+#include <plat/keyboard.h>
 
 /* padmux devices to enable */
 static struct pmx_dev *pmx_devs[] = {
@@ -51,6 +52,16 @@ static struct platform_device *plat_devs[] __initdata = {
 	&rtc_device,
 
 	/* spear300 specific devices */
+	&kbd_device,
+};
+
+/* keyboard specific platform data */
+static DECLARE_KEYMAP(spear_keymap);
+
+static struct kbd_platform_data kbd_data = {
+	.keymap = spear_keymap,
+	.keymapsize = ARRAY_SIZE(spear_keymap),
+	.rep = 1,
 };
 
 static void __init spear300_evb_init(void)
@@ -62,6 +73,9 @@ static void __init spear300_evb_init(void)
 	pmx_driver.devs = pmx_devs;
 	pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
 
+	/* set keyboard plat data */
+	kbd_set_plat_data(&kbd_device, &kbd_data);
+
 	/* call spear300 machine init function */
 	spear300_init();
 
arch/arm/plat-spear/include/plat/keyboard.h new file +154 -0

154 lines not on this page · raw message

drivers/input/keyboard/Kconfig +8 -0
index 9cc488d..2d7e3a8 100644
@@ -424,6 +424,14 @@ config KEYBOARD_OMAP
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
+config KEYBOARD_SPEAR
+	tristate "ST SPEAR keyboard support"
+	help
+	  Say Y here if you want to use the SPEAR keyboard.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called spear-keboard.
+
 config KEYBOARD_TWL4030
 	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
 	depends on TWL4030_CORE
drivers/input/keyboard/Makefile +1 -0
index 504b591..b21c54d 100644
@@ -35,6 +35,7 @@ obj-$(CONFIG_KEYBOARD_PXA930_ROTARY)	+= pxa930_rotary.o
 obj-$(CONFIG_KEYBOARD_QT2160)		+= qt2160.o
 obj-$(CONFIG_KEYBOARD_SAMSUNG)		+= samsung-keypad.o
 obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
+obj-$(CONFIG_KEYBOARD_SPEAR)		+= spear-keyboard.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
 obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
drivers/input/keyboard/spear-keyboard.c new file +335 -0

335 lines not on this page · raw message

Signature · 1 line
1.7.2.2
maintainer
#71 lore raw

PATCH 21/74 ST SPEAr : Added keyboard support

Hi Rajeev,

Quoted 5 lines · Viresh KUMAR

From: Rajeev Kumar <[email protected]>

Quoted 17 lines
---
 arch/arm/mach-spear13xx/clock.c                |    2 +-
 arch/arm/mach-spear13xx/include/mach/generic.h |    1 +
 arch/arm/mach-spear13xx/spear1300_evb.c        |   14 +
 arch/arm/mach-spear13xx/spear13xx.c            |   19 ++
 arch/arm/mach-spear3xx/clock.c                 |   12 +
 arch/arm/mach-spear3xx/include/mach/generic.h  |    1 +
 arch/arm/mach-spear3xx/spear300.c              |   19 ++
 arch/arm/mach-spear3xx/spear300_evb.c          |   14 +
 arch/arm/plat-spear/include/plat/keyboard.h    |  154 +++++++++++
 drivers/input/keyboard/Kconfig                 |    8 +
 drivers/input/keyboard/Makefile                |    1 +
 drivers/input/keyboard/spear-keyboard.c        |  335 ++++++++++++++++++++++++
 12 files changed, 579 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/plat-spear/include/plat/keyboard.h
 create mode 100644 drivers/input/keyboard/spear-keyboard.c

First of all, please split platform modifications from the driver itself (as I care about the latter but less about the former).

Quoted 223 lines
arch/arm/mach-spear13xx/clock.c +1 -1
index 9252940..c48b779 100644
@@ -801,7 +801,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{.dev_id = "ssp",		.clk = &ssp_clk},
 	{.dev_id = "gpio0",		.clk = &gpio0_clk},
 	{.dev_id = "gpio1",		.clk = &gpio1_clk},
-	{.dev_id = "kbd",		.clk = &kbd_clk},
+	{.dev_id = "keyboard",		.clk = &kbd_clk},
 	{.dev_id = "wdt",		.clk = &wdt_clk},
 };
 
arch/arm/mach-spear13xx/include/mach/generic.h +1 -0
index 7e5d7e1..19c5de0 100644
@@ -33,6 +33,7 @@ extern struct amba_device uart_device;
 extern struct platform_device ehci0_device;
 extern struct platform_device ehci1_device;
 extern struct platform_device i2c_device;
+extern struct platform_device kbd_device;
 extern struct platform_device ohci0_device;
 extern struct platform_device ohci1_device;
 extern struct platform_device rtc_device;
arch/arm/mach-spear13xx/spear1300_evb.c +14 -0
index 0a6d26f..0cdad7a 100644
@@ -16,6 +16,7 @@
 #include <asm/mach-types.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
+#include <plat/keyboard.h>
 
 static struct amba_device *amba_devs[] __initdata = {
 	&uart_device,
@@ -25,15 +26,28 @@ static struct platform_device *plat_devs[] __initdata = {
 	&ehci0_device,
 	&ehci1_device,
 	&i2c_device,
+	&kbd_device,
 	&ohci0_device,
 	&ohci1_device,
 	&rtc_device,
 };
 
+/* keyboard specific platform data */
+static DECLARE_KEYMAP(spear_keymap);
+
+static struct kbd_platform_data kbd_data = {
+	.keymap = spear_keymap,
+	.keymapsize = ARRAY_SIZE(spear_keymap),
+	.rep = 1,
+};
+
 static void __init spear1300_evb_init(void)
 {
 	unsigned int i;
 
+	/* set keyboard plat data */
+	kbd_set_plat_data(&kbd_device, &kbd_data);
+
 	/* call spear1300 machine init function */
 	spear1300_init();
 
arch/arm/mach-spear13xx/spear13xx.c +19 -0
index c8f1aff..342fcd9 100644
@@ -166,6 +166,25 @@ struct platform_device ohci1_device = {
 	.resource = ohci1_resources,
 };
 
+/* keyboard device registration */
+static struct resource kbd_resources[] = {
+	{
+		.start = SPEAR13XX_KBD_BASE,
+		.end = SPEAR13XX_KBD_BASE + SZ_1K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = IRQ_KBD,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device kbd_device = {
+	.name = "keyboard",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(kbd_resources),
+	.resource = kbd_resources,
+};
+
 /* rtc device registration */
 static struct resource rtc_resources[] = {
 	{
arch/arm/mach-spear3xx/clock.c +12 -0
index 79f0159..3a26622 100644
@@ -470,6 +470,15 @@ static struct clk i2c1_clk = {
 };
 #endif
 
+#ifdef CONFIG_MACH_SPEAR300
+/* keyboard clock */
+static struct clk kbd_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &apb_clk,
+	.recalc = &follow_parent,
+};
+#endif
+
 /* array of all spear 3xx clock lookups */
 static struct clk_lookup spear_clk_lookups[] = {
 	{ .con_id = "apb_pclk",	.clk = &dummy_apb_pclk},
@@ -511,6 +520,9 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "adc",		.clk = &adc_clk},
 	{ .dev_id = "ssp",		.clk = &ssp_clk},
 	{ .dev_id = "gpio",		.clk = &gpio_clk},
+#ifdef CONFIG_MACH_SPEAR300
+	{ .dev_id = "keyboard",		.clk = &kbd_clk},
+#endif
 #ifdef CONFIG_MACH_SPEAR320
 	{ .dev_id = "i2c_designware.1",	.clk = &i2c1_clk},
 #endif
arch/arm/mach-spear3xx/include/mach/generic.h +1 -0
index 3eb2737..70f7ee2 100644
@@ -108,6 +108,7 @@ extern struct pmx_driver pmx_driver;
 /* Add spear300 machine device structure declarations here */
 extern struct amba_device clcd_device;
 extern struct amba_device gpio1_device;
+extern struct platform_device kbd_device;
 
 /* pad mux modes */
 extern struct pmx_mode nand_mode;
arch/arm/mach-spear3xx/spear300.c +19 -0
index 5d8df00..fa314e9 100644
@@ -407,6 +407,25 @@ struct amba_device gpio1_device = {
 	.irq = {VIRQ_GPIO1, NO_IRQ},
 };
 
+/* keyboard device registration */
+static struct resource kbd_resources[] = {
+	{
+		.start = SPEAR300_KEYBOARD_BASE,
+		.end = SPEAR300_KEYBOARD_BASE + SZ_1K - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.start = VIRQ_KEYBOARD,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device kbd_device = {
+	.name = "keyboard",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(kbd_resources),
+	.resource = kbd_resources,
+};
+
 /* spear3xx shared irq */
 struct shirq_dev_config shirq_ras1_config[] = {
 	{
arch/arm/mach-spear3xx/spear300_evb.c +14 -0
index 3b3c6ce..afb773e 100644
@@ -15,6 +15,7 @@
 #include <asm/mach-types.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
+#include <plat/keyboard.h>
 
 /* padmux devices to enable */
 static struct pmx_dev *pmx_devs[] = {
@@ -51,6 +52,16 @@ static struct platform_device *plat_devs[] __initdata = {
 	&rtc_device,
 
 	/* spear300 specific devices */
+	&kbd_device,
+};
+
+/* keyboard specific platform data */
+static DECLARE_KEYMAP(spear_keymap);
+
+static struct kbd_platform_data kbd_data = {
+	.keymap = spear_keymap,
+	.keymapsize = ARRAY_SIZE(spear_keymap),
+	.rep = 1,
 };
 
 static void __init spear300_evb_init(void)
@@ -62,6 +73,9 @@ static void __init spear300_evb_init(void)
 	pmx_driver.devs = pmx_devs;
 	pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
 
+	/* set keyboard plat data */
+	kbd_set_plat_data(&kbd_device, &kbd_data);
+
 	/* call spear300 machine init function */
 	spear300_init();
 
arch/arm/plat-spear/include/plat/keyboard.h new file +10 -0
new file mode 100644
index 0000000..8345770
@@ -0,0 +1,154 @@
+/*
+ * arch/arm/plat-spear/include/plat/keyboard.h
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Rajeev Kumar<[email protected]>
+ *
+ * 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.
+ */

arch/arm/plat-spear/include/plat/keyboard.h line 20

Quoted 10 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +10 -0
+
+#ifndef __PLAT_KEYBOARD_H
+#define __PLAT_KEYBOARD_H
+
+#include <linux/bitops.h>
+#include <linux/input.h>
+#include <mach/misc_regs.h>
+
+#define KEY(row, col, val) (((row) << 28 | ((col) << 24) | (val)))
+

Please use definitions from include/linux/input/matrix_keypad.h

Quoted 92 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +92 -0
+#define DECLARE_KEYMAP(name) \
+int name[] = {\
+	KEY(0, 0, KEY_ESC), \
+	KEY(0, 1, KEY_1), \
+	KEY(0, 2, KEY_2), \
+	KEY(0, 3, KEY_3), \
+	KEY(0, 4, KEY_4), \
+	KEY(0, 5, KEY_5), \
+	KEY(0, 6, KEY_6), \
+	KEY(0, 7, KEY_7), \
+	KEY(0, 8, KEY_8), \
+	KEY(1, 0, KEY_9), \
+	KEY(1, 1, KEY_MINUS), \
+	KEY(1, 2, KEY_EQUAL), \
+	KEY(1, 3, KEY_BACKSPACE), \
+	KEY(1, 4, KEY_TAB), \
+	KEY(1, 5, KEY_Q), \
+	KEY(1, 6, KEY_W), \
+	KEY(1, 7, KEY_E), \
+	KEY(1, 8, KEY_R), \
+	KEY(2, 0, KEY_T), \
+	KEY(2, 1, KEY_Y), \
+	KEY(2, 2, KEY_U), \
+	KEY(2, 3, KEY_I), \
+	KEY(2, 4, KEY_O), \
+	KEY(2, 5, KEY_P), \
+	KEY(2, 6, KEY_LEFTBRACE), \
+	KEY(2, 7, KEY_RIGHTBRACE), \
+	KEY(2, 8, KEY_ENTER), \
+	KEY(3, 0, KEY_LEFTCTRL), \
+	KEY(3, 1, KEY_A), \
+	KEY(3, 2, KEY_S), \
+	KEY(3, 3, KEY_D), \
+	KEY(3, 4, KEY_F), \
+	KEY(3, 5, KEY_G), \
+	KEY(3, 6, KEY_H), \
+	KEY(3, 7, KEY_J), \
+	KEY(3, 8, KEY_K), \
+	KEY(4, 0, KEY_L), \
+	KEY(4, 1, KEY_SEMICOLON), \
+	KEY(4, 2, KEY_APOSTROPHE), \
+	KEY(4, 3, KEY_GRAVE), \
+	KEY(4, 4, KEY_LEFTSHIFT), \
+	KEY(4, 5, KEY_BACKSLASH), \
+	KEY(4, 6, KEY_Z), \
+	KEY(4, 7, KEY_X), \
+	KEY(4, 8, KEY_C), \
+	KEY(4, 0, KEY_L), \
+	KEY(4, 1, KEY_SEMICOLON), \
+	KEY(4, 2, KEY_APOSTROPHE), \
+	KEY(4, 3, KEY_GRAVE), \
+	KEY(4, 4, KEY_LEFTSHIFT), \
+	KEY(4, 5, KEY_BACKSLASH), \
+	KEY(4, 6, KEY_Z), \
+	KEY(4, 7, KEY_X), \
+	KEY(4, 8, KEY_C), \
+	KEY(4, 0, KEY_L), \
+	KEY(4, 1, KEY_SEMICOLON), \
+	KEY(4, 2, KEY_APOSTROPHE), \
+	KEY(4, 3, KEY_GRAVE), \
+	KEY(4, 4, KEY_LEFTSHIFT), \
+	KEY(4, 5, KEY_BACKSLASH), \
+	KEY(4, 6, KEY_Z), \
+	KEY(4, 7, KEY_X), \
+	KEY(4, 8, KEY_C), \
+	KEY(5, 0, KEY_V), \
+	KEY(5, 1, KEY_B), \
+	KEY(5, 2, KEY_N), \
+	KEY(5, 3, KEY_M), \
+	KEY(5, 4, KEY_COMMA), \
+	KEY(5, 5, KEY_DOT), \
+	KEY(5, 6, KEY_SLASH), \
+	KEY(5, 7, KEY_RIGHTSHIFT), \
+	KEY(5, 8, KEY_KPASTERISK), \
+	KEY(6, 0, KEY_LEFTALT), \
+	KEY(6, 1, KEY_SPACE), \
+	KEY(6, 2, KEY_CAPSLOCK), \
+	KEY(6, 3, KEY_F1), \
+	KEY(6, 4, KEY_F2), \
+	KEY(6, 5, KEY_F3), \
+	KEY(6, 6, KEY_F4), \
+	KEY(6, 7, KEY_F5), \
+	KEY(6, 8, KEY_F6), \
+	KEY(7, 0, KEY_F7), \
+	KEY(7, 1, KEY_F8), \
+	KEY(7, 2, KEY_F9), \
+	KEY(7, 3, KEY_F10), \
+	KEY(7, 4, KEY_NUMLOCK), \
+	KEY(7, 5, KEY_SCROLLLOCK), \
+	KEY(7, 6, KEY_KP7), \
+	KEY(7, 7, KEY_KP8), \
+	KEY(7, 8, KEY_KP9), \

arch/arm/plat-spear/include/plat/keyboard.h line 122

Quoted 10 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +10 -0
+	KEY(8, 0, KEY_KPMINUS), \
+	KEY(8, 1, KEY_KP4), \
+	KEY(8, 2, KEY_KP5), \
+	KEY(8, 3, KEY_KP6), \
+	KEY(8, 4, KEY_KPPLUS), \
+	KEY(8, 5, KEY_KP1), \
+	KEY(8, 6, KEY_KP2), \
+	KEY(8, 7, KEY_KP3), \
+	KEY(8, 8, KEY_KP0), \
+};

Hm, I'd expect this to be in particular board code, not in the header file.

Quoted 4 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +4 -0
+/**
+ * struct kbd_platform_data - keymap for spear keyboards
+ * keymap: pointer to array of values encoded with KEY() macro representing
+ * keymap

arch/arm/plat-spear/include/plat/keyboard.h line 136

Quoted 10 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +10 -0
+ * keymapsize: number of entries (initialized) in this keymap
+ * rep: current values for autorepeat parameters
+ *
+ * This structure is supposed to be used by platform code to supply
+ * keymaps to drivers that implement keyboards.
+ */
+struct kbd_platform_data {
+	int *keymap;
+	unsigned int keymapsize;
+	unsigned int rep:1;

Bool please.

Quoted 4 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +4 -0
+};
+
+/* This function is used to set platform data field of pdev->dev */
+static inline void

arch/arm/plat-spear/include/plat/keyboard.h line 150

Quoted 10 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +10 -0
+kbd_set_plat_data(struct platform_device *pdev, struct kbd_platform_data *data)
+{
+#ifdef CONFIG_ARCH_SPEAR13XX
+#define KBD_PAD_SEL	(BIT(18) | BIT(20) | BIT(22) | BIT(24) | BIT(26))
+
+	u32 val;
+	/* Workaround:Setting bit for routing it to the IP */
+	val = readl(PAD_FUNCTION_EN_2);
+	val &= ~KBD_PAD_SEL;
+	writel(val, PAD_FUNCTION_EN_2);

Why does it belong here?

Quoted 9 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +4 -0
+#endif
+	pdev->dev.platform_data = data;
+}
+#endif /* __PLAT_KEYBOARD_H */
drivers/input/keyboard/Kconfig +0 -0
index 9cc488d..2d7e3a8 100644

drivers/input/keyboard/Kconfig config KEYBOARD_OMAP · line 428

Quoted 5 lines
drivers/input/keyboard/Kconfig +2 -0
@@ -424,6 +424,14 @@ config KEYBOARD_OMAP
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
+config KEYBOARD_SPEAR
+	tristate "ST SPEAR keyboard support"

No arch/platform dependencies?

Quoted 77 lines
drivers/input/keyboard/Kconfig +6 -0
+	help
+	  Say Y here if you want to use the SPEAR keyboard.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called spear-keboard.
+
 config KEYBOARD_TWL4030
 	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
 	depends on TWL4030_CORE
drivers/input/keyboard/Makefile +1 -0
index 504b591..b21c54d 100644
@@ -35,6 +35,7 @@ obj-$(CONFIG_KEYBOARD_PXA930_ROTARY)	+= pxa930_rotary.o
 obj-$(CONFIG_KEYBOARD_QT2160)		+= qt2160.o
 obj-$(CONFIG_KEYBOARD_SAMSUNG)		+= samsung-keypad.o
 obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
+obj-$(CONFIG_KEYBOARD_SPEAR)		+= spear-keyboard.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
 obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
drivers/input/keyboard/spear-keyboard.c new file +50 -0
new file mode 100644
index 0000000..4f5c734
@@ -0,0 +1,335 @@
+/*
+ * drivers/input/keyboard/keyboard-spear.c
+ *
+ * SPEAr Keyboard Driver
+ * Based on omap-keypad driver
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Rajeev Kumar<[email protected]>
+ *
+ * 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.
+ */
+
+#include <linux/clk.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_wakeup.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <plat/keyboard.h>
+
+/* Keyboard Regsiters */
+#define MODE_REG	0x00	/* 16 bit reg */
+#define STATUS_REG	0x0C	/* 2 bit reg */
+#define DATA_REG	0x10	/* 8 bit reg */
+#define INTR_MASK	0x54
+
+/* Register Values */
+/*
+ * pclk freq mask = (APB FEQ -1)= 82 MHZ.Programme bit 15-9 in mode
+ * control register as 1010010(82MHZ)
+ */
+#define PCLK_FREQ_MSK	0xA400	/* 82 MHz */
+#define START_SCAN	0x0100
+#define SCAN_RATE_10	0x0000
+#define SCAN_RATE_20	0x0004
+#define SCAN_RATE_40	0x0008
+#define SCAN_RATE_80	0x000C
+#define MODE_KEYBOARD	0x0002
+#define DATA_AVAIL	0x2
+
+#define KEY_MASK	0xFF000000

drivers/input/keyboard/spear-keyboard.c line 60

Quoted 10 lines
drivers/input/keyboard/spear-keyboard.c new file +10 -0
+#define KEY_VALUE	0x00FFFFFF
+#define ROW_MASK	0xF0
+#define COLUMN_MASK	0x0F
+#define ROW_SHIFT	4
+
+struct spear_kbd {
+	struct input_dev *input;
+	void __iomem *io_base;		/* Keyboard Base Address */
+	struct clk *clk;
+	int *keymap;

You need a copy of keymap here so that userspace can modify it safely via EVIOCSKEYCODE.

Quoted 9 lines
drivers/input/keyboard/spear-keyboard.c new file +9 -0
+};
+/* TODO: Need to optimize this function */
+static inline int get_key_value(struct spear_kbd *dev, int row, int col)
+{
+	int i, key;
+	int *keymap = dev->keymap;
+
+	key = KEY(row, col, 0);
+	for (i = 0; keymap[i] != 0; i++)

drivers/input/keyboard/spear-keyboard.c line 79

Quoted 10 lines
drivers/input/keyboard/spear-keyboard.c new file +10 -0
+		if ((keymap[i] & KEY_MASK) == key)
+			return keymap[i] & KEY_VALUE;
+	return -ENOKEY;
+}
+
+static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
+{
+	struct spear_kbd *dev = dev_id;
+	static u8 last_key ;
+	static u8 last_event;

No statics please, pull it into spear_kbd structure.

drivers/input/keyboard/spear-keyboard.c line 83

Quoted 4 lines
drivers/input/keyboard/spear-keyboard.c new file +4 -0
+	int key;
+	u8 sts, val = 0;
+
+	if (dev == NULL) {

How can it be?

Quoted 18 lines
drivers/input/keyboard/spear-keyboard.c new file +18 -0
+		pr_err("Keyboard: Invalid dev_id in irq handler\n");
+		return IRQ_NONE;
+	}
+
+	sts = readb(dev->io_base + STATUS_REG);
+	if (sts & DATA_AVAIL) {
+		/* following reads active (row, col) pair */
+		val = readb(dev->io_base + DATA_REG);
+		key = get_key_value(dev, (val & ROW_MASK)>>ROW_SHIFT, (val
+					& COLUMN_MASK));
+
+		/* valid key press event */
+		if (key >= 0) {
+			if (last_event == 1) {
+				/* check if we missed a release event */
+				input_report_key(dev->input, last_key,
+						!last_event);
+			}

drivers/input/keyboard/spear-keyboard.c line 111

Quoted 10 lines
drivers/input/keyboard/spear-keyboard.c new file +10 -0
+			/* notify key press */
+			last_event = 1;
+			last_key = key;
+			input_report_key(dev->input, key, last_event);
+		} else {
+			/* notify key release */
+			last_event = 0;
+			input_report_key(dev->input, last_key, last_event);
+		}
+	} else

Don't you need to clear interrupt here? You got it somehow...

Quoted 63 lines
drivers/input/keyboard/spear-keyboard.c new file +63 -0
+		return IRQ_NONE;
+
+	/* clear interrupt */
+	writeb(0, dev->io_base + STATUS_REG);
+
+	return IRQ_HANDLED;
+}
+
+static int __init spear_kbd_probe(struct platform_device *pdev)
+{
+	struct spear_kbd *kbd;
+	struct kbd_platform_data *pdata = pdev->dev.platform_data;
+	struct resource *res;
+	int i, ret, irq;
+	u16 val = 0;
+
+	if (!pdata) {
+		dev_err(&pdev->dev, "Invalid platform data\n");
+		return -EINVAL;
+	}
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "no keyboard resource defined\n");
+		return -EBUSY;
+	}
+
+	if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
+		dev_err(&pdev->dev, "keyboard region already claimed\n");
+		return -EBUSY;
+	}
+
+	kbd = kzalloc(sizeof(*kbd), GFP_KERNEL);
+	if (!kbd) {
+		dev_err(&pdev->dev, "out of memory\n");
+		ret = -ENOMEM;
+		goto err_release_mem_region;
+	}
+
+	kbd->clk = clk_get(&pdev->dev, NULL);
+	if (IS_ERR(kbd->clk)) {
+		ret = PTR_ERR(kbd->clk);
+		goto err_kfree;
+	}
+
+	ret = clk_enable(kbd->clk);
+	if (ret < 0)
+		goto err_clk_put;
+
+	platform_set_drvdata(pdev, kbd);
+	kbd->keymap = pdata->keymap; /* key mappings */
+
+	kbd->io_base = ioremap(res->start, resource_size(res));
+	if (!kbd->io_base) {
+		dev_err(&pdev->dev, "ioremap fail for kbd_region\n");
+		ret = -ENOMEM;
+		goto err_clear_plat_data;
+	}
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		dev_err(&pdev->dev, "not able to get irq for the device\n");
+		ret = irq;

drivers/input/keyboard/spear-keyboard.c line 184

Quoted 10 lines
drivers/input/keyboard/spear-keyboard.c new file +10 -0
+		goto err_iounmap;
+	}
+
+	ret = request_irq(irq, spear_kbd_interrupt, 0, "keyboard",
+			kbd);
+	if (ret) {
+		dev_err(&pdev->dev, "request_irq fail\n");
+		goto err_iounmap;
+	}
+

Are you 100% sure the device is shut off at this point? Because if it isn't you risk to get interrupt before you allocated your input device.

Quoted 29 lines
drivers/input/keyboard/spear-keyboard.c new file +29 -0
+	kbd->input = input_allocate_device();
+	if (!kbd->input) {
+		ret = -ENOMEM;
+		dev_err(&pdev->dev, "input device allocation fail\n");
+		goto err_free_irq;
+	}
+
+	if (pdata->rep)
+		__set_bit(EV_REP, kbd->input->evbit);
+
+	/* setup input device */
+	__set_bit(EV_KEY, kbd->input->evbit);
+
+	for (i = 0; kbd->keymap[i] != 0; i++)
+		__set_bit(kbd->keymap[i] & KEY_MAX, kbd->input->keybit);
+
+	kbd->input->name = "keyboard";
+	kbd->input->phys = "keyboard/input0";
+	kbd->input->dev.parent = &pdev->dev;
+	kbd->input->id.bustype = BUS_HOST;
+	kbd->input->id.vendor = 0x0001;
+	kbd->input->id.product = 0x0001;
+	kbd->input->id.version = 0x0100;
+
+	ret = input_register_device(kbd->input);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Unable to register keyboard device\n");
+		goto err_free_dev;
+	}

drivers/input/keyboard/spear-keyboard.c line 223

Quoted 10 lines
drivers/input/keyboard/spear-keyboard.c new file +10 -0
+
+	/* program keyboard */
+	val |= SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK;
+	writew(val, kbd->io_base + MODE_REG);
+
+	writeb(1, kbd->io_base + STATUS_REG);
+
+	/* start key scan */
+	val |= START_SCAN;
+	writew(val, kbd->io_base + MODE_REG);

This should go into open() method.

Quoted 24 lines
drivers/input/keyboard/spear-keyboard.c new file +24 -0
+
+	device_init_wakeup(&pdev->dev, 1);
+
+	return 0;
+
+err_free_dev:
+	input_free_device(kbd->input);
+err_free_irq:
+	free_irq(irq, pdev);
+err_iounmap:
+	iounmap(kbd->io_base);
+err_clear_plat_data:
+	platform_set_drvdata(pdev, NULL);
+	clk_disable(kbd->clk);
+err_clk_put:
+	clk_put(kbd->clk);
+err_kfree:
+	kfree(kbd);
+err_release_mem_region:
+	release_mem_region(res->start, resource_size(res));
+
+	return ret;
+}
+

drivers/input/keyboard/spear-keyboard.c line 257

Quoted 10 lines
drivers/input/keyboard/spear-keyboard.c new file +10 -0
+static int spear_kbd_remove(struct platform_device *pdev)
+{
+	struct spear_kbd *kbd = platform_get_drvdata(pdev);
+	struct resource *res;
+	u16 val;
+	int irq;
+
+	val = readw(kbd->io_base + MODE_REG);
+	val &= ~START_SCAN;
+	writew(val, kbd->io_base + MODE_REG);

Need to go into close() method.

drivers/input/keyboard/spear-keyboard.c line 261

Quoted 4 lines
drivers/input/keyboard/spear-keyboard.c new file +4 -0
+
+	/* unregister input device */
+	input_unregister_device(kbd->input);
+	input_free_device(kbd->input);

No free after unregister.

drivers/input/keyboard/spear-keyboard.c line 265

Quoted 4 lines
drivers/input/keyboard/spear-keyboard.c new file +4 -0
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq)
+		free_irq(irq, pdev);

Can it ever be 0 here?

Quoted 39 lines
drivers/input/keyboard/spear-keyboard.c new file +39 -0
+
+	iounmap(kbd->io_base);
+	platform_set_drvdata(pdev, NULL);
+	clk_disable(kbd->clk);
+	clk_put(kbd->clk);
+	kfree(kbd);
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res)
+		release_mem_region(res->start, resource_size(res));
+
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int spear_kbd_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct spear_kbd *kbd = platform_get_drvdata(pdev);
+	int irq;
+
+	irq = platform_get_irq(pdev, 0);
+	clk_disable(kbd->clk);
+	if (device_may_wakeup(&pdev->dev))
+		enable_irq_wake(irq);
+
+	return 0;
+}
+
+static int spear_kbd_resume(struct platform_device *pdev)
+{
+	struct spear_kbd *kbd = platform_get_drvdata(pdev);
+	int irq;
+
+	irq = platform_get_irq(pdev, 0);
+	if (device_may_wakeup(&pdev->dev))
+		disable_irq_wake(irq);
+	clk_enable(kbd->clk);
+
+	return 0;
+}

drivers/input/keyboard/spear-keyboard.c line 314

Quoted 10 lines
drivers/input/keyboard/spear-keyboard.c new file +10 -0
+#else
+#define spear_kbd_suspend	NULL
+#define spear_kbd_resume	NULL
+#endif
+
+static struct platform_driver spear_kbd_driver = {
+	.probe		= spear_kbd_probe,
+	.remove		= spear_kbd_remove,
+	.suspend	= spear_kbd_suspend,
+	.resume		= spear_kbd_resume,

Switch to dev_pm_ops please.

Quoted 24 lines
drivers/input/keyboard/spear-keyboard.c new file +21 -0
+	.driver		= {
+		.name	= "keyboard",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __devinit spear_kbd_init(void)
+{
+	return platform_driver_register(&spear_kbd_driver);
+}
+module_init(spear_kbd_init);
+
+static void __exit spear_kbd_exit(void)
+{
+	platform_driver_unregister(&spear_kbd_driver);
+}
+module_exit(spear_kbd_exit);
+
+MODULE_AUTHOR("Rajeev Kumar");
+MODULE_DESCRIPTION("SPEAr Keyboard Driver");
+MODULE_LICENSE("GPL");
Signature · 1 line
1.7.2.2

Thanks.

Signature · 1 line
Dmitry
#72 lore raw

PATCH 21/74 ST SPEAr : Added keyboard support

Hi Dmitry

Please find my answers embedded below.

Quoted 2 lines · Dmitry Torokhov

Hi Rajeev,

[snip...]

Quoted 4 lines

First of all, please split platform modifications from the driver itself (as I care about the latter but less about the former).

Will be done.

Quoted 2 lines
Quoted 2 lines
arch/arm/mach-spear13xx/clock.c +0 -0
index 9252940..c48b779 100644

[snip...]

Quoted 16 lines
Quoted 16 lines

+++ b/arch/arm/plat-spear/include/plat/keyboard.h

arch/arm/mach-spear13xx/clock.c +14 -0
@@ -0,0 +1,154 @@
+/*
+ * arch/arm/plat-spear/include/plat/keyboard.h
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Rajeev Kumar<[email protected]>
+ *
+ * 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 __PLAT_KEYBOARD_H
+#define __PLAT_KEYBOARD_H
+
Quoted 9 lines

arch/arm/mach-spear13xx/clock.c line 20

Quoted 6 lines
arch/arm/mach-spear13xx/clock.c +6 -0
+#include <linux/bitops.h>
+#include <linux/input.h>
+#include <mach/misc_regs.h>
+
+#define KEY(row, col, val) (((row) << 28 | ((col) << 24) | (val)))
+

Please use definitions from include/linux/input/matrix_keypad.h

Ok. I will check it and modify.

Quoted 97 lines
Quoted 97 lines
arch/arm/mach-spear13xx/clock.c +97 -0
+#define DECLARE_KEYMAP(name) \
+int name[] = {\
+     KEY(0, 0, KEY_ESC), \
+     KEY(0, 1, KEY_1), \
+     KEY(0, 2, KEY_2), \
+     KEY(0, 3, KEY_3), \
+     KEY(0, 4, KEY_4), \
+     KEY(0, 5, KEY_5), \
+     KEY(0, 6, KEY_6), \
+     KEY(0, 7, KEY_7), \
+     KEY(0, 8, KEY_8), \
+     KEY(1, 0, KEY_9), \
+     KEY(1, 1, KEY_MINUS), \
+     KEY(1, 2, KEY_EQUAL), \
+     KEY(1, 3, KEY_BACKSPACE), \
+     KEY(1, 4, KEY_TAB), \
+     KEY(1, 5, KEY_Q), \
+     KEY(1, 6, KEY_W), \
+     KEY(1, 7, KEY_E), \
+     KEY(1, 8, KEY_R), \
+     KEY(2, 0, KEY_T), \
+     KEY(2, 1, KEY_Y), \
+     KEY(2, 2, KEY_U), \
+     KEY(2, 3, KEY_I), \
+     KEY(2, 4, KEY_O), \
+     KEY(2, 5, KEY_P), \
+     KEY(2, 6, KEY_LEFTBRACE), \
+     KEY(2, 7, KEY_RIGHTBRACE), \
+     KEY(2, 8, KEY_ENTER), \
+     KEY(3, 0, KEY_LEFTCTRL), \
+     KEY(3, 1, KEY_A), \
+     KEY(3, 2, KEY_S), \
+     KEY(3, 3, KEY_D), \
+     KEY(3, 4, KEY_F), \
+     KEY(3, 5, KEY_G), \
+     KEY(3, 6, KEY_H), \
+     KEY(3, 7, KEY_J), \
+     KEY(3, 8, KEY_K), \
+     KEY(4, 0, KEY_L), \
+     KEY(4, 1, KEY_SEMICOLON), \
+     KEY(4, 2, KEY_APOSTROPHE), \
+     KEY(4, 3, KEY_GRAVE), \
+     KEY(4, 4, KEY_LEFTSHIFT), \
+     KEY(4, 5, KEY_BACKSLASH), \
+     KEY(4, 6, KEY_Z), \
+     KEY(4, 7, KEY_X), \
+     KEY(4, 8, KEY_C), \
+     KEY(4, 0, KEY_L), \
+     KEY(4, 1, KEY_SEMICOLON), \
+     KEY(4, 2, KEY_APOSTROPHE), \
+     KEY(4, 3, KEY_GRAVE), \
+     KEY(4, 4, KEY_LEFTSHIFT), \
+     KEY(4, 5, KEY_BACKSLASH), \
+     KEY(4, 6, KEY_Z), \
+     KEY(4, 7, KEY_X), \
+     KEY(4, 8, KEY_C), \
+     KEY(4, 0, KEY_L), \
+     KEY(4, 1, KEY_SEMICOLON), \
+     KEY(4, 2, KEY_APOSTROPHE), \
+     KEY(4, 3, KEY_GRAVE), \
+     KEY(4, 4, KEY_LEFTSHIFT), \
+     KEY(4, 5, KEY_BACKSLASH), \
+     KEY(4, 6, KEY_Z), \
+     KEY(4, 7, KEY_X), \
+     KEY(4, 8, KEY_C), \
+     KEY(5, 0, KEY_V), \
+     KEY(5, 1, KEY_B), \
+     KEY(5, 2, KEY_N), \
+     KEY(5, 3, KEY_M), \
+     KEY(5, 4, KEY_COMMA), \
+     KEY(5, 5, KEY_DOT), \
+     KEY(5, 6, KEY_SLASH), \
+     KEY(5, 7, KEY_RIGHTSHIFT), \
+     KEY(5, 8, KEY_KPASTERISK), \
+     KEY(6, 0, KEY_LEFTALT), \
+     KEY(6, 1, KEY_SPACE), \
+     KEY(6, 2, KEY_CAPSLOCK), \
+     KEY(6, 3, KEY_F1), \
+     KEY(6, 4, KEY_F2), \
+     KEY(6, 5, KEY_F3), \
+     KEY(6, 6, KEY_F4), \
+     KEY(6, 7, KEY_F5), \
+     KEY(6, 8, KEY_F6), \
+     KEY(7, 0, KEY_F7), \
+     KEY(7, 1, KEY_F8), \
+     KEY(7, 2, KEY_F9), \
+     KEY(7, 3, KEY_F10), \
+     KEY(7, 4, KEY_NUMLOCK), \
+     KEY(7, 5, KEY_SCROLLLOCK), \
+     KEY(7, 6, KEY_KP7), \
+     KEY(7, 7, KEY_KP8), \
+     KEY(7, 8, KEY_KP9), \
+     KEY(8, 0, KEY_KPMINUS), \
+     KEY(8, 1, KEY_KP4), \
+     KEY(8, 2, KEY_KP5), \
+     KEY(8, 3, KEY_KP6), \
+     KEY(8, 4, KEY_KPPLUS), \
Quoted 9 lines

arch/arm/mach-spear13xx/clock.c line 122

Quoted 5 lines
arch/arm/mach-spear13xx/clock.c +5 -0
+     KEY(8, 5, KEY_KP1), \
+     KEY(8, 6, KEY_KP2), \
+     KEY(8, 7, KEY_KP3), \
+     KEY(8, 8, KEY_KP0), \
+};

Hm, I'd expect this to be in particular board code, not in the header file.

Currently we have support for evaluation boards only and all of them will have this structure in their board source files. In order to remove redundant code we kept it in plat/keyboard.h.

Quoted 8 lines
Quoted 8 lines
arch/arm/mach-spear13xx/clock.c +8 -0
+/**
+ * struct kbd_platform_data - keymap for spear keyboards
+ * keymap: pointer to array of values encoded with KEY() macro representing
+ * keymap
+ * keymapsize: number of entries (initialized) in this keymap
+ * rep: current values for autorepeat parameters
+ *
+ * This structure is supposed to be used by platform code to supply
Quoted 9 lines

arch/arm/mach-spear13xx/clock.c line 136

Quoted 6 lines
arch/arm/mach-spear13xx/clock.c +6 -0
+ * keymaps to drivers that implement keyboards.
+ */
+struct kbd_platform_data {
+     int *keymap;
+     unsigned int keymapsize;
+     unsigned int rep:1;

Bool please.

OK

Quoted 8 lines
Quoted 8 lines
arch/arm/mach-spear13xx/clock.c +8 -0
+};
+
+/* This function is used to set platform data field of pdev->dev */
+static inline void
+kbd_set_plat_data(struct platform_device *pdev, struct kbd_platform_data *data)
+{
+#ifdef CONFIG_ARCH_SPEAR13XX
+#define KBD_PAD_SEL  (BIT(18) | BIT(20) | BIT(22) | BIT(24) | BIT(26))
Quoted 9 lines

arch/arm/mach-spear13xx/clock.c line 150

Quoted 6 lines
arch/arm/mach-spear13xx/clock.c +6 -0
+
+     u32 val;
+     /* Workaround:Setting bit for routing it to the IP */
+     val = readl(PAD_FUNCTION_EN_2);
+     val &= ~KBD_PAD_SEL;
+     writel(val, PAD_FUNCTION_EN_2);

Why does it belong here?

Sorry. It will be handled in padmux framework.

Quoted 12 lines
Quoted 12 lines
arch/arm/mach-spear13xx/clock.c +4 -0
+#endif
+     pdev->dev.platform_data = data;
+}
+#endif /* __PLAT_KEYBOARD_H */
drivers/input/keyboard/Kconfig +0 -0
index 9cc488d..2d7e3a8 100644
@@ -424,6 +424,14 @@ config KEYBOARD_OMAP
        To compile this driver as a module, choose M here: the
        module will be called omap-keypad.
 
Quoted 5 lines

drivers/input/keyboard/Kconfig config KEYBOARD_OMAP · line 428

Quoted 2 lines
drivers/input/keyboard/Kconfig +2 -0
+config KEYBOARD_SPEAR
+     tristate "ST SPEAR keyboard support"

No arch/platform dependencies?

Will add them.

Quoted 1 line
Quoted 1 line
drivers/input/keyboard/Kconfig +1 -0
+     help

[snip...]

Quoted 9 lines

drivers/input/keyboard/Kconfig

Quoted 5 lines
drivers/input/keyboard/Kconfig +5 -0
+struct spear_kbd {
+     struct input_dev *input;
+     void __iomem *io_base;          /* Keyboard Base Address */
+     struct clk *clk;
+     int *keymap;

You need a copy of keymap here so that userspace can modify it safely via EVIOCSKEYCODE.

We have one copy of struct spear_kbd per device structure. I think it will be fine if we change this structure only. And so don't need to copy another structure in driver.

Quoted 13 lines
Quoted 13 lines
drivers/input/keyboard/Kconfig +13 -0
+};
+/* TODO: Need to optimize this function */
+static inline int get_key_value(struct spear_kbd *dev, int row, int col)
+{
+     int i, key;
+     int *keymap = dev->keymap;
+
+     key = KEY(row, col, 0);
+     for (i = 0; keymap[i] != 0; i++)
+             if ((keymap[i] & KEY_MASK) == key)
+                     return keymap[i] & KEY_VALUE;
+     return -ENOKEY;
+}
Quoted 9 lines

drivers/input/keyboard/Kconfig

Quoted 6 lines
drivers/input/keyboard/Kconfig +6 -0
+
+static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
+{
+     struct spear_kbd *dev = dev_id;
+     static u8 last_key ;
+     static u8 last_event;

No statics please, pull it into spear_kbd structure.

Ok

Quoted 7 lines

drivers/input/keyboard/Kconfig

Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+     int key;
+     u8 sts, val = 0;
+
+     if (dev == NULL) {

How can it be?

Not needed, will be fixed.

Quoted 22 lines
Quoted 22 lines
drivers/input/keyboard/Kconfig +22 -0
+             pr_err("Keyboard: Invalid dev_id in irq handler\n");
+             return IRQ_NONE;
+     }
+
+     sts = readb(dev->io_base + STATUS_REG);
+     if (sts & DATA_AVAIL) {
+             /* following reads active (row, col) pair */
+             val = readb(dev->io_base + DATA_REG);
+             key = get_key_value(dev, (val & ROW_MASK)>>ROW_SHIFT, (val
+                                     & COLUMN_MASK));
+
+             /* valid key press event */
+             if (key >= 0) {
+                     if (last_event == 1) {
+                             /* check if we missed a release event */
+                             input_report_key(dev->input, last_key,
+                                             !last_event);
+                     }
+                     /* notify key press */
+                     last_event = 1;
+                     last_key = key;
+                     input_report_key(dev->input, key, last_event);
Quoted 9 lines

drivers/input/keyboard/Kconfig

Quoted 6 lines
drivers/input/keyboard/Kconfig +6 -0
+             } else {
+                     /* notify key release */
+                     last_event = 0;
+                     input_report_key(dev->input, last_key, last_event);
+             }
+     } else

Don't you need to clear interrupt here? You got it somehow...

I can think of only one way in which this handler is called for some other device interrupt, that is when this irq line is shared between peripherals. In that case if interrupt is not meant for kbd then kbd shouldn't clear it. Isn't it fine???

Quoted 10 lines
Quoted 10 lines
drivers/input/keyboard/Kconfig +10 -0
+             return IRQ_NONE;
+
+     /* clear interrupt */
+     writeb(0, dev->io_base + STATUS_REG);
+
+     return IRQ_HANDLED;
+}
+
+static int __init spear_kbd_probe(struct platform_device *pdev)
+{

[snip...]

Quoted 11 lines

drivers/input/keyboard/Kconfig

Quoted 7 lines
drivers/input/keyboard/Kconfig +7 -0
+     ret = request_irq(irq, spear_kbd_interrupt, 0, "keyboard",
+                     kbd);
+     if (ret) {
+             dev_err(&pdev->dev, "request_irq fail\n");
+             goto err_iounmap;
+     }
+

Are you 100% sure the device is shut off at this point? Because if it isn't you risk to get interrupt before you allocated your input device.

I will check and place it at correct place.

Quoted 7 lines

drivers/input/keyboard/Kconfig

Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+
+     /* start key scan */
+     val |= START_SCAN;
+     writew(val, kbd->io_base + MODE_REG);

This should go into open() method.

OK.

Quoted 4 lines
Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+static int spear_kbd_remove(struct platform_device *pdev)
+{
+     struct spear_kbd *kbd = platform_get_drvdata(pdev);
+     struct resource *res;
Quoted 9 lines

drivers/input/keyboard/Kconfig

Quoted 6 lines
drivers/input/keyboard/Kconfig +6 -0
+     u16 val;
+     int irq;
+
+     val = readw(kbd->io_base + MODE_REG);
+     val &= ~START_SCAN;
+     writew(val, kbd->io_base + MODE_REG);

Need to go into close() method.

OK.

Quoted 7 lines

drivers/input/keyboard/Kconfig

Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+
+     /* unregister input device */
+     input_unregister_device(kbd->input);
+     input_free_device(kbd->input);

No free after unregister.

OK.

Quoted 7 lines

drivers/input/keyboard/Kconfig

Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+
+     irq = platform_get_irq(pdev, 0);
+     if (irq)
+             free_irq(irq, pdev);

Can it ever be 0 here?

No. Will correct.

Quoted 9 lines

drivers/input/keyboard/Kconfig

Quoted 6 lines
drivers/input/keyboard/Kconfig +6 -0
+
+static struct platform_driver spear_kbd_driver = {
+     .probe          = spear_kbd_probe,
+     .remove         = spear_kbd_remove,
+     .suspend        = spear_kbd_suspend,
+     .resume         = spear_kbd_resume,

Switch to dev_pm_ops please.

Ok.

Thanks,
rajeev.

#73 lore raw

PATCH 21/74 ST SPEAr : Added keyboard support

Quoted 6 lines · rajeev
Quoted 6 lines
Quoted 6 lines

+struct spear_kbd {

Quoted 4 lines
Quoted 4 lines
drivers/input/keyboard/spear-keyboard.c new file +4 -0
+     struct input_dev *input;
+     void __iomem *io_base;          /* Keyboard Base Address */
+     struct clk *clk;
+     int *keymap;
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

You need a copy of keymap here so that userspace can modify it safely via EVIOCSKEYCODE.

We have one copy of struct spear_kbd per device structure. I think it will be fine if we change this structure only. And so don't need to copy another structure in driver.

Sorry!! I wanted to say "keymap array" not "struct spear_kbd" in above explanation.

rajeev.

maintainer
#74 lore raw

PATCH 21/74 ST SPEAr : Added keyboard support

In reply to rajeev
Quoted 157 lines · rajeev

Hi Dmitry

Please find my answers embedded below.

Quoted 2 lines · Dmitry Torokhov

Hi Rajeev,

[snip...]

Quoted 4 lines

First of all, please split platform modifications from the driver itself (as I care about the latter but less about the former).

Will be done.

Quoted 2 lines
Quoted 2 lines
arch/arm/mach-spear13xx/clock.c +0 -0
index 9252940..c48b779 100644

[snip...]

Quoted 16 lines
Quoted 16 lines

+++ b/arch/arm/plat-spear/include/plat/keyboard.h

arch/arm/mach-spear13xx/clock.c +14 -0
@@ -0,0 +1,154 @@
+/*
+ * arch/arm/plat-spear/include/plat/keyboard.h
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Rajeev Kumar<[email protected]>
+ *
+ * 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 __PLAT_KEYBOARD_H
+#define __PLAT_KEYBOARD_H
+
Quoted 9 lines

arch/arm/mach-spear13xx/clock.c line 20

Quoted 6 lines
arch/arm/mach-spear13xx/clock.c +6 -0
+#include <linux/bitops.h>
+#include <linux/input.h>
+#include <mach/misc_regs.h>
+
+#define KEY(row, col, val) (((row) << 28 | ((col) << 24) | (val)))
+

Please use definitions from include/linux/input/matrix_keypad.h

Ok. I will check it and modify.

Quoted 97 lines
Quoted 97 lines
arch/arm/mach-spear13xx/clock.c +97 -0
+#define DECLARE_KEYMAP(name) \
+int name[] = {\
+     KEY(0, 0, KEY_ESC), \
+     KEY(0, 1, KEY_1), \
+     KEY(0, 2, KEY_2), \
+     KEY(0, 3, KEY_3), \
+     KEY(0, 4, KEY_4), \
+     KEY(0, 5, KEY_5), \
+     KEY(0, 6, KEY_6), \
+     KEY(0, 7, KEY_7), \
+     KEY(0, 8, KEY_8), \
+     KEY(1, 0, KEY_9), \
+     KEY(1, 1, KEY_MINUS), \
+     KEY(1, 2, KEY_EQUAL), \
+     KEY(1, 3, KEY_BACKSPACE), \
+     KEY(1, 4, KEY_TAB), \
+     KEY(1, 5, KEY_Q), \
+     KEY(1, 6, KEY_W), \
+     KEY(1, 7, KEY_E), \
+     KEY(1, 8, KEY_R), \
+     KEY(2, 0, KEY_T), \
+     KEY(2, 1, KEY_Y), \
+     KEY(2, 2, KEY_U), \
+     KEY(2, 3, KEY_I), \
+     KEY(2, 4, KEY_O), \
+     KEY(2, 5, KEY_P), \
+     KEY(2, 6, KEY_LEFTBRACE), \
+     KEY(2, 7, KEY_RIGHTBRACE), \
+     KEY(2, 8, KEY_ENTER), \
+     KEY(3, 0, KEY_LEFTCTRL), \
+     KEY(3, 1, KEY_A), \
+     KEY(3, 2, KEY_S), \
+     KEY(3, 3, KEY_D), \
+     KEY(3, 4, KEY_F), \
+     KEY(3, 5, KEY_G), \
+     KEY(3, 6, KEY_H), \
+     KEY(3, 7, KEY_J), \
+     KEY(3, 8, KEY_K), \
+     KEY(4, 0, KEY_L), \
+     KEY(4, 1, KEY_SEMICOLON), \
+     KEY(4, 2, KEY_APOSTROPHE), \
+     KEY(4, 3, KEY_GRAVE), \
+     KEY(4, 4, KEY_LEFTSHIFT), \
+     KEY(4, 5, KEY_BACKSLASH), \
+     KEY(4, 6, KEY_Z), \
+     KEY(4, 7, KEY_X), \
+     KEY(4, 8, KEY_C), \
+     KEY(4, 0, KEY_L), \
+     KEY(4, 1, KEY_SEMICOLON), \
+     KEY(4, 2, KEY_APOSTROPHE), \
+     KEY(4, 3, KEY_GRAVE), \
+     KEY(4, 4, KEY_LEFTSHIFT), \
+     KEY(4, 5, KEY_BACKSLASH), \
+     KEY(4, 6, KEY_Z), \
+     KEY(4, 7, KEY_X), \
+     KEY(4, 8, KEY_C), \
+     KEY(4, 0, KEY_L), \
+     KEY(4, 1, KEY_SEMICOLON), \
+     KEY(4, 2, KEY_APOSTROPHE), \
+     KEY(4, 3, KEY_GRAVE), \
+     KEY(4, 4, KEY_LEFTSHIFT), \
+     KEY(4, 5, KEY_BACKSLASH), \
+     KEY(4, 6, KEY_Z), \
+     KEY(4, 7, KEY_X), \
+     KEY(4, 8, KEY_C), \
+     KEY(5, 0, KEY_V), \
+     KEY(5, 1, KEY_B), \
+     KEY(5, 2, KEY_N), \
+     KEY(5, 3, KEY_M), \
+     KEY(5, 4, KEY_COMMA), \
+     KEY(5, 5, KEY_DOT), \
+     KEY(5, 6, KEY_SLASH), \
+     KEY(5, 7, KEY_RIGHTSHIFT), \
+     KEY(5, 8, KEY_KPASTERISK), \
+     KEY(6, 0, KEY_LEFTALT), \
+     KEY(6, 1, KEY_SPACE), \
+     KEY(6, 2, KEY_CAPSLOCK), \
+     KEY(6, 3, KEY_F1), \
+     KEY(6, 4, KEY_F2), \
+     KEY(6, 5, KEY_F3), \
+     KEY(6, 6, KEY_F4), \
+     KEY(6, 7, KEY_F5), \
+     KEY(6, 8, KEY_F6), \
+     KEY(7, 0, KEY_F7), \
+     KEY(7, 1, KEY_F8), \
+     KEY(7, 2, KEY_F9), \
+     KEY(7, 3, KEY_F10), \
+     KEY(7, 4, KEY_NUMLOCK), \
+     KEY(7, 5, KEY_SCROLLLOCK), \
+     KEY(7, 6, KEY_KP7), \
+     KEY(7, 7, KEY_KP8), \
+     KEY(7, 8, KEY_KP9), \
+     KEY(8, 0, KEY_KPMINUS), \
+     KEY(8, 1, KEY_KP4), \
+     KEY(8, 2, KEY_KP5), \
+     KEY(8, 3, KEY_KP6), \
+     KEY(8, 4, KEY_KPPLUS), \
Quoted 9 lines

arch/arm/mach-spear13xx/clock.c line 122

Quoted 5 lines
arch/arm/mach-spear13xx/clock.c +5 -0
+     KEY(8, 5, KEY_KP1), \
+     KEY(8, 6, KEY_KP2), \
+     KEY(8, 7, KEY_KP3), \
+     KEY(8, 8, KEY_KP0), \
+};

Hm, I'd expect this to be in particular board code, not in the header file.

Quoted 4 lines

Currently we have support for evaluation boards only and all of them will have this structure in their board source files. In order to remove redundant code we kept it in plat/keyboard.h.

So call it "spear_default_keymap" and put it right into the driver? And then allow platform code override it.

Quoted 70 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-spear13xx/clock.c +8 -0
+/**
+ * struct kbd_platform_data - keymap for spear keyboards
+ * keymap: pointer to array of values encoded with KEY() macro representing
+ * keymap
+ * keymapsize: number of entries (initialized) in this keymap
+ * rep: current values for autorepeat parameters
+ *
+ * This structure is supposed to be used by platform code to supply
Quoted 9 lines

arch/arm/mach-spear13xx/clock.c line 136

Quoted 6 lines
arch/arm/mach-spear13xx/clock.c +6 -0
+ * keymaps to drivers that implement keyboards.
+ */
+struct kbd_platform_data {
+     int *keymap;
+     unsigned int keymapsize;
+     unsigned int rep:1;

Bool please.

OK

Quoted 8 lines
Quoted 8 lines
arch/arm/mach-spear13xx/clock.c +8 -0
+};
+
+/* This function is used to set platform data field of pdev->dev */
+static inline void
+kbd_set_plat_data(struct platform_device *pdev, struct kbd_platform_data *data)
+{
+#ifdef CONFIG_ARCH_SPEAR13XX
+#define KBD_PAD_SEL  (BIT(18) | BIT(20) | BIT(22) | BIT(24) | BIT(26))
Quoted 9 lines

arch/arm/mach-spear13xx/clock.c line 150

Quoted 6 lines
arch/arm/mach-spear13xx/clock.c +6 -0
+
+     u32 val;
+     /* Workaround:Setting bit for routing it to the IP */
+     val = readl(PAD_FUNCTION_EN_2);
+     val &= ~KBD_PAD_SEL;
+     writel(val, PAD_FUNCTION_EN_2);

Why does it belong here?

Sorry. It will be handled in padmux framework.

Quoted 12 lines
Quoted 12 lines
arch/arm/mach-spear13xx/clock.c +4 -0
+#endif
+     pdev->dev.platform_data = data;
+}
+#endif /* __PLAT_KEYBOARD_H */
drivers/input/keyboard/Kconfig +0 -0
index 9cc488d..2d7e3a8 100644
@@ -424,6 +424,14 @@ config KEYBOARD_OMAP
        To compile this driver as a module, choose M here: the
        module will be called omap-keypad.
 
Quoted 5 lines

drivers/input/keyboard/Kconfig config KEYBOARD_OMAP · line 428

Quoted 2 lines
drivers/input/keyboard/Kconfig +2 -0
+config KEYBOARD_SPEAR
+     tristate "ST SPEAR keyboard support"

No arch/platform dependencies?

Will add them.

Quoted 1 line
Quoted 1 line
drivers/input/keyboard/Kconfig +1 -0
+     help

[snip...]

Quoted 6 lines
Quoted 5 lines
drivers/input/keyboard/Kconfig +5 -0
+struct spear_kbd {
+     struct input_dev *input;
+     void __iomem *io_base;          /* Keyboard Base Address */
+     struct clk *clk;
+     int *keymap;
Quoted 7 lines
Quoted 3 lines

You need a copy of keymap here so that userspace can modify it safely via EVIOCSKEYCODE.

We have one copy of struct spear_kbd per device structure. I think it will be fine if we change this structure only. And so don't need to copy another structure in driver.

Normally such platform data should be declared as 'const' and drivers should not modify such data. Also unbinding device from driver and rebinding later should restore the device into pristine state. Having a copy of keymap in spear_kbd allows to achieve such behavior.

Quoted 68 lines
Quoted 14 lines
Quoted 14 lines
drivers/input/keyboard/Kconfig +13 -0
+};
+/* TODO: Need to optimize this function */
+static inline int get_key_value(struct spear_kbd *dev, int row, int col)
+{
+     int i, key;
+     int *keymap = dev->keymap;
+
+     key = KEY(row, col, 0);
+     for (i = 0; keymap[i] != 0; i++)
+             if ((keymap[i] & KEY_MASK) == key)
+                     return keymap[i] & KEY_VALUE;
+     return -ENOKEY;
+}
Quoted 9 lines

drivers/input/keyboard/Kconfig

Quoted 6 lines
drivers/input/keyboard/Kconfig +6 -0
+
+static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
+{
+     struct spear_kbd *dev = dev_id;
+     static u8 last_key ;
+     static u8 last_event;

No statics please, pull it into spear_kbd structure.

Ok

Quoted 7 lines

drivers/input/keyboard/Kconfig

Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+     int key;
+     u8 sts, val = 0;
+
+     if (dev == NULL) {

How can it be?

Not needed, will be fixed.

Quoted 22 lines
Quoted 22 lines
drivers/input/keyboard/Kconfig +22 -0
+             pr_err("Keyboard: Invalid dev_id in irq handler\n");
+             return IRQ_NONE;
+     }
+
+     sts = readb(dev->io_base + STATUS_REG);
+     if (sts & DATA_AVAIL) {
+             /* following reads active (row, col) pair */
+             val = readb(dev->io_base + DATA_REG);
+             key = get_key_value(dev, (val & ROW_MASK)>>ROW_SHIFT, (val
+                                     & COLUMN_MASK));
+
+             /* valid key press event */
+             if (key >= 0) {
+                     if (last_event == 1) {
+                             /* check if we missed a release event */
+                             input_report_key(dev->input, last_key,
+                                             !last_event);
+                     }
+                     /* notify key press */
+                     last_event = 1;
+                     last_key = key;
+                     input_report_key(dev->input, key, last_event);
Quoted 9 lines

drivers/input/keyboard/Kconfig

Quoted 6 lines
drivers/input/keyboard/Kconfig +6 -0
+             } else {
+                     /* notify key release */
+                     last_event = 0;
+                     input_report_key(dev->input, last_key, last_event);
+             }
+     } else

Don't you need to clear interrupt here? You got it somehow...

Quoted 3 lines

I can think of only one way in which this handler is called for some other device interrupt, that is when this irq line is shared between peripherals. In that case if interrupt is not meant for kbd then kbd shouldn't clear it.

You would be clearing IRQ condition _in your device_ so that sould not affect the other device in any way.

Quoted 1 line

Isn't it fine???

I guess it should be OK.

Quoted 91 lines
Quoted 11 lines
Quoted 11 lines
drivers/input/keyboard/Kconfig +10 -0
+             return IRQ_NONE;
+
+     /* clear interrupt */
+     writeb(0, dev->io_base + STATUS_REG);
+
+     return IRQ_HANDLED;
+}
+
+static int __init spear_kbd_probe(struct platform_device *pdev)
+{

[snip...]

Quoted 11 lines

drivers/input/keyboard/Kconfig

Quoted 7 lines
drivers/input/keyboard/Kconfig +7 -0
+     ret = request_irq(irq, spear_kbd_interrupt, 0, "keyboard",
+                     kbd);
+     if (ret) {
+             dev_err(&pdev->dev, "request_irq fail\n");
+             goto err_iounmap;
+     }
+

Are you 100% sure the device is shut off at this point? Because if it isn't you risk to get interrupt before you allocated your input device.

I will check and place it at correct place.

Quoted 7 lines

drivers/input/keyboard/Kconfig

Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+
+     /* start key scan */
+     val |= START_SCAN;
+     writew(val, kbd->io_base + MODE_REG);

This should go into open() method.

OK.

Quoted 4 lines
Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+static int spear_kbd_remove(struct platform_device *pdev)
+{
+     struct spear_kbd *kbd = platform_get_drvdata(pdev);
+     struct resource *res;
Quoted 9 lines

drivers/input/keyboard/Kconfig

Quoted 6 lines
drivers/input/keyboard/Kconfig +6 -0
+     u16 val;
+     int irq;
+
+     val = readw(kbd->io_base + MODE_REG);
+     val &= ~START_SCAN;
+     writew(val, kbd->io_base + MODE_REG);

Need to go into close() method.

OK.

Quoted 7 lines

drivers/input/keyboard/Kconfig

Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+
+     /* unregister input device */
+     input_unregister_device(kbd->input);
+     input_free_device(kbd->input);

No free after unregister.

OK.

Quoted 7 lines

drivers/input/keyboard/Kconfig

Quoted 4 lines
drivers/input/keyboard/Kconfig +4 -0
+
+     irq = platform_get_irq(pdev, 0);
+     if (irq)
+             free_irq(irq, pdev);

Can it ever be 0 here?

No. Will correct.

Quoted 9 lines

drivers/input/keyboard/Kconfig

Quoted 6 lines
drivers/input/keyboard/Kconfig +6 -0
+
+static struct platform_driver spear_kbd_driver = {
+     .probe          = spear_kbd_probe,
+     .remove         = spear_kbd_remove,
+     .suspend        = spear_kbd_suspend,
+     .resume         = spear_kbd_resume,

Switch to dev_pm_ops please.

Ok.

Thanks,
rajeev.

Signature · 1 line
Dmitry
#75 lore raw

PATCH 21/74 ST SPEAr : Added keyboard support

Quoted 3 lines · Dmitry Torokhov
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

+#define DECLARE_KEYMAP(name) \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +2 -0
+int name[] = {\
+     KEY(0, 0, KEY_ESC), \

[snip...]

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

arch/arm/plat-spear/include/plat/keyboard.h line 122

Quoted 4 lines
arch/arm/plat-spear/include/plat/keyboard.h new file +4 -0
+     KEY(8, 6, KEY_KP2), \
+     KEY(8, 7, KEY_KP3), \
+     KEY(8, 8, KEY_KP0), \
+};

Hm, I'd expect this to be in particular board code, not in the header file.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Currently we have support for evaluation boards only and all of them will have this structure in their board source files. In order to remove redundant code we kept it in plat/keyboard.h.

So call it "spear_default_keymap" and put it right into the driver? And then allow platform code override it.

Renaming is fine but I would still like to keep spear_default_keymap in platform files instead of driver.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines

drivers/input/keyboard/spear-keyboard.c line 60

Quoted 5 lines
drivers/input/keyboard/spear-keyboard.c new file +5 -0
+struct spear_kbd {
+     struct input_dev *input;
+     void __iomem *io_base;          /* Keyboard Base Address */
+     struct clk *clk;
+     int *keymap;

You need a copy of keymap here so that userspace can modify it safely via EVIOCSKEYCODE.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

We have one copy of struct spear_kbd per device structure. I think it will be fine if we change this structure only. And so don't need to copy another structure in driver.

Normally such platform data should be declared as 'const' and drivers should not modify such data. Also unbinding device from driver and rebinding later should restore the device into pristine state. Having a copy of keymap in spear_kbd allows to achieve such behavior.

OK.

viresh.

#76 lore raw

PATCH 22/74 ST SPEAr: Added ARM PL061 GPIO Support on SPEAr13xx and modified resource size

In reply to Viresh KUMAR
---
 arch/arm/mach-spear13xx/include/mach/generic.h |    1 +
 arch/arm/mach-spear13xx/include/mach/gpio.h    |   18 +++++++++++
 arch/arm/mach-spear13xx/include/mach/irqs.h    |   10 ++++++-
 arch/arm/mach-spear13xx/include/mach/spear.h   |    4 +-
 arch/arm/mach-spear13xx/spear1300_evb.c        |    2 +
 arch/arm/mach-spear13xx/spear13xx.c            |   37 ++++++++++++++++++++++++
 arch/arm/mach-spear3xx/spear300.c              |    2 +-
 arch/arm/mach-spear3xx/spear3xx.c              |    2 +-
 arch/arm/mach-spear6xx/spear6xx.c              |    9 ++----
 9 files changed, 74 insertions(+), 11 deletions(-)
arch/arm/mach-spear13xx/include/mach/generic.h +1 -0
index 19c5de0..5b974f4 100644
@@ -29,6 +29,7 @@
 #define SPEAR_GPT0_CHAN1_IRQ	IRQ_GPT0_TMR1
 
 /* Add spear13xx family device structure declarations here */
+extern struct amba_device gpio_device[];
 extern struct amba_device uart_device;
 extern struct platform_device ehci0_device;
 extern struct platform_device ehci1_device;
arch/arm/mach-spear13xx/include/mach/gpio.h +18 -0
index 43fa541..2f8ad23 100644
@@ -16,4 +16,22 @@
 
 #include <plat/gpio.h>
 
+#define GPIO0_0			0
+#define GPIO0_1			1
+#define GPIO0_2			2
+#define GPIO0_3			3
+#define GPIO0_4			4
+#define GPIO0_5			5
+#define GPIO0_6			6
+#define GPIO0_7			7
+
+#define GPIO1_0			8
+#define GPIO1_1			9
+#define GPIO1_2			10
+#define GPIO1_3			11
+#define GPIO1_4			12
+#define GPIO1_5			13
+#define GPIO1_6			14
+#define GPIO1_7			15
+
 #endif /* __MACH_GPIO_H */
arch/arm/mach-spear13xx/include/mach/irqs.h +9 -1
index fd90236..562d20f 100644
@@ -86,6 +86,14 @@
 
 #define IRQ_GIC_END		(IRQ_SHPI_START + 128)
 
-#define NR_IRQS			IRQ_GIC_END
+#define VIRQ_START		IRQ_GIC_END
+
+/* GPIO pins virtual irqs */
+#define SPEAR_GPIO0_INT_BASE	(VIRQ_START + 0)
+#define SPEAR_GPIO1_INT_BASE	(SPEAR_GPIO0_INT_BASE + 8)
+#define SPEAR_GPIO_INT_END	(SPEAR_GPIO1_INT_BASE + 8)
+
+#define VIRQ_END		SPEAR_GPIO_INT_END
+#define NR_IRQS			VIRQ_END
 
 #endif /* __MACH_IRQS_H */
arch/arm/mach-spear13xx/include/mach/spear.h +2 -2
index 0dcd131..716e215 100644
@@ -43,8 +43,8 @@
 #define SPEAR13XX_GPT2_BASE		0xE0480000
 #define SPEAR13XX_GPT3_BASE		0xE0500000
 #define SPEAR13XX_RTC_BASE		0xE0580000
-#define SPEAR13XX_GPIOA_BASE		0xE0600000
-#define SPEAR13XX_GPIOB_BASE		0xE0680000
+#define SPEAR13XX_GPIO0_BASE		0xE0600000
+#define SPEAR13XX_GPIO1_BASE		0xE0680000
 #define SPEAR13XX_MISC_BASE		0xE0700000
 #define VA_SPEAR13XX_MISC_BASE		IO_ADDRESS(SPEAR13XX_MISC_BASE)
 
arch/arm/mach-spear13xx/spear1300_evb.c +2 -0
index 0cdad7a..a518620 100644
@@ -19,6 +19,8 @@
 #include <plat/keyboard.h>
 
 static struct amba_device *amba_devs[] __initdata = {
+	&gpio_device[0],
+	&gpio_device[1],
 	&uart_device,
 };
 
arch/arm/mach-spear13xx/spear13xx.c +37 -0
index 342fcd9..c86e7b9 100644
@@ -12,6 +12,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/amba/pl061.h>
 #include <linux/ptrace.h>
 #include <linux/io.h>
 #include <asm/hardware/gic.h>
@@ -24,6 +25,42 @@
 #include <mach/hardware.h>
 
 /* Add spear13xx machines common devices here */
+/* gpio device registeration */
+static struct pl061_platform_data gpio_plat_data[] = {
+	{
+		.gpio_base	= 0,
+		.irq_base	= SPEAR_GPIO0_INT_BASE,
+	}, {
+		.gpio_base	= 8,
+		.irq_base	= SPEAR_GPIO1_INT_BASE,
+	},
+};
+
+struct amba_device gpio_device[] = {
+	{
+		.dev = {
+			.init_name = "gpio0",
+			.platform_data = &gpio_plat_data[0],
+		},
+		.res = {
+			.start = SPEAR13XX_GPIO0_BASE,
+			.end = SPEAR13XX_GPIO0_BASE + SZ_4K - 1,
+			.flags = IORESOURCE_MEM,
+		},
+		.irq = {IRQ_GPIO0, NO_IRQ},
+	}, {
+		.dev = {
+			.init_name = "gpio1",
+			.platform_data = &gpio_plat_data[1],
+		},
+		.res = {
+			.start = SPEAR13XX_GPIO1_BASE,
+			.end = SPEAR13XX_GPIO1_BASE + SZ_4K - 1,
+			.flags = IORESOURCE_MEM,
+		},
+		.irq = {IRQ_GPIO1, NO_IRQ},
+	}
+};
 
 /* uart device registeration */
 struct amba_device uart_device = {
arch/arm/mach-spear3xx/spear300.c +1 -1
index fa314e9..cf010cc 100644
@@ -401,7 +401,7 @@ struct amba_device gpio1_device = {
 	},
 	.res = {
 		.start = SPEAR300_GPIO_BASE,
-		.end = SPEAR300_GPIO_BASE + SPEAR300_GPIO_SIZE - 1,
+		.end = SPEAR300_GPIO_BASE + SZ_4K - 1,
 		.flags = IORESOURCE_MEM,
 	},
 	.irq = {VIRQ_GPIO1, NO_IRQ},
arch/arm/mach-spear3xx/spear3xx.c +1 -1
index 780d83e..eb64087 100644
@@ -35,7 +35,7 @@ struct amba_device gpio_device = {
 	},
 	.res = {
 		.start = SPEAR3XX_ICM3_GPIO_BASE,
-		.end = SPEAR3XX_ICM3_GPIO_BASE + SPEAR3XX_ICM3_GPIO_SIZE - 1,
+		.end = SPEAR3XX_ICM3_GPIO_BASE + SZ_4K - 1,
 		.flags = IORESOURCE_MEM,
 	},
 	.irq = {IRQ_BASIC_GPIO, NO_IRQ},
arch/arm/mach-spear6xx/spear6xx.c +3 -6
index 5a5195b..9a357a1 100644
@@ -89,8 +89,7 @@ struct amba_device gpio_device[] = {
 		},
 		.res = {
 			.start = SPEAR6XX_CPU_GPIO_BASE,
-			.end = SPEAR6XX_CPU_GPIO_BASE +
-				SPEAR6XX_CPU_GPIO_SIZE - 1,
+			.end = SPEAR6XX_CPU_GPIO_BASE + SZ_4K - 1,
 			.flags = IORESOURCE_MEM,
 		},
 		.irq = {IRQ_LOCAL_GPIO, NO_IRQ},
@@ -101,8 +100,7 @@ struct amba_device gpio_device[] = {
 		},
 		.res = {
 			.start = SPEAR6XX_ICM3_GPIO_BASE,
-			.end = SPEAR6XX_ICM3_GPIO_BASE +
-				SPEAR6XX_ICM3_GPIO_SIZE - 1,
+			.end = SPEAR6XX_ICM3_GPIO_BASE + SZ_4K - 1,
 			.flags = IORESOURCE_MEM,
 		},
 		.irq = {IRQ_BASIC_GPIO, NO_IRQ},
@@ -113,8 +111,7 @@ struct amba_device gpio_device[] = {
 		},
 		.res = {
 			.start = SPEAR6XX_ICM2_GPIO_BASE,
-			.end = SPEAR6XX_ICM2_GPIO_BASE +
-				SPEAR6XX_ICM2_GPIO_SIZE - 1,
+			.end = SPEAR6XX_ICM2_GPIO_BASE + SZ_4K - 1,
 			.flags = IORESOURCE_MEM,
 		},
 		.irq = {IRQ_APPL_GPIO, NO_IRQ},
Signature · 1 line
1.7.2.2
#77 lore raw

PATCH 23/74 ST SPEAr: Adding support for ST's PWM IP

In reply to Viresh KUMAR
---
 arch/arm/mach-spear3xx/clock.c                |   32 ++-
 arch/arm/mach-spear3xx/include/mach/generic.h |    1 +
 arch/arm/mach-spear3xx/spear320.c             |   17 +
 arch/arm/mach-spear3xx/spear320_evb.c         |    1 +
 arch/arm/plat-spear/Kconfig                   |    7 +
 arch/arm/plat-spear/Makefile                  |    1 +
 arch/arm/plat-spear/pwm.c                     |  484 +++++++++++++++++++++++++
 7 files changed, 539 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/plat-spear/pwm.c
arch/arm/mach-spear3xx/clock.c +28 -4
index 3a26622..39835e8 100644
@@ -461,6 +461,23 @@ static struct clk gpio_clk = {
 
 static struct clk dummy_apb_pclk;
 
+/* spear300 machine specific clock structures */
+#ifdef CONFIG_MACH_SPEAR300
+/* keyboard clock */
+static struct clk kbd_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &apb_clk,
+	.recalc = &follow_parent,
+};
+
+#endif
+
+/* spear310 machine specific clock structures */
+#ifdef CONFIG_MACH_SPEAR310
+
+#endif
+
+/* spear320 machine specific clock structures */
 #ifdef CONFIG_MACH_SPEAR320
 /* i2c1 clock */
 static struct clk i2c1_clk = {
@@ -468,11 +485,9 @@ static struct clk i2c1_clk = {
 	.pclk = &ahb_clk,
 	.recalc = &follow_parent,
 };
-#endif
 
-#ifdef CONFIG_MACH_SPEAR300
-/* keyboard clock */
-static struct clk kbd_clk = {
+/* pwm clock */
+static struct clk pwm_clk = {
 	.flags = ALWAYS_ENABLED,
 	.pclk = &apb_clk,
 	.recalc = &follow_parent,
@@ -520,11 +535,20 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "adc",		.clk = &adc_clk},
 	{ .dev_id = "ssp",		.clk = &ssp_clk},
 	{ .dev_id = "gpio",		.clk = &gpio_clk},
+
+	/* spear300 machine specific clock structures */
 #ifdef CONFIG_MACH_SPEAR300
 	{ .dev_id = "keyboard",		.clk = &kbd_clk},
 #endif
+
+	/* spear310 machine specific clock structures */
+#ifdef CONFIG_MACH_SPEAR310
+
+#endif
+	/* spear320 machine specific clock structures */
 #ifdef CONFIG_MACH_SPEAR320
 	{ .dev_id = "i2c_designware.1",	.clk = &i2c1_clk},
+	{ .dev_id = "pwm",		.clk = &pwm_clk},
 #endif
 };
 
arch/arm/mach-spear3xx/include/mach/generic.h +1 -0
index 70f7ee2..447de7e 100644
@@ -174,6 +174,7 @@ void __init spear310_init(void);
 extern struct amba_device clcd_device;
 extern struct platform_device i2c1_device;
 extern struct platform_device plgpio_device;
+extern struct platform_device pwm_device;
 
 /* pad mux modes */
 extern struct pmx_mode auto_net_smii_mode;
arch/arm/mach-spear3xx/spear320.c +17 -0
index bfb21ae..75e7890 100644
@@ -452,6 +452,23 @@ struct platform_device plgpio_device = {
 	.resource = plgpio_resources,
 };
 
+/* pwm device registeration */
+static struct resource pwm_resources[] = {
+	{
+		.start = SPEAR320_PWM_BASE,
+		.end = SPEAR320_PWM_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	},
+};
+
+struct platform_device pwm_device = {
+	.name = "pwm",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(pwm_resources),
+	.resource = pwm_resources,
+};
+
+
 /* spear3xx shared irq */
 struct shirq_dev_config shirq_ras1_config[] = {
 	{
arch/arm/mach-spear3xx/spear320_evb.c +1 -0
index f90a9b8..943eddc 100644
@@ -57,6 +57,7 @@ static struct platform_device *plat_devs[] __initdata = {
 	/* spear320 specific devices */
 	&i2c1_device,
 	&plgpio_device,
+	&pwm_device,
 };
 
 static void __init spear320_evb_init(void)
arch/arm/plat-spear/Kconfig +7 -0
index 29a25d2..80f402b 100644
@@ -36,4 +36,11 @@ source "arch/arm/mach-spear13xx/Kconfig"
 source "arch/arm/mach-spear3xx/Kconfig"
 source "arch/arm/mach-spear6xx/Kconfig"
 
+config SPEAR_PWM
+	tristate "SPEAr Pulse Width Modulator"
+	depends on MACH_SPEAR320
+	default y
+	help
+	  Support for ST Microelectronics Pulse Width Modulator present on SPEAr Platform.
+
 endif
arch/arm/plat-spear/Makefile +1 -0
index c31892a..0e29587 100644
@@ -8,6 +8,7 @@ obj-y	:= clcd.o clock.o time.o
 obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o padmux.o
 obj-$(CONFIG_MACH_SPEAR310)	+= plgpio.o
 obj-$(CONFIG_MACH_SPEAR320)	+= plgpio.o
+obj-$(CONFIG_SPEAR_PWM)		+= pwm.o
 
 obj-$(CONFIG_BOARD_SPEAR1300_EVB)	+= i2c_eval_board.o
 obj-$(CONFIG_BOARD_SPEAR300_EVB)	+= i2c_eval_board.o
arch/arm/plat-spear/pwm.c new file +484 -0

484 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#78 lore raw

PATCH 24/74 ST SPEAr: Add smi driver for serial NOR flash

In reply to Viresh KUMAR

From: Shiraz Hashim <[email protected]>

SPEAr platforms(spear3xx/spear6xx/spear13xx) provide SMI(Serial Memory Interface) controller to access serial NOR flash. SMI provides a simple interface for SPI/serial NOR flashes and has certain inbuilt commands and features to support these flashes easily. It also makes it possible to map an address range in order to directly access (read/write) the SNOR over address bus. This patch intends to provide serial nor driver support for spear platforms which are accessed through SMI.

---
 arch/arm/plat-spear/include/plat/smi.h |   68 ++
 drivers/mtd/devices/Kconfig            |    7 +
 drivers/mtd/devices/Makefile           |    1 +
 drivers/mtd/devices/spear_smi.c        | 1122 ++++++++++++++++++++++++++++++++
 4 files changed, 1198 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-spear/include/plat/smi.h
 create mode 100644 drivers/mtd/devices/spear_smi.c
arch/arm/plat-spear/include/plat/smi.h new file +68 -0
new file mode 100644
index 0000000..4c74df7
@@ -0,0 +1,68 @@
+/*
+ * arch/arm/plat-spear/include/plat/smi.h
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Shiraz Hashim <[email protected]>
+ *
+ * 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 __PLAT_SMI_H
+#define __PLAT_SMI_H
+
+#include <linux/types.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/platform_device.h>
+
+/* macro to define partitions for flash devices */
+#define DEFINE_PARTS(n, of, s)		\
+{					\
+	.name = n,			\
+	.offset = of,			\
+	.size = s,			\
+}
+
+/**
+ * struct spear_smi_flash_info - platform structure for passing flash
+ * information
+ *
+ * name: name of the serial nor flash for identification
+ * mem_base: the memory base on which the flash is mapped
+ * size: size of the flash in bytes
+ * num_parts: number of partitions
+ * parts: parition details
+ * fast_mode: whether flash supports fast mode
+ */
+
+struct spear_smi_flash_info {
+	char *name;
+	unsigned long mem_base;
+	unsigned long size;
+	int num_parts;
+	struct mtd_partition *parts;
+	u8 fast_mode;
+};
+
+/**
+ * struct spear_smi_plat_data - platform structure for configuring smi
+ *
+ * clk_rate: clk rate at which SMI must operate
+ * num_flashes: number of flashes present on board
+ * board_flash_info: specific details of each flash present on board
+ */
+struct spear_smi_plat_data {
+	unsigned long clk_rate;
+	int num_flashes;
+	struct spear_smi_flash_info *board_flash_info;
+};
+
+static inline void smi_set_plat_data(struct platform_device *pdev,
+		struct spear_smi_plat_data *pdata)
+{
+	pdev->dev.platform_data = pdata;
+}
+
+#endif /* __PLAT_SMI_H */
drivers/mtd/devices/Kconfig +7 -0
index 35081ce..83daf23 100644
@@ -102,6 +102,13 @@ config M25PXX_USE_FAST_READ
 	help
 	  This option enables FAST_READ access supported by ST M25Pxx.
 
+config MTD_SPEAR_SMI
+	tristate "SPEAR MTD NOR Support through SMI controller"
+	depends on PLAT_SPEAR
+	default y
+	help
+	  This enable SNOR support on SPEAR platforms using SMI controller
+
 config MTD_SST25L
 	tristate "Support SST25L (non JEDEC) SPI Flash chips"
 	depends on SPI_MASTER
drivers/mtd/devices/Makefile +1 -0
index f3226b1..6e9063b 100644
@@ -16,4 +16,5 @@ obj-$(CONFIG_MTD_LART)		+= lart.o
 obj-$(CONFIG_MTD_BLOCK2MTD)	+= block2mtd.o
 obj-$(CONFIG_MTD_DATAFLASH)	+= mtd_dataflash.o
 obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
+obj-$(CONFIG_MTD_SPEAR_SMI)	+= spear_smi.o
 obj-$(CONFIG_MTD_SST25L)	+= sst25l.o
drivers/mtd/devices/spear_smi.c new file +1122 -0

1,122 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#79 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

From: Vipin Kumar <[email protected]>

SPEAr platforms use Flexible Static Memory Controller(FSMC) provided by ST for interfacing with NAND devices.
This patch adds the support for glue logic for NAND flash on SPEAr boards

---
 arch/arm/mach-spear13xx/clock.c                  |    2 +-
 arch/arm/mach-spear13xx/include/mach/generic.h   |    2 +
 arch/arm/mach-spear13xx/include/mach/misc_regs.h |   10 +
 arch/arm/mach-spear13xx/spear1300_evb.c          |    8 +
 arch/arm/mach-spear13xx/spear13xx.c              |   58 ++
 arch/arm/mach-spear3xx/clock.c                   |   14 +
 arch/arm/mach-spear3xx/include/mach/generic.h    |   15 +-
 arch/arm/mach-spear3xx/include/mach/spear320.h   |    3 +
 arch/arm/mach-spear3xx/spear300.c                |   98 +++
 arch/arm/mach-spear3xx/spear300_evb.c            |    7 +
 arch/arm/mach-spear3xx/spear310.c                |   26 +
 arch/arm/mach-spear3xx/spear310_evb.c            |    7 +
 arch/arm/mach-spear3xx/spear320.c                |   26 +
 arch/arm/mach-spear3xx/spear320_evb.c            |    7 +
 arch/arm/mach-spear6xx/clock.c                   |    2 +-
 arch/arm/mach-spear6xx/include/mach/generic.h    |    1 +
 arch/arm/mach-spear6xx/spear600_evb.c            |    7 +
 arch/arm/mach-spear6xx/spear6xx.c                |   26 +
 arch/arm/plat-spear/include/plat/fsmc.h          |  109 +++
 arch/arm/plat-spear/include/plat/nand.h          |   76 ++
 drivers/mtd/nand/Kconfig                         |    6 +
 drivers/mtd/nand/Makefile                        |    1 +
 drivers/mtd/nand/spear_nand.c                    |  860 ++++++++++++++++++++++
 23 files changed, 1363 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/plat-spear/include/plat/fsmc.h
 create mode 100644 arch/arm/plat-spear/include/plat/nand.h
 create mode 100644 drivers/mtd/nand/spear_nand.c
arch/arm/mach-spear13xx/clock.c +1 -1
index 5280657..8658d48 100644
@@ -791,7 +791,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{.dev_id = "pcie2",		.clk = &pcie2_clk},
 	{.dev_id = "cfxd",		.clk = &cfxd_clk},
 	{.dev_id = "sd",		.clk = &sd_clk},
-	{.dev_id = "fsmc",		.clk = &fsmc_clk},
+	{.con_id = "fsmc",		.clk = &fsmc_clk},
 	{.dev_id = "sysram0",		.clk = &sysram0_clk},
 	{.dev_id = "sysram1",		.clk = &sysram1_clk},
 
arch/arm/mach-spear13xx/include/mach/generic.h +2 -0
index 186a8be..b884359 100644
@@ -35,6 +35,7 @@ extern struct platform_device ehci0_device;
 extern struct platform_device ehci1_device;
 extern struct platform_device i2c_device;
 extern struct platform_device kbd_device;
+extern struct platform_device nand_device;
 extern struct platform_device ohci0_device;
 extern struct platform_device ohci1_device;
 extern struct platform_device rtc_device;
@@ -51,6 +52,7 @@ void __init spear1300_init(void);
 void __init spear13xx_map_io(void);
 void __init spear13xx_init_irq(void);
 void __init spear13xx_init(void);
+void __init nand_mach_init(u32 busw);
 void spear13xx_secondary_startup(void);
 
 #endif /* __MACH_GENERIC_H */
arch/arm/mach-spear13xx/include/mach/misc_regs.h +10 -0
index c4dcab2..05815fa 100644
@@ -205,6 +205,16 @@
 #define PCIE_MIPHY_CFG		((unsigned int *)(MISC_BASE + 0x328))
 #define PERIP_CFG		((unsigned int *)(MISC_BASE + 0x32c))
 #define FSMC_CFG		((unsigned int *)(MISC_BASE + 0x330))
+	/* FSMC_CFG register masks */
+	#define FSMC_MEMSEL_MASK	0x3
+	#define FSMC_MEMSEL_SHIFT	0
+	#define FSMC_MEM_NOR		0
+	#define FSMC_MEM_NAND		1
+	#define FSMC_MEM_SRAM		2
+	#define NAND_BANK_MASK		0x3
+	#define NAND_BANK_SHIFT		2
+	#define NAND_DEV_WIDTH16	4
+
 #define MPMC_CTR_STS		((unsigned int *)(MISC_BASE + 0x334))
 
 /* Inter-Processor Communication Registers */
arch/arm/mach-spear13xx/spear1300_evb.c +8 -0
index 5b74f05..4267b46 100644
@@ -12,11 +12,13 @@
  */
 
 #include <linux/types.h>
+#include <linux/mtd/nand.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
 #include <plat/keyboard.h>
+#include <plat/nand.h>
 #include <plat/smi.h>
 
 static struct amba_device *amba_devs[] __initdata = {
@@ -30,6 +32,7 @@ static struct platform_device *plat_devs[] __initdata = {
 	&ehci1_device,
 	&i2c_device,
 	&kbd_device,
+	&nand_device,
 	&ohci0_device,
 	&ohci1_device,
 	&rtc_device,
@@ -52,6 +55,11 @@ static void __init spear1300_evb_init(void)
 	/* set keyboard plat data */
 	kbd_set_plat_data(&kbd_device, &kbd_data);
 
+	/* set nand device's plat data */
+	nand_set_plat_data(&nand_device, NULL, 0, NAND_SKIP_BBTSCAN,
+			SPEAR_NAND_BW8);
+	nand_mach_init(SPEAR_NAND_BW8);
+
 	/* call spear1300 machine init function */
 	spear1300_init();
 
arch/arm/mach-spear13xx/spear13xx.c +58 -0

70 lines not on this page · raw message

arch/arm/mach-spear3xx/clock.c +14 -0
index 39835e8..93c5fd9 100644
@@ -461,6 +461,16 @@ static struct clk gpio_clk = {
 
 static struct clk dummy_apb_pclk;
 
+#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR310) || \
+	defined(CONFIG_MACH_SPEAR320)
+/* fsmc clock */
+static struct clk fsmc_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &ahb_clk,
+	.recalc = &follow_parent,
+};
+#endif
+
 /* spear300 machine specific clock structures */
 #ifdef CONFIG_MACH_SPEAR300
 /* keyboard clock */
@@ -535,6 +545,10 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "adc",		.clk = &adc_clk},
 	{ .dev_id = "ssp",		.clk = &ssp_clk},
 	{ .dev_id = "gpio",		.clk = &gpio_clk},
+#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR310) || \
+	defined(CONFIG_MACH_SPEAR320)
+	{ .con_id = "fsmc",		.clk = &fsmc_clk},
+#endif
 
 	/* spear300 machine specific clock structures */
 #ifdef CONFIG_MACH_SPEAR300
arch/arm/mach-spear3xx/include/mach/generic.h +9 -6
index 91c0c09..6aac229 100644
@@ -111,6 +111,10 @@ extern struct pmx_driver pmx_driver;
 extern struct amba_device clcd_device;
 extern struct amba_device gpio1_device;
 extern struct platform_device kbd_device;
+extern struct platform_device nand0_device;
+extern struct platform_device nand1_device;
+extern struct platform_device nand2_device;
+extern struct platform_device nand3_device;
 
 /* pad mux modes */
 extern struct pmx_mode nand_mode;
@@ -148,12 +152,12 @@ void __init spear300_init(void);
 
 /* Add misc structure declarations here */
 extern struct clcd_board clcd_plat_data;
-#endif /* CONFIG_MACH_SPEAR300 */
 
 /* spear310 declarations */
-#ifdef CONFIG_MACH_SPEAR310
+#elif defined(CONFIG_MACH_SPEAR310)
 /* Add spear310 machine device structure declarations here */
 extern struct platform_device plgpio_device;
+extern struct platform_device nand_device;
 
 /* pad mux devices */
 extern struct pmx_dev pmx_emi_cs_0_1_4_5;
@@ -168,13 +172,12 @@ extern struct pmx_dev pmx_tdm0;
 /* Add spear310 machine function declarations here */
 void __init spear310_init(void);
 
-#endif /* CONFIG_MACH_SPEAR310 */
-
 /* spear320 declarations */
-#ifdef CONFIG_MACH_SPEAR320
+#elif defined(CONFIG_MACH_SPEAR320)
 /* Add spear320 machine device structure declarations here */
 extern struct amba_device clcd_device;
 extern struct platform_device i2c1_device;
+extern struct platform_device nand_device;
 extern struct platform_device plgpio_device;
 extern struct platform_device pwm_device;
 
@@ -213,6 +216,6 @@ void __init spear320_init(void);
 
 /* Add misc structure declarations here */
 extern struct clcd_board clcd_plat_data;
-#endif /* CONFIG_MACH_SPEAR320 */
+#endif
 
 #endif /* __MACH_GENERIC_H */
arch/arm/mach-spear3xx/include/mach/spear320.h +3 -0
index 53677e4..aa6727c 100644
@@ -22,6 +22,9 @@
 #define SPEAR320_FSMC_BASE		0x4C000000
 #define SPEAR320_FSMC_SIZE		0x01000000
 
+#define SPEAR320_NAND_BASE		0x50000000
+#define SPEAR320_NAND_SIZE		0x04000000
+
 #define SPEAR320_I2S_BASE		0x60000000
 #define SPEAR320_I2S_SIZE		0x10000000
 
arch/arm/mach-spear3xx/spear300.c +98 -0

110 lines not on this page · raw message

arch/arm/mach-spear3xx/spear300_evb.c +7 -0
index 7bd8963..895f7b7 100644
@@ -11,11 +11,13 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/mtd/nand.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
 #include <plat/keyboard.h>
+#include <plat/nand.h>
 #include <plat/smi.h>
 
 /* padmux devices to enable */
@@ -49,6 +51,7 @@ static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
 	&ehci_device,
 	&i2c_device,
+	&nand0_device,
 	&ohci0_device,
 	&ohci1_device,
 	&rtc_device,
@@ -79,6 +82,10 @@ static void __init spear300_evb_init(void)
 	/* set keyboard plat data */
 	kbd_set_plat_data(&kbd_device, &kbd_data);
 
+	/* set nand0 device's plat data */
+	nand_set_plat_data(&nand0_device, NULL, 0, NAND_SKIP_BBTSCAN,
+			SPEAR_NAND_BW8);
+
 	/* call spear300 machine init function */
 	spear300_init();
 
arch/arm/mach-spear3xx/spear310.c +26 -0
index 88b55b5..69350b7 100644
@@ -16,6 +16,7 @@
 #include <mach/generic.h>
 #include <mach/spear.h>
 #include <plat/gpio.h>
+#include <plat/nand.h>
 #include <plat/shirq.h>
 
 /* pad multiplexing support */
@@ -177,6 +178,31 @@ int spear300_o2p(int offset)
 		return offset + 2;
 }
 
+/* nand device registeration */
+static struct nand_platform_data nand_platform_data;
+
+static struct resource nand_resources[] = {
+	{
+		.name = "nand_data",
+		.start = SPEAR310_NAND_BASE,
+		.end = SPEAR310_NAND_BASE + SZ_16 - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.name = "fsmc_regs",
+		.start = SPEAR310_FSMC_BASE,
+		.end = SPEAR310_FSMC_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	},
+};
+
+struct platform_device nand_device = {
+	.name = "nand",
+	.id = -1,
+	.resource = nand_resources,
+	.num_resources = ARRAY_SIZE(nand_resources),
+	.dev.platform_data = &nand_platform_data,
+};
+
 static struct plgpio_platform_data plgpio_plat_data = {
 	.gpio_base = 8,
 	.irq_base = SPEAR_PLGPIO_INT_BASE,
arch/arm/mach-spear3xx/spear310_evb.c +7 -0
index cd076c9..8f17362 100644
@@ -11,10 +11,12 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/mtd/nand.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
+#include <plat/nand.h>
 #include <plat/smi.h>
 
 /* padmux devices to enable */
@@ -54,6 +56,7 @@ static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
 	&ehci_device,
 	&i2c_device,
+	&nand_device,
 	&ohci0_device,
 	&ohci1_device,
 	&rtc_device,
@@ -72,6 +75,10 @@ static void __init spear310_evb_init(void)
 	pmx_driver.devs = pmx_devs;
 	pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
 
+	/* set nand device's plat data */
+	nand_set_plat_data(&nand_device, NULL, 0, NAND_SKIP_BBTSCAN,
+			SPEAR_NAND_BW8);
+
 	/* call spear310 machine init function */
 	spear310_init();
 
arch/arm/mach-spear3xx/spear320.c +26 -0
index 75e7890..2ac838b 100644
@@ -16,6 +16,7 @@
 #include <mach/generic.h>
 #include <mach/spear.h>
 #include <plat/gpio.h>
+#include <plat/nand.h>
 #include <plat/shirq.h>
 
 /* pad multiplexing support */
@@ -431,6 +432,31 @@ struct platform_device i2c1_device = {
 	.resource = i2c1_resources,
 };
 
+/* nand device registeration */
+static struct nand_platform_data nand_platform_data;
+
+static struct resource nand_resources[] = {
+	{
+		.name = "nand_data",
+		.start = SPEAR320_NAND_BASE,
+		.end = SPEAR320_NAND_BASE + SZ_16 - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.name = "fsmc_regs",
+		.start = SPEAR320_FSMC_BASE,
+		.end = SPEAR320_FSMC_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	},
+};
+
+struct platform_device nand_device = {
+	.name = "nand",
+	.id = -1,
+	.resource = nand_resources,
+	.num_resources = ARRAY_SIZE(nand_resources),
+	.dev.platform_data = &nand_platform_data,
+};
+
 static struct resource plgpio_resources[] = {
 	{
 		.start = SPEAR320_SOC_CONFIG_BASE,
arch/arm/mach-spear3xx/spear320_evb.c +7 -0
index 7f7b5dd..d693877 100644
@@ -11,10 +11,12 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/mtd/nand.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
+#include <plat/nand.h>
 #include <plat/smi.h>
 
 /* padmux devices to enable */
@@ -52,6 +54,7 @@ static struct platform_device *plat_devs[] __initdata = {
 	/* spear3xx specific devices */
 	&ehci_device,
 	&i2c_device,
+	&nand_device,
 	&ohci0_device,
 	&ohci1_device,
 	&rtc_device,
@@ -72,6 +75,10 @@ static void __init spear320_evb_init(void)
 	pmx_driver.devs = pmx_devs;
 	pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
 
+	/* set nand device's plat data */
+	nand_set_plat_data(&nand_device, NULL, 0, NAND_SKIP_BBTSCAN,
+			SPEAR_NAND_BW8);
+
 	/* call spear320 machine init function */
 	spear320_init();
 
arch/arm/mach-spear6xx/clock.c +1 -1
index fb05ec8..91f1f3f 100644
@@ -602,7 +602,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	{ .dev_id = "jpeg",		.clk = &jpeg_clk},
 	{ .dev_id = "gmac",		.clk = &gmac_clk},
 	{ .dev_id = "smi",		.clk = &smi_clk},
-	{ .dev_id = "fsmc",		.clk = &fsmc_clk},
+	{ .con_id = "fsmc",		.clk = &fsmc_clk},
 	/* clock derived from apb clk */
 	{ .dev_id = "adc",		.clk = &adc_clk},
 	{ .dev_id = "ssp0",		.clk = &ssp0_clk},
arch/arm/mach-spear6xx/include/mach/generic.h +1 -0
index f885898..ff90419 100644
@@ -36,6 +36,7 @@ extern struct amba_device wdt_device;
 extern struct platform_device ehci0_device;
 extern struct platform_device ehci1_device;
 extern struct platform_device i2c_device;
+extern struct platform_device nand_device;
 extern struct platform_device ohci0_device;
 extern struct platform_device ohci1_device;
 extern struct platform_device rtc_device;
arch/arm/mach-spear6xx/spear600_evb.c +7 -0
index 0eb5f50..cf86efc 100644
@@ -11,10 +11,12 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/mtd/nand.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
+#include <plat/nand.h>
 #include <plat/smi.h>
 
 static struct amba_device *amba_devs[] __initdata = {
@@ -33,6 +35,7 @@ static struct platform_device *plat_devs[] __initdata = {
 	&i2c_device,
 	&ohci0_device,
 	&ohci1_device,
+	&nand_device,
 	&rtc_device,
 	&smi_device,
 };
@@ -41,6 +44,10 @@ static void __init spear600_evb_init(void)
 {
 	unsigned int i;
 
+	/* set nand device's plat data */
+	nand_set_plat_data(&nand_device, NULL, 0, NAND_SKIP_BBTSCAN,
+			SPEAR_NAND_BW8);
+
 	/* call spear600 machine init function */
 	spear600_init();
 
arch/arm/mach-spear6xx/spear6xx.c +26 -0
index 4987597..2296d0f 100644
@@ -21,6 +21,7 @@
 #include <mach/irqs.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
+#include <plat/nand.h>
 
 /* Add spear6xx machines common devices here */
 
@@ -152,6 +153,31 @@ struct platform_device i2c_device = {
 	.resource = i2c_resources,
 };
 
+/* nand device registeration */
+static struct nand_platform_data nand_platform_data;
+
+static struct resource nand_resources[] = {
+	{
+		.name = "nand_data",
+		.start = SPEAR6XX_ICM1_NAND_BASE,
+		.end = SPEAR6XX_ICM1_NAND_BASE + SZ_16 - 1,
+		.flags = IORESOURCE_MEM,
+	}, {
+		.name = "fsmc_regs",
+		.start = SPEAR6XX_ICM1_FSMC_BASE,
+		.end = SPEAR6XX_ICM1_FSMC_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	},
+};
+
+struct platform_device nand_device = {
+	.name = "nand",
+	.id = -1,
+	.resource = nand_resources,
+	.num_resources = ARRAY_SIZE(nand_resources),
+	.dev.platform_data = &nand_platform_data,
+};
+
 /* usb host device registeration */
 static struct resource ehci0_resources[] = {
 	[0] = {
arch/arm/plat-spear/include/plat/fsmc.h new file +109 -0

109 lines not on this page · raw message

arch/arm/plat-spear/include/plat/nand.h new file +76 -0

76 lines not on this page · raw message

drivers/mtd/nand/Kconfig +6 -0
index 8b4b67c..89d35d1 100644
@@ -531,4 +531,10 @@ config MTD_NAND_JZ4740
 	help
 		Enables support for NAND Flash on JZ4740 SoC based boards.
 
+config MTD_NAND_SPEAR
+	tristate "Support for NAND on SPEAr platforms"
+	depends on MTD_NAND && PLAT_SPEAR
+	help
+	  Enables support for NAND Flash chips wired onto SPEAr boards.
+
 endif # MTD_NAND
drivers/mtd/nand/Makefile +1 -0
index ac83dcd..d1749af 100644
@@ -40,6 +40,7 @@ obj-$(CONFIG_MTD_NAND_FSL_UPM)		+= fsl_upm.o
 obj-$(CONFIG_MTD_NAND_SH_FLCTL)		+= sh_flctl.o
 obj-$(CONFIG_MTD_NAND_MXC)		+= mxc_nand.o
 obj-$(CONFIG_MTD_NAND_SOCRATES)		+= socrates_nand.o
+obj-$(CONFIG_MTD_NAND_SPEAR)		+= spear_nand.o
 obj-$(CONFIG_MTD_NAND_TXX9NDFMC)	+= txx9ndfmc.o
 obj-$(CONFIG_MTD_NAND_NUC900)		+= nuc900_nand.o
 obj-$(CONFIG_MTD_NAND_NOMADIK)		+= nomadik_nand.o
drivers/mtd/nand/spear_nand.c new file +860 -0

860 lines not on this page · raw message

Signature · 1 line
1.7.2.2
#80 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

2010/8/30 Viresh KUMAR <[email protected]>:

Quoted 5 lines

From: Vipin Kumar <[email protected]>

SPEAr platforms use Flexible Static Memory Controller(FSMC) provided by ST for interfacing with NAND devices.
This patch adds the support for glue logic for NAND flash on SPEAr boards

OK...

Quoted 4 lines

(...)
?create mode 100644 arch/arm/plat-spear/include/plat/fsmc.h ?create mode 100644 arch/arm/plat-spear/include/plat/nand.h ?create mode 100644 drivers/mtd/nand/spear_nand.c

spear_nand.c?

Why not fsmc-nand.c or similar if this is the name of the block. We have this in U300, Nomadik NHK8815 and other platforms too, it doesn't have much to do with SPEAr actually...

Also, what are the include files doing in plat-spear since we have the same hardware in other platforms? Move them to include/linux/mtd/ so we can use them please.

I *highly* suspect that this driver duplicates some code found in drivers/mtd/nand/nomadik_nand.c because it's the same silicon.

Alessandro can judge on this, but I have a feeling that driver should be replaced by this, more mature driver.

arch/arm/plat-spear/include/plat/fsmc.h line 4

Quoted 11 lines

(...)

arch/arm/plat-spear/include/plat/fsmc.h new file +4 -0
new file mode 100644
index 0000000..c0fdcd3
@@ -0,0 +1,109 @@
+/*
+ * arch/arm/plat-spear/include/plat/fsmc.h
+ *
+ * SPEAr platform nand interface header file

Replace "SPEAr platform" for "FSMC - Flexible Static Media Controller"

arch/arm/plat-spear/include/plat/fsmc.h line 15

Quoted 11 lines
arch/arm/plat-spear/include/plat/fsmc.h new file +11 -0
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Vipin Kumar <[email protected]>
+ *
+ * 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 __PLAT_FSMC_H
+#define __PLAT_FSMC_H

Change these according to the new suggested placement.

Quoted 20 lines
arch/arm/plat-spear/include/plat/fsmc.h new file +20 -0
+
+#include <linux/delay.h>
+#include <linux/types.h>
+#include <asm/param.h>
+
+#define FSMC_MAX_NAND_BANKS ? ?4
+
+struct nand_bank_regs {
+ ? ? ? u32 pc;
+ ? ? ? u32 sts;
+ ? ? ? u32 comm;
+ ? ? ? u32 attrib;
+ ? ? ? u32 ioata;
+ ? ? ? u32 ecc1;
+ ? ? ? u32 ecc2;
+ ? ? ? u32 ecc3;
+};
+
+struct fsmc_regs {
+ ? ? ? u8 reserved_1[0x40];

arch/arm/plat-spear/include/plat/fsmc.h line 45

Quoted 10 lines
arch/arm/plat-spear/include/plat/fsmc.h new file +10 -0
+ ? ? ? struct nand_bank_regs bank_regs[FSMC_MAX_NAND_BANKS];
+ ? ? ? u8 reserved_2[0xfe0 - 0xc0];
+ ? ? ? u32 peripid0; ? ? ? ? ? ? ? ? ? /* 0xfe0 */
+ ? ? ? u32 peripid1; ? ? ? ? ? ? ? ? ? /* 0xfe4 */
+ ? ? ? u32 peripid2; ? ? ? ? ? ? ? ? ? /* 0xfe8 */
+ ? ? ? u32 peripid3; ? ? ? ? ? ? ? ? ? /* 0xfec */
+ ? ? ? u32 pcellid0; ? ? ? ? ? ? ? ? ? /* 0xff0 */
+ ? ? ? u32 pcellid1; ? ? ? ? ? ? ? ? ? /* 0xff4 */
+ ? ? ? u32 pcellid2; ? ? ? ? ? ? ? ? ? /* 0xff8 */
+ ? ? ? u32 pcellid3; ? ? ? ? ? ? ? ? ? /* 0xffc */

Do you need to have an u32 for each of these registers? I think this is the AMBA PrimeCell ID registers which means that the latter four are just "0xB105F00D" (clever) and then padded to 32 bits. (Correct me if I'm wrong.)

You can find macros for extracting the important parts of the field in include/linux/amba/bus.h

Quoted 33 lines
arch/arm/plat-spear/include/plat/fsmc.h new file +33 -0
+};
+
+#define FSMC_BUSY_WAIT_TIMEOUT (1 * HZ)
+
+/* pc register definitions */
+#define FSMC_RESET ? ? ? ? ? ? (1 << 0)
+#define FSMC_WAITON ? ? ? ? ? ?(1 << 1)
+#define FSMC_ENABLE ? ? ? ? ? ?(1 << 2)
+#define FSMC_DEVTYPE_NAND ? ? ?(1 << 3)
+#define FSMC_DEVWID_8 ? ? ? ? ?(0 << 4)
+#define FSMC_DEVWID_16 ? ? ? ? (1 << 4)
+#define FSMC_ECCEN ? ? ? ? ? ? (1 << 6)
+#define FSMC_ECCPLEN_512 ? ? ? (0 << 7)
+#define FSMC_ECCPLEN_256 ? ? ? (1 << 7)
+#define FSMC_TCLR_1 ? ? ? ? ? ?(1 << 9)
+#define FSMC_TAR_1 ? ? ? ? ? ? (1 << 13)
+
+/* sts register definitions */
+#define FSMC_CODE_RDY ? ? ? ? ?(1 << 15)
+
+/* comm register definitions */
+#define FSMC_TSET_0 ? ? ? ? ? ?(0 << 0)
+#define FSMC_TWAIT_6 ? ? ? ? ? (6 << 8)
+#define FSMC_THOLD_4 ? ? ? ? ? (4 << 16)
+#define FSMC_THIZ_1 ? ? ? ? ? ?(1 << 24)
+
+/* peripid2 register definitions */
+#define FSMC_REVISION_MSK ? ? ?(0xf)
+#define FSMC_REVISION_SHFT ? ? (0x4)
+
+#define FSMC_VER1 ? ? ? ? ? ? ?1
+#define FSMC_VER2 ? ? ? ? ? ? ?2
+#define FSMC_VER3 ? ? ? ? ? ? ?3

arch/arm/plat-spear/include/plat/fsmc.h line 88

Quoted 10 lines
arch/arm/plat-spear/include/plat/fsmc.h new file +10 -0
+#define FSMC_VER4 ? ? ? ? ? ? ?4
+#define FSMC_VER5 ? ? ? ? ? ? ?5
+#define FSMC_VER6 ? ? ? ? ? ? ?6
+#define FSMC_VER7 ? ? ? ? ? ? ?7
+#define FSMC_VER8 ? ? ? ? ? ? ?8
+
+static inline u32 get_fsmc_version(struct fsmc_regs *regs)
+{
+ ? ? ? return (readl(&regs->peripid2) >> FSMC_REVISION_SHFT) &
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? FSMC_REVISION_MSK;

Use macros from <linux/amba/bus.h> to extract version if possible.

Quoted 27 lines
arch/arm/plat-spear/include/plat/fsmc.h new file +21 -0
+}
+
+/*
+ * There are 13 bytes of ecc for every 512 byte block in FSMC version 8
+ * and it has to be read consecutively and immediately after the 512
+ * byte data block for hardware to generate the error bit offsets
+ * Managing the ecc bytes in the following way is easier. This way is
+ * similar to oobfree structure maintained already in u-boot nand driver
+ */
+#define MAX_ECCPLACE_ENTRIES ? 32
+
+struct fsmc_nand_eccplace {
+ ? ? ? u8 offset;
+ ? ? ? u8 length;
+};
+
+struct fsmc_eccplace {
+ ? ? ? struct fsmc_nand_eccplace eccplace[MAX_ECCPLACE_ENTRIES];
+};
+
+#endif /* __PLAT_FSMC_H */
arch/arm/plat-spear/include/plat/nand.h new file +0 -0
new file mode 100644
index 0000000..712b4b0

arch/arm/plat-spear/include/plat/nand.h line 5

Quoted 5 lines
arch/arm/plat-spear/include/plat/nand.h new file +5 -0
@@ -0,0 +1,76 @@
+/*
+ * arch/arm/plat-spear/include/plat/nand.h
+ *
+ * NAND macros for SPEAr platform
+ *

Replace "SPEAr platform" for "FSMC - Flexible Static Media Controller"

arch/arm/plat-spear/include/plat/nand.h line 15

Quoted 10 lines
arch/arm/plat-spear/include/plat/nand.h new file +10 -0
+ * Copyright (C) 2010 ST Microelectronics
+ * Vipin Kumar <[email protected]>
+ *
+ * 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 __PLAT_NAND_H
+#define __PLAT_NAND_H

Change this to reflect the new suggested placement.

arch/arm/plat-spear/include/plat/nand.h

Quoted 5 lines
arch/arm/plat-spear/include/plat/nand.h new file +5 -0
+
+#include <linux/mtd/partitions.h>
+
+#define SPEAR_NAND_BW8 ? ? ? ? 1
+#define SPEAR_NAND_BW16 ? ? ? ? ? ? ? ?2

FSMC_NAND*?

arch/arm/plat-spear/include/plat/nand.h line 28

Quoted 8 lines
arch/arm/plat-spear/include/plat/nand.h new file +8 -0
+
+#if defined(CONFIG_MACH_SPEAR310)
+#define PLAT_NAND_CLE ? ? ? ? ?(1 << 17)
+#define PLAT_NAND_ALE ? ? ? ? ?(1 << 16)
+#else
+#define PLAT_NAND_CLE ? ? ? ? ?(1 << 16)
+#define PLAT_NAND_ALE ? ? ? ? ?(1 << 17)
+#endif

You have to handle this some other way using platform data I think.

arch/arm/plat-spear/include/plat/nand.h line 30

Quoted 2 lines
arch/arm/plat-spear/include/plat/nand.h new file +2 -0
+
+struct nand_platform_data {

fsmc_platform_data!

arch/arm/plat-spear/include/plat/nand.h line 34

Quoted 4 lines
arch/arm/plat-spear/include/plat/nand.h new file +4 -0
+ ? ? ? /*
+ ? ? ? ?* Board specific information
+ ? ? ? ?* Set from arch/arm/mach-spear<mach>/spear<mach>_evb.c
+ ? ? ? ?*/

Skip this comment...

Quoted 16 lines
arch/arm/plat-spear/include/plat/nand.h new file +16 -0
+
+ ? ? ? /*
+ ? ? ? ?* Use the default partition table present in the NAND driver if
+ ? ? ? ?* partitions is set to NULL.
+ ? ? ? ?*/
+ ? ? ? struct mtd_partition ? ?*partitions;
+ ? ? ? unsigned int ? ? ? ? ? ?nr_partitions;
+ ? ? ? unsigned int ? ? ? ? ? ?options;
+ ? ? ? unsigned int ? ? ? ? ? ?width;
+
+ ? ? ? /*
+ ? ? ? ?* Machine specific information
+ ? ? ? ?* Set from arch/arm/mach-spear<mach>/spear<mach>.c
+ ? ? ? ?*/
+
+ ? ? ? unsigned int ? ? ? ? ? ?bank;

arch/arm/plat-spear/include/plat/nand.h line 60

Quoted 10 lines
arch/arm/plat-spear/include/plat/nand.h new file +10 -0
+ ? ? ? /*
+ ? ? ? ?* Set to NULL if bank selection is not supported by machine
+ ? ? ? ?* architecture
+ ? ? ? ?* -> eg. when controller supports only one bank
+ ? ? ? ?*/
+ ? ? ? void ? ? ? ? ? ? ? ? ? ?(*select_bank)(u32 bank, u32 busw);
+};
+
+/* This function is used to set platform data field of pdev->dev */
+static inline void nand_set_plat_data(struct platform_device *pdev,

What about naming this fsmc_set_plat_data()

Quoted 24 lines
arch/arm/plat-spear/include/plat/nand.h new file +16 -0
+ ? ? ? ? ? ? ? struct mtd_partition *partitions, unsigned int nr_partitions,
+ ? ? ? ? ? ? ? unsigned int options, unsigned int width)
+{
+ ? ? ? struct nand_platform_data *nand_plat_data;
+ ? ? ? nand_plat_data = dev_get_platdata(&pdev->dev);
+
+ ? ? ? if (partitions) {
+ ? ? ? ? ? ? ? nand_plat_data->partitions = partitions;
+ ? ? ? ? ? ? ? nand_plat_data->nr_partitions = nr_partitions;
+ ? ? ? }
+
+ ? ? ? nand_plat_data->options = options;
+ ? ? ? nand_plat_data->width = width;
+}
+
+#endif /* __PLAT_NAND_H */
drivers/mtd/nand/Kconfig +0 -0
index 8b4b67c..89d35d1 100644
@@ -531,4 +531,10 @@ config MTD_NAND_JZ4740

? ? ? ?help
? ? ? ? ? ? ? ?Enables support for NAND Flash on JZ4740 SoC based boards.

Quoted 1 line

+config MTD_NAND_SPEAR

MTD_NAND_FSMC

Quoted 1 line

+ ? ? ? tristate "Support for NAND on SPEAr platforms"

skip "on SPEAr platforms", there will be more.

Quoted 3 lines

+ ? ? ? depends on MTD_NAND && PLAT_SPEAR
+ ? ? ? help
+ ? ? ? ? Enables support for NAND Flash chips wired onto SPEAr boards.

Update help text to fit with U300 and Nomadik etc use. Something more generic.

drivers/mtd/nand/spear_nand.c

Quoted 7 lines

+
?endif # MTD_NAND

drivers/mtd/nand/spear_nand.c new file +0 -0
new file mode 100644
index 0000000..da9661b

Name the file fsmc-nand.c or so.

drivers/mtd/nand/spear_nand.c line 4

Quoted 5 lines
drivers/mtd/nand/spear_nand.c new file +4 -0
@@ -0,0 +1,860 @@
+/*
+ * drivers/mtd/nand/spear_nand.c
+ *
+ * SPEAr13XX machines common source file

No... "FSMC Flexible Static Media Controller NAND portions driver"

drivers/mtd/nand/spear_nand.c line 10

Quoted 6 lines
drivers/mtd/nand/spear_nand.c new file +6 -0
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * Vipin Kumar <[email protected]>
+ * Ashish Priyadarshi
+ *
+ * Based on drivers/mtd/nand/nomadik_nand.c

Aha :-)

But why did you fork it instead of merging the drivers??

Quoted 99 lines
drivers/mtd/nand/spear_nand.c new file +99 -0
+ *
+ * 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.
+ */
+
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/resource.h>
+#include <linux/sched.h>
+#include <linux/types.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/partitions.h>
+#include <linux/io.h>
+#include <linux/slab.h>
+#include <plat/fsmc.h>
+#include <plat/nand.h>
+#include <mtd/mtd-abi.h>
+
+static struct nand_ecclayout fsmc_ecc1_layout = {
+ ? ? ? .eccbytes = 24,
+ ? ? ? .eccpos = {2, 3, 4, 18, 19, 20, 34, 35, 36, 50, 51, 52,
+ ? ? ? ? ? ? ? 66, 67, 68, 82, 83, 84, 98, 99, 100, 114, 115, 116},
+ ? ? ? .oobfree = {
+ ? ? ? ? ? ? ? {.offset = 8, .length = 8},
+ ? ? ? ? ? ? ? {.offset = 24, .length = 8},
+ ? ? ? ? ? ? ? {.offset = 40, .length = 8},
+ ? ? ? ? ? ? ? {.offset = 56, .length = 8},
+ ? ? ? ? ? ? ? {.offset = 72, .length = 8},
+ ? ? ? ? ? ? ? {.offset = 88, .length = 8},
+ ? ? ? ? ? ? ? {.offset = 104, .length = 8},
+ ? ? ? ? ? ? ? {.offset = 120, .length = 8}
+ ? ? ? }
+};
+
+static struct nand_ecclayout fsmc_ecc4_lp_layout = {
+ ? ? ? .eccbytes = 104,
+ ? ? ? .eccpos = { ?2, ? 3, ? 4, ? 5, ? 6, ? 7, ? 8,
+ ? ? ? ? ? ? ? 9, ?10, ?11, ?12, ?13, ?14,
+ ? ? ? ? ? ? ? 18, ?19, ?20, ?21, ?22, ?23, ?24,
+ ? ? ? ? ? ? ? 25, ?26, ?27, ?28, ?29, ?30,
+ ? ? ? ? ? ? ? 34, ?35, ?36, ?37, ?38, ?39, ?40,
+ ? ? ? ? ? ? ? 41, ?42, ?43, ?44, ?45, ?46,
+ ? ? ? ? ? ? ? 50, ?51, ?52, ?53, ?54, ?55, ?56,
+ ? ? ? ? ? ? ? 57, ?58, ?59, ?60, ?61, ?62,
+ ? ? ? ? ? ? ? 66, ?67, ?68, ?69, ?70, ?71, ?72,
+ ? ? ? ? ? ? ? 73, ?74, ?75, ?76, ?77, ?78,
+ ? ? ? ? ? ? ? 82, ?83, ?84, ?85, ?86, ?87, ?88,
+ ? ? ? ? ? ? ? 89, ?90, ?91, ?92, ?93, ?94,
+ ? ? ? ? ? ? ? 98, ?99, 100, 101, 102, 103, 104,
+ ? ? ? ? ? ? ? 105, 106, 107, 108, 109, 110,
+ ? ? ? ? ? ? ? 114, 115, 116, 117, 118, 119, 120,
+ ? ? ? ? ? ? ? 121, 122, 123, 124, 125, 126
+ ? ? ? },
+ ? ? ? .oobfree = {
+ ? ? ? ? ? ? ? {.offset = 15, .length = 3},
+ ? ? ? ? ? ? ? {.offset = 31, .length = 3},
+ ? ? ? ? ? ? ? {.offset = 47, .length = 3},
+ ? ? ? ? ? ? ? {.offset = 63, .length = 3},
+ ? ? ? ? ? ? ? {.offset = 79, .length = 3},
+ ? ? ? ? ? ? ? {.offset = 95, .length = 3},
+ ? ? ? ? ? ? ? {.offset = 111, .length = 3},
+ ? ? ? ? ? ? ? {.offset = 127, .length = 1}
+ ? ? ? }
+};
+
+/*
+ * ECC placement definitions in oobfree type format.
+ * There are 13 bytes of ecc for every 512 byte block and it has to be read
+ * consecutively and immediately after the 512 byte data block for hardware to
+ * generate the error bit offsets in 512 byte data.
+ * Managing the ecc bytes in the following way makes it easier for software to
+ * read ecc bytes consecutive to data bytes. This way is similar to
+ * oobfree structure maintained already in generic nand driver
+ */
+static struct fsmc_eccplace fsmc_ecc4_lp_place = {
+ ? ? ? .eccplace = {
+ ? ? ? ? ? ? ? {.offset = 2, .length = 13},
+ ? ? ? ? ? ? ? {.offset = 18, .length = 13},
+ ? ? ? ? ? ? ? {.offset = 34, .length = 13},
+ ? ? ? ? ? ? ? {.offset = 50, .length = 13},
+ ? ? ? ? ? ? ? {.offset = 66, .length = 13},
+ ? ? ? ? ? ? ? {.offset = 82, .length = 13},
+ ? ? ? ? ? ? ? {.offset = 98, .length = 13},
+ ? ? ? ? ? ? ? {.offset = 114, .length = 13}
+ ? ? ? }
+};
+
+static struct nand_ecclayout fsmc_ecc4_sp_layout = {
+ ? ? ? .eccbytes = 13,
+ ? ? ? .eccpos = { 0, ?1, ?2, ?3, ?6, ?7, 8,
+ ? ? ? ? ? ? ? 9, 10, 11, 12, 13, 14
+ ? ? ? },
+ ? ? ? .oobfree = {

drivers/mtd/nand/spear_nand.c line 119

Quoted 10 lines
drivers/mtd/nand/spear_nand.c new file +10 -0
+ ? ? ? ? ? ? ? {.offset = 15, .length = 1},
+ ? ? ? }
+};
+
+static struct fsmc_eccplace fsmc_ecc4_sp_place = {
+ ? ? ? .eccplace = {
+ ? ? ? ? ? ? ? {.offset = 0, .length = 4},
+ ? ? ? ? ? ? ? {.offset = 6, .length = 9}
+ ? ? ? }
+};

I think ECC placement should be in the platform data.

Quoted 7 lines
drivers/mtd/nand/spear_nand.c new file +7 -0
+
+/*
+ * Default partition tables to be used if the partition information not provided
+ * through platform data
+ */
+#define PARTITION(n, off, sz) ?{.name = n, .offset = off, .size = sz}
+

drivers/mtd/nand/spear_nand.c line 136

Quoted 10 lines
drivers/mtd/nand/spear_nand.c new file +10 -0
+/*
+ * Default partition layout for small page(= 512 bytes) devices
+ * Size for "Root file system" is updated in driver based on actual device size
+ */
+static struct mtd_partition partition_info_16KB_blk[] = {
+ ? ? ? PARTITION("X-loader", 0, 4 * 0x4000),
+ ? ? ? PARTITION("U-Boot", 0x10000, 20 * 0x4000),
+ ? ? ? PARTITION("Kernel", 0x60000, 256 * 0x4000),
+ ? ? ? PARTITION("Root File System", 0x460000, 0),
+};

Ewwww atleast pass this part in from the platform data.

drivers/mtd/nand/spear_nand.c line 147

Quoted 11 lines
drivers/mtd/nand/spear_nand.c new file +11 -0
+
+/*
+ * Default partition layout for large page(> 512 bytes) devices
+ * Size for "Root file system" is updated in driver based on actual device size
+ */
+static struct mtd_partition partition_info_128KB_blk[] = {
+ ? ? ? PARTITION("X-loader", 0, 4 * 0x20000),
+ ? ? ? PARTITION("U-Boot", 0x80000, 12 * 0x20000),
+ ? ? ? PARTITION("Kernel", 0x200000, 48 * 0x20000),
+ ? ? ? PARTITION("Root File System", 0x800000, 0),
+};

Dito.

The rest of the driver looks really nice to my untrained eye, but I'm including Alessandro and Sebastian on the review.

Yours,
Linus Walleij

#81 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

Ciao Linus,

Quoted 25 lines · Linus Walleij

2010/8/30 Viresh KUMAR <[email protected]>:

Quoted 6 lines

From: Vipin Kumar <[email protected]>

SPEAr platforms use Flexible Static Memory Controller(FSMC) provided by ST for interfacing with NAND devices.
This patch adds the support for glue logic for NAND flash on SPEAr boards

OK...

Quoted 5 lines

(...)

 create mode 100644 arch/arm/plat-spear/include/plat/fsmc.h
 create mode 100644 arch/arm/plat-spear/include/plat/nand.h
 create mode 100644 drivers/mtd/nand/spear_nand.c

spear_nand.c?

Why not fsmc-nand.c or similar if this is the name of the block. We have this in U300, Nomadik NHK8815 and other platforms too, it doesn't have much to do with SPEAr actually...

Quoted 7 lines

Also, what are the include files doing in plat-spear since we have the same hardware in other platforms? Move them to include/linux/mtd/ so we can use them please.

I *highly* suspect that this driver duplicates some code found in drivers/mtd/nand/nomadik_nand.c because it's the same silicon.

Why nomadik_nand.c?
Shouldn't the fsmc_nand.c rule apply also in this case?

Quoted 3 lines

Alessandro can judge on this, but I have a feeling that driver should be replaced by this, more mature driver.

Maybe.
But I suspect that may be few differences in the ECC accelerator inside, in fact.

In our FSMC previous case it was a Hamming accelerator, and I think this apply
also for nomadik (maybe). In our sp1300 case it is a BCH with 104 bytes of ECC.

This is one of the options when generating the h/w block, so FSMCs may differ.
If we want to re-use same driver I guess we might change something and accept
few parameters from the platform.

Vipin can for sure comment more on this.....

Rgds,
Arm

Signature · 8 lines
-- "Every step appears to be the unavoidable consequence of the
-- preceding one." (A. Einstein) 
-- 
Armando Visconti                  Mobile: (+39) 346 8879146
Senior SW Engineer                Fax:    (+39) 02 93519290
CPG                               Work:   (+39) 02 93519683
Computer System Division          e-mail: armando.visconti at st.com
ST Microelectronics               TINA:   051  4683
#82 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

Alessandro,

Quoted 14 lines
Quoted 5 lines

Alessandro can judge on this, but I have a feeling that driver should be replaced by this, more mature driver.

Maybe.
But I suspect that may be few differences in the ECC accelerator inside, in fact.

In our FSMC previous case it was a Hamming accelerator, and I think this apply
also for nomadik (maybe). In our sp1300 case it is a BCH with 104 bytes of ECC.

Quoted 7 lines

This is one of the options when generating the h/w block, so FSMCs may differ.
If we want to re-use same driver I guess we might change something and accept
few parameters from the platform.

Vipin can for sure comment more on this.....

Mmmh .... it seems that the driver already handles the different types of h/w ecc.
And in fact it works for our new and old SPEAr platform at the same time.

So, probably, it would work for Nomadik also...

Ciao,
Arm

Quoted 5 lines

Rgds,
Arm

Signature · 8 lines
-- "Every step appears to be the unavoidable consequence of the
-- preceding one." (A. Einstein) 
-- 
Armando Visconti                  Mobile: (+39) 346 8879146
Senior SW Engineer                Fax:    (+39) 02 93519290
CPG                               Work:   (+39) 02 93519683
Computer System Division          e-mail: armando.visconti at st.com
ST Microelectronics               TINA:   051  4683
#83 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

In reply to Armando Visconti

2010/9/2 Armando Visconti <[email protected]>:

Quoted 5 lines
Quoted 2 lines

I *highly* suspect that this driver duplicates some code found in drivers/mtd/nand/nomadik_nand.c because it's the same silicon.

Why nomadik_nand.c?
Shouldn't the fsmc_nand.c rule apply also in this case?

As I said I think nomadik_nand.c shall be deleted and replaced with this driver.

Unless Alessandro hits me on the fingers... If it is made generic I can provide testing for the U300. (Maybe I can get my NHK8815 card booting too, I don't know.)

Yours,
Linus Walleij

#84 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

Quoted 10 lines · Linus Walleij

2010/9/2 Armando Visconti <[email protected]>:

Quoted 6 lines
Quoted 3 lines

I *highly* suspect that this driver duplicates some code found in drivers/mtd/nand/nomadik_nand.c because it's the same silicon.

Why nomadik_nand.c?
Shouldn't the fsmc_nand.c rule apply also in this case?

Quoted 7 lines

As I said I think nomadik_nand.c shall be deleted and replaced with this driver.

Unless Alessandro hits me on the fingers... If it is made generic I can provide testing for the U300. (Maybe I can get my NHK8815 card booting too, I don't know.)

As I said before, the SPEAr driver should work on Nomadik too as it looks generic enough and for us it is working on two different platforms with different FSMC versions.

This, unless the Nomadik FSMC is a customized h/w block, which I seem to remember in fact ...

Ciao,
Arm

Signature · 8 lines
-- "Every step appears to be the unavoidable consequence of the
-- preceding one." (A. Einstein) 
-- 
Armando Visconti                  Mobile: (+39) 346 8879146
Senior SW Engineer                Fax:    (+39) 02 93519290
CPG                               Work:   (+39) 02 93519683
Computer System Division          e-mail: armando.visconti at st.com
ST Microelectronics               TINA:   051  4683
#85 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

Linus:

Quoted 2 lines
Quoted 2 lines

As I said I think nomadik_nand.c shall be deleted and replaced with this driver.

Armando:

Quoted 3 lines

As I said before, the SPEAr driver should work on Nomadik too as it looks generic enough and for us it is working on two different platforms with different FSMC versions.

Ok. I can't test it for a while, so I'll take your word. If needed I'll make my homework later to fix 8815 over the new driver.

Note however that the platform data in arch/arm/mach-nomadik/board-nhk8815.c should be fixed to reference the new driver. If you remove my version please at least compile-check the nhk with the new patch-set.

thanks
/alessandro

#86 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

2010/9/3 Alessandro Rubini <[email protected]>:

Quoted 4 lines

Note however that the platform data in arch/arm/mach-nomadik/board-nhk8815.c should be fixed to reference the new driver. ?If you remove my version please at least compile-check the nhk with the new patch-set.

What about we put this new FSMC generic thing in, and then remove the old one with the same patch that instead activates the new one. No need to rush that.

Right now I mostly worry about having it in the proper place with the proper name and the headers accessible from all archs...

Linus Walleij

#87 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

Quoted 13 lines · Linus Walleij

2010/9/3 Alessandro Rubini <[email protected]>:

Quoted 5 lines

Note however that the platform data in arch/arm/mach-nomadik/board-nhk8815.c should be fixed to reference the new driver. If you remove my version please at least compile-check the nhk with the new patch-set.

What about we put this new FSMC generic thing in, and then remove the old one with the same patch that instead activates the new one. No need to rush that.

Quoted 6 lines

Right now I mostly worry about having it in the proper place with the proper name and the headers accessible from all archs...

Linus Walleij

Agreed.

THis also because, as I already mentioned, I seem to remember that the Nomadik FSMC it is not exactly the standard one, but a modified (not configured)
version.

So, you may better check with Andrea Gallo whether this is really the case or not.

Rgds,
Arm

#88 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

In reply to Linus Walleij
Quoted 11 lines · Linus Walleij
Quoted 4 lines
Quoted 4 lines

Note however that the platform data in arch/arm/mach-nomadik/board-nhk8815.c should be fixed to reference the new driver. If you remove my version please at least compile-check the nhk with the new patch-set.

What about we put this new FSMC generic thing in, and then remove the old one with the same patch that instead activates the new one. No need to rush that.

Right now I mostly worry about having it in the proper place with the proper name and the headers accessible from all archs...

Linus,

Sorry for replying late!!!

The solution looks fine to us, but currently we don't have enough bandwidth to rework on the suggested solution.

Maybe, we can go ahead with current patch, get it acked. Then send another patch later to fix mentioned issues.

How do you suggest to proceed on this?

viresh.

#89 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

2010/9/10 viresh kumar <[email protected]>:

Quoted 11 lines
Quoted 3 lines

Right now I mostly worry about having it in the proper place with the proper name and the headers accessible from all archs...

The solution looks fine to us, but currently we don't have enough bandwidth to rework on the suggested solution.

Maybe, we can go ahead with current patch, get it acked. Then send another patch later to fix mentioned issues.

How do you suggest to proceed on this?

Easy, I will attempt to step in and fix it up and also test it on U300. :-)

Yours,
Linus Walleij

#90 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

In reply to Armando Visconti
Quoted 32 lines · Armando VISCONTI

Ciao Linus,

Quoted 29 lines · Linus Walleij

2010/8/30 Viresh KUMAR <[email protected]>:

Quoted 6 lines

From: Vipin Kumar <[email protected]>

SPEAr platforms use Flexible Static Memory Controller(FSMC) provided by ST for interfacing with NAND devices.
This patch adds the support for glue logic for NAND flash on SPEAr boards

OK...

Quoted 5 lines

(...)

 create mode 100644 arch/arm/plat-spear/include/plat/fsmc.h
 create mode 100644 arch/arm/plat-spear/include/plat/nand.h
 create mode 100644 drivers/mtd/nand/spear_nand.c

spear_nand.c?

Why not fsmc-nand.c or similar if this is the name of the block. We have this in U300, Nomadik NHK8815 and other platforms too, it doesn't have much to do with SPEAr actually...

Also, what are the include files doing in plat-spear since we have the same hardware in other platforms? Move them to include/linux/mtd/ so we can use them please.

Quoted 10 lines
Quoted 3 lines

I *highly* suspect that this driver duplicates some code found in drivers/mtd/nand/nomadik_nand.c because it's the same silicon.

Why nomadik_nand.c?
Shouldn't the fsmc_nand.c rule apply also in this case?

Quoted 3 lines

Alessandro can judge on this, but I have a feeling that driver should be replaced by this, more mature driver.

Hello All,

Quoted 8 lines

Maybe.
But I suspect that may be few differences in the ECC accelerator inside, in fact.

In our FSMC previous case it was a Hamming accelerator, and I think this apply
also for nomadik (maybe). In our sp1300 case it is a BCH with 104 bytes of ECC.

Adding on top of what Armando has already pointed out, FSMC block may have different versions and each of them may support different features based on its configuration eg. spear device's FSMC block is version8 and is configured for 13 byte ecc(per 512 bytes data, BCH8 algorithm). There are other possibilities eg. BCH4, BCH2 etc which are not used in spear devices.

Making it generic would also entail supporting all possible configurations through single driver (makes more sense)

Customization was the prime reason for keeping the driver spear dependent and naming it as spear_nand.c

Alessandro/Sebastian: Is it OK to add a common driver for all FSMC versions and customizations

Comments/Suggestions welcome

Regards
Vipin

Quoted 13 lines

This is one of the options when generating the h/w block, so FSMCs may differ.
If we want to re-use same driver I guess we might change something and accept
few parameters from the platform.

Vipin can for sure comment more on this.....

Rgds,
Arm

#91 lore raw

PATCH 27/74 ST SPEAr : NAND interface driver for spear platforms

Hi!

Quoted 6 lines

Adding on top of what Armando has already pointed out, FSMC block may have different versions and each of them may support different features based on its configuration eg. spear device's FSMC block is version8 and is configured for 13 byte ecc(per 512 bytes data, BCH8 algorithm). There are other possibilities eg. BCH4, BCH2 etc which are not used in spear devices.

Looking at the future trend of NAND flash memories I believe that BCH8 is likely to be of most interest, but of course having backwards compatibility with already existing FSMC block usage is interesting enough.

Quoted 2 lines

Making it generic would also entail supporting all possible configurations through single driver (makes more sense)

[...]

Quoted 2 lines

Alessandro/Sebastian: Is it OK to add a common driver for all FSMC versions and customizations

I believe that a common driver is the best way forward, yes. Let me know if I can assist you in any of the development or testing.

/ Sebastian

#92 lore raw

PATCH 28/74 Incrementing the ecc_pos array to contain 128 char

In reply to Viresh KUMAR

From: Vipin Kumar <[email protected]>

For a page size of 4096, the number of oob bytes are 128 per page. This demands for an increased ecc_pos array as well as ecc can be placed at more than 64 locations.

This patch is added because SPEAr platforms NAND controller has 13 bytes of ecc for each 512 bytes of data. This results in 104 bytes of ecc in case of 4096 byte page.

---
 include/mtd/mtd-abi.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/mtd/mtd-abi.h +1 -1
index 4debb45..ff3f30e 100644
@@ -150,7 +150,7 @@ struct nand_oobfree {
  */
 struct nand_ecclayout {
 	__u32 eccbytes;
-	__u32 eccpos[64];
+	__u32 eccpos[128];
 	__u32 oobavail;
 	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
 };
Signature · 1 line
1.7.2.2
#93 lore raw

PATCH 28/74 Incrementing the ecc_pos array to contain 128 char

Quoted 6 lines · Viresh KUMAR

From: Vipin Kumar <[email protected]>

For a page size of 4096, the number of oob bytes are 128 per page. This demands for an increased ecc_pos array as well as ecc can be placed at more than 64 locations.

Quoted 6 lines

This patch is added because SPEAr platforms NAND controller has 13 bytes of ecc for each 512 bytes of data. This results in 104 bytes of ecc in case of 4096 byte page.

Nack, breaking ABI Is not allowed in Linux.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (???????? ?????)