ARM: ep93xx: various updates
Subsystems (4)
v2 cover ARM: ep93xx: various updates
Hi all,
This is a rebase of Hartley's original submission:
https://www.spinics.net/lists/arm-kernel/msg564135.html
rebased against v4.13-rc1, I have been using these patches on a TS-7300 board with 32MB of RAM and everything works fine here as well.
Here is what Hartley wrote in v1:
Here are a couple mach-ep93xx patches that I have been holding on to. Some of these have been previously posted.
The first patch is needed for 128 MiB version of the TS-7300 board. That board uses multiple chip selects for the SDRAM and does not boot with the previous flatmem setup. With the switch, all the other ep93xx boards I have still work properly.
The second patch has been rebased due to the chip select change in the spi-ep93xx driver which has been merged.
Patch 3 is just a cosmetic change.
Patch 4 was originally from Florian Fainelli's github ts72xx branch. It has been updated to the new spi-ep93xx chip select method.
H Hartley Sweeten (4):
ARM: ep93xx: switch to SPARSEMEM
ARM: ep93xx: simone: let the mmc_spi driver handle the card detect
ARM: ep93xx: tidy up TS-72xx Watchdog resources
ARM: ep93xx: Add lm70 HWMON sensor to TS-72xx boards
arch/arm/Kconfig | 2 +- arch/arm/mach-ep93xx/simone.c | 54 +++---------------------------------------- arch/arm/mach-ep93xx/ts72xx.c | 46 +++++++++++++++++++++++++++--------- arch/arm/mach-ep93xx/ts72xx.h | 3 --- 4 files changed, 39 insertions(+), 66 deletions(-)
Signature · 1 line
2.11.0
PATCH v2 1/4 ARM: ep93xx: switch to SPARSEMEM
From: H Hartley Sweeten <[email protected]>
The EP93xx has four chip selects that can be used for the SDRAM memory. These chip selects are decoded to specify an address domain:
SDCS3 0x00000000-0x0fffffff with Boot Option ASDO=1 SDCS0 0xc0000000-0xcfffffff SDCS1 0xd0000000-0xdfffffff SDCS2 0xe0000000-x0efffffff SDCS3 0xf0000000-0xffffffff with Boot Option ASDO=0
Because of the row/column/bank architecture of SDRAM, the mapping of these memories into the processor's memory space is discontiguous.
Most ep93xx systems only use one of the chip selects. For these systems, ARCH_HAS_HOLES_MEMORYMODEL has worked fine to handle the discontiguous memory.
But, some of the TS-72xx boards use multiple chip selects. The TS-7300 in particular uses SDCS3 (with ASDO=1) and SDCS2. On that system with ARCH_HAS_HOLES_MEMORYMODEL the SDCS2 memory does not get handled correctly and results in the system not booting.
Change the EP93xx to ARCH_SPARSEMEM_ENABLE. This handles the discontiguous memory for all configurations.
This has been tested on the following ep93xx platforms:
EDB9307A with 64 MiB on SDCS0
Vision EP9307 with 64 MiB on SDCS0
TS-7300 with 64 MiB on SDCS3 (with ASDO=1) and 64 MiB on SDCS2 sim.one with 64 MiB on SDCS0
--- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
@@ -378,7 +378,7 @@ config ARCH_EBSA110 config ARCH_EP93XX bool "EP93xx-based" - select ARCH_HAS_HOLES_MEMORYMODEL + select ARCH_SPARSEMEM_ENABLE select ARM_AMBA select ARM_PATCH_PHYS_VIRT select ARM_VIC
Signature · 1 line
2.11.0
Alexander Sverdlin
maintainerPATCH v2 1/4 ARM: ep93xx: switch to SPARSEMEM
Hello!
Quoted 28 lines · Florian Fainelli
From: H Hartley Sweeten <[email protected]>
The EP93xx has four chip selects that can be used for the SDRAM memory. These chip selects are decoded to specify an address domain:
SDCS3 0x00000000-0x0fffffff with Boot Option ASDO=1 SDCS0 0xc0000000-0xcfffffff SDCS1 0xd0000000-0xdfffffff SDCS2 0xe0000000-x0efffffff SDCS3 0xf0000000-0xffffffff with Boot Option ASDO=0Because of the row/column/bank architecture of SDRAM, the mapping of these memories into the processor's memory space is discontiguous.
Most ep93xx systems only use one of the chip selects. For these systems,
ARCH_HAS_HOLES_MEMORYMODELhas worked fine to handle the discontiguous memory.But, some of the TS-72xx boards use multiple chip selects. The TS-7300 in particular uses SDCS3 (with ASDO=1) and SDCS2. On that system with
ARCH_HAS_HOLES_MEMORYMODELthe SDCS2 memory does not get handled correctly and results in the system not booting.Change the EP93xx to
ARCH_SPARSEMEM_ENABLE. This handles the discontiguous memory for all configurations.This has been tested on the following ep93xx platforms:
Quoted 8 lines
EDB9307A with 64 MiB on SDCS0
Vision EP9307 with 64 MiB on SDCS0
TS-7300 with 64 MiB on SDCS3 (with ASDO=1) and 64 MiB on SDCS2 sim.one with 64 MiB on SDCS0Signed-off-by H Hartley Sweeten <[email protected]>Tested-by Linus Walleij <[email protected]>Cc Russell King <[email protected]>
As I've tested this patch back in 4.12 times,
Quoted 17 lines
--- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/Kconfig +1
-1@@ -378,7 +378,7 @@ config ARCH_EBSA110 config ARCH_EP93XX bool "EP93xx-based" - select ARCH_HAS_HOLES_MEMORYMODEL + select ARCH_SPARSEMEM_ENABLE select ARM_AMBA select ARM_PATCH_PHYS_VIRT select ARM_VIC
PATCH v2 2/4 ARM: ep93xx: simone: let the mmc_spi driver handle the card detect
In reply to Florian FainelliFrom: H Hartley Sweeten <[email protected]>
This board uses a GPIO for the MMC card detect. Let the mmc_spi driver handle it instead of the platform code.
--- arch/arm/mach-ep93xx/simone.c | 54 +++---------------------------------------- 1 file changed, 3 insertions(+), 51 deletions(-)
arch/arm/mach-ep93xx/simone.c +3 -51
@@ -43,60 +43,12 @@ static struct ep93xxfb_mach_info __initdata simone_fb_info = { .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING, }; -/* -* GPIO lines used for MMC card detection. -*/ -#define MMC_CARD_DETECT_GPIO EP93XX_GPIO_LINE_EGPIO0 - -/* -* MMC card detection GPIO setup. -*/ - -static int simone_mmc_spi_init (struct device *dev, -irqreturn_t (*irq_handler)(int ,void *),void *mmc) -{ -unsigned int gpio =MMC_CARD_DETECT_GPIO ; -int irq, err; - - err =gpio_request (gpio,dev_name (dev)); -if (err) -return err; - - err =gpio_direction_input (gpio); -if (err) - goto fail; - - irq =gpio_to_irq (gpio); -if (irq <0 ) - goto fail; - - err =request_irq (irq, irq_handler,IRQF_TRIGGER_FALLING , -"MMC card detect" , mmc); -if (err) - goto fail; - -printk (KERN_INFO "%s: using irq %d for MMC card detection\n" , -dev_name (dev), irq); - -return 0 ; -fail: -gpio_free (gpio); -return err; -} - -static void simone_mmc_spi_exit (struct device *dev,void *mmc) -{ -unsigned int gpio =MMC_CARD_DETECT_GPIO ; - -free_irq (gpio_to_irq (gpio), mmc); -gpio_free (gpio); -} -static struct mmc_spi_platform_data simone_mmc_spi_data = { - .init = simone_mmc_spi_init, - .exit = simone_mmc_spi_exit, .detect_delay =500 , .ocr_mask =MMC_VDD_32_33 |MMC_VDD_33_34 , + .flags =MMC_SPI_USE_CD_GPIO , + .cd_gpio =EP93XX_GPIO_LINE_EGPIO0 , + .cd_debounce =1 , };static struct spi_board_info simone_spi_devices[]__initdata = {
Signature · 1 line
2.11.0
Alexander Sverdlin
maintainerPATCH v2 2/4 ARM: ep93xx: simone: let the mmc_spi driver handle the card detect
Hello!
Quoted 7 lines · Florian Fainelli
From: H Hartley Sweeten <[email protected]>
This board uses a GPIO for the MMC card detect. Let the
mmc_spidriver handle it instead of the platform code.Signed-off-by H Hartley Sweeten <[email protected]>Tested-by Linus Walleij <[email protected]>
Quoted 72 lines
--- arch/arm/mach-ep93xx/simone.c | 54 +++---------------------------------------- 1 file changed, 3 insertions(+), 51 deletions(-)arch/arm/mach-ep93xx/simone.c +3
-51@@ -43,60 +43,12 @@ static struct ep93xxfb_mach_info __initdata simone_fb_info = { .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING, }; -/* -* GPIO lines used for MMC card detection. -*/ -#define MMC_CARD_DETECT_GPIO EP93XX_GPIO_LINE_EGPIO0 - -/* -* MMC card detection GPIO setup. -*/ - -static int simone_mmc_spi_init (struct device *dev, -irqreturn_t (*irq_handler)(int ,void *),void *mmc) -{ -unsigned int gpio =MMC_CARD_DETECT_GPIO ; -int irq, err; - - err =gpio_request (gpio,dev_name (dev)); -if (err) -return err; - - err =gpio_direction_input (gpio); -if (err) - goto fail; - - irq =gpio_to_irq (gpio); -if (irq <0 ) - goto fail; - - err =request_irq (irq, irq_handler,IRQF_TRIGGER_FALLING , -"MMC card detect" , mmc); -if (err) - goto fail; - -printk (KERN_INFO "%s: using irq %d for MMC card detection\n" , -dev_name (dev), irq); - -return 0 ; -fail: -gpio_free (gpio); -return err; -} - -static void simone_mmc_spi_exit (struct device *dev,void *mmc) -{ -unsigned int gpio =MMC_CARD_DETECT_GPIO ; - -free_irq (gpio_to_irq (gpio), mmc); -gpio_free (gpio); -} -static struct mmc_spi_platform_data simone_mmc_spi_data = { - .init = simone_mmc_spi_init, - .exit = simone_mmc_spi_exit, .detect_delay =500 , .ocr_mask =MMC_VDD_32_33 |MMC_VDD_33_34 , + .flags =MMC_SPI_USE_CD_GPIO , + .cd_gpio =EP93XX_GPIO_LINE_EGPIO0 , + .cd_debounce =1 , };static struct spi_board_info simone_spi_devices[]__initdata = {
PATCH v2 3/4 ARM: ep93xx: tidy up TS-72xx Watchdog resources
In reply to Florian FainelliFrom: H Hartley Sweeten <[email protected]>
The ts-72xx watchdog uses two byte sized registers. Tidy up the resource declaration so that the proper information is shown in /proc/iomem.
--- arch/arm/mach-ep93xx/ts72xx.c | 20 +++++++++----------- arch/arm/mach-ep93xx/ts72xx.h | 3 --- 2 files changed, 9 insertions(+), 14 deletions(-)
arch/arm/mach-ep93xx/ts72xx.c +9 -11
@@ -186,24 +186,22 @@ static struct platform_device ts72xx_rtc_device = { .num_resources = ARRAY_SIZE(ts72xx_rtc_resources), }; +/************************************************************************* +* Watchdog (in CPLD) +*************************************************************************/ +#define TS72XX_WDT_CONTROL_PHYS_BASE (EP93XX_CS2_PHYS_BASE + 0x03800000) +#define TS72XX_WDT_FEED_PHYS_BASE (EP93XX_CS2_PHYS_BASE + 0x03c00000) +static struct resource ts72xx_wdt_resources[] = { - { - .start =TS72XX_WDT_CONTROL_PHYS_BASE , - .end =TS72XX_WDT_CONTROL_PHYS_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =TS72XX_WDT_FEED_PHYS_BASE , - .end =TS72XX_WDT_FEED_PHYS_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, +DEFINE_RES_MEM (TS72XX_WDT_CONTROL_PHYS_BASE ,0x01 ), +DEFINE_RES_MEM (TS72XX_WDT_FEED_PHYS_BASE ,0x01 ), };static struct platform_device ts72xx_wdt_device = { .name ="ts72xx-wdt" , .id =-1 , - .num_resources =ARRAY_SIZE (ts72xx_wdt_resources), .resource = ts72xx_wdt_resources, + .num_resources =ARRAY_SIZE (ts72xx_wdt_resources), };static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
arch/arm/mach-ep93xx/ts72xx.h +0 -3
@@ -38,9 +38,6 @@#define TS72XX_OPTIONS2_TS9420 0x04#define TS72XX_OPTIONS2_TS9420_BOOT 0x02 -#define TS72XX_WDT_CONTROL_PHYS_BASE 0x23800000 -#define TS72XX_WDT_FEED_PHYS_BASE 0x23c00000 -#ifndef __ASSEMBLY__static inline int ts72xx_model (void )
Signature · 1 line
2.11.0
Alexander Sverdlin
maintainerPATCH v2 3/4 ARM: ep93xx: tidy up TS-72xx Watchdog resources
Hello!
Quoted 6 lines · Florian Fainelli
From: H Hartley Sweeten <[email protected]>
The ts-72xx watchdog uses two byte sized registers. Tidy up the resource declaration so that the proper information is shown in
/proc/iomem.Signed-off-by H Hartley Sweeten <[email protected]>
Quoted 57 lines
--- arch/arm/mach-ep93xx/ts72xx.c | 20 +++++++++----------- arch/arm/mach-ep93xx/ts72xx.h | 3 --- 2 files changed, 9 insertions(+), 14 deletions(-)arch/arm/mach-ep93xx/ts72xx.c +9
-11@@ -186,24 +186,22 @@ static struct platform_device ts72xx_rtc_device = { .num_resources = ARRAY_SIZE(ts72xx_rtc_resources), }; +/************************************************************************* +* Watchdog (in CPLD) +*************************************************************************/ +#define TS72XX_WDT_CONTROL_PHYS_BASE (EP93XX_CS2_PHYS_BASE + 0x03800000) +#define TS72XX_WDT_FEED_PHYS_BASE (EP93XX_CS2_PHYS_BASE + 0x03c00000) +static struct resource ts72xx_wdt_resources[] = { - { - .start =TS72XX_WDT_CONTROL_PHYS_BASE , - .end =TS72XX_WDT_CONTROL_PHYS_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =TS72XX_WDT_FEED_PHYS_BASE , - .end =TS72XX_WDT_FEED_PHYS_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, +DEFINE_RES_MEM (TS72XX_WDT_CONTROL_PHYS_BASE ,0x01 ), +DEFINE_RES_MEM (TS72XX_WDT_FEED_PHYS_BASE ,0x01 ), };static struct platform_device ts72xx_wdt_device = { .name ="ts72xx-wdt" , .id =-1 , - .num_resources =ARRAY_SIZE (ts72xx_wdt_resources), .resource = ts72xx_wdt_resources, + .num_resources =ARRAY_SIZE (ts72xx_wdt_resources), };static struct ep93xx_eth_data __initdata ts72xx_eth_data = {arch/arm/mach-ep93xx/ts72xx.h +0
-3@@ -38,9 +38,6 @@#define TS72XX_OPTIONS2_TS9420 0x04#define TS72XX_OPTIONS2_TS9420_BOOT 0x02 -#define TS72XX_WDT_CONTROL_PHYS_BASE 0x23800000 -#define TS72XX_WDT_FEED_PHYS_BASE 0x23c00000 -#ifndef __ASSEMBLY__static inline int ts72xx_model (void )
PATCH v2 4/4 ARM: ep93xx: Add lm70 HWMON sensor to TS-72xx boards
In reply to Florian FainelliFrom: H Hartley Sweeten <[email protected]>
Register the TI TMP122 (lm70) temperature sensor driver for the TS-72xx boards.
Originaly from Florian Fainelli. Updated to the new spi-ep93xx chip select method.
--- arch/arm/mach-ep93xx/ts72xx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
arch/arm/mach-ep93xx/ts72xx.c +26 -0
@@ -18,7 +18,10 @@#include <linux/io.h> #include <linux/mtd/nand.h> #include <linux/mtd/partitions.h> +#include <linux/spi/spi.h> +#include <linux/platform_data/spi-ep93xx.h> +#include <mach/gpio-ep93xx.h> #include <mach/hardware.h> #include <asm/mach-types.h>
@@ -230,6 +233,27 @@ static struct platform_device ts73xx_fpga_device = {#endif +/************************************************************************* +* SPI Bus +*************************************************************************/ +static struct spi_board_info ts72xx_spi_devices[]__initdata = { + { + .modalias ="tmp122" , + .max_speed_hz =2 *1000 *1000 , + .bus_num =0 , + .chip_select =0 , + }, +}; + +static int ts72xx_spi_chipselects[]__initdata = { +EP93XX_GPIO_LINE_F (2 ),/* DIO_17 */ +}; + +static struct ep93xx_spi_info ts72xx_spi_info__initdata = { + .chipselect = ts72xx_spi_chipselects, + .num_chipselect =ARRAY_SIZE (ts72xx_spi_chipselects), +}; +static void __init ts72xx_init_machine (void ) {ep93xx_init_devices ();
@@ -242,6 +266,8 @@ static void __init ts72xx_init_machine(void)if (board_is_ts7300 ())platform_device_register (&ts73xx_fpga_device);#endif +ep93xx_register_spi (&ts72xx_spi_info, ts72xx_spi_devices, +ARRAY_SIZE (ts72xx_spi_devices)); }MACHINE_START (TS72XX ,"Technologic Systems TS-72xx SBC" )
Signature · 1 line
2.11.0
Alexander Sverdlin
maintainerPATCH v2 4/4 ARM: ep93xx: Add lm70 HWMON sensor to TS-72xx boards
Hello!
Quoted 10 lines · Florian Fainelli
From: H Hartley Sweeten <[email protected]>
Register the TI TMP122 (lm70) temperature sensor driver for the TS-72xx boards.
Originaly from Florian Fainelli. Updated to the new spi-ep93xx chip select method.
Signed-off-by H Hartley Sweeten <[email protected]>Signed-off-by Florian Fainelli <[email protected]>
Quoted 56 lines
--- arch/arm/mach-ep93xx/ts72xx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)arch/arm/mach-ep93xx/ts72xx.c +26
-0@@ -18,7 +18,10 @@#include <linux/io.h> #include <linux/mtd/nand.h> #include <linux/mtd/partitions.h> +#include <linux/spi/spi.h> +#include <linux/platform_data/spi-ep93xx.h> +#include <mach/gpio-ep93xx.h> #include <mach/hardware.h> #include <asm/mach-types.h> @@ -230,6 +233,27 @@ static struct platform_device ts73xx_fpga_device = {#endif +/************************************************************************* +* SPI Bus +*************************************************************************/ +static struct spi_board_info ts72xx_spi_devices[]__initdata = { + { + .modalias ="tmp122" , + .max_speed_hz =2 *1000 *1000 , + .bus_num =0 , + .chip_select =0 , + }, +}; + +static int ts72xx_spi_chipselects[]__initdata = { +EP93XX_GPIO_LINE_F (2 ),/* DIO_17 */ +}; + +static struct ep93xx_spi_info ts72xx_spi_info__initdata = { + .chipselect = ts72xx_spi_chipselects, + .num_chipselect =ARRAY_SIZE (ts72xx_spi_chipselects), +}; +static void __init ts72xx_init_machine (void ) {ep93xx_init_devices ();@@ -242,6 +266,8 @@ static void __init ts72xx_init_machine(void)if (board_is_ts7300 ())platform_device_register (&ts73xx_fpga_device);#endif +ep93xx_register_spi (&ts72xx_spi_info, ts72xx_spi_devices, +ARRAY_SIZE (ts72xx_spi_devices)); }MACHINE_START (TS72XX ,"Technologic Systems TS-72xx SBC" )
v2 cover ARM: ep93xx: various updates
In reply to Florian FainelliQuoted 1 line · Florian Fainelli
This is a rebase of Hartley's original submission:
Hartley are you sending pull requests to ARM SoC for these changes?
Else I can stack them up in one of my trees and feed it to ARM SoC if you need help.
Yours,
Linus Walleij
v2 cover ARM: ep93xx: various updates
Quoted 6 lines · Linus Walleij
Quoted 1 line · Florian Fainelli
This is a rebase of Hartley's original submission:
Hartley are you sending pull requests to ARM SoC for these changes?
Else I can stack them up in one of my trees and feed it to ARM SoC if you need help.
Linus, I don't have my own tree to send a pull request from. Please put them in one of your trees.
Thanks,
Hartley