Updating SPEAr Support
Subsystems (14)
PATCH v2 62/69 ST SPEAr: Appending spear3** with global structures
In reply to Viresh KUMAR--- arch/arm/mach-spear3xx/include/mach/generic.h | 140 ++++++++++++------------ arch/arm/mach-spear3xx/spear300.c | 42 ++++---- arch/arm/mach-spear3xx/spear300_evb.c | 43 ++++---- arch/arm/mach-spear3xx/spear310.c | 16 ++-- arch/arm/mach-spear3xx/spear310_evb.c | 37 ++++--- arch/arm/mach-spear3xx/spear320.c | 32 +++--- arch/arm/mach-spear3xx/spear320_evb.c | 50 +++++---- arch/arm/mach-spear3xx/spear3xx.c | 20 ++-- arch/arm/plat-spear/include/plat/spi.h | 2 +- 9 files changed, 193 insertions(+), 189 deletions(-)
arch/arm/mach-spear3xx/include/mach/generic.h +70 -70
@@ -31,16 +31,16 @@#define SPEAR_GPT0_CHAN1_IRQ SPEAR3XX_IRQ_CPU_GPT1_2/* Add spear3xx family device structure declarations here */ -extern struct amba_device gpio_device; -extern struct amba_device ssp0_device; -extern struct amba_device uart_device; -extern struct amba_device wdt_device; -extern struct platform_device ehci_device; -extern struct platform_device i2c_device; -extern struct platform_device ohci0_device; -extern struct platform_device ohci1_device; -extern struct platform_device rtc_device; -extern struct platform_device smi_device; +extern struct amba_device spear3xx_gpio_device; +extern struct amba_device spear3xx_ssp0_device; +extern struct amba_device spear3xx_uart_device; +extern struct amba_device spear3xx_wdt_device; +extern struct platform_device spear3xx_ehci_device; +extern struct platform_device spear3xx_i2c_device; +extern struct platform_device spear3xx_ohci0_device; +extern struct platform_device spear3xx_ohci1_device; +extern struct platform_device spear3xx_rtc_device; +extern struct platform_device spear3xx_smi_device;extern struct sys_timer spear3xx_timer;/* Add spear3xx family function declarations here */
@@ -88,49 +88,49 @@ extern struct pmx_dev spear3xx_pmx_timer_1_2;#if defined(CONFIG_MACH_SPEAR310 ) || defined(CONFIG_MACH_SPEAR320 )/* padmux plgpio devices */ -extern struct pmx_dev pmx_plgpio_0_1; -extern struct pmx_dev pmx_plgpio_2_3; -extern struct pmx_dev pmx_plgpio_4_5; -extern struct pmx_dev pmx_plgpio_6_9; -extern struct pmx_dev pmx_plgpio_10_27; -extern struct pmx_dev pmx_plgpio_28; -extern struct pmx_dev pmx_plgpio_29; -extern struct pmx_dev pmx_plgpio_30; -extern struct pmx_dev pmx_plgpio_31; -extern struct pmx_dev pmx_plgpio_32; -extern struct pmx_dev pmx_plgpio_33; -extern struct pmx_dev pmx_plgpio_34_36; -extern struct pmx_dev pmx_plgpio_37_42; -extern struct pmx_dev pmx_plgpio_43_44_47_48; -extern struct pmx_dev pmx_plgpio_45_46_49_50; +extern struct pmx_dev spear3xx_pmx_plgpio_0_1; +extern struct pmx_dev spear3xx_pmx_plgpio_2_3; +extern struct pmx_dev spear3xx_pmx_plgpio_4_5; +extern struct pmx_dev spear3xx_pmx_plgpio_6_9; +extern struct pmx_dev spear3xx_pmx_plgpio_10_27; +extern struct pmx_dev spear3xx_pmx_plgpio_28; +extern struct pmx_dev spear3xx_pmx_plgpio_29; +extern struct pmx_dev spear3xx_pmx_plgpio_30; +extern struct pmx_dev spear3xx_pmx_plgpio_31; +extern struct pmx_dev spear3xx_pmx_plgpio_32; +extern struct pmx_dev spear3xx_pmx_plgpio_33; +extern struct pmx_dev spear3xx_pmx_plgpio_34_36; +extern struct pmx_dev spear3xx_pmx_plgpio_37_42; +extern struct pmx_dev spear3xx_pmx_plgpio_43_44_47_48; +extern struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50;#endif /* spear300 declarations */ #ifdef CONFIG_MACH_SPEAR300 /* Add spear300 machine device structure declarations here */ -extern struct amba_device clcd_device; -extern struct amba_device gpio1_device; -extern struct platform_device kbd_device; -extern struct platform_device nand0_device; -extern struct platform_device nand1_device; -extern struct platform_device nand2_device; -extern struct platform_device nand3_device; -extern struct platform_device sdhci_device; +extern struct amba_device spear300_clcd_device; +extern struct amba_device spear300_gpio1_device; +extern struct platform_device spear300_kbd_device; +extern struct platform_device spear300_nand0_device; +extern struct platform_device spear300_nand1_device; +extern struct platform_device spear300_nand2_device; +extern struct platform_device spear300_nand3_device; +extern struct platform_device spear300_sdhci_device;/* pad mux modes */ -extern struct pmx_mode nand_mode; -extern struct pmx_mode nor_mode; -extern struct pmx_mode photo_frame_mode; -extern struct pmx_mode lend_ip_phone_mode; -extern struct pmx_mode hend_ip_phone_mode; -extern struct pmx_mode lend_wifi_phone_mode; -extern struct pmx_mode hend_wifi_phone_mode; -extern struct pmx_mode ata_pabx_wi2s_mode; -extern struct pmx_mode ata_pabx_i2s_mode; -extern struct pmx_mode caml_lcdw_mode; -extern struct pmx_mode camu_lcd_mode; -extern struct pmx_mode camu_wlcd_mode; -extern struct pmx_mode caml_lcd_mode; +extern struct pmx_mode spear300_nand_mode; +extern struct pmx_mode spear300_nor_mode; +extern struct pmx_mode spear300_photo_frame_mode; +extern struct pmx_mode spear300_lend_ip_phone_mode; +extern struct pmx_mode spear300_hend_ip_phone_mode; +extern struct pmx_mode spear300_lend_wifi_phone_mode; +extern struct pmx_mode spear300_hend_wifi_phone_mode; +extern struct pmx_mode spear300_ata_pabx_wi2s_mode; +extern struct pmx_mode spear300_ata_pabx_i2s_mode; +extern struct pmx_mode spear300_caml_lcdw_mode; +extern struct pmx_mode spear300_camu_lcd_mode; +extern struct pmx_mode spear300_camu_wlcd_mode; +extern struct pmx_mode spear300_caml_lcd_mode;/* pad mux devices */ extern struct pmx_dev spear300_pmx_fsmc_2_chips;
@@ -166,14 +166,14 @@ extern struct clcd_board clcd_plat_data;/* spear310 declarations */ #if defined(CONFIG_MACH_SPEAR310 )/* Add spear310 machine device structure declarations here */ -extern struct amba_device uart1_device; -extern struct amba_device uart2_device; -extern struct amba_device uart3_device; -extern struct amba_device uart4_device; -extern struct amba_device uart5_device; -extern struct platform_device emi_nor_device; -extern struct platform_device plgpio_device; -extern struct platform_device nand_device; +extern struct amba_device spear310_uart1_device; +extern struct amba_device spear310_uart2_device; +extern struct amba_device spear310_uart3_device; +extern struct amba_device spear310_uart4_device; +extern struct amba_device spear310_uart5_device; +extern struct platform_device spear310_emi_nor_device; +extern struct platform_device spear310_plgpio_device; +extern struct platform_device spear310_nand_device;/* pad mux devices */ extern struct pmx_dev spear310_pmx_emi_cs_0_1_4_5;
@@ -194,24 +194,24 @@ void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,/* spear320 declarations */ #if defined(CONFIG_MACH_SPEAR320 )/* Add spear320 machine device structure declarations here */ -extern struct amba_device clcd_device; -extern struct amba_device ssp_device[]; -extern struct amba_device uart1_device; -extern struct amba_device uart2_device; -extern struct platform_device can0_device; -extern struct platform_device can1_device; -extern struct platform_device emi_nor_device; -extern struct platform_device i2c1_device; -extern struct platform_device nand_device; -extern struct platform_device plgpio_device; -extern struct platform_device pwm_device; -extern struct platform_device sdhci_device; +extern struct amba_device spear320_clcd_device; +extern struct amba_device spear320_ssp_device[]; +extern struct amba_device spear320_uart1_device; +extern struct amba_device spear320_uart2_device; +extern struct platform_device spear320_can0_device; +extern struct platform_device spear320_can1_device; +extern struct platform_device spear320_emi_nor_device; +extern struct platform_device spear320_i2c1_device; +extern struct platform_device spear320_nand_device; +extern struct platform_device spear320_plgpio_device; +extern struct platform_device spear320_pwm_device; +extern struct platform_device spear320_sdhci_device;/* pad mux modes */ -extern struct pmx_mode auto_net_smii_mode; -extern struct pmx_mode auto_net_mii_mode; -extern struct pmx_mode auto_exp_mode; -extern struct pmx_mode small_printers_mode; +extern struct pmx_mode spear320_auto_net_smii_mode; +extern struct pmx_mode spear320_auto_net_mii_mode; +extern struct pmx_mode spear320_auto_exp_mode; +extern struct pmx_mode spear320_small_printers_mode;/* pad mux devices */ extern struct pmx_dev spear320_pmx_clcd;
arch/arm/mach-spear3xx/spear300.c +21 -21
156 lines not on this page · raw message
arch/arm/mach-spear3xx/spear300_evb.c +22 -21
77 lines not on this page · raw message
arch/arm/mach-spear3xx/spear310.c +8 -8
@@ -196,7 +196,7 @@ static struct pmx_driver pmx_driver;/* Add spear310 specific devices here */ /* uart1 device registeration */ -struct amba_device uart1_device = { +struct amba_device spear310_uart1_device = { .dev = { .init_name ="uart1" , },
@@ -209,7 +209,7 @@ struct amba_device uart1_device = { };/* uart2 device registeration */ -struct amba_device uart2_device = { +struct amba_device spear310_uart2_device = { .dev = { .init_name ="uart2" , },
@@ -222,7 +222,7 @@ struct amba_device uart2_device = { };/* uart3 device registeration */ -struct amba_device uart3_device = { +struct amba_device spear310_uart3_device = { .dev = { .init_name ="uart3" , },
@@ -235,7 +235,7 @@ struct amba_device uart3_device = { };/* uart4 device registeration */ -struct amba_device uart4_device = { +struct amba_device spear310_uart4_device = { .dev = { .init_name ="uart4" , },
@@ -248,7 +248,7 @@ struct amba_device uart4_device = { };/* uart5 device registeration */ -struct amba_device uart5_device = { +struct amba_device spear310_uart5_device = { .dev = { .init_name ="uart5" , },
@@ -277,7 +277,7 @@ static struct resource nand_resources[] = { }, }; -struct platform_device nand_device = { +struct platform_device spear310_nand_device = { .name ="nand" , .id =-1 , .resource = nand_resources,
@@ -323,7 +323,7 @@ int spear300_o2p(int offset)/* emi nor flash device registeration */ static struct physmap_flash_data emi_norflash_data; -struct platform_device emi_nor_device = { +struct platform_device spear310_emi_nor_device = { .name ="physmap-flash" , .id =-1 , .dev.platform_data = &emi_norflash_data,
@@ -351,7 +351,7 @@ static struct resource plgpio_resources[] = { }, }; -struct platform_device plgpio_device = { +struct platform_device spear310_plgpio_device = { .name ="plgpio" , .id =-1 , .dev = {
arch/arm/mach-spear3xx/spear310_evb.c +19 -18
@@ -69,27 +69,27 @@ static struct pmx_dev *pmx_devs[] = {static struct amba_device *amba_devs[]__initdata = {/* spear3xx specific devices */ - &gpio_device, - &ssp0_device, - &uart_device, - &wdt_device, + &spear3xx_gpio_device, + &spear3xx_ssp0_device, + &spear3xx_uart_device, + &spear3xx_wdt_device,/* spear310 specific devices */ };static struct platform_device *plat_devs[]__initdata = {/* spear3xx specific devices */ - &ehci_device, - &emi_nor_device, - &i2c_device, - &nand_device, - &ohci0_device, - &ohci1_device, - &rtc_device, - &smi_device, + &spear3xx_ehci_device, + &spear3xx_i2c_device, + &spear3xx_ohci0_device, + &spear3xx_ohci1_device, + &spear3xx_rtc_device, + &spear3xx_smi_device,/* spear310 specific devices */ - &plgpio_device, + &spear310_emi_nor_device, + &spear310_nand_device, + &spear310_plgpio_device, };/* spi board information */
@@ -132,8 +132,8 @@ static void __init spear310_evb_init(void)unsigned int i;/* set nand device's plat data */ -fsmc_nand_set_plat_data (&nand_device,NULL ,0 ,NAND_SKIP_BBTSCAN , -FSMC_NAND_BW8 ); +fsmc_nand_set_plat_data (&spear310_nand_device,NULL ,0 , +NAND_SKIP_BBTSCAN ,FSMC_NAND_BW8 );/* call spear310 machine init function */ spear310_init (NULL , pmx_devs,ARRAY_SIZE (pmx_devs));
@@ -142,10 +142,10 @@ static void __init spear310_evb_init(void)i2c_register_board_devices ();/* initialize serial nor related data in smi plat data */ -smi_init_board_info (&smi_device); +smi_init_board_info (&spear3xx_smi_device);/* initialize emi related data in emi plat data */ -emi_init_board_info (&emi_nor_device, emi_nor_resources, +emi_init_board_info (&spear310_emi_nor_device, emi_nor_resources,ARRAY_SIZE (emi_nor_resources), partition_info,ARRAY_SIZE (partition_info),EMI_FLASH_WIDTH32 );
@@ -157,7 +157,8 @@ static void __init spear310_evb_init(void)amba_device_register (amba_devs[i], &iomem_resource);/* Initialize emi regiters */ -emi_init (&emi_nor_device,SPEAR310_EMI_REG_BASE ,0 ,EMI_FLASH_WIDTH32 ); +emi_init (&spear310_emi_nor_device,SPEAR310_EMI_REG_BASE ,0 , +EMI_FLASH_WIDTH32 );spi_init (); }
arch/arm/mach-spear3xx/spear320.c +16 -16
@@ -30,25 +30,25 @@#define SMALL_PRINTERS_MODE (1 << 3)#define ALL_MODES 0xF -struct pmx_mode auto_net_smii_mode = { +struct pmx_mode spear320_auto_net_smii_mode = { .id =AUTO_NET_SMII_MODE , .name ="Automation Networking SMII Mode" , .value =0x00 , }; -struct pmx_mode auto_net_mii_mode = { +struct pmx_mode spear320_auto_net_mii_mode = { .id =AUTO_NET_MII_MODE , .name ="Automation Networking MII Mode" , .value =0x01 , }; -struct pmx_mode auto_exp_mode = { +struct pmx_mode spear320_auto_exp_mode = { .id =AUTO_EXP_MODE , .name ="Automation Expanded Mode" , .value =0x02 , }; -struct pmx_mode small_printers_mode = { +struct pmx_mode spear320_small_printers_mode = { .id =SMALL_PRINTERS_MODE , .name ="Small Printers Mode" , .value =0x03 ,
@@ -594,7 +594,7 @@ static struct pmx_driver pmx_driver = {/* Add spear320 specific devices here */ /* CLCD device registration */ -struct amba_device clcd_device = { +struct amba_device spear320_clcd_device = { .dev = { .init_name ="clcd" , .coherent_dma_mask = ~0 ,
@@ -622,7 +622,7 @@ static struct pl022_ssp_controller ssp_platform_data[] = { } }; -struct amba_device ssp_device[] = { +struct amba_device spear320_ssp_device[] = { { .dev = { .coherent_dma_mask = ~0 ,
@@ -651,7 +651,7 @@ struct amba_device ssp_device[] = { };/* uart1 device registeration */ -struct amba_device uart1_device = { +struct amba_device spear320_uart1_device = { .dev = { .init_name ="uart1" , },
@@ -664,7 +664,7 @@ struct amba_device uart1_device = { };/* uart2 device registeration */ -struct amba_device uart2_device = { +struct amba_device spear320_uart2_device = { .dev = { .init_name ="uart2" , },
@@ -678,7 +678,7 @@ struct amba_device uart2_device = {/* emi nor flash device registeration */ static struct physmap_flash_data emi_norflash_data; -struct platform_device emi_nor_device = { +struct platform_device spear320_emi_nor_device = { .name ="physmap-flash" , .id =-1 , .dev.platform_data = &emi_norflash_data,
@@ -703,7 +703,7 @@ static struct resource can0_resources[] = { }, }; -struct platform_device can0_device = { +struct platform_device spear320_can0_device = { .name ="spear_can" , .id =0 , .num_resources =ARRAY_SIZE (can0_resources),
@@ -721,7 +721,7 @@ static struct resource can1_resources[] = { }, }; -struct platform_device can1_device = { +struct platform_device spear320_can1_device = { .name ="spear_can" , .id =1 , .num_resources =ARRAY_SIZE (can1_resources),
@@ -740,7 +740,7 @@ static struct resource i2c1_resources[] = { }, }; -struct platform_device i2c1_device = { +struct platform_device spear320_i2c1_device = { .name ="i2c_designware" , .id =1 , .dev = {
@@ -767,7 +767,7 @@ static struct resource nand_resources[] = { }, }; -struct platform_device nand_device = { +struct platform_device spear320_nand_device = { .name ="nand" , .id =-1 , .resource = nand_resources,
@@ -786,7 +786,7 @@ static struct resource plgpio_resources[] = { }, }; -struct platform_device plgpio_device = { +struct platform_device spear320_plgpio_device = { .name ="plgpio" , .id =-1 , .dev = {
@@ -805,7 +805,7 @@ static struct resource pwm_resources[] = { }, }; -struct platform_device pwm_device = { +struct platform_device spear320_pwm_device = { .name ="pwm" , .id =-1 , .num_resources =ARRAY_SIZE (pwm_resources),
@@ -824,7 +824,7 @@ static struct resource sdhci_resources[] = { } }; -struct platform_device sdhci_device = { +struct platform_device spear320_sdhci_device = { .dev = { .coherent_dma_mask = ~0 , },
arch/arm/mach-spear3xx/spear320_evb.c +26 -24
87 lines not on this page · raw message
arch/arm/mach-spear3xx/spear3xx.c +10 -10
@@ -32,7 +32,7 @@ static struct pl061_platform_data gpio_plat_data = { .irq_base = SPEAR3XX_GPIO_INT_BASE, }; -struct amba_device gpio_device = { +struct amba_device spear3xx_gpio_device = { .dev = { .init_name ="gpio" , .platform_data = &gpio_plat_data,
@@ -61,7 +61,7 @@ static struct pl022_ssp_controller ssp_platform_data = { .num_chipselect = 2, }; -struct amba_device ssp0_device = { +struct amba_device spear3xx_ssp0_device = { .dev = { .coherent_dma_mask = ~0 , .init_name ="ssp-pl022.0" ,
@@ -76,7 +76,7 @@ struct amba_device ssp0_device = { };/* uart device registeration */ -struct amba_device uart_device = { +struct amba_device spear3xx_uart_device = { .dev = { .init_name ="uart" , },
@@ -89,7 +89,7 @@ struct amba_device uart_device = { };/* watchdog device registeration */ -struct amba_device wdt_device = { +struct amba_device spear3xx_wdt_device = { .dev = { .init_name ="wdt" , },
@@ -112,7 +112,7 @@ static struct resource i2c_resources[] = { }, }; -struct platform_device i2c_device = { +struct platform_device spear3xx_i2c_device = { .name ="i2c_designware" , .id =0 , .dev = {
@@ -162,7 +162,7 @@ static struct resource ohci1_resources[] = {static u64 ehci_dmamask = ~0 ;static int usbh_id =-1 ; -struct platform_device ehci_device = { +struct platform_device spear3xx_ehci_device = { .name ="spear-ehci" , .id =-1 , .dev = {
@@ -176,7 +176,7 @@ struct platform_device ehci_device = {static u64 ohci0_dmamask = ~0 ; -struct platform_device ohci0_device = { +struct platform_device spear3xx_ohci0_device = { .name ="spear-ohci" , .id =0 , .dev = {
@@ -190,7 +190,7 @@ struct platform_device ohci0_device = {static u64 ohci1_dmamask = ~0 ; -struct platform_device ohci1_device = { +struct platform_device spear3xx_ohci1_device = { .name ="spear-ohci" , .id =1 , .dev = {
@@ -214,7 +214,7 @@ static struct resource rtc_resources[] = { }, }; -struct platform_device rtc_device = { +struct platform_device spear3xx_rtc_device = { .name ="rtc-spear" , .id =-1 , .num_resources =ARRAY_SIZE (rtc_resources),
@@ -233,7 +233,7 @@ static struct resource smi_resources[] = { }, }; -struct platform_device smi_device = { +struct platform_device spear3xx_smi_device = { .name ="smi" , .id =-1 , .num_resources =ARRAY_SIZE (smi_resources),
arch/arm/plat-spear/include/plat/spi.h +1 -1
@@ -55,7 +55,7 @@ static void spi##id##_##type##_cs_control(u32 control) \/* This will define CHIP_INFO structure for a specific spi slave */ #define DECLARE_SPI_CHIP_INFO (id, type, chip_select_control) \ -struct pl022_config_chip spi##id##_##type##_chip_info = { \ +static struct pl022_config_chip spi##id##_##type##_chip_info = {\ .lbm = LOOPBACK_DISABLED, \ .iface = SSP_INTERFACE_MOTOROLA_SPI, \ .hierarchy = SSP_MASTER, \
Signature · 1 line
1.7.2.2
PATCH v2 63/69 ST SPEAr3xx: Updating plgpio and emi source to make it compliant with single image strategy
In reply to Viresh KUMAR--- arch/arm/mach-spear3xx/emi.c | 18 ++++++++++- arch/arm/mach-spear3xx/include/mach/emi.h | 19 ++++++----- arch/arm/mach-spear3xx/include/mach/gpio.h | 27 ++++++++-------- arch/arm/plat-spear/plgpio.c | 46 ++++++++++++++++++++------- 4 files changed, 75 insertions(+), 35 deletions(-)
arch/arm/mach-spear3xx/emi.c +17 -1
@@ -15,6 +15,7 @@#include <linux/err.h> #include <linux/init.h> #include <linux/io.h> +#include <asm/mach-types.h> #include <mach/emi.h> int __init emi_init(struct platform_device *pdev, unsigned long base,
@@ -23,8 +24,23 @@ int __init emi_init(struct platform_device *pdev, unsigned long base,void __iomem *emi_reg_base;struct clk *clk;int ret; +u32 ack_reg, max_banks; +/* u32 timeout_reg, irq_reg; */ + +/* fixing machine dependent values */ +if (machine_is_spear310 ()) { + ack_reg =SPEAR310_ACK_REG ; + max_banks =SPEAR310_EMI_MAX_BANKS ; +/* timeout_reg = SPEAR310_TIMEOUT_REG; */ +/* irq_reg = SPEAR310_IRQ_REG; */ + }else { + ack_reg =SPEAR320_ACK_REG ; + max_banks =SPEAR320_EMI_MAX_BANKS ; +/* timeout_reg = SPEAR320_TIMEOUT_REG; */ +/* irq_reg = SPEAR320_IRQ_REG; */ + } -if (bank > (EMI_MAX_BANKS -1 )) +if (bank > (max_banks -1 ))return -EINVAL ; emi_reg_base =ioremap (base,EMI_REG_SIZE );
arch/arm/mach-spear3xx/include/mach/emi.h +10 -9
@@ -33,18 +33,19 @@#define CTRL_REG (0x14)#if defined(CONFIG_MACH_SPEAR310 ) -#define TIMEOUT_REG (0x90) -#define ACK_REG (0x94) -#define IRQ_REG (0x98) +#define SPEAR310_TIMEOUT_REG (0x90) +#define SPEAR310_ACK_REG (0x94) +#define SPEAR310_IRQ_REG (0x98) -#define EMI_MAX_BANKS 6 +#define SPEAR310_EMI_MAX_BANKS 6 +#endif -#elif defined(CONFIG_MACH_SPEAR320 ) -#define TIMEOUT_REG (0x60) -#define ACK_REG (0x64) -#define IRQ_REG (0x68) +#if defined(CONFIG_MACH_SPEAR320 ) +#define SPEAR320_TIMEOUT_REG (0x60) +#define SPEAR320_ACK_REG (0x64) +#define SPEAR320_IRQ_REG (0x68) -#define EMI_MAX_BANKS 4 +#define SPEAR320_EMI_MAX_BANKS 4#endif
arch/arm/mach-spear3xx/include/mach/gpio.h +14 -13
@@ -17,20 +17,21 @@#include <plat/gpio.h> #ifdef CONFIG_MACH_SPEAR310 -#define PLGPIO_ENB 0x0010 -#define PLGPIO_WDATA 0x0020 -#define PLGPIO_DIR 0x0030 -#define PLGPIO_IE 0x0040 -#define PLGPIO_RDATA 0x0050 -#define PLGPIO_MIS 0x0060 +#define SPEAR310_PLGPIO_ENB 0x0010 +#define SPEAR310_PLGPIO_WDATA 0x0020 +#define SPEAR310_PLGPIO_DIR 0x0030 +#define SPEAR310_PLGPIO_IE 0x0040 +#define SPEAR310_PLGPIO_RDATA 0x0050 +#define SPEAR310_PLGPIO_MIS 0x0060 +#endif -#elif defined(CONFIG_MACH_SPEAR320 ) -#define PLGPIO_ENB 0x0024 -#define PLGPIO_WDATA 0x0034 -#define PLGPIO_DIR 0x0044 -#define PLGPIO_RDATA 0x0054 -#define PLGPIO_IE 0x0064 -#define PLGPIO_MIS 0x0074 +#if defined(CONFIG_MACH_SPEAR320 ) +#define SPEAR320_PLGPIO_ENB 0x0024 +#define SPEAR320_PLGPIO_WDATA 0x0034 +#define SPEAR320_PLGPIO_DIR 0x0044 +#define SPEAR320_PLGPIO_RDATA 0x0054 +#define SPEAR320_PLGPIO_IE 0x0064 +#define SPEAR320_PLGPIO_MIS 0x0074#endif #define BASIC_GPIO_0 0
arch/arm/plat-spear/plgpio.c +34 -12
121 lines not on this page · raw message
Signature · 1 line
1.7.2.2
PATCH v2 64/69 SPEAr6xx: Rework Kconfig for single image solution
In reply to Viresh KUMAR--- arch/arm/mach-spear6xx/Kconfig | 15 ++++++++------- arch/arm/mach-spear6xx/Kconfig600 | 17 ----------------- 2 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 arch/arm/mach-spear6xx/Kconfig600
arch/arm/mach-spear6xx/Kconfig +8 -7
@@ -4,17 +4,18 @@ if ARCH_SPEAR6XX -choice - prompt "SPEAr6XX Family" - default MACH_SPEAR600 +menu "SPEAr6xx Implementations" +config BOARD_SPEAR600_EVB + bool "SPEAr600 Evaluation Board" + select MACH_SPEAR600 + help + Supports ST SPEAr600 Evaluation Board + +endmenu config MACH_SPEAR600 bool "SPEAr600" help Supports ST SPEAr600 Machine -endchoice - -# Adding SPEAr6XX machine specific configuration files -source "arch/arm/mach-spear6xx/Kconfig600" endif #ARCH_SPEAR6XX
arch/arm/mach-spear6xx/Kconfig600 deleted +0 -17
@@ -1,17 +0,0 @@ -# -# SPEAr600 machine configuration file -# - -if MACH_SPEAR600 - -choice - prompt "SPEAr600 Boards" - default BOARD_SPEAR600_EVB - -config BOARD_SPEAR600_EVB - bool "SPEAr600 Evaluation Board" - help - Supports ST SPEAr600 Evaluation Board -endchoice - -endif #MACH_SPEAR600
Signature · 1 line
1.7.2.2
PATCH v2 65/69 ST SPEAR6xx: renaming spear600_defconfig as spear6xx_defconfig
In reply to Viresh KUMAR---
.../{spear600_defconfig => spear6xx_defconfig} | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
rename arch/arm/configs/{spear600_defconfig => spear6xx_defconfig} (97%)arch/arm/configs/spear6xx_defconfig renamed from arch/arm/configs/spear600_defconfig +1 -1
@@ -8,6 +8,7 @@ CONFIG_MODULE_UNLOAD=y CONFIG_MODVERSIONS=y CONFIG_PLAT_SPEAR=y CONFIG_ARCH_SPEAR6XX=y +CONFIG_BOARD_SPEAR600_EVB=y CONFIG_BINFMT_MISC=y CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_BLK_DEV_RAM=y
@@ -22,7 +23,6 @@ CONFIG_MAX_RAW_DEVS=8192 CONFIG_GPIO_SYSFS=y CONFIG_GPIO_PL061=y # CONFIG_HWMON is not set -# CONFIG_VGA_CONSOLE is not set # CONFIG_HID_SUPPORT is not set # CONFIG_USB_SUPPORT is not set CONFIG_EXT2_FS=y
Signature · 1 line
1.7.2.2
PATCH v2 66/69 ST SPEAr13xx: Pass default padmux settings as parameter to spear13**_init routine
In reply to Viresh KUMARThis patch makes pmx_driver static to spear1300.c and spear1310.c, also now default setting of padmux are sent to spear1300_init and spear1310_init routines
--- arch/arm/mach-spear13xx/include/mach/generic.h | 8 ++++---- arch/arm/mach-spear13xx/spear1300.c | 9 +++++++-- arch/arm/mach-spear13xx/spear1300_evb.c | 7 +------ arch/arm/mach-spear13xx/spear1310.c | 9 +++++++-- arch/arm/mach-spear13xx/spear1310_evb.c | 7 +------ 5 files changed, 20 insertions(+), 20 deletions(-)
arch/arm/mach-spear13xx/include/mach/generic.h +4 -4
@@ -220,8 +220,6 @@ extern struct pmx_dev pmx_uart1_modem;#define SPEAR_GPT0_CHAN0_IRQ IRQ_GPT0_TMR0#define SPEAR_GPT0_CHAN1_IRQ IRQ_GPT0_TMR1 -extern struct pmx_driver pmx_driver; -/* Add spear13xx family device structure declarations here */ extern struct amba_device spear13xx_gpio_device[];extern struct amba_device spear13xx_ssp_device;
@@ -255,7 +253,8 @@ void spear13xx_secondary_startup(void);/* spear1300 declarations */ #ifdef CONFIG_MACH_SPEAR1300 /* Add spear1300 machine function declarations here */ -void __init spear1300_init (void ); +void __init spear1300_init (struct pmx_mode *pmx_mode,struct pmx_dev **pmx_devs, +u8 pmx_dev_count);#endif /* CONFIG_MACH_SPEAR1300 */
@@ -266,7 +265,8 @@ extern struct platform_device spear1310_can0_device;extern struct platform_device spear1310_can1_device;/* Add spear1310 machine function declarations here */ -void __init spear1310_init (void ); +void __init spear1310_init (struct pmx_mode *pmx_mode,struct pmx_dev **pmx_devs, +u8 pmx_dev_count);#endif /* CONFIG_MACH_SPEAR1310 */
arch/arm/mach-spear13xx/spear1300.c +7 -2
@@ -15,11 +15,12 @@#include <mach/spear.h> /* pmx driver structure */ -struct pmx_driver pmx_driver; +static struct pmx_driver pmx_driver;/* Add spear1300 specific devices here */ -void __init spear1300_init (void ) +void __init spear1300_init (struct pmx_mode *pmx_mode,struct pmx_dev **pmx_devs, +u8 pmx_dev_count) {int ret;
@@ -27,6 +28,10 @@ void __init spear1300_init(void)spear13xx_init ();/* pmx initialization */ + pmx_driver.mode = pmx_mode; + pmx_driver.devs = pmx_devs; + pmx_driver.devs_count = pmx_dev_count; + ret =pmx_register (&pmx_driver);if (ret)pr_err ("padmux: registeration failed. err no: %d\n" , ret);
arch/arm/mach-spear13xx/spear1300_evb.c +1 -6
@@ -122,11 +122,6 @@ static void __init spear1300_evb_init(void) {unsigned int i; -/* padmux initialization, must be done before spear1300_init */ - pmx_driver.mode =NULL ; - pmx_driver.devs = pmx_devs; - pmx_driver.devs_count =ARRAY_SIZE (pmx_devs); -/* set keyboard plat data */ kbd_set_plat_data (&spear13xx_kbd_device, &kbd_data);
@@ -136,7 +131,7 @@ static void __init spear1300_evb_init(void)nand_mach_init (FSMC_NAND_BW8 );/* call spear1300 machine init function */ -spear1300_init (); +spear1300_init (NULL , pmx_devs,ARRAY_SIZE (pmx_devs));/* Register slave devices on the I2C buses */ i2c_register_board_devices ();
arch/arm/mach-spear13xx/spear1310.c +7 -2
@@ -17,7 +17,7 @@#include <mach/hardware.h> /* pmx driver structure */ -struct pmx_driver pmx_driver; +static struct pmx_driver pmx_driver;/* Pad multiplexing for uart1_modem device */ static struct pmx_mux_reg pmx_uart1_modem_mux[] = {
@@ -393,7 +393,8 @@ struct platform_device spear1310_can1_device = { .resource = can1_resources, }; -void __init spear1310_init (void ) +void __init spear1310_init (struct pmx_mode *pmx_mode,struct pmx_dev **pmx_devs, +u8 pmx_dev_count) {int ret;
@@ -401,6 +402,10 @@ void __init spear1310_init(void)spear13xx_init ();/* pmx initialization */ + pmx_driver.mode = pmx_mode; + pmx_driver.devs = pmx_devs; + pmx_driver.devs_count = pmx_dev_count; + ret =pmx_register (&pmx_driver);if (ret)pr_err ("padmux: registeration failed. err no: %d\n" , ret);
arch/arm/mach-spear13xx/spear1310_evb.c +1 -6
@@ -133,11 +133,6 @@ static void __init spear1310_evb_init(void) {unsigned int i; -/* padmux initialization, must be done before spear1300_init */ - pmx_driver.mode =NULL ; - pmx_driver.devs = pmx_devs; - pmx_driver.devs_count =ARRAY_SIZE (pmx_devs); -/* set keyboard plat data */ kbd_set_plat_data (&spear13xx_kbd_device, &kbd_data);
@@ -147,7 +142,7 @@ static void __init spear1310_evb_init(void)nand_mach_init (FSMC_NAND_BW8 );/* call spear1310 machine init function */ -spear1310_init (); +spear1310_init (NULL , pmx_devs,ARRAY_SIZE (pmx_devs));/* Register slave devices on the I2C buses */ i2c_register_board_devices ();
Signature · 1 line
1.7.2.2
PATCH v2 67/69 ST SPEAr: Adding devices & clocks
In reply to Viresh KUMAR--- arch/arm/mach-spear13xx/clock.c | 39 ++++++++ arch/arm/mach-spear13xx/include/mach/generic.h | 7 ++ arch/arm/mach-spear13xx/include/mach/irqs.h | 10 +- arch/arm/mach-spear13xx/include/mach/spear1310.h | 34 +++++++ arch/arm/mach-spear13xx/spear1310.c | 107 ++++++++++++++++++++++ arch/arm/mach-spear13xx/spear1310_evb.c | 32 +++++++ arch/arm/mach-spear3xx/spear310_evb.c | 5 + arch/arm/mach-spear3xx/spear320_evb.c | 6 + 8 files changed, 235 insertions(+), 5 deletions(-)
arch/arm/mach-spear13xx/clock.c +39 -0
@@ -1025,6 +1025,40 @@ static struct clk gmac_phy4_clk = { .recalc = &follow_parent, }; +/* uart1 clock */ +static struct clk uart1_clk = { + .flags =ALWAYS_ENABLED , + .pclk = &ras_pclk_clk, + .recalc = &follow_parent, +}; + +/* uart2 clock */ +static struct clk uart2_clk = { + .flags =ALWAYS_ENABLED , + .pclk = &ras_pclk_clk, + .recalc = &follow_parent, +}; + +/* uart3 clock */ +static struct clk uart3_clk = { + .flags =ALWAYS_ENABLED , + .pclk = &ras_pclk_clk, + .recalc = &follow_parent, +}; + +/* uart4 clock */ +static struct clk uart4_clk = { + .flags =ALWAYS_ENABLED , + .pclk = &ras_pclk_clk, + .recalc = &follow_parent, +}; + +/* uart5 clock */ +static struct clk uart5_clk = { + .flags =ALWAYS_ENABLED , + .pclk = &ras_pclk_clk, + .recalc = &follow_parent, +};#endif static struct clk dummy_apb_pclk;
@@ -1138,6 +1172,11 @@ static struct clk_lookup spear1310_clk_lookups[] = { {.dev_id = "stmmacphy.2", .clk = &gmac_phy2_clk}, {.dev_id = "stmmacphy.3", .clk = &gmac_phy3_clk}, {.dev_id = "stmmacphy.4", .clk = &gmac_phy4_clk}, + {.dev_id = "uart1", .clk = &uart1_clk}, + {.dev_id = "uart2", .clk = &uart2_clk}, + {.dev_id = "uart3", .clk = &uart3_clk}, + {.dev_id = "uart4", .clk = &uart4_clk}, + {.dev_id = "uart5", .clk = &uart5_clk}, }; #endif
arch/arm/mach-spear13xx/include/mach/generic.h +7 -0
@@ -261,8 +261,15 @@ void __init spear1300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,/* spear1310 declarations */ #ifdef CONFIG_MACH_SPEAR1310 /* Add spear1310 machine device structure declarations here */ +extern struct amba_device spear1310_uart1_device; +extern struct amba_device spear1310_uart2_device; +extern struct amba_device spear1310_uart3_device; +extern struct amba_device spear1310_uart4_device; +extern struct amba_device spear1310_uart5_device;extern struct platform_device spear1310_can0_device;extern struct platform_device spear1310_can1_device; +extern struct platform_device spear1310_i2c1_device; +extern struct platform_device spear1310_ras_fsmc_nor_device;/* Add spear1310 machine function declarations here */ void __init spear1310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
arch/arm/mach-spear13xx/include/mach/irqs.h +5 -5
@@ -97,11 +97,11 @@#define IRQ_CCAN1 (IRQ_SHPI_START + 83)#define IRQ_TDM0 (IRQ_SHPI_START + 84)#define IRQ_TDM1 (IRQ_SHPI_START + 85) -#define IRQ_UART0 (IRQ_SHPI_START + 86) -#define IRQ_UART1 (IRQ_SHPI_START + 87) -#define IRQ_UART2 (IRQ_SHPI_START + 88) -#define IRQ_UART3 (IRQ_SHPI_START + 89) -#define IRQ_UART4 (IRQ_SHPI_START + 90) +#define IRQ_UART1 (IRQ_SHPI_START + 86) +#define IRQ_UART2 (IRQ_SHPI_START + 87) +#define IRQ_UART3 (IRQ_SHPI_START + 88) +#define IRQ_UART4 (IRQ_SHPI_START + 89) +#define IRQ_UART5 (IRQ_SHPI_START + 90)#define IRQ_I2C_CNTR (IRQ_SHPI_START + 91)#define IRQ_GMAC0_SBD (IRQ_SHPI_START + 92)#define IRQ_GMAC0_PMT (IRQ_SHPI_START + 93)
arch/arm/mach-spear13xx/include/mach/spear1310.h +34 -0
@@ -16,9 +16,33 @@#ifndef __MACH_SPEAR1310_H#define __MACH_SPEAR1310_H +#define SPEAR1310_TDM_E1_0_BASE UL(0x6C200000) +#define SPEAR1310_TDM_E1_1_BASE UL(0x6C300000) +#define SPEAR1310_RS485_0_BASE UL(0x6C400000) +#define SPEAR1310_RS485_1_BASE UL(0x6C500000) +#define SPEAR1310_RAS_BASE UL(0x6C800000) +#define SPEAR1310_GETH1_BASE UL(0x6D000000) +#define SPEAR1310_GETH2_BASE UL(0x6D100000) +#define SPEAR1310_GETH3_BASE UL(0x6D200000) +#define SPEAR1310_GETH4_BASE UL(0x6D300000) +#define SPEAR1310_UART1_BASE UL(0x6D400000) +#define SPEAR1310_UART2_BASE UL(0x6D500000) +#define SPEAR1310_UART3_BASE UL(0x6D600000) +#define SPEAR1310_UART4_BASE UL(0x6D700000) +#define SPEAR1310_UART5_BASE UL(0x6D800000) +#define SPEAR1310_I2C1_BASE UL(0x6D900000)#define SPEAR1310_CAN0_BASE UL(0x6DA00000)#define SPEAR1310_CAN1_BASE UL(0x6DB00000)#define SPEAR1310_RAS_BASE UL(0x6C800000) +#define SPEAR1310_GETH1_BASE UL(0x6D000000) +#define SPEAR1310_GETH2_BASE UL(0x6D100000) +#define SPEAR1310_GETH3_BASE UL(0x6D200000) +#define SPEAR1310_GETH4_BASE UL(0x6D300000) +#define SPEAR1310_FSMC1_CS0_BASE UL(0x70000000) +#define SPEAR1310_FSMC1_CS1_BASE UL(0x74000000) +#define SPEAR1310_FSMC1_CS2_BASE UL(0x78000000) +#define SPEAR1310_FSMC1_CS3_BASE UL(0x7C000000) +#define SPEAR1310_FSMC1_BASE UL(0x6FF00000)/* RAS Area Control Register */ #define SPEAR1310_RAS_CTRL_REG0 (SPEAR1310_RAS_BASE + 0x0)
@@ -26,6 +50,16 @@#define SPEAR1310_PHY_CLK_MASK 0xF#define SPEAR1310_PHY_CLK_SHIFT 0 +#define RAS_FSMC_MODE_MASK 0x3 +#define RAS_FSMC_MODE_NOR 0 +#define RAS_FSMC_MODE_NAND 1 +#define RAS_FSMC_MODE_SRAM 2 +#define RAS_FSMC_WIDTH_MASK 0x30 +#define RAS_FSMC_WIDTH_8 0x00 +#define RAS_FSMC_WIDTH_16 0x10 +#define RAS_FSMC_WIDTH_32 0x20 +#define RAS_FSMC_CS_SPLIT 0x40 +#endif /* __MACH_SPEAR1310_H */ #endif /* CONFIG_MACH_SPEAR1310 */
arch/arm/mach-spear13xx/spear1310.c +107 -0
125 lines not on this page · raw message
arch/arm/mach-spear13xx/spear1310_evb.c +32 -0
@@ -67,6 +67,13 @@ static struct amba_device *amba_devs[] __initdata = { &spear13xx_gpio_device[1 ], &spear13xx_ssp_device, &spear13xx_uart_device, + +/* spear1310 specific devices */ + &spear1310_uart1_device, + &spear1310_uart2_device, + &spear1310_uart3_device, + &spear1310_uart4_device, + &spear1310_uart5_device, }; static struct platform_device *plat_devs[] __initdata = {
@@ -86,6 +93,7 @@ static struct platform_device *plat_devs[] __initdata = {/* spear1310 specific devices */ &spear1310_can0_device, &spear1310_can1_device, + &spear1310_i2c1_device, };/* keyboard specific platform data */
@@ -129,6 +137,23 @@ int spear1310_pcie_port_is_host(int port) }#endif +static void __init ras_fsmc_config (u32 mode,u32 width) +{ +u32 val, *address; + + address =ioremap (SPEAR1310_RAS_CTRL_REG0 ,SZ_16 ); + + val =readl (address); + val &= ~(RAS_FSMC_MODE_MASK |RAS_FSMC_WIDTH_MASK ); + val |= mode; + val |= width; + val |=RAS_FSMC_CS_SPLIT ; + +writel (val, address); + +iounmap (address); +} +static void __init spear1310_evb_init (void ) {unsigned int i;
@@ -153,6 +178,8 @@ static void __init spear1310_evb_init(void)/* initialize fsmc related data in fsmc plat data */ fsmc_init_board_info (&spear13xx_fsmc_nor_device, partition_info,ARRAY_SIZE (partition_info),FSMC_FLASH_WIDTH8 ); +fsmc_init_board_info (&spear1310_ras_fsmc_nor_device,NULL , +0 ,FSMC_FLASH_WIDTH16 );/* Initialize fsmc regiters */ fsmc_nor_init(&spear13xx_fsmc_nor_device, SPEAR13XX_FSMC_BASE, 0,
@@ -171,6 +198,11 @@ static void __init spear1310_evb_init(void)for (i =0 ; i <ARRAY_SIZE (amba_devs); i++)amba_device_register (amba_devs[i], &iomem_resource); +/* ras fsmc init */ +ras_fsmc_config (RAS_FSMC_MODE_NOR ,RAS_FSMC_WIDTH_16 ); +fsmc_nor_init (&spear1310_ras_fsmc_nor_device,SPEAR1310_FSMC1_BASE ,3 , +FSMC_FLASH_WIDTH16 ); +spi_init (); }
arch/arm/mach-spear3xx/spear310_evb.c +5 -0
@@ -75,6 +75,11 @@ static struct amba_device *amba_devs[] __initdata = { &spear3xx_wdt_device,/* spear310 specific devices */ + &spear310_uart1_device, + &spear310_uart2_device, + &spear310_uart3_device, + &spear310_uart4_device, + &spear310_uart5_device, }; static struct platform_device *plat_devs[] __initdata = {
arch/arm/mach-spear3xx/spear320_evb.c +6 -0
@@ -68,11 +68,16 @@ static struct pmx_dev *pmx_devs[] = {static struct amba_device *amba_devs[]__initdata = {/* spear3xx specific devices */ &spear3xx_gpio_device, + &spear3xx_ssp0_device, &spear3xx_uart_device, &spear3xx_wdt_device,/* spear320 specific devices */ &spear320_clcd_device, + &spear320_ssp_device[0 ], + &spear320_ssp_device[1 ], + &spear320_uart1_device, + &spear320_uart2_device, };static struct platform_device *plat_devs[]__initdata = {
@@ -87,6 +92,7 @@ static struct platform_device *plat_devs[] __initdata = {/* spear320 specific devices */ &spear320_can0_device, &spear320_can1_device, + &spear320_emi_nor_device, &spear320_i2c1_device, &spear320_nand_device, &spear320_plgpio_device,
Signature · 1 line
1.7.2.2
PATCH v2 68/69 ST SPEAr: Adding information in Documentation/ and MAINTAINERS
In reply to Viresh KUMARFrom: Shiraz Hashim <[email protected]>
--- Documentation/arm/SPEAr/overview.txt | 34 +++++++++++++++++++++++----------- MAINTAINERS | 6 ++++++ 2 files changed, 29 insertions(+), 11 deletions(-)
Documentation/arm/SPEAr/overview.txt +23 -11
@@ -9,8 +9,9 @@ Introduction The ST Microelectronics SPEAr range of ARM9/CortexA9 System-on-Chip CPUs are supported by the 'spear' platform of ARM Linux. Currently SPEAr300, - SPEAr310, SPEAr320 and SPEAr600 SOCs are supported. Support for the SPEAr13XX - series is in progress. + SPEAr310, SPEAr320, SPEAr600, SPEAr1300 and SPEAr1310 SOCs are supported. + SPEAr3XX and SPEAr6XX are based on ARM9 whereas SPEAr13XX is based on latest + ARM Cortex A9 CPUs. Hierarchy in SPEAr is as follows:
@@ -27,16 +28,25 @@ Introduction - SPEAr600_EVB (Evaluation Board) - SPEAr13XX (13XX SOC series, based on ARM CORTEXA9) - SPEAr1300 (SOC) + - SPEAr1300_EVB (Evaluation Board) + - SPEAr1310 (SOC) + - SPEAr1310_EVB (Evaluation Board) Configuration ------------- - A generic configuration is provided for each machine, and can be used as the + A generic configuration is provided for each machine family, and can be used as the default by - make spear600_defconfig - make spear300_defconfig - make spear310_defconfig - make spear320_defconfig + #make ARCH=arm spear13xx_defconfig + #make ARCH=arm spear3xx_defconfig + #make ARCH=arm spear6xx_defconfig + + Compilation + ----------- + + After applying default configuration, Linux kernel for SPEAr architecture + can be compiled as + #make ARCH=arm CROSS_COMPILE=arm-linux- uImage Layout ------
@@ -48,13 +58,15 @@ Introduction Each machine series have a directory with name arch/arm/mach-spear followed by series name. Like mach-spear3xx, mach-spear6xx and mach-spear13xx. - Common file for machines of spear3xx family is mach-spear3xx/spear3xx.c and for - spear6xx is mach-spear6xx/spear6xx.c. mach-spear* also contain soc/machine + Common file for machines of spear3xx family is mach-spear3xx/spear3xx.c, for + spear6xx is mach-spear6xx/spear6xx.c and similarly for spear13xx is + mach-spear13xx/spear13xx.c. mach-spear* also contain soc/machine specific files, like spear300.c, spear310.c, spear320.c and spear600.c. - mach-spear* also contains board specific files for each machine type. + Board specific files for each machine type is also contained in mach-spear* + folder. Document Author --------------- - Viresh Kumar, (c) 2010 ST Microelectronics + Viresh Kumar, Shiraz Hashim (c) 2010 ST Microelectronics
MAINTAINERS +6 -0
@@ -5462,6 +5462,12 @@ W: http://www.st.com/spear S: Maintained F: arch/arm/plat-spear/ +SPEAR13XX MACHINE SUPPORT +M: Shiraz Hashim <[email protected]> +W: http://www.st.com/spear +S: Maintained +F: arch/arm/mach-spear13xx/ + SPEAR3XX MACHINE SUPPORT M: Viresh Kumar <[email protected]> W: http://www.st.com/spear
Signature · 1 line
1.7.2.2
PATCH v2 69/69 ST SPEAr: Updating defconfigs
In reply to Viresh KUMAR--- arch/arm/configs/spear13xx_defconfig | 78 ++++++++++++++++++++++++++++++--- arch/arm/configs/spear3xx_defconfig | 80 +++++++++++++++++++++++++++++++--- arch/arm/configs/spear6xx_defconfig | 72 ++++++++++++++++++++++++++++--- 3 files changed, 211 insertions(+), 19 deletions(-)
arch/arm/configs/spear13xx_defconfig +72 -6
@@ -10,31 +10,94 @@ CONFIG_PLAT_SPEAR=y CONFIG_ARCH_SPEAR13XX=y CONFIG_BOARD_SPEAR1300_EVB=y CONFIG_BOARD_SPEAR1310_EVB=y +CONFIG_PCI=y +CONFIG_PCI_MSI=y +CONFIG_PCIEPORTBUS=y +# CONFIG_PCIEAER is not set CONFIG_SMP=y CONFIG_NR_CPUS=2 CONFIG_AEABI=y +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_STAT_DETAILS=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_VFP=y CONFIG_BINFMT_MISC=y +CONFIG_PM=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_NET_IPIP=y +CONFIG_ARPD=y +# CONFIG_IPV6 is not set +# CONFIG_WIRELESS is not set CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y CONFIG_MTD=y CONFIG_MTD_CONCAT=y CONFIG_MTD_PARTITIONS=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_CHAR=y CONFIG_MTD_BLOCK=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CFI_INTELEXT=y +CONFIG_MTD_CFI_STAA=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_M25P80=y +# CONFIG_M25PXX_USE_FAST_READ is not set +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_FSMC=y CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=16384 +CONFIG_SCSI=y +CONFIG_BLK_DEV_SD=y +CONFIG_CHR_DEV_ST=y +CONFIG_CHR_DEV_OSST=y +CONFIG_BLK_DEV_SR=y +CONFIG_CHR_DEV_SG=y +CONFIG_CHR_DEV_SCH=y +CONFIG_NETDEVICES=y +# CONFIG_WLAN is not set CONFIG_INPUT_FF_MEMLESS=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set -# CONFIG_INPUT_KEYBOARD is not set +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_EVBUG=y +# CONFIG_KEYBOARD_ATKBD is not set +CONFIG_KEYBOARD_SPEAR=y # CONFIG_INPUT_MOUSE is not set CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y # CONFIG_LEGACY_PTYS is not set CONFIG_RAW_DRIVER=y CONFIG_MAX_RAW_DEVS=8192 +CONFIG_I2C=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_DESIGNWARE=y +CONFIG_SPI=y +CONFIG_SPI_PL022=y +CONFIG_SPI_SPIDEV=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_PL061=y # CONFIG_HWMON is not set # CONFIG_HID_SUPPORT is not set -# CONFIG_USB_SUPPORT is not set +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_TT_NEWSCHED is not set +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_USB_TEST=y +CONFIG_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SPEAR=y +CONFIG_RTC_CLASS=y CONFIG_EXT2_FS=y CONFIG_EXT2_FS_XATTR=y CONFIG_EXT2_FS_SECURITY=y
@@ -42,16 +105,18 @@ CONFIG_EXT3_FS=y # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set CONFIG_EXT3_FS_SECURITY=y CONFIG_AUTOFS4_FS=m -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y CONFIG_FAT_DEFAULT_IOCHARSET="ascii" CONFIG_TMPFS=y CONFIG_JFFS2_FS=y +CONFIG_NFS_FS=y +CONFIG_ROOT_NFS=y +# CONFIG_RPCSEC_GSS_KRB5 is not set CONFIG_PARTITION_ADVANCED=y -CONFIG_NLS=y CONFIG_NLS_DEFAULT="utf8" CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_ASCII=m +CONFIG_NLS_ASCII=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_KERNEL=y
@@ -59,3 +124,4 @@ CONFIG_DETECT_HUNG_TASK=y CONFIG_DEBUG_SPINLOCK=y CONFIG_DEBUG_SPINLOCK_SLEEP=y CONFIG_DEBUG_INFO=y +# CONFIG_ARM_UNWIND is not set
arch/arm/configs/spear3xx_defconfig +73 -7
116 lines not on this page · raw message
arch/arm/configs/spear6xx_defconfig +66 -6
106 lines not on this page · raw message
Signature · 1 line
1.7.2.2
Re: [PATCH V2 62/69] ST SPEAr: Appending spear3** with global structures
In reply to Viresh KUMARQuoted 11 lines · Viresh KUMAR
Signed-off-by Viresh Kumar <[email protected]>---
?arch/arm/mach-spear3xx/include/mach/generic.h | ?140 ++++++++++++------------ ?arch/arm/mach-spear3xx/spear300.c ? ? ? ? ? ? | ? 42 ++++---- ?arch/arm/mach-spear3xx/spear300_evb.c ? ? ? ? | ? 43 ++++---- ?arch/arm/mach-spear3xx/spear310.c ? ? ? ? ? ? | ? 16 ++-- ?arch/arm/mach-spear3xx/spear310_evb.c ? ? ? ? | ? 37 ++++--- ?arch/arm/mach-spear3xx/spear320.c ? ? ? ? ? ? | ? 32 +++--- ?arch/arm/mach-spear3xx/spear320_evb.c ? ? ? ? | ? 50 +++++---- ?arch/arm/mach-spear3xx/spear3xx.c ? ? ? ? ? ? | ? 20 ++-- ?arch/arm/plat-spear/include/plat/spi.h ? ? ? ?| ? ?2 +-
Quoted 1 line
?9 files changed, 193 insertions(+), 189 deletions(-)
Hello everybody,
I have used an latest patch on git for sending this patch series. I think there is some bug
there, due to which all of you have received some mails which are not intended for all of you.
There was a bugfix in git which enables to send mail to "recipients mentioned in TO field", of patch
itself.
After creating patches (with git format-patch ---), i have added To and CC lists in patches.
But when i sent patches the TO field was carried away in later patches too. So due to this
all patches send after rtc patches have following recipients added:
rtc-linux at googlegroups.com,
a.zummo at towertech.it. Similarly for other patches too.
Once again sorry for this.
--
viresh
Re: [PATCH V2 62/69] ST SPEAr: Appending spear3** with global structures
Quoted 10 lines · viresh kumar
Hello everybody,
I have used an latest patch on git for sending this patch series. I think there is some bug
there, due to which all of you have received some mails which are not intended for all of you.
There was a bugfix in git which enables to send mail to "recipients mentioned in TO field", of patch
itself.
Quoted 8 lines
After creating patches (with git format-patch ---), i have added To and CC lists in patches.
But when i sent patches the TO field was carried away in later patches too. So due to this
all patches send after rtc patches have following recipients added:
rtc-linux at googlegroups.com,
a.zummo at towertech.it. Similarly for other patches too.
Hello,
Should i resend my patches (with correct list of people in To:)??
Signature · 1 line
viresh
PATCH v2 16/69 rtc: Adding support for spear rtc
In reply to Viresh KUMARQuoted 4 lines · On Fri, 1 Oct 2010 17:25:36 +0530 Viresh KUMAR <[email protected]> wrote:
From: Rajeev Kumar <[email protected]>
Signed-off-by Rajeev Kumar <[email protected]>Signed-off-by Viresh Kumar <[email protected]>
nack. you don't need the ioctl op. please do not send 69+ irrelevant patches to the rtc mailing list.
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
PATCH v2 16/69 rtc: Adding support for spear rtc
Quoted 1 line · Alessandro Zummo
please do not send 69+ irrelevant patches to the rtc mailing list.
Alessandro,
I have already replied to Patch62/69 for this issue.
I have used an latest patch on git for sending this patch series. I think there is some bug
there, due to which all of you have received some mails which are not intended for all of you.
There was a bugfix in git which enables to send mail to "recipients mentioned in TO field", of patch
itself.
After creating patches (with git format-patch ---), i have added To and CC lists in patches.
But when i sent patches the TO field was carried away in later patches too. So due to this
all patches send after rtc patches have following recipients added:
rtc-linux at googlegroups.com,
a.zummo at towertech.it. Similarly for other patches too.
Once again sorry for this.
Signature · 1 line
viresh
Dmitry Torokhov
maintainerPATCH v2 21/69 Keyboard: Adding support for spear-keyboard
In reply to Viresh KUMARHi Rajeev,
Quoted 17 lines · Viresh KUMAR
drivers/input/keyboard/spear-keyboard.c new file +17
-0+ +#define KEY_MASK 0xFF000000 +#define KEY_VALUE 0x00FFFFFF +#define ROW_MASK 0xF0 +#define COLUMN_MASK 0x0F +#define ROW_SHIFT 4 + +struct spear_kbd { +struct input_dev *input; +void __iomem *io_base;/* Keyboard Base Address */ +struct clk *clk; +u8 last_key ; +u8 last_event; +int *keymap; +int keymapsize; +}; +/* TODO: Need to optimize this function */
drivers/input/keyboard/spear-keyboard.c line 75
Quoted 10 lines
drivers/input/keyboard/spear-keyboard.c new file +10
-0+static inline int get_key_value (struct spear_kbd *dev,int row,int col) +{ +int i, key; + + key =KEY (row, col,0 ); +for (i =0 ; i < dev->keymapsize; i++) +if ((dev->keymap[i] &KEY_MASK ) == key) +return dev->keymap[i] &KEY_VALUE ; +return -ENOKEY ; +}
As discussed previously I'd like to see the driver using as much of matrix_keypad infrastructure as practical and also to see the initial keypad copied into the spear_kbd structure to ensure that the board code could be made const and bind/rebind of the device would restore the original keymap.
Thanks.
Signature · 1 line
Dmitry
PATCH v2 21/69 Keyboard: Adding support for spear-keyboard
Quoted 6 lines · Dmitry Torokhov
As discussed previously I'd like to see the driver using as much of
matrix_keypadinfrastructure as practical and also to see the initial keypad copied into thespear_kbdstructure to ensure that the board code could be made const and bind/rebind of the device would restore the original keymap.
Dmitry,
As suggested in V1, we have used KEY() macro from matrix_keypad.h file. Also we are allocating memory for keymap in driver itself in probe. Then we are copying keymap in from plat data. This makes it restore to original keymap on every bind/rebind of device.
Is there anything else we need to do??
Signature · 1 line
viresh
Dmitry Torokhov
maintainerPATCH v2 21/69 Keyboard: Adding support for spear-keyboard
Quoted 8 lines · viresh kumar
Quoted 6 lines · Dmitry Torokhov
As discussed previously I'd like to see the driver using as much of
matrix_keypadinfrastructure as practical and also to see the initial keypad copied into thespear_kbdstructure to ensure that the board code could be made const and bind/rebind of the device would restore the original keymap.
Quoted 9 lines
Dmitry,
As suggested in V1, we have used
KEY()macro frommatrix_keypad.hfile. Also we are allocating memory for keymap in driver itself in probe. Then we are copying keymap in from plat data. This makes it restore to original keymap on every bind/rebind of device.Is there anything else we need to do??
Viresh,
Sorry, did not look far enough in the patch and missed the separate allocation. But do you really want to allocate it separately? I think the following patch simplifies and speeds up things at the expense of slightly larger keymap structure.
There are also fixes for proper __devinit/__devexit markups, locking of open/close vs suspend/resume, keymap can be changed from userspace via EVIOCSKEYCODE and bunch of other changes.
Thanks.
Signature · 11 lines
Dmitry Input: spear-kbd - assorted changes Signed-off-by: Dmitry Torokhov <[email protected]> --- arch/arm/plat-spear/include/plat/keyboard.h | 3 drivers/input/keyboard/spear-keyboard.c | 311 +++++++++++++-------------- 2 files changed, 149 insertions(+), 165 deletions(-)
arch/arm/plat-spear/include/plat/keyboard.h +1 -2
@@ -130,8 +130,7 @@ int name[] = {\* keymaps to drivers that implement keyboards. */ struct kbd_platform_data { -int *keymap; -unsigned int keymapsize; +const struct matrix_keymap_data *keymap;bool rep; };
drivers/input/keyboard/spear-keyboard.c +148 -163
432 lines not on this page · raw message
PATCH v2 21/69 Keyboard: Adding support for spear-keyboard
Quoted 15 lines · Dmitry Torokhov
Sorry, did not look far enough in the patch and missed the separate allocation. But do you really want to allocate it separately? I think the following patch simplifies and speeds up things at the expense of slightly larger keymap structure.
There are also fixes for proper __devinit/__devexit markups, locking of open/close vs suspend/resume, keymap can be changed from userspace via EVIOCSKEYCODE and bunch of other changes.
Thanks.
--
Dmitry
Quoted 8 lines
Input: spear-kbd - assorted changes
Signed-off-by Dmitry Torokhov <[email protected]>---
arch/arm/plat-spear/include/plat/keyboard.h | 3 drivers/input/keyboard/spear-keyboard.c | 311 +++++++++++++-------------- 2 files changed, 149 insertions(+), 165 deletions(-)
Dmitry,
We are busy with other activities, and can't test it right now. But i have reviewed it and it looks fine to me.
Please include it in input-next repo. We will test it later on.
--
viresh
v2 cover Updating SPEAr Support
In reply to Viresh KUMARQuoted 14 lines · Viresh KUMAR
Following set of patches:
- updates SPEAr3xx, 6xx support
- Adds support for SPEAr13xx
- Removes Multiple defconfigs per machine familyChanges since V1:
- sev definitions moved tosystem.hand removed from spear and omap archs
- bug fix added in system controller filesp810.h
- Review Comments incorporated
- Driver and machine support are divided into separate patches
- Nand Driver is removed from patch list as it is already floated by Linus Walleij.
- Few later patches of SPEAr13xx Patches are merged with initial patches of SPEAr13xx
Quoted 8 lines
- Smaller Defconfigs are used instead of large.
- Clock renaming & minor corrections are moved to clock specific patches from peripheral machine support patches.
- Removed Commented code related to SPI
- [PATCH] Incrementing theecc_posarray to contain 128 char - is removed from list
- Board specific code is moved to *evb.c files from machine files for EMI NOR
- replaced readl with__raw_readlinuncompress.hin plat-spear/include/plat/
Russell,
Are there open points in these v2 patches or are they fine?
Signature · 1 line
viresh
PATCH v2 19/69 USB host: Adding USB ehci & ohci support for spear platform
In reply to Viresh KUMARQuoted 6 lines · Viresh KUMAR
From: Deepak Sikri <[email protected]>
This patch adds support for ehci and ohci controller in the SPEAr platform
Signed-off-by Deepak Sikri <[email protected]>Signed-off-by Viresh Kumar <[email protected]>
Quoted 10 lines
--- drivers/usb/Kconfig | 2 + drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-spear.c | 211 ++++++++++++++++++++++++++++++++++++ drivers/usb/host/ohci-hcd.c | 5 + drivers/usb/host/ohci-spear.c | 240 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 463 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/host/ehci-spear.c create mode 100644 drivers/usb/host/ohci-spear.c
David,
Does this patch looks fine to you or are there any more suggestions??
--
viresh.
PATCH v2 25/69 ST SPEAr: Add smi driver for serial NOR flash
In reply to Viresh KUMARQuoted 12 lines · Viresh KUMAR
From: Shiraz Hashim <[email protected]>
SPEAr platforms(spear3xx/spear6xx/spear13xx) provide SMI(Serial Memory Interface) controller to access serial NOR flash. SMI provides a simple interface for SPI/serial NOR flashes and has certain inbuilt commands and features to support these flashes easily. It also makes it possible to map an address range in order to directly access (read/write) the SNOR over address bus. This patch intends to provide serial nor driver support for spear platforms which are accessed through SMI.
Signed-off-by Shiraz Hashim <[email protected]>Signed-off-by Viresh Kumar <[email protected]>
Quoted 8 lines
--- arch/arm/plat-spear/include/plat/smi.h | 68 ++ drivers/mtd/devices/Kconfig | 7 + drivers/mtd/devices/Makefile | 1 + drivers/mtd/devices/spear_smi.c | 1122 ++++++++++++++++++++++++++++++++ 4 files changed, 1198 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-spear/include/plat/smi.h create mode 100644 drivers/mtd/devices/spear_smi.c
David,
Any review comments on this patch??
Signature · 1 line
viresh
Re: [PATCH V2 45/69] ST SPEAr: PCIE gadget suppport
In reply to Viresh KUMARQuoted 8 lines · Viresh KUMAR
From: Pratyush Anand <[email protected]>
This is a configurable gadget. can be configured by sysfs interface. Any IP available at PCIE bus can be programmed to be used by host controller.It supoorts both INTX and MSI.
By default, gadget is configured for INTX and SYSRAM1 is mapped to BAR0 with size0x1000
Quoted 8 lines
Signed-off-by Pratyush Anand <[email protected]>Signed-off-by Viresh Kumar <[email protected]>--- drivers/misc/Kconfig | 10 + drivers/misc/Makefile | 1 + drivers/misc/spear13xx_pcie_gadget.c | 888 ++++++++++++++++++++++++++++++++++ 3 files changed, 899 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/spear13xx_pcie_gadget.c
Andrew,
Any review comments on this patch??
Signature · 1 line
viresh
Re: [PATCH V2 45/69] ST SPEAr: PCIE gadget suppport
In reply to Viresh KUMARQuoted 9 lines · On Fri, 1 Oct 2010 17:26:05 +0530 Viresh KUMAR <[email protected]> wrote:
From: Pratyush Anand <[email protected]>
This is a configurable gadget. can be configured by sysfs interface. Any IP available at PCIE bus can be programmed to be used by host controller.It supoorts both INTX and MSI.
By default, gadget is configured for INTX and SYSRAM1 is mapped to BAR0 with size0x1000
Quoted 3 lines
...
+static void
enable_dbi_access(struct pcie_app_reg *app_reg)
app_reg should have the __iomem tag.
drivers/misc/spear13xx_pcie_gadget.c line 61
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+{ +/* Enable DBI access */ +writel (readl (&app_reg->slv_armisc) | (1 <<AXI_OP_DBI_ACCESS_ID ), + &app_reg->slv_armisc); +writel (readl (&app_reg->slv_awmisc) | (1 <<AXI_OP_DBI_ACCESS_ID ), + &app_reg->slv_awmisc); + +} + +static void disable_dbi_access (struct pcie_app_reg *app_reg)
ditto
Quoted 4 lines
drivers/misc/spear13xx_pcie_gadget.c new file +4
-0+{ +/* disable DBI access */ +writel (readl (&app_reg->slv_armisc) & ~(1 <<AXI_OP_DBI_ACCESS_ID ), + &app_reg->slv_armisc);
drivers/misc/spear13xx_pcie_gadget.c line 75
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+writel (readl (&app_reg->slv_awmisc) & ~(1 <<AXI_OP_DBI_ACCESS_ID ), + &app_reg->slv_awmisc); + +} + +static void spear_dbi_read_reg (struct spear_pcie_gadget_config *config, +int where,int size,u32 *val) +{ +struct pcie_app_reg *app_reg + = (struct pcie_app_reg *) config->va_app_base;
ditto
Quoted 13 lines
drivers/misc/spear13xx_pcie_gadget.c new file +13
-0+u32 va_address; + +/* Enable DBI access */ +enable_dbi_access (app_reg); + + va_address = (u32 )config->va_dbi_base + (where & ~0x3 ); + + *val =readl (va_address); + +if (size ==1 ) + *val = (*val >> (8 * (where &3 ))) &0xff ; +else if (size ==2 ) + *val = (*val >> (8 * (where &3 ))) &0xffff ;
drivers/misc/spear13xx_pcie_gadget.c line 98
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ +/* Disable DBI access */ +disable_dbi_access (app_reg); +} + +static void spear_dbi_write_reg (struct spear_pcie_gadget_config *config, +int where,int size,u32 val) +{ +struct pcie_app_reg *app_reg + = (struct pcie_app_reg *) config->va_app_base;
etc.
Quoted 12 lines
drivers/misc/spear13xx_pcie_gadget.c new file +12
-0+u32 va_address; + +/* Enable DBI access */ +enable_dbi_access (app_reg); + + va_address = (u32 )config->va_dbi_base + (where & ~0x3 ); + +if (size ==4 ) +writel (val, va_address); +else if (size ==2 ) +writew (val, va_address + (where &2 )); +else if (size ==1 )
drivers/misc/spear13xx_pcie_gadget.c line 169
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+writeb (val, va_address + (where &3 )); + +/* Disable DBI access */ +disable_dbi_access (app_reg); +} + +/**
This token is specifically used to introduce a kerneldoc comment, but this wasn't a kerneldoc comment.
Quoted 17 lines
+ * Tell if a device supports a given PCI capability.
+ * Returns the address of the requested capability structure within the
+ * device's PCI configuration space or 0 in case the device does not
+ * support it. Possible values for @cap:
+ *
+ * %PCI_CAP_ID_PM Power Management
+ * %PCI_CAP_ID_AGP Accelerated Graphics Port
+ * %PCI_CAP_ID_VPD Vital Product Data
+ * %PCI_CAP_ID_SLOTID Slot Identification
+ * %PCI_CAP_ID_MSI Message Signalled Interrupts
+ * %PCI_CAP_ID_CHSWP CompactPCI HotSwap
+ * %PCI_CAP_ID_PCIX PCI-X
+ * %PCI_CAP_ID_EXP PCI Express
+ */...
drivers/misc/spear13xx_pcie_gadget.c line 209
Quoted 7 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+ +static ssize_t pcie_gadget_show_link (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base;
Check all the __iomems;
Quoted 5 lines
drivers/misc/spear13xx_pcie_gadget.c new file +5
-0+if (readl (&app_reg->app_status_1) & ((u32 )1 <<XMLH_LINK_UP_ID )) +return sprintf (buf,"UP" ); +else +return sprintf (buf,"DOWN" ); +}
drivers/misc/spear13xx_pcie_gadget.c line 225
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ +static ssize_t pcie_gadget_store_link (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base; +char link[10 ]; + +if (sscanf (buf,"%s" , link) !=1 )
What happens if strlen(buf) >= 10?
Quoted 13 lines
drivers/misc/spear13xx_pcie_gadget.c new file +12
-0+return -EINVAL ; + +if (!strcmp (link,"UP" )) +writel (readl (&app_reg->app_ctrl_0) | (1 <<APP_LTSSM_ENABLE_ID ), + &app_reg->app_ctrl_0); +else +writel (readl (&app_reg->app_ctrl_0) + & ~(1 <<APP_LTSSM_ENABLE_ID ), + &app_reg->app_ctrl_0); +return count; +} +
drivers/misc/spear13xx_pcie_gadget.c line 256
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +8
-0+static ssize_t pcie_gadget_store_int_type (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +char int_type[10 ]; +u32 cap, vector, vec, flags; + +if (sscanf (buf,"%s" , int_type) !=1 )
ditto
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c new file +9
-0+return -EINVAL ; + +if (!strcmp (int_type,"INTA" )) +spear_dbi_write_reg (config,PCI_INTERRUPT_LINE ,1 ,1 ); + +else if (!strcmp (int_type,"MSI" )) { + vector = config->requested_msi; + vec =0 ; +while (vector >1 ) {
drivers/misc/spear13xx_pcie_gadget.c line 275
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ vector /=2 ; + vec++; + } +spear_dbi_write_reg (config,PCI_INTERRUPT_LINE ,1 ,0 ); + cap =pci_find_own_capability (config,PCI_CAP_ID_MSI ); +spear_dbi_read_reg (config, cap +PCI_MSI_FLAGS ,1 , &flags); + flags &= ~PCI_MSI_FLAGS_QMASK ; + flags |= vec <<1 ; +spear_dbi_write_reg (config, cap +PCI_MSI_FLAGS ,1 , flags); + }
No checking for unrecognised input?
Quoted 4 lines
drivers/misc/spear13xx_pcie_gadget.c new file +4
-0+strcpy (config->int_type, int_type); + +return count; +}
drivers/misc/spear13xx_pcie_gadget.c line 290
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ +static DEVICE_ATTR(int_type, S_IWUSR | S_IRUGO, pcie_gadget_show_int_type, + pcie_gadget_store_int_type); + +static ssize_t pcie_gadget_show_no_of_msi (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base;
__iomem
Quoted 21 lines
drivers/misc/spear13xx_pcie_gadget.c new file +19
-0+u32 cap, vector, vec, flags; + +if ((readl (&app_reg->msg_status) & (1 <<CFG_MSI_EN_ID )) + != (1 <<CFG_MSI_EN_ID )) + vector =0 ; +else { + cap =pci_find_own_capability (config,PCI_CAP_ID_MSI ); +spear_dbi_read_reg (config, cap +PCI_MSI_FLAGS ,1 , &flags); + flags &= ~PCI_MSI_FLAGS_QSIZE ; + vec = flags >>4 ; + vector =1 ; +while (vec--) + vector *=2 ; + } + config->configured_msi = vector; + +return sprintf (buf,"%u" , vector); +} +
drivers/misc/spear13xx_pcie_gadget.c line 334
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +9
-0+static ssize_t pcie_gadget_store_inta (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base; +int en; + +if (sscanf (buf,"%d" , &en) !=1 )
strict_strtoul() would be better. It will reject input of the form "42foo".
Quoted 14 lines
drivers/misc/spear13xx_pcie_gadget.c new file +14
-0+return -EINVAL ; + +if (en) +writel (readl (&app_reg->app_ctrl_0) | (1 <<SYS_INT_ID ), + &app_reg->app_ctrl_0); +else +writel (readl (&app_reg->app_ctrl_0) & ~(1 <<SYS_INT_ID ), + &app_reg->app_ctrl_0); + +return count; +} + +static DEVICE_ATTR(inta, S_IWUSR, NULL, pcie_gadget_store_inta); +
drivers/misc/spear13xx_pcie_gadget.c line 358
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+static ssize_t pcie_gadget_store_send_msi (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base; +int vector; +u32 ven_msi; + +if (sscanf (buf,"%d" , &vector) !=1 )
strict_strtoul().
Quoted 28 lines
drivers/misc/spear13xx_pcie_gadget.c new file +28
-0+return -EINVAL ; + +if (!config->configured_msi) +return -EINVAL ; + +if (vector >= config->configured_msi) +return -EINVAL ; + + ven_msi =readl (&app_reg->ven_msi_1); + ven_msi &= ~VEN_MSI_FUN_NUM_MASK ; + ven_msi |=0 <<VEN_MSI_FUN_NUM_ID ; + ven_msi &= ~VEN_MSI_TC_MASK ; + ven_msi |=0 <<VEN_MSI_TC_ID ; + ven_msi &= ~VEN_MSI_VECTOR_MASK ; + ven_msi |= vector <<VEN_MSI_VECTOR_ID ; + +/*generating interrupt for msi vector*/ + ven_msi |=VEN_MSI_REQ_EN ; +writel (ven_msi, &app_reg->ven_msi_1); +/*need to wait till this bit is cleared, it is not cleared +* autometically[Bug RTL] TBD*/ +udelay (1 ); + ven_msi &= ~VEN_MSI_REQ_EN ; +writel (ven_msi, &app_reg->ven_msi_1); + +return count; +} +
drivers/misc/spear13xx_pcie_gadget.c line 406
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+static ssize_t pcie_gadget_store_vendor_id (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +u32 id; + +if (sscanf (buf,"%x" , &id) !=1 )
strict_strtoul can be used here as well?
Quoted 7 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+return -EINVAL ; + +spear_dbi_write_reg (config,PCI_VENDOR_ID ,2 , id); + +return count; +} +
drivers/misc/spear13xx_pcie_gadget.c line 434
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+static ssize_t pcie_gadget_store_device_id (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +u32 id; + +if (sscanf (buf,"%x" , &id) !=1 )
etc.
Quoted 8 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+return -EINVAL ; + +spear_dbi_write_reg (config,PCI_DEVICE_ID ,2 , id); + +return count; +} +
drivers/misc/spear13xx_pcie_gadget.c line 460
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +8
-0+static ssize_t pcie_gadget_store_bar0_size (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +u32 size, pos, pos1; +u32 no_of_bit =0 ; + +if (sscanf (buf,"%x" , &size) !=1 )
etc.
Quoted 28 lines
drivers/misc/spear13xx_pcie_gadget.c new file +28
-0+return -EINVAL ; +/* as per PCIE specs, min bar size supported is 128 bytes. But +* our controller supports min as 256*/ +if (size <=0x100 ) + size =0x100 ; +/* max bar size is 1MB*/ +else if (size >=0x100000 ) + size =0x100000 ; +else { + pos =0 ; + pos1 =0 ; +while (pos <21 ) { + pos =find_next_bit ((unsigned long *)&size,21 , pos); +if (pos !=21 ) + pos1 = pos +1 ; + pos++; + no_of_bit++; + } +if (no_of_bit ==2 ) + pos1--; + + size =1 << pos1; + } + config->bar0_size = size; +spear_dbi_write_reg (config,PCIE_BAR0_MASK_REG ,4 , size -1 ); + +return count; +}
drivers/misc/spear13xx_pcie_gadget.c line 498
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+ +static ssize_t pcie_gadget_show_bar0_address (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base;
etc
Quoted 37 lines
drivers/misc/spear13xx_pcie_gadget.c new file +34
-0+u32 address =readl (&app_reg->pim0_mem_addr_start); + +return sprintf (buf,"%x" , address); +} + +static ssize_t pcie_gadget_show_help (struct device *dev, +struct device_attribute *attr,char *buf) +{ +char text[] ="\t\tlink read->ltssm status\n \ +link write->arg1 = UP to enable ltsmm DOWN to disable\n \ +int_type read->type of supported interrupt\n \ +int_type write->arg1 = interrupt type to be configured and\n \ +can be INTA, MSI or NO_INT\n \ +(select MSI only when you have programmed no_of_msi)\n \ +no_of_msi read->zero if MSI is not enabled by host\n \ +and positive value is the number of MSI vector granted\n \ +no_of_msi write->arg1 = number of MSI vector needed\n \ +inta write->arg1 = 1 to assert INTA and 0 to de-assert\n \ +send_msi write->arg1 = MSI vector to be send\n \ +vendor_id read->programmed vendor id (hex)\n\ +vendor_id write->arg1 = vendor id(hex) to be programmed\n \ +device_id read->programmed device id(hex)\n \ +device_id write->arg1 = device id(hex) to be programmed\n \ +bar0_size read->size of bar0 in hex\n \ +bar0_size write->arg1= size of bar0 in hex\n \ +(default bar0 size is 1000 (hex) bytes)\n \ +bar0_address read->address of bar0 mapped area in hex\n \ +bar0_address write->arg1 = address of bar0 mapped area in hex\n\ +(default mapping of bar0 is SYSRAM1(E0800000)\n \ +(always program bar size before bar address)\n \ +(kernel might modify bar size and address to align)\n \ +(read back bar size and address after writing to check)\n \ +bar0_rw_offset read->offset of bar0 for which bar0_data \n \ +will return value\n \
drivers/misc/spear13xx_pcie_gadget.c line 631
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ bar0_rw_offset write->arg1 = offset of bar0 for which\n \ + bar0_data will write value\n \ + bar0_data read->data at bar0_rw_offset\n \ + bar0_data write->arg1 = data to be written at\n \ + bar0_rw_offset\n"; + +int size = (sizeof (text) <PAGE_SIZE ) ?sizeof (text) :PAGE_SIZE ; + +return snprintf (buf, size,"%s" , text); +}
What the heck is this??
Quoted 59 lines
drivers/misc/spear13xx_pcie_gadget.c new file +56
-0+static DEVICE_ATTR(help, S_IRUGO, pcie_gadget_show_help, NULL); + +static struct attribute *pcie_gadget_attributes[] = { + &dev_attr_link.attr, + &dev_attr_int_type.attr, + &dev_attr_no_of_msi.attr, + &dev_attr_inta.attr, + &dev_attr_send_msi.attr, + &dev_attr_vendor_id.attr, + &dev_attr_device_id.attr, + &dev_attr_bar0_size.attr, + &dev_attr_bar0_address.attr, + &dev_attr_bar0_rw_offset.attr, + &dev_attr_bar0_data.attr, + &dev_attr_help.attr, +NULL +}; + +static int __devinit spear_pcie_gadget_probe (struct platform_device *pdev) +{ +struct resource *res0, *res1; +struct spear_pcie_gadget_config *config; +unsigned int status =0 ; +int irq; +struct clk *clk; + +/* get resource for application registers*/ + + res0 =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res0) { +dev_err (&pdev->dev,"no resource defined\n" ); +return -EBUSY ; + } +if (!request_mem_region (res0->start,resource_size (res0), + pdev->name)) { +dev_err (&pdev->dev,"pcie gadget region already claimed\n" ); +return -EBUSY ; + } +/* get resource for dbi registers*/ + + res1 =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); +if (!res1) { +dev_err (&pdev->dev,"no resource defined\n" ); + goto err_rel_res0; + } +if (!request_mem_region (res1->start,resource_size (res1), + pdev->name)) { +dev_err (&pdev->dev,"pcie gadget region already claimed\n" ); + goto err_rel_res0; + } + + config =kzalloc (sizeof (*config),GFP_KERNEL ); +if (!config) { +dev_err (&pdev->dev,"out of memory\n" ); + status = -ENOMEM ; + goto err_rel_res;
drivers/misc/spear13xx_pcie_gadget.c line 759
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ } + + config->va_app_base =ioremap (res0->start,resource_size (res0)); +if (!config->va_app_base) { +dev_err (&pdev->dev,"ioremap fail\n" ); + status = -ENOMEM ; + goto err_kzalloc; + } + + config->base = (void *)res1->start;
Is that __iomem?
Quoted 69 lines
drivers/misc/spear13xx_pcie_gadget.c new file +68
-0+ config->va_dbi_base =ioremap (res1->start,resource_size (res1)); +if (!config->va_dbi_base) { +dev_err (&pdev->dev,"ioremap fail\n" ); + status = -ENOMEM ; + goto err_iounmap_app; + } + +dev_set_drvdata (&pdev->dev, config); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { +dev_err (&pdev->dev,"no update irq?\n" ); + status = irq; + goto err_iounmap; + } + + status =request_irq (irq, spear_pcie_gadget_irq,0 , pdev->name,NULL ); +if (status) { +dev_err (&pdev->dev,"pcie gadget interrupt IRQ%d already \ +claimed\n" , irq); + goto err_get_irq; + } +/* Register sysfs hooks */ + status =sysfs_create_group (&pdev->dev.kobj, &pcie_gadget_attr_group); +if (status) + goto err_irq; + +/* init basic pcie application registers*/ +/* do not enable clock if it is PCIE0.Ideally , all controller should +* have been independent from others with respect to clock. But PCIE1 +* and 2 depends on PCIE0.So PCIE0 clk is provided during board init.*/ +if (pdev->id ==1 ) { +/* Ideally CFG Clock should have been also enabled here. But +* it is done currently during board init routne*/ + clk =clk_get_sys ("pcie1" ,NULL ); +if (!clk) { +pr_err ("%s:couldn't get clk for pcie1\n" , __func__); + goto err_irq; + } +if (clk_enable (clk)) { +pr_err ("%s:couldn't enable clk for pcie1\n" , __func__); + goto err_irq; + } + }else if (pdev->id ==2 ) { +/* Ideally CFG Clock should have been also enabled here. But +* it is done currently during board init routne*/ + clk =clk_get_sys ("pcie2" ,NULL ); +if (!clk) { +pr_err ("%s:couldn't get clk for pcie2\n" , __func__); + goto err_irq; + } +if (clk_enable (clk)) { +pr_err ("%s:couldn't enable clk for pcie2\n" , __func__); + goto err_irq; + } + } +spear13xx_pcie_device_init (config); + +return 0 ; +err_irq: +free_irq (irq,NULL ); +err_get_irq: +dev_set_drvdata (&pdev->dev,NULL ); +err_iounmap: +iounmap (config->va_dbi_base); +err_iounmap_app: +iounmap (config->va_app_base); +err_kzalloc:
drivers/misc/spear13xx_pcie_gadget.c
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +8
-0+kfree (config); +err_rel_res: +release_mem_region (res1->start,resource_size (res1)); +err_rel_res0: +release_mem_region (res0->start,resource_size (res0)); +return status; +} +
The driver implements a large, complex userspace interface and afaict that interface wasn't documented anywhere.
But the interface is the most important part of the driver! It should be documented in a permanent fashion so that reviewers can understand and review your proposed interface. They will want to do that before even looking at the code.
Re: [PATCH V2 45/69] ST SPEAr: PCIE gadget suppport
In reply to viresh kumarQuoted 18 lines · On Tue, 19 Oct 2010 11:29:20 +0530 viresh kumar <[email protected]> wrote:
Quoted 8 lines · Viresh KUMAR
From: Pratyush Anand <[email protected]>
This is a configurable gadget. can be configured by sysfs interface. Any IP available at PCIE bus can be programmed to be used by host controller.It supoorts both INTX and MSI.
By default, gadget is configured for INTX and SYSRAM1 is mapped to BAR0 with size0x1000Quoted 8 lines
Signed-off-by Pratyush Anand <[email protected]>Signed-off-by Viresh Kumar <[email protected]>--- drivers/misc/Kconfig | 10 + drivers/misc/Makefile | 1 + drivers/misc/spear13xx_pcie_gadget.c | 888 ++++++++++++++++++++++++++++++++++ 3 files changed, 899 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/spear13xx_pcie_gadget.c
Quoted 4 lines
Andrew,
Any review comments on this patch??
I looked.
I'd suggest cc'ing the PCI list and maintainer on future versions.
Re: [PATCH V2 45/69] ST SPEAr: PCIE gadget suppport
Quoted 7 lines · Andrew Morton
Quoted 4 lines
Quoted 4 lines
Andrew,
Any review comments on this patch??
I looked.
I'd suggest cc'ing the PCI list and maintainer on future versions.
Will do that.
Thanks
viresh
RE: [PATCH V2 45/69] ST SPEAr: PCIE gadget suppport
In reply to Andrew MortonQuoted 27 lines
-----Original Message-----
From: Andrew Morton [mailto:akpm at linux-foundation.org]
Sent: Wednesday, October 20, 2010 3:17 AM
To: Viresh KUMAR
Cc: linux-arm-kernel at lists.infradead.org; rtc-linux at googlegroups.com; a.zummo at towertech.it; dbrownell at users.sourceforge.net; linux- usb at vger.kernel.org; linux-input at vger.kernel.org; dmitry.torokhov at gmail.com; linux-mtd at lists.infradead.org; dwmw2 at infradead.org; linux-kernel at vger.kernel.org; Pratyush ANAND; Shiraz HASHIM; Vipin KUMAR; Deepak SIKRI; Armando VISCONTI; Vipul Kumar SAMAR; Rajeev KUMAR; Bhupesh SHARMA
Subject: Re: [PATCH V2 45/69] ST SPEAr: PCIE gadget suppportQuoted 9 lines · On Fri, 1 Oct 2010 17:26:05 +0530 Viresh KUMAR <[email protected]> wrote:
From: Pratyush Anand <[email protected]>
This is a configurable gadget. can be configured by sysfs interface. Any IP available at PCIE bus can be programmed to be used by host controller.It supoorts both INTX and MSI.
By default, gadget is configured for INTX and SYSRAM1 is mapped to BAR0 with size0x1000
Quoted 6 lines
Quoted 3 lines
...
+static void
enable_dbi_access(struct pcie_app_reg *app_reg)
app_regshould have the__iomemtag.
Ok.
Quoted 4 lines
Quoted 4 lines
drivers/misc/spear13xx_pcie_gadget.c new file +4
-0+{ +/* Enable DBI access */ +writel (readl (&app_reg->slv_armisc) | (1 <<AXI_OP_DBI_ACCESS_ID ), + &app_reg->slv_armisc);
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 61
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+writel (readl (&app_reg->slv_awmisc) | (1 <<AXI_OP_DBI_ACCESS_ID ), + &app_reg->slv_awmisc); + +} + +static void disable_dbi_access (struct pcie_app_reg *app_reg)ditto
Ok.
Quoted 8 lines
Quoted 8 lines
drivers/misc/spear13xx_pcie_gadget.c new file +8
-0+{ +/* disable DBI access */ +writel (readl (&app_reg->slv_armisc) & ~(1 <<AXI_OP_DBI_ACCESS_ID ), + &app_reg->slv_armisc); +writel (readl (&app_reg->slv_awmisc) & ~(1 <<AXI_OP_DBI_ACCESS_ID ), + &app_reg->slv_awmisc); + +}
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 75
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+ +static void spear_dbi_read_reg (struct spear_pcie_gadget_config *config, +int where,int size,u32 *val) +{ +struct pcie_app_reg *app_reg + = (struct pcie_app_reg *) config->va_app_base;ditto
ok
Quoted 17 lines
Quoted 17 lines
drivers/misc/spear13xx_pcie_gadget.c new file +17
-0+u32 va_address; + +/* Enable DBI access */ +enable_dbi_access (app_reg); + + va_address = (u32 )config->va_dbi_base + (where & ~0x3 ); + + *val =readl (va_address); + +if (size ==1 ) + *val = (*val >> (8 * (where &3 ))) &0xff ; +else if (size ==2 ) + *val = (*val >> (8 * (where &3 ))) &0xffff ; + +/* Disable DBI access */ +disable_dbi_access (app_reg); +}
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 98
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+ +static void spear_dbi_write_reg (struct spear_pcie_gadget_config *config, +int where,int size,u32 val) +{ +struct pcie_app_reg *app_reg + = (struct pcie_app_reg *) config->va_app_base;etc.
ok
Quoted 43 lines
Quoted 12 lines
drivers/misc/spear13xx_pcie_gadget.c new file +12
-0+u32 va_address; + +/* Enable DBI access */ +enable_dbi_access (app_reg); + + va_address = (u32 )config->va_dbi_base + (where & ~0x3 ); + +if (size ==4 ) +writel (val, va_address); +else if (size ==2 ) +writew (val, va_address + (where &2 )); +else if (size ==1 )drivers/misc/spear13xx_pcie_gadget.c line 169
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+writeb (val, va_address + (where &3 )); + +/* Disable DBI access */ +disable_dbi_access (app_reg); +} + +/** This token is specifically used to introduce a kerneldoc comment, but this wasn't a kerneldoc comment.
Quoted 17 lines
+ * Tell if a device supports a given PCI capability.
+ * Returns the address of the requested capability structure within the
+ * device's PCI configuration space or 0 in case the device does not
+ * support it. Possible values for @cap:
+ *
+ * %PCI_CAP_ID_PM Power Management
+ * %PCI_CAP_ID_AGP Accelerated Graphics Port
+ * %PCI_CAP_ID_VPD Vital Product Data
+ * %PCI_CAP_ID_SLOTID Slot Identification
+ * %PCI_CAP_ID_MSI Message Signalled Interrupts
+ * %PCI_CAP_ID_CHSWP CompactPCI HotSwap
+ * %PCI_CAP_ID_PCIX PCI-X
+ * %PCI_CAP_ID_EXP PCI Express
+ */...
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c line 209
Quoted 7 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+ +static ssize_t pcie_gadget_show_link (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base;Check all the
__iomems;
Ok.
Quoted 9 lines
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c new file +9
-0+if (readl (&app_reg->app_status_1) & ((u32 )1 <<XMLH_LINK_UP_ID )) +return sprintf (buf,"UP" ); +else +return sprintf (buf,"DOWN" ); +} + +static ssize_t pcie_gadget_store_link (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 225
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base; +char link[10 ]; + +if (sscanf (buf,"%s" , link) !=1 )What happens if strlen(buf) >= 10?
Will return -EINVAL for strlen(buf) >= 0.
Quoted 16 lines
drivers/misc/spear13xx_pcie_gadget.c
Quoted 4 lines
drivers/misc/spear13xx_pcie_gadget.c new file +4
-0+return -EINVAL ; + +if (!strcmp (link,"UP" )) + writel(readl(&app_reg->app_ctrl_0) | (1 <<
APP_LTSSM_ENABLE_ID),Quoted 11 lines
drivers/misc/spear13xx_pcie_gadget.c new file +8
-0+ &app_reg->app_ctrl_0); + else + writel(readl(&app_reg->app_ctrl_0) + & ~(1 <<APP_LTSSM_ENABLE_ID ), + &app_reg->app_ctrl_0); +return count; +} +
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c line 256
Quoted 8 lines
drivers/misc/spear13xx_pcie_gadget.c new file +8
-0+static ssize_t pcie_gadget_store_int_type (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +char int_type[10 ]; +u32 cap, vector, vec, flags; + +if (sscanf (buf,"%s" , int_type) !=1 )ditto
Will return -EINVAL for strlen(buf) >= 0.
Quoted 14 lines
Quoted 14 lines
drivers/misc/spear13xx_pcie_gadget.c new file +13
-0+return -EINVAL ; + +if (!strcmp (int_type,"INTA" )) +spear_dbi_write_reg (config,PCI_INTERRUPT_LINE ,1 ,1 ); + +else if (!strcmp (int_type,"MSI" )) { + vector = config->requested_msi; + vec =0 ; +while (vector >1 ) { + vector /=2 ; + vec++; + } +spear_dbi_write_reg (config,PCI_INTERRUPT_LINE ,1 ,0 );
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 275
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+ cap =pci_find_own_capability (config,PCI_CAP_ID_MSI ); +spear_dbi_read_reg (config, cap +PCI_MSI_FLAGS ,1 , &flags); + flags &= ~PCI_MSI_FLAGS_QMASK ; + flags |= vec <<1 ; +spear_dbi_write_reg (config, cap +PCI_MSI_FLAGS ,1 , flags); + }No checking for unrecognised input?
Will return -EINVAL for other inputs.
Quoted 40 lines
drivers/misc/spear13xx_pcie_gadget.c
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+strcpy (config->int_type, int_type); + +return count; +} + +static DEVICE_ATTR(int_type, S_IWUSR | S_IRUGO,
pcie_gadget_show_int_type,drivers/misc/spear13xx_pcie_gadget.c line 290
Quoted 8 lines
drivers/misc/spear13xx_pcie_gadget.c new file +8
-0+ pcie_gadget_store_int_type); + +static ssize_t pcie_gadget_show_no_of_msi (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base;
__iomemQuoted 22 lines
drivers/misc/spear13xx_pcie_gadget.c new file +19
-0+u32 cap, vector, vec, flags; + +if ((readl (&app_reg->msg_status) & (1 <<CFG_MSI_EN_ID )) + != (1 <<CFG_MSI_EN_ID )) + vector =0 ; +else { + cap =pci_find_own_capability (config,PCI_CAP_ID_MSI ); +spear_dbi_read_reg (config, cap +PCI_MSI_FLAGS ,1 , &flags); + flags &= ~PCI_MSI_FLAGS_QSIZE ; + vec = flags >>4 ; + vector =1 ; +while (vec--) + vector *=2 ; + } + config->configured_msi = vector; + +return sprintf (buf,"%u" , vector); +} +
Quoted 13 lines
drivers/misc/spear13xx_pcie_gadget.c line 334
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c new file +9
-0+static ssize_t pcie_gadget_store_inta (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base; +int en; + +if (sscanf (buf,"%d" , &en) !=1 )
strict_strtoul()would be better. It will reject input of the form "42foo".
Ok..will use strict_strtoul.
Quoted 18 lines
Quoted 18 lines
drivers/misc/spear13xx_pcie_gadget.c new file +18
-0+return -EINVAL ; + +if (en) +writel (readl (&app_reg->app_ctrl_0) | (1 <<SYS_INT_ID ), + &app_reg->app_ctrl_0); +else +writel (readl (&app_reg->app_ctrl_0) & ~(1 <<SYS_INT_ID ), + &app_reg->app_ctrl_0); + +return count; +} + +static DEVICE_ATTR(inta, S_IWUSR, NULL, pcie_gadget_store_inta); + +static ssize_t pcie_gadget_store_send_msi (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev);
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 358
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base; +int vector; +u32 ven_msi; + +if (sscanf (buf,"%d" , &vector) !=1 )
strict_strtoul().
Ok..will use strict_strtoul().
Quoted 31 lines
Quoted 31 lines
drivers/misc/spear13xx_pcie_gadget.c new file +28
-0+return -EINVAL ; + +if (!config->configured_msi) +return -EINVAL ; + +if (vector >= config->configured_msi) +return -EINVAL ; + + ven_msi =readl (&app_reg->ven_msi_1); + ven_msi &= ~VEN_MSI_FUN_NUM_MASK ; + ven_msi |=0 <<VEN_MSI_FUN_NUM_ID ; + ven_msi &= ~VEN_MSI_TC_MASK ; + ven_msi |=0 <<VEN_MSI_TC_ID ; + ven_msi &= ~VEN_MSI_VECTOR_MASK ; + ven_msi |= vector <<VEN_MSI_VECTOR_ID ; + +/*generating interrupt for msi vector*/ + ven_msi |=VEN_MSI_REQ_EN ; +writel (ven_msi, &app_reg->ven_msi_1); +/*need to wait till this bit is cleared, it is not cleared +* autometically[Bug RTL] TBD*/ +udelay (1 ); + ven_msi &= ~VEN_MSI_REQ_EN ; +writel (ven_msi, &app_reg->ven_msi_1); + +return count; +} +
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c line 406
Quoted 7 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+static ssize_t pcie_gadget_store_vendor_id (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +u32 id; + +if (sscanf (buf,"%x" , &id) !=1 )
strict_strtoulcan be used here as well?
Ok..will use strict_strtoul().
Quoted 10 lines
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+return -EINVAL ; + +spear_dbi_write_reg (config,PCI_VENDOR_ID ,2 , id); + +return count; +} +
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c line 434
Quoted 7 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+static ssize_t pcie_gadget_store_device_id (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +u32 id; + +if (sscanf (buf,"%x" , &id) !=1 )etc.
Ok..will use strict_strtoul().
Quoted 10 lines
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+return -EINVAL ; + +spear_dbi_write_reg (config,PCI_DEVICE_ID ,2 , id); + +return count; +} +
Quoted 11 lines
drivers/misc/spear13xx_pcie_gadget.c line 460
Quoted 8 lines
drivers/misc/spear13xx_pcie_gadget.c new file +8
-0+static ssize_t pcie_gadget_store_bar0_size (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +u32 size, pos, pos1; +u32 no_of_bit =0 ; + +if (sscanf (buf,"%x" , &size) !=1 )etc.
Ok..will use strict_strtoul().
Quoted 32 lines
Quoted 32 lines
drivers/misc/spear13xx_pcie_gadget.c new file +29
-0+return -EINVAL ; +/* as per PCIE specs, min bar size supported is 128 bytes. But +* our controller supports min as 256*/ +if (size <=0x100 ) + size =0x100 ; +/* max bar size is 1MB*/ +else if (size >=0x100000 ) + size =0x100000 ; +else { + pos =0 ; + pos1 =0 ; +while (pos <21 ) { + pos =find_next_bit ((unsigned long *)&size,21 , pos); +if (pos !=21 ) + pos1 = pos +1 ; + pos++; + no_of_bit++; + } +if (no_of_bit ==2 ) + pos1--; + + size =1 << pos1; + } + config->bar0_size = size; +spear_dbi_write_reg (config,PCIE_BAR0_MASK_REG ,4 , size -1 ); + +return count; +} +
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 498
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+static ssize_t pcie_gadget_show_bar0_address (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct spear_pcie_gadget_config *config =dev_get_drvdata (dev); +struct pcie_app_reg *app_reg = + (struct pcie_app_reg *)config->va_app_base;etc
Ok..will use __iomem
Quoted 42 lines
Quoted 21 lines
drivers/misc/spear13xx_pcie_gadget.c new file +18
-0+u32 address =readl (&app_reg->pim0_mem_addr_start); + +return sprintf (buf,"%x" , address); +} + +static ssize_t pcie_gadget_show_help (struct device *dev, +struct device_attribute *attr,char *buf) +{ +char text[] ="\t\tlink read->ltssm status\n \ +link write->arg1 = UP to enable ltsmm DOWN to disable\n \ +int_type read->type of supported interrupt\n \ +int_type write->arg1 = interrupt type to be configured and\n \ +can be INTA, MSI or NO_INT\n \ +(select MSI only when you have programmed no_of_msi)\n \ +no_of_msi read->zero if MSI is not enabled by host\n \ +and positive value is the number of MSI vector granted\n \ +no_of_msi write->arg1 = number of MSI vector needed\n \ +inta write->arg1 = 1 to assert INTA and 0 to de-assert\n \ drivers/misc/spear13xx_pcie_gadget.c
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ send_msi write->arg1 = MSI vector to be send\n \ + vendor_id read->programmed vendor id (hex)\n\ + vendor_id write->arg1 = vendor id(hex) to be programmed\n \ + device_id read->programmed device id(hex)\n \ + device_id write->arg1 = device id(hex) to be programmed\n \ + bar0_size read->size of bar0 in hex\n \ + bar0_size write->arg1= size of bar0 in hex\n \ + (default bar0 size is 1000 (hex) bytes)\n \ + bar0_address read->address of bar0 mapped area in hex\n \ + bar0_address write->arg1 = address of bar0 mapped area inhex\n\
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ (default mapping of bar0 is SYSRAM1(E0800000)\n \ + (always program bar size before bar address)\n \ + (kernel might modify bar size and address to align)\n \ + (read back bar size and address after writing to check)\n \ + bar0_rw_offset read->offset of bar0 for which bar0_data \n \ + will return value\n \ + bar0_rw_offset write->arg1 = offset of bar0 for which\n \ + bar0_data will write value\n \ + bar0_data read->data at bar0_rw_offset\n \ + bar0_data write->arg1 = data to be written at\n \
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 631
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+ bar0_rw_offset\n"; + +int size = (sizeof (text) <PAGE_SIZE ) ?sizeof (text) :PAGE_SIZE ; + +return snprintf (buf, size,"%s" , text); +}What the heck is this??
This was just to provide help for different sysfs nodes. What could be the other Way to do it? Should it be better to remove help node from here provide all the help In a separate document?
Quoted 64 lines
Quoted 12 lines
drivers/misc/spear13xx_pcie_gadget.c new file +12
-0+static DEVICE_ATTR(help, S_IRUGO, pcie_gadget_show_help, NULL); + +static struct attribute *pcie_gadget_attributes[] = { + &dev_attr_link.attr, + &dev_attr_int_type.attr, + &dev_attr_no_of_msi.attr, + &dev_attr_inta.attr, + &dev_attr_send_msi.attr, + &dev_attr_vendor_id.attr, + &dev_attr_device_id.attr, + &dev_attr_bar0_size.attr, + &dev_attr_bar0_address.attr,drivers/misc/spear13xx_pcie_gadget.c
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+ &dev_attr_bar0_rw_offset.attr, + &dev_attr_bar0_data.attr, + &dev_attr_help.attr, +NULL +}; + +static int __devinit spear_pcie_gadget_probe(struct platform_device*pdev)
Quoted 41 lines
drivers/misc/spear13xx_pcie_gadget.c new file +41
-0+{ +struct resource *res0, *res1; +struct spear_pcie_gadget_config *config; +unsigned int status =0 ; +int irq; +struct clk *clk; + +/* get resource for application registers*/ + + res0 =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res0) { +dev_err (&pdev->dev,"no resource defined\n" ); +return -EBUSY ; + } +if (!request_mem_region (res0->start,resource_size (res0), + pdev->name)) { +dev_err (&pdev->dev,"pcie gadget region already claimed\n" ); +return -EBUSY ; + } +/* get resource for dbi registers*/ + + res1 =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); +if (!res1) { +dev_err (&pdev->dev,"no resource defined\n" ); + goto err_rel_res0; + } +if (!request_mem_region (res1->start,resource_size (res1), + pdev->name)) { +dev_err (&pdev->dev,"pcie gadget region already claimed\n" ); + goto err_rel_res0; + } + + config =kzalloc (sizeof (*config),GFP_KERNEL ); +if (!config) { +dev_err (&pdev->dev,"out of memory\n" ); + status = -ENOMEM ; + goto err_rel_res; + } + + config->va_app_base =ioremap (res0->start,resource_size (res0)); +if (!config->va_app_base) {
Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 759
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+dev_err (&pdev->dev,"ioremap fail\n" ); + status = -ENOMEM ; + goto err_kzalloc; + } + + config->base = (void *)res1->start;Is that
__iomem?
Will use __iomem here too.
Quoted 86 lines
Quoted 7 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+ config->va_dbi_base =ioremap (res1->start,resource_size (res1)); +if (!config->va_dbi_base) { +dev_err (&pdev->dev,"ioremap fail\n" ); + status = -ENOMEM ; + goto err_iounmap_app; + } +drivers/misc/spear13xx_pcie_gadget.c
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+dev_set_drvdata (&pdev->dev, config); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { +dev_err (&pdev->dev,"no update irq?\n" ); + status = irq; + goto err_iounmap; + } + + status = request_irq(irq, spear_pcie_gadget_irq, 0, pdev->name,NULL);
drivers/misc/spear13xx_pcie_gadget.c
Quoted 7 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+if (status) { +dev_err (&pdev->dev,"pcie gadget interrupt IRQ%d already \ +claimed\n" , irq); + goto err_get_irq; + } +/* Register sysfs hooks */ + status = sysfs_create_group(&pdev->dev.kobj,
&pcie_gadget_attr_group);drivers/misc/spear13xx_pcie_gadget.c
Quoted 7 lines
drivers/misc/spear13xx_pcie_gadget.c new file +7
-0+if (status) + goto err_irq; + +/* init basic pcie application registers*/ +/* do not enable clock if it is PCIE0.Ideally , all controller should +* have been independent from others with respect to clock. But PCIE1 +* and 2 depends on PCIE0.So PCIE0 clk is provided during board init.*/
Quoted 38 lines
drivers/misc/spear13xx_pcie_gadget.c new file +37
-0+if (pdev->id ==1 ) { +/* Ideally CFG Clock should have been also enabled here. But +* it is done currently during board init routne*/ + clk =clk_get_sys ("pcie1" ,NULL ); +if (!clk) { +pr_err ("%s:couldn't get clk for pcie1\n" , __func__); + goto err_irq; + } +if (clk_enable (clk)) { +pr_err ("%s:couldn't enable clk for pcie1\n" , __func__); + goto err_irq; + } + }else if (pdev->id ==2 ) { +/* Ideally CFG Clock should have been also enabled here. But +* it is done currently during board init routne*/ + clk =clk_get_sys ("pcie2" ,NULL ); +if (!clk) { +pr_err ("%s:couldn't get clk for pcie2\n" , __func__); + goto err_irq; + } +if (clk_enable (clk)) { +pr_err ("%s:couldn't enable clk for pcie2\n" , __func__); + goto err_irq; + } + } +spear13xx_pcie_device_init (config); + +return 0 ; +err_irq: +free_irq (irq,NULL ); +err_get_irq: +dev_set_drvdata (&pdev->dev,NULL ); +err_iounmap: +iounmap (config->va_dbi_base); +err_iounmap_app: +iounmap (config->va_app_base); +err_kzalloc:drivers/misc/spear13xx_pcie_gadget.c
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +8
-0+kfree (config); +err_rel_res: +release_mem_region (res1->start,resource_size (res1)); +err_rel_res0: +release_mem_region (res0->start,resource_size (res0)); +return status; +} +The driver implements a large, complex userspace interface and afaict that interface wasn't documented anywhere.
Quoted 4 lines
But the interface is the most important part of the driver! It should be documented in a permanent fashion so that reviewers can understand and review your proposed interface. They will want to do that before even looking at the code.
Ok..Will write Documentation/misc-devices/spear_pcie_gadget.txt.
Re: [PATCH V2 45/69] ST SPEAr: PCIE gadget suppport
Quoted 44 lines · On Thu, 21 Oct 2010 22:18:28 +0800 Pratyush ANAND <[email protected]> wrote:
Quoted 34 lines
Quoted 13 lines
drivers/misc/spear13xx_pcie_gadget.c new file +13
-0+static ssize_t pcie_gadget_show_help (struct device *dev, +struct device_attribute *attr,char *buf) +{ +char text[] ="\t\tlink read->ltssm status\n \ +link write->arg1 = UP to enable ltsmm DOWN to disable\n \ +int_type read->type of supported interrupt\n \ +int_type write->arg1 = interrupt type to be configured and\n \ +can be INTA, MSI or NO_INT\n \ +(select MSI only when you have programmed no_of_msi)\n \ +no_of_msi read->zero if MSI is not enabled by host\n \ +and positive value is the number of MSI vector granted\n \ +no_of_msi write->arg1 = number of MSI vector needed\n \ +inta write->arg1 = 1 to assert INTA and 0 to de-assert\n \ drivers/misc/spear13xx_pcie_gadget.c
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ send_msi write->arg1 = MSI vector to be send\n \ + vendor_id read->programmed vendor id (hex)\n\ + vendor_id write->arg1 = vendor id(hex) to be programmed\n \ + device_id read->programmed device id(hex)\n \ + device_id write->arg1 = device id(hex) to be programmed\n \ + bar0_size read->size of bar0 in hex\n \ + bar0_size write->arg1= size of bar0 in hex\n \ + (default bar0 size is 1000 (hex) bytes)\n \ + bar0_address read->address of bar0 mapped area in hex\n \ + bar0_address write->arg1 = address of bar0 mapped area inhex\n\
Quoted 10 lines
drivers/misc/spear13xx_pcie_gadget.c new file +10
-0+ (default mapping of bar0 is SYSRAM1(E0800000)\n \ + (always program bar size before bar address)\n \ + (kernel might modify bar size and address to align)\n \ + (read back bar size and address after writing to check)\n \ + bar0_rw_offset read->offset of bar0 for which bar0_data \n \ + will return value\n \ + bar0_rw_offset write->arg1 = offset of bar0 for which\n \ + bar0_data will write value\n \ + bar0_data read->data at bar0_rw_offset\n \ + bar0_data write->arg1 = data to be written at\n \Quoted 9 lines
drivers/misc/spear13xx_pcie_gadget.c line 631
Quoted 6 lines
drivers/misc/spear13xx_pcie_gadget.c new file +6
-0+ bar0_rw_offset\n"; + +int size = (sizeof (text) <PAGE_SIZE ) ?sizeof (text) :PAGE_SIZE ; + +return snprintf (buf, size,"%s" , text); +}What the heck is this??
Quoted 3 lines
This was just to provide help for different sysfs nodes. What could be the other Way to do it? Should it be better to remove help node from here provide all the help In a separate document?
Yes, documenting it externally would be more typical.
v2 cover Updating SPEAr Support
In reply to viresh kumarQuoted 24 lines · Viresh KUMAR
Quoted 14 lines · Viresh KUMAR
Following set of patches:
- updates SPEAr3xx, 6xx support
- Adds support for SPEAr13xx
- Removes Multiple defconfigs per machine familyChanges since V1:
- sev definitions moved tosystem.hand removed from spear and omap archs
- bug fix added in system controller filesp810.h
- Review Comments incorporated
- Driver and machine support are divided into separate patches
- Nand Driver is removed from patch list as it is already floated by Linus Walleij.
- Few later patches of SPEAr13xx Patches are merged with initial patches of SPEAr13xxQuoted 8 lines
- Smaller Defconfigs are used instead of large.
- Clock renaming & minor corrections are moved to clock specific patches from peripheral machine support patches.
- Removed Commented code related to SPI
- [PATCH] Incrementing theecc_posarray to contain 128 char - is removed from list
- Board specific code is moved to *evb.c files from machine files for EMI NOR
- replaced readl with__raw_readlinuncompress.hin plat-spear/include/plat/
Quoted 4 lines
Russell,
Are there open points in these v2 patches or are they fine?
Russell,
Are there open points in these v2 patches or are they fine?
Signature · 1 line
viresh
Re: [PATCH V2 25/69] ST SPEAr: Add smi driver for serial NOR flash
In reply to viresh kumarQuoted 22 lines · viresh kumar
Quoted 12 lines · Viresh KUMAR
From: Shiraz Hashim <[email protected]>
SPEAr platforms(spear3xx/spear6xx/spear13xx) provide SMI(Serial Memory Interface) controller to access serial NOR flash. SMI provides a simple interface for SPI/serial NOR flashes and has certain inbuilt commands and features to support these flashes easily. It also makes it possible to map an address range in order to directly access (read/write) the SNOR over address bus. This patch intends to provide serial nor driver support for spear platforms which are accessed through SMI.
Signed-off-by Shiraz Hashim <[email protected]>Signed-off-by Viresh Kumar <[email protected]>Quoted 8 lines
--- arch/arm/plat-spear/include/plat/smi.h | 68 ++ drivers/mtd/devices/Kconfig | 7 + drivers/mtd/devices/Makefile | 1 + drivers/mtd/devices/spear_smi.c | 1122 ++++++++++++++++++++++++++++++++ 4 files changed, 1198 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-spear/include/plat/smi.h create mode 100644 drivers/mtd/devices/spear_smi.c
Quoted 4 lines
David,
Any review comments on this patch??
David,
Any review comments??
Signature · 1 line
viresh
PATCH v2 21/69 Keyboard: Adding support for spear-keyboard
In reply to Dmitry TorokhovDmitry,
Quoted 6 lines · Dmitry Torokhov
drivers/input/keyboard/spear-keyboard.c +3
-3-/* program keyboard */ - val |=SCAN_RATE_80 |MODE_KEYBOARD |PCLK_FREQ_MSK ; -writew (val, kbd->io_base +MODE_REG ); + input_dev->keycode = kbd->keycodes; + input_dev->keycodesize =sizeof (kbd->keycodes[0 ]); + input_dev->keycodemax =ARRAY_SIZE (kbd->keycodes);
drivers/input/keyboard/spear-keyboard.c static void spear_kbd_close(struct input_dev *dev) · line 225
Quoted 10 lines
drivers/input/keyboard/spear-keyboard.c +6
-2-writeb (1 , kbd->io_base +STATUS_REG ); +matrix_keypad_build_keymap (keymap,ROW_SHIFT , + input_dev->keycode, input_dev->keybit); -device_init_wakeup (&pdev->dev,1 ); +input_set_drvdata (input_dev, kbd); + +/* ensure device is shut off */ +spear_kbd_close (input_dev);
Since, clock to keyboard is not enabled at this time (during probe), this function call is not required. This tries to disable clock which is never enabled.
I have removed this function call and tested your patch and was working fine.
--
viresh
PATCH v2 28/69 ST SPEAr: Adding machine support for nand
In reply to Viresh KUMARHi, Viresh,
It looked you missed the file include/mtd/fsmc.h in this patch.
Stanley.
Quoted 708 lines · Viresh KUMAR
From: Vipin Kumar <[email protected]>
Signed-off-by Vipin Kumar <[email protected]>Signed-off-by Rajeev Kumar <[email protected]>Signed-off-by Shiraz Hashim <[email protected]>Signed-off-by Viresh Kumar <[email protected]>--- arch/arm/mach-spear13xx/include/mach/generic.h | 2 + arch/arm/mach-spear13xx/include/mach/misc_regs.h | 10 ++ arch/arm/mach-spear13xx/spear1300_evb.c | 9 ++ arch/arm/mach-spear13xx/spear13xx.c | 58 +++++++++++++ arch/arm/mach-spear3xx/include/mach/generic.h | 15 ++-- arch/arm/mach-spear3xx/include/mach/spear320.h | 3 + arch/arm/mach-spear3xx/spear300.c | 98 ++++++++++++++++++++++ arch/arm/mach-spear3xx/spear300_evb.c | 8 ++ arch/arm/mach-spear3xx/spear310.c | 26 ++++++ arch/arm/mach-spear3xx/spear310_evb.c | 8 ++ arch/arm/mach-spear3xx/spear320.c | 26 ++++++ arch/arm/mach-spear3xx/spear320_evb.c | 8 ++ arch/arm/mach-spear6xx/include/mach/generic.h | 1 + arch/arm/mach-spear6xx/spear600_evb.c | 8 ++ arch/arm/mach-spear6xx/spear6xx.c | 26 ++++++ arch/arm/plat-spear/include/plat/fsmc.h | 36 ++++++++ 16 files changed, 336 insertions(+), 6 deletions(-) create mode 100644 arch/arm/plat-spear/include/plat/fsmc.harch/arm/mach-spear13xx/include/mach/generic.h +2
-0@@ -35,6 +35,7 @@ extern struct platform_device spear13xx_ehci0_device;extern struct platform_device spear13xx_ehci1_device;extern struct platform_device spear13xx_i2c_device;extern struct platform_device spear13xx_kbd_device; +extern struct platform_device spear13xx_nand_device;extern struct platform_device spear13xx_ohci0_device;extern struct platform_device spear13xx_ohci1_device;extern struct platform_device spear13xx_rtc_device;@@ -51,6 +52,7 @@ void __init spear1300_init(void);void __init spear13xx_map_io (void );void __init spear13xx_init_irq (void );void __init spear13xx_init (void ); +void __init nand_mach_init (u32 busw);void spear13xx_secondary_startup (void );#endif /* __MACH_GENERIC_H */ arch/arm/mach-spear13xx/include/mach/misc_regs.h +10
-0@@ -210,6 +210,16 @@#define CF_MMC_ACTIVE 0x2#define XD_MMC_ACTIVE 0x3#define FSMC_CFG ((unsigned int *)(MISC_BASE + 0x330)) +/* FSMC_CFG register masks */ +#define FSMC_MEMSEL_MASK 0x3 +#define FSMC_MEMSEL_SHIFT 0 +#define FSMC_MEM_NOR 0 +#define FSMC_MEM_NAND 1 +#define FSMC_MEM_SRAM 2 +#define NAND_BANK_MASK 0x3 +#define NAND_BANK_SHIFT 2 +#define NAND_DEV_WIDTH16 4 +#define MPMC_CTR_STS ((unsigned int *)(MISC_BASE + 0x334))/* Inter-Processor Communication Registers */ arch/arm/mach-spear13xx/spear1300_evb.c +9
-0@@ -12,11 +12,14 @@*/ #include <linux/types.h> +#include <linux/mtd/nand.h> +#include <mtd/fsmc.h> #include <asm/mach/arch.h> #include <asm/mach-types.h> #include <mach/generic.h> #include <mach/spear.h> #include <plat/keyboard.h> +#include <plat/fsmc.h> #include <plat/smi.h> static struct amba_device *amba_devs[]__initdata = {@@ -30,6 +33,7 @@ static struct platform_device *plat_devs[] __initdata = { &spear13xx_ehci1_device, &spear13xx_i2c_device, &spear13xx_kbd_device, + &spear13xx_nand_device, &spear13xx_ohci0_device, &spear13xx_ohci1_device, &spear13xx_rtc_device,@@ -52,6 +56,11 @@ static void __init spear1300_evb_init(void)/* set keyboard plat data */ kbd_set_plat_data (&spear13xx_kbd_device, &kbd_data); +/* set nand device's plat data */ +fsmc_nand_set_plat_data (&spear13xx_nand_device,NULL ,0 , +NAND_SKIP_BBTSCAN ,FSMC_NAND_BW8 ); +nand_mach_init (FSMC_NAND_BW8 ); +/* call spear1300 machine init function */ spear1300_init ();arch/arm/mach-spear13xx/spear13xx.c +58
-0@@ -15,6 +15,7 @@#include <linux/amba/pl061.h> #include <linux/ptrace.h> #include <linux/io.h> +#include <mtd/fsmc.h> #include <asm/hardware/gic.h> #include <asm/irq.h> #include <asm/localtimer.h> @@ -23,6 +24,7 @@#include <mach/irqs.h> #include <mach/generic.h> #include <mach/hardware.h> +#include <mach/misc_regs.h> /* Add spear13xx machines common devices here */ /* gpio device registeration */ @@ -97,6 +99,62 @@ struct platform_device spear13xx_i2c_device = { .resource = i2c_resources, }; +/* nand device registeration */ +void __init nand_mach_init (u32 busw) +{ +u32 fsmc_cfg =readl (FSMC_CFG ); + fsmc_cfg &= ~(FSMC_MEMSEL_MASK <<FSMC_MEMSEL_SHIFT ); + fsmc_cfg |= (FSMC_MEM_NAND <<FSMC_MEMSEL_SHIFT ); + +if (busw ==FSMC_NAND_BW16 ) + fsmc_cfg |=1 <<NAND_DEV_WIDTH16 ; +else + fsmc_cfg &= ~(1 <<NAND_DEV_WIDTH16 ); + +writel (fsmc_cfg,FSMC_CFG ); +} + +static void nand_select_bank (u32 bank,u32 busw) +{ +u32 fsmc_cfg =readl (FSMC_CFG ); + + fsmc_cfg &= ~(NAND_BANK_MASK <<NAND_BANK_SHIFT ); + fsmc_cfg |= (bank <<NAND_BANK_SHIFT ); + +if (busw) + fsmc_cfg |=1 <<NAND_DEV_WIDTH16 ; +else + fsmc_cfg &= ~(1 <<NAND_DEV_WIDTH16 ); + +writel (fsmc_cfg,FSMC_CFG ); +} + +static struct fsmc_nand_platform_data nand_platform_data = { + .select_bank = nand_select_bank, +}; + +static struct resource nand_resources[] = { + { + .name ="nand_data" , + .start =SPEAR13XX_FSMC_MEM_BASE , + .end =SPEAR13XX_FSMC_MEM_BASE +SZ_16 -1 , + .flags =IORESOURCE_MEM , + }, { + .name ="fsmc_regs" , + .start =SPEAR13XX_FSMC_BASE , + .end =SPEAR13XX_FSMC_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device spear13xx_nand_device = { + .name ="nand" , + .id =-1 , + .resource = nand_resources, + .num_resources =ARRAY_SIZE (nand_resources), + .dev.platform_data = &nand_platform_data, +}; +/* usb host device registeration */ static struct resource ehci0_resources[] = { [0 ] = {arch/arm/mach-spear3xx/include/mach/generic.h +9
-6@@ -111,6 +111,10 @@ extern struct pmx_driver pmx_driver;extern struct amba_device clcd_device;extern struct amba_device gpio1_device;extern struct platform_device kbd_device; +extern struct platform_device nand0_device; +extern struct platform_device nand1_device; +extern struct platform_device nand2_device; +extern struct platform_device nand3_device;/* pad mux modes */ extern struct pmx_mode nand_mode;@@ -148,12 +152,12 @@ void __init spear300_init(void);/* Add misc structure declarations here */ extern struct clcd_board clcd_plat_data; -#endif /* CONFIG_MACH_SPEAR300 */ /* spear310 declarations */ -#ifdef CONFIG_MACH_SPEAR310 +#elif defined(CONFIG_MACH_SPEAR310 )/* Add spear310 machine device structure declarations here */ extern struct platform_device plgpio_device; +extern struct platform_device nand_device;/* pad mux devices */ extern struct pmx_dev pmx_emi_cs_0_1_4_5;@@ -168,13 +172,12 @@ extern struct pmx_dev pmx_tdm0;/* Add spear310 machine function declarations here */ void __init spear310_init (void ); -#endif /* CONFIG_MACH_SPEAR310 */ -/* spear320 declarations */ -#ifdef CONFIG_MACH_SPEAR320 +#elif defined(CONFIG_MACH_SPEAR320 )/* Add spear320 machine device structure declarations here */ extern struct amba_device clcd_device;extern struct platform_device i2c1_device; +extern struct platform_device nand_device;extern struct platform_device plgpio_device;extern struct platform_device pwm_device;@@ -213,6 +216,6 @@ void __init spear320_init(void);/* Add misc structure declarations here */ extern struct clcd_board clcd_plat_data; -#endif /* CONFIG_MACH_SPEAR320 */ +#endif #endif /* __MACH_GENERIC_H */ arch/arm/mach-spear3xx/include/mach/spear320.h +3
-0@@ -22,6 +22,9 @@#define SPEAR320_FSMC_BASE 0x4C000000#define SPEAR320_FSMC_SIZE 0x01000000 +#define SPEAR320_NAND_BASE 0x50000000 +#define SPEAR320_NAND_SIZE 0x04000000 +#define SPEAR320_I2S_BASE 0x60000000#define SPEAR320_I2S_SIZE 0x10000000arch/arm/mach-spear3xx/spear300.c +98
-0@@ -14,6 +14,7 @@#include <linux/types.h> #include <linux/amba/pl061.h> #include <linux/ptrace.h> +#include <mtd/fsmc.h> #include <asm/irq.h> #include <mach/generic.h> #include <mach/spear.h> @@ -426,6 +427,103 @@ struct platform_device kbd_device = { .resource = kbd_resources, }; +/* nand device registeration */ +static struct fsmc_nand_platform_data nand0_platform_data; + +static struct resource nand0_resources[] = { + { + .name ="nand_data" , + .start =SPEAR300_NAND_0_BASE , + .end =SPEAR300_NAND_0_BASE +SZ_16 -1 , + .flags =IORESOURCE_MEM , + }, { + .name ="fsmc_regs" , + .start =SPEAR300_FSMC_BASE , + .end =SPEAR300_FSMC_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device nand0_device = { + .name ="nand" , + .id =0 , + .resource = nand0_resources, + .num_resources =ARRAY_SIZE (nand0_resources), + .dev.platform_data = &nand0_platform_data, +}; + +static struct fsmc_nand_platform_data nand1_platform_data; + +static struct resource nand1_resources[] = { + { + .name ="nand_data" , + .start =SPEAR300_NAND_1_BASE , + .end =SPEAR300_NAND_1_BASE +SZ_16 -1 , + .flags =IORESOURCE_MEM , + }, { + .name ="fsmc_regs" , + .start =SPEAR300_FSMC_BASE , + .end =SPEAR300_FSMC_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device nand1_device = { + .name ="nand" , + .id =1 , + .resource = nand1_resources, + .num_resources =ARRAY_SIZE (nand1_resources), + .dev.platform_data = &nand1_platform_data, +}; + +static struct fsmc_nand_platform_data nand2_platform_data; + +static struct resource nand2_resources[] = { + { + .name ="nand_data" , + .start =SPEAR300_NAND_2_BASE , + .end =SPEAR300_NAND_2_BASE +SZ_16 -1 , + .flags =IORESOURCE_MEM , + }, { + .name ="fsmc_regs" , + .start =SPEAR300_FSMC_BASE , + .end =SPEAR300_FSMC_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device nand2_device = { + .name ="nand" , + .id =2 , + .resource = nand2_resources, + .num_resources =ARRAY_SIZE (nand2_resources), + .dev.platform_data = &nand2_platform_data, +}; + +static struct fsmc_nand_platform_data nand3_platform_data; + +static struct resource nand3_resources[] = { + { + .name ="nand_data" , + .start =SPEAR300_NAND_3_BASE , + .end =SPEAR300_NAND_3_BASE +SZ_16 -1 , + .flags =IORESOURCE_MEM , + }, { + .name ="fsmc_regs" , + .start =SPEAR300_FSMC_BASE , + .end =SPEAR300_FSMC_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device nand3_device = { + .name ="nand" , + .id =3 , + .resource = nand3_resources, + .num_resources =ARRAY_SIZE (nand3_resources), + .dev.platform_data = &nand3_platform_data, +}; +/* spear3xx shared irq */ struct shirq_dev_config shirq_ras1_config[] = { {arch/arm/mach-spear3xx/spear300_evb.c +8
-0@@ -11,10 +11,13 @@* warranty of any kind, whether express or implied. */ +#include <linux/mtd/nand.h> +#include <mtd/fsmc.h> #include <asm/mach/arch.h> #include <asm/mach-types.h> #include <mach/generic.h> #include <mach/spear.h> +#include <plat/fsmc.h> #include <plat/keyboard.h> #include <plat/smi.h> @@ -49,6 +52,7 @@ static struct platform_device *plat_devs[] __initdata = {/* spear3xx specific devices */ &ehci_device, &i2c_device, + &nand0_device, &ohci0_device, &ohci1_device, &rtc_device,@@ -79,6 +83,10 @@ static void __init spear300_evb_init(void)/* set keyboard plat data */ kbd_set_plat_data (&kbd_device, &kbd_data); +/* set nand0 device's plat data */ +fsmc_nand_set_plat_data (&nand0_device,NULL ,0 ,NAND_SKIP_BBTSCAN , +FSMC_NAND_BW8 ); +/* call spear300 machine init function */ spear300_init ();arch/arm/mach-spear3xx/spear310.c +26
-0@@ -12,6 +12,7 @@*/ #include <linux/ptrace.h> +#include <mtd/fsmc.h> #include <asm/irq.h> #include <mach/generic.h> #include <mach/spear.h> @@ -177,6 +178,31 @@ int spear300_o2p(int offset)return offset +2 ; } +/* nand device registeration */ +static struct fsmc_nand_platform_data nand_platform_data; + +static struct resource nand_resources[] = { + { + .name ="nand_data" , + .start =SPEAR310_NAND_BASE , + .end =SPEAR310_NAND_BASE +SZ_16 -1 , + .flags =IORESOURCE_MEM , + }, { + .name ="fsmc_regs" , + .start =SPEAR310_FSMC_BASE , + .end =SPEAR310_FSMC_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device nand_device = { + .name ="nand" , + .id =-1 , + .resource = nand_resources, + .num_resources =ARRAY_SIZE (nand_resources), + .dev.platform_data = &nand_platform_data, +}; +static struct plgpio_platform_data plgpio_plat_data = { .gpio_base =8 , .irq_base =SPEAR_PLGPIO_INT_BASE ,arch/arm/mach-spear3xx/spear310_evb.c +8
-0@@ -11,10 +11,13 @@* warranty of any kind, whether express or implied. */ +#include <linux/mtd/nand.h> +#include <mtd/fsmc.h> #include <asm/mach/arch.h> #include <asm/mach-types.h> #include <mach/generic.h> #include <mach/spear.h> +#include <plat/fsmc.h> #include <plat/smi.h> /* padmux devices to enable */ @@ -54,6 +57,7 @@ static struct platform_device *plat_devs[] __initdata = {/* spear3xx specific devices */ &ehci_device, &i2c_device, + &nand_device, &ohci0_device, &ohci1_device, &rtc_device,@@ -72,6 +76,10 @@ static void __init spear310_evb_init(void) pmx_driver.devs = pmx_devs; pmx_driver.devs_count =ARRAY_SIZE (pmx_devs); +/* set nand device's plat data */ +fsmc_nand_set_plat_data (&nand_device,NULL ,0 ,NAND_SKIP_BBTSCAN , +FSMC_NAND_BW8 ); +/* call spear310 machine init function */ spear310_init ();arch/arm/mach-spear3xx/spear320.c +26
-0@@ -12,6 +12,7 @@*/ #include <linux/ptrace.h> +#include <mtd/fsmc.h> #include <asm/irq.h> #include <mach/generic.h> #include <mach/spear.h> @@ -431,6 +432,31 @@ struct platform_device i2c1_device = { .resource = i2c1_resources, }; +/* nand device registeration */ +static struct fsmc_nand_platform_data nand_platform_data; + +static struct resource nand_resources[] = { + { + .name ="nand_data" , + .start =SPEAR320_NAND_BASE , + .end =SPEAR320_NAND_BASE +SZ_16 -1 , + .flags =IORESOURCE_MEM , + }, { + .name ="fsmc_regs" , + .start =SPEAR320_FSMC_BASE , + .end =SPEAR320_FSMC_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device nand_device = { + .name ="nand" , + .id =-1 , + .resource = nand_resources, + .num_resources =ARRAY_SIZE (nand_resources), + .dev.platform_data = &nand_platform_data, +}; +static struct resource plgpio_resources[] = { { .start =SPEAR320_SOC_CONFIG_BASE ,arch/arm/mach-spear3xx/spear320_evb.c +8
-0@@ -11,10 +11,13 @@* warranty of any kind, whether express or implied. */ +#include <linux/mtd/nand.h> +#include <mtd/fsmc.h> #include <asm/mach/arch.h> #include <asm/mach-types.h> #include <mach/generic.h> #include <mach/spear.h> +#include <plat/fsmc.h> #include <plat/smi.h> /* padmux devices to enable */ @@ -52,6 +55,7 @@ static struct platform_device *plat_devs[] __initdata = {/* spear3xx specific devices */ &ehci_device, &i2c_device, + &nand_device, &ohci0_device, &ohci1_device, &rtc_device,@@ -72,6 +76,10 @@ static void __init spear320_evb_init(void) pmx_driver.devs = pmx_devs; pmx_driver.devs_count =ARRAY_SIZE (pmx_devs); +/* set nand device's plat data */ +fsmc_nand_set_plat_data (&nand_device,NULL ,0 ,NAND_SKIP_BBTSCAN , +FSMC_NAND_BW8 ); +/* call spear320 machine init function */ spear320_init ();arch/arm/mach-spear6xx/include/mach/generic.h +1
-0@@ -36,6 +36,7 @@ extern struct amba_device wdt_device;extern struct platform_device ehci0_device;extern struct platform_device ehci1_device;extern struct platform_device i2c_device; +extern struct platform_device nand_device;extern struct platform_device ohci0_device;extern struct platform_device ohci1_device;extern struct platform_device rtc_device;arch/arm/mach-spear6xx/spear600_evb.c +8
-0@@ -11,10 +11,13 @@* warranty of any kind, whether express or implied. */ +#include <linux/mtd/nand.h> +#include <mtd/fsmc.h> #include <asm/mach/arch.h> #include <asm/mach-types.h> #include <mach/generic.h> #include <mach/spear.h> +#include <plat/fsmc.h> #include <plat/smi.h> static struct amba_device *amba_devs[]__initdata = {@@ -33,6 +36,7 @@ static struct platform_device *plat_devs[] __initdata = { &i2c_device, &ohci0_device, &ohci1_device, + &nand_device, &rtc_device, &smi_device, };@@ -41,6 +45,10 @@ static void __init spear600_evb_init(void) {unsigned int i; +/* set nand device's plat data */ +fsmc_nand_set_plat_data (&nand_device,NULL ,0 ,NAND_SKIP_BBTSCAN , +FSMC_NAND_BW8 ); +/* call spear600 machine init function */ spear600_init ();arch/arm/mach-spear6xx/spear6xx.c +26
-0@@ -15,6 +15,7 @@#include <linux/amba/pl061.h> #include <linux/ptrace.h> #include <linux/io.h> +#include <mtd/fsmc.h> #include <asm/hardware/vic.h> #include <asm/irq.h> #include <asm/mach/arch.h> @@ -152,6 +153,31 @@ struct platform_device i2c_device = { .resource = i2c_resources, }; +/* nand device registeration */ +static struct fsmc_nand_platform_data nand_platform_data; + +static struct resource nand_resources[] = { + { + .name ="nand_data" , + .start =SPEAR6XX_ICM1_NAND_BASE , + .end =SPEAR6XX_ICM1_NAND_BASE +SZ_16 -1 , + .flags =IORESOURCE_MEM , + }, { + .name ="fsmc_regs" , + .start =SPEAR6XX_ICM1_FSMC_BASE , + .end =SPEAR6XX_ICM1_FSMC_BASE +SZ_4K -1 , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device nand_device = { + .name ="nand" , + .id =-1 , + .resource = nand_resources, + .num_resources =ARRAY_SIZE (nand_resources), + .dev.platform_data = &nand_platform_data, +}; +/* usb host device registeration */ static struct resource ehci0_resources[] = { [0 ] = {arch/arm/plat-spear/include/plat/fsmc.h new file +36
-0@@ -0,0 +1,36 @@ +/* +* arch/arm/plat-spear/include/plat/fsmc.h +* +* FSMC definitions for SPEAr platform +* +* Copyright (C) 2010 ST Microelectronics +* Vipin Kumar <[email protected]> +* +* This file is licensed under the terms of the GNU General Public +* License version 2. This program is licensed "as is" without any +* warranty of any kind, whether express or implied. +*/ + +#ifndef __PLAT_FSMC_H +#define __PLAT_FSMC_H + +#include <mtd/fsmc.h> + +/* This function is used to set platform data field of pdev->dev */ +static inline void fsmc_nand_set_plat_data (struct platform_device *pdev, +struct mtd_partition *partitions,unsigned int nr_partitions, +unsigned int options,unsigned int width) +{ +struct fsmc_nand_platform_data *plat_data; + plat_data =dev_get_platdata (&pdev->dev); + +if (partitions) { + plat_data->partitions = partitions; + plat_data->nr_partitions = nr_partitions; + } + + plat_data->options = options; + plat_data->width = width; +} + +#endif /* __PLAT_FSMC_H */
PATCH v2 28/69 ST SPEAr: Adding machine support for nand
Quoted 5 lines · stanley.miao
Hi, Viresh,
It looked you missed the file
include/mtd/fsmc.hin this patch.Stanley.
Hi Stanley,
I sent this patchset after linus walleij has submitted patchset for fsmc. In that patchset fsmc.h was at include/mtd/fsmc.h, but later it was placed at include/linux/mtd/fsmc.h.
I am waiting for few of our drivers to be pushed in mainline, then i will send final V3 version for this patchset.
Signature · 1 line
viresh
Re: [PATCH V2 25/69] ST SPEAr: Add smi driver for serial NOR flash
In reply to viresh kumarQuoted 23 lines · viresh kumar
Quoted 22 lines · viresh kumar
Quoted 20 lines · Viresh KUMAR
From: Shiraz Hashim <[email protected]>
SPEAr platforms(spear3xx/spear6xx/spear13xx) provide SMI(Serial Memory Interface) controller to access serial NOR flash. SMI provides a simple interface for SPI/serial NOR flashes and has certain inbuilt commands and features to support these flashes easily. It also makes it possible to map an address range in order to directly access (read/write) the SNOR over address bus. This patch intends to provide serial nor driver support for spear platforms which are accessed through SMI.
Signed-off-by Shiraz Hashim <[email protected]>Signed-off-by Viresh Kumar <[email protected]>--- arch/arm/plat-spear/include/plat/smi.h | 68 ++ drivers/mtd/devices/Kconfig | 7 + drivers/mtd/devices/Makefile | 1 + drivers/mtd/devices/spear_smi.c | 1122 ++++++++++++++++++++++++++++++++ 4 files changed, 1198 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-spear/include/plat/smi.h create mode 100644 drivers/mtd/devices/spear_smi.c
Quoted 9 lines
Quoted 4 lines
David,
Any review comments on this patch??
David,
Any review comments??
David,
Is this patch OK? Actually i have sent this patch as part of a big patchset. And my whole patchset is on hold untill i get this acked.
Please see if you can get some time to review this patch.
--
viresh
Re: [PATCH V2 25/69] ST SPEAr: Add smi driver for serial NOR flash
Quoted 3 lines · viresh kumar
Is this patch OK? Actually i have sent this patch as part of a big patchset. And my whole patchset is on hold untill i get this acked.
Please see if you can get some time to review this patch.
Would be simpler if you can separate mtd pieces.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)