Skip to contentSkip to conversation

ARM: pxa: towards multiplatform support

PATCH Applied Arnd Bergmann 16 participants 154 messages Oct 18, 2019 – Apr 19, 2022 3 messages not in the archive Page 1 of 2

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

cover ARM: pxa: towards multiplatform support

Hi PXA maintainers,

I'm in the process of getting the old ARM platforms to all build in a single kernel. The largest part of that work is changing all the device drivers to no longer require mach/*.h header files.

This series does it for arch/pxa/.

As with the omap1 and s3c24xx series I sent before, I don't expect this all to be correct in the first version, though a lot of the patches are fairly simple and I did exhaustive compile-time testing on them.

Please test if you have the hardware, or review!

Arnd

Bcc: Alexandre Belloni <[email protected]>
Bcc: [email protected]
Bcc: Bartlomiej Zolnierkiewicz <[email protected]>
Bcc: Brian Norris <[email protected]>
Bcc: Daniel Thompson <[email protected]>
Bcc: David Woodhouse <[email protected]>
Bcc: Dmitry Torokhov <[email protected]>
Bcc: Dominik Brodowski <[email protected]>
Bcc: [email protected]
Bcc: Felipe Balbi <[email protected]>
Bcc: Greg Kroah-Hartman <[email protected]>
Bcc: Guenter Roeck <[email protected]>
Bcc: Jacek Anaszewski <[email protected]>
Bcc: Jens Axboe <[email protected]>
Bcc: Jingoo Han <[email protected]>
Bcc: Jonathan Cameron <[email protected]>
Bcc: Lee Jones <[email protected]>
Bcc: Lubomir Rintel <[email protected]>
Bcc: Marek Vasut <[email protected]>
Bcc: Mark Brown <[email protected]>
Bcc: Michael Turquette <[email protected]>
Bcc: Miquel Raynal <[email protected]>
Bcc: Paul Parsons <[email protected]>
Bcc: Pavel Machek <[email protected]>
Bcc: Philipp Zabel <[email protected]>
Bcc: "Rafael J. Wysocki" <[email protected]>
Bcc: Richard Weinberger <[email protected]>
Bcc: Russell King <[email protected]>
Bcc: Sebastian Reichel <[email protected]>
Bcc: Sergey Lapin <[email protected]>
Bcc: Stephen Boyd <[email protected]>
Bcc: Tomas Cech <[email protected]>
Bcc: Ulf Hansson <[email protected]>
Bcc: Vignesh Raghavendra <[email protected]>
Bcc: Viresh Kumar <[email protected]>
Bcc: Wim Van Sebroeck <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Arnd Bergmann (46):
ARM: pxa: split mach/generic.h
ARM: pxa: make mainstone.h private
ARM: pxa: make mach/regs-uart.h private
ARM: pxa: remove mach/dma.h
ARM: pxa: split up mach/hardware.h
ARM: pxa: stop using mach/bitfield.h
ARM: pxa: move mach/sound.h to linux/platform_data/
ARM: pxa: move regs-lcd.h into driver
watchdog: sa1100: use platform device registration
ARM: pxa: pxa2xx-ac97-lib: use IRQ resource
ARM: pxa: cmx270: use platform device for nand
ARM: pxa: make addr-map.h header local
ARM: pxa: move pcmcia board data into mach-pxa
ARM: pxa: use pdev resource for palmld mmio
ARM: pxa: maybe fix gpio lookup tables
ARM: pxa: tosa: use gpio descriptor for audio
ARM: pxa: poodle: use platform data for poodle asoc driver
ARM: pxa: corgi: use gpio descriptors for audio
ARM: pxa: hx4700: use gpio descriptors for audio
ARM: pxa: lubbock: pass udc irqs as resource
ARM: pxa: spitz: use gpio descriptors for audio
ARM: pxa: eseries: use gpio lookup for audio
ARM: pxa: z2: use gpio lookup for audio device
ARM: pxa: magician: use platform driver for audio
ARM: pxa: mainstone-wm97xx: use gpio lookup table
ARM: pxa: zylonite: use gpio lookup instead mfp header
input: touchscreen: mainstone: fix pxa2xx+pxa3xx configuration
input: touchscreen: mainstone: sync with zylonite driver
Input: touchscreen: use wrapper for pxa2xx ac97 registers
SoC: pxa: use pdev resource for FIFO regs
ASoC: pxa: ac97: use normal MMIO accessors
ASoC: pxa: i2s: use normal MMIO accessors
ARM: pxa: pcmcia: move smemc configuration back to arch
ARM: pxa: remove get_clk_frequency_khz()
cpufreq: pxa3: move clk register access to clk driver
ARM: pxa: move smemc register access from clk to platform
ARM: pxa: move clk register definitions to driver
video: backlight: tosa: use gpio lookup table
power: tosa: simplify probe function
ARM: pxa: tosa: use gpio lookup for battery
ARM: pxa: move it8152 PCI support into machine
ARM: pxa: remove unused mach/bitfield.h
ARM: pxa: pci-it8152: add platform checks
ARM: mmp: remove tavorevb board support
ARM: mmp: rename pxa_register_device
ARM: pxa: move plat-pxa to drivers/soc/

 arch/arm/Kconfig                              |   9 -
 arch/arm/Makefile                             |   1 -
 arch/arm/common/Makefile                      |   1 -
 arch/arm/common/locomo.c                      |   1 -
 arch/arm/common/sa1111.c                      |   5 +-
 arch/arm/include/asm/hardware/sa1111.h        |   2 -
 arch/arm/mach-mmp/Kconfig                     |  10 +-
 arch/arm/mach-mmp/Makefile                    |   1 -
 arch/arm/mach-mmp/devices.c                   |   2 +-
 arch/arm/mach-mmp/devices.h                   |  10 +-
 arch/arm/mach-mmp/mfp.h                       |   2 +-
 arch/arm/mach-mmp/mmp2.h                      |  48 ++---
 arch/arm/mach-mmp/pxa168.h                    |  60 +++---
 arch/arm/mach-mmp/pxa910.h                    |  38 ++--
 arch/arm/mach-mmp/tavorevb.c                  | 113 -----------
 arch/arm/mach-mmp/ttc_dkb.c                   |   6 +-
 arch/arm/mach-pxa/Kconfig                     |   8 +-
 arch/arm/mach-pxa/Makefile                    |  22 +-
 .../mach-pxa/{include/mach => }/addr-map.h    |   0
 .../arm/mach-pxa/balloon3-pcmcia.c            |   4 +-
 arch/arm/mach-pxa/balloon3.c                  |   4 +-
 .../mach-pxa/{include/mach => }/balloon3.h    |   2 +-
 arch/arm/mach-pxa/cm-x270.c                   |  25 +++
 arch/arm/mach-pxa/cm-x2xx-pci.c               |   2 +-
 arch/arm/mach-pxa/cm-x2xx.c                   |   7 +-
 arch/arm/mach-pxa/cm-x300.c                   |  12 +-
 .../arm/mach-pxa/cm_x255-pcmcia.c             |   2 +-
 .../arm/mach-pxa/cm_x270-pcmcia.c             |   2 +-
 .../arm/mach-pxa/cm_x2xx-pcmcia.c             |   2 +-
 arch/arm/mach-pxa/colibri-evalboard.c         |   1 -
 .../arm/mach-pxa/colibri-pcmcia.c             |   2 +-
 arch/arm/mach-pxa/colibri-pxa270-income.c     |   1 -
 arch/arm/mach-pxa/colibri-pxa270.c            |   2 +-
 arch/arm/mach-pxa/colibri-pxa300.c            |   3 +-
 arch/arm/mach-pxa/colibri-pxa320.c            |   2 +-
 arch/arm/mach-pxa/colibri-pxa3xx.c            |   1 -
 arch/arm/mach-pxa/corgi.c                     |  23 ++-
 arch/arm/mach-pxa/{include/mach => }/corgi.h  |   2 +-
 arch/arm/mach-pxa/corgi_pm.c                  |   3 +-
 arch/arm/mach-pxa/csb726.c                    |   3 +-
 arch/arm/mach-pxa/devices.c                   |  15 +-
 .../arm/mach-pxa/e740-pcmcia.c                |   2 +-
 arch/arm/mach-pxa/em-x270.c                   |   2 +-
 arch/arm/mach-pxa/eseries.c                   |  34 +++-
 arch/arm/mach-pxa/ezx.c                       |   1 -
 arch/arm/mach-pxa/generic.c                   |  78 ++++++--
 arch/arm/mach-pxa/generic.h                   |   9 -
 arch/arm/mach-pxa/gumstix.c                   |   1 -
 .../arm/mach-pxa/hx4700-pcmcia.c              |   4 +-
 arch/arm/mach-pxa/hx4700.c                    |  18 +-
 arch/arm/mach-pxa/{include/mach => }/hx4700.h |   2 +-
 arch/arm/mach-pxa/idp.c                       |   2 -
 arch/arm/mach-pxa/include/mach/bitfield.h     | 114 -----------
 arch/arm/mach-pxa/include/mach/dma.h          |  17 --
 arch/arm/mach-pxa/include/mach/generic.h      |   1 -
 arch/arm/mach-pxa/include/mach/mfp.h          |   2 +-
 arch/arm/mach-pxa/include/mach/pxa-regs.h     |  52 +++++
 arch/arm/mach-pxa/include/mach/pxa2xx-regs.h  |  47 +----
 arch/arm/mach-pxa/include/mach/pxa3xx-regs.h  |  71 +------
 arch/arm/mach-pxa/include/mach/regs-ost.h     |   4 +-
 arch/arm/mach-pxa/include/mach/reset.h        |   2 +-
 arch/arm/mach-pxa/include/mach/tosa.h         |  15 --
 arch/arm/mach-pxa/irq.c                       |   3 +-
 arch/arm/mach-pxa/littleton.c                 |   1 -
 arch/arm/mach-pxa/lpd270.c                    |   4 +-
 arch/arm/mach-pxa/lubbock.c                   |  15 +-
 .../arm/mach-pxa/{include/mach => }/lubbock.h |   2 -
 arch/arm/mach-pxa/magician.c                  |  54 ++++-
 arch/arm/mach-pxa/mainstone.c                 |  15 +-
 .../mach-pxa/{include/mach => }/mainstone.h   |   2 -
 arch/arm/mach-pxa/mfp-pxa2xx.c                |   1 +
 arch/arm/mach-pxa/mfp-pxa2xx.h                |   2 +-
 arch/arm/mach-pxa/mfp-pxa3xx.c                |   1 -
 arch/arm/mach-pxa/mfp-pxa3xx.h                |   2 +-
 arch/arm/mach-pxa/mioa701.c                   |   2 +-
 arch/arm/mach-pxa/mxm8x10.c                   |   8 +-
 arch/arm/mach-pxa/palm27x.c                   |   2 +-
 .../arm/mach-pxa/palmld-pcmcia.c              |   5 +-
 arch/arm/mach-pxa/palmld.c                    |  23 ++-
 arch/arm/mach-pxa/{include/mach => }/palmld.h |   2 +-
 arch/arm/mach-pxa/palmt5.c                    |  11 +-
 .../arm/mach-pxa/palmtc-pcmcia.c              |   4 +-
 arch/arm/mach-pxa/palmtc.c                    |   4 +-
 arch/arm/mach-pxa/{include/mach => }/palmtc.h |   2 +-
 arch/arm/mach-pxa/palmte2.c                   |   2 +-
 arch/arm/mach-pxa/palmtreo.c                  |   2 +-
 .../arm/mach-pxa/palmtx-pcmcia.c              |   4 +-
 arch/arm/mach-pxa/palmtx.c                    |  13 +-
 arch/arm/mach-pxa/{include/mach => }/palmtx.h |   2 +-
 arch/arm/mach-pxa/palmz72.c                   |   2 +-
 .../it8152.c => mach-pxa/pci-it8152.c}        |  25 ++-
 .../it8152.h => mach-pxa/pci-it8152.h}        |   2 -
 arch/arm/mach-pxa/pcm990-baseboard.c          |   2 +-
 arch/arm/mach-pxa/poodle.c                    |  31 ++-
 arch/arm/mach-pxa/{include/mach => }/poodle.h |   4 +-
 arch/arm/mach-pxa/pxa-regs.h                  |   1 +
 arch/arm/mach-pxa/pxa25x.c                    |   6 +-
 arch/arm/mach-pxa/pxa25x.h                    |   2 +-
 arch/arm/mach-pxa/pxa27x-udc.h                |   2 +
 arch/arm/mach-pxa/pxa27x.c                    |   6 +-
 arch/arm/mach-pxa/pxa27x.h                    |   2 +-
 arch/arm/mach-pxa/pxa2xx.c                    |   1 -
 arch/arm/mach-pxa/pxa300.c                    |   1 +
 arch/arm/mach-pxa/pxa320.c                    |   1 +
 arch/arm/mach-pxa/pxa3xx-ulpi.c               |   2 +-
 arch/arm/mach-pxa/pxa3xx.c                    |  11 +-
 arch/arm/mach-pxa/pxa3xx.h                    |   2 +-
 arch/arm/mach-pxa/pxa930.c                    |   1 +
 arch/arm/mach-pxa/regs-rtc.h                  |   2 +-
 arch/arm/mach-pxa/regs-u2d.h                  |   2 -
 .../mach-pxa/{include/mach => }/regs-uart.h   |   2 +
 arch/arm/mach-pxa/reset.c                     |   3 -
 arch/arm/mach-pxa/sleep.S                     |   5 +-
 arch/arm/mach-pxa/smemc.c                     |  11 +-
 arch/arm/mach-pxa/spitz.c                     |  33 ++-
 arch/arm/mach-pxa/{include/mach => }/spitz.h  |   2 +-
 arch/arm/mach-pxa/spitz_pm.c                  |   3 +-
 arch/arm/mach-pxa/standby.S                   |   1 -
 .../arm/mach-pxa/stargate2-pcmcia.c           |   2 +-
 arch/arm/mach-pxa/tosa.c                      |  63 +++++-
 .../arm/mach-pxa/trizeps4-pcmcia.c            |   4 +-
 arch/arm/mach-pxa/trizeps4.c                  |   4 +-
 .../mach-pxa/{include/mach => }/trizeps4.h    |   3 +-
 .../arm/mach-pxa/viper-pcmcia.c               |   6 +-
 .../arm/mach-pxa/viper-pcmcia.h               |   0
 arch/arm/mach-pxa/viper.c                     |   8 +-
 .../arm/mach-pxa/vpac270-pcmcia.c             |   4 +-
 arch/arm/mach-pxa/vpac270.c                   |   4 +-
 .../arm/mach-pxa/{include/mach => }/vpac270.h |   0
 arch/arm/mach-pxa/xcep.c                      |   2 +-
 arch/arm/mach-pxa/z2.c                        |  11 +
 arch/arm/mach-pxa/zeus.c                      |   6 +-
 arch/arm/mach-pxa/zylonite.c                  |  34 +++-
 arch/arm/mach-pxa/zylonite.h                  |   2 +
 arch/arm/mach-pxa/zylonite_pxa300.c           |   1 +
 arch/arm/mach-pxa/zylonite_pxa320.c           |   1 +
 arch/arm/mach-sa1100/generic.c                |   6 +-
 arch/arm/mach-sa1100/include/mach/reset.h     |   1 -
 drivers/ata/pata_palmld.c                     |   3 +-
 drivers/clk/pxa/clk-pxa.c                     |   8 +-
 drivers/clk/pxa/clk-pxa.h                     |   9 +-
 drivers/clk/pxa/clk-pxa25x.c                  |  46 ++---
 drivers/clk/pxa/clk-pxa27x.c                  |  68 +++----
 drivers/clk/pxa/clk-pxa3xx.c                  | 139 +++++++++++--
 drivers/cpufreq/pxa2xx-cpufreq.c              |   6 +-
 drivers/cpufreq/pxa3xx-cpufreq.c              |  65 +++---
 drivers/input/mouse/pxa930_trkball.c          |   1 -
 drivers/input/touchscreen/Kconfig             |   2 +
 drivers/input/touchscreen/mainstone-wm97xx.c  | 123 ++++++------
 drivers/input/touchscreen/zylonite-wm97xx.c   |  34 ++--
 drivers/leds/leds-locomo.c                    |   1 -
 drivers/mmc/host/pxamci.c                     |   2 +-
 drivers/mtd/maps/pxa2xx-flash.c               |   2 -
 drivers/mtd/nand/raw/cmx270_nand.c            |  89 +++------
 drivers/pcmcia/Makefile                       |  16 --
 drivers/pcmcia/pxa2xx_base.c                  |  48 ++---
 drivers/pcmcia/pxa2xx_sharpsl.c               |   3 +-
 drivers/pcmcia/sa1111_generic.c               |   1 -
 drivers/pcmcia/sa1111_lubbock.c               |   1 -
 drivers/pcmcia/soc_common.c                   |   2 -
 drivers/pcmcia/soc_common.h                   | 120 +----------
 drivers/power/supply/tosa_battery.c           | 189 ++++++++++--------
 drivers/rtc/rtc-pxa.c                         |   2 -
 drivers/soc/Kconfig                           |   1 +
 drivers/soc/Makefile                          |   1 +
 .../arm/plat-pxa => drivers/soc/pxa}/Kconfig  |   5 +-
 .../arm/plat-pxa => drivers/soc/pxa}/Makefile |   4 -
 {arch/arm/plat-pxa => drivers/soc/pxa}/mfp.c  |   2 +-
 {arch/arm/plat-pxa => drivers/soc/pxa}/ssp.c  |   0
 drivers/usb/gadget/udc/pxa25x_udc.c           |  37 ++--
 drivers/usb/gadget/udc/pxa25x_udc.h           |   7 +-
 drivers/usb/host/ohci-pxa27x.c                |   3 +-
 drivers/video/backlight/tosa_bl.c             |  10 +-
 drivers/video/backlight/tosa_bl.h             |   8 +
 drivers/video/backlight/tosa_lcd.c            |  28 ++-
 .../video/fbdev/pxa3xx-regs.h                 |  24 +--
 drivers/video/fbdev/pxafb.c                   |   4 +-
 drivers/watchdog/sa1100_wdt.c                 |  88 +++++---
 include/linux/clk/pxa.h                       |  16 ++
 include/linux/platform_data/asoc-poodle.h     |  16 ++
 .../linux/platform_data/asoc-pxa.h            |   4 +-
 include/linux/platform_data/video-pxafb.h     |  22 +-
 .../hardware.h => include/linux/soc/pxa/cpu.h |  61 +-----
 .../plat => include/linux/soc/pxa}/mfp.h      |   6 +-
 include/linux/soc/pxa/smemc.h                 |  13 ++
 include/pcmcia/soc_common.h                   | 125 ++++++++++++
 include/sound/pxa2xx-lib.h                    |   4 +
 sound/arm/pxa2xx-ac97-lib.c                   | 145 +++++++++-----
 .../arm/pxa2xx-ac97-regs.h                    |  42 ++--
 sound/arm/pxa2xx-ac97.c                       |   3 +-
 sound/soc/pxa/corgi.c                         |  42 ++--
 sound/soc/pxa/e740_wm9705.c                   |  37 ++--
 sound/soc/pxa/e750_wm9705.c                   |  33 ++-
 sound/soc/pxa/e800_wm9712.c                   |  33 ++-
 sound/soc/pxa/em-x270.c                       |   2 +-
 sound/soc/pxa/hx4700.c                        |  34 ++--
 sound/soc/pxa/magician.c                      | 141 ++++---------
 sound/soc/pxa/mioa701_wm9713.c                |   2 +-
 sound/soc/pxa/palm27x.c                       |   2 +-
 sound/soc/pxa/poodle.c                        |  51 ++---
 sound/soc/pxa/pxa2xx-ac97.c                   |  24 ++-
 sound/soc/pxa/pxa2xx-i2s.c                    | 112 ++++++-----
 sound/soc/pxa/spitz.c                         |  58 +++---
 sound/soc/pxa/tosa.c                          |  18 +-
 sound/soc/pxa/z2.c                            |   8 +-
 205 files changed, 1916 insertions(+), 1795 deletions(-)
 delete mode 100644 arch/arm/mach-mmp/tavorevb.c
 rename arch/arm/mach-pxa/{include/mach => }/addr-map.h (100%)
 rename drivers/pcmcia/pxa2xx_balloon3.c => arch/arm/mach-pxa/balloon3-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/balloon3.h (99%)
 rename drivers/pcmcia/pxa2xx_cm_x255.c => arch/arm/mach-pxa/cm_x255-pcmcia.c (98%)
 rename drivers/pcmcia/pxa2xx_cm_x270.c => arch/arm/mach-pxa/cm_x270-pcmcia.c (98%)
 rename drivers/pcmcia/pxa2xx_cm_x2xx.c => arch/arm/mach-pxa/cm_x2xx-pcmcia.c (96%)
 rename drivers/pcmcia/pxa2xx_colibri.c => arch/arm/mach-pxa/colibri-pcmcia.c (99%)
 rename arch/arm/mach-pxa/{include/mach => }/corgi.h (98%)
 rename drivers/pcmcia/pxa2xx_e740.c => arch/arm/mach-pxa/e740-pcmcia.c (98%)
 rename drivers/pcmcia/pxa2xx_hx4700.c => arch/arm/mach-pxa/hx4700-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/hx4700.h (99%)
 delete mode 100644 arch/arm/mach-pxa/include/mach/bitfield.h
 delete mode 100644 arch/arm/mach-pxa/include/mach/dma.h
 delete mode 100644 arch/arm/mach-pxa/include/mach/generic.h
 create mode 100644 arch/arm/mach-pxa/include/mach/pxa-regs.h
 rename arch/arm/mach-pxa/{include/mach => }/lubbock.h (97%)
 rename arch/arm/mach-pxa/{include/mach => }/mainstone.h (99%)
 rename drivers/pcmcia/pxa2xx_palmld.c => arch/arm/mach-pxa/palmld-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/palmld.h (98%)
 rename drivers/pcmcia/pxa2xx_palmtc.c => arch/arm/mach-pxa/palmtc-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/palmtc.h (98%)
 rename drivers/pcmcia/pxa2xx_palmtx.c => arch/arm/mach-pxa/palmtx-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/palmtx.h (98%)
 rename arch/arm/{common/it8152.c => mach-pxa/pci-it8152.c} (95%)
 rename arch/arm/{include/asm/hardware/it8152.h => mach-pxa/pci-it8152.h} (98%)
 rename arch/arm/mach-pxa/{include/mach => }/poodle.h (97%)
 create mode 100644 arch/arm/mach-pxa/pxa-regs.h
 rename arch/arm/mach-pxa/{include/mach => }/regs-uart.h (99%)
 rename arch/arm/mach-pxa/{include/mach => }/spitz.h (99%)
 rename drivers/pcmcia/pxa2xx_stargate2.c => arch/arm/mach-pxa/stargate2-pcmcia.c (99%)
 rename drivers/pcmcia/pxa2xx_trizeps4.c => arch/arm/mach-pxa/trizeps4-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/trizeps4.h (98%)
 rename drivers/pcmcia/pxa2xx_viper.c => arch/arm/mach-pxa/viper-pcmcia.c (97%)
 rename include/linux/platform_data/pcmcia-pxa2xx_viper.h => arch/arm/mach-pxa/viper-pcmcia.h (100%)
 rename drivers/pcmcia/pxa2xx_vpac270.c => arch/arm/mach-pxa/vpac270-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/vpac270.h (100%)
 rename {arch/arm/plat-pxa => drivers/soc/pxa}/Kconfig (83%)
 rename {arch/arm/plat-pxa => drivers/soc/pxa}/Makefile (51%)
 rename {arch/arm/plat-pxa => drivers/soc/pxa}/mfp.c (99%)
 rename {arch/arm/plat-pxa => drivers/soc/pxa}/ssp.c (100%)
 create mode 100644 drivers/video/backlight/tosa_bl.h
 rename arch/arm/mach-pxa/include/mach/regs-lcd.h => drivers/video/fbdev/pxa3xx-regs.h (90%)
 create mode 100644 include/linux/clk/pxa.h
 create mode 100644 include/linux/platform_data/asoc-poodle.h
 rename arch/arm/mach-pxa/include/mach/audio.h => include/linux/platform_data/asoc-pxa.h (93%)
 rename arch/arm/mach-pxa/include/mach/hardware.h => include/linux/soc/pxa/cpu.h (75%)
 rename {arch/arm/plat-pxa/include/plat => include/linux/soc/pxa}/mfp.h (98%)
 create mode 100644 include/linux/soc/pxa/smemc.h
 create mode 100644 include/pcmcia/soc_common.h
 rename arch/arm/mach-pxa/include/mach/regs-ac97.h => sound/arm/pxa2xx-ac97-regs.h (71%)
Signature · 1 line
2.20.0
#1 lore raw

PATCH 1/46 ARM: pxa: split mach/generic.h

Only one declaration from this header is actually used in drivers, so move that one into the global location and leave everything else private.

---
 arch/arm/mach-pxa/generic.h              | 6 +-----
 arch/arm/mach-pxa/include/mach/generic.h | 6 +++++-
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-pxa/generic.h +1 -5
index 3b7873f8e1f8..67925d3ea026 100644
@@ -7,6 +7,7 @@
  */
 
 #include <linux/reboot.h>
+#include <mach/generic.h>
 
 struct irq_data;
 
@@ -71,8 +72,3 @@ extern unsigned pxa25x_get_clk_frequency_khz(int);
 #define pxa27x_get_clk_frequency_khz(x)		(0)
 #endif
 
-#ifdef CONFIG_PXA3xx
-extern unsigned	pxa3xx_get_clk_frequency_khz(int);
-#else
-#define pxa3xx_get_clk_frequency_khz(x)		(0)
-#endif
arch/arm/mach-pxa/include/mach/generic.h +5 -1
index 665542e0c9e2..613f6a299d0d 100644
@@ -1 +1,5 @@
-#include "../../generic.h"
+#ifdef CONFIG_PXA3xx
+extern unsigned	pxa3xx_get_clk_frequency_khz(int);
+#else
+#define pxa3xx_get_clk_frequency_khz(x)		(0)
+#endif
Signature · 7 lines
2.20.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

PATCH 2/46 ARM: pxa: make mainstone.h private

In reply to Arnd Bergmann

No driver includes this any more, so don't expose it globally.

---
 arch/arm/mach-pxa/mainstone.c                    | 2 +-
 arch/arm/mach-pxa/{include/mach => }/mainstone.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/mainstone.h (99%)
arch/arm/mach-pxa/mainstone.c +1 -1
index 1b7882920164..ef79417ca001 100644
@@ -45,7 +45,7 @@
 #include <asm/mach/flash.h>
 
 #include "pxa27x.h"
-#include <mach/mainstone.h>
+#include "mainstone.h"
 #include <mach/audio.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/mainstone.h renamed from arch/arm/mach-pxa/include/mach/mainstone.h +0 -2
similarity index 99%
rename from arch/arm/mach-pxa/include/mach/mainstone.h
rename to arch/arm/mach-pxa/mainstone.h
index 1698f2ffd7c7..ba003742e003 100644
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- *  arch/arm/mach-pxa/include/mach/mainstone.h
- *
  *  Author:	Nicolas Pitre
  *  Created:	Nov 14, 2002
  *  Copyright:	MontaVista Software Inc.
Signature · 1 line
2.20.0
#5 lore raw

PATCH 3/46 ARM: pxa: make mach/regs-uart.h private

In reply to Arnd Bergmann

This is not used by any drivers, so make it private to the platform.

---
 arch/arm/mach-pxa/{include/mach => }/regs-uart.h | 0
 arch/arm/mach-pxa/viper.c                        | 2 +-
 arch/arm/mach-pxa/zeus.c                         | 2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/regs-uart.h (100%)
arch/arm/mach-pxa/regs-uart.h renamed from arch/arm/mach-pxa/include/mach/regs-uart.h +0 -0
similarity index 100%
rename from arch/arm/mach-pxa/include/mach/regs-uart.h
rename to arch/arm/mach-pxa/regs-uart.h
arch/arm/mach-pxa/viper.c +1 -1
index c06031da6676..16f33e576902 100644
@@ -48,7 +48,7 @@
 #include "pxa25x.h"
 #include <mach/audio.h>
 #include <linux/platform_data/video-pxafb.h>
-#include <mach/regs-uart.h>
+#include "regs-uart.h"
 #include <linux/platform_data/pcmcia-pxa2xx_viper.h>
 #include "viper.h"
 
arch/arm/mach-pxa/zeus.c +1 -1
index da113c8eefbf..239faff71a1f 100644
@@ -39,7 +39,7 @@
 
 #include "pxa27x.h"
 #include "devices.h"
-#include <mach/regs-uart.h>
+#include "regs-uart.h"
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include "pxa27x-udc.h"
Signature · 1 line
2.20.0
maintainer Acked-by on v1 3/46
#6 lore raw

Re: [PATCH 03/46] ARM: pxa: make mach/regs-uart.h private

Quoted 4 lines · Arnd Bergmann

This is not used by any drivers, so make it private to the platform.

Too bad I don't have that board, because a more zealous change would be to use :
pxa_set_ffuart_info(NULL), pxa_set_btuart_info(NULL) and pxa_set_stuart_info(NULL), and kill regs-uart.h ...

But anyway :

Cheers.

--
Robert

#7 lore raw

PATCH 4/46 ARM: pxa: remove mach/dma.h

In reply to Arnd Bergmann

The file no longer contains anything useful, so remove it.

---
 arch/arm/mach-pxa/include/mach/dma.h | 17 -----------------
 arch/arm/mach-pxa/pxa25x.c           |  1 -
 arch/arm/mach-pxa/pxa27x.c           |  1 -
 arch/arm/mach-pxa/pxa3xx.c           |  1 -
 4 files changed, 20 deletions(-)
 delete mode 100644 arch/arm/mach-pxa/include/mach/dma.h
arch/arm/mach-pxa/include/mach/dma.h deleted +0 -17
deleted file mode 100644
index 79f9842a7e1c..000000000000
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- *  arch/arm/mach-pxa/include/mach/dma.h
- *
- *  Author:	Nicolas Pitre
- *  Created:	Jun 15, 2001
- *  Copyright:	MontaVista Software, Inc.
- */
-#ifndef __ASM_ARCH_DMA_H
-#define __ASM_ARCH_DMA_H
-
-#include <mach/hardware.h>
-
-/* DMA Controller Registers Definitions */
-#define DMAC_REGS_VIRT	io_p2v(0x40000000)
-
-#endif /* _ASM_ARCH_DMA_H */
arch/arm/mach-pxa/pxa25x.c +0 -1
index 678641ab46e5..0d25cc45f825 100644
@@ -34,7 +34,6 @@
 #include "pxa25x.h"
 #include <mach/reset.h>
 #include "pm.h"
-#include <mach/dma.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/pxa27x.c +0 -1
index f0ba7ed24cb6..f7e89831e85b 100644
@@ -33,7 +33,6 @@
 #include <mach/reset.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pm.h"
-#include <mach/dma.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/pxa3xx.c +0 -1
index 560160682df6..6eb1c24d7395 100644
@@ -32,7 +32,6 @@
 #include <mach/reset.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pm.h"
-#include <mach/dma.h>
 #include <mach/smemc.h>
 #include <mach/irqs.h>
 
Signature · 1 line
2.20.0
#9 lore raw

PATCH 5/46 ARM: pxa: split up mach/hardware.h

In reply to Arnd Bergmann

The mach/hardware.h is included in lots of places, and it provides three different things on pxa:

- the cpu_is_pxa* macros
- an indirect inclusion of mach/addr-map.h
- the __REG() and io_pv2() helper macros

Split it up into separate <linux/soc/pxa/cpu.h> and mach/pxa-regs.h headers, then change all the files that use mach/hardware.h to include the exact set of those three headers that they actually need, allowing for further more targeted cleanup.

linux/soc/pxa/cpu.h can remain permanently exported and is now in a global location along with similar headers. pxa-regs.h and addr-map.h are only used in a very small number of drivers now and can be moved to arch/arm/mach-pxa/ directly when those drivers are to pass the necessary data as resources.

---
 arch/arm/common/locomo.c                      |  1 -
 arch/arm/common/sa1111.c                      |  5 +-
 arch/arm/mach-pxa/cm-x2xx.c                   |  2 +
 arch/arm/mach-pxa/cm-x300.c                   |  2 +
 arch/arm/mach-pxa/colibri-evalboard.c         |  1 -
 arch/arm/mach-pxa/colibri-pxa270-income.c     |  1 -
 arch/arm/mach-pxa/colibri-pxa300.c            |  1 +
 arch/arm/mach-pxa/colibri-pxa3xx.c            |  1 -
 arch/arm/mach-pxa/corgi.c                     |  1 -
 arch/arm/mach-pxa/corgi_pm.c                  |  1 -
 arch/arm/mach-pxa/csb726.c                    |  1 +
 arch/arm/mach-pxa/devices.c                   |  2 +-
 arch/arm/mach-pxa/ezx.c                       |  1 -
 arch/arm/mach-pxa/generic.c                   |  3 +-
 arch/arm/mach-pxa/gumstix.c                   |  1 -
 arch/arm/mach-pxa/hx4700.c                    |  2 +-
 arch/arm/mach-pxa/idp.c                       |  1 -
 arch/arm/mach-pxa/include/mach/pxa-regs.h     | 52 ++++++++++++++++
 arch/arm/mach-pxa/include/mach/pxa2xx-regs.h  |  2 +-
 arch/arm/mach-pxa/include/mach/pxa3xx-regs.h  |  2 +-
 arch/arm/mach-pxa/include/mach/regs-ac97.h    |  2 +-
 arch/arm/mach-pxa/include/mach/regs-ost.h     |  2 +-
 arch/arm/mach-pxa/include/mach/trizeps4.h     |  1 +
 arch/arm/mach-pxa/irq.c                       |  3 +-
 arch/arm/mach-pxa/littleton.c                 |  1 -
 arch/arm/mach-pxa/lpd270.c                    |  2 +-
 arch/arm/mach-pxa/lubbock.c                   |  1 -
 arch/arm/mach-pxa/magician.c                  |  2 +-
 arch/arm/mach-pxa/mainstone.c                 |  2 +-
 arch/arm/mach-pxa/mfp-pxa2xx.c                |  1 +
 arch/arm/mach-pxa/mfp-pxa3xx.c                |  1 -
 arch/arm/mach-pxa/poodle.c                    |  1 -
 arch/arm/mach-pxa/pxa-regs.h                  |  1 +
 arch/arm/mach-pxa/pxa25x.c                    |  3 +-
 arch/arm/mach-pxa/pxa25x.h                    |  2 +-
 arch/arm/mach-pxa/pxa27x-udc.h                |  2 +
 arch/arm/mach-pxa/pxa27x.c                    |  3 +-
 arch/arm/mach-pxa/pxa27x.h                    |  2 +-
 arch/arm/mach-pxa/pxa2xx.c                    |  1 -
 arch/arm/mach-pxa/pxa300.c                    |  1 +
 arch/arm/mach-pxa/pxa320.c                    |  1 +
 arch/arm/mach-pxa/pxa3xx-ulpi.c               |  2 +-
 arch/arm/mach-pxa/pxa3xx.c                    |  3 +-
 arch/arm/mach-pxa/pxa3xx.h                    |  2 +-
 arch/arm/mach-pxa/pxa930.c                    |  1 +
 arch/arm/mach-pxa/regs-rtc.h                  |  2 +-
 arch/arm/mach-pxa/regs-uart.h                 |  2 +
 arch/arm/mach-pxa/sleep.S                     |  1 -
 arch/arm/mach-pxa/smemc.c                     |  2 +-
 arch/arm/mach-pxa/spitz_pm.c                  |  1 -
 arch/arm/mach-pxa/standby.S                   |  1 -
 arch/arm/mach-pxa/xcep.c                      |  2 +-
 arch/arm/mach-pxa/zylonite.c                  |  1 +
 arch/arm/mach-pxa/zylonite.h                  |  2 +
 arch/arm/mach-pxa/zylonite_pxa300.c           |  1 +
 arch/arm/mach-pxa/zylonite_pxa320.c           |  1 +
 drivers/clk/pxa/clk-pxa3xx.c                  |  1 +
 drivers/cpufreq/pxa2xx-cpufreq.c              |  1 +
 drivers/cpufreq/pxa3xx-cpufreq.c              |  1 +
 drivers/input/mouse/pxa930_trkball.c          |  1 -
 drivers/input/touchscreen/zylonite-wm97xx.c   |  2 +-
 drivers/leds/leds-locomo.c                    |  1 -
 drivers/mmc/host/pxamci.c                     |  2 +-
 drivers/mtd/maps/pxa2xx-flash.c               |  2 -
 drivers/mtd/nand/raw/cmx270_nand.c            |  3 +-
 drivers/pcmcia/pxa2xx_base.c                  |  2 +-
 drivers/pcmcia/pxa2xx_cm_x2xx.c               |  2 +-
 drivers/pcmcia/pxa2xx_sharpsl.c               |  1 -
 drivers/pcmcia/sa1111_generic.c               |  1 -
 drivers/pcmcia/sa1111_lubbock.c               |  1 -
 drivers/pcmcia/soc_common.c                   |  2 -
 drivers/rtc/rtc-pxa.c                         |  2 -
 drivers/usb/host/ohci-pxa27x.c                |  3 +-
 drivers/video/fbdev/pxafb.c                   |  2 +-
 drivers/watchdog/sa1100_wdt.c                 |  1 -
 .../hardware.h => include/linux/soc/pxa/cpu.h | 61 ++-----------------
 sound/arm/pxa2xx-ac97-lib.c                   |  1 +
 sound/soc/pxa/pxa2xx-ac97.c                   |  2 +-
 sound/soc/pxa/pxa2xx-i2s.c                    |  2 +-
 sound/soc/pxa/z2.c                            |  1 -
 80 files changed, 121 insertions(+), 119 deletions(-)
 create mode 100644 arch/arm/mach-pxa/include/mach/pxa-regs.h
 create mode 100644 arch/arm/mach-pxa/pxa-regs.h
 rename arch/arm/mach-pxa/include/mach/hardware.h => include/linux/soc/pxa/cpu.h (75%)
arch/arm/common/locomo.c +0 -1
index 62f241b09fe3..fd9157121406 100644
@@ -23,7 +23,6 @@
 #include <linux/spinlock.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 
arch/arm/common/sa1111.c +4 -1
index 947ef7981d92..e2829af69f96 100644
@@ -26,13 +26,16 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
 #include <linux/sizes.h>
 
 #include <asm/hardware/sa1111.h>
 
+#ifdef CONFIG_ARCH_SA1100
+#include <mach/hardware.h>
+#endif
+
 /* SA1111 IRQs */
 #define IRQ_GPAIN0		(0)
 #define IRQ_GPAIN1		(1)
arch/arm/mach-pxa/cm-x2xx.c +2 -0
index ff976d1217eb..c731539add9f 100644
@@ -14,6 +14,7 @@
 
 #include <linux/dm9000.h>
 #include <linux/leds.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
@@ -32,6 +33,7 @@
 #undef GPIO88_GPIO
 #undef GPIO89_GPIO
 #include <mach/audio.h>
+#include <mach/addr-map.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <mach/smemc.h>
 
arch/arm/mach-pxa/cm-x300.c +2 -0
index 425855f456f2..f3f2703fffc6 100644
@@ -40,6 +40,8 @@
 #include <linux/spi/spi_gpio.h>
 #include <linux/spi/tdo24m.h>
 
+#include <linux/soc/pxa/cpu.h>
+
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/setup.h>
arch/arm/mach-pxa/colibri-evalboard.c +0 -1
index b9c173ede891..b62af07b8f96 100644
@@ -13,7 +13,6 @@
 #include <linux/interrupt.h>
 #include <linux/gpio/machine.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/mach/arch.h>
 #include <linux/i2c.h>
 #include <linux/platform_data/i2c-pxa.h>
arch/arm/mach-pxa/colibri-pxa270-income.c +0 -1
index dbad2f13706c..957dc9ad4873 100644
@@ -25,7 +25,6 @@
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/hardware.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pxa27x.h"
arch/arm/mach-pxa/colibri-pxa300.c +1 -0
index 82052dfd96b6..4ceeea142bfd 100644
@@ -13,6 +13,7 @@
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach-types.h>
 #include <linux/sizes.h>
arch/arm/mach-pxa/colibri-pxa3xx.c +0 -1
index 3cead80a2b37..701dfef930eb 100644
@@ -13,7 +13,6 @@
 #include <linux/gpio.h>
 #include <linux/etherdevice.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <linux/sizes.h>
 #include <asm/system_info.h>
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/corgi.c +0 -1
index f2d73289230f..e9743ebbee86 100644
@@ -39,7 +39,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/corgi_pm.c +0 -1
index 092dcb9fced5..ff1ac9bf37cb 100644
@@ -19,7 +19,6 @@
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 #include <mach/corgi.h>
 #include <mach/pxa2xx-regs.h>
arch/arm/mach-pxa/csb726.c +1 -0
index 98fcdc6e2944..d48493445ae5 100644
@@ -17,6 +17,7 @@
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
+
 #include "csb726.h"
 #include "pxa27x.h"
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/devices.c +1 -1
index 524d6093e0c7..c289a6c2311d 100644
@@ -8,6 +8,7 @@
 #include <linux/dmaengine.h>
 #include <linux/spi/pxa2xx_spi.h>
 #include <linux/platform_data/i2c-pxa.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "udc.h"
 #include <linux/platform_data/usb-pxa3xx-ulpi.h>
@@ -19,7 +20,6 @@
 #include <linux/platform_data/keypad-pxa27x.h>
 #include <linux/platform_data/media/camera-pxa.h>
 #include <mach/audio.h>
-#include <mach/hardware.h>
 #include <linux/platform_data/mmp_dma.h>
 #include <linux/platform_data/mtd-nand-pxa3xx.h>
 
arch/arm/mach-pxa/ezx.c +0 -1
index ec10851b63cf..a77c5988a446 100644
@@ -29,7 +29,6 @@
 #include "pxa27x.h"
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
-#include <mach/hardware.h>
 #include <linux/platform_data/keypad-pxa27x.h>
 #include <linux/platform_data/media/camera-pxa.h>
 
arch/arm/mach-pxa/generic.c +2 -1
index ab7cdffd7ea8..3c3cd90bb9b4 100644
@@ -17,11 +17,12 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/soc/pxa/cpu.h>
 
-#include <mach/hardware.h>
 #include <asm/mach/map.h>
 #include <asm/mach-types.h>
 
+#include <mach/addr-map.h>
 #include <mach/irqs.h>
 #include <mach/reset.h>
 #include <mach/smemc.h>
arch/arm/mach-pxa/gumstix.c +0 -1
index 4b4589cf431f..b50080d55fa4 100644
@@ -28,7 +28,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <linux/sizes.h>
 
arch/arm/mach-pxa/hx4700.c +1 -1
index 311268d186ab..4dce8834c5b6 100644
@@ -37,11 +37,11 @@
 #include <linux/usb/gpio_vbus.h>
 #include <linux/platform_data/i2c-pxa.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
 #include "pxa27x.h"
+#include <mach/addr-map.h>
 #include <mach/hx4700.h>
 #include <linux/platform_data/irda-pxaficp.h>
 
arch/arm/mach-pxa/idp.c +0 -1
index fb0850af8496..57c0511472bc 100644
@@ -22,7 +22,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/include/mach/pxa-regs.h new file +52 -0

52 lines not on this page · raw message

arch/arm/mach-pxa/include/mach/pxa2xx-regs.h +1 -1
index fa121e135915..f68b573ab4a0 100644
@@ -11,7 +11,7 @@
 #ifndef __PXA2XX_REGS_H
 #define __PXA2XX_REGS_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * Power Manager
arch/arm/mach-pxa/include/mach/pxa3xx-regs.h +1 -1
index 070f6c74196e..8eb1ba533e1c 100644
@@ -10,7 +10,7 @@
 #ifndef __ASM_ARCH_PXA3XX_REGS_H
 #define __ASM_ARCH_PXA3XX_REGS_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * Oscillator Configuration Register (OSCC)
arch/arm/mach-pxa/include/mach/regs-ac97.h +1 -1
index 1db96fd4df32..ec09b9635e25 100644
@@ -2,7 +2,7 @@
 #ifndef __ASM_ARCH_REGS_AC97_H
 #define __ASM_ARCH_REGS_AC97_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * AC97 Controller registers
arch/arm/mach-pxa/include/mach/regs-ost.h +1 -1
index deb564ed8ee7..109d0ed264df 100644
@@ -2,7 +2,7 @@
 #ifndef __ASM_MACH_REGS_OST_H
 #define __ASM_MACH_REGS_OST_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * OS Timer & Match Registers
arch/arm/mach-pxa/include/mach/trizeps4.h +1 -0
index 3cddb1428c5e..27926629f9c6 100644
@@ -11,6 +11,7 @@
 #ifndef _TRIPEPS4_H_
 #define _TRIPEPS4_H_
 
+#include <mach/addr-map.h>
 #include "irqs.h" /* PXA_GPIO_TO_IRQ */
 
 /* physical memory regions */
arch/arm/mach-pxa/irq.c +2 -1
index 74efc3ab595f..f25c30e8a834 100644
@@ -17,13 +17,14 @@
 #include <linux/irq.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/exception.h>
 
-#include <mach/hardware.h>
 #include <mach/irqs.h>
 
 #include "generic.h"
+#include "pxa-regs.h"
 
 #define ICIP			(0x000)
 #define ICMR			(0x004)
arch/arm/mach-pxa/littleton.c +0 -1
index 793f61375ee8..7486056e6cce 100644
@@ -31,7 +31,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/lpd270.c +1 -1
index 20e00e970385..1b7c2def3033 100644
@@ -28,7 +28,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <linux/sizes.h>
 
@@ -39,6 +38,7 @@
 
 #include "pxa27x.h"
 #include "lpd270.h"
+#include <mach/addr-map.h>
 #include <mach/audio.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/lubbock.c +0 -1
index 742d18a1f7dc..477d144f039c 100644
@@ -34,7 +34,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <linux/sizes.h>
 
arch/arm/mach-pxa/magician.c +1 -1
index e1a394ac3eea..ce4c677be868 100644
@@ -30,12 +30,12 @@
 #include <linux/usb/gpio_vbus.h>
 #include <linux/platform_data/i2c-pxa.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/system_info.h>
 
 #include "pxa27x.h"
+#include <mach/addr-map.h>
 #include <mach/magician.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/mainstone.c +1 -1
index ef79417ca001..16883c996c45 100644
@@ -35,7 +35,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <linux/sizes.h>
 
@@ -52,6 +51,7 @@
 #include <linux/platform_data/irda-pxaficp.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/keypad-pxa27x.h>
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -0
index 6a5451b186c2..6bc7206fd2ac 100644
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/syscore_ops.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa2xx.h"
arch/arm/mach-pxa/mfp-pxa3xx.c +0 -1
index 56114df9700d..f26b5e5412cf 100644
@@ -16,7 +16,6 @@
 #include <linux/io.h>
 #include <linux/syscore_ops.h>
 
-#include <mach/hardware.h>
 #include "mfp-pxa3xx.h"
 #include <mach/pxa3xx-regs.h>
 
arch/arm/mach-pxa/poodle.c +0 -1
index 3a4ecc3c8f8b..8dd791ee49bf 100644
@@ -30,7 +30,6 @@
 #include <linux/mtd/sharpsl.h>
 #include <linux/memblock.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/irq.h>
 #include <asm/setup.h>
arch/arm/mach-pxa/pxa-regs.h new file +1 -0
new file mode 100644
index 000000000000..584d2ac592cc
@@ -0,0 +1 @@
+#include <mach/pxa-regs.h>
arch/arm/mach-pxa/pxa25x.c +2 -1
index 0d25cc45f825..305047ebd2f1 100644
@@ -26,14 +26,15 @@
 #include <linux/irq.h>
 #include <linux/irqchip.h>
 #include <linux/platform_data/mmp_dma.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
-#include <mach/hardware.h>
 #include <mach/irqs.h>
 #include "pxa25x.h"
 #include <mach/reset.h>
 #include "pm.h"
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/pxa25x.h +1 -1
index b58d0fbdb4db..403bc16c2ed2 100644
@@ -2,7 +2,7 @@
 #ifndef __MACH_PXA25x_H
 #define __MACH_PXA25x_H
 
-#include <mach/hardware.h>
+#include <mach/addr-map.h>
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa25x.h"
 #include <mach/irqs.h>
arch/arm/mach-pxa/pxa27x-udc.h +2 -0
index faf73804697f..2d3df3b1cb68 100644
@@ -2,6 +2,8 @@
 #ifndef _ASM_ARCH_PXA27X_UDC_H
 #define _ASM_ARCH_PXA27X_UDC_H
 
+#include "pxa-regs.h"
+
 #ifdef _ASM_ARCH_PXA25X_UDC_H
 #error You cannot include both PXA25x and PXA27x UDC support
 #endif
arch/arm/mach-pxa/pxa27x.c +2 -1
index f7e89831e85b..a81ac88ecbfd 100644
@@ -23,9 +23,9 @@
 #include <linux/irq.h>
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/platform_data/mmp_dma.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/map.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/suspend.h>
 #include <mach/irqs.h>
@@ -33,6 +33,7 @@
 #include <mach/reset.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pm.h"
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/pxa27x.h +1 -1
index abdc02fb4f03..6c99090647d2 100644
@@ -3,7 +3,7 @@
 #define __MACH_PXA27x_H
 
 #include <linux/suspend.h>
-#include <mach/hardware.h>
+#include <mach/addr-map.h>
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa27x.h"
 #include <mach/irqs.h>
arch/arm/mach-pxa/pxa2xx.c +0 -1
index 2d26cd2afbf3..ac72acb43e26 100644
@@ -12,7 +12,6 @@
 #include <linux/device.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa25x.h"
 #include <mach/reset.h>
arch/arm/mach-pxa/pxa300.c +1 -0
index 7f2f5a6a2263..f77ec118d5b9 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa300.h"
 
arch/arm/mach-pxa/pxa320.c +1 -0
index 78abcc741df7..e372e6c118de 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa320.h"
 
arch/arm/mach-pxa/pxa3xx-ulpi.c +1 -1
index 4bd7da1f8657..c29a7f0fa1b0 100644
@@ -21,8 +21,8 @@
 #include <linux/clk.h>
 #include <linux/usb.h>
 #include <linux/usb/otg.h>
+#include <linux/soc/pxa/cpu.h>
 
-#include <mach/hardware.h>
 #include "regs-u2d.h"
 #include <linux/platform_data/usb-pxa3xx-ulpi.h>
 
arch/arm/mach-pxa/pxa3xx.c +2 -1
index 6eb1c24d7395..fc84aed99481 100644
@@ -24,14 +24,15 @@
 #include <linux/syscore_ops.h>
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/platform_data/mmp_dma.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
-#include <mach/hardware.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/reset.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pm.h"
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 #include <mach/irqs.h>
 
arch/arm/mach-pxa/pxa3xx.h +1 -1
index 6d4502aa9d06..22ace053ea25 100644
@@ -2,7 +2,7 @@
 #ifndef __MACH_PXA3XX_H	
 #define __MACH_PXA3XX_H
 
-#include <mach/hardware.h>
+#include <mach/addr-map.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/irqs.h>
 
arch/arm/mach-pxa/pxa930.c +1 -0
index bf91de4267e5..b9021a40cbd1 100644
@@ -13,6 +13,7 @@
 #include <linux/irq.h>
 #include <linux/gpio-pxa.h>
 #include <linux/platform_device.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa930.h"
 
arch/arm/mach-pxa/regs-rtc.h +1 -1
index b1f9ff14e335..96255a0f595e 100644
@@ -2,7 +2,7 @@
 #ifndef __ASM_MACH_REGS_RTC_H
 #define __ASM_MACH_REGS_RTC_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * Real Time Clock
arch/arm/mach-pxa/regs-uart.h +2 -0
index 9a168f83afeb..490e9ca16297 100644
@@ -2,6 +2,8 @@
 #ifndef __ASM_ARCH_REGS_UART_H
 #define __ASM_ARCH_REGS_UART_H
 
+#include "pxa-regs.h"
+
 /*
  * UARTs
  */
arch/arm/mach-pxa/sleep.S +0 -1
index 6c5b3ffd2cd3..272efeb954f4 100644
@@ -13,7 +13,6 @@
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
 #include <mach/smemc.h>
 #include <mach/pxa2xx-regs.h>
 
arch/arm/mach-pxa/smemc.c +1 -1
index 32e82cc92ea5..47b99549d616 100644
@@ -8,8 +8,8 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/syscore_ops.h>
+#include <linux/soc/pxa/cpu.h>
 
-#include <mach/hardware.h>
 #include <mach/smemc.h>
 
 #ifdef CONFIG_PM
arch/arm/mach-pxa/spitz_pm.c +0 -1
index 25a1f8c5a738..201dabe883b6 100644
@@ -18,7 +18,6 @@
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 #include <mach/spitz.h>
 #include "pxa27x.h"
arch/arm/mach-pxa/standby.S +0 -1
index eab1645bb4ad..626fecdefb1c 100644
@@ -11,7 +11,6 @@
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
 
 #include <mach/pxa2xx-regs.h>
 
arch/arm/mach-pxa/xcep.c +1 -1
index f485146b899f..e6ab428287ae 100644
@@ -24,8 +24,8 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
 #include "pxa25x.h"
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/zylonite.c +1 -0
index bf2ab5bd49ec..c56c86b35025 100644
@@ -20,6 +20,7 @@
 #include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/smc91x.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/zylonite.h +2 -0
index 7300ec2aac0d..afe3efcb8e04 100644
@@ -2,6 +2,8 @@
 #ifndef __ASM_ARCH_ZYLONITE_H
 #define __ASM_ARCH_ZYLONITE_H
 
+#include <linux/soc/pxa/cpu.h>
+
 #define ZYLONITE_ETH_PHYS	0x14000000
 
 #define EXT_GPIO(x)		(128 + (x))
arch/arm/mach-pxa/zylonite_pxa300.c +1 -0
index 956fec1c4940..50a8a3547dbc 100644
@@ -17,6 +17,7 @@
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/platform_data/pca953x.h>
 #include <linux/gpio.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa300.h"
 #include "devices.h"
arch/arm/mach-pxa/zylonite_pxa320.c +1 -0
index 94cb834f36cd..67cab4f1194b 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/gpio.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa320.h"
 #include "zylonite.h"
drivers/clk/pxa/clk-pxa3xx.c +1 -0
index 60db92772e72..027b78183565 100644
@@ -14,6 +14,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
 #include <linux/of.h>
+#include <linux/soc/pxa/cpu.h>
 #include <mach/smemc.h>
 #include <mach/pxa3xx-regs.h>
 
drivers/cpufreq/pxa2xx-cpufreq.c +1 -0
index f0b6f52eb2c3..0f0e676ff781 100644
@@ -24,6 +24,7 @@
 #include <linux/cpufreq.h>
 #include <linux/err.h>
 #include <linux/regulator/consumer.h>
+#include <linux/soc/pxa/cpu.h>
 #include <linux/io.h>
 
 #include <mach/pxa2xx-regs.h>
drivers/cpufreq/pxa3xx-cpufreq.c +1 -0
index 32f993c94675..d3b398b4aa6a 100644
@@ -8,6 +8,7 @@
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/cpufreq.h>
+#include <linux/soc/pxa/cpu.h>
 #include <linux/slab.h>
 #include <linux/io.h>
 
drivers/input/mouse/pxa930_trkball.c +0 -1
index 41acde60b60f..fb04c851aaa7 100644
@@ -15,7 +15,6 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 
-#include <mach/hardware.h>
 #include <linux/platform_data/mouse-pxa930_trkball.h>
 
 /* Trackball Controller Register Definitions */
drivers/input/touchscreen/zylonite-wm97xx.c +1 -1
index 0f4ac7f844ce..f57bdf083188 100644
@@ -21,9 +21,9 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/soc/pxa/cpu.h>
 #include <linux/wm97xx.h>
 
-#include <mach/hardware.h>
 #include <mach/mfp.h>
 #include <mach/regs-ac97.h>
 
drivers/leds/leds-locomo.c +0 -1
index 42dc46e3f00f..9aa3fccd71fb 100644
@@ -11,7 +11,6 @@
 #include <linux/device.h>
 #include <linux/leds.h>
 
-#include <mach/hardware.h>
 #include <asm/hardware/locomo.h>
 
 static void locomoled_brightness_set(struct led_classdev *led_cdev,
drivers/mmc/host/pxamci.c +1 -1
index 024acc1b0a2e..26740966ca76 100644
@@ -31,10 +31,10 @@
 #include <linux/gfp.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <linux/sizes.h>
 
-#include <mach/hardware.h>
 #include <linux/platform_data/mmc-pxamci.h>
 
 #include "pxamci.h"
drivers/mtd/maps/pxa2xx-flash.c +0 -2
index 7d96758a8f04..1749dbbacc13 100644
@@ -16,8 +16,6 @@
 #include <linux/mtd/partitions.h>
 
 #include <asm/io.h>
-#include <mach/hardware.h>
-
 #include <asm/mach/flash.h>
 
 #define CACHELINESIZE	32
drivers/mtd/nand/raw/cmx270_nand.c +2 -1
index 045b6175ae79..7af3d0bdcdb8 100644
@@ -17,12 +17,13 @@
 #include <linux/slab.h>
 #include <linux/gpio.h>
 #include <linux/module.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/pxa2xx-regs.h>
+#include <mach/addr-map.h>
 
 #define GPIO_NAND_CS	(11)
 #define GPIO_NAND_RB	(89)
drivers/pcmcia/pxa2xx_base.c +1 -1
index d6d2f75f8f47..7cd1375d6087 100644
@@ -23,8 +23,8 @@
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
 #include <linux/platform_device.h>
+#include <linux/soc/pxa/cpu.h>
 
-#include <mach/hardware.h>
 #include <mach/smemc.h>
 #include <asm/io.h>
 #include <asm/irq.h>
drivers/pcmcia/pxa2xx_cm_x2xx.c +1 -1
index 14eae238131d..8c5040e55e24 100644
@@ -7,9 +7,9 @@
  */
 
 #include <linux/module.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 int cmx255_pcmcia_init(void);
 int cmx270_pcmcia_init(void);
drivers/pcmcia/pxa2xx_sharpsl.c +0 -1
index 5fdd25a9e28e..66fe1d1af12a 100644
@@ -15,7 +15,6 @@
 #include <linux/platform_device.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/hardware/scoop.h>
 
drivers/pcmcia/sa1111_generic.c +0 -1
index 11783410223b..2f556fa37c43 100644
@@ -17,7 +17,6 @@
 
 #include <pcmcia/ss.h>
 
-#include <mach/hardware.h>
 #include <asm/hardware/sa1111.h>
 #include <asm/mach-types.h>
 #include <asm/irq.h>
drivers/pcmcia/sa1111_lubbock.c +0 -1
index 7feb8d61c639..f1b5160cb8fa 100644
@@ -17,7 +17,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 
-#include <mach/hardware.h>
 #include <asm/hardware/sa1111.h>
 #include <asm/mach-types.h>
 
drivers/pcmcia/soc_common.c +0 -2
index 3a8c84bb174d..9276a628473d 100644
@@ -47,8 +47,6 @@
 #include <linux/spinlock.h>
 #include <linux/timer.h>
 
-#include <mach/hardware.h>
-
 #include "soc_common.h"
 
 static irqreturn_t soc_common_pcmcia_interrupt(int irq, void *dev);
drivers/rtc/rtc-pxa.c +0 -2
index d2f1d8f754bf..ea5da3edacd8 100644
@@ -16,8 +16,6 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 
-#include <mach/hardware.h>
-
 #include "rtc-sa1100.h"
 
 #define RTC_DEF_DIVIDER		(32768 - 1)
drivers/usb/host/ohci-pxa27x.c +1 -2
index 7679fb583e41..0dfe9b7c02e2 100644
@@ -36,8 +36,7 @@
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/usb/otg.h>
-
-#include <mach/hardware.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "ohci.h"
 
drivers/video/fbdev/pxafb.c +1 -1
index f70c9f79622e..ece691a0f18a 100644
@@ -57,10 +57,10 @@
 #include <linux/console.h>
 #include <linux/of_graph.h>
 #include <linux/regulator/consumer.h>
+#include <linux/soc/pxa/cpu.h>
 #include <video/of_display_timing.h>
 #include <video/videomode.h>
 
-#include <mach/hardware.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/div64.h>
drivers/watchdog/sa1100_wdt.c +0 -1
index cbd8c957182f..0f6ffc1e7f4e 100644
@@ -35,7 +35,6 @@
 #endif
 
 #include <mach/reset.h>
-#include <mach/hardware.h>
 
 static unsigned long oscr_freq;
 static unsigned long sa1100wdt_users;
include/linux/soc/pxa/cpu.h renamed from arch/arm/mach-pxa/include/mach/hardware.h +4 -57

77 lines not on this page · raw message

sound/arm/pxa2xx-ac97-lib.c +1 -0
index 58274b4a1f09..84d5f85073b9 100644
@@ -17,6 +17,7 @@
 #include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/of_gpio.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <sound/pxa2xx-lib.h>
 
sound/soc/pxa/pxa2xx-ac97.c +1 -1
index bf28187315db..eb99e01ee26f 100644
@@ -21,7 +21,7 @@
 #include <sound/pxa2xx-lib.h>
 #include <sound/dmaengine_pcm.h>
 
-#include <mach/hardware.h>
+#include <mach/pxa-regs.h>
 #include <mach/regs-ac97.h>
 #include <mach/audio.h>
 
sound/soc/pxa/pxa2xx-i2s.c +1 -1
index 9f7fb7335ac0..e7c43fe46dff 100644
@@ -21,7 +21,7 @@
 #include <sound/pxa2xx-lib.h>
 #include <sound/dmaengine_pcm.h>
 
-#include <mach/hardware.h>
+#include <mach/pxa-regs.h>
 #include <mach/audio.h>
 
 #include "pxa2xx-i2s.h"
sound/soc/pxa/z2.c +0 -1
index f9a33cb36f5b..8f121ca13eee 100644
@@ -21,7 +21,6 @@
 #include <sound/jack.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <mach/audio.h>
 #include <mach/z2.h>
 
Signature · 1 line
2.20.0
maintainer Acked-by on v1 5/46
#10 lore raw

Re: [PATCH 05/46] ARM: pxa: split up mach/hardware.h

Quoted 35 lines · Arnd Bergmann

The mach/hardware.h is included in lots of places, and it provides three different things on pxa:

- the cpu_is_pxa* macros
- an indirect inclusion of mach/addr-map.h
- the __REG() and io_pv2() helper macros

Split it up into separate <linux/soc/pxa/cpu.h> and mach/pxa-regs.h headers, then change all the files that use mach/hardware.h to include the exact set of those three headers that they actually need, allowing for further more targeted cleanup.

linux/soc/pxa/cpu.h can remain permanently exported and is now in a global location along with similar headers. pxa-regs.h and addr-map.h are only used in a very small number of drivers now and can be moved to arch/arm/mach-pxa/ directly when those drivers are to pass the necessary data as resources.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Jacek Anaszewski <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Dominik Brodowski <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Mark Brown <[email protected]>
Quoted 8 lines

For input bits:

Signature · 1 line
Dmitry
#11 lore raw

Re: [PATCH 05/46] ARM: pxa: split up mach/hardware.h

In reply to Arnd Bergmann
Quoted 35 lines · Arnd Bergmann

The mach/hardware.h is included in lots of places, and it provides three different things on pxa:

- the cpu_is_pxa* macros
- an indirect inclusion of mach/addr-map.h
- the __REG() and io_pv2() helper macros

Split it up into separate <linux/soc/pxa/cpu.h> and mach/pxa-regs.h headers, then change all the files that use mach/hardware.h to include the exact set of those three headers that they actually need, allowing for further more targeted cleanup.

linux/soc/pxa/cpu.h can remain permanently exported and is now in a global location along with similar headers. pxa-regs.h and addr-map.h are only used in a very small number of drivers now and can be moved to arch/arm/mach-pxa/ directly when those drivers are to pass the necessary data as resources.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Jacek Anaszewski <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Dominik Brodowski <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Mark Brown <[email protected]>
Quoted 8 lines

For rtc: Acked-by: Alexandre Belloni <[email protected]>

Quoted 1,308 lines
---
 arch/arm/common/locomo.c                      |  1 -
 arch/arm/common/sa1111.c                      |  5 +-
 arch/arm/mach-pxa/cm-x2xx.c                   |  2 +
 arch/arm/mach-pxa/cm-x300.c                   |  2 +
 arch/arm/mach-pxa/colibri-evalboard.c         |  1 -
 arch/arm/mach-pxa/colibri-pxa270-income.c     |  1 -
 arch/arm/mach-pxa/colibri-pxa300.c            |  1 +
 arch/arm/mach-pxa/colibri-pxa3xx.c            |  1 -
 arch/arm/mach-pxa/corgi.c                     |  1 -
 arch/arm/mach-pxa/corgi_pm.c                  |  1 -
 arch/arm/mach-pxa/csb726.c                    |  1 +
 arch/arm/mach-pxa/devices.c                   |  2 +-
 arch/arm/mach-pxa/ezx.c                       |  1 -
 arch/arm/mach-pxa/generic.c                   |  3 +-
 arch/arm/mach-pxa/gumstix.c                   |  1 -
 arch/arm/mach-pxa/hx4700.c                    |  2 +-
 arch/arm/mach-pxa/idp.c                       |  1 -
 arch/arm/mach-pxa/include/mach/pxa-regs.h     | 52 ++++++++++++++++
 arch/arm/mach-pxa/include/mach/pxa2xx-regs.h  |  2 +-
 arch/arm/mach-pxa/include/mach/pxa3xx-regs.h  |  2 +-
 arch/arm/mach-pxa/include/mach/regs-ac97.h    |  2 +-
 arch/arm/mach-pxa/include/mach/regs-ost.h     |  2 +-
 arch/arm/mach-pxa/include/mach/trizeps4.h     |  1 +
 arch/arm/mach-pxa/irq.c                       |  3 +-
 arch/arm/mach-pxa/littleton.c                 |  1 -
 arch/arm/mach-pxa/lpd270.c                    |  2 +-
 arch/arm/mach-pxa/lubbock.c                   |  1 -
 arch/arm/mach-pxa/magician.c                  |  2 +-
 arch/arm/mach-pxa/mainstone.c                 |  2 +-
 arch/arm/mach-pxa/mfp-pxa2xx.c                |  1 +
 arch/arm/mach-pxa/mfp-pxa3xx.c                |  1 -
 arch/arm/mach-pxa/poodle.c                    |  1 -
 arch/arm/mach-pxa/pxa-regs.h                  |  1 +
 arch/arm/mach-pxa/pxa25x.c                    |  3 +-
 arch/arm/mach-pxa/pxa25x.h                    |  2 +-
 arch/arm/mach-pxa/pxa27x-udc.h                |  2 +
 arch/arm/mach-pxa/pxa27x.c                    |  3 +-
 arch/arm/mach-pxa/pxa27x.h                    |  2 +-
 arch/arm/mach-pxa/pxa2xx.c                    |  1 -
 arch/arm/mach-pxa/pxa300.c                    |  1 +
 arch/arm/mach-pxa/pxa320.c                    |  1 +
 arch/arm/mach-pxa/pxa3xx-ulpi.c               |  2 +-
 arch/arm/mach-pxa/pxa3xx.c                    |  3 +-
 arch/arm/mach-pxa/pxa3xx.h                    |  2 +-
 arch/arm/mach-pxa/pxa930.c                    |  1 +
 arch/arm/mach-pxa/regs-rtc.h                  |  2 +-
 arch/arm/mach-pxa/regs-uart.h                 |  2 +
 arch/arm/mach-pxa/sleep.S                     |  1 -
 arch/arm/mach-pxa/smemc.c                     |  2 +-
 arch/arm/mach-pxa/spitz_pm.c                  |  1 -
 arch/arm/mach-pxa/standby.S                   |  1 -
 arch/arm/mach-pxa/xcep.c                      |  2 +-
 arch/arm/mach-pxa/zylonite.c                  |  1 +
 arch/arm/mach-pxa/zylonite.h                  |  2 +
 arch/arm/mach-pxa/zylonite_pxa300.c           |  1 +
 arch/arm/mach-pxa/zylonite_pxa320.c           |  1 +
 drivers/clk/pxa/clk-pxa3xx.c                  |  1 +
 drivers/cpufreq/pxa2xx-cpufreq.c              |  1 +
 drivers/cpufreq/pxa3xx-cpufreq.c              |  1 +
 drivers/input/mouse/pxa930_trkball.c          |  1 -
 drivers/input/touchscreen/zylonite-wm97xx.c   |  2 +-
 drivers/leds/leds-locomo.c                    |  1 -
 drivers/mmc/host/pxamci.c                     |  2 +-
 drivers/mtd/maps/pxa2xx-flash.c               |  2 -
 drivers/mtd/nand/raw/cmx270_nand.c            |  3 +-
 drivers/pcmcia/pxa2xx_base.c                  |  2 +-
 drivers/pcmcia/pxa2xx_cm_x2xx.c               |  2 +-
 drivers/pcmcia/pxa2xx_sharpsl.c               |  1 -
 drivers/pcmcia/sa1111_generic.c               |  1 -
 drivers/pcmcia/sa1111_lubbock.c               |  1 -
 drivers/pcmcia/soc_common.c                   |  2 -
 drivers/rtc/rtc-pxa.c                         |  2 -
 drivers/usb/host/ohci-pxa27x.c                |  3 +-
 drivers/video/fbdev/pxafb.c                   |  2 +-
 drivers/watchdog/sa1100_wdt.c                 |  1 -
 .../hardware.h => include/linux/soc/pxa/cpu.h | 61 ++-----------------
 sound/arm/pxa2xx-ac97-lib.c                   |  1 +
 sound/soc/pxa/pxa2xx-ac97.c                   |  2 +-
 sound/soc/pxa/pxa2xx-i2s.c                    |  2 +-
 sound/soc/pxa/z2.c                            |  1 -
 80 files changed, 121 insertions(+), 119 deletions(-)
 create mode 100644 arch/arm/mach-pxa/include/mach/pxa-regs.h
 create mode 100644 arch/arm/mach-pxa/pxa-regs.h
 rename arch/arm/mach-pxa/include/mach/hardware.h => include/linux/soc/pxa/cpu.h (75%)
arch/arm/common/locomo.c +0 -1
index 62f241b09fe3..fd9157121406 100644
@@ -23,7 +23,6 @@
 #include <linux/spinlock.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 
arch/arm/common/sa1111.c +4 -1
index 947ef7981d92..e2829af69f96 100644
@@ -26,13 +26,16 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
 #include <linux/sizes.h>
 
 #include <asm/hardware/sa1111.h>
 
+#ifdef CONFIG_ARCH_SA1100
+#include <mach/hardware.h>
+#endif
+
 /* SA1111 IRQs */
 #define IRQ_GPAIN0		(0)
 #define IRQ_GPAIN1		(1)
arch/arm/mach-pxa/cm-x2xx.c +2 -0
index ff976d1217eb..c731539add9f 100644
@@ -14,6 +14,7 @@
 
 #include <linux/dm9000.h>
 #include <linux/leds.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
@@ -32,6 +33,7 @@
 #undef GPIO88_GPIO
 #undef GPIO89_GPIO
 #include <mach/audio.h>
+#include <mach/addr-map.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <mach/smemc.h>
 
arch/arm/mach-pxa/cm-x300.c +2 -0
index 425855f456f2..f3f2703fffc6 100644
@@ -40,6 +40,8 @@
 #include <linux/spi/spi_gpio.h>
 #include <linux/spi/tdo24m.h>
 
+#include <linux/soc/pxa/cpu.h>
+
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/setup.h>
arch/arm/mach-pxa/colibri-evalboard.c +0 -1
index b9c173ede891..b62af07b8f96 100644
@@ -13,7 +13,6 @@
 #include <linux/interrupt.h>
 #include <linux/gpio/machine.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/mach/arch.h>
 #include <linux/i2c.h>
 #include <linux/platform_data/i2c-pxa.h>
arch/arm/mach-pxa/colibri-pxa270-income.c +0 -1
index dbad2f13706c..957dc9ad4873 100644
@@ -25,7 +25,6 @@
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/hardware.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pxa27x.h"
arch/arm/mach-pxa/colibri-pxa300.c +1 -0
index 82052dfd96b6..4ceeea142bfd 100644
@@ -13,6 +13,7 @@
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach-types.h>
 #include <linux/sizes.h>
arch/arm/mach-pxa/colibri-pxa3xx.c +0 -1
index 3cead80a2b37..701dfef930eb 100644
@@ -13,7 +13,6 @@
 #include <linux/gpio.h>
 #include <linux/etherdevice.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <linux/sizes.h>
 #include <asm/system_info.h>
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/corgi.c +0 -1
index f2d73289230f..e9743ebbee86 100644
@@ -39,7 +39,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/corgi_pm.c +0 -1
index 092dcb9fced5..ff1ac9bf37cb 100644
@@ -19,7 +19,6 @@
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 #include <mach/corgi.h>
 #include <mach/pxa2xx-regs.h>
arch/arm/mach-pxa/csb726.c +1 -0
index 98fcdc6e2944..d48493445ae5 100644
@@ -17,6 +17,7 @@
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
+
 #include "csb726.h"
 #include "pxa27x.h"
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/devices.c +1 -1
index 524d6093e0c7..c289a6c2311d 100644
@@ -8,6 +8,7 @@
 #include <linux/dmaengine.h>
 #include <linux/spi/pxa2xx_spi.h>
 #include <linux/platform_data/i2c-pxa.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "udc.h"
 #include <linux/platform_data/usb-pxa3xx-ulpi.h>
@@ -19,7 +20,6 @@
 #include <linux/platform_data/keypad-pxa27x.h>
 #include <linux/platform_data/media/camera-pxa.h>
 #include <mach/audio.h>
-#include <mach/hardware.h>
 #include <linux/platform_data/mmp_dma.h>
 #include <linux/platform_data/mtd-nand-pxa3xx.h>
 
arch/arm/mach-pxa/ezx.c +0 -1
index ec10851b63cf..a77c5988a446 100644
@@ -29,7 +29,6 @@
 #include "pxa27x.h"
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
-#include <mach/hardware.h>
 #include <linux/platform_data/keypad-pxa27x.h>
 #include <linux/platform_data/media/camera-pxa.h>
 
arch/arm/mach-pxa/generic.c +2 -1
index ab7cdffd7ea8..3c3cd90bb9b4 100644
@@ -17,11 +17,12 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/soc/pxa/cpu.h>
 
-#include <mach/hardware.h>
 #include <asm/mach/map.h>
 #include <asm/mach-types.h>
 
+#include <mach/addr-map.h>
 #include <mach/irqs.h>
 #include <mach/reset.h>
 #include <mach/smemc.h>
arch/arm/mach-pxa/gumstix.c +0 -1
index 4b4589cf431f..b50080d55fa4 100644
@@ -28,7 +28,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <linux/sizes.h>
 
arch/arm/mach-pxa/hx4700.c +1 -1
index 311268d186ab..4dce8834c5b6 100644
@@ -37,11 +37,11 @@
 #include <linux/usb/gpio_vbus.h>
 #include <linux/platform_data/i2c-pxa.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
 #include "pxa27x.h"
+#include <mach/addr-map.h>
 #include <mach/hx4700.h>
 #include <linux/platform_data/irda-pxaficp.h>
 
arch/arm/mach-pxa/idp.c +0 -1
index fb0850af8496..57c0511472bc 100644
@@ -22,7 +22,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/include/mach/pxa-regs.h new file +52 -0
new file mode 100644
index 000000000000..ba5120c06b8a
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *  Author:	Nicolas Pitre
+ *  Created:	Jun 15, 2001
+ *  Copyright:	MontaVista Software Inc.
+ */
+#ifndef __ASM_MACH_PXA_REGS_H
+#define __ASM_MACH_PXA_REGS_H
+
+/*
+ * Workarounds for at least 2 errata so far require this.
+ * The mapping is set in mach-pxa/generic.c.
+ */
+#define UNCACHED_PHYS_0		0xfe000000
+#define UNCACHED_PHYS_0_SIZE	0x00100000
+
+/*
+ * Intel PXA2xx internal register mapping:
+ *
+ * 0x40000000 - 0x41ffffff <--> 0xf2000000 - 0xf3ffffff
+ * 0x44000000 - 0x45ffffff <--> 0xf4000000 - 0xf5ffffff
+ * 0x48000000 - 0x49ffffff <--> 0xf6000000 - 0xf7ffffff
+ * 0x4c000000 - 0x4dffffff <--> 0xf8000000 - 0xf9ffffff
+ * 0x50000000 - 0x51ffffff <--> 0xfa000000 - 0xfbffffff
+ * 0x54000000 - 0x55ffffff <--> 0xfc000000 - 0xfdffffff
+ * 0x58000000 - 0x59ffffff <--> 0xfe000000 - 0xffffffff
+ *
+ * Note that not all PXA2xx chips implement all those addresses, and the
+ * kernel only maps the minimum needed range of this mapping.
+ */
+#define io_v2p(x) (0x3c000000 + ((x) & 0x01ffffff) + (((x) & 0x0e000000) << 1))
+#define io_p2v(x) IOMEM(0xf2000000 + ((x) & 0x01ffffff) + (((x) & 0x1c000000) >> 1))
+
+#ifndef __ASSEMBLY__
+# define __REG(x)	(*((volatile u32 __iomem *)io_p2v(x)))
+
+/* With indexed regs we don't want to feed the index through io_p2v()
+   especially if it is a variable, otherwise horrible code will result. */
+# define __REG2(x,y)	\
+	(*(volatile u32 __iomem*)((u32)&__REG(x) + (y)))
+
+# define __PREG(x)	(io_v2p((u32)&(x)))
+
+#else
+
+# define __REG(x)	io_p2v(x)
+# define __PREG(x)	io_v2p(x)
+
+#endif
+
+
+#endif
arch/arm/mach-pxa/include/mach/pxa2xx-regs.h +1 -1
index fa121e135915..f68b573ab4a0 100644
@@ -11,7 +11,7 @@
 #ifndef __PXA2XX_REGS_H
 #define __PXA2XX_REGS_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * Power Manager
arch/arm/mach-pxa/include/mach/pxa3xx-regs.h +1 -1
index 070f6c74196e..8eb1ba533e1c 100644
@@ -10,7 +10,7 @@
 #ifndef __ASM_ARCH_PXA3XX_REGS_H
 #define __ASM_ARCH_PXA3XX_REGS_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * Oscillator Configuration Register (OSCC)
arch/arm/mach-pxa/include/mach/regs-ac97.h +1 -1
index 1db96fd4df32..ec09b9635e25 100644
@@ -2,7 +2,7 @@
 #ifndef __ASM_ARCH_REGS_AC97_H
 #define __ASM_ARCH_REGS_AC97_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * AC97 Controller registers
arch/arm/mach-pxa/include/mach/regs-ost.h +1 -1
index deb564ed8ee7..109d0ed264df 100644
@@ -2,7 +2,7 @@
 #ifndef __ASM_MACH_REGS_OST_H
 #define __ASM_MACH_REGS_OST_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * OS Timer & Match Registers
arch/arm/mach-pxa/include/mach/trizeps4.h +1 -0
index 3cddb1428c5e..27926629f9c6 100644
@@ -11,6 +11,7 @@
 #ifndef _TRIPEPS4_H_
 #define _TRIPEPS4_H_
 
+#include <mach/addr-map.h>
 #include "irqs.h" /* PXA_GPIO_TO_IRQ */
 
 /* physical memory regions */
arch/arm/mach-pxa/irq.c +2 -1
index 74efc3ab595f..f25c30e8a834 100644
@@ -17,13 +17,14 @@
 #include <linux/irq.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/exception.h>
 
-#include <mach/hardware.h>
 #include <mach/irqs.h>
 
 #include "generic.h"
+#include "pxa-regs.h"
 
 #define ICIP			(0x000)
 #define ICMR			(0x004)
arch/arm/mach-pxa/littleton.c +0 -1
index 793f61375ee8..7486056e6cce 100644
@@ -31,7 +31,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/lpd270.c +1 -1
index 20e00e970385..1b7c2def3033 100644
@@ -28,7 +28,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <linux/sizes.h>
 
@@ -39,6 +38,7 @@
 
 #include "pxa27x.h"
 #include "lpd270.h"
+#include <mach/addr-map.h>
 #include <mach/audio.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/lubbock.c +0 -1
index 742d18a1f7dc..477d144f039c 100644
@@ -34,7 +34,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <linux/sizes.h>
 
arch/arm/mach-pxa/magician.c +1 -1
index e1a394ac3eea..ce4c677be868 100644
@@ -30,12 +30,12 @@
 #include <linux/usb/gpio_vbus.h>
 #include <linux/platform_data/i2c-pxa.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/system_info.h>
 
 #include "pxa27x.h"
+#include <mach/addr-map.h>
 #include <mach/magician.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/mainstone.c +1 -1
index ef79417ca001..16883c996c45 100644
@@ -35,7 +35,6 @@
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <linux/sizes.h>
 
@@ -52,6 +51,7 @@
 #include <linux/platform_data/irda-pxaficp.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/keypad-pxa27x.h>
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/mfp-pxa2xx.c +1 -0
index 6a5451b186c2..6bc7206fd2ac 100644
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/syscore_ops.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa2xx.h"
arch/arm/mach-pxa/mfp-pxa3xx.c +0 -1
index 56114df9700d..f26b5e5412cf 100644
@@ -16,7 +16,6 @@
 #include <linux/io.h>
 #include <linux/syscore_ops.h>
 
-#include <mach/hardware.h>
 #include "mfp-pxa3xx.h"
 #include <mach/pxa3xx-regs.h>
 
arch/arm/mach-pxa/poodle.c +0 -1
index 3a4ecc3c8f8b..8dd791ee49bf 100644
@@ -30,7 +30,6 @@
 #include <linux/mtd/sharpsl.h>
 #include <linux/memblock.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/irq.h>
 #include <asm/setup.h>
arch/arm/mach-pxa/pxa-regs.h new file +1 -0
new file mode 100644
index 000000000000..584d2ac592cc
@@ -0,0 +1 @@
+#include <mach/pxa-regs.h>
arch/arm/mach-pxa/pxa25x.c +2 -1
index 0d25cc45f825..305047ebd2f1 100644
@@ -26,14 +26,15 @@
 #include <linux/irq.h>
 #include <linux/irqchip.h>
 #include <linux/platform_data/mmp_dma.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
-#include <mach/hardware.h>
 #include <mach/irqs.h>
 #include "pxa25x.h"
 #include <mach/reset.h>
 #include "pm.h"
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/pxa25x.h +1 -1
index b58d0fbdb4db..403bc16c2ed2 100644
@@ -2,7 +2,7 @@
 #ifndef __MACH_PXA25x_H
 #define __MACH_PXA25x_H
 
-#include <mach/hardware.h>
+#include <mach/addr-map.h>
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa25x.h"
 #include <mach/irqs.h>
arch/arm/mach-pxa/pxa27x-udc.h +2 -0
index faf73804697f..2d3df3b1cb68 100644
@@ -2,6 +2,8 @@
 #ifndef _ASM_ARCH_PXA27X_UDC_H
 #define _ASM_ARCH_PXA27X_UDC_H
 
+#include "pxa-regs.h"
+
 #ifdef _ASM_ARCH_PXA25X_UDC_H
 #error You cannot include both PXA25x and PXA27x UDC support
 #endif
arch/arm/mach-pxa/pxa27x.c +2 -1
index f7e89831e85b..a81ac88ecbfd 100644
@@ -23,9 +23,9 @@
 #include <linux/irq.h>
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/platform_data/mmp_dma.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/map.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/suspend.h>
 #include <mach/irqs.h>
@@ -33,6 +33,7 @@
 #include <mach/reset.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pm.h"
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/pxa27x.h +1 -1
index abdc02fb4f03..6c99090647d2 100644
@@ -3,7 +3,7 @@
 #define __MACH_PXA27x_H
 
 #include <linux/suspend.h>
-#include <mach/hardware.h>
+#include <mach/addr-map.h>
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa27x.h"
 #include <mach/irqs.h>
arch/arm/mach-pxa/pxa2xx.c +0 -1
index 2d26cd2afbf3..ac72acb43e26 100644
@@ -12,7 +12,6 @@
 #include <linux/device.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa25x.h"
 #include <mach/reset.h>
arch/arm/mach-pxa/pxa300.c +1 -0
index 7f2f5a6a2263..f77ec118d5b9 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa300.h"
 
arch/arm/mach-pxa/pxa320.c +1 -0
index 78abcc741df7..e372e6c118de 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa320.h"
 
arch/arm/mach-pxa/pxa3xx-ulpi.c +1 -1
index 4bd7da1f8657..c29a7f0fa1b0 100644
@@ -21,8 +21,8 @@
 #include <linux/clk.h>
 #include <linux/usb.h>
 #include <linux/usb/otg.h>
+#include <linux/soc/pxa/cpu.h>
 
-#include <mach/hardware.h>
 #include "regs-u2d.h"
 #include <linux/platform_data/usb-pxa3xx-ulpi.h>
 
arch/arm/mach-pxa/pxa3xx.c +2 -1
index 6eb1c24d7395..fc84aed99481 100644
@@ -24,14 +24,15 @@
 #include <linux/syscore_ops.h>
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/platform_data/mmp_dma.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
-#include <mach/hardware.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/reset.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pm.h"
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 #include <mach/irqs.h>
 
arch/arm/mach-pxa/pxa3xx.h +1 -1
index 6d4502aa9d06..22ace053ea25 100644
@@ -2,7 +2,7 @@
 #ifndef __MACH_PXA3XX_H	
 #define __MACH_PXA3XX_H
 
-#include <mach/hardware.h>
+#include <mach/addr-map.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/irqs.h>
 
arch/arm/mach-pxa/pxa930.c +1 -0
index bf91de4267e5..b9021a40cbd1 100644
@@ -13,6 +13,7 @@
 #include <linux/irq.h>
 #include <linux/gpio-pxa.h>
 #include <linux/platform_device.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa930.h"
 
arch/arm/mach-pxa/regs-rtc.h +1 -1
index b1f9ff14e335..96255a0f595e 100644
@@ -2,7 +2,7 @@
 #ifndef __ASM_MACH_REGS_RTC_H
 #define __ASM_MACH_REGS_RTC_H
 
-#include <mach/hardware.h>
+#include "pxa-regs.h"
 
 /*
  * Real Time Clock
arch/arm/mach-pxa/regs-uart.h +2 -0
index 9a168f83afeb..490e9ca16297 100644
@@ -2,6 +2,8 @@
 #ifndef __ASM_ARCH_REGS_UART_H
 #define __ASM_ARCH_REGS_UART_H
 
+#include "pxa-regs.h"
+
 /*
  * UARTs
  */
arch/arm/mach-pxa/sleep.S +0 -1
index 6c5b3ffd2cd3..272efeb954f4 100644
@@ -13,7 +13,6 @@
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
 #include <mach/smemc.h>
 #include <mach/pxa2xx-regs.h>
 
arch/arm/mach-pxa/smemc.c +1 -1
index 32e82cc92ea5..47b99549d616 100644
@@ -8,8 +8,8 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/syscore_ops.h>
+#include <linux/soc/pxa/cpu.h>
 
-#include <mach/hardware.h>
 #include <mach/smemc.h>
 
 #ifdef CONFIG_PM
arch/arm/mach-pxa/spitz_pm.c +0 -1
index 25a1f8c5a738..201dabe883b6 100644
@@ -18,7 +18,6 @@
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 #include <mach/spitz.h>
 #include "pxa27x.h"
arch/arm/mach-pxa/standby.S +0 -1
index eab1645bb4ad..626fecdefb1c 100644
@@ -11,7 +11,6 @@
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
 
 #include <mach/pxa2xx-regs.h>
 
arch/arm/mach-pxa/xcep.c +1 -1
index f485146b899f..e6ab428287ae 100644
@@ -24,8 +24,8 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/map.h>
 
-#include <mach/hardware.h>
 #include "pxa25x.h"
+#include <mach/addr-map.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/zylonite.c +1 -0
index bf2ab5bd49ec..c56c86b35025 100644
@@ -20,6 +20,7 @@
 #include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/smc91x.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/zylonite.h +2 -0
index 7300ec2aac0d..afe3efcb8e04 100644
@@ -2,6 +2,8 @@
 #ifndef __ASM_ARCH_ZYLONITE_H
 #define __ASM_ARCH_ZYLONITE_H
 
+#include <linux/soc/pxa/cpu.h>
+
 #define ZYLONITE_ETH_PHYS	0x14000000
 
 #define EXT_GPIO(x)		(128 + (x))
arch/arm/mach-pxa/zylonite_pxa300.c +1 -0
index 956fec1c4940..50a8a3547dbc 100644
@@ -17,6 +17,7 @@
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/platform_data/pca953x.h>
 #include <linux/gpio.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa300.h"
 #include "devices.h"
arch/arm/mach-pxa/zylonite_pxa320.c +1 -0
index 94cb834f36cd..67cab4f1194b 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/gpio.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "pxa320.h"
 #include "zylonite.h"
drivers/clk/pxa/clk-pxa3xx.c +1 -0
index 60db92772e72..027b78183565 100644
@@ -14,6 +14,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
 #include <linux/of.h>
+#include <linux/soc/pxa/cpu.h>
 #include <mach/smemc.h>
 #include <mach/pxa3xx-regs.h>
 
drivers/cpufreq/pxa2xx-cpufreq.c +1 -0
index f0b6f52eb2c3..0f0e676ff781 100644
@@ -24,6 +24,7 @@
 #include <linux/cpufreq.h>
 #include <linux/err.h>
 #include <linux/regulator/consumer.h>
+#include <linux/soc/pxa/cpu.h>
 #include <linux/io.h>
 
 #include <mach/pxa2xx-regs.h>
drivers/cpufreq/pxa3xx-cpufreq.c +1 -0
index 32f993c94675..d3b398b4aa6a 100644
@@ -8,6 +8,7 @@
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/cpufreq.h>
+#include <linux/soc/pxa/cpu.h>
 #include <linux/slab.h>
 #include <linux/io.h>
 
drivers/input/mouse/pxa930_trkball.c +0 -1
index 41acde60b60f..fb04c851aaa7 100644
@@ -15,7 +15,6 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 
-#include <mach/hardware.h>
 #include <linux/platform_data/mouse-pxa930_trkball.h>
 
 /* Trackball Controller Register Definitions */
drivers/input/touchscreen/zylonite-wm97xx.c +1 -1
index 0f4ac7f844ce..f57bdf083188 100644
@@ -21,9 +21,9 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/soc/pxa/cpu.h>
 #include <linux/wm97xx.h>
 
-#include <mach/hardware.h>
 #include <mach/mfp.h>
 #include <mach/regs-ac97.h>
 
drivers/leds/leds-locomo.c +0 -1
index 42dc46e3f00f..9aa3fccd71fb 100644
@@ -11,7 +11,6 @@
 #include <linux/device.h>
 #include <linux/leds.h>
 
-#include <mach/hardware.h>
 #include <asm/hardware/locomo.h>
 
 static void locomoled_brightness_set(struct led_classdev *led_cdev,
drivers/mmc/host/pxamci.c +1 -1
index 024acc1b0a2e..26740966ca76 100644
@@ -31,10 +31,10 @@
 #include <linux/gfp.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <linux/sizes.h>
 
-#include <mach/hardware.h>
 #include <linux/platform_data/mmc-pxamci.h>
 
 #include "pxamci.h"
drivers/mtd/maps/pxa2xx-flash.c +0 -2
index 7d96758a8f04..1749dbbacc13 100644
@@ -16,8 +16,6 @@
 #include <linux/mtd/partitions.h>
 
 #include <asm/io.h>
-#include <mach/hardware.h>
-
 #include <asm/mach/flash.h>
 
 #define CACHELINESIZE	32
drivers/mtd/nand/raw/cmx270_nand.c +2 -1
index 045b6175ae79..7af3d0bdcdb8 100644
@@ -17,12 +17,13 @@
 #include <linux/slab.h>
 #include <linux/gpio.h>
 #include <linux/module.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/pxa2xx-regs.h>
+#include <mach/addr-map.h>
 
 #define GPIO_NAND_CS	(11)
 #define GPIO_NAND_RB	(89)
drivers/pcmcia/pxa2xx_base.c +1 -1
index d6d2f75f8f47..7cd1375d6087 100644
@@ -23,8 +23,8 @@
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
 #include <linux/platform_device.h>
+#include <linux/soc/pxa/cpu.h>
 
-#include <mach/hardware.h>
 #include <mach/smemc.h>
 #include <asm/io.h>
 #include <asm/irq.h>
drivers/pcmcia/pxa2xx_cm_x2xx.c +1 -1
index 14eae238131d..8c5040e55e24 100644
@@ -7,9 +7,9 @@
  */
 
 #include <linux/module.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 int cmx255_pcmcia_init(void);
 int cmx270_pcmcia_init(void);
drivers/pcmcia/pxa2xx_sharpsl.c +0 -1
index 5fdd25a9e28e..66fe1d1af12a 100644
@@ -15,7 +15,6 @@
 #include <linux/platform_device.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/hardware/scoop.h>
 
drivers/pcmcia/sa1111_generic.c +0 -1
index 11783410223b..2f556fa37c43 100644
@@ -17,7 +17,6 @@
 
 #include <pcmcia/ss.h>
 
-#include <mach/hardware.h>
 #include <asm/hardware/sa1111.h>
 #include <asm/mach-types.h>
 #include <asm/irq.h>
drivers/pcmcia/sa1111_lubbock.c +0 -1
index 7feb8d61c639..f1b5160cb8fa 100644
@@ -17,7 +17,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 
-#include <mach/hardware.h>
 #include <asm/hardware/sa1111.h>
 #include <asm/mach-types.h>
 
drivers/pcmcia/soc_common.c +0 -2
index 3a8c84bb174d..9276a628473d 100644
@@ -47,8 +47,6 @@
 #include <linux/spinlock.h>
 #include <linux/timer.h>
 
-#include <mach/hardware.h>
-
 #include "soc_common.h"
 
 static irqreturn_t soc_common_pcmcia_interrupt(int irq, void *dev);
drivers/rtc/rtc-pxa.c +0 -2
index d2f1d8f754bf..ea5da3edacd8 100644
@@ -16,8 +16,6 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 
-#include <mach/hardware.h>
-
 #include "rtc-sa1100.h"
 
 #define RTC_DEF_DIVIDER		(32768 - 1)
drivers/usb/host/ohci-pxa27x.c +1 -2
index 7679fb583e41..0dfe9b7c02e2 100644
@@ -36,8 +36,7 @@
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/usb/otg.h>
-
-#include <mach/hardware.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include "ohci.h"
 
drivers/video/fbdev/pxafb.c +1 -1
index f70c9f79622e..ece691a0f18a 100644
@@ -57,10 +57,10 @@
 #include <linux/console.h>
 #include <linux/of_graph.h>
 #include <linux/regulator/consumer.h>
+#include <linux/soc/pxa/cpu.h>
 #include <video/of_display_timing.h>
 #include <video/videomode.h>
 
-#include <mach/hardware.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/div64.h>
drivers/watchdog/sa1100_wdt.c +0 -1
index cbd8c957182f..0f6ffc1e7f4e 100644
@@ -35,7 +35,6 @@
 #endif
 
 #include <mach/reset.h>
-#include <mach/hardware.h>
 
 static unsigned long oscr_freq;
 static unsigned long sa1100wdt_users;
include/linux/soc/pxa/cpu.h renamed from arch/arm/mach-pxa/include/mach/hardware.h +4 -57
similarity index 75%
rename from arch/arm/mach-pxa/include/mach/hardware.h
rename to include/linux/soc/pxa/cpu.h
index ee7eab16135f..5782450ee45c 100644
@@ -1,61 +1,16 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- *  arch/arm/mach-pxa/include/mach/hardware.h
- *
  *  Author:	Nicolas Pitre
  *  Created:	Jun 15, 2001
  *  Copyright:	MontaVista Software Inc.
  */
 
-#ifndef __ASM_ARCH_HARDWARE_H
-#define __ASM_ARCH_HARDWARE_H
-
-#include <mach/addr-map.h>
-
-/*
- * Workarounds for at least 2 errata so far require this.
- * The mapping is set in mach-pxa/generic.c.
- */
-#define UNCACHED_PHYS_0		0xfe000000
-#define UNCACHED_PHYS_0_SIZE	0x00100000
-
-/*
- * Intel PXA2xx internal register mapping:
- *
- * 0x40000000 - 0x41ffffff <--> 0xf2000000 - 0xf3ffffff
- * 0x44000000 - 0x45ffffff <--> 0xf4000000 - 0xf5ffffff
- * 0x48000000 - 0x49ffffff <--> 0xf6000000 - 0xf7ffffff
- * 0x4c000000 - 0x4dffffff <--> 0xf8000000 - 0xf9ffffff
- * 0x50000000 - 0x51ffffff <--> 0xfa000000 - 0xfbffffff
- * 0x54000000 - 0x55ffffff <--> 0xfc000000 - 0xfdffffff
- * 0x58000000 - 0x59ffffff <--> 0xfe000000 - 0xffffffff
- *
- * Note that not all PXA2xx chips implement all those addresses, and the
- * kernel only maps the minimum needed range of this mapping.
- */
-#define io_v2p(x) (0x3c000000 + ((x) & 0x01ffffff) + (((x) & 0x0e000000) << 1))
-#define io_p2v(x) IOMEM(0xf2000000 + ((x) & 0x01ffffff) + (((x) & 0x1c000000) >> 1))
-
-#ifndef __ASSEMBLY__
-# define __REG(x)	(*((volatile u32 __iomem *)io_p2v(x)))
-
-/* With indexed regs we don't want to feed the index through io_p2v()
-   especially if it is a variable, otherwise horrible code will result. */
-# define __REG2(x,y)	\
-	(*(volatile u32 __iomem*)((u32)&__REG(x) + (y)))
-
-# define __PREG(x)	(io_v2p((u32)&(x)))
-
-#else
-
-# define __REG(x)	io_p2v(x)
-# define __PREG(x)	io_v2p(x)
-
-#endif
-
-#ifndef __ASSEMBLY__
+#ifndef __SOC_PXA_CPU_H
+#define __SOC_PXA_CPU_H
 
+#ifdef CONFIG_ARM
 #include <asm/cputype.h>
+#endif
 
 /*
  *   CPU     Stepping     CPU_ID         JTAG_ID
@@ -294,12 +249,4 @@
 		__cpu_is_pxa93x(read_cpuid_id());	\
 	 })
 
-
-/*
- * return current memory and LCD clock frequency in units of 10kHz
- */
-extern unsigned int get_memclk_frequency_10khz(void);
-
 #endif
-
-#endif  /* _ASM_ARCH_HARDWARE_H */
sound/arm/pxa2xx-ac97-lib.c +1 -0
index 58274b4a1f09..84d5f85073b9 100644
@@ -17,6 +17,7 @@
 #include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/of_gpio.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <sound/pxa2xx-lib.h>
 
sound/soc/pxa/pxa2xx-ac97.c +1 -1
index bf28187315db..eb99e01ee26f 100644
@@ -21,7 +21,7 @@
 #include <sound/pxa2xx-lib.h>
 #include <sound/dmaengine_pcm.h>
 
-#include <mach/hardware.h>
+#include <mach/pxa-regs.h>
 #include <mach/regs-ac97.h>
 #include <mach/audio.h>
 
sound/soc/pxa/pxa2xx-i2s.c +1 -1
index 9f7fb7335ac0..e7c43fe46dff 100644
@@ -21,7 +21,7 @@
 #include <sound/pxa2xx-lib.h>
 #include <sound/dmaengine_pcm.h>
 
-#include <mach/hardware.h>
+#include <mach/pxa-regs.h>
 #include <mach/audio.h>
 
 #include "pxa2xx-i2s.h"
sound/soc/pxa/z2.c +0 -1
index f9a33cb36f5b..8f121ca13eee 100644
@@ -21,7 +21,6 @@
 #include <sound/jack.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 #include <mach/audio.h>
 #include <mach/z2.h>
 
Signature · 1 line
2.20.0
Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
maintainer Acked-by on v1 5/46
#12 lore raw

Re: [PATCH 05/46] ARM: pxa: split up mach/hardware.h

In reply to Arnd Bergmann
Quoted 43 lines · Arnd Bergmann

The mach/hardware.h is included in lots of places, and it provides three different things on pxa:

- the cpu_is_pxa* macros
- an indirect inclusion of mach/addr-map.h
- the __REG() and io_pv2() helper macros

Split it up into separate <linux/soc/pxa/cpu.h> and mach/pxa-regs.h headers, then change all the files that use mach/hardware.h to include the exact set of those three headers that they actually need, allowing for further more targeted cleanup.

linux/soc/pxa/cpu.h can remain permanently exported and is now in a global location along with similar headers. pxa-regs.h and addr-map.h are only used in a very small number of drivers now and can be moved to arch/arm/mach-pxa/ directly when those drivers are to pass the necessary data as resources.

Quoted 3 lines
---
 drivers/cpufreq/pxa2xx-cpufreq.c              |  1 +
 drivers/cpufreq/pxa3xx-cpufreq.c              |  1 +
Signature · 1 line
viresh
Acked-by on v1 5/46
#13 lore raw

Re: [PATCH 05/46] ARM: pxa: split up mach/hardware.h

In reply to Arnd Bergmann
Quoted 36 lines · Arnd Bergmann

The mach/hardware.h is included in lots of places, and it provides three different things on pxa:

- the cpu_is_pxa* macros
- an indirect inclusion of mach/addr-map.h
- the __REG() and io_pv2() helper macros

Split it up into separate <linux/soc/pxa/cpu.h> and mach/pxa-regs.h headers, then change all the files that use mach/hardware.h to include the exact set of those three headers that they actually need, allowing for further more targeted cleanup.

linux/soc/pxa/cpu.h can remain permanently exported and is now in a global location along with similar headers. pxa-regs.h and addr-map.h are only used in a very small number of drivers now and can be moved to arch/arm/mach-pxa/ directly when those drivers are to pass the necessary data as resources.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Jacek Anaszewski <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Dominik Brodowski <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Mark Brown <[email protected]>
Quoted 8 lines

[...]

For the mmc part:

maintainer Acked-by on v1 5/46
#15 lore raw

Re: [PATCH 05/46] ARM: pxa: split up mach/hardware.h

In reply to Arnd Bergmann

Quoting Arnd Bergmann (2019-10-18 08:41:20)

Quoted 43 lines

The mach/hardware.h is included in lots of places, and it provides three different things on pxa:

- the cpu_is_pxa* macros
- an indirect inclusion of mach/addr-map.h
- the __REG() and io_pv2() helper macros

Split it up into separate <linux/soc/pxa/cpu.h> and mach/pxa-regs.h headers, then change all the files that use mach/hardware.h to include the exact set of those three headers that they actually need, allowing for further more targeted cleanup.

linux/soc/pxa/cpu.h can remain permanently exported and is now in a global location along with similar headers. pxa-regs.h and addr-map.h are only used in a very small number of drivers now and can be moved to arch/arm/mach-pxa/ directly when those drivers are to pass the necessary data as resources.

Quoted 1 line

---

maintainer
#16 lore raw

Re: [PATCH 05/46] ARM: pxa: split up mach/hardware.h

In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

The mach/hardware.h is included in lots of places, and it provides three different things on pxa:

- the cpu_is_pxa* macros
- an indirect inclusion of mach/addr-map.h
- the __REG() and io_pv2() helper macros

Split it up into separate <linux/soc/pxa/cpu.h> and mach/pxa-regs.h headers, then change all the files that use mach/hardware.h to include the exact set of those three headers that they actually need, allowing for further more targeted cleanup.

Quoted 5 lines

linux/soc/pxa/cpu.h can remain permanently exported and is now in a global location along with similar headers. pxa-regs.h and addr-map.h are only used in a very small number of drivers now and can be moved to arch/arm/mach-pxa/ directly when those drivers are to pass the necessary data as resources.

For the pxa part, that looks fine to me.
I'd like to focus a bit of Russell's attention to the sa11xx part (reminder in [1]), and more specifically :

- the change to drivers/pcmcia/soc_common.c
- the change to drivers/pcmcia/sa1111_generic.c

I must admit my knowledge of PCMCIA is relatively poor, and even if the patch looks harmless, one never knows if Assebet will ever by same after ...

Cheers.

--
Robert

[1] Extract of the patch for Russell's scrutiny

drivers/pcmcia/sa1111_generic.c line 22

Quoted 12 lines
drivers/pcmcia/sa1111_generic.c +0 -1
index 11783410223b..2f556fa37c43 100644
@@ -17,7 +17,6 @@
 
 #include <pcmcia/ss.h>
 
-#include <mach/hardware.h>
 #include <asm/hardware/sa1111.h>
 #include <asm/mach-types.h>
 #include <asm/irq.h>

... zip ...

Quoted 13 lines
drivers/pcmcia/soc_common.c +0 -2
index 3a8c84bb174d..9276a628473d 100644
@@ -47,8 +47,6 @@
 #include <linux/spinlock.h>
 #include <linux/timer.h>
 
-#include <mach/hardware.h>
-
 #include "soc_common.h"
 
 static irqreturn_t soc_common_pcmcia_interrupt(int irq, void *dev);
#17 lore raw

PATCH 6/46 ARM: pxa: stop using mach/bitfield.h

In reply to Arnd Bergmann

There are two identical copies of mach/bitfield.h, one for mach-sa1100 and one for mach-pxa. The pxafb driver only makes use of two macros, which can be trivially open-coded in the header.

Cc Bartlomiej Zolnierkiewicz <[email protected]>
---
 arch/arm/mach-pxa/idp.c                   | 1 -
 arch/arm/mach-pxa/include/mach/regs-lcd.h | 5 +++--
 arch/arm/mach-pxa/regs-u2d.h              | 2 --
 drivers/video/fbdev/pxafb.c               | 1 -
 4 files changed, 3 insertions(+), 6 deletions(-)
arch/arm/mach-pxa/idp.c +0 -1
index 57c0511472bc..525d01ddfbbb 100644
@@ -30,7 +30,6 @@
 #include "pxa25x.h"
 #include "idp.h"
 #include <linux/platform_data/video-pxafb.h>
-#include <mach/bitfield.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/smc91x.h>
 
arch/arm/mach-pxa/include/mach/regs-lcd.h +3 -2
index e2b6e3d1f625..6a434675f84a 100644
@@ -2,8 +2,6 @@
 #ifndef __ASM_ARCH_REGS_LCD_H
 #define __ASM_ARCH_REGS_LCD_H
 
-#include <mach/bitfield.h>
-
 /*
  * LCD Controller Registers and Bits Definitions
  */
@@ -86,6 +84,9 @@
 #define LCCR0_OUC	(1 << 25)	/* Overlay Underlay control bit */
 #define LCCR0_LDDALT	(1 << 26)	/* LDD alternate mapping control */
 
+#define Fld(Size, Shft)	(((Size) << 16) + (Shft))
+#define FShft(Field)	((Field) & 0x0000FFFF)
+
 #define LCCR1_PPL	Fld (10, 0)	/* Pixels Per Line - 1 */
 #define LCCR1_DisWdth(Pixel)	(((Pixel) - 1) << FShft (LCCR1_PPL))
 
arch/arm/mach-pxa/regs-u2d.h +0 -2
index fe4c80ad87ec..ab517ba62c9a 100644
@@ -2,8 +2,6 @@
 #ifndef __ASM_ARCH_PXA3xx_U2D_H
 #define __ASM_ARCH_PXA3xx_U2D_H
 
-#include <mach/bitfield.h>
-
 /*
  * USB2 device controller registers and bits definitions
  */
drivers/video/fbdev/pxafb.c +0 -1
index ece691a0f18a..e68b8a69db92 100644
@@ -64,7 +64,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/div64.h>
-#include <mach/bitfield.h>
 #include <linux/platform_data/video-pxafb.h>
 
 /*
Signature · 1 line
2.20.0
maintainer Acked-by on v1 6/46
#18 lore raw

Re: [PATCH 06/46] ARM: pxa: stop using mach/bitfield.h

Quoted 8 lines · Arnd Bergmann

There are two identical copies of mach/bitfield.h, one for mach-sa1100 and one for mach-pxa. The pxafb driver only makes use of two macros, which can be trivially open-coded in the header.

Cc Bartlomiej Zolnierkiewicz <[email protected]>

Cheers.

--
Robert

Acked-by on v1 6/46
#19 lore raw

Re: [PATCH 06/46] ARM: pxa: stop using mach/bitfield.h

In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

There are two identical copies of mach/bitfield.h, one for mach-sa1100 and one for mach-pxa. The pxafb driver only makes use of two macros, which can be trivially open-coded in the header.

Cc Bartlomiej Zolnierkiewicz <[email protected]>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 68 lines
---
 arch/arm/mach-pxa/idp.c                   | 1 -
 arch/arm/mach-pxa/include/mach/regs-lcd.h | 5 +++--
 arch/arm/mach-pxa/regs-u2d.h              | 2 --
 drivers/video/fbdev/pxafb.c               | 1 -
 4 files changed, 3 insertions(+), 6 deletions(-)
arch/arm/mach-pxa/idp.c +0 -1
index 57c0511472bc..525d01ddfbbb 100644
@@ -30,7 +30,6 @@
 #include "pxa25x.h"
 #include "idp.h"
 #include <linux/platform_data/video-pxafb.h>
-#include <mach/bitfield.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/smc91x.h>
 
arch/arm/mach-pxa/include/mach/regs-lcd.h +3 -2
index e2b6e3d1f625..6a434675f84a 100644
@@ -2,8 +2,6 @@
 #ifndef __ASM_ARCH_REGS_LCD_H
 #define __ASM_ARCH_REGS_LCD_H
 
-#include <mach/bitfield.h>
-
 /*
  * LCD Controller Registers and Bits Definitions
  */
@@ -86,6 +84,9 @@
 #define LCCR0_OUC	(1 << 25)	/* Overlay Underlay control bit */
 #define LCCR0_LDDALT	(1 << 26)	/* LDD alternate mapping control */
 
+#define Fld(Size, Shft)	(((Size) << 16) + (Shft))
+#define FShft(Field)	((Field) & 0x0000FFFF)
+
 #define LCCR1_PPL	Fld (10, 0)	/* Pixels Per Line - 1 */
 #define LCCR1_DisWdth(Pixel)	(((Pixel) - 1) << FShft (LCCR1_PPL))
 
arch/arm/mach-pxa/regs-u2d.h +0 -2
index fe4c80ad87ec..ab517ba62c9a 100644
@@ -2,8 +2,6 @@
 #ifndef __ASM_ARCH_PXA3xx_U2D_H
 #define __ASM_ARCH_PXA3xx_U2D_H
 
-#include <mach/bitfield.h>
-
 /*
  * USB2 device controller registers and bits definitions
  */
drivers/video/fbdev/pxafb.c +0 -1
index ece691a0f18a..e68b8a69db92 100644
@@ -64,7 +64,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/div64.h>
-#include <mach/bitfield.h>
 #include <linux/platform_data/video-pxafb.h>
 
 /*
#20 lore raw

PATCH 7/46 ARM: pxa: move mach/sound.h to linux/platform_data/

In reply to Arnd Bergmann

This is a basically a platform_data file, so move it out of the mach/* header directory.

Cc Marek Vasut <[email protected]>
Cc Tomas Cech <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Mark Brown <[email protected]>
---
 arch/arm/mach-pxa/balloon3.c                                  | 2 +-
 arch/arm/mach-pxa/cm-x2xx.c                                   | 2 +-
 arch/arm/mach-pxa/cm-x300.c                                   | 2 +-
 arch/arm/mach-pxa/colibri-pxa270.c                            | 2 +-
 arch/arm/mach-pxa/colibri-pxa300.c                            | 2 +-
 arch/arm/mach-pxa/colibri-pxa320.c                            | 2 +-
 arch/arm/mach-pxa/csb726.c                                    | 2 +-
 arch/arm/mach-pxa/devices.c                                   | 2 +-
 arch/arm/mach-pxa/em-x270.c                                   | 2 +-
 arch/arm/mach-pxa/eseries.c                                   | 2 +-
 arch/arm/mach-pxa/lpd270.c                                    | 2 +-
 arch/arm/mach-pxa/lubbock.c                                   | 2 +-
 arch/arm/mach-pxa/mainstone.c                                 | 2 +-
 arch/arm/mach-pxa/mioa701.c                                   | 2 +-
 arch/arm/mach-pxa/palm27x.c                                   | 2 +-
 arch/arm/mach-pxa/palmld.c                                    | 2 +-
 arch/arm/mach-pxa/palmt5.c                                    | 2 +-
 arch/arm/mach-pxa/palmtc.c                                    | 2 +-
 arch/arm/mach-pxa/palmte2.c                                   | 2 +-
 arch/arm/mach-pxa/palmtreo.c                                  | 2 +-
 arch/arm/mach-pxa/palmtx.c                                    | 2 +-
 arch/arm/mach-pxa/palmz72.c                                   | 2 +-
 arch/arm/mach-pxa/pcm990-baseboard.c                          | 2 +-
 arch/arm/mach-pxa/tosa.c                                      | 2 +-
 arch/arm/mach-pxa/trizeps4.c                                  | 2 +-
 arch/arm/mach-pxa/viper.c                                     | 2 +-
 arch/arm/mach-pxa/vpac270.c                                   | 2 +-
 arch/arm/mach-pxa/zeus.c                                      | 2 +-
 arch/arm/mach-pxa/zylonite.c                                  | 2 +-
 .../mach/audio.h => include/linux/platform_data/asoc-pxa.h    | 4 ++--
 sound/arm/pxa2xx-ac97-lib.c                                   | 2 +-
 sound/arm/pxa2xx-ac97.c                                       | 2 +-
 sound/soc/pxa/corgi.c                                         | 2 +-
 sound/soc/pxa/e740_wm9705.c                                   | 2 +-
 sound/soc/pxa/e750_wm9705.c                                   | 2 +-
 sound/soc/pxa/e800_wm9712.c                                   | 2 +-
 sound/soc/pxa/em-x270.c                                       | 2 +-
 sound/soc/pxa/mioa701_wm9713.c                                | 2 +-
 sound/soc/pxa/palm27x.c                                       | 2 +-
 sound/soc/pxa/poodle.c                                        | 2 +-
 sound/soc/pxa/pxa2xx-ac97.c                                   | 2 +-
 sound/soc/pxa/pxa2xx-i2s.c                                    | 2 +-
 sound/soc/pxa/tosa.c                                          | 2 +-
 sound/soc/pxa/z2.c                                            | 2 +-
 44 files changed, 45 insertions(+), 45 deletions(-)
 rename arch/arm/mach-pxa/include/mach/audio.h => include/linux/platform_data/asoc-pxa.h (93%)
arch/arm/mach-pxa/balloon3.c +1 -1
index 26140249c784..82f9299f67d3 100644
@@ -41,7 +41,7 @@
 
 #include "pxa27x.h"
 #include <mach/balloon3.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include "udc.h"
arch/arm/mach-pxa/cm-x2xx.c +1 -1
index c731539add9f..b13fcc72abab 100644
@@ -32,7 +32,7 @@
 #undef GPIO87_GPIO
 #undef GPIO88_GPIO
 #undef GPIO89_GPIO
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/addr-map.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <mach/smemc.h>
arch/arm/mach-pxa/cm-x300.c +1 -1
index f3f2703fffc6..6cdc440672a6 100644
@@ -53,7 +53,7 @@
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/mtd-nand-pxa3xx.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/usb-pxa3xx-ulpi.h>
 
 #include <asm/mach/map.h>
arch/arm/mach-pxa/colibri-pxa270.c +1 -1
index 2f2cd2ae4187..5dc669752836 100644
@@ -23,7 +23,7 @@
 #include <asm/mach-types.h>
 #include <linux/sizes.h>
 
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include "colibri.h"
 #include "pxa27x.h"
 
arch/arm/mach-pxa/colibri-pxa300.c +1 -1
index 4ceeea142bfd..11ca6c4795e7 100644
@@ -24,7 +24,7 @@
 #include "colibri.h"
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/video-pxafb.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 #include "generic.h"
 #include "devices.h"
arch/arm/mach-pxa/colibri-pxa320.c +1 -1
index eba917d69c0a..c1e97d4345dc 100644
@@ -24,7 +24,7 @@
 #include "colibri.h"
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include "pxa27x-udc.h"
 #include "udc.h"
 
arch/arm/mach-pxa/csb726.c +1 -1
index d48493445ae5..88f2f1d96c7b 100644
@@ -22,7 +22,7 @@
 #include "pxa27x.h"
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/devices.c +1 -1
index c289a6c2311d..233035e6a2ff 100644
@@ -19,7 +19,7 @@
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/keypad-pxa27x.h>
 #include <linux/platform_data/media/camera-pxa.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/mmp_dma.h>
 #include <linux/platform_data/mtd-nand-pxa3xx.h>
 
arch/arm/mach-pxa/em-x270.c +1 -1
index d8681a331030..5bb72a41dae2 100644
@@ -37,7 +37,7 @@
 
 #include "pxa27x.h"
 #include "pxa27x-udc.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/eseries.c +1 -1
index 91f7c3e40065..d8a87ff66675 100644
@@ -34,7 +34,7 @@
 #include "pxa25x.h"
 #include <mach/eseries-gpio.h>
 #include "eseries-irq.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include "udc.h"
 #include <linux/platform_data/irda-pxaficp.h>
arch/arm/mach-pxa/lpd270.c +1 -1
index 1b7c2def3033..c59fd2624f91 100644
@@ -39,7 +39,7 @@
 #include "pxa27x.h"
 #include "lpd270.h"
 #include <mach/addr-map.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/irda-pxaficp.h>
arch/arm/mach-pxa/lubbock.c +1 -1
index 477d144f039c..098605c8eeed 100644
@@ -45,7 +45,7 @@
 #include <asm/hardware/sa1111.h>
 
 #include "pxa25x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/lubbock.h>
 #include "udc.h"
 #include <linux/platform_data/irda-pxaficp.h>
arch/arm/mach-pxa/mainstone.c +1 -1
index 16883c996c45..ed505de6b5d9 100644
@@ -45,7 +45,7 @@
 
 #include "pxa27x.h"
 #include "mainstone.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/irda-pxaficp.h>
arch/arm/mach-pxa/mioa701.c +1 -1
index c360023a989c..c78d2d245309 100644
@@ -42,7 +42,7 @@
 #include "udc.h"
 #include "pxa27x-udc.h"
 #include <linux/platform_data/media/camera-pxa.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/smemc.h>
 
 #include "mioa701.h"
arch/arm/mach-pxa/palm27x.c +1 -1
index 3ad0b3915ae1..a93169a12ad7 100644
@@ -25,7 +25,7 @@
 #include <asm/mach/map.h>
 
 #include "pxa27x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/irda-pxaficp.h>
arch/arm/mach-pxa/palmld.c +1 -1
index 5f73716a77f0..d85146957004 100644
@@ -29,7 +29,7 @@
 #include <asm/mach/map.h>
 
 #include "pxa27x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/palmld.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
arch/arm/mach-pxa/palmt5.c +1 -1
index 902403367786..4e2cff87deba 100644
@@ -30,7 +30,7 @@
 #include <asm/mach/map.h>
 
 #include "pxa27x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include "palmt5.h"
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
arch/arm/mach-pxa/palmtc.c +1 -1
index f52bd155e825..71917127dfdd 100644
@@ -30,7 +30,7 @@
 #include <asm/mach/map.h>
 
 #include "pxa25x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/palmtc.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
arch/arm/mach-pxa/palmte2.c +1 -1
index a92b9665f425..1621d3d3f76f 100644
@@ -30,7 +30,7 @@
 #include <asm/mach/map.h>
 
 #include "pxa25x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include "palmte2.h"
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
arch/arm/mach-pxa/palmtreo.c +1 -1
index 2bf0f7f3ea24..d6d5b90d9578 100644
@@ -29,7 +29,7 @@
 
 #include "pxa27x.h"
 #include "pxa27x-udc.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include "palmtreo.h"
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
arch/arm/mach-pxa/palmtx.c +1 -1
index 926593ecf1c9..eed25d09dfb2 100644
@@ -33,7 +33,7 @@
 #include <asm/mach/map.h>
 
 #include "pxa27x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/palmtx.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
arch/arm/mach-pxa/palmz72.c +1 -1
index 77fe2e367324..1bf11c888b4e 100644
@@ -35,7 +35,7 @@
 #include <asm/mach/map.h>
 
 #include "pxa27x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include "palmz72.h"
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
arch/arm/mach-pxa/pcm990-baseboard.c +1 -1
index cb1c56769fbc..84af112fa819 100644
@@ -30,7 +30,7 @@
 #include <linux/platform_data/media/camera-pxa.h>
 #include <asm/mach/map.h>
 #include "pxa27x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pcm990_baseboard.h"
arch/arm/mach-pxa/tosa.c +1 -1
index f537ff1c3ba7..23da9568c520 100644
@@ -46,7 +46,7 @@
 #include <linux/platform_data/mmc-pxamci.h>
 #include "udc.h"
 #include "tosa_bt.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/smemc.h>
 
 #include <asm/mach/arch.h>
arch/arm/mach-pxa/trizeps4.c +1 -1
index f76f8be09554..1337008cc760 100644
@@ -41,7 +41,7 @@
 
 #include "pxa27x.h"
 #include <mach/trizeps4.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/irda-pxaficp.h>
arch/arm/mach-pxa/viper.c +1 -1
index 16f33e576902..7d1cb2c2dfa1 100644
@@ -46,7 +46,7 @@
 #include <linux/syscore_ops.h>
 
 #include "pxa25x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include "regs-uart.h"
 #include <linux/platform_data/pcmcia-pxa2xx_viper.h>
arch/arm/mach-pxa/vpac270.c +1 -1
index 26a5ebc00069..7abbebc5d455 100644
@@ -30,7 +30,7 @@
 #include <asm/mach/arch.h>
 
 #include "pxa27x.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/vpac270.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
arch/arm/mach-pxa/zeus.c +1 -1
index 239faff71a1f..6652b1e5978e 100644
@@ -46,7 +46,7 @@
 #include "udc.h"
 #include <linux/platform_data/video-pxafb.h>
 #include "pm.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/pcmcia-pxa2xx_viper.h>
 #include "zeus.h"
 #include <mach/smemc.h>
arch/arm/mach-pxa/zylonite.c +1 -1
index c56c86b35025..e3ae45f444d5 100644
@@ -25,7 +25,7 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include "pxa3xx.h"
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include "zylonite.h"
 #include <linux/platform_data/mmc-pxamci.h>
include/linux/platform_data/asoc-pxa.h renamed from arch/arm/mach-pxa/include/mach/audio.h +2 -2
similarity index 93%
rename from arch/arm/mach-pxa/include/mach/audio.h
rename to include/linux/platform_data/asoc-pxa.h
index 7beebf7297b5..327454cd8246 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_ARCH_AUDIO_H__
-#define __ASM_ARCH_AUDIO_H__
+#ifndef __SOC_PXA_AUDIO_H__
+#define __SOC_PXA_AUDIO_H__
 
 #include <sound/core.h>
 #include <sound/pcm.h>
sound/arm/pxa2xx-ac97-lib.c +1 -1
index 84d5f85073b9..9b5c1f0f8998 100644
@@ -23,7 +23,7 @@
 
 #include <mach/irqs.h>
 #include <mach/regs-ac97.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 static DEFINE_MUTEX(car_mutex);
 static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
sound/arm/pxa2xx-ac97.c +1 -1
index acfaf1d4ec25..2e99232028ac 100644
@@ -22,7 +22,7 @@
 #include <sound/dmaengine_pcm.h>
 
 #include <mach/regs-ac97.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 static void pxa2xx_ac97_legacy_reset(struct snd_ac97 *ac97)
 {
sound/soc/pxa/corgi.c +1 -1
index d81082323fb4..47647a1c3124 100644
@@ -22,7 +22,7 @@
 
 #include <asm/mach-types.h>
 #include <mach/corgi.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 #include "../codecs/wm8731.h"
 #include "pxa2xx-i2s.h"
sound/soc/pxa/e740_wm9705.c +1 -1
index eafa1482afbe..f922be7e0016 100644
@@ -13,7 +13,7 @@
 #include <sound/pcm.h>
 #include <sound/soc.h>
 
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/eseries-gpio.h>
 
 #include <asm/mach-types.h>
sound/soc/pxa/e750_wm9705.c +1 -1
index d75510d7b16b..308828cd736b 100644
@@ -13,7 +13,7 @@
 #include <sound/pcm.h>
 #include <sound/soc.h>
 
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/eseries-gpio.h>
 
 #include <asm/mach-types.h>
sound/soc/pxa/e800_wm9712.c +1 -1
index 56d543da938a..d74fcceef687 100644
@@ -14,7 +14,7 @@
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/eseries-gpio.h>
 
 static int e800_spk_amp_event(struct snd_soc_dapm_widget *w,
sound/soc/pxa/em-x270.c +1 -1
index 9076ea7e9339..b59ec22e1e7e 100644
@@ -23,7 +23,7 @@
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 SND_SOC_DAILINK_DEFS(ac97,
 	DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97")),
sound/soc/pxa/mioa701_wm9713.c +1 -1
index 129eb5251a5f..f78ab7ce8fc7 100644
@@ -33,7 +33,7 @@
 #include <linux/platform_device.h>
 
 #include <asm/mach-types.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
sound/soc/pxa/palm27x.c +1 -1
index b92ea1a0453f..275c86379e88 100644
@@ -20,7 +20,7 @@
 #include <sound/jack.h>
 
 #include <asm/mach-types.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/asoc-palm27x.h>
 
 static struct snd_soc_jack hs_jack;
sound/soc/pxa/poodle.c +1 -1
index 48d5c2252b10..f289c089aede 100644
@@ -22,7 +22,7 @@
 #include <asm/mach-types.h>
 #include <asm/hardware/locomo.h>
 #include <mach/poodle.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 #include "../codecs/wm8731.h"
 #include "pxa2xx-i2s.h"
sound/soc/pxa/pxa2xx-ac97.c +1 -1
index eb99e01ee26f..2138106fed23 100644
@@ -23,7 +23,7 @@
 
 #include <mach/pxa-regs.h>
 #include <mach/regs-ac97.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 static void pxa2xx_ac97_warm_reset(struct ac97_controller *adrv)
 {
sound/soc/pxa/pxa2xx-i2s.c +1 -1
index e7c43fe46dff..583b2de897c7 100644
@@ -22,7 +22,7 @@
 #include <sound/dmaengine_pcm.h>
 
 #include <mach/pxa-regs.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 #include "pxa2xx-i2s.h"
 
sound/soc/pxa/tosa.c +1 -1
index b429db25f884..81ee1bcf4c44 100644
@@ -24,7 +24,7 @@
 
 #include <asm/mach-types.h>
 #include <mach/tosa.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 
 #define TOSA_HP        0
 #define TOSA_MIC_INT   1
sound/soc/pxa/z2.c +1 -1
index 8f121ca13eee..1fb3e7ac42fa 100644
@@ -21,7 +21,7 @@
 #include <sound/jack.h>
 
 #include <asm/mach-types.h>
-#include <mach/audio.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include <mach/z2.h>
 
 #include "../codecs/wm8750.h"
Signature · 1 line
2.20.0
maintainer Acked-by on v1 7/46
#21 lore raw

Re: [PATCH 07/46] ARM: pxa: move mach/sound.h to linux/platform_data/

Quoted 2 lines · Arnd Bergmann

This is a basically a platform_data file, so move it out of the mach/* header directory.

maintainer Acked-by on v1 7/46
#22 lore raw

Re: [PATCH 07/46] ARM: pxa: move mach/sound.h to linux/platform_data/

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

This is a basically a platform_data file, so move it out of the mach/* header directory.

Cc Marek Vasut <[email protected]>
Cc Tomas Cech <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Mark Brown <[email protected]>

Cheers.

--
Robert

#23 lore raw

PATCH 8/46 ARM: pxa: move regs-lcd.h into driver

In reply to Arnd Bergmann

Only the pxafb driver uses this header, so move it into the same directory. The SMART_* macros are required by some platform data definitions and can go into the linux/platform_data/video-pxafb.h header.

---
 .../video/fbdev/pxa3xx-regs.h                 | 19 ----------------
 drivers/video/fbdev/pxafb.c                   |  1 +
 include/linux/platform_data/video-pxafb.h     | 22 ++++++++++++++++++-
 3 files changed, 22 insertions(+), 20 deletions(-)
 rename arch/arm/mach-pxa/include/mach/regs-lcd.h => drivers/video/fbdev/pxa3xx-regs.h (90%)
drivers/video/fbdev/pxa3xx-regs.h renamed from arch/arm/mach-pxa/include/mach/regs-lcd.h +0 -19
similarity index 90%
rename from arch/arm/mach-pxa/include/mach/regs-lcd.h
rename to drivers/video/fbdev/pxa3xx-regs.h
index 6a434675f84a..6a96610ef9b5 100644
@@ -177,23 +177,4 @@
 #define PRSR_ST_OK	(1 << 9)	/* Status OK */
 #define PRSR_CON_NT	(1 << 10)	/* Continue to Next Command */
 
-#define SMART_CMD_A0			 (0x1 << 8)
-#define SMART_CMD_READ_STATUS_REG	 (0x0 << 9)
-#define SMART_CMD_READ_FRAME_BUFFER	((0x0 << 9) | SMART_CMD_A0)
-#define SMART_CMD_WRITE_COMMAND		 (0x1 << 9)
-#define SMART_CMD_WRITE_DATA		((0x1 << 9) | SMART_CMD_A0)
-#define SMART_CMD_WRITE_FRAME		((0x2 << 9) | SMART_CMD_A0)
-#define SMART_CMD_WAIT_FOR_VSYNC	 (0x3 << 9)
-#define SMART_CMD_NOOP			 (0x4 << 9)
-#define SMART_CMD_INTERRUPT		 (0x5 << 9)
-
-#define SMART_CMD(x)	(SMART_CMD_WRITE_COMMAND | ((x) & 0xff))
-#define SMART_DAT(x)	(SMART_CMD_WRITE_DATA | ((x) & 0xff))
-
-/* SMART_DELAY() is introduced for software controlled delay primitive which
- * can be inserted between command sequences, unused command 0x6 is used here
- * and delay ranges from 0ms ~ 255ms
- */
-#define SMART_CMD_DELAY		(0x6 << 9)
-#define SMART_DELAY(ms)		(SMART_CMD_DELAY | ((ms) & 0xff))
 #endif /* __ASM_ARCH_REGS_LCD_H */
drivers/video/fbdev/pxafb.c +1 -0
index e68b8a69db92..a65453c6c390 100644
@@ -72,6 +72,7 @@
 #define DEBUG_VAR 1
 
 #include "pxafb.h"
+#include "pxa3xx-regs.h"
 
 /* Bits which should not be set in machine configuration structures */
 #define LCCR0_INVALID_CONFIG_MASK	(LCCR0_OUM | LCCR0_BM | LCCR0_QDM |\
include/linux/platform_data/video-pxafb.h +21 -1
index b3d574778326..6333bac166a5 100644
@@ -8,7 +8,6 @@
  */
 
 #include <linux/fb.h>
-#include <mach/regs-lcd.h>
 
 /*
  * Supported LCD connections
@@ -153,6 +152,27 @@ struct pxafb_mach_info {
 void pxa_set_fb_info(struct device *, struct pxafb_mach_info *);
 unsigned long pxafb_get_hsync_time(struct device *dev);
 
+/* smartpanel related */
+#define SMART_CMD_A0			 (0x1 << 8)
+#define SMART_CMD_READ_STATUS_REG	 (0x0 << 9)
+#define SMART_CMD_READ_FRAME_BUFFER	((0x0 << 9) | SMART_CMD_A0)
+#define SMART_CMD_WRITE_COMMAND		 (0x1 << 9)
+#define SMART_CMD_WRITE_DATA		((0x1 << 9) | SMART_CMD_A0)
+#define SMART_CMD_WRITE_FRAME		((0x2 << 9) | SMART_CMD_A0)
+#define SMART_CMD_WAIT_FOR_VSYNC	 (0x3 << 9)
+#define SMART_CMD_NOOP			 (0x4 << 9)
+#define SMART_CMD_INTERRUPT		 (0x5 << 9)
+
+#define SMART_CMD(x)	(SMART_CMD_WRITE_COMMAND | ((x) & 0xff))
+#define SMART_DAT(x)	(SMART_CMD_WRITE_DATA | ((x) & 0xff))
+
+/* SMART_DELAY() is introduced for software controlled delay primitive which
+ * can be inserted between command sequences, unused command 0x6 is used here
+ * and delay ranges from 0ms ~ 255ms
+ */
+#define SMART_CMD_DELAY		(0x6 << 9)
+#define SMART_DELAY(ms)		(SMART_CMD_DELAY | ((ms) & 0xff))
+
 #ifdef CONFIG_FB_PXA_SMARTPANEL
 extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int);
 extern int pxafb_smart_flush(struct fb_info *info);
Signature · 1 line
2.20.0
maintainer Acked-by on v1 8/46
#24 lore raw

Re: [PATCH 08/46] ARM: pxa: move regs-lcd.h into driver

Quoted 9 lines · Arnd Bergmann

Only the pxafb driver uses this header, so move it into the same directory. The SMART_* macros are required by some platform data definitions and can go into the linux/platform_data/video-pxafb.h header.

Cheers.

--
Robert

Acked-by on v1 8/46
#25 lore raw

Re: [PATCH 08/46] ARM: pxa: move regs-lcd.h into driver

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

Only the pxafb driver uses this header, so move it into the same directory. The SMART_* macros are required by some platform data definitions and can go into the linux/platform_data/video-pxafb.h header.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 91 lines
---
 .../video/fbdev/pxa3xx-regs.h                 | 19 ----------------
 drivers/video/fbdev/pxafb.c                   |  1 +
 include/linux/platform_data/video-pxafb.h     | 22 ++++++++++++++++++-
 3 files changed, 22 insertions(+), 20 deletions(-)
 rename arch/arm/mach-pxa/include/mach/regs-lcd.h => drivers/video/fbdev/pxa3xx-regs.h (90%)
drivers/video/fbdev/pxa3xx-regs.h renamed from arch/arm/mach-pxa/include/mach/regs-lcd.h +0 -19
similarity index 90%
rename from arch/arm/mach-pxa/include/mach/regs-lcd.h
rename to drivers/video/fbdev/pxa3xx-regs.h
index 6a434675f84a..6a96610ef9b5 100644
@@ -177,23 +177,4 @@
 #define PRSR_ST_OK	(1 << 9)	/* Status OK */
 #define PRSR_CON_NT	(1 << 10)	/* Continue to Next Command */
 
-#define SMART_CMD_A0			 (0x1 << 8)
-#define SMART_CMD_READ_STATUS_REG	 (0x0 << 9)
-#define SMART_CMD_READ_FRAME_BUFFER	((0x0 << 9) | SMART_CMD_A0)
-#define SMART_CMD_WRITE_COMMAND		 (0x1 << 9)
-#define SMART_CMD_WRITE_DATA		((0x1 << 9) | SMART_CMD_A0)
-#define SMART_CMD_WRITE_FRAME		((0x2 << 9) | SMART_CMD_A0)
-#define SMART_CMD_WAIT_FOR_VSYNC	 (0x3 << 9)
-#define SMART_CMD_NOOP			 (0x4 << 9)
-#define SMART_CMD_INTERRUPT		 (0x5 << 9)
-
-#define SMART_CMD(x)	(SMART_CMD_WRITE_COMMAND | ((x) & 0xff))
-#define SMART_DAT(x)	(SMART_CMD_WRITE_DATA | ((x) & 0xff))
-
-/* SMART_DELAY() is introduced for software controlled delay primitive which
- * can be inserted between command sequences, unused command 0x6 is used here
- * and delay ranges from 0ms ~ 255ms
- */
-#define SMART_CMD_DELAY		(0x6 << 9)
-#define SMART_DELAY(ms)		(SMART_CMD_DELAY | ((ms) & 0xff))
 #endif /* __ASM_ARCH_REGS_LCD_H */
drivers/video/fbdev/pxafb.c +1 -0
index e68b8a69db92..a65453c6c390 100644
@@ -72,6 +72,7 @@
 #define DEBUG_VAR 1
 
 #include "pxafb.h"
+#include "pxa3xx-regs.h"
 
 /* Bits which should not be set in machine configuration structures */
 #define LCCR0_INVALID_CONFIG_MASK	(LCCR0_OUM | LCCR0_BM | LCCR0_QDM |\
include/linux/platform_data/video-pxafb.h +21 -1
index b3d574778326..6333bac166a5 100644
@@ -8,7 +8,6 @@
  */
 
 #include <linux/fb.h>
-#include <mach/regs-lcd.h>
 
 /*
  * Supported LCD connections
@@ -153,6 +152,27 @@ struct pxafb_mach_info {
 void pxa_set_fb_info(struct device *, struct pxafb_mach_info *);
 unsigned long pxafb_get_hsync_time(struct device *dev);
 
+/* smartpanel related */
+#define SMART_CMD_A0			 (0x1 << 8)
+#define SMART_CMD_READ_STATUS_REG	 (0x0 << 9)
+#define SMART_CMD_READ_FRAME_BUFFER	((0x0 << 9) | SMART_CMD_A0)
+#define SMART_CMD_WRITE_COMMAND		 (0x1 << 9)
+#define SMART_CMD_WRITE_DATA		((0x1 << 9) | SMART_CMD_A0)
+#define SMART_CMD_WRITE_FRAME		((0x2 << 9) | SMART_CMD_A0)
+#define SMART_CMD_WAIT_FOR_VSYNC	 (0x3 << 9)
+#define SMART_CMD_NOOP			 (0x4 << 9)
+#define SMART_CMD_INTERRUPT		 (0x5 << 9)
+
+#define SMART_CMD(x)	(SMART_CMD_WRITE_COMMAND | ((x) & 0xff))
+#define SMART_DAT(x)	(SMART_CMD_WRITE_DATA | ((x) & 0xff))
+
+/* SMART_DELAY() is introduced for software controlled delay primitive which
+ * can be inserted between command sequences, unused command 0x6 is used here
+ * and delay ranges from 0ms ~ 255ms
+ */
+#define SMART_CMD_DELAY		(0x6 << 9)
+#define SMART_DELAY(ms)		(SMART_CMD_DELAY | ((ms) & 0xff))
+
 #ifdef CONFIG_FB_PXA_SMARTPANEL
 extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int);
 extern int pxafb_smart_flush(struct fb_info *info);
#26 lore raw

PATCH 9/46 watchdog: sa1100: use platform device registration

In reply to Arnd Bergmann

Rather than relying on machine specific headers to pass down the reboot status and the register locations, use resources and platform_data.

Aside from this, keep the changes to a minimum.

---
 arch/arm/mach-pxa/devices.c               | 11 +++
 arch/arm/mach-pxa/include/mach/regs-ost.h |  2 +
 arch/arm/mach-pxa/include/mach/reset.h    |  2 +-
 arch/arm/mach-pxa/pxa25x.c                |  2 +-
 arch/arm/mach-pxa/pxa27x.c                |  2 +-
 arch/arm/mach-pxa/pxa3xx.c                |  2 +-
 arch/arm/mach-pxa/reset.c                 |  3 -
 arch/arm/mach-sa1100/generic.c            |  6 +-
 arch/arm/mach-sa1100/include/mach/reset.h |  1 -
 drivers/watchdog/sa1100_wdt.c             | 87 ++++++++++++++++-------
 10 files changed, 83 insertions(+), 35 deletions(-)
arch/arm/mach-pxa/devices.c +11 -0
index 233035e6a2ff..fb9b4f6d32de 100644
@@ -23,6 +23,8 @@
 #include <linux/platform_data/mmp_dma.h>
 #include <linux/platform_data/mtd-nand-pxa3xx.h>
 
+#include <mach/regs-ost.h>
+#include <mach/reset.h>
 #include "devices.h"
 #include "generic.h"
 
@@ -1110,3 +1112,12 @@ void __init pxa2xx_set_dmac_info(struct mmp_dma_platdata *dma_pdata)
 {
 	pxa_register_device(&pxa2xx_pxa_dma, dma_pdata);
 }
+
+void __init pxa_register_wdt(unsigned int reset_status)
+{
+	struct resource res = DEFINE_RES_MEM(OST_PHYS, OST_LEN);
+
+	reset_status &= RESET_STATUS_WATCHDOG;
+	platform_device_register_resndata(NULL, "sa1100_wdt", -1, &res, 1,
+					  &reset_status, sizeof(reset_status));
+}
arch/arm/mach-pxa/include/mach/regs-ost.h +2 -0
index 109d0ed264df..c8001cfc8d6b 100644
@@ -7,6 +7,8 @@
 /*
  * OS Timer & Match Registers
  */
+#define OST_PHYS	0x40A00000
+#define OST_LEN		0x00000020
 
 #define OSMR0		io_p2v(0x40A00000)  /* */
 #define OSMR1		io_p2v(0x40A00004)  /* */
arch/arm/mach-pxa/include/mach/reset.h +1 -1
index e1c4d100fd45..963dd190bc13 100644
@@ -8,8 +8,8 @@
 #define RESET_STATUS_GPIO	(1 << 3)	/* GPIO Reset */
 #define RESET_STATUS_ALL	(0xf)
 
-extern unsigned int reset_status;
 extern void clear_reset_status(unsigned int mask);
+extern void pxa_register_wdt(unsigned int reset_status);
 
 /**
  * init_gpio_reset() - register GPIO as reset generator
arch/arm/mach-pxa/pxa25x.c +1 -1
index 305047ebd2f1..dfc90b41fba3 100644
@@ -240,7 +240,7 @@ static int __init pxa25x_init(void)
 
 	if (cpu_is_pxa25x()) {
 
-		reset_status = RCSR;
+		pxa_register_wdt(RCSR);
 
 		pxa25x_init_pm();
 
arch/arm/mach-pxa/pxa27x.c +1 -1
index a81ac88ecbfd..38fdd22c4dc5 100644
@@ -337,7 +337,7 @@ static int __init pxa27x_init(void)
 
 	if (cpu_is_pxa27x()) {
 
-		reset_status = RCSR;
+		pxa_register_wdt(RCSR);
 
 		pxa27x_init_pm();
 
arch/arm/mach-pxa/pxa3xx.c +1 -1
index fc84aed99481..7c569fa2a6da 100644
@@ -463,7 +463,7 @@ static int __init pxa3xx_init(void)
 
 	if (cpu_is_pxa3xx()) {
 
-		reset_status = ARSR;
+		pxa_register_wdt(ARSR);
 
 		/*
 		 * clear RDH bit every time after reset
arch/arm/mach-pxa/reset.c +0 -3
index af78405aa4e9..fcb791c5ae3e 100644
@@ -11,9 +11,6 @@
 #include <mach/reset.h>
 #include <mach/smemc.h>
 
-unsigned int reset_status;
-EXPORT_SYMBOL(reset_status);
-
 static void do_hw_reset(void);
 
 static int reset_gpio = -1;
arch/arm/mach-sa1100/generic.c +3 -3
index 4dfb7554649d..6c21f214cd60 100644
@@ -39,9 +39,6 @@
 #include "generic.h"
 #include <clocksource/pxa.h>
 
-unsigned int reset_status;
-EXPORT_SYMBOL(reset_status);
-
 #define NR_FREQS	16
 
 /*
@@ -319,10 +316,13 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
 static int __init sa1100_init(void)
 {
+	struct resource wdt_res = DEFINE_RES_MEM(0x90000000, 0x20);
 	pm_power_off = sa1100_power_off;
 
 	regulator_has_full_constraints();
 
+	platform_device_register_simple("sa1100_wdt", -1, &wdt_res, 1);
+
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
 
arch/arm/mach-sa1100/include/mach/reset.h +0 -1
index 27695650a567..a6723d45ae2a 100644
@@ -10,7 +10,6 @@
 #define RESET_STATUS_GPIO	(1 << 3)	/* GPIO Reset */
 #define RESET_STATUS_ALL	(0xf)
 
-extern unsigned int reset_status;
 static inline void clear_reset_status(unsigned int mask)
 {
 	RCSR = mask;
drivers/watchdog/sa1100_wdt.c +63 -24

163 lines not on this page · raw message

Signature · 1 line
2.20.0
maintainer
#27 lore raw

Re: [PATCH 09/46] watchdog: sa1100: use platform device registration

Quoted 145 lines · Arnd Bergmann

Rather than relying on machine specific headers to pass down the reboot status and the register locations, use resources and platform_data.

Aside from this, keep the changes to a minimum.

---
  arch/arm/mach-pxa/devices.c               | 11 +++
  arch/arm/mach-pxa/include/mach/regs-ost.h |  2 +
  arch/arm/mach-pxa/include/mach/reset.h    |  2 +-
  arch/arm/mach-pxa/pxa25x.c                |  2 +-
  arch/arm/mach-pxa/pxa27x.c                |  2 +-
  arch/arm/mach-pxa/pxa3xx.c                |  2 +-
  arch/arm/mach-pxa/reset.c                 |  3 -
  arch/arm/mach-sa1100/generic.c            |  6 +-
  arch/arm/mach-sa1100/include/mach/reset.h |  1 -
  drivers/watchdog/sa1100_wdt.c             | 87 ++++++++++++++++-------
  10 files changed, 83 insertions(+), 35 deletions(-)
arch/arm/mach-pxa/devices.c +11 -0
index 233035e6a2ff..fb9b4f6d32de 100644
@@ -23,6 +23,8 @@
  #include <linux/platform_data/mmp_dma.h>
  #include <linux/platform_data/mtd-nand-pxa3xx.h>
 
+#include <mach/regs-ost.h>
+#include <mach/reset.h>
  #include "devices.h"
  #include "generic.h"
 
@@ -1110,3 +1112,12 @@ void __init pxa2xx_set_dmac_info(struct mmp_dma_platdata *dma_pdata)
  {
  	pxa_register_device(&pxa2xx_pxa_dma, dma_pdata);
  }
+
+void __init pxa_register_wdt(unsigned int reset_status)
+{
+	struct resource res = DEFINE_RES_MEM(OST_PHYS, OST_LEN);
+
+	reset_status &= RESET_STATUS_WATCHDOG;
+	platform_device_register_resndata(NULL, "sa1100_wdt", -1, &res, 1,
+					  &reset_status, sizeof(reset_status));
+}
arch/arm/mach-pxa/include/mach/regs-ost.h +2 -0
index 109d0ed264df..c8001cfc8d6b 100644
@@ -7,6 +7,8 @@
  /*
   * OS Timer & Match Registers
   */
+#define OST_PHYS	0x40A00000
+#define OST_LEN		0x00000020
 
  #define OSMR0		io_p2v(0x40A00000)  /* */
  #define OSMR1		io_p2v(0x40A00004)  /* */
arch/arm/mach-pxa/include/mach/reset.h +1 -1
index e1c4d100fd45..963dd190bc13 100644
@@ -8,8 +8,8 @@
  #define RESET_STATUS_GPIO	(1 << 3)	/* GPIO Reset */
  #define RESET_STATUS_ALL	(0xf)
 
-extern unsigned int reset_status;
  extern void clear_reset_status(unsigned int mask);
+extern void pxa_register_wdt(unsigned int reset_status);
 
  /**
   * init_gpio_reset() - register GPIO as reset generator
arch/arm/mach-pxa/pxa25x.c +1 -1
index 305047ebd2f1..dfc90b41fba3 100644
@@ -240,7 +240,7 @@ static int __init pxa25x_init(void)
 
  	if (cpu_is_pxa25x()) {
 
-		reset_status = RCSR;
+		pxa_register_wdt(RCSR);
 
  		pxa25x_init_pm();
 
arch/arm/mach-pxa/pxa27x.c +1 -1
index a81ac88ecbfd..38fdd22c4dc5 100644
@@ -337,7 +337,7 @@ static int __init pxa27x_init(void)
 
  	if (cpu_is_pxa27x()) {
 
-		reset_status = RCSR;
+		pxa_register_wdt(RCSR);
 
  		pxa27x_init_pm();
 
arch/arm/mach-pxa/pxa3xx.c +1 -1
index fc84aed99481..7c569fa2a6da 100644
@@ -463,7 +463,7 @@ static int __init pxa3xx_init(void)
 
  	if (cpu_is_pxa3xx()) {
 
-		reset_status = ARSR;
+		pxa_register_wdt(ARSR);
 
  		/*
  		 * clear RDH bit every time after reset
arch/arm/mach-pxa/reset.c +0 -3
index af78405aa4e9..fcb791c5ae3e 100644
@@ -11,9 +11,6 @@
  #include <mach/reset.h>
  #include <mach/smemc.h>
 
-unsigned int reset_status;
-EXPORT_SYMBOL(reset_status);
-
  static void do_hw_reset(void);
 
  static int reset_gpio = -1;
arch/arm/mach-sa1100/generic.c +0 -3
index 4dfb7554649d..6c21f214cd60 100644
@@ -39,9 +39,6 @@
  #include "generic.h"
  #include <clocksource/pxa.h>
 
-unsigned int reset_status;
-EXPORT_SYMBOL(reset_status);
-
  #define NR_FREQS	16
 
  /*
@@ -319,10 +316,13 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 

arch/arm/mach-sa1100/generic.c static struct platform_device *sa11x0_devices[] __initdata = { · line 326

Quoted 10 lines
arch/arm/mach-sa1100/generic.c +3 -0
  static int __init sa1100_init(void)
  {
+	struct resource wdt_res = DEFINE_RES_MEM(0x90000000, 0x20);
  	pm_power_off = sa1100_power_off;
 
  	regulator_has_full_constraints();
 
+	platform_device_register_simple("sa1100_wdt", -1, &wdt_res, 1);
+
  	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));

Wouldn't it be better to add the watchdog device to sa11x0_devices ?

Quoted 133 lines
arch/arm/mach-sa1100/generic.c +0 -0
  }
 
arch/arm/mach-sa1100/include/mach/reset.h +0 -1
index 27695650a567..a6723d45ae2a 100644
@@ -10,7 +10,6 @@
  #define RESET_STATUS_GPIO	(1 << 3)	/* GPIO Reset */
  #define RESET_STATUS_ALL	(0xf)
 
-extern unsigned int reset_status;
  static inline void clear_reset_status(unsigned int mask)
  {
  	RCSR = mask;
drivers/watchdog/sa1100_wdt.c +40 -14
index 0f6ffc1e7f4e..a24d6a07c7a7 100644
@@ -22,6 +22,7 @@
  #include <linux/types.h>
  #include <linux/kernel.h>
  #include <linux/fs.h>
+#include <linux/platform_device.h>
  #include <linux/miscdevice.h>
  #include <linux/watchdog.h>
  #include <linux/init.h>
@@ -30,16 +31,42 @@
  #include <linux/uaccess.h>
  #include <linux/timex.h>
 
-#ifdef CONFIG_ARCH_PXA
-#include <mach/regs-ost.h>
-#endif
+#define REG_OSMR0  	0x0000  /* OS timer Match Reg. 0 */
+#define REG_OSMR1  	0x0004  /* OS timer Match Reg. 1 */
+#define REG_OSMR2  	0x0008  /* OS timer Match Reg. 2 */
+#define REG_OSMR3  	0x000c  /* OS timer Match Reg. 3 */
+#define REG_OSCR   	0x0010  /* OS timer Counter Reg. */
+#define REG_OSSR   	0x0014  /* OS timer Status Reg. */
+#define REG_OWER   	0x0018  /* OS timer Watch-dog Enable Reg. */
+#define REG_OIER  	0x001C  /* OS timer Interrupt Enable Reg. */
 
-#include <mach/reset.h>
+#define OSSR_M3		(1 << 3)	/* Match status channel 3 */
+#define OSSR_M2		(1 << 2)	/* Match status channel 2 */
+#define OSSR_M1		(1 << 1)	/* Match status channel 1 */
+#define OSSR_M0		(1 << 0)	/* Match status channel 0 */
+
+#define OWER_WME	(1 << 0)	/* Watchdog Match Enable */
+
+#define OIER_E3		(1 << 3)	/* Interrupt enable channel 3 */
+#define OIER_E2		(1 << 2)	/* Interrupt enable channel 2 */
+#define OIER_E1		(1 << 1)	/* Interrupt enable channel 1 */
+#define OIER_E0		(1 << 0)	/* Interrupt enable channel 0 */
 
  static unsigned long oscr_freq;
  static unsigned long sa1100wdt_users;
  static unsigned int pre_margin;
  static int boot_status;
+static void __iomem *reg_base;
+
+static inline void sa1100_wr(u32 val, u32 offset)
+{
+	writel_relaxed(val, reg_base + offset);
+}
+
+static inline u32 sa1100_rd(u32 offset)
+{
+	return readl_relaxed(reg_base + offset);
+}
 
  /*
   *	Allow only one person to hold it open
@@ -50,10 +77,10 @@ static int sa1100dog_open(struct inode *inode, struct file *file)
  		return -EBUSY;
 
  	/* Activate SA1100 Watchdog timer */
-	writel_relaxed(readl_relaxed(OSCR) + pre_margin, OSMR3);
-	writel_relaxed(OSSR_M3, OSSR);
-	writel_relaxed(OWER_WME, OWER);
-	writel_relaxed(readl_relaxed(OIER) | OIER_E3, OIER);
+	sa1100_wr(sa1100_rd(REG_OSCR) + pre_margin, REG_OSMR3);
+	sa1100_wr(OSSR_M3, REG_OSSR);
+	sa1100_wr(OWER_WME, REG_OWER);
+	sa1100_wr(sa1100_rd(REG_OIER) | OIER_E3, REG_OIER);
  	return stream_open(inode, file);
  }
 
@@ -61,7 +88,7 @@ static int sa1100dog_open(struct inode *inode, struct file *file)
   * The watchdog cannot be disabled.
   *
   * Previous comments suggested that turning off the interrupt by
- * clearing OIER[E3] would prevent the watchdog timing out but this
+ * clearing REG_OIER[E3] would prevent the watchdog timing out but this
   * does not appear to be true (at least on the PXA255).
   */
  static int sa1100dog_release(struct inode *inode, struct file *file)
@@ -76,7 +103,7 @@ static ssize_t sa1100dog_write(struct file *file, const char __user *data,
  {
  	if (len)
  		/* Refresh OSMR3 timer. */
-		writel_relaxed(readl_relaxed(OSCR) + pre_margin, OSMR3);
+		sa1100_wr(sa1100_rd(REG_OSCR) + pre_margin, REG_OSMR3);
  	return len;
  }
 
@@ -110,7 +137,7 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
  		break;
 
  	case WDIOC_KEEPALIVE:
-		writel_relaxed(readl_relaxed(OSCR) + pre_margin, OSMR3);
+		sa1100_wr(sa1100_rd(REG_OSCR) + pre_margin, REG_OSMR3);
  		ret = 0;
  		break;
 
@@ -125,7 +152,7 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
  		}
 
  		pre_margin = oscr_freq * time;
-		writel_relaxed(readl_relaxed(OSCR) + pre_margin, OSMR3);
+		sa1100_wr(sa1100_rd(REG_OSCR) + pre_margin, REG_OSMR3);
  		/*fall through*/
 
  	case WDIOC_GETTIMEOUT:
@@ -150,12 +177,22 @@ static struct miscdevice sa1100dog_miscdev = {
  	.fops		= &sa1100dog_fops,
  };
 
-static int margin __initdata = 60;		/* (secs) Default is 1 minute */
+static int margin = 60;		/* (secs) Default is 1 minute */
  static struct clk *clk;
 
-static int __init sa1100dog_init(void)

drivers/watchdog/sa1100_wdt.c static struct miscdevice sa1100dog_miscdev = { · line 192

Quoted 10 lines
drivers/watchdog/sa1100_wdt.c +8 -0
+static int sa1100dog_probe(struct platform_device *pdev)
  {
  	int ret;
+	int *platform_data;
+	struct resource *res;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENXIO;
+	reg_base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
	reg_base = devm_platform_ioremap_resource(pdev, 0);
Quoted 49 lines
drivers/watchdog/sa1100_wdt.c +15 -10
+	ret = PTR_ERR_OR_ZERO(reg_base);
+	if (ret)
+		return ret;
 
  	clk = clk_get(NULL, "OSTIMER0");
  	if (IS_ERR(clk)) {
@@ -173,13 +210,9 @@ static int __init sa1100dog_init(void)
 
  	oscr_freq = clk_get_rate(clk);
 
-	/*
-	 * Read the reset status, and save it for later.  If
-	 * we suspend, RCSR will be cleared, and the watchdog
-	 * reset reason will be lost.
-	 */
-	boot_status = (reset_status & RESET_STATUS_WATCHDOG) ?
-				WDIOF_CARDRESET : 0;
+	platform_data = pdev->dev.platform_data;
+	if (platform_data && *platform_data)
+		boot_status = WDIOF_CARDRESET;
  	pre_margin = oscr_freq * margin;
 
  	ret = misc_register(&sa1100dog_miscdev);
@@ -195,15 +228,21 @@ static int __init sa1100dog_init(void)
  	return ret;
  }
 
-static void __exit sa1100dog_exit(void)
+static int sa1100dog_remove(struct platform_device *pdev)
  {
  	misc_deregister(&sa1100dog_miscdev);
  	clk_disable_unprepare(clk);
  	clk_put(clk);
+
+	return 0;
  }
 
-module_init(sa1100dog_init);
-module_exit(sa1100dog_exit);
+struct platform_driver sa1100dog_driver = {
+	.driver.name = "sa1100_wdt",
+	.probe	  = sa1100dog_probe,
+	.remove	  = sa1100dog_remove,
+};
+module_platform_driver(sa1100dog_driver);
 
  MODULE_AUTHOR("Oleg Drokin <[email protected]>");
  MODULE_DESCRIPTION("SA1100/PXA2xx Watchdog");
#28 lore raw

Re: [PATCH 09/46] watchdog: sa1100: use platform device registration

Quoted 7 lines · Guenter Roeck
Quoted 7 lines
arch/arm/mach-sa1100/generic.c +1 -0
@@ -319,10 +316,13 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
  static int __init sa1100_init(void)
  {
+     struct resource wdt_res = DEFINE_RES_MEM(0x90000000, 0x20);
      pm_power_off = sa1100_power_off;
 
Quoted 7 lines

arch/arm/mach-sa1100/generic.c static struct platform_device *sa11x0_devices[] __initdata = { · line 326

Quoted 5 lines
arch/arm/mach-sa1100/generic.c +2 -0
      regulator_has_full_constraints();
 
+     platform_device_register_simple("sa1100_wdt", -1, &wdt_res, 1);
+
      return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));

Wouldn't it be better to add the watchdog device to sa11x0_devices ?

Generally speaking, platform_device_register_simple() is better than platform_add_devices(), it does the same thing with fewer source lines and smaller object code, and it doesn't have the problem of lifetime rules for statically allocated reference-counted devices.

One day we may want to replace all static platform_device instances with platform_device_info instead, but right now there are too many of those.

I can change this one to a platform_device for consistency though if you think it's worth it.

Arnd

maintainer
#29 lore raw

Re: [PATCH 09/46] watchdog: sa1100: use platform device registration

Quoted 22 lines · Arnd Bergmann
Quoted 7 lines · Guenter Roeck
Quoted 7 lines
arch/arm/mach-sa1100/generic.c +1 -0
@@ -319,10 +316,13 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
   static int __init sa1100_init(void)
   {
+     struct resource wdt_res = DEFINE_RES_MEM(0x90000000, 0x20);
       pm_power_off = sa1100_power_off;
 
Quoted 7 lines

arch/arm/mach-sa1100/generic.c static struct platform_device *sa11x0_devices[] __initdata = { · line 326

Quoted 5 lines
arch/arm/mach-sa1100/generic.c +2 -0
       regulator_has_full_constraints();
 
+     platform_device_register_simple("sa1100_wdt", -1, &wdt_res, 1);
+
       return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));

Wouldn't it be better to add the watchdog device to sa11x0_devices ?

Generally speaking, platform_device_register_simple() is better than platform_add_devices(), it does the same thing with fewer source lines and smaller object code, and it doesn't have the problem of lifetime rules for statically allocated reference-counted devices.

Quoted 6 lines

One day we may want to replace all static platform_device instances with platform_device_info instead, but right now there are too many of those.

I can change this one to a platform_device for consistency though if you think it's worth it.

No, I was just wondering. Thanks for the explanation.

Guenter

#30 lore raw

PATCH 10/46 ARM: pxa: pxa2xx-ac97-lib: use IRQ resource

In reply to Arnd Bergmann

The pxa2xx-ac97-lib code is the last driver to use mach/irqs.h for PXA. Almost everything already passes the interrupt as a resource, so use it from there.

The one exception is the mxm8x10 machine, which apparently has a resource-less device. Replacing it with the correct one enables the driver here as well.

---
 arch/arm/mach-pxa/mxm8x10.c |  8 ++------
 sound/arm/pxa2xx-ac97-lib.c | 10 +++++++---
 2 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/mach-pxa/mxm8x10.c +2 -6
index fde386f6cffe..35546b59c88e 100644
@@ -26,6 +26,7 @@
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
+#include <linux/platform_data/asoc-pxa.h>
 #include "pxa320.h"
 
 #include "mxm8x10.h"
@@ -356,14 +357,9 @@ void __init mxm_8x10_usb_host_init(void)
 	pxa_set_ohci_info(&mxm_8x10_ohci_platform_data);
 }
 
-/* AC97 Sound Support */
-static struct platform_device mxm_8x10_ac97_device = {
-	.name = "pxa2xx-ac97"
-};
-
 void __init mxm_8x10_ac97_init(void)
 {
-	platform_device_register(&mxm_8x10_ac97_device);
+	pxa_set_ac97_info(NULL);
 }
 
 /* NAND flash Support */
sound/arm/pxa2xx-ac97-lib.c +7 -3
index 9b5c1f0f8998..8c79d224f03b 100644
@@ -21,7 +21,6 @@
 
 #include <sound/pxa2xx-lib.h>
 
-#include <mach/irqs.h>
 #include <mach/regs-ac97.h>
 #include <linux/platform_data/asoc-pxa.h>
 
@@ -319,6 +318,7 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume);
 int pxa2xx_ac97_hw_probe(struct platform_device *dev)
 {
 	int ret;
+	int irq;
 	pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
 
 	if (pdata) {
@@ -387,7 +387,11 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
 	if (ret)
 		goto err_clk2;
 
-	ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, 0, "AC97", NULL);
+	irq = platform_get_irq(dev, 0);
+	if (!irq)
+		goto err_irq;
+
+	ret = request_irq(irq, pxa2xx_ac97_irq, 0, "AC97", NULL);
 	if (ret < 0)
 		goto err_irq;
 
@@ -413,7 +417,7 @@ void pxa2xx_ac97_hw_remove(struct platform_device *dev)
 	if (cpu_is_pxa27x())
 		gpio_free(reset_gpio);
 	GCR |= GCR_ACLINK_OFF;
-	free_irq(IRQ_AC97, NULL);
+	free_irq(platform_get_irq(dev, 0), NULL);
 	if (ac97conf_clk) {
 		clk_put(ac97conf_clk);
 		ac97conf_clk = NULL;
Signature · 1 line
2.20.0
maintainer Acked-by on v1 10/46
#31 lore raw

Re: [PATCH 10/46] ARM: pxa: pxa2xx-ac97-lib: use IRQ resource

Quoted 10 lines · Arnd Bergmann

The pxa2xx-ac97-lib code is the last driver to use mach/irqs.h for PXA. Almost everything already passes the interrupt as a resource, so use it from there.

The one exception is the mxm8x10 machine, which apparently has a resource-less device. Replacing it with the correct one enables the driver here as well.

Cheers.

--
Robert

#32 lore raw

PATCH 11/46 ARM: pxa: cmx270: use platform device for nand

In reply to Arnd Bergmann

The driver traditionally hardcodes the MMIO register address and the GPIO numbers from data defined in platform header files.

To make it indepdendent of that, use a memory resource for the registers, and a gpio lookup table to replace the gpio numbers.

Cc Miquel Raynal <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Brian Norris <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Vignesh Raghavendra <[email protected]>
---
 arch/arm/mach-pxa/cm-x270.c        | 25 +++++++++
 drivers/mtd/nand/raw/cmx270_nand.c | 88 +++++++++++-------------------
 2 files changed, 56 insertions(+), 57 deletions(-)
arch/arm/mach-pxa/cm-x270.c +25 -0
index 9baad11314f2..6d80400d8887 100644
@@ -40,6 +40,10 @@
 #define GPIO19_WLAN_STRAP	(19)
 #define GPIO102_WLAN_RST	(102)
 
+/* NAND GPIOS */
+#define GPIO_NAND_CS		(11)
+#define GPIO_NAND_RB		(89)
+
 static unsigned long cmx270_pin_config[] = {
 	/* AC'97 */
 	GPIO28_AC97_BITCLK,
@@ -403,6 +407,26 @@ static void __init cmx270_init_spi(void)
 static inline void cmx270_init_spi(void) {}
 #endif
 
+static struct gpiod_lookup_table cmx270_nand_gpio_table = {
+	.dev_id = "cmx270-nand",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", GPIO_NAND_CS, "cs", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("gpio-pxa", GPIO_NAND_RB, "rb", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
+static struct resource cmx270_nand_resources[] __initdata = {
+	DEFINE_RES_MEM(PXA_CS1_PHYS, 12),
+};
+
+static void __init cmx270_init_nand(void)
+{
+	platform_device_register_simple("cmx270-nand", -1,
+					cmx270_nand_resources, 1);
+	gpiod_add_lookup_table(&cmx270_nand_gpio_table);
+}
+
 void __init cmx270_init(void)
 {
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config));
@@ -416,4 +440,5 @@ void __init cmx270_init(void)
 	cmx270_init_ohci();
 	cmx270_init_2700G();
 	cmx270_init_spi();
+	cmx270_init_nand();
 }
drivers/mtd/nand/raw/cmx270_nand.c +31 -57

159 lines not on this page · raw message

Signature · 1 line
2.20.0
maintainer Acked-by on v1 11/46
#33 lore raw

Re: [PATCH 11/46] ARM: pxa: cmx270: use platform device for nand

Hi Arnd,

Arnd Bergmann <[email protected]> wrote on Fri, 18 Oct 2019 17:41:26 +0200:

Quoted 5 lines

The driver traditionally hardcodes the MMIO register address and the GPIO numbers from data defined in platform header files.

To make it indepdendent of that, use a memory resource for the registers, and a gpio lookup table to replace the gpio numbers.

Looks good to me besides the typo s/indepdendent/independent/.

Quoted 219 lines
Cc Miquel Raynal <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Brian Norris <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Vignesh Raghavendra <[email protected]>
---
 arch/arm/mach-pxa/cm-x270.c        | 25 +++++++++
 drivers/mtd/nand/raw/cmx270_nand.c | 88 +++++++++++-------------------
 2 files changed, 56 insertions(+), 57 deletions(-)
arch/arm/mach-pxa/cm-x270.c +25 -0
index 9baad11314f2..6d80400d8887 100644
@@ -40,6 +40,10 @@
 #define GPIO19_WLAN_STRAP	(19)
 #define GPIO102_WLAN_RST	(102)
 
+/* NAND GPIOS */
+#define GPIO_NAND_CS		(11)
+#define GPIO_NAND_RB		(89)
+
 static unsigned long cmx270_pin_config[] = {
 	/* AC'97 */
 	GPIO28_AC97_BITCLK,
@@ -403,6 +407,26 @@ static void __init cmx270_init_spi(void)
 static inline void cmx270_init_spi(void) {}
 #endif
 
+static struct gpiod_lookup_table cmx270_nand_gpio_table = {
+	.dev_id = "cmx270-nand",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", GPIO_NAND_CS, "cs", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("gpio-pxa", GPIO_NAND_RB, "rb", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
+static struct resource cmx270_nand_resources[] __initdata = {
+	DEFINE_RES_MEM(PXA_CS1_PHYS, 12),
+};
+
+static void __init cmx270_init_nand(void)
+{
+	platform_device_register_simple("cmx270-nand", -1,
+					cmx270_nand_resources, 1);
+	gpiod_add_lookup_table(&cmx270_nand_gpio_table);
+}
+
 void __init cmx270_init(void)
 {
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config));
@@ -416,4 +440,5 @@ void __init cmx270_init(void)
 	cmx270_init_ohci();
 	cmx270_init_2700G();
 	cmx270_init_spi();
+	cmx270_init_nand();
 }
drivers/mtd/nand/raw/cmx270_nand.c +24 -57
index 7af3d0bdcdb8..31cb20858c46 100644
@@ -15,18 +15,17 @@
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/slab.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/soc/pxa/cpu.h>
+#include <linux/platform_device.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/addr-map.h>
-
-#define GPIO_NAND_CS	(11)
-#define GPIO_NAND_RB	(89)
+static struct gpio_desc *gpiod_nand_cs;
+static struct gpio_desc *gpiod_nand_rb;
 
 /* MTD structure for CM-X270 board */
 static struct mtd_info *cmx270_nand_mtd;
@@ -70,14 +69,14 @@ static void cmx270_read_buf(struct nand_chip *this, u_char *buf, int len)
 
 static inline void nand_cs_on(void)
 {
-	gpio_set_value(GPIO_NAND_CS, 0);
+	gpiod_set_value(gpiod_nand_cs, 0);
 }
 
 static void nand_cs_off(void)
 {
 	dsb();
 
-	gpio_set_value(GPIO_NAND_CS, 1);
+	gpiod_set_value(gpiod_nand_cs, 1);
 }
 
 /*
@@ -120,48 +119,41 @@ static int cmx270_device_ready(struct nand_chip *this)
 {
 	dsb();
 
-	return (gpio_get_value(GPIO_NAND_RB));
+	return (gpiod_get_value(gpiod_nand_rb));
 }
 
 /*
  * Main initialization routine
  */
-static int __init cmx270_init(void)
+static int cmx270_probe(struct platform_device *pdev)
 {
 	struct nand_chip *this;
+	struct device *dev = &pdev->dev;
 	int ret;
 
-	if (!(machine_is_armcore() && cpu_is_pxa27x()))
-		return -ENODEV;
-
-	ret = gpio_request(GPIO_NAND_CS, "NAND CS");
+	gpiod_nand_cs = devm_gpiod_get(dev, "cs", GPIOD_OUT_HIGH);
+	ret = PTR_ERR_OR_ZERO(gpiod_nand_cs);
 	if (ret) {
 		pr_warn("CM-X270: failed to request NAND CS gpio\n");
 		return ret;
 	}
 
-	gpio_direction_output(GPIO_NAND_CS, 1);
-
-	ret = gpio_request(GPIO_NAND_RB, "NAND R/B");
+	gpiod_nand_rb = devm_gpiod_get(dev, "rb", GPIOD_IN);
+	ret = PTR_ERR_OR_ZERO(gpiod_nand_rb);
 	if (ret) {
 		pr_warn("CM-X270: failed to request NAND R/B gpio\n");
-		goto err_gpio_request;
+		return ret;
 	}
 
-	gpio_direction_input(GPIO_NAND_RB);
-
 	/* Allocate memory for MTD device structure and private data */
-	this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
-	if (!this) {
-		ret = -ENOMEM;
-		goto err_kzalloc;
-	}
+	this = devm_kzalloc(dev, sizeof(struct nand_chip), GFP_KERNEL);
+	if (!this)
+		return -ENOMEM;
 
-	cmx270_nand_io = ioremap(PXA_CS1_PHYS, 12);
+	cmx270_nand_io = devm_platform_ioremap_resource(pdev, 0);
 	if (!cmx270_nand_io) {
 		pr_debug("Unable to ioremap NAND device\n");
-		ret = -EINVAL;
-		goto err_ioremap;
+		return -EINVAL;
 	}
 
 	cmx270_nand_mtd = nand_to_mtd(this);
@@ -189,48 +181,30 @@ static int __init cmx270_init(void)
 	ret = nand_scan(this, 1);
 	if (ret) {
 		pr_notice("No NAND device\n");
-		goto err_scan;
+		return ret;
 	}
 
 	/* Register the partitions */
-	ret = mtd_device_register(cmx270_nand_mtd, partition_info,
-				  NUM_PARTITIONS);
-	if (ret)
-		goto err_scan;
-
-	/* Return happy */
-	return 0;
-
-err_scan:
-	iounmap(cmx270_nand_io);
-err_ioremap:
-	kfree(this);
-err_kzalloc:
-	gpio_free(GPIO_NAND_RB);
-err_gpio_request:
-	gpio_free(GPIO_NAND_CS);
-
-	return ret;
-
+	return mtd_device_register(cmx270_nand_mtd, partition_info,
+				   NUM_PARTITIONS);
 }
-module_init(cmx270_init);
 
 /*
  * Clean up routine
  */
-static void __exit cmx270_cleanup(void)
+static int cmx270_remove(struct platform_device *pdev)
 {
-	/* Release resources, unregister device */
 	nand_release(mtd_to_nand(cmx270_nand_mtd));
 
-	gpio_free(GPIO_NAND_RB);
-	gpio_free(GPIO_NAND_CS);
-
-	iounmap(cmx270_nand_io);
-
-	kfree(mtd_to_nand(cmx270_nand_mtd));
+	return 0;
 }
-module_exit(cmx270_cleanup);

drivers/mtd/nand/raw/cmx270_nand.c static int __init cmx270_init(void) · line 210

Quoted 10 lines
drivers/mtd/nand/raw/cmx270_nand.c +7 -0
+
+static struct platform_driver cmx270_nand_driver = {
+	.driver.name = "cmx270-nand",
+	.probe = cmx270_probe,
+	.remove = cmx270_remove,
+};
+module_platform_driver(cmx270_nand_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Mike Rapoport <[email protected]>");

Thanks,
Miquèl

#34 lore raw

Re: [PATCH 11/46] ARM: pxa: cmx270: use platform device for nand

Quoted 5 lines · Miquel Raynal

Hi Arnd,

Arnd Bergmann <[email protected]> wrote on Fri, 18 Oct 2019 17:41:26 +0200:

Quoted 7 lines
Quoted 5 lines

The driver traditionally hardcodes the MMIO register address and the GPIO numbers from data defined in platform header files.

To make it indepdendent of that, use a memory resource for the registers, and a gpio lookup table to replace the gpio numbers.

Looks good to me besides the typo s/indepdendent/independent/.

Fixed now

Quoted 1 line

Thanks!

Arnd

maintainer Acked-by on v1 11/46
#35 lore raw

Re: [PATCH 11/46] ARM: pxa: cmx270: use platform device for nand

In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

The driver traditionally hardcodes the MMIO register address and the GPIO numbers from data defined in platform header files.

To make it indepdendent of that, use a memory resource for the registers, and a gpio lookup table to replace the gpio numbers.

Quoted 8 lines
Cc Miquel Raynal <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Brian Norris <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Vignesh Raghavendra <[email protected]>

Cheers.

--
Robert

#36 lore raw

PATCH 12/46 ARM: pxa: make addr-map.h header local

In reply to Arnd Bergmann

Drivers should not rely on the contents of this file, so move it into the platform directory directly.

Cc Philipp Zabel <[email protected]>
Cc Paul Parsons <[email protected]>
---
 arch/arm/mach-pxa/{include/mach => }/addr-map.h | 0
 arch/arm/mach-pxa/cm-x2xx.c                     | 2 +-
 arch/arm/mach-pxa/generic.c                     | 2 +-
 arch/arm/mach-pxa/hx4700.c                      | 2 +-
 arch/arm/mach-pxa/include/mach/trizeps4.h       | 2 +-
 arch/arm/mach-pxa/lpd270.c                      | 2 +-
 arch/arm/mach-pxa/magician.c                    | 2 +-
 arch/arm/mach-pxa/mainstone.c                   | 2 +-
 arch/arm/mach-pxa/pxa25x.c                      | 2 +-
 arch/arm/mach-pxa/pxa25x.h                      | 2 +-
 arch/arm/mach-pxa/pxa27x.c                      | 2 +-
 arch/arm/mach-pxa/pxa27x.h                      | 2 +-
 arch/arm/mach-pxa/pxa3xx.c                      | 2 +-
 arch/arm/mach-pxa/pxa3xx.h                      | 2 +-
 arch/arm/mach-pxa/xcep.c                        | 2 +-
 15 files changed, 14 insertions(+), 14 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/addr-map.h (100%)
arch/arm/mach-pxa/addr-map.h renamed from arch/arm/mach-pxa/include/mach/addr-map.h +0 -0
similarity index 100%
rename from arch/arm/mach-pxa/include/mach/addr-map.h
rename to arch/arm/mach-pxa/addr-map.h
arch/arm/mach-pxa/cm-x2xx.c +1 -1
index b13fcc72abab..9b030eccd548 100644
@@ -33,7 +33,7 @@
 #undef GPIO88_GPIO
 #undef GPIO89_GPIO
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <linux/platform_data/video-pxafb.h>
 #include <mach/smemc.h>
 
arch/arm/mach-pxa/generic.c +1 -1
index 3c3cd90bb9b4..f9083c4f0aea 100644
@@ -22,7 +22,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach-types.h>
 
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/irqs.h>
 #include <mach/reset.h>
 #include <mach/smemc.h>
arch/arm/mach-pxa/hx4700.c +1 -1
index 4dce8834c5b6..b3dcbe291e13 100644
@@ -41,7 +41,7 @@
 #include <asm/mach/arch.h>
 
 #include "pxa27x.h"
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/hx4700.h>
 #include <linux/platform_data/irda-pxaficp.h>
 
arch/arm/mach-pxa/include/mach/trizeps4.h +1 -1
index 27926629f9c6..b6c19d155ef9 100644
@@ -11,7 +11,7 @@
 #ifndef _TRIPEPS4_H_
 #define _TRIPEPS4_H_
 
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include "irqs.h" /* PXA_GPIO_TO_IRQ */
 
 /* physical memory regions */
arch/arm/mach-pxa/lpd270.c +1 -1
index c59fd2624f91..6f3b7ca4d899 100644
@@ -38,7 +38,7 @@
 
 #include "pxa27x.h"
 #include "lpd270.h"
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/magician.c +1 -1
index ce4c677be868..e925f7a8d349 100644
@@ -35,7 +35,7 @@
 #include <asm/system_info.h>
 
 #include "pxa27x.h"
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/magician.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/mainstone.c +1 -1
index ed505de6b5d9..5f7bc5a9215e 100644
@@ -51,7 +51,7 @@
 #include <linux/platform_data/irda-pxaficp.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/keypad-pxa27x.h>
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/pxa25x.c +1 -1
index dfc90b41fba3..8d21c7eef1d2 100644
@@ -34,7 +34,7 @@
 #include "pxa25x.h"
 #include <mach/reset.h>
 #include "pm.h"
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/pxa25x.h +1 -1
index 403bc16c2ed2..4699ebf7b486 100644
@@ -2,7 +2,7 @@
 #ifndef __MACH_PXA25x_H
 #define __MACH_PXA25x_H
 
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa25x.h"
 #include <mach/irqs.h>
arch/arm/mach-pxa/pxa27x.c +1 -1
index 38fdd22c4dc5..c36a9784fab8 100644
@@ -33,7 +33,7 @@
 #include <mach/reset.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pm.h"
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/smemc.h>
 
 #include "generic.h"
arch/arm/mach-pxa/pxa27x.h +1 -1
index 6c99090647d2..bf2755561fe5 100644
@@ -3,7 +3,7 @@
 #define __MACH_PXA27x_H
 
 #include <linux/suspend.h>
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/pxa2xx-regs.h>
 #include "mfp-pxa27x.h"
 #include <mach/irqs.h>
arch/arm/mach-pxa/pxa3xx.c +1 -1
index 7c569fa2a6da..7881888107c7 100644
@@ -32,7 +32,7 @@
 #include <mach/reset.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include "pm.h"
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/smemc.h>
 #include <mach/irqs.h>
 
arch/arm/mach-pxa/pxa3xx.h +1 -1
index 22ace053ea25..6b424d328680 100644
@@ -2,7 +2,7 @@
 #ifndef __MACH_PXA3XX_H	
 #define __MACH_PXA3XX_H
 
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/pxa3xx-regs.h>
 #include <mach/irqs.h>
 
arch/arm/mach-pxa/xcep.c +1 -1
index e6ab428287ae..7389e0199144 100644
@@ -25,7 +25,7 @@
 #include <asm/mach/map.h>
 
 #include "pxa25x.h"
-#include <mach/addr-map.h>
+#include "addr-map.h"
 #include <mach/smemc.h>
 
 #include "generic.h"
Signature · 1 line
2.20.0
maintainer
#37 lore raw

Re: [PATCH 12/46] ARM: pxa: make addr-map.h header local

Quoted 6 lines · Arnd Bergmann

Drivers should not rely on the contents of this file, so move it into the platform directory directly.

Cc Philipp Zabel <[email protected]>
Cc Paul Parsons <[email protected]>

Mmmh for this one, my jenkins is a bit grumpy :

Bisectability test results for configuration "pxa_defconfig,arm,arm-linux-gnueabi-"

Failed to build patch #12: 15fb575e5d52 ARM: pxa: make addr-map.h header local
Configuration: "pxa_defconfig, architecture arm".

In file included from drivers/pcmcia/pxa2xx_trizeps4.c:23:
arch/arm/mach-pxa/include/mach/trizeps4.h:14:10: fatal error: addr-map.h: No such file or directory

 #include "addr-map.h"
          ^~~~~~~~~~~~

compilation terminated.
make[3]: *** [scripts/Makefile.build:265: drivers/pcmcia/pxa2xx_trizeps4.o] Error 1

Signature · 1 line
Robert
#38 lore raw

PATCH 13/46 ARM: pxa: move pcmcia board data into mach-pxa

In reply to Arnd Bergmann

The drivers/pcmcia/pxa2xx_*.c are essentially part of the board files, but for historic reasons located in drivers/pcmcia.

Move them into the same place as the actual board file to avoid lots of machine header inclusions.

Cc Marek Vasut <[email protected]>
Cc Dominik Brodowski <[email protected]>
Cc Jonathan Cameron <[email protected]>
---
 arch/arm/mach-pxa/Makefile                    |  21 +--
 .../arm/mach-pxa/balloon3-pcmcia.c            |   4 +-
 arch/arm/mach-pxa/balloon3.c                  |   2 +-
 .../mach-pxa/{include/mach => }/balloon3.h    |   2 +-
 .../arm/mach-pxa/cm_x255-pcmcia.c             |   2 +-
 .../arm/mach-pxa/cm_x270-pcmcia.c             |   2 +-
 .../arm/mach-pxa/cm_x2xx-pcmcia.c             |   0
 .../arm/mach-pxa/colibri-pcmcia.c             |   2 +-
 .../arm/mach-pxa/e740-pcmcia.c                |   2 +-
 .../arm/mach-pxa/hx4700-pcmcia.c              |   2 +-
 .../arm/mach-pxa/palmld-pcmcia.c              |   2 +-
 .../arm/mach-pxa/palmtc-pcmcia.c              |   4 +-
 arch/arm/mach-pxa/palmtc.c                    |   2 +-
 arch/arm/mach-pxa/{include/mach => }/palmtc.h |   2 +-
 .../arm/mach-pxa/palmtx-pcmcia.c              |   4 +-
 arch/arm/mach-pxa/palmtx.c                    |   2 +-
 arch/arm/mach-pxa/{include/mach => }/palmtx.h |   2 +-
 .../arm/mach-pxa/stargate2-pcmcia.c           |   2 +-
 .../arm/mach-pxa/trizeps4-pcmcia.c            |   4 +-
 arch/arm/mach-pxa/trizeps4.c                  |   2 +-
 .../mach-pxa/{include/mach => }/trizeps4.h    |   2 +-
 .../arm/mach-pxa/viper-pcmcia.c               |   6 +-
 .../arm/mach-pxa/viper-pcmcia.h               |   0
 arch/arm/mach-pxa/viper.c                     |   2 +-
 .../arm/mach-pxa/vpac270-pcmcia.c             |   4 +-
 arch/arm/mach-pxa/vpac270.c                   |   2 +-
 .../arm/mach-pxa/{include/mach => }/vpac270.h |   0
 arch/arm/mach-pxa/zeus.c                      |   2 +-
 drivers/pcmcia/Makefile                       |  16 ---
 drivers/pcmcia/pxa2xx_sharpsl.c               |   2 +-
 drivers/pcmcia/soc_common.h                   | 120 +----------------
 include/pcmcia/soc_common.h                   | 125 ++++++++++++++++++
 32 files changed, 170 insertions(+), 176 deletions(-)
 rename drivers/pcmcia/pxa2xx_balloon3.c => arch/arm/mach-pxa/balloon3-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/balloon3.h (99%)
 rename drivers/pcmcia/pxa2xx_cm_x255.c => arch/arm/mach-pxa/cm_x255-pcmcia.c (98%)
 rename drivers/pcmcia/pxa2xx_cm_x270.c => arch/arm/mach-pxa/cm_x270-pcmcia.c (98%)
 rename drivers/pcmcia/pxa2xx_cm_x2xx.c => arch/arm/mach-pxa/cm_x2xx-pcmcia.c (100%)
 rename drivers/pcmcia/pxa2xx_colibri.c => arch/arm/mach-pxa/colibri-pcmcia.c (99%)
 rename drivers/pcmcia/pxa2xx_e740.c => arch/arm/mach-pxa/e740-pcmcia.c (98%)
 rename drivers/pcmcia/pxa2xx_hx4700.c => arch/arm/mach-pxa/hx4700-pcmcia.c (98%)
 rename drivers/pcmcia/pxa2xx_palmld.c => arch/arm/mach-pxa/palmld-pcmcia.c (98%)
 rename drivers/pcmcia/pxa2xx_palmtc.c => arch/arm/mach-pxa/palmtc-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/palmtc.h (98%)
 rename drivers/pcmcia/pxa2xx_palmtx.c => arch/arm/mach-pxa/palmtx-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/palmtx.h (98%)
 rename drivers/pcmcia/pxa2xx_stargate2.c => arch/arm/mach-pxa/stargate2-pcmcia.c (99%)
 rename drivers/pcmcia/pxa2xx_trizeps4.c => arch/arm/mach-pxa/trizeps4-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/trizeps4.h (99%)
 rename drivers/pcmcia/pxa2xx_viper.c => arch/arm/mach-pxa/viper-pcmcia.c (97%)
 rename include/linux/platform_data/pcmcia-pxa2xx_viper.h => arch/arm/mach-pxa/viper-pcmcia.h (100%)
 rename drivers/pcmcia/pxa2xx_vpac270.c => arch/arm/mach-pxa/vpac270-pcmcia.c (98%)
 rename arch/arm/mach-pxa/{include/mach => }/vpac270.h (100%)
 create mode 100644 include/pcmcia/soc_common.h
arch/arm/mach-pxa/Makefile +13 -8
index f70728930c4f..e0df39b0238d 100644
@@ -37,13 +37,15 @@ obj-$(CONFIG_MACH_SAAR)		+= saar.o
 obj-$(CONFIG_ARCH_PXA_IDP)	+= idp.o
 obj-$(CONFIG_ARCH_VIPER)	+= viper.o
 obj-$(CONFIG_MACH_ARCOM_ZEUS)	+= zeus.o
-obj-$(CONFIG_MACH_BALLOON3)	+= balloon3.o
+obj-$(CONFIG_ARCOM_PCMCIA)	+= viper-pcmcia.o
+obj-$(CONFIG_MACH_BALLOON3)	+= balloon3.o balloon3-pcmcia.o
 obj-$(CONFIG_MACH_CSB726)	+= csb726.o
 obj-$(CONFIG_CSB726_CSB701)	+= csb701.o
 obj-$(CONFIG_MACH_ARMCORE)      += cm-x2xx.o cm-x255.o cm-x270.o
 ifeq ($(CONFIG_PCI),y)
 obj-$(CONFIG_MACH_ARMCORE)	+= cm-x2xx-pci.o
 endif
+obj-$(CONFIG_MACH_ARMCORE)	+= cm_x2xx-pcmcia.o cm_x255-pcmcia.o cm_x270-pcmcia.o
 obj-$(CONFIG_MACH_EM_X270)	+= em-x270.o
 obj-$(CONFIG_MACH_CM_X300)      += cm-x300.o
 obj-$(CONFIG_MACH_CAPC7117)     += capc7117.o mxm8x10.o
@@ -51,21 +53,23 @@ obj-$(CONFIG_ARCH_GUMSTIX)	+= gumstix.o
 obj-$(CONFIG_GUMSTIX_AM200EPD)	+= am200epd.o
 obj-$(CONFIG_GUMSTIX_AM300EPD)	+= am300epd.o
 obj-$(CONFIG_MACH_INTELMOTE2)	+= stargate2.o
-obj-$(CONFIG_MACH_STARGATE2)	+= stargate2.o
+obj-$(CONFIG_MACH_STARGATE2)	+= stargate2.o stargate2-pcmcia.o
 obj-$(CONFIG_MACH_XCEP)         += xcep.o
 obj-$(CONFIG_MACH_TRIZEPS4)	+= trizeps4.o
+obj-$(CONFIG_TRIZEPS_PCMCIA)	+= trizeps4-pcmcia.o
 obj-$(CONFIG_MACH_LOGICPD_PXA270)	+= lpd270.o
 obj-$(CONFIG_MACH_PCM027)		+= pcm027.o
 obj-$(CONFIG_MACH_PCM990_BASEBOARD)	+= pcm990-baseboard.o
-obj-$(CONFIG_MACH_COLIBRI)			+= colibri-pxa270.o
+obj-$(CONFIG_MACH_COLIBRI)		+= colibri-pxa270.o colibri-pcmcia.o
 obj-$(CONFIG_MACH_COLIBRI_EVALBOARD)	+= colibri-evalboard.o
 obj-$(CONFIG_MACH_COLIBRI_PXA270_INCOME)	+= colibri-pxa270-income.o
 obj-$(CONFIG_MACH_COLIBRI300)	+= colibri-pxa3xx.o colibri-pxa300.o
-obj-$(CONFIG_MACH_COLIBRI320)	+= colibri-pxa3xx.o colibri-pxa320.o
-obj-$(CONFIG_MACH_VPAC270)	+= vpac270.o
+obj-$(CONFIG_MACH_COLIBRI320)	+= colibri-pxa3xx.o colibri-pxa320.o colibri-pcmcia.o
+obj-$(CONFIG_MACH_VPAC270)	+= vpac270.o vpac270-pcmcia.o
 
 # End-user Products
 obj-$(CONFIG_MACH_H4700)	+= hx4700.o
+obj-$(CONFIG_MACH_H4700)	+= hx4700-pcmcia.o
 obj-$(CONFIG_MACH_H5000)	+= h5000.o
 obj-$(CONFIG_MACH_HIMALAYA)	+= himalaya.o
 obj-$(CONFIG_MACH_MAGICIAN)	+= magician.o
@@ -73,12 +77,12 @@ obj-$(CONFIG_MACH_MIOA701)	+= mioa701.o mioa701_bootresume.o
 obj-$(CONFIG_PXA_EZX)           += ezx.o
 obj-$(CONFIG_MACH_MP900C)	+= mp900.o
 obj-$(CONFIG_MACH_PALMTE2)	+= palmte2.o
-obj-$(CONFIG_MACH_PALMTC)	+= palmtc.o
+obj-$(CONFIG_MACH_PALMTC)	+= palmtc.o palmtc-pcmcia.o
 obj-$(CONFIG_MACH_PALM27X)	+= palm27x.o
 obj-$(CONFIG_MACH_PALMT5)	+= palmt5.o
-obj-$(CONFIG_MACH_PALMTX)	+= palmtx.o
+obj-$(CONFIG_MACH_PALMTX)	+= palmtx.o palmtx-pcmcia.o
 obj-$(CONFIG_MACH_PALMZ72)	+= palmz72.o
-obj-$(CONFIG_MACH_PALMLD)	+= palmld.o
+obj-$(CONFIG_MACH_PALMLD)	+= palmld.o palmld-pcmcia.o
 obj-$(CONFIG_PALM_TREO)		+= palmtreo.o
 obj-$(CONFIG_PXA_SHARP_C7xx)	+= corgi.o sharpsl_pm.o corgi_pm.o
 obj-$(CONFIG_PXA_SHARP_Cxx00)	+= spitz.o sharpsl_pm.o spitz_pm.o
@@ -86,6 +90,7 @@ obj-$(CONFIG_MACH_POODLE)	+= poodle.o
 obj-$(CONFIG_MACH_TOSA)		+= tosa.o
 obj-$(CONFIG_MACH_ICONTROL)     += icontrol.o mxm8x10.o
 obj-$(CONFIG_ARCH_PXA_ESERIES)	+= eseries.o
+obj-$(CONFIG_MACH_E740)		+= e740-pcmcia.o
 obj-$(CONFIG_MACH_ZIPIT2)	+= z2.o
 
 obj-$(CONFIG_PXA_SYSTEMS_CPLDS)	+= pxa_cplds_irqs.o
arch/arm/mach-pxa/balloon3-pcmcia.c renamed from drivers/pcmcia/pxa2xx_balloon3.c +2 -2
similarity index 98%
rename from drivers/pcmcia/pxa2xx_balloon3.c
rename to arch/arm/mach-pxa/balloon3-pcmcia.c
index 5fe1da7a50e4..6a27b76cc603 100644
@@ -20,11 +20,11 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 
-#include <mach/balloon3.h>
+#include "balloon3.h"
 
 #include <asm/mach-types.h>
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 static int balloon3_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
arch/arm/mach-pxa/balloon3.c +1 -1
index 82f9299f67d3..896d47d9a8dc 100644
@@ -40,7 +40,7 @@
 #include <asm/mach/flash.h>
 
 #include "pxa27x.h"
-#include <mach/balloon3.h>
+#include "balloon3.h"
 #include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/balloon3.h renamed from arch/arm/mach-pxa/include/mach/balloon3.h +1 -1
similarity index 99%
rename from arch/arm/mach-pxa/include/mach/balloon3.h
rename to arch/arm/mach-pxa/balloon3.h
index 04f3639c4082..f351358c0e5b 100644
@@ -11,7 +11,7 @@
 #ifndef ASM_ARCH_BALLOON3_H
 #define ASM_ARCH_BALLOON3_H
 
-#include "irqs.h" /* PXA_NR_BUILTIN_GPIO */
+#include <mach/irqs.h> /* PXA_NR_BUILTIN_GPIO */
 
 enum balloon3_features {
 	BALLOON3_FEATURE_OHCI,
arch/arm/mach-pxa/cm_x255-pcmcia.c renamed from drivers/pcmcia/pxa2xx_cm_x255.c +1 -1
similarity index 98%
rename from drivers/pcmcia/pxa2xx_cm_x255.c
rename to arch/arm/mach-pxa/cm_x255-pcmcia.c
index c0b6b846fbaa..7f9f3c157210 100644
@@ -12,7 +12,7 @@
 #include <linux/gpio.h>
 #include <linux/export.h>
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 #define GPIO_PCMCIA_SKTSEL	(54)
 #define GPIO_PCMCIA_S0_CD_VALID	(16)
arch/arm/mach-pxa/cm_x270-pcmcia.c renamed from drivers/pcmcia/pxa2xx_cm_x270.c +1 -1
similarity index 98%
rename from drivers/pcmcia/pxa2xx_cm_x270.c
rename to arch/arm/mach-pxa/cm_x270-pcmcia.c
index 36e35da5f887..57c8cbb2f896 100644
@@ -12,7 +12,7 @@
 #include <linux/gpio.h>
 #include <linux/export.h>
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 #define GPIO_PCMCIA_S0_CD_VALID	(84)
 #define GPIO_PCMCIA_S0_RDYINT	(82)
arch/arm/mach-pxa/cm_x2xx-pcmcia.c renamed from drivers/pcmcia/pxa2xx_cm_x2xx.c +0 -0
similarity index 100%
rename from drivers/pcmcia/pxa2xx_cm_x2xx.c
rename to arch/arm/mach-pxa/cm_x2xx-pcmcia.c
arch/arm/mach-pxa/colibri-pcmcia.c renamed from drivers/pcmcia/pxa2xx_colibri.c +1 -1
similarity index 99%
rename from drivers/pcmcia/pxa2xx_colibri.c
rename to arch/arm/mach-pxa/colibri-pcmcia.c
index f0f725e99604..9da7b478e5eb 100644
@@ -14,7 +14,7 @@
 
 #include <asm/mach-types.h>
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 #define	COLIBRI270_RESET_GPIO	53
 #define	COLIBRI270_PPEN_GPIO	107
arch/arm/mach-pxa/e740-pcmcia.c renamed from drivers/pcmcia/pxa2xx_e740.c +1 -1
similarity index 98%
rename from drivers/pcmcia/pxa2xx_e740.c
rename to arch/arm/mach-pxa/e740-pcmcia.c
index 72caa6d05ab9..133535d7ac05 100644
@@ -18,7 +18,7 @@
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
arch/arm/mach-pxa/hx4700-pcmcia.c renamed from drivers/pcmcia/pxa2xx_hx4700.c +1 -1
similarity index 98%
rename from drivers/pcmcia/pxa2xx_hx4700.c
rename to arch/arm/mach-pxa/hx4700-pcmcia.c
index 87b6a1639d94..e8acbfc9ef6c 100644
@@ -12,7 +12,7 @@
 #include <asm/mach-types.h>
 #include <mach/hx4700.h>
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 static struct gpio gpios[] = {
 	{ GPIO114_HX4700_CF_RESET,    GPIOF_OUT_INIT_LOW,   "CF reset"        },
arch/arm/mach-pxa/palmld-pcmcia.c renamed from drivers/pcmcia/pxa2xx_palmld.c +1 -1
similarity index 98%
rename from drivers/pcmcia/pxa2xx_palmld.c
rename to arch/arm/mach-pxa/palmld-pcmcia.c
index cfff41ac9ca2..07e0f7438db1 100644
@@ -14,7 +14,7 @@
 
 #include <asm/mach-types.h>
 #include <mach/palmld.h>
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 static struct gpio palmld_pcmcia_gpios[] = {
 	{ GPIO_NR_PALMLD_PCMCIA_POWER,	GPIOF_INIT_LOW,	"PCMCIA Power" },
arch/arm/mach-pxa/palmtc-pcmcia.c renamed from drivers/pcmcia/pxa2xx_palmtc.c +2 -2
similarity index 98%
rename from drivers/pcmcia/pxa2xx_palmtc.c
rename to arch/arm/mach-pxa/palmtc-pcmcia.c
index 8fe05613ed04..8e3f382343fe 100644
@@ -14,8 +14,8 @@
 #include <linux/delay.h>
 
 #include <asm/mach-types.h>
-#include <mach/palmtc.h>
-#include "soc_common.h"
+#include "palmtc.h"
+#include <pcmcia/soc_common.h>
 
 static struct gpio palmtc_pcmcia_gpios[] = {
 	{ GPIO_NR_PALMTC_PCMCIA_POWER1,	GPIOF_INIT_LOW,	"PCMCIA Power 1" },
arch/arm/mach-pxa/palmtc.c +1 -1
index 71917127dfdd..a3aa01d47472 100644
@@ -31,7 +31,7 @@
 
 #include "pxa25x.h"
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/palmtc.h>
+#include "palmtc.h"
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/irda-pxaficp.h>
arch/arm/mach-pxa/palmtc.h renamed from arch/arm/mach-pxa/include/mach/palmtc.h +1 -1
similarity index 98%
rename from arch/arm/mach-pxa/include/mach/palmtc.h
rename to arch/arm/mach-pxa/palmtc.h
index 9257a02c46e5..afec057c2857 100644
@@ -12,7 +12,7 @@
 #ifndef _INCLUDE_PALMTC_H_
 #define _INCLUDE_PALMTC_H_
 
-#include "irqs.h" /* PXA_GPIO_TO_IRQ */
+#include <mach/irqs.h> /* PXA_GPIO_TO_IRQ */
 
 /** HERE ARE GPIOs **/
 
arch/arm/mach-pxa/palmtx-pcmcia.c renamed from drivers/pcmcia/pxa2xx_palmtx.c +2 -2
similarity index 98%
rename from drivers/pcmcia/pxa2xx_palmtx.c
rename to arch/arm/mach-pxa/palmtx-pcmcia.c
index c449ca72cb87..8c2aaad93043 100644
@@ -12,8 +12,8 @@
 #include <linux/gpio.h>
 
 #include <asm/mach-types.h>
-#include <mach/palmtx.h>
-#include "soc_common.h"
+#include "palmtx.h"
+#include <pcmcia/soc_common.h>
 
 static struct gpio palmtx_pcmcia_gpios[] = {
 	{ GPIO_NR_PALMTX_PCMCIA_POWER1,	GPIOF_INIT_LOW,	"PCMCIA Power 1" },
arch/arm/mach-pxa/palmtx.c +1 -1
index eed25d09dfb2..d6819413a8d6 100644
@@ -34,7 +34,7 @@
 
 #include "pxa27x.h"
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/palmtx.h>
+#include "palmtx.h"
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/irda-pxaficp.h>
arch/arm/mach-pxa/palmtx.h renamed from arch/arm/mach-pxa/include/mach/palmtx.h +1 -1
similarity index 98%
rename from arch/arm/mach-pxa/include/mach/palmtx.h
rename to arch/arm/mach-pxa/palmtx.h
index ec88abf0fc6c..a2bb993952d9 100644
@@ -12,7 +12,7 @@
 #ifndef _INCLUDE_PALMTX_H_
 #define _INCLUDE_PALMTX_H_
 
-#include "irqs.h" /* PXA_GPIO_TO_IRQ */
+#include <mach/irqs.h> /* PXA_GPIO_TO_IRQ */
 
 /** HERE ARE GPIOs **/
 
arch/arm/mach-pxa/stargate2-pcmcia.c renamed from drivers/pcmcia/pxa2xx_stargate2.c +1 -1
similarity index 99%
rename from drivers/pcmcia/pxa2xx_stargate2.c
rename to arch/arm/mach-pxa/stargate2-pcmcia.c
index 6efb7f814b4a..9b73487a4f24 100644
@@ -23,7 +23,7 @@
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 #define SG2_S0_POWER_CTL	108
 #define SG2_S0_GPIO_RESET	82
arch/arm/mach-pxa/trizeps4-pcmcia.c renamed from drivers/pcmcia/pxa2xx_trizeps4.c +2 -2
similarity index 98%
rename from drivers/pcmcia/pxa2xx_trizeps4.c
rename to arch/arm/mach-pxa/trizeps4-pcmcia.c
index 6db8fe880ed4..02d7bb0c538f 100644
@@ -20,9 +20,9 @@
 #include <asm/irq.h>
 
 #include <mach/pxa2xx-regs.h>
-#include <mach/trizeps4.h>
+#include "trizeps4.h"
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 extern void board_pcmcia_power(int power);
 
arch/arm/mach-pxa/trizeps4.c +1 -1
index 1337008cc760..fadfbb40cd6c 100644
@@ -40,7 +40,7 @@
 #include <asm/mach/flash.h>
 
 #include "pxa27x.h"
-#include <mach/trizeps4.h>
+#include "trizeps4.h"
 #include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
arch/arm/mach-pxa/trizeps4.h renamed from arch/arm/mach-pxa/include/mach/trizeps4.h +1 -1
similarity index 99%
rename from arch/arm/mach-pxa/include/mach/trizeps4.h
rename to arch/arm/mach-pxa/trizeps4.h
index b6c19d155ef9..e0f37c0ff06f 100644
@@ -12,7 +12,7 @@
 #define _TRIPEPS4_H_
 
 #include "addr-map.h"
-#include "irqs.h" /* PXA_GPIO_TO_IRQ */
+#include <mach/irqs.h> /* PXA_GPIO_TO_IRQ */
 
 /* physical memory regions */
 #define TRIZEPS4_FLASH_PHYS	(PXA_CS0_PHYS)  /* Flash region */
arch/arm/mach-pxa/viper-pcmcia.c renamed from drivers/pcmcia/pxa2xx_viper.c +2 -4
similarity index 97%
rename from drivers/pcmcia/pxa2xx_viper.c
rename to arch/arm/mach-pxa/viper-pcmcia.c
index 7ac6647d286e..26599dcc49b3 100644
@@ -22,13 +22,11 @@
 #include <linux/gpio.h>
 
 #include <pcmcia/ss.h>
+#include <pcmcia/soc_common.h>
 
 #include <asm/irq.h>
 
-#include <linux/platform_data/pcmcia-pxa2xx_viper.h>
-
-#include "soc_common.h"
-#include "pxa2xx_base.h"
+#include "viper-pcmcia.h"
 
 static struct platform_device *arcom_pcmcia_dev;
 
arch/arm/mach-pxa/viper-pcmcia.h renamed from include/linux/platform_data/pcmcia-pxa2xx_viper.h +0 -0
similarity index 100%
rename from include/linux/platform_data/pcmcia-pxa2xx_viper.h
rename to arch/arm/mach-pxa/viper-pcmcia.h
arch/arm/mach-pxa/viper.c +1 -1
index 7d1cb2c2dfa1..fe74ee266871 100644
@@ -49,7 +49,7 @@
 #include <linux/platform_data/asoc-pxa.h>
 #include <linux/platform_data/video-pxafb.h>
 #include "regs-uart.h"
-#include <linux/platform_data/pcmcia-pxa2xx_viper.h>
+#include "viper-pcmcia.h"
 #include "viper.h"
 
 #include <asm/setup.h>
arch/arm/mach-pxa/vpac270-pcmcia.c renamed from drivers/pcmcia/pxa2xx_vpac270.c +2 -2
similarity index 98%
rename from drivers/pcmcia/pxa2xx_vpac270.c
rename to arch/arm/mach-pxa/vpac270-pcmcia.c
index 3565add03a5e..9fd990c8a5fb 100644
@@ -13,9 +13,9 @@
 
 #include <asm/mach-types.h>
 
-#include <mach/vpac270.h>
+#include "vpac270.h"
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 static struct gpio vpac270_pcmcia_gpios[] = {
 	{ GPIO107_VPAC270_PCMCIA_PPEN,	GPIOF_INIT_LOW,	"PCMCIA PPEN" },
arch/arm/mach-pxa/vpac270.c +1 -1
index 7abbebc5d455..5adb053a293e 100644
@@ -31,7 +31,7 @@
 
 #include "pxa27x.h"
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/vpac270.h>
+#include "vpac270.h"
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
arch/arm/mach-pxa/vpac270.h renamed from arch/arm/mach-pxa/include/mach/vpac270.h +0 -0
similarity index 100%
rename from arch/arm/mach-pxa/include/mach/vpac270.h
rename to arch/arm/mach-pxa/vpac270.h
arch/arm/mach-pxa/zeus.c +1 -1
index 6652b1e5978e..80c2bf6e1d30 100644
@@ -47,7 +47,7 @@
 #include <linux/platform_data/video-pxafb.h>
 #include "pm.h"
 #include <linux/platform_data/asoc-pxa.h>
-#include <linux/platform_data/pcmcia-pxa2xx_viper.h>
+#include "viper-pcmcia.h"
 #include "zeus.h"
 #include <mach/smemc.h>
 
drivers/pcmcia/Makefile +0 -16
index 01779c5c45f3..1bd5fd1db6db 100644
@@ -49,23 +49,7 @@ sa1100_cs-$(CONFIG_SA1100_H3100)		+= sa1100_h3600.o
 sa1100_cs-$(CONFIG_SA1100_H3600)		+= sa1100_h3600.o
 sa1100_cs-$(CONFIG_SA1100_SIMPAD)		+= sa1100_simpad.o
 
-pxa2xx_cm_x2xx_cs-y				+= pxa2xx_cm_x2xx.o pxa2xx_cm_x255.o pxa2xx_cm_x270.o
 pxa2xx-obj-$(CONFIG_MACH_MAINSTONE)		+= pxa2xx_mainstone.o
 pxa2xx-obj-$(CONFIG_PXA_SHARPSL)		+= pxa2xx_sharpsl.o
-pxa2xx-obj-$(CONFIG_MACH_ARMCORE)		+= pxa2xx_cm_x2xx_cs.o
-pxa2xx-obj-$(CONFIG_ARCOM_PCMCIA)		+= pxa2xx_viper.o
-pxa2xx-obj-$(CONFIG_TRIZEPS_PCMCIA)		+= pxa2xx_trizeps4.o
-pxa2xx-obj-$(CONFIG_MACH_PALMTX)		+= pxa2xx_palmtx.o
-pxa2xx-obj-$(CONFIG_MACH_PALMTC)		+= pxa2xx_palmtc.o
-pxa2xx-obj-$(CONFIG_MACH_PALMLD)		+= pxa2xx_palmld.o
-pxa2xx-obj-$(CONFIG_MACH_E740)			+= pxa2xx_e740.o
-pxa2xx-obj-$(CONFIG_MACH_STARGATE2)		+= pxa2xx_stargate2.o
-pxa2xx-obj-$(CONFIG_MACH_VPAC270)		+= pxa2xx_vpac270.o
-pxa2xx-obj-$(CONFIG_MACH_BALLOON3)		+= pxa2xx_balloon3.o
-pxa2xx-obj-$(CONFIG_MACH_COLIBRI)		+= pxa2xx_colibri.o
-pxa2xx-obj-$(CONFIG_MACH_COLIBRI320)		+= pxa2xx_colibri.o
-pxa2xx-obj-$(CONFIG_MACH_H4700)			+= pxa2xx_hx4700.o
-
 obj-$(CONFIG_PCMCIA_PXA2XX)			+= pxa2xx_base.o $(pxa2xx-obj-y)
-
 obj-$(CONFIG_PCMCIA_XXS1500)			+= xxs1500_ss.o
drivers/pcmcia/pxa2xx_sharpsl.c +1 -1
index 66fe1d1af12a..b3ba858f70cb 100644
@@ -18,7 +18,7 @@
 #include <asm/irq.h>
 #include <asm/hardware/scoop.h>
 
-#include "soc_common.h"
+#include <pcmcia/soc_common.h>
 
 #define	NO_KEEP_VS 0x0001
 #define SCOOP_DEV platform_scoop_config->devs
drivers/pcmcia/soc_common.h +1 -119

138 lines not on this page · raw message

include/pcmcia/soc_common.h new file +125 -0

125 lines not on this page · raw message

Signature · 1 line
2.20.0
#39 lore raw

PATCH 14/46 ARM: pxa: use pdev resource for palmld mmio

In reply to Arnd Bergmann

The palmld header is almost unused in drivers, the only remaining thing now is the PATA device address, which should really be passed as a resource.

Cc Bartlomiej Zolnierkiewicz <[email protected]>
Cc Jens Axboe <[email protected]>
---
 arch/arm/mach-pxa/palmld-pcmcia.c             |  3 ++-
 arch/arm/mach-pxa/palmld.c                    | 12 +++++++++---
 arch/arm/mach-pxa/{include/mach => }/palmld.h |  2 +-
 drivers/ata/pata_palmld.c                     |  3 +--
 4 files changed, 13 insertions(+), 7 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/palmld.h (98%)
arch/arm/mach-pxa/palmld-pcmcia.c +2 -1
index 07e0f7438db1..720294a50864 100644
@@ -13,9 +13,10 @@
 #include <linux/gpio.h>
 
 #include <asm/mach-types.h>
-#include <mach/palmld.h>
 #include <pcmcia/soc_common.h>
 
+#include "palmld.h"
+
 static struct gpio palmld_pcmcia_gpios[] = {
 	{ GPIO_NR_PALMLD_PCMCIA_POWER,	GPIOF_INIT_LOW,	"PCMCIA Power" },
 	{ GPIO_NR_PALMLD_PCMCIA_RESET,	GPIOF_INIT_HIGH,"PCMCIA Reset" },
arch/arm/mach-pxa/palmld.c +9 -3
index d85146957004..d821606ce0b5 100644
@@ -29,8 +29,8 @@
 #include <asm/mach/map.h>
 
 #include "pxa27x.h"
+#include "palmld.h"
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/palmld.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/irda-pxaficp.h>
@@ -279,9 +279,15 @@ static inline void palmld_leds_init(void) {}
  * HDD
  ******************************************************************************/
 #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
+static struct resource palmld_ide_resources[] = {
+	DEFINE_RES_MEM(PALMLD_IDE_PHYS, 0x1000),
+};
+
 static struct platform_device palmld_ide_device = {
-	.name	= "pata_palmld",
-	.id	= -1,
+	.name		= "pata_palmld",
+	.id		= -1,
+	.resource	= palmld_ide_resources,
+	.num_resources	= ARRAY_SIZE(palmld_ide_resources),
 };
 
 static struct gpiod_lookup_table palmld_ide_gpio_table = {
arch/arm/mach-pxa/palmld.h renamed from arch/arm/mach-pxa/include/mach/palmld.h +1 -1
similarity index 98%
rename from arch/arm/mach-pxa/include/mach/palmld.h
rename to arch/arm/mach-pxa/palmld.h
index 99a6d8b3a1e3..ee3bc15b71a2 100644
@@ -9,7 +9,7 @@
 #ifndef _INCLUDE_PALMLD_H_
 #define _INCLUDE_PALMLD_H_
 
-#include "irqs.h" /* PXA_GPIO_TO_IRQ */
+#include <mach/irqs.h> /* PXA_GPIO_TO_IRQ */
 
 /** HERE ARE GPIOs **/
 
drivers/ata/pata_palmld.c +1 -2
index 2448441571ed..400e65190904 100644
@@ -25,7 +25,6 @@
 #include <linux/gpio/consumer.h>
 
 #include <scsi/scsi_host.h>
-#include <mach/palmld.h>
 
 #define DRV_NAME "pata_palmld"
 
@@ -63,7 +62,7 @@ static int palmld_pata_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	/* remap drive's physical memory address */
-	mem = devm_ioremap(dev, PALMLD_IDE_PHYS, 0x1000);
+	mem = devm_platform_ioremap_resource(pdev, 0);
 	if (!mem)
 		return -ENOMEM;
 
Signature · 1 line
2.20.0
maintainer Acked-by on v1 14/46
#40 lore raw

Re: [PATCH 14/46] ARM: pxa: use pdev resource for palmld mmio

Quoted 8 lines · Arnd Bergmann

The palmld header is almost unused in drivers, the only remaining thing now is the PATA device address, which should really be passed as a resource.

Cc Bartlomiej Zolnierkiewicz <[email protected]>
Cc Jens Axboe <[email protected]>

Cheers.

--
Robert

Acked-by on v1 14/46
#41 lore raw

Re: [PATCH 14/46] ARM: pxa: use pdev resource for palmld mmio

In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

The palmld header is almost unused in drivers, the only remaining thing now is the PATA device address, which should really be passed as a resource.

Cc Bartlomiej Zolnierkiewicz <[email protected]>
Cc Jens Axboe <[email protected]>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 93 lines
---
 arch/arm/mach-pxa/palmld-pcmcia.c             |  3 ++-
 arch/arm/mach-pxa/palmld.c                    | 12 +++++++++---
 arch/arm/mach-pxa/{include/mach => }/palmld.h |  2 +-
 drivers/ata/pata_palmld.c                     |  3 +--
 4 files changed, 13 insertions(+), 7 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/palmld.h (98%)
arch/arm/mach-pxa/palmld-pcmcia.c +2 -1
index 07e0f7438db1..720294a50864 100644
@@ -13,9 +13,10 @@
 #include <linux/gpio.h>
 
 #include <asm/mach-types.h>
-#include <mach/palmld.h>
 #include <pcmcia/soc_common.h>
 
+#include "palmld.h"
+
 static struct gpio palmld_pcmcia_gpios[] = {
 	{ GPIO_NR_PALMLD_PCMCIA_POWER,	GPIOF_INIT_LOW,	"PCMCIA Power" },
 	{ GPIO_NR_PALMLD_PCMCIA_RESET,	GPIOF_INIT_HIGH,"PCMCIA Reset" },
arch/arm/mach-pxa/palmld.c +9 -3
index d85146957004..d821606ce0b5 100644
@@ -29,8 +29,8 @@
 #include <asm/mach/map.h>
 
 #include "pxa27x.h"
+#include "palmld.h"
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/palmld.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/irda-pxaficp.h>
@@ -279,9 +279,15 @@ static inline void palmld_leds_init(void) {}
  * HDD
  ******************************************************************************/
 #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
+static struct resource palmld_ide_resources[] = {
+	DEFINE_RES_MEM(PALMLD_IDE_PHYS, 0x1000),
+};
+
 static struct platform_device palmld_ide_device = {
-	.name	= "pata_palmld",
-	.id	= -1,
+	.name		= "pata_palmld",
+	.id		= -1,
+	.resource	= palmld_ide_resources,
+	.num_resources	= ARRAY_SIZE(palmld_ide_resources),
 };
 
 static struct gpiod_lookup_table palmld_ide_gpio_table = {
arch/arm/mach-pxa/palmld.h renamed from arch/arm/mach-pxa/include/mach/palmld.h +1 -1
similarity index 98%
rename from arch/arm/mach-pxa/include/mach/palmld.h
rename to arch/arm/mach-pxa/palmld.h
index 99a6d8b3a1e3..ee3bc15b71a2 100644
@@ -9,7 +9,7 @@
 #ifndef _INCLUDE_PALMLD_H_
 #define _INCLUDE_PALMLD_H_
 
-#include "irqs.h" /* PXA_GPIO_TO_IRQ */
+#include <mach/irqs.h> /* PXA_GPIO_TO_IRQ */
 
 /** HERE ARE GPIOs **/
 
drivers/ata/pata_palmld.c +1 -2
index 2448441571ed..400e65190904 100644
@@ -25,7 +25,6 @@
 #include <linux/gpio/consumer.h>
 
 #include <scsi/scsi_host.h>
-#include <mach/palmld.h>
 
 #define DRV_NAME "pata_palmld"
 
@@ -63,7 +62,7 @@ static int palmld_pata_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	/* remap drive's physical memory address */
-	mem = devm_ioremap(dev, PALMLD_IDE_PHYS, 0x1000);
+	mem = devm_platform_ioremap_resource(pdev, 0);
 	if (!mem)
 		return -ENOMEM;
 
#42 lore raw

PATCH 15/46 ARM: pxa: maybe fix gpio lookup tables

In reply to Arnd Bergmann

From inspection I found a couple of GPIO lookups that are listed with device "gpio-pxa", but actually have a number from a different gpio controller.

Try to rectify that here, with a guess of what the actual device name is.

---
 arch/arm/mach-pxa/cm-x300.c  | 8 ++++----
 arch/arm/mach-pxa/magician.c | 2 +-
 arch/arm/mach-pxa/tosa.c     | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-pxa/cm-x300.c +4 -4
index 6cdc440672a6..92fbe4cf71c7 100644
@@ -357,13 +357,13 @@ static struct platform_device cm_x300_spi_gpio = {
 static struct gpiod_lookup_table cm_x300_spi_gpiod_table = {
 	.dev_id         = "spi_gpio",
 	.table          = {
-		GPIO_LOOKUP("gpio-pxa", GPIO_LCD_SCL,
+		GPIO_LOOKUP("pca9555.1", GPIO_LCD_SCL - GPIO_LCD_BASE,
 			    "sck", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("gpio-pxa", GPIO_LCD_DIN,
+		GPIO_LOOKUP("pca9555.1", GPIO_LCD_DIN - GPIO_LCD_BASE,
 			    "mosi", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("gpio-pxa", GPIO_LCD_DOUT,
+		GPIO_LOOKUP("pca9555.1", GPIO_LCD_DOUT - GPIO_LCD_BASE,
 			    "miso", GPIO_ACTIVE_HIGH),
-		GPIO_LOOKUP("gpio-pxa", GPIO_LCD_CS,
+		GPIO_LOOKUP("pca9555.1", GPIO_LCD_CS - GPIO_LCD_BASE,
 			    "cs", GPIO_ACTIVE_HIGH),
 		{ },
 	},
arch/arm/mach-pxa/magician.c +1 -1
index e925f7a8d349..31037679bf24 100644
@@ -675,7 +675,7 @@ static struct platform_device bq24022 = {
 static struct gpiod_lookup_table bq24022_gpiod_table = {
 	.dev_id = "gpio-regulator",
 	.table = {
-		GPIO_LOOKUP("gpio-pxa", EGPIO_MAGICIAN_BQ24022_ISET2,
+		GPIO_LOOKUP("htc-egpio-0", EGPIO_MAGICIAN_BQ24022_ISET2 - MAGICIAN_EGPIO_BASE,
 			    NULL, GPIO_ACTIVE_HIGH),
 		GPIO_LOOKUP("gpio-pxa", GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
 			    "enable", GPIO_ACTIVE_LOW),
arch/arm/mach-pxa/tosa.c +2 -2
index 23da9568c520..264b5b6ed13b 100644
@@ -295,9 +295,9 @@ static struct gpiod_lookup_table tosa_mci_gpio_table = {
 	.table = {
 		GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_nSD_DETECT,
 			    "cd", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_SD_WP,
+		GPIO_LOOKUP("sharp-scoop.0", TOSA_GPIO_SD_WP - TOSA_SCOOP_GPIO_BASE,
 			    "wp", GPIO_ACTIVE_LOW),
-		GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_PWR_ON,
+		GPIO_LOOKUP("sharp-scoop.0", TOSA_GPIO_PWR_ON - TOSA_SCOOP_GPIO_BASE,
 			    "power", GPIO_ACTIVE_HIGH),
 		{ },
 	},
Signature · 1 line
2.20.0
maintainer Acked-by on v1 15/46
#43 lore raw

Re: [PATCH 15/46] ARM: pxa: maybe fix gpio lookup tables

Quoted 8 lines · Arnd Bergmann

From inspection I found a couple of GPIO lookups that are listed with device "gpio-pxa", but actually have a number from a different gpio controller.

Try to rectify that here, with a guess of what the actual device name is.

Ah yes that's a good catch, maybe something like this could be added :

Fixes 32d1544880aa ("ARM: pxa: Add gpio descriptor lookup tables for MMC CD/WP")
Fixes 9b00bc7b901f ("spi: spi-gpio: Rewrite to use GPIO descriptors")

Thanks for fixing this.

Cheers.

--
Robert

Reviewed-by on v1 15/46
#44 lore raw

Re: [PATCH 15/46] ARM: pxa: maybe fix gpio lookup tables

In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

From inspection I found a couple of GPIO lookups that are listed with device "gpio-pxa", but actually have a number from a different gpio controller.

Try to rectify that here, with a guess of what the actual device name is.

OOps my mistakes:

I suppose this tells us a bit about how much these platforms are getting tested in real life though :/

Yours,
Linus Walleij

#45 lore raw

PATCH 16/46 ARM: pxa: tosa: use gpio descriptor for audio

In reply to Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

---
 arch/arm/mach-pxa/tosa.c | 12 ++++++++++++
 sound/soc/pxa/tosa.c     | 16 +++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)
arch/arm/mach-pxa/tosa.c +12 -0
index 264b5b6ed13b..9a7f1e42adac 100644
@@ -859,6 +859,17 @@ static struct platform_device wm9712_device = {
 	.id	= -1,
 };
 
+static struct gpiod_lookup_table tosa_audio_gpio_table = {
+	.dev_id = "tosa-audio",
+	.table = {
+		GPIO_LOOKUP("tc6393xb",
+			    TOSA_GPIO_L_MUTE - TOSA_TC6393XB_GPIO_BASE,
+			    "l-mute", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
+
 static struct platform_device tosa_audio_device = {
 	.name	= "tosa-audio",
 	.id	= -1,
@@ -916,6 +927,7 @@ static void __init tosa_init(void)
 	PMCR = 0x01;
 
 	gpiod_add_lookup_table(&tosa_mci_gpio_table);
+	gpiod_add_lookup_table(&tosa_audio_gpio_table);
 	pxa_set_mci_info(&tosa_mci_platform_data);
 	pxa_set_ficp_info(&tosa_ficp_platform_data);
 	pxa_set_i2c_info(NULL);
sound/soc/pxa/tosa.c +7 -9
index 81ee1bcf4c44..d671cf3d44ed 100644
@@ -16,14 +16,13 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/device.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/tosa.h>
 #include <linux/platform_data/asoc-pxa.h>
 
 #define TOSA_HP        0
@@ -35,6 +34,7 @@
 
 static int tosa_jack_func;
 static int tosa_spk_func;
+static struct gpio_desc *l_mute_gpio;
 
 static void tosa_ext_control(struct snd_soc_dapm_context *dapm)
 {
@@ -128,7 +128,7 @@ static int tosa_set_spk(struct snd_kcontrol *kcontrol,
 static int tosa_hp_event(struct snd_soc_dapm_widget *w,
 	struct snd_kcontrol *k, int event)
 {
-	gpio_set_value(TOSA_GPIO_L_MUTE, SND_SOC_DAPM_EVENT_ON(event) ? 1 : 0);
+	gpiod_set_value(l_mute_gpio, SND_SOC_DAPM_EVENT_ON(event) ? 1 : 0);
 	return 0;
 }
 
@@ -222,25 +222,23 @@ static int tosa_probe(struct platform_device *pdev)
 	struct snd_soc_card *card = &tosa;
 	int ret;
 
-	ret = gpio_request_one(TOSA_GPIO_L_MUTE, GPIOF_OUT_INIT_LOW,
-			       "Headphone Jack");
+	l_mute_gpio = devm_gpiod_get(&pdev->dev, "l-mute", GPIOD_OUT_LOW);
+	ret = PTR_ERR_OR_ZERO(l_mute_gpio);
 	if (ret)
 		return ret;
 
 	card->dev = &pdev->dev;
 
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
-	if (ret) {
+	if (ret)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
 			ret);
-		gpio_free(TOSA_GPIO_L_MUTE);
-	}
+
 	return ret;
 }
 
 static int tosa_remove(struct platform_device *pdev)
 {
-	gpio_free(TOSA_GPIO_L_MUTE);
 	return 0;
 }
 
Signature · 1 line
2.20.0
maintainer Acked-by on v1 16/46
#46 lore raw

Re: [PATCH 16/46] ARM: pxa: tosa: use gpio descriptor for audio

Quoted 2 lines · Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

#48 lore raw

PATCH 17/46 ARM: pxa: poodle: use platform data for poodle asoc driver

In reply to Arnd Bergmann

The poodle audio driver shows its age by using a custom gpio api for the "locomo" support chip.

In a perfect world, this would get converted to use gpiolib and a gpio lookup table.

As the world is not perfect, just pass all the required data in a custom platform_data structure. to avoid the globally visible mach/poodle.h header.

---
 arch/arm/mach-pxa/poodle.c                    | 30 ++++++++----
 arch/arm/mach-pxa/{include/mach => }/poodle.h |  4 +-
 include/linux/platform_data/asoc-poodle.h     | 16 ++++++
 sound/soc/pxa/poodle.c                        | 49 ++++++++++---------
 4 files changed, 63 insertions(+), 36 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/poodle.h (97%)
 create mode 100644 include/linux/platform_data/asoc-poodle.h
arch/arm/mach-pxa/poodle.c +20 -10
index 8dd791ee49bf..7709fe026c33 100644
@@ -39,11 +39,13 @@
 #include <asm/mach/irq.h>
 
 #include "pxa25x.h"
-#include <linux/platform_data/mmc-pxamci.h>
 #include "udc.h"
+#include "poodle.h"
+
+#include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/irda-pxaficp.h>
-#include <mach/poodle.h>
 #include <linux/platform_data/video-pxafb.h>
+#include <linux/platform_data/asoc-poodle.h>
 
 #include <asm/hardware/scoop.h>
 #include <asm/hardware/locomo.h>
@@ -155,12 +157,6 @@ static struct scoop_pcmcia_config poodle_pcmcia_config = {
 
 EXPORT_SYMBOL(poodle_scoop_device);
 
-
-static struct platform_device poodle_audio_device = {
-	.name	= "poodle-audio",
-	.id	= -1,
-};
-
 /* LoCoMo device */
 static struct resource locomo_resources[] = {
 	[0] = {
@@ -179,7 +175,7 @@ static struct locomo_platform_data locomo_info = {
 	.irq_base	= IRQ_BOARD_START,
 };
 
-struct platform_device poodle_locomo_device = {
+static struct platform_device poodle_locomo_device = {
 	.name		= "locomo",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(locomo_resources),
@@ -189,7 +185,21 @@ struct platform_device poodle_locomo_device = {
 	},
 };
 
-EXPORT_SYMBOL(poodle_locomo_device);
+static struct poodle_audio_platform_data poodle_audio_pdata = {
+	.locomo_dev	= &poodle_locomo_device.dev,
+
+	.gpio_amp_on   	= POODLE_LOCOMO_GPIO_AMP_ON,
+	.gpio_mute_l   	= POODLE_LOCOMO_GPIO_MUTE_L,
+	.gpio_mute_r   	= POODLE_LOCOMO_GPIO_MUTE_R,
+	.gpio_232vcc_on	= POODLE_LOCOMO_GPIO_232VCC_ON,
+	.gpio_jk_b     	= POODLE_LOCOMO_GPIO_JK_B,
+};
+
+static struct platform_device poodle_audio_device = {
+	.name	= "poodle-audio",
+	.id	= -1,
+	.dev.platform_data = &poodle_audio_pdata,
+};
 
 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
 static struct pxa2xx_spi_controller poodle_spi_info = {
arch/arm/mach-pxa/poodle.h renamed from arch/arm/mach-pxa/include/mach/poodle.h +1 -3
similarity index 97%
rename from arch/arm/mach-pxa/include/mach/poodle.h
rename to arch/arm/mach-pxa/poodle.h
index b56b19351a03..e675a3d1aa18 100644
@@ -15,7 +15,7 @@
 #ifndef __ASM_ARCH_POODLE_H
 #define __ASM_ARCH_POODLE_H  1
 
-#include "irqs.h" /* PXA_GPIO_TO_IRQ */
+#include <mach/irqs.h> /* PXA_GPIO_TO_IRQ */
 
 /*
  * GPIOs
@@ -89,6 +89,4 @@
 
 #define POODLE_NR_IRQS		(IRQ_BOARD_START + 4)	/* 4 for LoCoMo */
 
-extern struct platform_device poodle_locomo_device;
-
 #endif /* __ASM_ARCH_POODLE_H  */
include/linux/platform_data/asoc-poodle.h new file +16 -0
new file mode 100644
index 000000000000..2052fad55c5c
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __LINUX_PLATFORM_DATA_POODLE_AUDIO
+#define __LINUX_PLATFORM_DATA_POODLE_AUDIO
+
+/* locomo is not a proper gpio driver, and uses its own api */
+struct poodle_audio_platform_data {
+	struct device	*locomo_dev;
+
+	int		gpio_amp_on;
+	int		gpio_mute_l;
+	int		gpio_mute_r;
+	int		gpio_232vcc_on;
+	int		gpio_jk_b;
+};
+
+#endif
sound/soc/pxa/poodle.c +26 -23

89 lines not on this page · raw message

Signature · 6 lines
2.20.0

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
maintainer Acked-by on v1 17/46
#49 lore raw

Re: [PATCH 17/46] ARM: pxa: poodle: use platform data for poodle asoc driver

Quoted 2 lines · Arnd Bergmann

The poodle audio driver shows its age by using a custom gpio api for the "locomo" support chip.

maintainer Acked-by on v1 17/46
#50 lore raw

Re: [PATCH 17/46] ARM: pxa: poodle: use platform data for poodle asoc driver

In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

The poodle audio driver shows its age by using a custom gpio api for the "locomo" support chip.

In a perfect world, this would get converted to use gpiolib and a gpio lookup table.

Quoted 7 lines

As the world is not perfect, just pass all the required data in a custom platform_data structure. to avoid the globally visible mach/poodle.h header.

Cheers.

--
Robert

#51 lore raw

PATCH 18/46 ARM: pxa: corgi: use gpio descriptors for audio

In reply to Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

---
 arch/arm/mach-pxa/corgi.c                    | 22 ++++++++++-
 arch/arm/mach-pxa/{include/mach => }/corgi.h |  2 +-
 arch/arm/mach-pxa/corgi_pm.c                 |  2 +-
 sound/soc/pxa/corgi.c                        | 40 +++++++++++++-------
 4 files changed, 50 insertions(+), 16 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/corgi.h (98%)
arch/arm/mach-pxa/corgi.c +21 -1
index e9743ebbee86..0ff8e8140513 100644
@@ -49,7 +49,7 @@
 #include <linux/platform_data/irda-pxaficp.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include "udc.h"
-#include <mach/corgi.h>
+#include "corgi.h"
 #include "sharpsl_pm.h"
 
 #include <asm/mach/sharpsl_param.h>
@@ -472,6 +472,25 @@ static struct platform_device corgiled_device = {
 	},
 };
 
+static struct gpiod_lookup_table corgi_audio_gpio_table = {
+	.dev_id = "corgi-audio",
+	.table = {
+		GPIO_LOOKUP("sharp-scoop",
+			    CORGI_GPIO_MUTE_L - CORGI_SCOOP_GPIO_BASE,
+			    "mute-l", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop",
+			    CORGI_GPIO_MUTE_R - CORGI_SCOOP_GPIO_BASE,
+			    "mute-r", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop",
+			    CORGI_GPIO_APM_ON - CORGI_SCOOP_GPIO_BASE,
+			    "apm-on", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop",
+			    CORGI_GPIO_MIC_BIAS - CORGI_SCOOP_GPIO_BASE,
+			    "mic-bias", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 /*
  * Corgi Audio
  */
@@ -740,6 +759,7 @@ static void __init corgi_init(void)
 
  	pxa_set_udc_info(&udc_info);
 	gpiod_add_lookup_table(&corgi_mci_gpio_table);
+	gpiod_add_lookup_table(&corgi_audio_gpio_table);
 	pxa_set_mci_info(&corgi_mci_platform_data);
 	pxa_set_ficp_info(&corgi_ficp_platform_data);
 	pxa_set_i2c_info(NULL);
arch/arm/mach-pxa/corgi.h renamed from arch/arm/mach-pxa/include/mach/corgi.h +1 -1
similarity index 98%
rename from arch/arm/mach-pxa/include/mach/corgi.h
rename to arch/arm/mach-pxa/corgi.h
index b565ca7b8cda..fe2fcf6532b9 100644
@@ -9,7 +9,7 @@
 #ifndef __ASM_ARCH_CORGI_H
 #define __ASM_ARCH_CORGI_H  1
 
-#include "irqs.h" /* PXA_NR_BUILTIN_GPIO */
+#include <mach/irqs.h> /* PXA_NR_BUILTIN_GPIO */
 
 /*
  * Corgi (Non Standard) GPIO Definitions
arch/arm/mach-pxa/corgi_pm.c +1 -1
index ff1ac9bf37cb..c6ddfc737644 100644
@@ -20,7 +20,7 @@
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/corgi.h>
+#include "corgi.h"
 #include <mach/pxa2xx-regs.h>
 #include "sharpsl_pm.h"
 
sound/soc/pxa/corgi.c +27 -13
index 47647a1c3124..9db5a3d3606e 100644
@@ -21,7 +21,6 @@
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/corgi.h>
 #include <linux/platform_data/asoc-pxa.h>
 
 #include "../codecs/wm8731.h"
@@ -41,6 +40,8 @@
 static int corgi_jack_func;
 static int corgi_spk_func;
 
+struct gpio_desc *gpiod_mute_l, *gpiod_mute_r, *gpiod_apm_on, *gpiod_mic_bias;
+
 static void corgi_ext_control(struct snd_soc_dapm_context *dapm)
 {
 	snd_soc_dapm_mutex_lock(dapm);
@@ -49,8 +50,8 @@ static void corgi_ext_control(struct snd_soc_dapm_context *dapm)
 	switch (corgi_jack_func) {
 	case CORGI_HP:
 		/* set = unmute headphone */
-		gpio_set_value(CORGI_GPIO_MUTE_L, 1);
-		gpio_set_value(CORGI_GPIO_MUTE_R, 1);
+		gpiod_set_value(gpiod_mute_l, 1);
+		gpiod_set_value(gpiod_mute_r, 1);
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Jack");
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Line Jack");
 		snd_soc_dapm_enable_pin_unlocked(dapm, "Headphone Jack");
@@ -58,24 +59,24 @@ static void corgi_ext_control(struct snd_soc_dapm_context *dapm)
 		break;
 	case CORGI_MIC:
 		/* reset = mute headphone */
-		gpio_set_value(CORGI_GPIO_MUTE_L, 0);
-		gpio_set_value(CORGI_GPIO_MUTE_R, 0);
+		gpiod_set_value(gpiod_mute_l, 0);
+		gpiod_set_value(gpiod_mute_r, 0);
 		snd_soc_dapm_enable_pin_unlocked(dapm, "Mic Jack");
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Line Jack");
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Headphone Jack");
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Headset Jack");
 		break;
 	case CORGI_LINE:
-		gpio_set_value(CORGI_GPIO_MUTE_L, 0);
-		gpio_set_value(CORGI_GPIO_MUTE_R, 0);
+		gpiod_set_value(gpiod_mute_l, 0);
+		gpiod_set_value(gpiod_mute_r, 0);
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Jack");
 		snd_soc_dapm_enable_pin_unlocked(dapm, "Line Jack");
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Headphone Jack");
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Headset Jack");
 		break;
 	case CORGI_HEADSET:
-		gpio_set_value(CORGI_GPIO_MUTE_L, 0);
-		gpio_set_value(CORGI_GPIO_MUTE_R, 1);
+		gpiod_set_value(gpiod_mute_l, 0);
+		gpiod_set_value(gpiod_mute_r, 1);
 		snd_soc_dapm_enable_pin_unlocked(dapm, "Mic Jack");
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Line Jack");
 		snd_soc_dapm_disable_pin_unlocked(dapm, "Headphone Jack");
@@ -108,8 +109,8 @@ static int corgi_startup(struct snd_pcm_substream *substream)
 static void corgi_shutdown(struct snd_pcm_substream *substream)
 {
 	/* set = unmute headphone */
-	gpio_set_value(CORGI_GPIO_MUTE_L, 1);
-	gpio_set_value(CORGI_GPIO_MUTE_R, 1);
+	gpiod_set_value(gpiod_mute_l, 1);
+	gpiod_set_value(gpiod_mute_r, 1);
 }
 
 static int corgi_hw_params(struct snd_pcm_substream *substream,
@@ -199,14 +200,14 @@ static int corgi_set_spk(struct snd_kcontrol *kcontrol,
 static int corgi_amp_event(struct snd_soc_dapm_widget *w,
 	struct snd_kcontrol *k, int event)
 {
-	gpio_set_value(CORGI_GPIO_APM_ON, SND_SOC_DAPM_EVENT_ON(event));
+	gpiod_set_value(gpiod_apm_on, SND_SOC_DAPM_EVENT_ON(event));
 	return 0;
 }
 
 static int corgi_mic_event(struct snd_soc_dapm_widget *w,
 	struct snd_kcontrol *k, int event)
 {
-	gpio_set_value(CORGI_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event));
+	gpiod_set_value(gpiod_mic_bias, SND_SOC_DAPM_EVENT_ON(event));
 	return 0;
 }
 
@@ -293,6 +294,19 @@ static int corgi_probe(struct platform_device *pdev)
 
 	card->dev = &pdev->dev;
 
+	gpiod_mute_l = devm_gpiod_get(&pdev->dev, "mute-l", GPIOD_OUT_HIGH);
+	if (IS_ERR(gpiod_mute_l))
+		return PTR_ERR(gpiod_mute_l);
+	gpiod_mute_r = devm_gpiod_get(&pdev->dev, "mute-r", GPIOD_OUT_HIGH);
+	if (IS_ERR(gpiod_mute_r))
+		return PTR_ERR(gpiod_mute_r);
+	gpiod_apm_on = devm_gpiod_get(&pdev->dev, "apm-on", GPIOD_OUT_LOW);
+	if (IS_ERR(gpiod_apm_on))
+		return PTR_ERR(gpiod_apm_on);
+	gpiod_mic_bias = devm_gpiod_get(&pdev->dev, "mic-bias", GPIOD_OUT_LOW);
+	if (IS_ERR(gpiod_mic_bias))
+		return PTR_ERR(gpiod_mic_bias);
+
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
 	if (ret)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
Signature · 1 line
2.20.0
maintainer Acked-by on v1 18/46
#52 lore raw

Re: [PATCH 18/46] ARM: pxa: corgi: use gpio descriptors for audio

Quoted 2 lines · Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

maintainer Acked-by on v1 18/46
#53 lore raw

Re: [PATCH 18/46] ARM: pxa: corgi: use gpio descriptors for audio

In reply to Arnd Bergmann

sound/soc/pxa/corgi.c line 44

Quoted 12 lines · Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

sound/soc/pxa/corgi.c +1 -0
@@ -41,6 +40,8 @@
 static int corgi_jack_func;
 static int corgi_spk_func;
 
+struct gpio_desc *gpiod_mute_l, *gpiod_mute_r, *gpiod_apm_on,
 *gpiod_mic_bias;

Can't this be static ?

Otherwise :

Cheers.

--
Robert

#54 lore raw

PATCH 19/46 ARM: pxa: hx4700: use gpio descriptors for audio

In reply to Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

---
 arch/arm/mach-pxa/hx4700-pcmcia.c             |  2 +-
 arch/arm/mach-pxa/hx4700.c                    | 16 ++++++++-
 arch/arm/mach-pxa/{include/mach => }/hx4700.h |  2 +-
 sound/soc/pxa/hx4700.c                        | 34 ++++++++-----------
 4 files changed, 31 insertions(+), 23 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/hx4700.h (99%)
arch/arm/mach-pxa/hx4700-pcmcia.c +1 -1
index e8acbfc9ef6c..e2331dfe427d 100644
@@ -10,7 +10,7 @@
 #include <linux/irq.h>
 
 #include <asm/mach-types.h>
-#include <mach/hx4700.h>
+#include "hx4700.h"
 
 #include <pcmcia/soc_common.h>
 
arch/arm/mach-pxa/hx4700.c +15 -1
index b3dcbe291e13..84383d14bf64 100644
@@ -42,7 +42,7 @@
 
 #include "pxa27x.h"
 #include "addr-map.h"
-#include <mach/hx4700.h>
+#include "hx4700.h"
 #include <linux/platform_data/irda-pxaficp.h>
 
 #include <sound/ak4641.h>
@@ -823,6 +823,19 @@ static struct i2c_board_info i2c_board_info[] __initdata = {
 	},
 };
 
+static struct gpiod_lookup_table hx4700_audio_gpio_table = {
+	.dev_id = "hx4700-audio",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET,
+			    "earphone-ndet", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("gpio-pxa", GPIO92_HX4700_HP_DRIVER,
+			    "hp-driver", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("gpio-pxa", GPIO107_HX4700_SPK_nSD,
+			    "spk-nsd", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 static struct platform_device audio = {
 	.name	= "hx4700-audio",
 	.id	= -1,
@@ -883,6 +896,7 @@ static void __init hx4700_init(void)
 	pxa_set_stuart_info(NULL);
 
 	gpiod_add_lookup_table(&bq24022_gpiod_table);
+	gpiod_add_lookup_table(&hx4700_audio_gpio_table);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	pwm_add_table(hx4700_pwm_lookup, ARRAY_SIZE(hx4700_pwm_lookup));
 
arch/arm/mach-pxa/hx4700.h renamed from arch/arm/mach-pxa/include/mach/hx4700.h +1 -1
similarity index 99%
rename from arch/arm/mach-pxa/include/mach/hx4700.h
rename to arch/arm/mach-pxa/hx4700.h
index 0c30e6d9c660..ce2db33989e1 100644
@@ -10,7 +10,7 @@
 
 #include <linux/gpio.h>
 #include <linux/mfd/asic3.h>
-#include "irqs.h" /* PXA_NR_BUILTIN_GPIO */
+#include <mach/irqs.h> /* PXA_NR_BUILTIN_GPIO */
 
 #define HX4700_ASIC3_GPIO_BASE	PXA_NR_BUILTIN_GPIO
 #define HX4700_EGPIO_BASE	(HX4700_ASIC3_GPIO_BASE + ASIC3_NUM_GPIOS)
sound/soc/pxa/hx4700.c +14 -20
index 0139343dbcce..2fae601f0844 100644
@@ -10,7 +10,7 @@
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 
 #include <sound/core.h>
 #include <sound/jack.h>
@@ -18,10 +18,10 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 
-#include <mach/hx4700.h>
 #include <asm/mach-types.h>
 #include "pxa2xx-i2s.h"
 
+static struct gpio_desc *gpiod_hp_driver, *gpiod_spk_nsd;
 static struct snd_soc_jack hs_jack;
 
 /* Headphones jack detection DAPM pin */
@@ -40,9 +40,8 @@ static struct snd_soc_jack_pin hs_jack_pin[] = {
 
 /* Headphones jack detection GPIO */
 static struct snd_soc_jack_gpio hs_jack_gpio = {
-	.gpio		= GPIO75_HX4700_EARPHONE_nDET,
 	.invert		= true,
-	.name		= "hp-gpio",
+	.name		= "earphone-ndet",
 	.report		= SND_JACK_HEADPHONE,
 	.debounce_time	= 200,
 };
@@ -81,14 +80,14 @@ static const struct snd_soc_ops hx4700_ops = {
 static int hx4700_spk_power(struct snd_soc_dapm_widget *w,
 			    struct snd_kcontrol *k, int event)
 {
-	gpio_set_value(GPIO107_HX4700_SPK_nSD, !!SND_SOC_DAPM_EVENT_ON(event));
+	gpiod_set_value(gpiod_spk_nsd, !!SND_SOC_DAPM_EVENT_ON(event));
 	return 0;
 }
 
 static int hx4700_hp_power(struct snd_soc_dapm_widget *w,
 			   struct snd_kcontrol *k, int event)
 {
-	gpio_set_value(GPIO92_HX4700_HP_DRIVER, !!SND_SOC_DAPM_EVENT_ON(event));
+	gpiod_set_value(gpiod_hp_driver, !!SND_SOC_DAPM_EVENT_ON(event));
 	return 0;
 }
 
@@ -162,11 +161,6 @@ static struct snd_soc_card snd_soc_card_hx4700 = {
 	.fully_routed		= true,
 };
 
-static struct gpio hx4700_audio_gpios[] = {
-	{ GPIO107_HX4700_SPK_nSD, GPIOF_OUT_INIT_HIGH, "SPK_POWER" },
-	{ GPIO92_HX4700_HP_DRIVER, GPIOF_OUT_INIT_LOW, "EP_POWER" },
-};
-
 static int hx4700_audio_probe(struct platform_device *pdev)
 {
 	int ret;
@@ -174,26 +168,26 @@ static int hx4700_audio_probe(struct platform_device *pdev)
 	if (!machine_is_h4700())
 		return -ENODEV;
 
-	ret = gpio_request_array(hx4700_audio_gpios,
-				ARRAY_SIZE(hx4700_audio_gpios));
+	gpiod_hp_driver = devm_gpiod_get(&pdev->dev, "hp-driver", GPIOD_OUT_HIGH);
+	ret = PTR_ERR_OR_ZERO(gpiod_hp_driver);
+	if (ret)
+		return ret;
+	gpiod_spk_nsd = devm_gpiod_get(&pdev->dev, "spk-nsd", GPIOD_OUT_HIGH);
+	ret = PTR_ERR_OR_ZERO(gpiod_spk_nsd);
 	if (ret)
 		return ret;
 
+	hs_jack_gpio.gpiod_dev = &pdev->dev;
 	snd_soc_card_hx4700.dev = &pdev->dev;
 	ret = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_hx4700);
-	if (ret)
-		gpio_free_array(hx4700_audio_gpios,
-				ARRAY_SIZE(hx4700_audio_gpios));
 
 	return ret;
 }
 
 static int hx4700_audio_remove(struct platform_device *pdev)
 {
-	gpio_set_value(GPIO92_HX4700_HP_DRIVER, 0);
-	gpio_set_value(GPIO107_HX4700_SPK_nSD, 0);
-
-	gpio_free_array(hx4700_audio_gpios, ARRAY_SIZE(hx4700_audio_gpios));
+	gpiod_set_value(gpiod_hp_driver, 0);
+	gpiod_set_value(gpiod_spk_nsd, 0);
 	return 0;
 }
 
Signature · 1 line
2.20.0
maintainer Acked-by on v1 19/46
#55 lore raw

Re: [PATCH 19/46] ARM: pxa: hx4700: use gpio descriptors for audio

Quoted 2 lines · Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

maintainer Acked-by on v1 19/46
#56 lore raw

Re: [PATCH 19/46] ARM: pxa: hx4700: use gpio descriptors for audio

In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

Cheers.

--
Robert

#57 lore raw

PATCH 20/46 ARM: pxa: lubbock: pass udc irqs as resource

In reply to Arnd Bergmann

Lubbock is the only machine that has three IRQs for the UDC. These are currently hardcoded in the driver based on a machine header file.

Change this to use platform device resources as we use for the generic IRQ anyway.

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/mach-pxa/lubbock.c                   | 12 +++++-
 .../arm/mach-pxa/{include/mach => }/lubbock.h |  2 -
 drivers/usb/gadget/udc/pxa25x_udc.c           | 37 ++++++++++---------
 drivers/usb/gadget/udc/pxa25x_udc.h           |  7 +---
 4 files changed, 32 insertions(+), 26 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/lubbock.h (97%)
arch/arm/mach-pxa/lubbock.c +11 -1
index 098605c8eeed..187d9d8893d7 100644
@@ -46,7 +46,7 @@
 
 #include "pxa25x.h"
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/lubbock.h>
+#include "lubbock.h"
 #include "udc.h"
 #include <linux/platform_data/irda-pxaficp.h>
 #include <linux/platform_data/video-pxafb.h>
@@ -131,6 +131,13 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
 	// no D+ pullup; lubbock can't connect/disconnect in software
 };
 
+static struct resource lubbock_udc_resources[] = {
+	DEFINE_RES_MEM(0x40600000, 0x10000),
+	DEFINE_RES_IRQ(IRQ_USB),
+	DEFINE_RES_IRQ(LUBBOCK_USB_IRQ),
+	DEFINE_RES_IRQ(LUBBOCK_USB_DISC_IRQ),
+};
+
 /* GPIOs for SA1111 PCMCIA */
 static struct gpiod_lookup_table sa1111_pcmcia_gpio_table = {
 	.dev_id = "1800",
@@ -495,6 +502,9 @@ static void __init lubbock_init(void)
 	lubbock_init_pcmcia();
 
 	clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL);
+	/* lubbock has two extra IRQs */
+	pxa25x_device_udc.resource = lubbock_udc_resources;
+	pxa25x_device_udc.num_resources = ARRAY_SIZE(lubbock_udc_resources);
 	pxa_set_udc_info(&udc_info);
 	pxa_set_fb_info(NULL, &sharp_lm8v31);
 	pxa_set_mci_info(&lubbock_mci_platform_data);
arch/arm/mach-pxa/lubbock.h renamed from arch/arm/mach-pxa/include/mach/lubbock.h +0 -2
similarity index 97%
rename from arch/arm/mach-pxa/include/mach/lubbock.h
rename to arch/arm/mach-pxa/lubbock.h
index a3af4a2f9446..8e3ff7d57121 100644
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- *  arch/arm/mach-pxa/include/mach/lubbock.h
- *
  *  Author:	Nicolas Pitre
  *  Created:	Jun 15, 2001
  *  Copyright:	MontaVista Software Inc.
drivers/usb/gadget/udc/pxa25x_udc.c +19 -18
index d4be53559f2e..ed7ae48b7db2 100644
@@ -44,10 +44,6 @@
 #include <linux/usb/gadget.h>
 #include <linux/usb/otg.h>
 
-#ifdef CONFIG_ARCH_LUBBOCK
-#include <mach/lubbock.h>
-#endif
-
 #define UDCCR	 0x0000 /* UDC Control Register */
 #define UDC_RES1 0x0004 /* UDC Undocumented - Reserved1 */
 #define UDC_RES2 0x0008 /* UDC Undocumented - Reserved2 */
@@ -1575,18 +1571,15 @@ lubbock_vbus_irq(int irq, void *_dev)
 	int			vbus;
 
 	dev->stats.irqs++;
-	switch (irq) {
-	case LUBBOCK_USB_IRQ:
+	if (irq == dev->usb_irq) {
 		vbus = 1;
-		disable_irq(LUBBOCK_USB_IRQ);
-		enable_irq(LUBBOCK_USB_DISC_IRQ);
-		break;
-	case LUBBOCK_USB_DISC_IRQ:
+		disable_irq(dev->usb_irq);
+		enable_irq(dev->usb_disc_irq);
+	} else if (irq == dev->usb_disc_irq) {
 		vbus = 0;
-		disable_irq(LUBBOCK_USB_DISC_IRQ);
-		enable_irq(LUBBOCK_USB_IRQ);
-		break;
-	default:
+		disable_irq(dev->usb_disc_irq);
+		enable_irq(dev->usb_irq);
+	} else {
 		return IRQ_NONE;
 	}
 
@@ -2421,20 +2414,28 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_ARCH_LUBBOCK
 	if (machine_is_lubbock()) {
-		retval = devm_request_irq(&pdev->dev, LUBBOCK_USB_DISC_IRQ,
+		dev->usb_irq = platform_get_irq(pdev, 1);
+		if (dev->usb_irq < 0)
+			return dev->usb_irq;
+
+		dev->usb_disc_irq = platform_get_irq(pdev, 2);
+		if (dev->usb_disc_irq < 0)
+			return dev->usb_disc_irq;
+
+		retval = devm_request_irq(&pdev->dev, dev->usb_disc_irq,
 					  lubbock_vbus_irq, 0, driver_name,
 					  dev);
 		if (retval != 0) {
 			pr_err("%s: can't get irq %i, err %d\n",
-				driver_name, LUBBOCK_USB_DISC_IRQ, retval);
+				driver_name, dev->usb_disc_irq, retval);
 			goto err;
 		}
-		retval = devm_request_irq(&pdev->dev, LUBBOCK_USB_IRQ,
+		retval = devm_request_irq(&pdev->dev, dev->usb_irq,
 					  lubbock_vbus_irq, 0, driver_name,
 					  dev);
 		if (retval != 0) {
 			pr_err("%s: can't get irq %i, err %d\n",
-				driver_name, LUBBOCK_USB_IRQ, retval);
+				driver_name, dev->usb_irq, retval);
 			goto err;
 		}
 	} else
drivers/usb/gadget/udc/pxa25x_udc.h +2 -5
index ccc6b921f067..c574fb602741 100644
@@ -121,16 +121,13 @@ struct pxa25x_udc {
 	struct dentry				*debugfs_udc;
 #endif
 	void __iomem				*regs;
+	int					usb_irq;
+	int					usb_disc_irq;
 };
 #define to_pxa25x(g)	(container_of((g), struct pxa25x_udc, gadget))
 
 /*-------------------------------------------------------------------------*/
 
-#ifdef CONFIG_ARCH_LUBBOCK
-#include <mach/lubbock.h>
-/* lubbock can also report usb connect/disconnect irqs */
-#endif
-
 static struct pxa25x_udc *the_controller;
 
 /*-------------------------------------------------------------------------*/
Signature · 1 line
2.20.0
maintainer Acked-by on v1 20/46
#58 lore raw

Re: [PATCH 20/46] ARM: pxa: lubbock: pass udc irqs as resource

Quoted 11 lines · Arnd Bergmann

Lubbock is the only machine that has three IRQs for the UDC. These are currently hardcoded in the driver based on a machine header file.

Change this to use platform device resources as we use for the generic IRQ anyway.

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

Cheers.

--
Robert

#59 lore raw

PATCH 21/46 ARM: pxa: spitz: use gpio descriptors for audio

In reply to Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

---
 arch/arm/mach-pxa/spitz.c                    | 33 ++++++++++-
 arch/arm/mach-pxa/{include/mach => }/spitz.h |  2 +-
 arch/arm/mach-pxa/spitz_pm.c                 |  2 +-
 sound/soc/pxa/spitz.c                        | 58 ++++++++------------
 4 files changed, 57 insertions(+), 38 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/spitz.h (99%)
arch/arm/mach-pxa/spitz.c +32 -1
index a4fdc399d152..6028fd83c44d 100644
@@ -44,7 +44,7 @@
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/video-pxafb.h>
-#include <mach/spitz.h>
+#include "spitz.h"
 #include "sharpsl_pm.h"
 #include <mach/smemc.h>
 
@@ -948,11 +948,42 @@ static void __init spitz_i2c_init(void)
 static inline void spitz_i2c_init(void) {}
 #endif
 
+static struct gpiod_lookup_table spitz_audio_gpio_table = {
+	.dev_id = "spitz-audio",
+	.table = {
+		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_L - SPITZ_SCP_GPIO_BASE,
+			    "mute-l", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R - SPITZ_SCP_GPIO_BASE,
+			    "mute-r", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.1", SPITZ_GPIO_MIC_BIAS - SPITZ_SCP2_GPIO_BASE,
+			    "mic", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
+static struct gpiod_lookup_table akita_audio_gpio_table = {
+	.dev_id = "spitz-audio",
+	.table = {
+		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_L - SPITZ_SCP_GPIO_BASE,
+			    "mute-l", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R - SPITZ_SCP_GPIO_BASE,
+			    "mute-r", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_MIC_BIAS - AKITA_IOEXP_GPIO_BASE,
+			    "mic", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 /******************************************************************************
  * Audio devices
  ******************************************************************************/
 static inline void spitz_audio_init(void)
 {
+	if (machine_is_akita())
+		gpiod_add_lookup_table(&akita_audio_gpio_table);
+	else
+		gpiod_add_lookup_table(&spitz_audio_gpio_table);
+
 	platform_device_register_simple("spitz-audio", -1, NULL, 0);
 }
 
arch/arm/mach-pxa/spitz.h renamed from arch/arm/mach-pxa/include/mach/spitz.h +1 -1
similarity index 99%
rename from arch/arm/mach-pxa/include/mach/spitz.h
rename to arch/arm/mach-pxa/spitz.h
index 04828d8918aa..f97e3ebd762d 100644
@@ -11,7 +11,7 @@
 #define __ASM_ARCH_SPITZ_H  1
 #endif
 
-#include "irqs.h" /* PXA_NR_BUILTIN_GPIO, PXA_GPIO_TO_IRQ */
+#include <mach/irqs.h> /* PXA_NR_BUILTIN_GPIO, PXA_GPIO_TO_IRQ */
 #include <linux/fb.h>
 
 /* Spitz/Akita GPIOs */
arch/arm/mach-pxa/spitz_pm.c +1 -1
index 201dabe883b6..6689b67f9ce5 100644
@@ -19,7 +19,7 @@
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/spitz.h>
+#include "spitz.h"
 #include "pxa27x.h"
 #include "sharpsl_pm.h"
 
sound/soc/pxa/spitz.c +23 -35

129 lines not on this page · raw message

Signature · 1 line
2.20.0
maintainer Acked-by on v1 21/46
#60 lore raw

Re: [PATCH 21/46] ARM: pxa: spitz: use gpio descriptors for audio

Quoted 2 lines · Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

maintainer
#61 lore raw

Re: [PATCH 21/46] ARM: pxa: spitz: use gpio descriptors for audio

In reply to Arnd Bergmann
Quoted 43 lines · Arnd Bergmann

The audio driver should not use a hardwired gpio number from the header. Change it to use a lookup table.

---
 arch/arm/mach-pxa/spitz.c                    | 33 ++++++++++-
 arch/arm/mach-pxa/{include/mach => }/spitz.h |  2 +-
 arch/arm/mach-pxa/spitz_pm.c                 |  2 +-
 sound/soc/pxa/spitz.c                        | 58 ++++++++------------
 4 files changed, 57 insertions(+), 38 deletions(-)
 rename arch/arm/mach-pxa/{include/mach => }/spitz.h (99%)
arch/arm/mach-pxa/spitz.c +13 -1
index a4fdc399d152..6028fd83c44d 100644
@@ -44,7 +44,7 @@
 #include <linux/platform_data/mmc-pxamci.h>
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/video-pxafb.h>
-#include <mach/spitz.h>
+#include "spitz.h"
 #include "sharpsl_pm.h"
 #include <mach/smemc.h>
 
@@ -948,11 +948,42 @@ static void __init spitz_i2c_init(void)
 static inline void spitz_i2c_init(void) {}
 #endif
 
+static struct gpiod_lookup_table spitz_audio_gpio_table = {
+	.dev_id = "spitz-audio",
+	.table = {
+		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_L - SPITZ_SCP_GPIO_BASE,
+			    "mute-l", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R - SPITZ_SCP_GPIO_BASE,
+			    "mute-r", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.1", SPITZ_GPIO_MIC_BIAS - SPITZ_SCP2_GPIO_BASE,
+			    "mic", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};

arch/arm/mach-pxa/spitz.c static void __init spitz_i2c_init(void) · line 972

Quoted 10 lines
arch/arm/mach-pxa/spitz.c +10 -0
+
+static struct gpiod_lookup_table akita_audio_gpio_table = {
+	.dev_id = "spitz-audio",
+	.table = {
+		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_L - SPITZ_SCP_GPIO_BASE,
+			    "mute-l", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R - SPITZ_SCP_GPIO_BASE,
+			    "mute-r", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_MIC_BIAS - AKITA_IOEXP_GPIO_BASE,
+			    "mic", GPIO_ACTIVE_HIGH),

This last one looks a bit dubious, as it looks like a gpio on a gpio expander, could you cross-check that "gpio-pxa" shouldn't be an I2C expander gpio please ?

Cheers.

--
Robert

#62 lore raw

Re: [PATCH 21/46] ARM: pxa: spitz: use gpio descriptors for audio

Quoted 11 lines · Robert Jarzmik

arch/arm/mach-pxa/spitz.c static void __init spitz_i2c_init(void) · line 972

Quoted 9 lines
arch/arm/mach-pxa/spitz.c +9 -0
+static struct gpiod_lookup_table akita_audio_gpio_table = {
+     .dev_id = "spitz-audio",
+     .table = {
+             GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_L - SPITZ_SCP_GPIO_BASE,
+                         "mute-l", GPIO_ACTIVE_HIGH),
+             GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R - SPITZ_SCP_GPIO_BASE,
+                         "mute-r", GPIO_ACTIVE_HIGH),
+             GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_MIC_BIAS - AKITA_IOEXP_GPIO_BASE,
+                         "mic", GPIO_ACTIVE_HIGH),

This last one looks a bit dubious, as it looks like a gpio on a gpio expander, could you cross-check that "gpio-pxa" shouldn't be an I2C expander gpio please ?

I'm revisiting this older patch series now, this was clearly a mistake in my original
version, changed it now to

@@ -982,7 +982,7 @@ static struct gpiod_lookup_table akita_audio_gpio_table = {
"mute-l", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("sharp-scoop.0", SPITZ_GPIO_MUTE_R -
SPITZ_SCP_GPIO_BASE,

                            "mute-r", GPIO_ACTIVE_HIGH),

- GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_MIC_BIAS -
AKITA_IOEXP_GPIO_BASE,
+ GPIO_LOOKUP("i2c-max7310", AKITA_GPIO_MIC_BIAS -
AKITA_IOEXP_GPIO_BASE,

                            "mic", GPIO_ACTIVE_HIGH),
                { },
        },

I'm not 100% sure this is the correct name, as I don't fully understand how i2c device
names are constructed. I see that Linus added a device name in commit 32d1544880aa ("ARM: pxa: Add gpio descriptor lookup tables for MMC CD/WP"), and I guess I could do the same here, but I think that was only needed to disambiguate
two instances of the same device in zylonite, which is not needed for spitz.

Arnd

#63 lore raw

PATCH 22/46 ARM: pxa: eseries: use gpio lookup for audio

In reply to Arnd Bergmann

The three eseries machines have very similar drivers for audio, all using the mach/eseries-gpio.h header for finding the gpio numbers.

Change these to use gpio descriptors to avoid the header file dependency.

I convert the _OFF gpio numbers into GPIO_ACTIVE_LOW ones for consistency here.

---
 arch/arm/mach-pxa/eseries.c | 32 ++++++++++++++++++++++++++++++++
 sound/soc/pxa/e740_wm9705.c | 35 ++++++++++++++++++-----------------
 sound/soc/pxa/e750_wm9705.c | 31 ++++++++++++++-----------------
 sound/soc/pxa/e800_wm9712.c | 31 ++++++++++++++-----------------
 4 files changed, 78 insertions(+), 51 deletions(-)
arch/arm/mach-pxa/eseries.c +32 -0
index d8a87ff66675..8399ce405093 100644
@@ -24,6 +24,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/usb/gpio_vbus.h>
 #include <linux/memblock.h>
+#include <linux/gpio/machine.h>
 
 #include <video/w100fb.h>
 
@@ -515,6 +516,16 @@ static struct platform_device e740_audio_device = {
 	.id		= -1,
 };
 
+static struct gpiod_lookup_table e740_audio_gpio_table = {
+	.dev_id = "e740-audio",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa",  GPIO_E740_WM9705_nAVDD2, "Audio power",  GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("gpio-pxa",  GPIO_E740_AMP_ON, "Output amp",  GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("gpio-pxa",  GPIO_E740_MIC_ON, "Mic amp", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 /* ----------------------------------------------------------------------- */
 
 static struct platform_device *e740_devices[] __initdata = {
@@ -534,6 +545,7 @@ static void __init e740_init(void)
 	clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name,
 			"UDCCLK", &pxa25x_device_udc.dev),
 	eseries_get_tmio_gpios();
+	gpiod_add_lookup_table(&e740_audio_gpio_table);
 	platform_add_devices(ARRAY_AND_SIZE(e740_devices));
 	pxa_set_ac97_info(NULL);
 	pxa_set_ficp_info(&e7xx_ficp_platform_data);
@@ -710,6 +722,15 @@ static struct platform_device e750_tc6393xb_device = {
 	.resource      = eseries_tmio_resources,
 };
 
+static struct gpiod_lookup_table e750_audio_gpio_table = {
+	.dev_id = "e750-audio",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa",  GPIO_E750_HP_AMP_OFF, "Output amp",  GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("gpio-pxa",  GPIO_E750_SPK_AMP_OFF, "Mic amp", GPIO_ACTIVE_LOW),
+		{ },
+	},
+};
+
 static struct platform_device e750_audio_device = {
 	.name		= "e750-audio",
 	.id		= -1,
@@ -733,6 +754,7 @@ static void __init e750_init(void)
 	clk_add_alias("CLK_CK3P6MI", e750_tc6393xb_device.name,
 			"GPIO11_CLK", NULL),
 	eseries_get_tmio_gpios();
+	gpiod_add_lookup_table(&e750_audio_gpio_table);
 	platform_add_devices(ARRAY_AND_SIZE(e750_devices));
 	pxa_set_ac97_info(NULL);
 	pxa_set_ficp_info(&e7xx_ficp_platform_data);
@@ -926,6 +948,15 @@ static struct platform_device e800_tc6393xb_device = {
 	.resource      = eseries_tmio_resources,
 };
 
+static struct gpiod_lookup_table e800_audio_gpio_table = {
+	.dev_id = "e800-audio",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa",  GPIO_E800_HP_AMP_OFF, "Output amp",  GPIO_ACTIVE_LOW),
+		GPIO_LOOKUP("gpio-pxa",  GPIO_E800_SPK_AMP_ON, "Mic amp", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 static struct platform_device e800_audio_device = {
 	.name		= "e800-audio",
 	.id		= -1,
@@ -949,6 +980,7 @@ static void __init e800_init(void)
 	clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
 			"GPIO11_CLK", NULL),
 	eseries_get_tmio_gpios();
+	gpiod_add_lookup_table(&e800_audio_gpio_table);
 	platform_add_devices(ARRAY_AND_SIZE(e800_devices));
 	pxa_set_ac97_info(NULL);
 }
sound/soc/pxa/e740_wm9705.c +18 -17
index f922be7e0016..4e0e9b778d4c 100644
@@ -7,17 +7,19 @@
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
 
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/eseries-gpio.h>
 
 #include <asm/mach-types.h>
 
+static struct gpio_desc *gpiod_output_amp, *gpiod_input_amp;
+static struct gpio_desc *gpiod_audio_power;
+
 #define E740_AUDIO_OUT 1
 #define E740_AUDIO_IN  2
 
@@ -25,9 +27,9 @@ static int e740_audio_power;
 
 static void e740_sync_audio_power(int status)
 {
-	gpio_set_value(GPIO_E740_WM9705_nAVDD2, !status);
-	gpio_set_value(GPIO_E740_AMP_ON, (status & E740_AUDIO_OUT) ? 1 : 0);
-	gpio_set_value(GPIO_E740_MIC_ON, (status & E740_AUDIO_IN) ? 1 : 0);
+	gpiod_set_value(gpiod_audio_power, !status);
+	gpiod_set_value(gpiod_output_amp, (status & E740_AUDIO_OUT) ? 1 : 0);
+	gpiod_set_value(gpiod_input_amp, (status & E740_AUDIO_IN) ? 1 : 0);
 }
 
 static int e740_mic_amp_event(struct snd_soc_dapm_widget *w,
@@ -116,36 +118,35 @@ static struct snd_soc_card e740 = {
 	.fully_routed = true,
 };
 
-static struct gpio e740_audio_gpios[] = {
-	{ GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW, "Mic amp" },
-	{ GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW, "Output amp" },
-	{ GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, "Audio power" },
-};
-
 static int e740_probe(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = &e740;
 	int ret;
 
-	ret = gpio_request_array(e740_audio_gpios,
-				 ARRAY_SIZE(e740_audio_gpios));
+	gpiod_input_amp  = devm_gpiod_get(&pdev->dev, "Mic amp", GPIOD_OUT_LOW);
+	ret = PTR_ERR_OR_ZERO(gpiod_input_amp);
+	if (ret)
+		return ret;
+	gpiod_output_amp  = devm_gpiod_get(&pdev->dev, "Output amp", GPIOD_OUT_LOW);
+	ret = PTR_ERR_OR_ZERO(gpiod_output_amp);
+	if (ret)
+		return ret;
+	gpiod_audio_power = devm_gpiod_get(&pdev->dev, "Audio power", GPIOD_OUT_HIGH);
+	ret = PTR_ERR_OR_ZERO(gpiod_audio_power);
 	if (ret)
 		return ret;
 
 	card->dev = &pdev->dev;
 
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
-	if (ret) {
+	if (ret)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
 			ret);
-		gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios));
-	}
 	return ret;
 }
 
 static int e740_remove(struct platform_device *pdev)
 {
-	gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios));
 	return 0;
 }
 
sound/soc/pxa/e750_wm9705.c +14 -17
index 308828cd736b..7a1e0d8bfd11 100644
@@ -7,24 +7,25 @@
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
 
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/eseries-gpio.h>
 
 #include <asm/mach-types.h>
 
+static struct gpio_desc *gpiod_spk_amp, *gpiod_hp_amp;
+
 static int e750_spk_amp_event(struct snd_soc_dapm_widget *w,
 				struct snd_kcontrol *kcontrol, int event)
 {
 	if (event & SND_SOC_DAPM_PRE_PMU)
-		gpio_set_value(GPIO_E750_SPK_AMP_OFF, 0);
+		gpiod_set_value(gpiod_spk_amp, 1);
 	else if (event & SND_SOC_DAPM_POST_PMD)
-		gpio_set_value(GPIO_E750_SPK_AMP_OFF, 1);
+		gpiod_set_value(gpiod_spk_amp, 0);
 
 	return 0;
 }
@@ -33,9 +34,9 @@ static int e750_hp_amp_event(struct snd_soc_dapm_widget *w,
 				struct snd_kcontrol *kcontrol, int event)
 {
 	if (event & SND_SOC_DAPM_PRE_PMU)
-		gpio_set_value(GPIO_E750_HP_AMP_OFF, 0);
+		gpiod_set_value(gpiod_hp_amp, 1);
 	else if (event & SND_SOC_DAPM_POST_PMD)
-		gpio_set_value(GPIO_E750_HP_AMP_OFF, 1);
+		gpiod_set_value(gpiod_hp_amp, 0);
 
 	return 0;
 }
@@ -100,35 +101,31 @@ static struct snd_soc_card e750 = {
 	.fully_routed = true,
 };
 
-static struct gpio e750_audio_gpios[] = {
-	{ GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Headphone amp" },
-	{ GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" },
-};
-
 static int e750_probe(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = &e750;
 	int ret;
 
-	ret = gpio_request_array(e750_audio_gpios,
-				 ARRAY_SIZE(e750_audio_gpios));
+	gpiod_hp_amp  = devm_gpiod_get(&pdev->dev, "Headphone amp", GPIOD_OUT_LOW);
+	ret = PTR_ERR_OR_ZERO(gpiod_hp_amp);
+	if (ret)
+		return ret;
+	gpiod_spk_amp  = devm_gpiod_get(&pdev->dev, "Speaker amp", GPIOD_OUT_LOW);
+	ret = PTR_ERR_OR_ZERO(gpiod_spk_amp);
 	if (ret)
 		return ret;
 
 	card->dev = &pdev->dev;
 
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
-	if (ret) {
+	if (ret)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
 			ret);
-		gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios));
-	}
 	return ret;
 }
 
 static int e750_remove(struct platform_device *pdev)
 {
-	gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios));
 	return 0;
 }
 
sound/soc/pxa/e800_wm9712.c +14 -17
index d74fcceef687..a39c494127cf 100644
@@ -7,7 +7,7 @@
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -15,15 +15,16 @@
 
 #include <asm/mach-types.h>
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/eseries-gpio.h>
+
+static struct gpio_desc *gpiod_spk_amp, *gpiod_hp_amp;
 
 static int e800_spk_amp_event(struct snd_soc_dapm_widget *w,
 				struct snd_kcontrol *kcontrol, int event)
 {
 	if (event & SND_SOC_DAPM_PRE_PMU)
-		gpio_set_value(GPIO_E800_SPK_AMP_ON, 1);
+		gpiod_set_value(gpiod_spk_amp, 1);
 	else if (event & SND_SOC_DAPM_POST_PMD)
-		gpio_set_value(GPIO_E800_SPK_AMP_ON, 0);
+		gpiod_set_value(gpiod_spk_amp, 0);
 
 	return 0;
 }
@@ -32,9 +33,9 @@ static int e800_hp_amp_event(struct snd_soc_dapm_widget *w,
 				struct snd_kcontrol *kcontrol, int event)
 {
 	if (event & SND_SOC_DAPM_PRE_PMU)
-		gpio_set_value(GPIO_E800_HP_AMP_OFF, 0);
+		gpiod_set_value(gpiod_hp_amp, 1);
 	else if (event & SND_SOC_DAPM_POST_PMD)
-		gpio_set_value(GPIO_E800_HP_AMP_OFF, 1);
+		gpiod_set_value(gpiod_hp_amp, 0);
 
 	return 0;
 }
@@ -100,35 +101,31 @@ static struct snd_soc_card e800 = {
 	.num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
-static struct gpio e800_audio_gpios[] = {
-	{ GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH, "Headphone amp" },
-	{ GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" },
-};
-
 static int e800_probe(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = &e800;
 	int ret;
 
-	ret = gpio_request_array(e800_audio_gpios,
-				 ARRAY_SIZE(e800_audio_gpios));
+	gpiod_hp_amp  = devm_gpiod_get(&pdev->dev, "Headphone amp", GPIOD_OUT_LOW);
+	ret = PTR_ERR_OR_ZERO(gpiod_hp_amp);
+	if (ret)
+		return ret;
+	gpiod_spk_amp  = devm_gpiod_get(&pdev->dev, "Speaker amp", GPIOD_OUT_LOW);
+	ret = PTR_ERR_OR_ZERO(gpiod_spk_amp);
 	if (ret)
 		return ret;
 
 	card->dev = &pdev->dev;
 
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
-	if (ret) {
+	if (ret)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
 			ret);
-		gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios));
-	}
 	return ret;
 }
 
 static int e800_remove(struct platform_device *pdev)
 {
-	gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios));
 	return 0;
 }
 
Signature · 1 line
2.20.0
maintainer Acked-by on v1 22/46
#64 lore raw

Re: [PATCH 22/46] ARM: pxa: eseries: use gpio lookup for audio

Quoted 2 lines · Arnd Bergmann

The three eseries machines have very similar drivers for audio, all using the mach/eseries-gpio.h header for finding the gpio numbers.

maintainer Acked-by on v1 22/46
#65 lore raw

Re: [PATCH 22/46] ARM: pxa: eseries: use gpio lookup for audio

In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

The three eseries machines have very similar drivers for audio, all using the mach/eseries-gpio.h header for finding the gpio numbers.

Change these to use gpio descriptors to avoid the header file dependency.

Quoted 6 lines

I convert the _OFF gpio numbers into GPIO_ACTIVE_LOW ones for consistency here.

Let's hope for the best :

Cheers.

--
Robert

Reviewed-by on v1 22/46
#66 lore raw

Re: [PATCH 22/46] ARM: pxa: eseries: use gpio lookup for audio

In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

The three eseries machines have very similar drivers for audio, all using the mach/eseries-gpio.h header for finding the gpio numbers.

Change these to use gpio descriptors to avoid the header file dependency.

Quoted 6 lines

I convert the _OFF gpio numbers into GPIO_ACTIVE_LOW ones for consistency here.

This is consistent with the way I imagine it should be done so:

Yours,
Linus Walleij

#67 lore raw

PATCH 23/46 ARM: pxa: z2: use gpio lookup for audio device

In reply to Arnd Bergmann

The audio device is allocated by the audio driver, and it uses a gpio number from the mach/z2.h header file.

Change it to use a gpio lookup table for the device allocated by the driver to keep the header file local to the machine.

---
 arch/arm/mach-pxa/z2.c | 11 +++++++++++
 sound/soc/pxa/z2.c     |  5 ++---
 2 files changed, 13 insertions(+), 3 deletions(-)
arch/arm/mach-pxa/z2.c +11 -0
index 900cefc4c5ea..874bdd49ad43 100644
@@ -623,6 +623,15 @@ static void __init z2_spi_init(void)
 static inline void z2_spi_init(void) {}
 #endif
 
+static struct gpiod_lookup_table z2_audio_gpio_table = {
+	.dev_id = "soc-audio",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", GPIO37_ZIPITZ2_HEADSET_DETECT,
+			    "hsdet-gpio", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 /******************************************************************************
  * Core power regulator
  ******************************************************************************/
@@ -727,6 +736,8 @@ static void __init z2_init(void)
 	z2_keys_init();
 	z2_pmic_init();
 
+	gpiod_add_lookup_table(&z2_audio_gpio_table);
+
 	pm_power_off = z2_power_off;
 }
 
sound/soc/pxa/z2.c +2 -3
index 1fb3e7ac42fa..5147ed60fcd0 100644
@@ -13,7 +13,7 @@
 #include <linux/timer.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -22,7 +22,6 @@
 
 #include <asm/mach-types.h>
 #include <linux/platform_data/asoc-pxa.h>
-#include <mach/z2.h>
 
 #include "../codecs/wm8750.h"
 #include "pxa2xx-i2s.h"
@@ -89,7 +88,6 @@ static struct snd_soc_jack_pin hs_jack_pins[] = {
 /* Headset jack detection gpios */
 static struct snd_soc_jack_gpio hs_jack_gpios[] = {
 	{
-		.gpio		= GPIO37_ZIPITZ2_HEADSET_DETECT,
 		.name		= "hsdet-gpio",
 		.report		= SND_JACK_HEADSET,
 		.debounce_time	= 200,
@@ -195,6 +193,7 @@ static int __init z2_init(void)
 	if (!z2_snd_device)
 		return -ENOMEM;
 
+	hs_jack_gpios[0].gpiod_dev = &z2_snd_device->dev;
 	platform_set_drvdata(z2_snd_device, &snd_soc_z2);
 	ret = platform_device_add(z2_snd_device);
 
Signature · 1 line
2.20.0
maintainer Acked-by on v1 23/46
#68 lore raw

Re: [PATCH 23/46] ARM: pxa: z2: use gpio lookup for audio device

Quoted 2 lines · Arnd Bergmann

The audio device is allocated by the audio driver, and it uses a gpio number from the mach/z2.h header file.

maintainer Acked-by on v1 23/46
#69 lore raw

Re: [PATCH 23/46] ARM: pxa: z2: use gpio lookup for audio device

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

The audio device is allocated by the audio driver, and it uses a gpio number from the mach/z2.h header file.

Change it to use a gpio lookup table for the device allocated by the driver to keep the header file local to the machine.

Cheers.

--
Robert

Reviewed-by on v1 23/46
#70 lore raw

Re: [PATCH 23/46] ARM: pxa: z2: use gpio lookup for audio device

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

The audio device is allocated by the audio driver, and it uses a gpio number from the mach/z2.h header file.

Change it to use a gpio lookup table for the device allocated by the driver to keep the header file local to the machine.

Yours,
Linus Walleij

#71 lore raw

PATCH 24/46 ARM: pxa: magician: use platform driver for audio

In reply to Arnd Bergmann

The magician audio driver creates a codec device and gets data from a board specific header file, both of which is a bit suspicious. Move these into the board file itself, using a gpio lookup table.

---
 arch/arm/mach-pxa/magician.c |  50 +++++++++++++
 sound/soc/pxa/magician.c     | 141 +++++++++--------------------------
 2 files changed, 87 insertions(+), 104 deletions(-)
arch/arm/mach-pxa/magician.c +50 -0
index 31037679bf24..48ac4b96e5ce 100644
@@ -54,6 +54,7 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/pxa2xx_spi.h>
 #include <linux/spi/ads7846.h>
+#include <sound/uda1380.h>
 
 static unsigned long magician_pin_config[] __initdata = {
 
@@ -892,6 +893,53 @@ static struct platform_device strataflash = {
 	},
 };
 
+/*
+ * audio support
+ */
+static struct uda1380_platform_data uda1380_info = {
+	.gpio_power = EGPIO_MAGICIAN_CODEC_POWER,
+	.gpio_reset = EGPIO_MAGICIAN_CODEC_RESET,
+	.dac_clk    = UDA1380_DAC_CLK_WSPLL,
+};
+
+static struct i2c_board_info magician_audio_i2c_board_info[] = {
+	{
+		I2C_BOARD_INFO("uda1380", 0x18),
+		.platform_data = &uda1380_info,
+	},
+};
+
+static struct gpiod_lookup_table magician_audio_gpio_table = {
+	.dev_id = "magician-audio",
+	.table = {
+		GPIO_LOOKUP("htc-egpio-0",
+			    EGPIO_MAGICIAN_SPK_POWER - MAGICIAN_EGPIO_BASE,
+			    "SPK_POWER", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("htc-egpio-0",
+			    EGPIO_MAGICIAN_EP_POWER - MAGICIAN_EGPIO_BASE,
+			    "EP_POWER", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("htc-egpio-0",
+			    EGPIO_MAGICIAN_MIC_POWER - MAGICIAN_EGPIO_BASE,
+			    "MIC_POWER", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("htc-egpio-0",
+			    EGPIO_MAGICIAN_IN_SEL0 - MAGICIAN_EGPIO_BASE,
+			    "IN_SEL0", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("htc-egpio-0",
+			    EGPIO_MAGICIAN_IN_SEL1 - MAGICIAN_EGPIO_BASE,
+			    "IN_SEL1", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
+static void magician_audio_init(void)
+{
+	i2c_register_board_info(0,
+		ARRAY_AND_SIZE(magician_audio_i2c_board_info));
+
+	gpiod_add_lookup_table(&magician_audio_gpio_table);
+	platform_device_register_simple("magician-audio", -1, NULL, 0);
+}
+
 /*
  * PXA I2C main controller
  */
@@ -1033,6 +1081,8 @@ static void __init magician_init(void)
 
 	gpiod_add_lookup_table(&bq24022_gpiod_table);
 	platform_add_devices(ARRAY_AND_SIZE(devices));
+
+	magician_audio_init();
 }
 
 MACHINE_START(MAGICIAN, "HTC Magician")
sound/soc/pxa/magician.c +37 -104

196 lines not on this page · raw message

Signature · 1 line
2.20.0
maintainer Acked-by on v1 24/46
#72 lore raw

Re: [PATCH 24/46] ARM: pxa: magician: use platform driver for audio

Quoted 4 lines · Arnd Bergmann

The magician audio driver creates a codec device and gets data from a board specific header file, both of which is a bit suspicious. Move these into the board file itself, using a gpio lookup table.

maintainer Acked-by on v1 24/46
#73 lore raw

Re: [PATCH 24/46] ARM: pxa: magician: use platform driver for audio

In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

The magician audio driver creates a codec device and gets data from a board specific header file, both of which is a bit suspicious. Move these into the board file itself, using a gpio lookup table.

Cheers.

--
Robert

Reviewed-by on v1 24/46
#74 lore raw

Re: [PATCH 24/46] ARM: pxa: magician: use platform driver for audio

In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

The magician audio driver creates a codec device and gets data from a board specific header file, both of which is a bit suspicious. Move these into the board file itself, using a gpio lookup table.

Yours,
Linus Walleij

#75 lore raw

PATCH 25/46 ARM: pxa: mainstone-wm97xx: use gpio lookup table

In reply to Arnd Bergmann

This driver hardcodes gpio numbers without a header file. Use lookup tables instead.

---
 arch/arm/mach-pxa/mainstone.c                |  9 +++++
 arch/arm/mach-pxa/palmld.c                   |  9 +++++
 arch/arm/mach-pxa/palmt5.c                   |  9 +++++
 arch/arm/mach-pxa/palmtx.c                   |  9 +++++
 drivers/input/touchscreen/mainstone-wm97xx.c | 35 ++++++++------------
 5 files changed, 50 insertions(+), 21 deletions(-)
arch/arm/mach-pxa/mainstone.c +9 -0
index 5f7bc5a9215e..48b89bca7b46 100644
@@ -545,6 +545,14 @@ static struct gpiod_lookup_table mainstone_pcmcia_gpio_table = {
 	},
 };
 
+static struct gpiod_lookup_table mainstone_wm97xx_gpio_table = {
+	.dev_id = "wm97xx-touch",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", 4, "touch", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 static void __init mainstone_init(void)
 {
 	int SW7 = 0;  /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
@@ -559,6 +567,7 @@ static void __init mainstone_init(void)
 		      "mst-pcmcia1", MST_PCMCIA_INPUTS, 0, NULL,
 		      NULL, mst_pcmcia1_irqs);
 	gpiod_add_lookup_table(&mainstone_pcmcia_gpio_table);
+	gpiod_add_lookup_table(&mainstone_wm97xx_gpio_table);
 
 	pxa_set_ffuart_info(NULL);
 	pxa_set_btuart_info(NULL);
arch/arm/mach-pxa/palmld.c +9 -0
index d821606ce0b5..32308c63884e 100644
@@ -347,6 +347,14 @@ static struct gpiod_lookup_table palmld_mci_gpio_table = {
 	},
 };
 
+static struct gpiod_lookup_table palmld_wm97xx_touch_gpio_table = {
+	.dev_id = "wm97xx-touch",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", 27, "touch", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 static void __init palmld_init(void)
 {
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
@@ -355,6 +363,7 @@ static void __init palmld_init(void)
 	pxa_set_stuart_info(NULL);
 
 	palm27x_mmc_init(&palmld_mci_gpio_table);
+	gpiod_add_lookup_table(&palmld_wm97xx_touch_gpio_table);
 	palm27x_pm_init(PALMLD_STR_BASE);
 	palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
 	palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
arch/arm/mach-pxa/palmt5.c +9 -0
index 4e2cff87deba..f21cb23c51ac 100644
@@ -191,6 +191,14 @@ static struct gpiod_lookup_table palmt5_mci_gpio_table = {
 	},
 };
 
+static struct gpiod_lookup_table palmt5_wm97xx_touch_gpio_table = {
+	.dev_id = "wm97xx-touch",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", 27, "touch", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 static void __init palmt5_init(void)
 {
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
@@ -199,6 +207,7 @@ static void __init palmt5_init(void)
 	pxa_set_stuart_info(NULL);
 
 	palm27x_mmc_init(&palmt5_mci_gpio_table);
+	gpiod_add_lookup_table(&palmt5_wm97xx_touch_gpio_table);
 	palm27x_pm_init(PALMT5_STR_BASE);
 	palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
 	palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
arch/arm/mach-pxa/palmtx.c +9 -0
index d6819413a8d6..e0d9f7882285 100644
@@ -346,6 +346,14 @@ static struct gpiod_lookup_table palmtx_mci_gpio_table = {
 	},
 };
 
+static struct gpiod_lookup_table palmtx_wm97xx_touch_gpio_table = {
+	.dev_id = "wm97xx-touch",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", 27, "touch", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 static void __init palmtx_init(void)
 {
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
@@ -354,6 +362,7 @@ static void __init palmtx_init(void)
 	pxa_set_stuart_info(NULL);
 
 	palm27x_mmc_init(&palmtx_mci_gpio_table);
+	gpiod_add_lookup_table(&palmtx_wm97xx_touch_gpio_table);
 	palm27x_pm_init(PALMTX_STR_BASE);
 	palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
 	palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N,
drivers/input/touchscreen/mainstone-wm97xx.c +14 -21
index f8564b398eb3..87655105ef3a 100644
@@ -21,6 +21,7 @@
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/wm97xx.h>
@@ -58,7 +59,7 @@ static const struct continuous cinfo[] = {
 /* continuous speed index */
 static int sp_idx;
 static u16 last, tries;
-static int irq;
+static struct gpio_desc *gpiod_irq;
 
 /*
  * Pen sampling frequency (Hz) in continuous mode.
@@ -194,28 +195,21 @@ static int wm97xx_acc_startup(struct wm97xx *wm)
 	/* IRQ driven touchscreen is used on Palm hardware */
 	if (machine_is_palmt5() || machine_is_palmtx() || machine_is_palmld()) {
 		pen_int = 1;
-		irq = 27;
 		/* There is some obscure mutant of WM9712 interbred with WM9713
 		 * used on Palm HW */
 		wm->variant = WM97xx_WM1613;
-	} else if (machine_is_mainstone() && pen_int)
-		irq = 4;
-
-	if (irq) {
-		ret = gpio_request(irq, "Touchscreen IRQ");
-		if (ret)
-			goto out;
-
-		ret = gpio_direction_input(irq);
-		if (ret) {
-			gpio_free(irq);
-			goto out;
-		}
+	}
+
+	if (pen_int) {
+		gpiod_irq = gpiod_get(wm->dev, "touch", GPIOD_IN);
+		if (IS_ERR(gpiod_irq))
+			pen_int = 0;
+	}
 
-		wm->pen_irq = gpio_to_irq(irq);
+	if (pen_int) {
+		wm->pen_irq = gpiod_to_irq(gpiod_irq);
 		irq_set_irq_type(wm->pen_irq, IRQ_TYPE_EDGE_BOTH);
-	} else /* pen irq not supported */
-		pen_int = 0;
+	}
 
 	/* codec specific irq config */
 	if (pen_int) {
@@ -242,7 +236,6 @@ static int wm97xx_acc_startup(struct wm97xx *wm)
 		}
 	}
 
-out:
 	return ret;
 }
 
@@ -250,8 +243,8 @@ static void wm97xx_acc_shutdown(struct wm97xx *wm)
 {
 	/* codec specific deconfig */
 	if (pen_int) {
-		if (irq)
-			gpio_free(irq);
+		if (gpiod_irq)
+			gpiod_put(gpiod_irq);
 		wm->pen_irq = 0;
 	}
 }
Signature · 1 line
2.20.0
maintainer Acked-by on v1 25/46
#76 lore raw

Re: [PATCH 25/46] ARM: pxa: mainstone-wm97xx: use gpio lookup table

Quoted 7 lines · Arnd Bergmann

This driver hardcodes gpio numbers without a header file. Use lookup tables instead.

Arnd, do you have these devices by chance? I had stached patches converting wm97xx core to use threaded ISR and it would be great if someone could test them...

Signature · 1 line
Dmitry

A message that is not in the archive (sent off-list or not yet received): CAK8P3a1Fc=ogknDRGJ3Sn8bZ8tsR_ebE8_bDtF_kZ4AZ5YG_+g@mail.gmail.com

#78 lore raw

Re: [PATCH 25/46] ARM: pxa: mainstone-wm97xx: use gpio lookup table

Quoted 11 lines · Dmitry Torokhov
Quoted 7 lines · Arnd Bergmann

This driver hardcodes gpio numbers without a header file. Use lookup tables instead.

Quoted 5 lines

Arnd, do you have these devices by chance? I had stached patches converting wm97xx core to use threaded ISR and it would be great if someone could test them...

Unfortunately I don't, but I'm hoping that someone can test my series on any hardware they might have.

If you like, send me your patches and I'll add them to this series.

Arnd

maintainer
#79 lore raw

Re: [PATCH 25/46] ARM: pxa: mainstone-wm97xx: use gpio lookup table

Quoted 15 lines · Arnd Bergmann
Quoted 13 lines · Dmitry Torokhov
Quoted 7 lines · Arnd Bergmann

This driver hardcodes gpio numbers without a header file. Use lookup tables instead.

Quoted 8 lines
Quoted 3 lines

Arnd, do you have these devices by chance? I had stached patches converting wm97xx core to use threaded ISR and it would be great if someone could test them...

Unfortunately I don't, but I'm hoping that someone can test my series on any hardware they might have.

If you like, send me your patches and I'll add them to this series.

OK, I'll do that, thanks.

Signature · 1 line
Dmitry
#82 lore raw

PATCH 26/46 ARM: pxa: zylonite: use gpio lookup instead mfp header

In reply to Arnd Bergmann

The mach/mfp.h header is only used by this one driver for hardcoded gpio numbers. Change that to use a lookup table instead.

---
 arch/arm/mach-pxa/zylonite.c                | 31 +++++++++++++++++++++
 drivers/input/touchscreen/zylonite-wm97xx.c | 20 +++++++------
 2 files changed, 42 insertions(+), 9 deletions(-)
arch/arm/mach-pxa/zylonite.c +31 -0
index e3ae45f444d5..d6c0e8866e18 100644
@@ -32,6 +32,7 @@
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/keypad-pxa27x.h>
 #include <linux/platform_data/mtd-nand-pxa3xx.h>
+#include <mach/mfp.h>
 
 #include "devices.h"
 #include "generic.h"
@@ -426,6 +427,35 @@ static void __init zylonite_init_ohci(void)
 static inline void zylonite_init_ohci(void) {}
 #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
 
+static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio15_table = {
+	.dev_id = "wm97xx-touch.0",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO15),
+			    "touch", GPIO_ACTIVE_LOW),
+		{ },
+	},
+};
+
+static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio26_table = {
+	.dev_id = "wm97xx-touch.0",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO26),
+			    "touch", GPIO_ACTIVE_LOW),
+		{ },
+	},
+};
+
+static void __init zylonite_init_wm97xx_touch(void)
+{
+	if (!IS_ENABLED(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE))
+		return;
+
+	if (cpu_is_pxa320())
+		gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio15_table);
+	else
+		gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio26_table);
+}
+
 static void __init zylonite_init(void)
 {
 	pxa_set_ffuart_info(NULL);
@@ -451,6 +481,7 @@ static void __init zylonite_init(void)
 	zylonite_init_nand();
 	zylonite_init_leds();
 	zylonite_init_ohci();
+	zylonite_init_wm97xx_touch();
 }
 
 MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
drivers/input/touchscreen/zylonite-wm97xx.c +11 -9
index f57bdf083188..cabdd6e3c6f8 100644
@@ -17,14 +17,13 @@
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/soc/pxa/cpu.h>
 #include <linux/wm97xx.h>
 
-#include <mach/mfp.h>
 #include <mach/regs-ac97.h>
 
 struct continuous {
@@ -181,14 +180,17 @@ static struct wm97xx_mach_ops zylonite_mach_ops = {
 static int zylonite_wm97xx_probe(struct platform_device *pdev)
 {
 	struct wm97xx *wm = platform_get_drvdata(pdev);
-	int gpio_touch_irq;
-
-	if (cpu_is_pxa320())
-		gpio_touch_irq = mfp_to_gpio(MFP_PIN_GPIO15);
-	else
-		gpio_touch_irq = mfp_to_gpio(MFP_PIN_GPIO26);
+	struct gpio_desc *gpio_touch_irq;
+	int err;
+
+	gpio_touch_irq = devm_gpiod_get(&pdev->dev, "touch", GPIOD_IN);
+	err = PTR_ERR_OR_ZERO(gpio_touch_irq);
+	if (err) {
+		dev_err(&pdev->dev, "Cannot get irq gpio: %d\n", err);
+		return err;
+	}
 
-	wm->pen_irq = gpio_to_irq(gpio_touch_irq);
+	wm->pen_irq = gpiod_to_irq(gpio_touch_irq);
 	irq_set_irq_type(wm->pen_irq, IRQ_TYPE_EDGE_BOTH);
 
 	wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN,
Signature · 1 line
2.20.0
Acked-by on v1 26/46
#84 lore raw

Re: [PATCH 26/46] ARM: pxa: zylonite: use gpio lookup instead mfp header

In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann

The mach/mfp.h header is only used by this one driver for hardcoded gpio numbers. Change that to use a lookup table instead.

(...)

Review

Quoted 2 lines
(quoted diff) +2 -0
+               GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO15),
+                           "touch", GPIO_ACTIVE_LOW),

What I tried to do with code like this, when I was ambitious, was to wind out mfp_to_gpio() as well and either just encode the offset on gpio-pxa as a define locally.

But this works too, the kernel looks better after than before and I am not perfectionist, so:

Yours,
Linus Walleij

#85 lore raw

PATCH 27/46 input: touchscreen: mainstone: fix pxa2xx+pxa3xx configuration

In reply to Arnd Bergmann

There are two different ways of flushing the ac97 queue in this driver, selected by a compile time option.

Change this to a runtime selection to make it work when both are enabled.

---
 drivers/input/touchscreen/mainstone-wm97xx.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/input/touchscreen/mainstone-wm97xx.c +7 -12
index 87655105ef3a..618c80847d9f 100644
@@ -98,25 +98,20 @@ MODULE_PARM_DESC(ac97_touch_slot, "Touch screen data slot AC97 number");
 
 
 /* flush AC97 slot 5 FIFO on pxa machines */
-#ifdef CONFIG_PXA27x
-static void wm97xx_acc_pen_up(struct wm97xx *wm)
-{
-	schedule_timeout_uninterruptible(1);
-
-	while (MISR & (1 << 2))
-		MODR;
-}
-#else
 static void wm97xx_acc_pen_up(struct wm97xx *wm)
 {
 	unsigned int count;
 
 	schedule_timeout_uninterruptible(1);
 
-	for (count = 0; count < 16; count++)
-		MODR;
+	if (cpu_is_pxa27x()) {
+		while (MISR & (1 << 2))
+			MODR;
+	} else if (cpu_is_pxa3xx()) {
+		for (count = 0; count < 16; count++)
+			MODR;
+	}
 }
-#endif
 
 static int wm97xx_acc_pen_down(struct wm97xx *wm)
 {
Signature · 1 line
2.20.0
maintainer Acked-by on v1 27/46
#86 lore raw

Re: [PATCH 27/46] input: touchscreen: mainstone: fix pxa2xx+pxa3xx configuration

Quoted 9 lines · Arnd Bergmann

There are two different ways of flushing the ac97 queue in this driver, selected by a compile time option.

Change this to a runtime selection to make it work when both are enabled.

Signature · 1 line
Dmitry
maintainer Acked-by on v1 27/46
#87 lore raw

Re: [PATCH 27/46] input: touchscreen: mainstone: fix pxa2xx+pxa3xx configuration

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

There are two different ways of flushing the ac97 queue in this driver, selected by a compile time option.

Change this to a runtime selection to make it work when both are enabled.

Cheers.

--
Robert

#88 lore raw

PATCH 28/46 input: touchscreen: mainstone: sync with zylonite driver

In reply to Arnd Bergmann

The two drivers are almost identical and can work on a variety of hardware in principle. The mainstone driver supports additional hardware, and the zylonite driver has a few cleanup patches.

Sync the two by adding the zylonite changes into the mainstone one, and checking for the zylonite board to order to keep the default behavior (interrupt enabled) there.

---
 drivers/input/touchscreen/mainstone-wm97xx.c | 59 ++++++++++----------
 1 file changed, 31 insertions(+), 28 deletions(-)
drivers/input/touchscreen/mainstone-wm97xx.c +31 -28
index 618c80847d9f..940d3c92b1f8 100644
@@ -24,9 +24,9 @@
 #include <linux/gpio/consumer.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
-#include <linux/wm97xx.h>
 #include <linux/io.h>
-#include <linux/gpio.h>
+#include <linux/soc/pxa/cpu.h>
+#include <linux/wm97xx.h>
 
 #include <mach/regs-ac97.h>
 
@@ -42,23 +42,22 @@ struct continuous {
 #define WM_READS(sp) ((sp / HZ) + 1)
 
 static const struct continuous cinfo[] = {
-	{WM9705_ID2, 0, WM_READS(94), 94},
-	{WM9705_ID2, 1, WM_READS(188), 188},
-	{WM9705_ID2, 2, WM_READS(375), 375},
-	{WM9705_ID2, 3, WM_READS(750), 750},
-	{WM9712_ID2, 0, WM_READS(94), 94},
-	{WM9712_ID2, 1, WM_READS(188), 188},
-	{WM9712_ID2, 2, WM_READS(375), 375},
-	{WM9712_ID2, 3, WM_READS(750), 750},
-	{WM9713_ID2, 0, WM_READS(94), 94},
-	{WM9713_ID2, 1, WM_READS(120), 120},
-	{WM9713_ID2, 2, WM_READS(154), 154},
-	{WM9713_ID2, 3, WM_READS(188), 188},
+	{ WM9705_ID2, 0, WM_READS(94),  94  },
+	{ WM9705_ID2, 1, WM_READS(188), 188 },
+	{ WM9705_ID2, 2, WM_READS(375), 375 },
+	{ WM9705_ID2, 3, WM_READS(750), 750 },
+	{ WM9712_ID2, 0, WM_READS(94),  94  },
+	{ WM9712_ID2, 1, WM_READS(188), 188 },
+	{ WM9712_ID2, 2, WM_READS(375), 375 },
+	{ WM9712_ID2, 3, WM_READS(750), 750 },
+	{ WM9713_ID2, 0, WM_READS(94),  94  },
+	{ WM9713_ID2, 1, WM_READS(120), 120 },
+	{ WM9713_ID2, 2, WM_READS(154), 154 },
+	{ WM9713_ID2, 3, WM_READS(188), 188 },
 };
 
 /* continuous speed index */
 static int sp_idx;
-static u16 last, tries;
 static struct gpio_desc *gpiod_irq;
 
 /*
@@ -102,7 +101,7 @@ static void wm97xx_acc_pen_up(struct wm97xx *wm)
 {
 	unsigned int count;
 
-	schedule_timeout_uninterruptible(1);
+	msleep(1);
 
 	if (cpu_is_pxa27x()) {
 		while (MISR & (1 << 2))
@@ -117,13 +116,14 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
 {
 	u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES;
 	int reads = 0;
+	static u16 last, tries;
 
 	/* When the AC97 queue has been drained we need to allow time
 	 * to buffer up samples otherwise we end up spinning polling
 	 * for samples.  The controller can't have a suitably low
 	 * threshold set to use the notifications it gives.
 	 */
-	schedule_timeout_uninterruptible(1);
+	msleep(1);
 
 	if (tries > 5) {
 		tries = 0;
@@ -193,6 +193,8 @@ static int wm97xx_acc_startup(struct wm97xx *wm)
 		/* There is some obscure mutant of WM9712 interbred with WM9713
 		 * used on Palm HW */
 		wm->variant = WM97xx_WM1613;
+	} else if (machine_is_zylonite()) {
+		pen_int = 1;
 	}
 
 	if (pen_int) {
@@ -253,13 +255,13 @@ static void wm97xx_irq_enable(struct wm97xx *wm, int enable)
 }
 
 static struct wm97xx_mach_ops mainstone_mach_ops = {
-	.acc_enabled = 1,
-	.acc_pen_up = wm97xx_acc_pen_up,
-	.acc_pen_down = wm97xx_acc_pen_down,
-	.acc_startup = wm97xx_acc_startup,
-	.acc_shutdown = wm97xx_acc_shutdown,
-	.irq_enable = wm97xx_irq_enable,
-	.irq_gpio = WM97XX_GPIO_2,
+	.acc_enabled	= 1,
+	.acc_pen_up	= wm97xx_acc_pen_up,
+	.acc_pen_down	= wm97xx_acc_pen_down,
+	.acc_startup	= wm97xx_acc_startup,
+	.acc_shutdown	= wm97xx_acc_shutdown,
+	.irq_enable	= wm97xx_irq_enable,
+	.irq_gpio	= WM97XX_GPIO_2,
 };
 
 static int mainstone_wm97xx_probe(struct platform_device *pdev)
@@ -274,14 +276,15 @@ static int mainstone_wm97xx_remove(struct platform_device *pdev)
 	struct wm97xx *wm = platform_get_drvdata(pdev);
 
 	wm97xx_unregister_mach_ops(wm);
+
 	return 0;
 }
 
 static struct platform_driver mainstone_wm97xx_driver = {
-	.probe = mainstone_wm97xx_probe,
-	.remove = mainstone_wm97xx_remove,
-	.driver = {
-		.name = "wm97xx-touch",
+	.probe	= mainstone_wm97xx_probe,
+	.remove	= mainstone_wm97xx_remove,
+	.driver	= {
+		.name	= "wm97xx-touch",
 	},
 };
 module_platform_driver(mainstone_wm97xx_driver);
Signature · 1 line
2.20.0
maintainer Acked-by on v1 28/46
#89 lore raw

Re: [PATCH 28/46] input: touchscreen: mainstone: sync with zylonite driver

Quoted 11 lines · Arnd Bergmann

The two drivers are almost identical and can work on a variety of hardware in principle. The mainstone driver supports additional hardware, and the zylonite driver has a few cleanup patches.

Sync the two by adding the zylonite changes into the mainstone one, and checking for the zylonite board to order to keep the default behavior (interrupt enabled) there.

Signature · 1 line
Dmitry
maintainer
#90 lore raw

Re: [PATCH 28/46] input: touchscreen: mainstone: sync with zylonite driver

In reply to Arnd Bergmann

drivers/input/touchscreen/mainstone-wm97xx.c static int wm97xx_acc_startup(struct wm97xx *wm) · line 198

Quoted 3 lines · Arnd Bergmann
drivers/input/touchscreen/mainstone-wm97xx.c +2 -0
+	} else if (machine_is_zylonite()) {
+		pen_int = 1;
 	}

I don't understand that part, why do you check for a zylonite board in this file ?

Cheers.

--
Robert

#91 lore raw

Re: [PATCH 28/46] input: touchscreen: mainstone: sync with zylonite driver

Quoted 9 lines · Robert Jarzmik

drivers/input/touchscreen/mainstone-wm97xx.c static int wm97xx_acc_startup(struct wm97xx *wm) · line 198

Quoted 3 lines · Arnd Bergmann
drivers/input/touchscreen/mainstone-wm97xx.c +2 -0
+     } else if (machine_is_zylonite()) {
+             pen_int = 1;
      }

I don't understand that part, why do you check for a zylonite board in this file ?

Revisiting another old patch. The reason here is that both the zylonite and mainstone drivers are for the same hardware, using the same "wm97xx-touch" platform_driver name, which means that we cannot have them both built in the same kernel on a multiplatform machine.

By making the mainstone driver deal with zylonite hardware, we can ensure that this driver works on all the relevant machines. I'm fairly sure my plan was to later remove the zylonite driver entirely, but for some reason I did not include a patch for that in my series.

We can probably do that as a follow-up later.

Arnd

#92 lore raw

PATCH 29/46 Input: touchscreen: use wrapper for pxa2xx ac97 registers

In reply to Arnd Bergmann

To avoid a dependency on the pxa platform header files with hardcoded registers, change the driver to call a wrapper in the pxa2xx-ac97-lib that encapsulates all the other ac97 stuff.

---
 drivers/input/touchscreen/Kconfig            |  2 ++
 drivers/input/touchscreen/mainstone-wm97xx.c | 16 ++++++++--------
 drivers/input/touchscreen/zylonite-wm97xx.c  | 12 ++++++------
 include/sound/pxa2xx-lib.h                   |  4 ++++
 sound/arm/pxa2xx-ac97-lib.c                  | 12 ++++++++++++
 5 files changed, 32 insertions(+), 14 deletions(-)
drivers/input/touchscreen/Kconfig +2 -0
index 46ad9090493b..c60199550d89 100644
@@ -848,6 +848,7 @@ config TOUCHSCREEN_WM9713
 config TOUCHSCREEN_WM97XX_MAINSTONE
 	tristate "WM97xx Mainstone/Palm accelerated touch"
 	depends on TOUCHSCREEN_WM97XX && ARCH_PXA
+	depends on SND_PXA2XX_LIB_AC97
 	help
 	  Say Y here for support for streaming mode with WM97xx touchscreens
 	  on Mainstone, Palm Tungsten T5, TX and LifeDrive systems.
@@ -860,6 +861,7 @@ config TOUCHSCREEN_WM97XX_MAINSTONE
 config TOUCHSCREEN_WM97XX_ZYLONITE
 	tristate "Zylonite accelerated touch"
 	depends on TOUCHSCREEN_WM97XX && MACH_ZYLONITE
+	depends on SND_PXA2XX_LIB_AC97
 	select TOUCHSCREEN_WM9713
 	help
 	  Say Y here for support for streaming mode with the touchscreen
drivers/input/touchscreen/mainstone-wm97xx.c +8 -8
index 940d3c92b1f8..8f6fe68f1f99 100644
@@ -28,7 +28,7 @@
 #include <linux/soc/pxa/cpu.h>
 #include <linux/wm97xx.h>
 
-#include <mach/regs-ac97.h>
+#include <sound/pxa2xx-lib.h>
 
 #include <asm/mach-types.h>
 
@@ -104,11 +104,11 @@ static void wm97xx_acc_pen_up(struct wm97xx *wm)
 	msleep(1);
 
 	if (cpu_is_pxa27x()) {
-		while (MISR & (1 << 2))
-			MODR;
+		while (pxa2xx_ac97_read_misr() & (1 << 2))
+			pxa2xx_ac97_read_modr();
 	} else if (cpu_is_pxa3xx()) {
 		for (count = 0; count < 16; count++)
-			MODR;
+			pxa2xx_ac97_read_modr();
 	}
 }
 
@@ -130,7 +130,7 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
 		return RC_PENUP;
 	}
 
-	x = MODR;
+	x = pxa2xx_ac97_read_modr();
 	if (x == last) {
 		tries++;
 		return RC_AGAIN;
@@ -138,10 +138,10 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
 	last = x;
 	do {
 		if (reads)
-			x = MODR;
-		y = MODR;
+			x = pxa2xx_ac97_read_modr();
+		y = pxa2xx_ac97_read_modr();
 		if (pressure)
-			p = MODR;
+			p = pxa2xx_ac97_read_modr();
 
 		dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n",
 			x, y, p);
drivers/input/touchscreen/zylonite-wm97xx.c +6 -6
index cabdd6e3c6f8..ed7eae638713 100644
@@ -24,7 +24,7 @@
 #include <linux/soc/pxa/cpu.h>
 #include <linux/wm97xx.h>
 
-#include <mach/regs-ac97.h>
+#include <sound/pxa2xx-lib.h>
 
 struct continuous {
 	u16 id;    /* codec id */
@@ -79,7 +79,7 @@ static void wm97xx_acc_pen_up(struct wm97xx *wm)
 	msleep(1);
 
 	for (i = 0; i < 16; i++)
-		MODR;
+		pxa2xx_ac97_read_modr();
 }
 
 static int wm97xx_acc_pen_down(struct wm97xx *wm)
@@ -100,7 +100,7 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
 		return RC_PENUP;
 	}
 
-	x = MODR;
+	x = pxa2xx_ac97_read_modr();
 	if (x == last) {
 		tries++;
 		return RC_AGAIN;
@@ -108,10 +108,10 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
 	last = x;
 	do {
 		if (reads)
-			x = MODR;
-		y = MODR;
+			x = pxa2xx_ac97_read_modr();
+		y = pxa2xx_ac97_read_modr();
 		if (pressure)
-			p = MODR;
+			p = pxa2xx_ac97_read_modr();
 
 		dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n",
 			x, y, p);
include/sound/pxa2xx-lib.h +4 -0
index 6758fc12fa84..79c32a8f4c91 100644
@@ -41,4 +41,8 @@ extern int pxa2xx_ac97_hw_resume(void);
 extern int pxa2xx_ac97_hw_probe(struct platform_device *dev);
 extern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
 
+/* modem registers, used by touchscreen driver */
+u32 pxa2xx_ac97_read_modr(void);
+u32 pxa2xx_ac97_read_misr(void);
+
 #endif
sound/arm/pxa2xx-ac97-lib.c +12 -0
index 8c79d224f03b..572b73d73762 100644
@@ -428,6 +428,18 @@ void pxa2xx_ac97_hw_remove(struct platform_device *dev)
 }
 EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_remove);
 
+u32 pxa2xx_ac97_read_modr(void)
+{
+	return MODR;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_read_modr);
+
+u32 pxa2xx_ac97_read_misr(void)
+{
+	return MISR;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_read_misr);
+
 MODULE_AUTHOR("Nicolas Pitre");
 MODULE_DESCRIPTION("Intel/Marvell PXA sound library");
 MODULE_LICENSE("GPL");
Signature · 1 line
2.20.0
maintainer
#93 lore raw

Re: [PATCH 29/46] Input: touchscreen: use wrapper for pxa2xx ac97 registers

Quoted 4 lines · Arnd Bergmann

To avoid a dependency on the pxa platform header files with hardcoded registers, change the driver to call a wrapper in the pxa2xx-ac97-lib that encapsulates all the other ac97 stuff.

Not supper happy about adding module dependencies. Can we include mach/regs-ac97.h from include/sound/pxa2xx-lib.h and use static inlines? Someone needs to include mach/regs-ac97.h in the end...

Or there is something later in the series that needs it?

Thanks.

Signature · 1 line
Dmitry

A message that is not in the archive (sent off-list or not yet received): CAK8P3a27==9TeS-RWEvrpnxh+6McqRF-xeb8WPj9pHOn+0zbOQ@mail.gmail.com

#95 lore raw

PATCH 29/46 Input: touchscreen: use wrapper for pxa2xx ac97 registers

Quoted 7 lines · Dmitry Torokhov
Quoted 4 lines · Arnd Bergmann

To avoid a dependency on the pxa platform header files with hardcoded registers, change the driver to call a wrapper in the pxa2xx-ac97-lib that encapsulates all the other ac97 stuff.

Quoted 5 lines

Not supper happy about adding module dependencies. Can we include mach/regs-ac97.h from include/sound/pxa2xx-lib.h and use static inlines? Someone needs to include mach/regs-ac97.h in the end...

Or there is something later in the series that needs it?

One of the goals of the series is to completely remove all mach/*.h headers and place them somewhere else, ideally inaccessible to device drivers.

In case of mach/regs-ac97.h, the later patch "ASoC: pxa: ac97: use normal MMIO accessors" passes the physical register base address as a platform device resource that gets ioremapped in the ac97 driver, rather than hardcoding the virtual address in a global header.

I agree that the exported function is still ugly, but I hope it's enough of an improvement over the previous state that we can do it anyway.

If you have any better ideas though, I can give that a try, too. One possibility would be a higher-level interface exported on top of 'struct snd_ac97', but I could not figure out how to do this.

Arnd

maintainer Acked-by on v1 29/46
#96 lore raw

Re: Fwd: [PATCH 29/46] Input: touchscreen: use wrapper for pxa2xx ac97 registers

Quoted 23 lines · Arnd Bergmann
Quoted 7 lines · Dmitry Torokhov
Quoted 4 lines · Arnd Bergmann

To avoid a dependency on the pxa platform header files with hardcoded registers, change the driver to call a wrapper in the pxa2xx-ac97-lib that encapsulates all the other ac97 stuff.

Quoted 5 lines

Not supper happy about adding module dependencies. Can we include mach/regs-ac97.h from include/sound/pxa2xx-lib.h and use static inlines? Someone needs to include mach/regs-ac97.h in the end...

Or there is something later in the series that needs it?

One of the goals of the series is to completely remove all mach/*.h headers and place them somewhere else, ideally inaccessible to device drivers.

In case of mach/regs-ac97.h, the later patch "ASoC: pxa: ac97: use normal MMIO accessors" passes the physical register base address as a platform device resource that gets ioremapped in the ac97 driver, rather than hardcoding the virtual address in a global header.

Quoted 6 lines

I agree that the exported function is still ugly, but I hope it's enough of an improvement over the previous state that we can do it anyway.

If you have any better ideas though, I can give that a try, too. One possibility would be a higher-level interface exported on top of 'struct snd_ac97', but I could not figure out how to do this.

No, I do mot really have better ideas given your stated goals and I guess there is not really much benefit on spending too much effort polishing essentially one driver.

Thanks.

Signature · 1 line
Dmitry
maintainer Acked-by on v1 29/46
#97 lore raw

Re: [PATCH 29/46] Input: touchscreen: use wrapper for pxa2xx ac97 registers

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

To avoid a dependency on the pxa platform header files with hardcoded registers, change the driver to call a wrapper in the pxa2xx-ac97-lib that encapsulates all the other ac97 stuff.

Cheers.

--
Robert

#98 lore raw

PATCH 30/46 SoC: pxa: use pdev resource for FIFO regs

In reply to Arnd Bergmann

The driver currently takes the hardwired FIFO address from a header file that we want to eliminate. Change it to use the mmio resource instead and stop including the heare.

---
 sound/soc/pxa/pxa2xx-ac97.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
sound/soc/pxa/pxa2xx-ac97.c +15 -7
index 2138106fed23..4fd97c50aa2c 100644
@@ -21,10 +21,12 @@
 #include <sound/pxa2xx-lib.h>
 #include <sound/dmaengine_pcm.h>
 
-#include <mach/pxa-regs.h>
-#include <mach/regs-ac97.h>
 #include <linux/platform_data/asoc-pxa.h>
 
+#define PCDR	0x0040  /* PCM FIFO Data Register */
+#define MODR	0x0140  /* Modem FIFO Data Register */
+#define MCDR	0x0060  /* Mic-in FIFO Data Register */
+
 static void pxa2xx_ac97_warm_reset(struct ac97_controller *adrv)
 {
 	pxa2xx_ac97_try_warm_reset();
@@ -59,35 +61,30 @@ static struct ac97_controller_ops pxa2xx_ac97_ops = {
 };
 
 static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_in = {
-	.addr		= __PREG(PCDR),
 	.addr_width	= DMA_SLAVE_BUSWIDTH_4_BYTES,
 	.chan_name	= "pcm_pcm_stereo_in",
 	.maxburst	= 32,
 };
 
 static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_out = {
-	.addr		= __PREG(PCDR),
 	.addr_width	= DMA_SLAVE_BUSWIDTH_4_BYTES,
 	.chan_name	= "pcm_pcm_stereo_out",
 	.maxburst	= 32,
 };
 
 static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_aux_mono_out = {
-	.addr		= __PREG(MODR),
 	.addr_width	= DMA_SLAVE_BUSWIDTH_2_BYTES,
 	.chan_name	= "pcm_aux_mono_out",
 	.maxburst	= 16,
 };
 
 static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_aux_mono_in = {
-	.addr		= __PREG(MODR),
 	.addr_width	= DMA_SLAVE_BUSWIDTH_2_BYTES,
 	.chan_name	= "pcm_aux_mono_in",
 	.maxburst	= 16,
 };
 
 static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_mic_mono_in = {
-	.addr		= __PREG(MCDR),
 	.addr_width	= DMA_SLAVE_BUSWIDTH_2_BYTES,
 	.chan_name	= "pcm_aux_mic_mono",
 	.maxburst	= 16,
@@ -225,6 +222,7 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
 	int ret;
 	struct ac97_controller *ctrl;
 	pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data;
+	struct resource *regs;
 	void **codecs_pdata;
 
 	if (pdev->id != -1) {
@@ -232,6 +230,16 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
+	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!regs)
+		return -ENXIO;
+
+	pxa2xx_ac97_pcm_stereo_in.addr = regs->start + PCDR;
+	pxa2xx_ac97_pcm_stereo_out.addr = regs->start + PCDR;
+	pxa2xx_ac97_pcm_aux_mono_out.addr = regs->start + MODR;
+	pxa2xx_ac97_pcm_aux_mono_in.addr = regs->start + MODR;
+	pxa2xx_ac97_pcm_mic_mono_in.addr = regs->start + MCDR;
+
 	ret = pxa2xx_ac97_hw_probe(pdev);
 	if (ret) {
 		dev_err(&pdev->dev, "PXA2xx AC97 hw probe error (%d)\n", ret);
Signature · 1 line
2.20.0
maintainer Acked-by on v1 30/46
#99 lore raw

Re: [PATCH 30/46] SoC: pxa: use pdev resource for FIFO regs

Quoted 3 lines · Arnd Bergmann

The driver currently takes the hardwired FIFO address from a header file that we want to eliminate. Change it to use the mmio resource instead and stop including the heare.

Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.

#100 lore raw

Re: [PATCH 30/46] SoC: pxa: use pdev resource for FIFO regs

Quoted 10 lines · Mark Brown
Quoted 3 lines · Arnd Bergmann

The driver currently takes the hardwired FIFO address from a header file that we want to eliminate. Change it to use the mmio resource instead and stop including the heare.

Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches.

Fixed, I guess I lost an 'A' somewhere.

Arnd

maintainer
#101 lore raw

Re: [PATCH 30/46] SoC: pxa: use pdev resource for FIFO regs

In reply to Arnd Bergmann
Quoted 3 lines · Arnd Bergmann

The driver currently takes the hardwired FIFO address from a header file that we want to eliminate. Change it to use the mmio resource instead and stop including the heare.

What is a "heare" ? I hear something like "including it here" maybe ...

Otherwise : Acked-by: Robert Jarzmik <[email protected]>

Cheers.

--
Robert

#102 lore raw

PATCH 31/46 ASoC: pxa: ac97: use normal MMIO accessors

In reply to Arnd Bergmann

To avoid dereferencing hardwired constant pointers from a global header file, change the driver to use devm_platform_ioremap_resource for getting an __iomem pointer, and then using readl/writel on that.

Each pointer dereference gets changed by a search&replace, which leads to a few overlong lines, but seems less risky than trying to clean up the code at the same time.

---
 sound/arm/pxa2xx-ac97-lib.c                   | 124 ++++++++++--------
 .../arm/pxa2xx-ac97-regs.h                    |  42 +++---
 sound/arm/pxa2xx-ac97.c                       |   1 -
 3 files changed, 92 insertions(+), 75 deletions(-)
 rename arch/arm/mach-pxa/include/mach/regs-ac97.h => sound/arm/pxa2xx-ac97-regs.h (71%)
sound/arm/pxa2xx-ac97-lib.c +72 -52
index 572b73d73762..e55c0421718b 100644
@@ -21,15 +21,17 @@
 
 #include <sound/pxa2xx-lib.h>
 
-#include <mach/regs-ac97.h>
 #include <linux/platform_data/asoc-pxa.h>
 
+#include "pxa2xx-ac97-regs.h"
+
 static DEFINE_MUTEX(car_mutex);
 static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
 static volatile long gsr_bits;
 static struct clk *ac97_clk;
 static struct clk *ac97conf_clk;
 static int reset_gpio;
+static void __iomem *ac97_reg_base;
 
 extern void pxa27x_configure_ac97reset(int reset_gpio, bool to_gpio);
 
@@ -46,7 +48,7 @@ extern void pxa27x_configure_ac97reset(int reset_gpio, bool to_gpio);
 int pxa2xx_ac97_read(int slot, unsigned short reg)
 {
 	int val = -ENODEV;
-	volatile u32 *reg_addr;
+	u32 __iomem *reg_addr;
 
 	if (slot > 0)
 		return -ENODEV;
@@ -55,31 +57,33 @@ int pxa2xx_ac97_read(int slot, unsigned short reg)
 
 	/* set up primary or secondary codec space */
 	if (cpu_is_pxa25x() && reg == AC97_GPIO_STATUS)
-		reg_addr = slot ? &SMC_REG_BASE : &PMC_REG_BASE;
+		reg_addr = ac97_reg_base +
+			   (slot ? SMC_REG_BASE : PMC_REG_BASE);
 	else
-		reg_addr = slot ? &SAC_REG_BASE : &PAC_REG_BASE;
+		reg_addr = ac97_reg_base +
+			   (slot ? SAC_REG_BASE : PAC_REG_BASE);
 	reg_addr += (reg >> 1);
 
 	/* start read access across the ac97 link */
-	GSR = GSR_CDONE | GSR_SDONE;
+	writel(GSR_CDONE | GSR_SDONE, ac97_reg_base + GSR);
 	gsr_bits = 0;
-	val = (*reg_addr & 0xffff);
+	val = (readl(reg_addr) & 0xffff);
 	if (reg == AC97_GPIO_STATUS)
 		goto out;
-	if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1) <= 0 &&
-	    !((GSR | gsr_bits) & GSR_SDONE)) {
+	if (wait_event_timeout(gsr_wq, (readl(ac97_reg_base + GSR) | gsr_bits) & GSR_SDONE, 1) <= 0 &&
+	    !((readl(ac97_reg_base + GSR) | gsr_bits) & GSR_SDONE)) {
 		printk(KERN_ERR "%s: read error (ac97_reg=%d GSR=%#lx)\n",
-				__func__, reg, GSR | gsr_bits);
+				__func__, reg, readl(ac97_reg_base + GSR) | gsr_bits);
 		val = -ETIMEDOUT;
 		goto out;
 	}
 
 	/* valid data now */
-	GSR = GSR_CDONE | GSR_SDONE;
+	writel(GSR_CDONE | GSR_SDONE, ac97_reg_base + GSR);
 	gsr_bits = 0;
-	val = (*reg_addr & 0xffff);
+	val = (readl(reg_addr) & 0xffff);
 	/* but we've just started another cycle... */
-	wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1);
+	wait_event_timeout(gsr_wq, (readl(ac97_reg_base + GSR) | gsr_bits) & GSR_SDONE, 1);
 
 out:	mutex_unlock(&car_mutex);
 	return val;
@@ -88,25 +92,27 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_read);
 
 int pxa2xx_ac97_write(int slot, unsigned short reg, unsigned short val)
 {
-	volatile u32 *reg_addr;
+	u32 __iomem *reg_addr;
 	int ret = 0;
 
 	mutex_lock(&car_mutex);
 
 	/* set up primary or secondary codec space */
 	if (cpu_is_pxa25x() && reg == AC97_GPIO_STATUS)
-		reg_addr = slot ? &SMC_REG_BASE : &PMC_REG_BASE;
+		reg_addr = ac97_reg_base +
+			   (slot ? SMC_REG_BASE : PMC_REG_BASE);
 	else
-		reg_addr = slot ? &SAC_REG_BASE : &PAC_REG_BASE;
+		reg_addr = ac97_reg_base +
+			   (slot ? SAC_REG_BASE : PAC_REG_BASE);
 	reg_addr += (reg >> 1);
 
-	GSR = GSR_CDONE | GSR_SDONE;
+	writel(GSR_CDONE | GSR_SDONE, ac97_reg_base + GSR);
 	gsr_bits = 0;
-	*reg_addr = val;
-	if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_CDONE, 1) <= 0 &&
-	    !((GSR | gsr_bits) & GSR_CDONE)) {
+	writel(val, reg_addr);
+	if (wait_event_timeout(gsr_wq, (readl(ac97_reg_base + GSR) | gsr_bits) & GSR_CDONE, 1) <= 0 &&
+	    !((readl(ac97_reg_base + GSR) | gsr_bits) & GSR_CDONE)) {
 		printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n",
-				__func__, reg, GSR | gsr_bits);
+				__func__, reg, readl(ac97_reg_base + GSR) | gsr_bits);
 		ret = -EIO;
 	}
 
@@ -120,17 +126,17 @@ static inline void pxa_ac97_warm_pxa25x(void)
 {
 	gsr_bits = 0;
 
-	GCR |= GCR_WARM_RST;
+	writel(readl(ac97_reg_base + GCR) | (GCR_WARM_RST), ac97_reg_base + GCR);
 }
 
 static inline void pxa_ac97_cold_pxa25x(void)
 {
-	GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
-	GCR &= ~GCR_COLD_RST;  /* then assert nCRST */
+	writel(readl(ac97_reg_base + GCR) & ( GCR_COLD_RST), ac97_reg_base + GCR);  /* clear everything but nCRST */
+	writel(readl(ac97_reg_base + GCR) & (~GCR_COLD_RST), ac97_reg_base + GCR);  /* then assert nCRST */
 
 	gsr_bits = 0;
 
-	GCR = GCR_COLD_RST;
+	writel(GCR_COLD_RST, ac97_reg_base + GCR);
 }
 #endif
 
@@ -142,15 +148,15 @@ static inline void pxa_ac97_warm_pxa27x(void)
 	/* warm reset broken on Bulverde, so manually keep AC97 reset high */
 	pxa27x_configure_ac97reset(reset_gpio, true);
 	udelay(10);
-	GCR |= GCR_WARM_RST;
+	writel(readl(ac97_reg_base + GCR) | (GCR_WARM_RST), ac97_reg_base + GCR);
 	pxa27x_configure_ac97reset(reset_gpio, false);
 	udelay(500);
 }
 
 static inline void pxa_ac97_cold_pxa27x(void)
 {
-	GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
-	GCR &= ~GCR_COLD_RST;  /* then assert nCRST */
+	writel(readl(ac97_reg_base + GCR) & ( GCR_COLD_RST), ac97_reg_base + GCR);  /* clear everything but nCRST */
+	writel(readl(ac97_reg_base + GCR) & (~GCR_COLD_RST), ac97_reg_base + GCR);  /* then assert nCRST */
 
 	gsr_bits = 0;
 
@@ -158,7 +164,7 @@ static inline void pxa_ac97_cold_pxa27x(void)
 	clk_prepare_enable(ac97conf_clk);
 	udelay(5);
 	clk_disable_unprepare(ac97conf_clk);
-	GCR = GCR_COLD_RST | GCR_WARM_RST;
+	writel(GCR_COLD_RST | GCR_WARM_RST, ac97_reg_base + GCR);
 }
 #endif
 
@@ -168,26 +174,26 @@ static inline void pxa_ac97_warm_pxa3xx(void)
 	gsr_bits = 0;
 
 	/* Can't use interrupts */
-	GCR |= GCR_WARM_RST;
+	writel(readl(ac97_reg_base + GCR) | (GCR_WARM_RST), ac97_reg_base + GCR);
 }
 
 static inline void pxa_ac97_cold_pxa3xx(void)
 {
 	/* Hold CLKBPB for 100us */
-	GCR = 0;
-	GCR = GCR_CLKBPB;
+	writel(0, ac97_reg_base + GCR);
+	writel(GCR_CLKBPB, ac97_reg_base + GCR);
 	udelay(100);
-	GCR = 0;
+	writel(0, ac97_reg_base + GCR);
 
-	GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
-	GCR &= ~GCR_COLD_RST;  /* then assert nCRST */
+	writel(readl(ac97_reg_base + GCR) & ( GCR_COLD_RST), ac97_reg_base + GCR);  /* clear everything but nCRST */
+	writel(readl(ac97_reg_base + GCR) & (~GCR_COLD_RST), ac97_reg_base + GCR);  /* then assert nCRST */
 
 	gsr_bits = 0;
 
 	/* Can't use interrupts on PXA3xx */
-	GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
+	writel(readl(ac97_reg_base + GCR) & (~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN)), ac97_reg_base + GCR);
 
-	GCR = GCR_WARM_RST | GCR_COLD_RST;
+	writel(GCR_WARM_RST | GCR_COLD_RST, ac97_reg_base + GCR);
 }
 #endif
 
@@ -213,10 +219,10 @@ bool pxa2xx_ac97_try_warm_reset(void)
 #endif
 		snd_BUG();
 
-	while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
+	while (!((readl(ac97_reg_base + GSR) | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
 		mdelay(1);
 
-	gsr = GSR | gsr_bits;
+	gsr = readl(ac97_reg_base + GSR) | gsr_bits;
 	if (!(gsr & (GSR_PCR | GSR_SCR))) {
 		printk(KERN_INFO "%s: warm reset timeout (GSR=%#lx)\n",
 				 __func__, gsr);
@@ -250,10 +256,10 @@ bool pxa2xx_ac97_try_cold_reset(void)
 #endif
 		snd_BUG();
 
-	while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
+	while (!((readl(ac97_reg_base + GSR) | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
 		mdelay(1);
 
-	gsr = GSR | gsr_bits;
+	gsr = readl(ac97_reg_base + GSR) | gsr_bits;
 	if (!(gsr & (GSR_PCR | GSR_SCR))) {
 		printk(KERN_INFO "%s: cold reset timeout (GSR=%#lx)\n",
 				 __func__, gsr);
@@ -268,8 +274,10 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_try_cold_reset);
 
 void pxa2xx_ac97_finish_reset(void)
 {
-	GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
-	GCR |= GCR_SDONE_IE|GCR_CDONE_IE;
+	u32 gcr = readl(ac97_reg_base + GCR);
+	gcr &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
+	gcr |= GCR_SDONE_IE|GCR_CDONE_IE;
+	writel(gcr, ac97_reg_base + GCR);
 }
 EXPORT_SYMBOL_GPL(pxa2xx_ac97_finish_reset);
 
@@ -277,9 +285,9 @@ static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id)
 {
 	long status;
 
-	status = GSR;
+	status = readl(ac97_reg_base + GSR);
 	if (status) {
-		GSR = status;
+		writel(status, ac97_reg_base + GSR);
 		gsr_bits |= status;
 		wake_up(&gsr_wq);
 
@@ -287,9 +295,9 @@ static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id)
 		   since they tend to spuriously trigger when MMC is used
 		   (hardware bug? go figure)... */
 		if (cpu_is_pxa27x()) {
-			MISR = MISR_EOC;
-			PISR = PISR_EOC;
-			MCSR = MCSR_EOC;
+			writel(MISR_EOC, ac97_reg_base + MISR);
+			writel(PISR_EOC, ac97_reg_base + PISR);
+			writel(MCSR_EOC, ac97_reg_base + MCSR);
 		}
 
 		return IRQ_HANDLED;
@@ -301,7 +309,7 @@ static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id)
 #ifdef CONFIG_PM
 int pxa2xx_ac97_hw_suspend(void)
 {
-	GCR |= GCR_ACLINK_OFF;
+	writel(readl(ac97_reg_base + GCR) | (GCR_ACLINK_OFF), ac97_reg_base + GCR);
 	clk_disable_unprepare(ac97_clk);
 	return 0;
 }
@@ -321,6 +329,12 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
 	int irq;
 	pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
 
+	ac97_reg_base = devm_platform_ioremap_resource(dev, 0);
+	if (IS_ERR(ac97_reg_base)) {
+		dev_err(&dev->dev, "Missing MMIO resource\n");
+		return PTR_ERR(ac97_reg_base);
+	}
+
 	if (pdata) {
 		switch (pdata->reset_gpio) {
 		case 95:
@@ -398,7 +412,7 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
 	return 0;
 
 err_irq:
-	GCR |= GCR_ACLINK_OFF;
+	writel(readl(ac97_reg_base + GCR) | (GCR_ACLINK_OFF), ac97_reg_base + GCR);
 err_clk2:
 	clk_put(ac97_clk);
 	ac97_clk = NULL;
@@ -416,7 +430,7 @@ void pxa2xx_ac97_hw_remove(struct platform_device *dev)
 {
 	if (cpu_is_pxa27x())
 		gpio_free(reset_gpio);
-	GCR |= GCR_ACLINK_OFF;
+	writel(readl(ac97_reg_base + GCR) | (GCR_ACLINK_OFF), ac97_reg_base + GCR);
 	free_irq(platform_get_irq(dev, 0), NULL);
 	if (ac97conf_clk) {
 		clk_put(ac97conf_clk);
@@ -430,13 +444,19 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_remove);
 
 u32 pxa2xx_ac97_read_modr(void)
 {
-	return MODR;
+	if (!ac97_reg_base)
+		return 0;
+
+	return readl(ac97_reg_base + MODR);
 }
 EXPORT_SYMBOL_GPL(pxa2xx_ac97_read_modr);
 
 u32 pxa2xx_ac97_read_misr(void)
 {
-	return MISR;
+	if (!ac97_reg_base)
+		return 0;
+
+	return readl(ac97_reg_base + MISR);
 }
 EXPORT_SYMBOL_GPL(pxa2xx_ac97_read_misr);
 
sound/arm/pxa2xx-ac97-regs.h renamed from arch/arm/mach-pxa/include/mach/regs-ac97.h +20 -22

100 lines not on this page · raw message

sound/arm/pxa2xx-ac97.c +0 -1
index 2e99232028ac..c3d682de1289 100644
@@ -21,7 +21,6 @@
 #include <sound/pxa2xx-lib.h>
 #include <sound/dmaengine_pcm.h>
 
-#include <mach/regs-ac97.h>
 #include <linux/platform_data/asoc-pxa.h>
 
 static void pxa2xx_ac97_legacy_reset(struct snd_ac97 *ac97)
Signature · 1 line
2.20.0
maintainer Acked-by on v1 31/46
#103 lore raw

Re: [PATCH 31/46] ASoC: pxa: ac97: use normal MMIO accessors

Quoted 10 lines · Arnd Bergmann

To avoid dereferencing hardwired constant pointers from a global header file, change the driver to use devm_platform_ioremap_resource for getting an __iomem pointer, and then using readl/writel on that.

Each pointer dereference gets changed by a search&replace, which leads to a few overlong lines, but seems less risky than trying to clean up the code at the same time.

Cheers.

--
Robert

#104 lore raw

PATCH 32/46 ASoC: pxa: i2s: use normal MMIO accessors

In reply to Arnd Bergmann

To avoid dereferencing hardwired constant pointers from a global header file, change the driver to use devm_platform_ioremap_resource for getting an __iomem pointer, and then using readl/writel on that.

Each pointer dereference gets changed by a search&replace, which leads to a few overlong lines, but seems less risky than trying to clean up the code at the same time.

---
 sound/soc/pxa/pxa2xx-i2s.c | 110 +++++++++++++++++++++----------------
 1 file changed, 62 insertions(+), 48 deletions(-)
sound/soc/pxa/pxa2xx-i2s.c +62 -48
index 583b2de897c7..e7ded1d7de9a 100644
@@ -21,7 +21,6 @@
 #include <sound/pxa2xx-lib.h>
 #include <sound/dmaengine_pcm.h>
 
-#include <mach/pxa-regs.h>
 #include <linux/platform_data/asoc-pxa.h>
 
 #include "pxa2xx-i2s.h"
@@ -29,13 +28,13 @@
 /*
  * I2S Controller Register and Bit Definitions
  */
-#define SACR0		__REG(0x40400000)  /* Global Control Register */
-#define SACR1		__REG(0x40400004)  /* Serial Audio I 2 S/MSB-Justified Control Register */
-#define SASR0		__REG(0x4040000C)  /* Serial Audio I 2 S/MSB-Justified Interface and FIFO Status Register */
-#define SAIMR		__REG(0x40400014)  /* Serial Audio Interrupt Mask Register */
-#define SAICR		__REG(0x40400018)  /* Serial Audio Interrupt Clear Register */
-#define SADIV		__REG(0x40400060)  /* Audio Clock Divider Register. */
-#define SADR		__REG(0x40400080)  /* Serial Audio Data Register (TX and RX FIFO access Register). */
+#define SACR0		(0x0000)	/* Global Control Register */
+#define SACR1		(0x0004)	/* Serial Audio I 2 S/MSB-Justified Control Register */
+#define SASR0		(0x000C)	/* Serial Audio I 2 S/MSB-Justified Interface and FIFO Status Register */
+#define SAIMR		(0x0014)	/* Serial Audio Interrupt Mask Register */
+#define SAICR		(0x0018)	/* Serial Audio Interrupt Clear Register */
+#define SADIV		(0x0060)	/* Audio Clock Divider Register. */
+#define SADR		(0x0080)	/* Serial Audio Data Register (TX and RX FIFO access Register). */
 
 #define SACR0_RFTH(x)	((x) << 12)	/* Rx FIFO Interrupt or DMA Trigger Threshold */
 #define SACR0_TFTH(x)	((x) << 8)	/* Tx FIFO Interrupt or DMA Trigger Threshold */
@@ -77,16 +76,15 @@ struct pxa_i2s_port {
 static struct pxa_i2s_port pxa_i2s;
 static struct clk *clk_i2s;
 static int clk_ena = 0;
+static void __iomem *i2s_reg_base;
 
 static struct snd_dmaengine_dai_dma_data pxa2xx_i2s_pcm_stereo_out = {
-	.addr		= __PREG(SADR),
 	.addr_width	= DMA_SLAVE_BUSWIDTH_4_BYTES,
 	.chan_name	= "tx",
 	.maxburst	= 32,
 };
 
 static struct snd_dmaengine_dai_dma_data pxa2xx_i2s_pcm_stereo_in = {
-	.addr		= __PREG(SADR),
 	.addr_width	= DMA_SLAVE_BUSWIDTH_4_BYTES,
 	.chan_name	= "rx",
 	.maxburst	= 32,
@@ -102,7 +100,7 @@ static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream,
 		return PTR_ERR(clk_i2s);
 
 	if (!cpu_dai->active)
-		SACR0 = 0;
+		writel(0, i2s_reg_base + SACR0);
 
 	return 0;
 }
@@ -114,7 +112,7 @@ static int pxa_i2s_wait(void)
 
 	/* flush the Rx FIFO */
 	for (i = 0; i < 16; i++)
-		SADR;
+		readl(i2s_reg_base + SADR);
 	return 0;
 }
 
@@ -174,39 +172,39 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
 
 	/* is port used by another stream */
 	if (!(SACR0 & SACR0_ENB)) {
-		SACR0 = 0;
+		writel(0, i2s_reg_base + SACR0);
 		if (pxa_i2s.master)
-			SACR0 |= SACR0_BCKD;
+			writel(readl(i2s_reg_base + SACR0) | (SACR0_BCKD), i2s_reg_base + SACR0);
 
-		SACR0 |= SACR0_RFTH(14) | SACR0_TFTH(1);
-		SACR1 |= pxa_i2s.fmt;
+		writel(readl(i2s_reg_base + SACR0) | (SACR0_RFTH(14) | SACR0_TFTH(1)), i2s_reg_base + SACR0);
+		writel(readl(i2s_reg_base + SACR1) | (pxa_i2s.fmt), i2s_reg_base + SACR1);
 	}
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		SAIMR |= SAIMR_TFS;
+		writel(readl(i2s_reg_base + SAIMR) | (SAIMR_TFS), i2s_reg_base + SAIMR);
 	else
-		SAIMR |= SAIMR_RFS;
+		writel(readl(i2s_reg_base + SAIMR) | (SAIMR_RFS), i2s_reg_base + SAIMR);
 
 	switch (params_rate(params)) {
 	case 8000:
-		SADIV = 0x48;
+		writel(0x48, i2s_reg_base + SADIV);
 		break;
 	case 11025:
-		SADIV = 0x34;
+		writel(0x34, i2s_reg_base + SADIV);
 		break;
 	case 16000:
-		SADIV = 0x24;
+		writel(0x24, i2s_reg_base + SADIV);
 		break;
 	case 22050:
-		SADIV = 0x1a;
+		writel(0x1a, i2s_reg_base + SADIV);
 		break;
 	case 44100:
-		SADIV = 0xd;
+		writel(0xd, i2s_reg_base + SADIV);
 		break;
 	case 48000:
-		SADIV = 0xc;
+		writel(0xc, i2s_reg_base + SADIV);
 		break;
 	case 96000: /* not in manual and possibly slightly inaccurate */
-		SADIV = 0x6;
+		writel(0x6, i2s_reg_base + SADIV);
 		break;
 	}
 
@@ -221,10 +219,10 @@ static int pxa2xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-			SACR1 &= ~SACR1_DRPL;
+			writel(readl(i2s_reg_base + SACR1) & (~SACR1_DRPL), i2s_reg_base + SACR1);
 		else
-			SACR1 &= ~SACR1_DREC;
-		SACR0 |= SACR0_ENB;
+			writel(readl(i2s_reg_base + SACR1) & (~SACR1_DREC), i2s_reg_base + SACR1);
+		writel(readl(i2s_reg_base + SACR0) | (SACR0_ENB), i2s_reg_base + SACR0);
 		break;
 	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
@@ -243,15 +241,15 @@ static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream,
 				struct snd_soc_dai *dai)
 {
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		SACR1 |= SACR1_DRPL;
-		SAIMR &= ~SAIMR_TFS;
+		writel(readl(i2s_reg_base + SACR1) | (SACR1_DRPL), i2s_reg_base + SACR1);
+		writel(readl(i2s_reg_base + SAIMR) & (~SAIMR_TFS), i2s_reg_base + SAIMR);
 	} else {
-		SACR1 |= SACR1_DREC;
-		SAIMR &= ~SAIMR_RFS;
+		writel(readl(i2s_reg_base + SACR1) | (SACR1_DREC), i2s_reg_base + SACR1);
+		writel(readl(i2s_reg_base + SAIMR) & (~SAIMR_RFS), i2s_reg_base + SAIMR);
 	}
 
-	if ((SACR1 & (SACR1_DREC | SACR1_DRPL)) == (SACR1_DREC | SACR1_DRPL)) {
-		SACR0 &= ~SACR0_ENB;
+	if ((readl(i2s_reg_base + SACR1) & (SACR1_DREC | SACR1_DRPL)) == (SACR1_DREC | SACR1_DRPL)) {
+		writel(readl(i2s_reg_base + SACR0) & (~SACR0_ENB), i2s_reg_base + SACR0);
 		pxa_i2s_wait();
 		if (clk_ena) {
 			clk_disable_unprepare(clk_i2s);
@@ -264,13 +262,13 @@ static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream,
 static int pxa2xx_i2s_suspend(struct snd_soc_dai *dai)
 {
 	/* store registers */
-	pxa_i2s.sacr0 = SACR0;
-	pxa_i2s.sacr1 = SACR1;
-	pxa_i2s.saimr = SAIMR;
-	pxa_i2s.sadiv = SADIV;
+	pxa_i2s.sacr0 = readl(i2s_reg_base + SACR0);
+	pxa_i2s.sacr1 = readl(i2s_reg_base + SACR1);
+	pxa_i2s.saimr = readl(i2s_reg_base + SAIMR);
+	pxa_i2s.sadiv = readl(i2s_reg_base + SADIV);
 
 	/* deactivate link */
-	SACR0 &= ~SACR0_ENB;
+	writel(readl(i2s_reg_base + SACR0) & (~SACR0_ENB), i2s_reg_base + SACR0);
 	pxa_i2s_wait();
 	return 0;
 }
@@ -279,12 +277,12 @@ static int pxa2xx_i2s_resume(struct snd_soc_dai *dai)
 {
 	pxa_i2s_wait();
 
-	SACR0 = pxa_i2s.sacr0 & ~SACR0_ENB;
-	SACR1 = pxa_i2s.sacr1;
-	SAIMR = pxa_i2s.saimr;
-	SADIV = pxa_i2s.sadiv;
+	writel(pxa_i2s.sacr0 & ~SACR0_ENB, i2s_reg_base + SACR0);
+	writel(pxa_i2s.sacr1, i2s_reg_base + SACR1);
+	writel(pxa_i2s.saimr, i2s_reg_base + SAIMR);
+	writel(pxa_i2s.sadiv, i2s_reg_base + SADIV);
 
-	SACR0 = pxa_i2s.sacr0;
+	writel(pxa_i2s.sacr0, i2s_reg_base + SACR0);
 
 	return 0;
 }
@@ -306,12 +304,12 @@ static int pxa2xx_i2s_probe(struct snd_soc_dai *dai)
 	 * the SACR0[RST] bit must also be set and cleared to reset all
 	 * I2S controller registers.
 	 */
-	SACR0 = SACR0_RST;
-	SACR0 = 0;
+	writel(SACR0_RST, i2s_reg_base + SACR0);
+	writel(0, i2s_reg_base + SACR0);
 	/* Make sure RPL and REC are disabled */
-	SACR1 = SACR1_DRPL | SACR1_DREC;
+	writel(SACR1_DRPL | SACR1_DREC, i2s_reg_base + SACR1);
 	/* Along with FIFO servicing */
-	SAIMR &= ~(SAIMR_RFS | SAIMR_TFS);
+	writel(readl(i2s_reg_base + SAIMR) & (~(SAIMR_RFS | SAIMR_TFS)), i2s_reg_base + SAIMR);
 
 	snd_soc_dai_init_dma_data(dai, &pxa2xx_i2s_pcm_stereo_out,
 		&pxa2xx_i2s_pcm_stereo_in);
@@ -367,6 +365,22 @@ static const struct snd_soc_component_driver pxa_i2s_component = {
 
 static int pxa2xx_i2s_drv_probe(struct platform_device *pdev)
 {
+	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+	if (!res) {
+		dev_err(&pdev->dev, "missing MMIO resource\n");
+		return -ENXIO;
+	}
+
+	i2s_reg_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(i2s_reg_base)) {
+		dev_err(&pdev->dev, "ioremap failed\n");
+		return PTR_ERR(i2s_reg_base);
+	}
+
+	pxa2xx_i2s_pcm_stereo_out.addr = res->start + SADR;
+	pxa2xx_i2s_pcm_stereo_in.addr = res->start + SADR;
+
 	return devm_snd_soc_register_component(&pdev->dev, &pxa_i2s_component,
 					       &pxa_i2s_dai, 1);
 }
Signature · 1 line
2.20.0
maintainer Acked-by on v1 32/46
#105 lore raw

Re: [PATCH 32/46] ASoC: pxa: i2s: use normal MMIO accessors

Quoted 3 lines · Arnd Bergmann

To avoid dereferencing hardwired constant pointers from a global header file, change the driver to use devm_platform_ioremap_resource for getting an __iomem pointer, and then using readl/writel on that.

maintainer Acked-by on v1 32/46
#106 lore raw

Re: [PATCH 32/46] ASoC: pxa: i2s: use normal MMIO accessors

In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

To avoid dereferencing hardwired constant pointers from a global header file, change the driver to use devm_platform_ioremap_resource for getting an __iomem pointer, and then using readl/writel on that.

Each pointer dereference gets changed by a search&replace, which leads to a few overlong lines, but seems less risky than trying to clean up the code at the same time.

Cheers.

--
Robert

#107 lore raw

PATCH 33/46 ARM: pxa: pcmcia: move smemc configuration back to arch

In reply to Arnd Bergmann

Rather than poking at the smemc registers directly from the pcmcia/pxa2xx_base driver, move those bits into machine file to have a cleaner interface.

Cc Dominik Brodowski <[email protected]>
---
 arch/arm/mach-pxa/generic.c   | 29 ++++++++++++++++++++++
 drivers/pcmcia/pxa2xx_base.c  | 46 ++++++++++++-----------------------
 include/linux/soc/pxa/smemc.h | 10 ++++++++
 3 files changed, 55 insertions(+), 30 deletions(-)
 create mode 100644 include/linux/soc/pxa/smemc.h
arch/arm/mach-pxa/generic.c +29 -0
index f9083c4f0aea..fe1d55d328e5 100644
@@ -70,6 +70,35 @@ unsigned int get_clk_frequency_khz(int info)
 }
 EXPORT_SYMBOL(get_clk_frequency_khz);
 
+void pxa_smemc_set_pcmcia_timing(int sock, u32 mcmem, u32 mcatt, u32 mcio)
+{
+	__raw_writel(mcmem, MCMEM(sock));
+	__raw_writel(mcatt, MCATT(sock));
+	__raw_writel(mcio, MCIO(sock));
+}
+EXPORT_SYMBOL_GPL(pxa_smemc_set_pcmcia_timing);
+
+void pxa_smemc_set_pcmcia_socket(int nr)
+{
+	switch (nr) {
+	case 0:
+		__raw_writel(0, MECR);
+		break;
+	case 1:
+		/*
+		 * We have at least one socket, so set MECR:CIT
+		 * (Card Is There)
+		 */
+		__raw_writel(MECR_CIT, MECR);
+		break;
+	case 2:
+		/* Set CIT and MECR:NOS (Number Of Sockets) */
+		__raw_writel(MECR_CIT | MECR_NOS, MECR);
+		break;
+	}
+}
+EXPORT_SYMBOL_GPL(pxa_smemc_set_pcmcia_socket);
+
 /*
  * Intel PXA2xx internal register mapping.
  *
drivers/pcmcia/pxa2xx_base.c +16 -30

107 lines not on this page · raw message

include/linux/soc/pxa/smemc.h new file +10 -0
new file mode 100644
index 000000000000..cbf1a2d8af29
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __PXA_REGS_H
+#define __PXA_REGS_H
+
+#include <linux/types.h>
+
+void pxa_smemc_set_pcmcia_timing(int sock, u32 mcmem, u32 mcatt, u32 mcio);
+void pxa_smemc_set_pcmcia_socket(int nr);
+
+#endif
Signature · 1 line
2.20.0
maintainer
#108 lore raw

Re: [PATCH 33/46] ARM: pxa: pcmcia: move smemc configuration back to arch

Quoted 20 lines · Arnd Bergmann

Rather than poking at the smemc registers directly from the pcmcia/pxa2xx_base driver, move those bits into machine file to have a cleaner interface.

Cc Dominik Brodowski <[email protected]>
drivers/pcmcia/pxa2xx_base.c +4 -4
-static int pxa2xx_pcmcia_set_mcxx(struct soc_pcmcia_socket *skt, unsigned int clk)
+static int pxa2xx_pcmcia_set_timing(struct soc_pcmcia_socket *skt)
 {
+	unsigned long clk = clk_get_rate(skt->clk) / 1000;
 	struct soc_pcmcia_timing timing;
 	int sock = skt->nr;
 
 	soc_common_pcmcia_get_timing(skt, &timing);
 
-	pxa2xx_pcmcia_set_mcmem(sock, timing.mem, clk);
-	pxa2xx_pcmcia_set_mcatt(sock, timing.attr, clk);
-	pxa2xx_pcmcia_set_mcio(sock, timing.io, clk);
+	pxa_smemc_set_pcmcia_timing(sock,
+		pxa2xx_pcmcia_mcmem(sock, timing.mem, clk),

drivers/pcmcia/pxa2xx_base.c static int pxa2xx_pcmcia_set_mcatt( int sock, int speed, int clock ) · line 181

Quoted 10 lines
drivers/pcmcia/pxa2xx_base.c +2 -4
+		pxa2xx_pcmcia_mcatt(sock, timing.attr, clk),
+		pxa2xx_pcmcia_mcio(sock, timing.io, clk));
 
 	return 0;
 }
 
-static int pxa2xx_pcmcia_set_timing(struct soc_pcmcia_socket *skt)
-{
-	unsigned long clk = clk_get_rate(skt->clk);
-	return pxa2xx_pcmcia_set_mcxx(skt, clk / 10000);

That curious, because you divide here by 10^4, while in the old pxa2xx_pcmcia_set_mcxx() that was 10^3 ... is that a fix I don't see ?

Cheers.

--
Robert

#109 lore raw

Re: [PATCH 33/46] ARM: pxa: pcmcia: move smemc configuration back to arch

Quoted 6 lines · Robert Jarzmik

drivers/pcmcia/pxa2xx_base.c static int pxa2xx_pcmcia_set_mcatt( int sock, int speed, int clock ) · line 181

Quoted 4 lines
drivers/pcmcia/pxa2xx_base.c +0 -4
-static int pxa2xx_pcmcia_set_timing(struct soc_pcmcia_socket *skt)
-{
-     unsigned long clk = clk_get_rate(skt->clk);
-     return pxa2xx_pcmcia_set_mcxx(skt, clk / 10000);

That curious, because you divide here by 10^4, while in the old pxa2xx_pcmcia_set_mcxx() that was 10^3 ... is that a fix I don't see ?

Revisiting an older patch here: I'm fairly sure the change was my typo, fixed it now, thanks!

Arnd

#110 lore raw

PATCH 34/46 ARM: pxa: remove get_clk_frequency_khz()

In reply to Arnd Bergmann

get_clk_frequency_khz() is not a proper name for a global function, and there is only one caller.

Convert viper to use the properly namespaced pxa25x_get_clk_frequency_khz() and remove the other references.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>
---
 arch/arm/mach-pxa/generic.c      | 15 ---------------
 arch/arm/mach-pxa/generic.h      |  1 -
 arch/arm/mach-pxa/viper.c        |  2 +-
 drivers/cpufreq/pxa2xx-cpufreq.c |  2 --
 4 files changed, 1 insertion(+), 19 deletions(-)
arch/arm/mach-pxa/generic.c +0 -15
index fe1d55d328e5..2c2c82fcf9cb 100644
@@ -55,21 +55,6 @@ void __init pxa_timer_init(void)
 	pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000));
 }
 
-/*
- * Get the clock frequency as reflected by CCCR and the turbo flag.
- * We assume these values have been applied via a fcs.
- * If info is not 0 we also display the current settings.
- */
-unsigned int get_clk_frequency_khz(int info)
-{
-	if (cpu_is_pxa25x())
-		return pxa25x_get_clk_frequency_khz(info);
-	else if (cpu_is_pxa27x())
-		return pxa27x_get_clk_frequency_khz(info);
-	return 0;
-}
-EXPORT_SYMBOL(get_clk_frequency_khz);
-
 void pxa_smemc_set_pcmcia_timing(int sock, u32 mcmem, u32 mcatt, u32 mcio)
 {
 	__raw_writel(mcmem, MCMEM(sock));
arch/arm/mach-pxa/generic.h +0 -1
index 67925d3ea026..2f706ef97357 100644
@@ -11,7 +11,6 @@
 
 struct irq_data;
 
-extern unsigned int get_clk_frequency_khz(int info);
 extern void __init pxa_dt_irq_init(int (*fn)(struct irq_data *,
 					     unsigned int));
 extern void __init pxa_map_io(void);
arch/arm/mach-pxa/viper.c +1 -1
index fe74ee266871..e341e26f7e2a 100644
@@ -852,7 +852,7 @@ static void __init viper_init_vcore_gpios(void)
 		goto err_dir;
 
 	/* c/should assume redboot set the correct level ??? */
-	viper_set_core_cpu_voltage(get_clk_frequency_khz(0), 1);
+	viper_set_core_cpu_voltage(pxa25x_get_clk_frequency_khz(0), 1);
 
 	return;
 
drivers/cpufreq/pxa2xx-cpufreq.c +0 -2
index 0f0e676ff781..e74d36d6f78d 100644
@@ -107,8 +107,6 @@ static struct pxa_freqs pxa27x_freqs[] = {
 static struct cpufreq_frequency_table
 	pxa27x_freq_table[NUM_PXA27x_FREQS+1];
 
-extern unsigned get_clk_frequency_khz(int info);
-
 #ifdef CONFIG_REGULATOR
 
 static int pxa_cpufreq_change_voltage(const struct pxa_freqs *pxa_freq)
Signature · 1 line
2.20.0
maintainer Acked-by on v1 34/46
#111 lore raw

Re: [PATCH 34/46] ARM: pxa: remove get_clk_frequency_khz()

Quoted 10 lines · Arnd Bergmann

get_clk_frequency_khz() is not a proper name for a global function, and there is only one caller.

Convert viper to use the properly namespaced pxa25x_get_clk_frequency_khz() and remove the other references.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>
Quoted 6 lines
---
 arch/arm/mach-pxa/generic.c      | 15 ---------------
 arch/arm/mach-pxa/generic.h      |  1 -
 arch/arm/mach-pxa/viper.c        |  2 +-
 drivers/cpufreq/pxa2xx-cpufreq.c |  2 --
 4 files changed, 1 insertion(+), 19 deletions(-)
Signature · 1 line
viresh
maintainer Acked-by on v1 34/46
#112 lore raw

Re: [PATCH 34/46] ARM: pxa: remove get_clk_frequency_khz()

In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

get_clk_frequency_khz() is not a proper name for a global function, and there is only one caller.

Convert viper to use the properly namespaced pxa25x_get_clk_frequency_khz() and remove the other references.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>

Cheers.

--
Robert

#113 lore raw

PATCH 35/46 cpufreq: pxa3: move clk register access to clk driver

In reply to Arnd Bergmann

The driver needs some low-level register access for setting the core and bus frequencies. These registers are owned by the clk driver, so move the low-level access into that driver with a slightly higher-level interface and avoid any machine header file dependencies.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>
---
 arch/arm/mach-pxa/generic.h              |  1 -
 arch/arm/mach-pxa/include/mach/generic.h |  5 --
 arch/arm/mach-pxa/pxa3xx.c               |  1 +
 drivers/clk/pxa/clk-pxa3xx.c             | 16 ++++++
 drivers/cpufreq/pxa2xx-cpufreq.c         |  3 --
 drivers/cpufreq/pxa3xx-cpufreq.c         | 64 +++++++++++++-----------
 include/linux/clk/pxa.h                  |  9 ++++
 7 files changed, 62 insertions(+), 37 deletions(-)
 delete mode 100644 arch/arm/mach-pxa/include/mach/generic.h
 create mode 100644 include/linux/clk/pxa.h
arch/arm/mach-pxa/generic.h +0 -1
index 2f706ef97357..487eadb0fc2a 100644
@@ -7,7 +7,6 @@
  */
 
 #include <linux/reboot.h>
-#include <mach/generic.h>
 
 struct irq_data;
 
arch/arm/mach-pxa/include/mach/generic.h deleted +0 -5
deleted file mode 100644
index 613f6a299d0d..000000000000
@@ -1,5 +0,0 @@
-#ifdef CONFIG_PXA3xx
-extern unsigned	pxa3xx_get_clk_frequency_khz(int);
-#else
-#define pxa3xx_get_clk_frequency_khz(x)		(0)
-#endif
arch/arm/mach-pxa/pxa3xx.c +1 -0
index 7881888107c7..f4657f4edb3b 100644
@@ -25,6 +25,7 @@
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/platform_data/mmp_dma.h>
 #include <linux/soc/pxa/cpu.h>
+#include <linux/clk/pxa.h>
 
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
drivers/clk/pxa/clk-pxa3xx.c +16 -0
index 027b78183565..60a0db4f3790 100644
@@ -16,6 +16,7 @@
 #include <linux/of.h>
 #include <linux/soc/pxa/cpu.h>
 #include <mach/smemc.h>
+#include <linux/clk/pxa.h>
 #include <mach/pxa3xx-regs.h>
 
 #include <dt-bindings/clock/pxa-clock.h>
@@ -79,6 +80,21 @@ unsigned int pxa3xx_get_clk_frequency_khz(int info)
 	return (unsigned int)clks[0] / KHz;
 }
 
+void pxa3xx_clk_update_accr(u32 disable, u32 enable, u32 xclkcfg, u32 mask)
+{
+	u32 accr = ACCR;
+
+	accr &= ~disable;
+	accr |= enable;
+
+	ACCR = accr;
+	if (xclkcfg)
+		__asm__("mcr p14, 0, %0, c6, c0, 0\n" : : "r"(xclkcfg));
+
+	while ((ACSR & mask) != (accr & mask))
+		cpu_relax();
+}
+
 static unsigned long clk_pxa3xx_ac97_get_rate(struct clk_hw *hw,
 					     unsigned long parent_rate)
 {
drivers/cpufreq/pxa2xx-cpufreq.c +0 -3
index e74d36d6f78d..ed1ae061a687 100644
@@ -27,9 +27,6 @@
 #include <linux/soc/pxa/cpu.h>
 #include <linux/io.h>
 
-#include <mach/pxa2xx-regs.h>
-#include <mach/smemc.h>
-
 #ifdef DEBUG
 static unsigned int freq_debug;
 module_param(freq_debug, uint, 0);
drivers/cpufreq/pxa3xx-cpufreq.c +36 -28

95 lines not on this page · raw message

include/linux/clk/pxa.h new file +9 -0
new file mode 100644
index 000000000000..e5516c608c99
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifdef CONFIG_PXA3xx
+extern unsigned	pxa3xx_get_clk_frequency_khz(int);
+extern void pxa3xx_clk_update_accr(u32 disable, u32 enable, u32 xclkcfg, u32 mask);
+#else
+#define pxa3xx_get_clk_frequency_khz(x)		(0)
+#define pxa3xx_clk_update_accr(disable, enable, xclkcfg, mask) do { } while (0)
+#endif
Signature · 1 line
2.20.0
maintainer Acked-by on v1 35/46
#114 lore raw

Re: [PATCH 35/46] cpufreq: pxa3: move clk register access to clk driver

Quoted 13 lines · Arnd Bergmann

The driver needs some low-level register access for setting the core and bus frequencies. These registers are owned by the clk driver, so move the low-level access into that driver with a slightly higher-level interface and avoid any machine header file dependencies.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>
Quoted 3 lines
---
 drivers/cpufreq/pxa2xx-cpufreq.c         |  3 --
 drivers/cpufreq/pxa3xx-cpufreq.c         | 64 +++++++++++++-----------
Signature · 1 line
viresh
maintainer
#115 lore raw

Re: [PATCH 35/46] cpufreq: pxa3: move clk register access to clk driver

In reply to Arnd Bergmann

Quoting Arnd Bergmann (2019-10-18 08:41:50)

Quoted 30 lines

The driver needs some low-level register access for setting the core and bus frequencies. These registers are owned by the clk driver, so move the low-level access into that driver with a slightly higher-level interface and avoid any machine header file dependencies.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>
drivers/clk/pxa/clk-pxa3xx.c +1 -0
index 027b78183565..60a0db4f3790 100644
@@ -16,6 +16,7 @@
 #include <linux/of.h>
 #include <linux/soc/pxa/cpu.h>
 #include <mach/smemc.h>
+#include <linux/clk/pxa.h>
 #include <mach/pxa3xx-regs.h>
 
 #include <dt-bindings/clock/pxa-clock.h>
@@ -79,6 +80,21 @@ unsigned int pxa3xx_get_clk_frequency_khz(int info)
        return (unsigned int)clks[0] / KHz;
 }
 

drivers/clk/pxa/clk-pxa3xx.c unsigned int pxa3xx_get_clk_frequency_khz(int info) · line 92

Quoted 10 lines
drivers/clk/pxa/clk-pxa3xx.c +10 -0
+void pxa3xx_clk_update_accr(u32 disable, u32 enable, u32 xclkcfg, u32 mask)
+{
+       u32 accr = ACCR;
+
+       accr &= ~disable;
+       accr |= enable;
+
+       ACCR = accr;
+       if (xclkcfg)
+               __asm__("mcr p14, 0, %0, c6, c0, 0\n" : : "r"(xclkcfg));

It's just a coprocessor instruction though? I don't see what this has to do with clks that we model in the kernel? Why can't it just be put in the cpufreq driver that calls it?

drivers/clk/pxa/clk-pxa3xx.c unsigned int pxa3xx_get_clk_frequency_khz(int info) · line 100

Quoted 8 lines
drivers/clk/pxa/clk-pxa3xx.c +5 -0
+
+       while ((ACSR & mask) != (accr & mask))
+               cpu_relax();
+}
+
 static unsigned long clk_pxa3xx_ac97_get_rate(struct clk_hw *hw,
                                             unsigned long parent_rate)
 {

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#116 lore raw

Re: [PATCH 35/46] cpufreq: pxa3: move clk register access to clk driver

Quoted 15 lines · Stephen Boyd

Quoting Arnd Bergmann (2019-10-18 08:41:50)

drivers/clk/pxa/clk-pxa3xx.c unsigned int pxa3xx_get_clk_frequency_khz(int info) · line 92

Quoted 10 lines
drivers/clk/pxa/clk-pxa3xx.c +10 -0
+void pxa3xx_clk_update_accr(u32 disable, u32 enable, u32 xclkcfg, u32 mask)
+{
+       u32 accr = ACCR;
+
+       accr &= ~disable;
+       accr |= enable;
+
+       ACCR = accr;
+       if (xclkcfg)
+               __asm__("mcr p14, 0, %0, c6, c0, 0\n" : : "r"(xclkcfg));

It's just a coprocessor instruction though? I don't see what this has to do with clks that we model in the kernel? Why can't it just be put in the cpufreq driver that calls it?

I think you forget the "ACCR = accr", which is an MMIO register write. ACCR stands for "Application Subsystem Clock Configuration Register", so I think Arnd is right to put it in here.

As for the broader question you ask, about the cpufreq driver, the reason is unfortunately "historic" : pxa3xx cpufreq driver doesn't use the clock framework to set the bus clocks, but does it by directly accessing the registers : old platform, old ways, etc ...

Cheers.

Signature · 6 lines
Robert

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#117 lore raw

Re: [PATCH 35/46] cpufreq: pxa3: move clk register access to clk driver

Quoting Robert Jarzmik (2019-10-30 13:42:35)

Quoted 17 lines
Quoted 15 lines · Stephen Boyd

Quoting Arnd Bergmann (2019-10-18 08:41:50)

drivers/clk/pxa/clk-pxa3xx.c unsigned int pxa3xx_get_clk_frequency_khz(int info) · line 92

Quoted 10 lines
drivers/clk/pxa/clk-pxa3xx.c +10 -0
+void pxa3xx_clk_update_accr(u32 disable, u32 enable, u32 xclkcfg, u32 mask)
+{
+       u32 accr = ACCR;
+
+       accr &= ~disable;
+       accr |= enable;
+
+       ACCR = accr;
+       if (xclkcfg)
+               __asm__("mcr p14, 0, %0, c6, c0, 0\n" : : "r"(xclkcfg));

It's just a coprocessor instruction though? I don't see what this has to do with clks that we model in the kernel? Why can't it just be put in the cpufreq driver that calls it?

Quoted 9 lines

I think you forget the "ACCR = accr", which is an MMIO register write. ACCR stands for "Application Subsystem Clock Configuration Register", so I think Arnd is right to put it in here.

As for the broader question you ask, about the cpufreq driver, the reason is unfortunately "historic" : pxa3xx cpufreq driver doesn't use the clock framework to set the bus clocks, but does it by directly accessing the registers : old platform, old ways, etc ...

Ah ok. I missed the writel at the end of the function.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#118 lore raw

Re: [PATCH 35/46] cpufreq: pxa3: move clk register access to clk driver

In reply to Robert Jarzmik

Quoting Robert Jarzmik (2019-10-30 13:42:35)

Quoted 17 lines
Quoted 15 lines · Stephen Boyd

Quoting Arnd Bergmann (2019-10-18 08:41:50)

drivers/clk/pxa/clk-pxa3xx.c unsigned int pxa3xx_get_clk_frequency_khz(int info) · line 92

Quoted 10 lines
drivers/clk/pxa/clk-pxa3xx.c +10 -0
+void pxa3xx_clk_update_accr(u32 disable, u32 enable, u32 xclkcfg, u32 mask)
+{
+       u32 accr = ACCR;
+
+       accr &= ~disable;
+       accr |= enable;
+
+       ACCR = accr;
+       if (xclkcfg)
+               __asm__("mcr p14, 0, %0, c6, c0, 0\n" : : "r"(xclkcfg));

It's just a coprocessor instruction though? I don't see what this has to do with clks that we model in the kernel? Why can't it just be put in the cpufreq driver that calls it?

Quoted 9 lines

I think you forget the "ACCR = accr", which is an MMIO register write. ACCR stands for "Application Subsystem Clock Configuration Register", so I think Arnd is right to put it in here.

As for the broader question you ask, about the cpufreq driver, the reason is unfortunately "historic" : pxa3xx cpufreq driver doesn't use the clock framework to set the bus clocks, but does it by directly accessing the registers : old platform, old ways, etc ...

But there aren't any locks or anything, so presumably the cpufreq driver can poke into the register directly and not worry? It may be a "Clock Configuration Register" but if the clk framework isn't dealing with this register I don't quite understand the desire to put it into the clk driver besides it looks like something that goes near this subsystem.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#119 lore raw

PATCH 36/46 ARM: pxa: move smemc register access from clk to platform

In reply to Arnd Bergmann

The get_sdram_rows() and get_memclkdiv() helpers need smemc register that are separate from the clk registers, move them out of the clk driver, and use an extern declaration instead.

---
 arch/arm/mach-pxa/generic.c   | 30 ++++++++++++++++++++++++++++++
 arch/arm/mach-pxa/pxa3xx.c    |  4 ++++
 arch/arm/mach-pxa/smemc.c     |  9 +++++++++
 drivers/clk/pxa/clk-pxa.c     |  4 +++-
 drivers/clk/pxa/clk-pxa.h     |  5 +++--
 drivers/clk/pxa/clk-pxa25x.c  | 30 +++---------------------------
 drivers/clk/pxa/clk-pxa27x.c  | 31 +++----------------------------
 drivers/clk/pxa/clk-pxa3xx.c  |  8 +++-----
 include/linux/soc/pxa/smemc.h |  3 +++
 9 files changed, 61 insertions(+), 63 deletions(-)
arch/arm/mach-pxa/generic.c +30 -0
index 2c2c82fcf9cb..942af8946a73 100644
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/soc/pxa/cpu.h>
+#include <linux/soc/pxa/smemc.h>
 
 #include <asm/mach/map.h>
 #include <asm/mach-types.h>
@@ -84,6 +85,35 @@ void pxa_smemc_set_pcmcia_socket(int nr)
 }
 EXPORT_SYMBOL_GPL(pxa_smemc_set_pcmcia_socket);
 
+#define MDCNFG_DRAC2(mdcnfg)	(((mdcnfg) >> 21) & 0x3)
+#define MDCNFG_DRAC0(mdcnfg)	(((mdcnfg) >> 5) & 0x3)
+
+int pxa_smemc_get_sdram_rows(void)
+{
+	static int sdram_rows;
+	unsigned int drac2 = 0, drac0 = 0;
+	u32 mdcnfg;
+
+	if (sdram_rows)
+		return sdram_rows;
+
+	mdcnfg = readl_relaxed(MDCNFG);
+
+	if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
+		drac2 = MDCNFG_DRAC2(mdcnfg);
+
+	if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
+		drac0 = MDCNFG_DRAC0(mdcnfg);
+
+	sdram_rows = 1 << (11 + max(drac0, drac2));
+	return sdram_rows;
+}
+
+void __iomem *pxa_smemc_get_mdrefr(void)
+{
+	return MDREFR;
+}
+
 /*
  * Intel PXA2xx internal register mapping.
  *
arch/arm/mach-pxa/pxa3xx.c +4 -0
index f4657f4edb3b..d486efb79dcd 100644
@@ -52,6 +52,10 @@ extern void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int));
 #define NDCR_ND_ARB_EN		(1 << 12)
 #define NDCR_ND_ARB_CNTL	(1 << 19)
 
+#define CKEN_BOOT  		11      /* < Boot rom clock enable */
+#define CKEN_TPM   		19      /* < TPM clock enable */
+#define CKEN_HSIO2 		41      /* < HSIO2 clock enable */
+
 #ifdef CONFIG_PM
 
 #define ISRAM_START	0x5c000000
arch/arm/mach-pxa/smemc.c +9 -0
index 47b99549d616..da0eeafdb5a0 100644
@@ -69,4 +69,13 @@ static int __init smemc_init(void)
 	return 0;
 }
 subsys_initcall(smemc_init);
+
 #endif
+
+static const unsigned int df_clkdiv[4] = { 1, 2, 4, 1 };
+unsigned int pxa3xx_smemc_get_memclkdiv(void)
+{
+	unsigned long memclkcfg = __raw_readl(MEMCLKCFG);
+
+	return	df_clkdiv[(memclkcfg >> 16) & 0x3];
+}
drivers/clk/pxa/clk-pxa.c +3 -1
index cfc79f942b07..831180360069 100644
@@ -11,6 +11,7 @@
 #include <linux/clkdev.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/soc/pxa/smemc.h>
 
 #include <dt-bindings/clock/pxa-clock.h>
 #include "clk-pxa.h"
@@ -150,12 +151,13 @@ void pxa2xx_core_turbo_switch(bool on)
 }
 
 void pxa2xx_cpll_change(struct pxa2xx_freq *freq,
-			u32 (*mdrefr_dri)(unsigned int), void __iomem *mdrefr,
+			u32 (*mdrefr_dri)(unsigned int),
 			void __iomem *cccr)
 {
 	unsigned int clkcfg = freq->clkcfg;
 	unsigned int unused, preset_mdrefr, postset_mdrefr;
 	unsigned long flags;
+	void __iomem *mdrefr = pxa_smemc_get_mdrefr();
 
 	local_irq_save(flags);
 
drivers/clk/pxa/clk-pxa.h +3 -2
index f131d2834af4..d81fbec42004 100644
@@ -146,12 +146,13 @@ static inline int dummy_clk_set_parent(struct clk_hw *hw, u8 index)
 
 extern void clkdev_pxa_register(int ckid, const char *con_id,
 				const char *dev_id, struct clk *clk);
-extern int clk_pxa_cken_init(const struct desc_clk_cken *clks, int nb_clks);
+extern int clk_pxa_cken_init(const struct desc_clk_cken *clks,
+			     int nb_clks);
 void clk_pxa_dt_common_init(struct device_node *np);
 
 void pxa2xx_core_turbo_switch(bool on);
 void pxa2xx_cpll_change(struct pxa2xx_freq *freq,
-			u32 (*mdrefr_dri)(unsigned int), void __iomem *mdrefr,
+			u32 (*mdrefr_dri)(unsigned int),
 			void __iomem *cccr);
 int pxa2xx_determine_rate(struct clk_rate_request *req,
 			  struct pxa2xx_freq *freqs,  int nb_freqs);
drivers/clk/pxa/clk-pxa25x.c +3 -27
index d0f957996acb..65807f000c6a 100644
@@ -15,7 +15,7 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <mach/pxa2xx-regs.h>
-#include <mach/smemc.h>
+#include <linux/soc/pxa/smemc.h>
 
 #include <dt-bindings/clock/pxa-clock.h>
 #include "clk-pxa.h"
@@ -33,9 +33,6 @@ enum {
 	 ((T) ? CLKCFG_TURBO : 0))
 #define PXA25x_CCCR(N2, M, L) (N2 << 7 | M << 5 | L)
 
-#define MDCNFG_DRAC2(mdcnfg)	(((mdcnfg) >> 21) & 0x3)
-#define MDCNFG_DRAC0(mdcnfg)	(((mdcnfg) >> 5) & 0x3)
-
 /* Define the refresh period in mSec for the SDRAM and the number of rows */
 #define SDRAM_TREF	64	/* standard 64ms SDRAM */
 
@@ -57,30 +54,9 @@ static const char * const get_freq_khz[] = {
 	"core", "run", "cpll", "memory"
 };
 
-static int get_sdram_rows(void)
-{
-	static int sdram_rows;
-	unsigned int drac2 = 0, drac0 = 0;
-	u32 mdcnfg;
-
-	if (sdram_rows)
-		return sdram_rows;
-
-	mdcnfg = readl_relaxed(MDCNFG);
-
-	if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
-		drac2 = MDCNFG_DRAC2(mdcnfg);
-
-	if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
-		drac0 = MDCNFG_DRAC0(mdcnfg);
-
-	sdram_rows = 1 << (11 + max(drac0, drac2));
-	return sdram_rows;
-}
-
 static u32 mdrefr_dri(unsigned int freq_khz)
 {
-	u32 interval = freq_khz * SDRAM_TREF / get_sdram_rows();
+	u32 interval = freq_khz * SDRAM_TREF / pxa_smemc_get_sdram_rows();
 
 	return interval / 32;
 }
@@ -268,7 +244,7 @@ static int clk_pxa25x_cpll_set_rate(struct clk_hw *hw, unsigned long rate,
 	if (i >= ARRAY_SIZE(pxa25x_freqs))
 		return -EINVAL;
 
-	pxa2xx_cpll_change(&pxa25x_freqs[i], mdrefr_dri, MDREFR, CCCR);
+	pxa2xx_cpll_change(&pxa25x_freqs[i], mdrefr_dri, CCCR);
 
 	return 0;
 }
drivers/clk/pxa/clk-pxa27x.c +3 -28
index 287fdeae7c7c..eac67d425bee 100644
@@ -12,8 +12,7 @@
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/of.h>
-
-#include <mach/smemc.h>
+#include <linux/soc/pxa/smemc.h>
 
 #include <dt-bindings/clock/pxa-clock.h>
 #include "clk-pxa.h"
@@ -50,9 +49,6 @@ enum {
 	 ((T)  ? CLKCFG_TURBO : 0))
 #define PXA27x_CCCR(A, L, N2) (A << 25 | N2 << 7 | L)
 
-#define MDCNFG_DRAC2(mdcnfg)	(((mdcnfg) >> 21) & 0x3)
-#define MDCNFG_DRAC0(mdcnfg)	(((mdcnfg) >> 5) & 0x3)
-
 /* Define the refresh period in mSec for the SDRAM and the number of rows */
 #define SDRAM_TREF	64	/* standard 64ms SDRAM */
 
@@ -61,30 +57,9 @@ static const char * const get_freq_khz[] = {
 	"system_bus"
 };
 
-static int get_sdram_rows(void)
-{
-	static int sdram_rows;
-	unsigned int drac2 = 0, drac0 = 0;
-	u32 mdcnfg;
-
-	if (sdram_rows)
-		return sdram_rows;
-
-	mdcnfg = readl_relaxed(MDCNFG);
-
-	if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
-		drac2 = MDCNFG_DRAC2(mdcnfg);
-
-	if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
-		drac0 = MDCNFG_DRAC0(mdcnfg);
-
-	sdram_rows = 1 << (11 + max(drac0, drac2));
-	return sdram_rows;
-}
-
 static u32 mdrefr_dri(unsigned int freq_khz)
 {
-	u32 interval = freq_khz * SDRAM_TREF / get_sdram_rows();
+	u32 interval = freq_khz * SDRAM_TREF / pxa_smemc_get_sdram_rows();
 
 	return (interval - 31) / 32;
 }
@@ -260,7 +235,7 @@ static int clk_pxa27x_cpll_set_rate(struct clk_hw *hw, unsigned long rate,
 	if (i >= ARRAY_SIZE(pxa27x_freqs))
 		return -EINVAL;
 
-	pxa2xx_cpll_change(&pxa27x_freqs[i], mdrefr_dri, MDREFR, CCCR);
+	pxa2xx_cpll_change(&pxa27x_freqs[i], mdrefr_dri, CCCR);
 	return 0;
 }
 
drivers/clk/pxa/clk-pxa3xx.c +3 -5
index 60a0db4f3790..08594fc899e2 100644
@@ -15,7 +15,7 @@
 #include <linux/clkdev.h>
 #include <linux/of.h>
 #include <linux/soc/pxa/cpu.h>
-#include <mach/smemc.h>
+#include <linux/soc/pxa/smemc.h>
 #include <linux/clk/pxa.h>
 #include <mach/pxa3xx-regs.h>
 
@@ -41,8 +41,6 @@ static unsigned char hss_mult[4] = { 8, 12, 16, 24 };
 
 /* crystal frequency to static memory controller multiplier (SMCFS) */
 static unsigned int smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, };
-static unsigned int df_clkdiv[4] = { 1, 2, 4, 1 };
-
 static const char * const get_freq_khz[] = {
 	"core", "ring_osc_60mhz", "run", "cpll", "system_bus"
 };
@@ -118,10 +116,10 @@ static unsigned long clk_pxa3xx_smemc_get_rate(struct clk_hw *hw,
 					      unsigned long parent_rate)
 {
 	unsigned long acsr = ACSR;
-	unsigned long memclkcfg = __raw_readl(MEMCLKCFG);
 
 	return (parent_rate / 48)  * smcfs_mult[(acsr >> 23) & 0x7] /
-		df_clkdiv[(memclkcfg >> 16) & 0x3];
+		pxa3xx_smemc_get_memclkdiv();
+
 }
 PARENTS(clk_pxa3xx_smemc) = { "spll_624mhz" };
 RATE_RO_OPS(clk_pxa3xx_smemc, "smemc");
include/linux/soc/pxa/smemc.h +3 -0
index cbf1a2d8af29..9283e5642b19 100644
@@ -6,5 +6,8 @@
 
 void pxa_smemc_set_pcmcia_timing(int sock, u32 mcmem, u32 mcatt, u32 mcio);
 void pxa_smemc_set_pcmcia_socket(int nr);
+int pxa_smemc_get_sdram_rows(void);
+unsigned int pxa3xx_smemc_get_memclkdiv(void);
+void __iomem *pxa_smemc_get_mdrefr(void);
 
 #endif
Signature · 1 line
2.20.0
maintainer Acked-by on v1 36/46
#120 lore raw

Re: [PATCH 36/46] ARM: pxa: move smemc register access from clk to platform

Quoting Arnd Bergmann (2019-10-18 08:41:51)

Quoted 10 lines

The get_sdram_rows() and get_memclkdiv() helpers need smemc register that are separate from the clk registers, move them out of the clk driver, and use an extern declaration instead.

---

maintainer
#121 lore raw

Re: [PATCH 36/46] ARM: pxa: move smemc register access from clk to platform

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

The get_sdram_rows() and get_memclkdiv() helpers need smemc register that are separate from the clk registers, move them out of the clk driver, and use an extern declaration instead.

This patch bothers me a bit.

The idea behind generic.c is that it's a file common to all pxa2xx, pxa3xx platforms. Yet with this patch, someone without history will believe that calling pxa_smemc_get_sdram_rows() on a pxa3xx platform is perfectly valid, while it is not, because DRAC2 doesn't exist on pxa3xx (bits are not defined in MDCNFG).

At least I'll rename the function to pxa2xx_smemc_get_sdram_rows() if you don't have a better idea.

Cheers.

--
Robert

#122 lore raw

PATCH 37/46 ARM: pxa: move clk register definitions to driver

In reply to Arnd Bergmann

The clock register definitions are now used (almost) exclusively in the clk driver, and that relies on no other mach/*.h header files any more.

Remove the dependency on mach/pxa*-regs.h by addressing the registers as offsets from a void __iomem * pointer, which is either passed from a board file, or (for the moment) ioremapped at boot time from a hardcoded address in case of DT (this should be moved into the DT of course).

---
 arch/arm/mach-pxa/generic.c                  |   7 +-
 arch/arm/mach-pxa/generic.h                  |   3 -
 arch/arm/mach-pxa/include/mach/pxa2xx-regs.h |  45 -------
 arch/arm/mach-pxa/include/mach/pxa3xx-regs.h |  69 -----------
 arch/arm/mach-pxa/sleep.S                    |   4 +-
 drivers/clk/pxa/clk-pxa.c                    |   4 +-
 drivers/clk/pxa/clk-pxa.h                    |   6 +-
 drivers/clk/pxa/clk-pxa25x.c                 |  18 +--
 drivers/clk/pxa/clk-pxa27x.c                 |  39 +++---
 drivers/clk/pxa/clk-pxa3xx.c                 | 120 +++++++++++++++----
 include/linux/clk/pxa.h                      |   7 ++
 11 files changed, 152 insertions(+), 170 deletions(-)
arch/arm/mach-pxa/generic.c +4 -3
index 942af8946a73..dd1755c84665 100644
@@ -19,6 +19,7 @@
 #include <linux/init.h>
 #include <linux/soc/pxa/cpu.h>
 #include <linux/soc/pxa/smemc.h>
+#include <linux/clk/pxa.h>
 
 #include <asm/mach/map.h>
 #include <asm/mach-types.h>
@@ -48,11 +49,11 @@ void clear_reset_status(unsigned int mask)
 void __init pxa_timer_init(void)
 {
 	if (cpu_is_pxa25x())
-		pxa25x_clocks_init();
+		pxa25x_clocks_init(io_p2v(0x41300000));
 	if (cpu_is_pxa27x())
-		pxa27x_clocks_init();
+		pxa27x_clocks_init(io_p2v(0x41300000));
 	if (cpu_is_pxa3xx())
-		pxa3xx_clocks_init();
+		pxa3xx_clocks_init(io_p2v(0x41340000), io_p2v(0x41350000));
 	pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000));
 }
 
arch/arm/mach-pxa/generic.h +0 -3
index 487eadb0fc2a..7bb1499de4c5 100644
@@ -22,19 +22,16 @@ extern void pxa_timer_init(void);
 #define ARRAY_AND_SIZE(x)	(x), ARRAY_SIZE(x)
 
 #define pxa25x_handle_irq icip_handle_irq
-extern int __init pxa25x_clocks_init(void);
 extern void __init pxa25x_init_irq(void);
 extern void __init pxa25x_map_io(void);
 extern void __init pxa26x_init_irq(void);
 
 #define pxa27x_handle_irq ichp_handle_irq
-extern int __init pxa27x_clocks_init(void);
 extern unsigned	pxa27x_get_clk_frequency_khz(int);
 extern void __init pxa27x_init_irq(void);
 extern void __init pxa27x_map_io(void);
 
 #define pxa3xx_handle_irq ichp_handle_irq
-extern int __init pxa3xx_clocks_init(void);
 extern void __init pxa3xx_init_irq(void);
 extern void __init pxa3xx_map_io(void);
 
arch/arm/mach-pxa/include/mach/pxa2xx-regs.h +0 -45

51 lines not on this page · raw message

arch/arm/mach-pxa/include/mach/pxa3xx-regs.h +0 -69

73 lines not on this page · raw message

arch/arm/mach-pxa/sleep.S +3 -1
index 272efeb954f4..ab50fe2cf923 100644
@@ -18,7 +18,9 @@
 
 #define MDREFR_KDIV	0x200a4000	// all banks
 #define CCCR_SLEEP	0x00000107	// L=7 2N=2 A=0 PPDIS=0 CPDIS=0
-
+#define CCCR_N_MASK     0x00000380
+#define CCCR_M_MASK     0x00000060
+#define CCCR_L_MASK     0x0000001f
 		.text
 
 #ifdef CONFIG_PXA3xx
drivers/clk/pxa/clk-pxa.c +3 -1
index 831180360069..03de634efc52 100644
@@ -95,7 +95,8 @@ void __init clkdev_pxa_register(int ckid, const char *con_id,
 		clk_register_clkdev(clk, con_id, dev_id);
 }
 
-int __init clk_pxa_cken_init(const struct desc_clk_cken *clks, int nb_clks)
+int __init clk_pxa_cken_init(const struct desc_clk_cken *clks,
+			     int nb_clks, void __iomem *clk_regs)
 {
 	int i;
 	struct pxa_clk *pxa_clk;
@@ -107,6 +108,7 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks, int nb_clks)
 		pxa_clk->lp = clks[i].lp;
 		pxa_clk->hp = clks[i].hp;
 		pxa_clk->gate = clks[i].gate;
+		pxa_clk->gate.reg = clk_regs + clks[i].cken_reg;
 		pxa_clk->gate.lock = &pxa_clk_lock;
 		clk = clk_register_composite(NULL, clks[i].name,
 					     clks[i].parent_names, 2,
drivers/clk/pxa/clk-pxa.h +4 -2
index d81fbec42004..879c31ced385 100644
@@ -105,6 +105,7 @@
 struct desc_clk_cken {
 	struct clk_hw hw;
 	int ckid;
+	int cken_reg;
 	const char *name;
 	const char *dev_id;
 	const char *con_id;
@@ -119,11 +120,12 @@ struct desc_clk_cken {
 #define PXA_CKEN(_dev_id, _con_id, _name, parents, _mult_lp, _div_lp,	\
 		 _mult_hp, _div_hp, is_lp, _cken_reg, _cken_bit, flag)	\
 	{ .ckid = CLK_ ## _name, .name = #_name,			\
+	  .cken_reg = _cken_reg,					\
 	  .dev_id = _dev_id, .con_id = _con_id,	.parent_names = parents,\
 	  .lp = { .mult = _mult_lp, .div = _div_lp },			\
 	  .hp = { .mult = _mult_hp, .div = _div_hp },			\
 	  .is_in_low_power = is_lp,					\
-	  .gate = { .reg = (void __iomem *)_cken_reg, .bit_idx = _cken_bit }, \
+	  .gate = { .bit_idx = _cken_bit }, \
 	  .flags = flag,						\
 	}
 #define PXA_CKEN_1RATE(dev_id, con_id, name, parents, cken_reg,		\
@@ -147,7 +149,7 @@ static inline int dummy_clk_set_parent(struct clk_hw *hw, u8 index)
 extern void clkdev_pxa_register(int ckid, const char *con_id,
 				const char *dev_id, struct clk *clk);
 extern int clk_pxa_cken_init(const struct desc_clk_cken *clks,
-			     int nb_clks);
+			     int nb_clks, void __iomem *clk_regs);
 void clk_pxa_dt_common_init(struct device_node *np);
 
 void pxa2xx_core_turbo_switch(bool on);
drivers/clk/pxa/clk-pxa25x.c +10 -8
index 65807f000c6a..d311ecf8520d 100644
@@ -14,11 +14,11 @@
 #include <linux/clkdev.h>
 #include <linux/io.h>
 #include <linux/of.h>
-#include <mach/pxa2xx-regs.h>
 #include <linux/soc/pxa/smemc.h>
 
 #include <dt-bindings/clock/pxa-clock.h>
 #include "clk-pxa.h"
+#include "clk-pxa2xx.h"
 
 #define KHz 1000
 #define MHz (1000 * 1000)
@@ -39,6 +39,7 @@ enum {
 /*
  * Various clock factors driven by the CCCR register.
  */
+static void __iomem *clk_regs;
 
 /* Crystal Frequency to Memory Frequency Multiplier (L) */
 static unsigned char L_clk_mult[32] = { 0, 27, 32, 36, 40, 45, 0, };
@@ -97,7 +98,7 @@ unsigned int pxa25x_get_clk_frequency_khz(int info)
 static unsigned long clk_pxa25x_memory_get_rate(struct clk_hw *hw,
 						unsigned long parent_rate)
 {
-	unsigned long cccr = readl(CCCR);
+	unsigned long cccr = readl(clk_regs + CCCR);
 	unsigned int m = M_clk_mult[(cccr >> 5) & 0x03];
 
 	return parent_rate / m;
@@ -201,7 +202,7 @@ MUX_OPS(clk_pxa25x_core, "core", CLK_SET_RATE_PARENT);
 static unsigned long clk_pxa25x_run_get_rate(struct clk_hw *hw,
 					     unsigned long parent_rate)
 {
-	unsigned long cccr = readl(CCCR);
+	unsigned long cccr = readl(clk_regs + CCCR);
 	unsigned int n2 = N2_clk_mult[(cccr >> 7) & 0x07];
 
 	return (parent_rate / n2) * 2;
@@ -212,7 +213,7 @@ RATE_RO_OPS(clk_pxa25x_run, "run");
 static unsigned long clk_pxa25x_cpll_get_rate(struct clk_hw *hw,
 	unsigned long parent_rate)
 {
-	unsigned long clkcfg, cccr = readl(CCCR);
+	unsigned long clkcfg, cccr = readl(clk_regs + CCCR);
 	unsigned int l, m, n2, t;
 
 	asm("mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg));
@@ -244,7 +245,7 @@ static int clk_pxa25x_cpll_set_rate(struct clk_hw *hw, unsigned long rate,
 	if (i >= ARRAY_SIZE(pxa25x_freqs))
 		return -EINVAL;
 
-	pxa2xx_cpll_change(&pxa25x_freqs[i], mdrefr_dri, CCCR);
+	pxa2xx_cpll_change(&pxa25x_freqs[i], mdrefr_dri, clk_regs + CCCR);
 
 	return 0;
 }
@@ -321,16 +322,17 @@ static void __init pxa25x_dummy_clocks_init(void)
 	}
 }
 
-int __init pxa25x_clocks_init(void)
+int __init pxa25x_clocks_init(void __iomem *regs)
 {
+	clk_regs = regs;
 	pxa25x_base_clocks_init();
 	pxa25x_dummy_clocks_init();
-	return clk_pxa_cken_init(pxa25x_clocks, ARRAY_SIZE(pxa25x_clocks));
+	return clk_pxa_cken_init(pxa25x_clocks, ARRAY_SIZE(pxa25x_clocks), clk_regs);
 }
 
 static void __init pxa25x_dt_clocks_init(struct device_node *np)
 {
-	pxa25x_clocks_init();
+	pxa25x_clocks_init(ioremap(0x41300000ul, 0x10));
 	clk_pxa_dt_common_init(np);
 }
 CLK_OF_DECLARE(pxa25x_clks, "marvell,pxa250-core-clocks",
drivers/clk/pxa/clk-pxa27x.c +21 -18
index eac67d425bee..4517ee28e7c5 100644
@@ -7,7 +7,6 @@
  * Heavily inspired from former arch/arm/mach-pxa/clock.c.
  */
 #include <linux/clk-provider.h>
-#include <mach/pxa2xx-regs.h>
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/clkdev.h>
@@ -16,6 +15,7 @@
 
 #include <dt-bindings/clock/pxa-clock.h>
 #include "clk-pxa.h"
+#include "clk-pxa2xx.h"
 
 #define KHz 1000
 #define MHz (1000 * 1000)
@@ -52,6 +52,8 @@ enum {
 /* Define the refresh period in mSec for the SDRAM and the number of rows */
 #define SDRAM_TREF	64	/* standard 64ms SDRAM */
 
+static void __iomem *clk_regs;
+
 static const char * const get_freq_khz[] = {
 	"core", "run", "cpll", "memory",
 	"system_bus"
@@ -99,7 +101,7 @@ unsigned int pxa27x_get_clk_frequency_khz(int info)
 
 bool pxa27x_is_ppll_disabled(void)
 {
-	unsigned long ccsr = readl(CCSR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
 
 	return ccsr & (1 << CCCR_PPDIS_BIT);
 }
@@ -201,7 +203,7 @@ static unsigned long clk_pxa27x_cpll_get_rate(struct clk_hw *hw,
 	unsigned long clkcfg;
 	unsigned int t, ht;
 	unsigned int l, L, n2, N;
-	unsigned long ccsr = readl(CCSR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
 
 	asm("mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg));
 	t  = clkcfg & (1 << 0);
@@ -235,7 +237,7 @@ static int clk_pxa27x_cpll_set_rate(struct clk_hw *hw, unsigned long rate,
 	if (i >= ARRAY_SIZE(pxa27x_freqs))
 		return -EINVAL;
 
-	pxa2xx_cpll_change(&pxa27x_freqs[i], mdrefr_dri, CCCR);
+	pxa2xx_cpll_change(&pxa27x_freqs[i], mdrefr_dri, clk_regs + CCCR);
 	return 0;
 }
 
@@ -246,8 +248,8 @@ static unsigned long clk_pxa27x_lcd_base_get_rate(struct clk_hw *hw,
 						  unsigned long parent_rate)
 {
 	unsigned int l, osc_forced;
-	unsigned long ccsr = readl(CCSR);
-	unsigned long cccr = readl(CCCR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
+	unsigned long cccr = readl(clk_regs + CCCR);
 
 	l  = ccsr & CCSR_L_MASK;
 	osc_forced = ccsr & (1 << CCCR_CPDIS_BIT);
@@ -268,7 +270,7 @@ static unsigned long clk_pxa27x_lcd_base_get_rate(struct clk_hw *hw,
 static u8 clk_pxa27x_lcd_base_get_parent(struct clk_hw *hw)
 {
 	unsigned int osc_forced;
-	unsigned long ccsr = readl(CCSR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
 
 	osc_forced = ccsr & (1 << CCCR_CPDIS_BIT);
 	if (osc_forced)
@@ -297,7 +299,7 @@ static u8 clk_pxa27x_core_get_parent(struct clk_hw *hw)
 {
 	unsigned long clkcfg;
 	unsigned int t, ht, osc_forced;
-	unsigned long ccsr = readl(CCSR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
 
 	osc_forced = ccsr & (1 << CCCR_CPDIS_BIT);
 	if (osc_forced)
@@ -334,7 +336,7 @@ MUX_OPS(clk_pxa27x_core, "core", CLK_SET_RATE_PARENT);
 static unsigned long clk_pxa27x_run_get_rate(struct clk_hw *hw,
 					     unsigned long parent_rate)
 {
-	unsigned long ccsr = readl(CCSR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
 	unsigned int n2 = (ccsr & CCSR_N2_MASK) >> CCSR_N2_SHIFT;
 
 	return (parent_rate / n2) * 2;
@@ -357,7 +359,7 @@ static unsigned long clk_pxa27x_system_bus_get_rate(struct clk_hw *hw,
 {
 	unsigned long clkcfg;
 	unsigned int b, osc_forced;
-	unsigned long ccsr = readl(CCSR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
 
 	osc_forced = ccsr & (1 << CCCR_CPDIS_BIT);
 	asm("mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg));
@@ -374,7 +376,7 @@ static unsigned long clk_pxa27x_system_bus_get_rate(struct clk_hw *hw,
 static u8 clk_pxa27x_system_bus_get_parent(struct clk_hw *hw)
 {
 	unsigned int osc_forced;
-	unsigned long ccsr = readl(CCSR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
 
 	osc_forced = ccsr & (1 << CCCR_CPDIS_BIT);
 	if (osc_forced)
@@ -390,8 +392,8 @@ static unsigned long clk_pxa27x_memory_get_rate(struct clk_hw *hw,
 						unsigned long parent_rate)
 {
 	unsigned int a, l, osc_forced;
-	unsigned long cccr = readl(CCCR);
-	unsigned long ccsr = readl(CCSR);
+	unsigned long cccr = readl(clk_regs + CCCR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
 
 	osc_forced = ccsr & (1 << CCCR_CPDIS_BIT);
 	a = cccr & (1 << CCCR_A_BIT);
@@ -409,8 +411,8 @@ static unsigned long clk_pxa27x_memory_get_rate(struct clk_hw *hw,
 static u8 clk_pxa27x_memory_get_parent(struct clk_hw *hw)
 {
 	unsigned int osc_forced, a;
-	unsigned long cccr = readl(CCCR);
-	unsigned long ccsr = readl(CCSR);
+	unsigned long cccr = readl(clk_regs + CCCR);
+	unsigned long ccsr = readl(clk_regs + CCSR);
 
 	osc_forced = ccsr & (1 << CCCR_CPDIS_BIT);
 	a = cccr & (1 << CCCR_A_BIT);
@@ -464,16 +466,17 @@ static void __init pxa27x_base_clocks_init(void)
 	clk_register_clk_pxa27x_lcd_base();
 }
 
-int __init pxa27x_clocks_init(void)
+int __init pxa27x_clocks_init(void __iomem *regs)
 {
+	clk_regs = regs;
 	pxa27x_base_clocks_init();
 	pxa27x_dummy_clocks_init();
-	return clk_pxa_cken_init(pxa27x_clocks, ARRAY_SIZE(pxa27x_clocks));
+	return clk_pxa_cken_init(pxa27x_clocks, ARRAY_SIZE(pxa27x_clocks), regs);
 }
 
 static void __init pxa27x_dt_clocks_init(struct device_node *np)
 {
-	pxa27x_clocks_init();
+	pxa27x_clocks_init(ioremap(0x41300000ul, 0x10));
 	clk_pxa_dt_common_init(np);
 }
 CLK_OF_DECLARE(pxa_clks, "marvell,pxa270-clocks", pxa27x_dt_clocks_init);
drivers/clk/pxa/clk-pxa3xx.c +100 -20

225 lines not on this page · raw message

include/linux/clk/pxa.h +7 -0
index e5516c608c99..736b8bb91bd7 100644
@@ -1,5 +1,12 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+extern int pxa25x_clocks_init(void __iomem *regs);
+extern int pxa27x_clocks_init(void __iomem *regs);
+extern int pxa3xx_clocks_init(void __iomem *regs, void __iomem *oscc_reg);
+
 #ifdef CONFIG_PXA3xx
 extern unsigned	pxa3xx_get_clk_frequency_khz(int);
 extern void pxa3xx_clk_update_accr(u32 disable, u32 enable, u32 xclkcfg, u32 mask);
Signature · 1 line
2.20.0
maintainer Acked-by on v1 37/46
#123 lore raw

Re: [PATCH 37/46] ARM: pxa: move clk register definitions to driver

Quoting Arnd Bergmann (2019-10-18 08:41:52)

Quoted 8 lines

The clock register definitions are now used (almost) exclusively in the clk driver, and that relies on no other mach/*.h header files any more.

Remove the dependency on mach/pxa*-regs.h by addressing the registers as offsets from a void __iomem * pointer, which is either passed from a board file, or (for the moment) ioremapped at boot time from a hardcoded address in case of DT (this should be moved into the DT of course).

Quoted 5 lines

---

maintainer Acked-by
#124 lore raw

Re: [PATCH 37/46] ARM: pxa: move clk register definitions to driver

Quoted 9 lines · Stephen Boyd

Quoting Arnd Bergmann (2019-10-18 08:41:52)

Quoted 8 lines

The clock register definitions are now used (almost) exclusively in the clk driver, and that relies on no other mach/*.h header files any more.

Remove the dependency on mach/pxa*-regs.h by addressing the registers as offsets from a void __iomem * pointer, which is either passed from a board file, or (for the moment) ioremapped at boot time from a hardcoded address in case of DT (this should be moved into the DT of course).

Quoted 7 lines
Quoted 5 lines

---

Cheers.

--
Robert

#125 lore raw

PATCH 38/46 video: backlight: tosa: use gpio lookup table

In reply to Arnd Bergmann

The driver should not require a machine specific header. Change it to pass the gpio line through a lookup table, and move the timing generator definitions into the drivers itself.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>

---
I'm not overly confident that I got the correct device names for the lookup table, it would be good if someone could double-check.

---
 arch/arm/mach-pxa/include/mach/tosa.h | 15 --------------
 arch/arm/mach-pxa/tosa.c              | 22 +++++++++++++++++++++
 drivers/video/backlight/tosa_bl.c     | 10 +++++-----
 drivers/video/backlight/tosa_bl.h     |  8 ++++++++
 drivers/video/backlight/tosa_lcd.c    | 28 ++++++++++++++++++++-------
 5 files changed, 56 insertions(+), 27 deletions(-)
 create mode 100644 drivers/video/backlight/tosa_bl.h
arch/arm/mach-pxa/include/mach/tosa.h +0 -15
index a499ed17931e..8bfaca3a8b64 100644
@@ -72,18 +72,6 @@
 #define TOSA_GPIO_BAT0_TH_ON		(TOSA_TC6393XB_GPIO_BASE + 14)
 #define TOSA_GPIO_BAT1_TH_ON		(TOSA_TC6393XB_GPIO_BASE + 15)
 
-/*
- * Timing Generator
- */
-#define TG_PNLCTL 			0x00
-#define TG_TPOSCTL 			0x01
-#define TG_DUTYCTL 			0x02
-#define TG_GPOSR 			0x03
-#define TG_GPODR1 			0x04
-#define TG_GPODR2 			0x05
-#define TG_PINICTL 			0x06
-#define TG_HPOSCTL 			0x07
-
 /*
  * PXA GPIOs
  */
@@ -192,7 +180,4 @@
 #define TOSA_KEY_MAIL		KEY_MAIL
 #endif
 
-struct spi_device;
-extern int tosa_bl_enable(struct spi_device *spi, int enable);
-
 #endif /* _ASM_ARCH_TOSA_H_ */
arch/arm/mach-pxa/tosa.c +22 -0
index 9a7f1e42adac..8329a2969b2b 100644
@@ -813,6 +813,26 @@ static struct pxa2xx_spi_controller pxa_ssp_master_info = {
 	.num_chipselect	= 1,
 };
 
+static struct gpiod_lookup_table tosa_lcd_gpio_table = {
+	.dev_id = "spi2.0",
+	.table = {
+		GPIO_LOOKUP("tc6393xb",
+			    TOSA_GPIO_TG_ON - TOSA_TC6393XB_GPIO_BASE,
+			    "tg #pwr", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
+static struct gpiod_lookup_table tosa_lcd_bl_gpio_table = {
+	.dev_id = "i2c-tosa-bl",
+	.table = {
+		GPIO_LOOKUP("tc6393xb",
+			    TOSA_GPIO_BL_C20MA - TOSA_TC6393XB_GPIO_BASE,
+			    "backlight", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 static struct spi_board_info spi_board_info[] __initdata = {
 	{
 		.modalias	= "tosa-lcd",
@@ -935,6 +955,8 @@ static void __init tosa_init(void)
 	platform_scoop_config = &tosa_pcmcia_config;
 
 	pxa2xx_set_spi_info(2, &pxa_ssp_master_info);
+	gpiod_add_lookup_table(&tosa_lcd_gpio_table);
+	gpiod_add_lookup_table(&tosa_lcd_bl_gpio_table);
 	spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 
 	clk_add_alias("CLK_CK3P6MI", tc6393xb_device.name, "GPIO11_CLK", NULL);
drivers/video/backlight/tosa_bl.c +5 -5
index 1275e815bd86..cff5e96fd988 100644
@@ -18,7 +18,7 @@
 
 #include <asm/mach/sharpsl_param.h>
 
-#include <mach/tosa.h>
+#include "tosa_bl.h"
 
 #define COMADJ_DEFAULT	97
 
@@ -28,6 +28,7 @@
 struct tosa_bl_data {
 	struct i2c_client *i2c;
 	struct backlight_device *bl;
+	struct gpio_desc *gpio;
 
 	int comadj;
 };
@@ -42,7 +43,7 @@ static void tosa_bl_set_backlight(struct tosa_bl_data *data, int brightness)
 	i2c_smbus_write_byte_data(data->i2c, DAC_CH2, (u8)(brightness & 0xff));
 
 	/* SetBacklightVR */
-	gpio_set_value(TOSA_GPIO_BL_C20MA, brightness & 0x100);
+	gpiod_set_value(data->gpio, brightness & 0x100);
 
 	tosa_bl_enable(spi, brightness);
 }
@@ -87,9 +88,8 @@ static int tosa_bl_probe(struct i2c_client *client,
 		return -ENOMEM;
 
 	data->comadj = sharpsl_param.comadj == -1 ? COMADJ_DEFAULT : sharpsl_param.comadj;
-
-	ret = devm_gpio_request_one(&client->dev, TOSA_GPIO_BL_C20MA,
-				GPIOF_OUT_INIT_LOW, "backlight");
+	data->gpio = devm_gpiod_get(&client->dev, "backlight", GPIOD_OUT_LOW);
+	ret = PTR_ERR_OR_ZERO(data->gpio);
 	if (ret) {
 		dev_dbg(&data->bl->dev, "Unable to request gpio!\n");
 		return ret;
drivers/video/backlight/tosa_bl.h new file +8 -0
new file mode 100644
index 000000000000..589e17e6fdb2
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _TOSA_BL_H
+#define _TOSA_BL_H
+
+struct spi_device;
+extern int tosa_bl_enable(struct spi_device *spi, int enable);
+
+#endif
drivers/video/backlight/tosa_lcd.c +21 -7
index 29af8e27b6e5..e8ab583e5098 100644
@@ -19,7 +19,7 @@
 
 #include <asm/mach/sharpsl_param.h>
 
-#include <mach/tosa.h>
+#include "tosa_bl.h"
 
 #define POWER_IS_ON(pwr)	((pwr) <= FB_BLANK_NORMAL)
 
@@ -28,12 +28,26 @@
 #define TG_REG0_UD	0x0004
 #define TG_REG0_LR	0x0008
 
+/*
+ * Timing Generator
+ */
+#define TG_PNLCTL 	0x00
+#define TG_TPOSCTL 	0x01
+#define TG_DUTYCTL 	0x02
+#define TG_GPOSR 	0x03
+#define TG_GPODR1 	0x04
+#define TG_GPODR2 	0x05
+#define TG_PINICTL 	0x06
+#define TG_HPOSCTL 	0x07
+
+
 #define	DAC_BASE	0x4e
 
 struct tosa_lcd_data {
 	struct spi_device *spi;
 	struct lcd_device *lcd;
 	struct i2c_client *i2c;
+	struct gpio_desc *gpiod_tg;
 
 	int lcd_power;
 	bool is_vga;
@@ -66,7 +80,7 @@ EXPORT_SYMBOL(tosa_bl_enable);
 static void tosa_lcd_tg_init(struct tosa_lcd_data *data)
 {
 	/* TG on */
-	gpio_set_value(TOSA_GPIO_TG_ON, 0);
+	gpiod_set_value(data->gpiod_tg, 0);
 
 	mdelay(60);
 
@@ -100,6 +114,7 @@ static void tosa_lcd_tg_on(struct tosa_lcd_data *data)
 		 */
 		struct i2c_adapter *adap = i2c_get_adapter(0);
 		struct i2c_board_info info = {
+			.dev_name = "tosa-bl",
 			.type	= "tosa-bl",
 			.addr	= DAC_BASE,
 			.platform_data = data->spi,
@@ -121,7 +136,7 @@ static void tosa_lcd_tg_off(struct tosa_lcd_data *data)
 	mdelay(50);
 
 	/* TG Off */
-	gpio_set_value(TOSA_GPIO_TG_ON, 1);
+	gpiod_set_value(data->gpiod_tg, 1);
 	mdelay(100);
 }
 
@@ -191,10 +206,9 @@ static int tosa_lcd_probe(struct spi_device *spi)
 	data->spi = spi;
 	spi_set_drvdata(spi, data);
 
-	ret = devm_gpio_request_one(&spi->dev, TOSA_GPIO_TG_ON,
-				GPIOF_OUT_INIT_LOW, "tg #pwr");
-	if (ret < 0)
-		return ret;
+	data->gpiod_tg = devm_gpiod_get(&spi->dev, "tg #pwr", GPIOD_OUT_LOW);
+	if (IS_ERR(data->gpiod_tg))
+		return PTR_ERR(data->gpiod_tg);
 
 	mdelay(60);
 
Signature · 1 line
2.20.0
maintainer Acked-by on v1 38/46
#126 lore raw

Re: [PATCH 38/46] video: backlight: tosa: use gpio lookup table

Quoted 12 lines · Arnd Bergmann

The driver should not require a machine specific header. Change it to pass the gpio line through a lookup table, and move the timing generator definitions into the drivers itself.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>
Quoted 4 lines

---
I'm not overly confident that I got the correct device names for the lookup table, it would be good if someone could double-check.

Ah the I2C and SPI devices querrying GPIOs ... unless someone does an actual test, this will probably be very regression prone ...

Anyway :

Cheers.

--
Robert

Reviewed-by on v1 38/46
#127 lore raw

Re: [PATCH 38/46] video: backlight: tosa: use gpio lookup table

In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

The driver should not require a machine specific header. Change it to pass the gpio line through a lookup table, and move the timing generator definitions into the drivers itself.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>
Quoted 4 lines

---
I'm not overly confident that I got the correct device names for the lookup table, it would be good if someone could double-check.

You're anyway doing more than required for the people who may or may not be using this platform. Brokenness can surely be fixed later, it's not like we are taking down the entire Amazon cloud or something.

Yours,
Linus Walleij

Reviewed-by
#128 lore raw

Re: [PATCH 38/46] video: backlight: tosa: use gpio lookup table

Quoted 19 lines · Linus Walleij
Quoted 12 lines · Arnd Bergmann

The driver should not require a machine specific header. Change it to pass the gpio line through a lookup table, and move the timing generator definitions into the drivers itself.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>
Quoted 4 lines

---
I'm not overly confident that I got the correct device names for the lookup table, it would be good if someone could double-check.

Quoted 6 lines

You're anyway doing more than required for the people who may or may not be using this platform. Brokenness can surely be fixed later, it's not like we are taking down the entire Amazon cloud or something.

Same here. I read, I did't see anything wrong but I can't test.

Daniel.

Applied
#129 lore raw

Re: [PATCH 38/46] video: backlight: tosa: use gpio lookup table

In reply to Arnd Bergmann
Quoted 16 lines · Arnd Bergmann

The driver should not require a machine specific header. Change it to pass the gpio line through a lookup table, and move the timing generator definitions into the drivers itself.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>

---
I'm not overly confident that I got the correct device names for the lookup table, it would be good if someone could double-check.

Quoted 8 lines
---
 arch/arm/mach-pxa/include/mach/tosa.h | 15 --------------
 arch/arm/mach-pxa/tosa.c              | 22 +++++++++++++++++++++
 drivers/video/backlight/tosa_bl.c     | 10 +++++-----
 drivers/video/backlight/tosa_bl.h     |  8 ++++++++
 drivers/video/backlight/tosa_lcd.c    | 28 ++++++++++++++++++++-------
 5 files changed, 56 insertions(+), 27 deletions(-)
 create mode 100644 drivers/video/backlight/tosa_bl.h

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#130 lore raw

PATCH 39/46 power: tosa: simplify probe function

In reply to Arnd Bergmann

We have three power supplies that need similar initialization. As a preparation for the gpio lookup table conversion, split out the initialization into a separate function.

---
 drivers/power/supply/tosa_battery.c | 50 ++++++++++++++---------------
 1 file changed, 24 insertions(+), 26 deletions(-)
drivers/power/supply/tosa_battery.c +24 -26
index 32cc31cd4761..b26b0eca33e1 100644
@@ -343,12 +343,24 @@ static int tosa_bat_resume(struct platform_device *dev)
 #define tosa_bat_resume NULL
 #endif
 
+static int tosa_power_supply_register(struct device *dev,
+			struct tosa_bat *bat,
+			const struct power_supply_desc *desc)
+{
+	struct power_supply_config cfg = {
+		.drv_data = bat,
+	};
+
+	mutex_init(&bat->work_lock);
+	bat->psy = power_supply_register(dev, desc, &cfg);
+
+	return PTR_ERR_OR_ZERO(bat->psy);
+}
+
+
 static int tosa_bat_probe(struct platform_device *dev)
 {
 	int ret;
-	struct power_supply_config main_psy_cfg = {},
-				   jacket_psy_cfg = {},
-				   bu_psy_cfg = {};
 
 	if (!machine_is_tosa())
 		return -ENODEV;
@@ -357,36 +369,22 @@ static int tosa_bat_probe(struct platform_device *dev)
 	if (ret)
 		return ret;
 
-	mutex_init(&tosa_bat_main.work_lock);
-	mutex_init(&tosa_bat_jacket.work_lock);
-
 	INIT_WORK(&bat_work, tosa_bat_work);
 
-	main_psy_cfg.drv_data = &tosa_bat_main;
-	tosa_bat_main.psy = power_supply_register(&dev->dev,
-						  &tosa_bat_main_desc,
-						  &main_psy_cfg);
-	if (IS_ERR(tosa_bat_main.psy)) {
-		ret = PTR_ERR(tosa_bat_main.psy);
+	ret = tosa_power_supply_register(&dev->dev, &tosa_bat_main,
+					 &tosa_bat_main_desc);
+	if (ret)
 		goto err_psy_reg_main;
-	}
 
-	jacket_psy_cfg.drv_data = &tosa_bat_jacket;
-	tosa_bat_jacket.psy = power_supply_register(&dev->dev,
-						    &tosa_bat_jacket_desc,
-						    &jacket_psy_cfg);
-	if (IS_ERR(tosa_bat_jacket.psy)) {
-		ret = PTR_ERR(tosa_bat_jacket.psy);
+	ret = tosa_power_supply_register(&dev->dev, &tosa_bat_jacket,
+					 &tosa_bat_jacket_desc);
+	if (ret)
 		goto err_psy_reg_jacket;
-	}
 
-	bu_psy_cfg.drv_data = &tosa_bat_bu;
-	tosa_bat_bu.psy = power_supply_register(&dev->dev, &tosa_bat_bu_desc,
-						&bu_psy_cfg);
-	if (IS_ERR(tosa_bat_bu.psy)) {
-		ret = PTR_ERR(tosa_bat_bu.psy);
+	ret = tosa_power_supply_register(&dev->dev, &tosa_bat_bu,
+					 &tosa_bat_bu_desc);
+	if (ret)
 		goto err_psy_reg_bu;
-	}
 
 	ret = request_irq(gpio_to_irq(TOSA_GPIO_BAT0_CRG),
 				tosa_bat_gpio_isr,
Signature · 1 line
2.20.0
maintainer Reviewed-by Acked-by on v1 39/46
#131 lore raw

Re: [PATCH 39/46] power: tosa: simplify probe function

Hi Arnd,

Quoted 8 lines · Arnd Bergmann

We have three power supplies that need similar initialization. As a preparation for the gpio lookup table conversion, split out the initialization into a separate function.

---

Assuming, that the whole series goes through ARM:

If the series doesn't make it into 5.5, I can also apply this cleanup patch.

-- Sebastian

Quoted 84 lines
 drivers/power/supply/tosa_battery.c | 50 ++++++++++++++---------------
 1 file changed, 24 insertions(+), 26 deletions(-)
drivers/power/supply/tosa_battery.c +24 -26
index 32cc31cd4761..b26b0eca33e1 100644
@@ -343,12 +343,24 @@ static int tosa_bat_resume(struct platform_device *dev)
 #define tosa_bat_resume NULL
 #endif
 
+static int tosa_power_supply_register(struct device *dev,
+			struct tosa_bat *bat,
+			const struct power_supply_desc *desc)
+{
+	struct power_supply_config cfg = {
+		.drv_data = bat,
+	};
+
+	mutex_init(&bat->work_lock);
+	bat->psy = power_supply_register(dev, desc, &cfg);
+
+	return PTR_ERR_OR_ZERO(bat->psy);
+}
+
+
 static int tosa_bat_probe(struct platform_device *dev)
 {
 	int ret;
-	struct power_supply_config main_psy_cfg = {},
-				   jacket_psy_cfg = {},
-				   bu_psy_cfg = {};
 
 	if (!machine_is_tosa())
 		return -ENODEV;
@@ -357,36 +369,22 @@ static int tosa_bat_probe(struct platform_device *dev)
 	if (ret)
 		return ret;
 
-	mutex_init(&tosa_bat_main.work_lock);
-	mutex_init(&tosa_bat_jacket.work_lock);
-
 	INIT_WORK(&bat_work, tosa_bat_work);
 
-	main_psy_cfg.drv_data = &tosa_bat_main;
-	tosa_bat_main.psy = power_supply_register(&dev->dev,
-						  &tosa_bat_main_desc,
-						  &main_psy_cfg);
-	if (IS_ERR(tosa_bat_main.psy)) {
-		ret = PTR_ERR(tosa_bat_main.psy);
+	ret = tosa_power_supply_register(&dev->dev, &tosa_bat_main,
+					 &tosa_bat_main_desc);
+	if (ret)
 		goto err_psy_reg_main;
-	}
 
-	jacket_psy_cfg.drv_data = &tosa_bat_jacket;
-	tosa_bat_jacket.psy = power_supply_register(&dev->dev,
-						    &tosa_bat_jacket_desc,
-						    &jacket_psy_cfg);
-	if (IS_ERR(tosa_bat_jacket.psy)) {
-		ret = PTR_ERR(tosa_bat_jacket.psy);
+	ret = tosa_power_supply_register(&dev->dev, &tosa_bat_jacket,
+					 &tosa_bat_jacket_desc);
+	if (ret)
 		goto err_psy_reg_jacket;
-	}
 
-	bu_psy_cfg.drv_data = &tosa_bat_bu;
-	tosa_bat_bu.psy = power_supply_register(&dev->dev, &tosa_bat_bu_desc,
-						&bu_psy_cfg);
-	if (IS_ERR(tosa_bat_bu.psy)) {
-		ret = PTR_ERR(tosa_bat_bu.psy);
+	ret = tosa_power_supply_register(&dev->dev, &tosa_bat_bu,
+					 &tosa_bat_bu_desc);
+	if (ret)
 		goto err_psy_reg_bu;
-	}
 
 	ret = request_irq(gpio_to_irq(TOSA_GPIO_BAT0_CRG),
 				tosa_bat_gpio_isr,
Signature · 1 line
2.20.0
maintainer Acked-by
#132 lore raw

Re: [PATCH 39/46] power: tosa: simplify probe function

Quoted 14 lines · Sebastian Reichel

Hi Arnd,

Quoted 8 lines · Arnd Bergmann

We have three power supplies that need similar initialization. As a preparation for the gpio lookup table conversion, split out the initialization into a separate function.

---

Assuming, that the whole series goes through ARM:

Quoted 7 lines

If the series doesn't make it into 5.5, I can also apply this cleanup patch.

-- Sebastian

Cheers.

--
Robert

maintainer Acked-by
#133 lore raw

Re: [PATCH 39/46] power: tosa: simplify probe function

In reply to Sebastian Reichel
Quoted 14 lines · Sebastian Reichel

Hi Arnd,

Quoted 8 lines · Arnd Bergmann

We have three power supplies that need similar initialization. As a preparation for the gpio lookup table conversion, split out the initialization into a separate function.

---

Assuming, that the whole series goes through ARM:

Quoted 7 lines

If the series doesn't make it into 5.5, I can also apply this cleanup patch.

-- Sebastian

Cheers.

--
Robert