Smedia Glamo 3362 drivers
Subsystems (4)
cover Smedia Glamo 3362 drivers
Those drivers provide MMC and display functionalities of the Smedia Glamo 3362, a multi-function device used in the Neo FreeRunner.
First patch is for the glamo core driver, needed for every other driver. The second is for MMC support.
The third is for the GPIO interface.
The last one is for the framebuffer driver. In the case of the FreeRunner, it is only useful with the glamo-gpio driver.
PATCH 1/4 Smedia Glamo 3362 core/resource driver
This driver provides base support for the Smedia Glamo 3362 multi-function device.
--- drivers/mfd/Kconfig | 8 + drivers/mfd/Makefile | 1 + drivers/mfd/glamo-core.c | 1299 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/glamo-core.h | 58 ++ include/linux/mfd/glamo-regs.h | 630 +++++++++++++++++++ include/linux/mfd/glamo.h | 54 ++ 6 files changed, 2050 insertions(+), 0 deletions(-) create mode 100644 drivers/mfd/glamo-core.c create mode 100644 include/linux/mfd/glamo-core.h create mode 100644 include/linux/mfd/glamo-regs.h create mode 100644 include/linux/mfd/glamo.h
drivers/mfd/Kconfig +8 -0
@@ -505,4 +505,12 @@ config MCP_UCB1200_TS tristate "Touchscreen interface support" depends on MCP_UCB1200 && INPUT +config MFD_GLAMO + bool "Smedia Glamo 336x/337x support" + select MFD_CORE + help + This enables the core driver for the Smedia Glamo 336x/337x + multi-function device. It includes irq_chip demultiplex as + well as clock / power management and GPIO support. + endmenu
drivers/mfd/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o obj-$(CONFIG_MFD_SM501) += sm501.o obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o obj-$(CONFIG_MFD_SH_MOBILE_SDHI) += sh_mobile_sdhi.o +obj-$(CONFIG_MFD_GLAMO) += glamo-core.o obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o
drivers/mfd/glamo-core.c new file +1299 -0
1,299 lines not on this page · raw message
include/linux/mfd/glamo-core.h new file +58 -0
58 lines not on this page · raw message
include/linux/mfd/glamo-regs.h new file +630 -0
630 lines not on this page · raw message
include/linux/mfd/glamo.h new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
1.7.1
Re: [PATCH 1/4] Smedia Glamo 3362 core/resource driver
Hi Thibaut,
drivers/mfd/glamo-core.c line 61
Quoted 9 lines · Thibaut Girka
drivers/mfd/glamo-core.c new file +9
-0+#define GLAMO_IRQ_HOSTBUS 0 +#define GLAMO_IRQ_JPEG 1 +#define GLAMO_IRQ_MPEG 2 +#define GLAMO_IRQ_MPROC1 3 +#define GLAMO_IRQ_MPROC0 4 +#define GLAMO_IRQ_CMDQUEUE 5 +#define GLAMO_IRQ_2D 6 +#define GLAMO_IRQ_MMC 7 +#define GLAMO_IRQ_RISC 8
This is conflicting with enum glamo_irq, please fix your namespaces.
drivers/mfd/glamo-core.c line 69
Quoted 8 lines
drivers/mfd/glamo-core.c new file +8
-0+ +/* +* Glamo internal settings +* +* We run the memory interface from the faster PLLB on 2.6.28 kernels and +* above. Couple of GTA02 users report trouble with memory bus when they +* upgraded from 2.6.24. So this parameter allows reversion to 2.6.24 +* scheme if their Glamo chip needs it.
So you're saying that a couple users reported a bug on a specific kernel revision, with the same HW, but all other users haven't ? Couldnt that be related to a specific HW revision ?
Also, this code should be scheduled for 2.6.37, and we're not going to carry code to allow it to run on 2.6.28.
Quoted 8 lines
drivers/mfd/glamo-core.c new file +8
-0+static const struct reg_range reg_range[] = { + {0x0000 ,0x76 ,"General" ,1 }, + {0x0200 ,0x18 ,"Host Bus" ,1 }, + {0x0300 ,0x38 ,"Memory" ,1 }, +/* { 0x0400, 0x100, "Sensor", 0 }, */ +/* { 0x0500, 0x300, "ISP", 0 }, */ +/* { 0x0800, 0x400, "JPEG", 0 }, */ +/* { 0x0c00, 0xcc, "MPEG", 0 }, */
drivers/mfd/glamo-core.c line 105
Quoted 10 lines
drivers/mfd/glamo-core.c new file +10
-0+ { 0x1100, 0xb2, "LCD 1", 0 }, + { 0x1200, 0x64, "LCD 2", 0 }, + { 0x1400, 0x42, "MMC", 0 }, +/* { 0x1500, 0x080, "MPU 0", 0 }, +{ 0x1580, 0x080, "MPU 1", 0 }, +{ 0x1600, 0x080, "Cmd Queue", 0 }, +{ 0x1680, 0x080, "RISC CPU", 0 },*/ + { 0x1700, 0x400, "2D Unit", 0 }, +/* { 0x1b00, 0x900, "3D Unit", 0 }, */ +};
Please remove the commented code from this array.
Quoted 28 lines
drivers/mfd/glamo-core.c new file +28
-0+static void glamo_irq_demux_handler (unsigned int irq,struct irq_desc *desc) +{ +struct glamo_core *glamo =get_irq_desc_data (desc); + desc->status &= ~(IRQ_REPLAY |IRQ_WAITING ); + +if (unlikely (desc->status &IRQ_INPROGRESS )) { + desc->status |= (IRQ_PENDING |IRQ_MASKED ); + desc->chip->mask (irq); + desc->chip->ack (irq); +return ; + } +kstat_incr_irqs_this_cpu (irq, desc); + + desc->chip->ack (irq); + desc->status |=IRQ_INPROGRESS ; + + do { + uint16_t irqstatus; + int i; + + if (unlikely((desc->status & + (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) == + (IRQ_PENDING | IRQ_MASKED))) { + /* dealing with pending IRQ, unmasking */ + desc->chip->unmask(irq); + desc->status &= ~IRQ_MASKED; + } +
drivers/mfd/glamo-core.c line 317
Quoted 10 lines
drivers/mfd/glamo-core.c new file +10
-0+ desc->status &= ~IRQ_PENDING ; + +/* read IRQ status register */ + irqstatus =__reg_read (glamo,GLAMO_REG_IRQ_STATUS ); +for (i =0 ; i <9 ; ++i) { +if (irqstatus &BIT (i)) +generic_handle_irq (glamo->irq_base + i); + } + + }while ((desc->status & (IRQ_PENDING |IRQ_DISABLED )) ==IRQ_PENDING );
So here you're busy looping in an interrupt handler, and that's not recommended.
Quoted 55 lines
drivers/mfd/glamo-core.c new file +55
-0+#ifdef CONFIG_DEBUG_FS +static ssize_t debugfs_regs_write (struct file *file, +const char __user *user_buf, +size_t count,loff_t *ppos) +{ +struct glamo_core *glamo = ((struct seq_file *)file->private_data)->private; +char buf[14 ]; +unsigned int reg; +unsigned int val; +int buf_size; + + buf_size =min (count,sizeof (buf) -1 ); +if (copy_from_user (buf, user_buf, buf_size)) +return -EFAULT ; +if (sscanf (buf,"%x %x" , ®, &val) !=2 ) +return -EFAULT ; + +dev_info (&glamo->pdev->dev,"reg %#02x <-- %#04x\n" , reg, val); + +glamo_reg_write (glamo, reg, val); + +return count; +} + +static int glamo_show_regs (struct seq_file *s,void *pos) +{ +struct glamo_core *glamo = s->private; +int i, n; +const struct reg_range *rr = reg_range; + +spin_lock (&glamo->lock); +for (i =0 ; i <ARRAY_SIZE (reg_range); ++i, ++rr) { +if (!rr->dump) +continue ; +seq_printf (s,"\n%s\n" , rr->name); +for (n = rr->start; n < rr->start + rr->count; n +=2 ) { +if ((n &15 ) ==0 ) +seq_printf (s,"\n%04X: " , n); +seq_printf (s,"%04x " ,__reg_read (glamo, n)); + } +seq_printf (s,"\n" ); + } +spin_unlock (&glamo->lock); + +return 0 ; +} + +static int debugfs_open_file (struct inode *inode,struct file *file) +{ +return single_open (file, glamo_show_regs, inode->i_private); +} + +static const struct file_operations debugfs_regs_ops = { + .open = debugfs_open_file, + .read = seq_read,
drivers/mfd/glamo-core.c line 390
Quoted 10 lines
drivers/mfd/glamo-core.c new file +10
-0+ .llseek = seq_lseek, + .write = debugfs_regs_write, + .release = single_release, +}; + +struct glamo_engine_reg_set { +uint16_t reg; +uint16_t mask_suspended; +uint16_t mask_enabled; +};
I think you want this definition outside of the DEBUGFS if.else.endif scope. Have you tried building this driver without DEBUGFS enabled ?
Quoted 6 lines
drivers/mfd/glamo-core.c new file +6
-0+static const struct glamo_engine_reg_set glamo_lcd_regs[] = { + {GLAMO_REG_CLOCK_LCD , +GLAMO_CLOCK_LCD_EN_M5CLK | +GLAMO_CLOCK_LCD_DG_M5CLK | +GLAMO_CLOCK_LCD_EN_DMCLK , +
drivers/mfd/glamo-core.c line 440
Quoted 10 lines
drivers/mfd/glamo-core.c new file +10
-0+GLAMO_CLOCK_LCD_EN_DHCLK | +GLAMO_CLOCK_LCD_EN_DCLK + }, + { GLAMO_REG_CLOCK_GEN5_1, +GLAMO_CLOCK_GEN51_EN_DIV_DMCLK , + +GLAMO_CLOCK_GEN51_EN_DIV_DHCLK | + GLAMO_CLOCK_GEN51_EN_DIV_DCLK + } +};
Identation could be clearer here:
static const struct glamo_engine_reg_set glamo_lcd_regs[] = {
{
GLAMO_REG_CLOCK_LCD,
GLAMO_CLOCK_LCD_EN_M5CLK |
GLAMO_CLOCK_LCD_DG_M5CLK |
GLAMO_CLOCK_LCD_EN_DMCLK,
GLAMO_CLOCK_LCD_EN_DHCLK |
GLAMO_CLOCK_LCD_EN_DCLK
},[...]
drivers/mfd/glamo-core.c line 754
Quoted 12 lines
drivers/mfd/glamo-core.c new file +12
-0+/*********************************************************************** +* script support +***********************************************************************/ + +#define GLAMO_SCRIPT_END 0xffff +#define GLAMO_SCRIPT_WAIT 0xfffe +#define GLAMO_SCRIPT_LOCK_PLL 0xfffd + +/* +* couple of people reported artefacts with 2.6.28 changes, this +* allows reversion to 2.6.24 settings +*/
Same remark as with the module option: This is going to be a 2.6.37 driver, and I'd like you to check if you're still seeing those issues before carrying these kind of hacks.
Quoted 61 lines
drivers/mfd/glamo-core.c new file +61
-0+static const struct glamo_script glamo_init_script[] = { + {GLAMO_REG_CLOCK_HOST ,0x1000 }, + {GLAMO_SCRIPT_WAIT ,2 }, + {GLAMO_REG_CLOCK_MEMORY ,0x1000 }, + {GLAMO_REG_CLOCK_MEMORY ,0x2000 }, + {GLAMO_REG_CLOCK_LCD ,0x1000 }, + {GLAMO_REG_CLOCK_MMC ,0x1000 }, + {GLAMO_REG_CLOCK_ISP ,0x1000 }, + {GLAMO_REG_CLOCK_ISP ,0x3000 }, + {GLAMO_REG_CLOCK_JPEG ,0x1000 }, + {GLAMO_REG_CLOCK_3D ,0x1000 }, + {GLAMO_REG_CLOCK_3D ,0x3000 }, + {GLAMO_REG_CLOCK_2D ,0x1000 }, + {GLAMO_REG_CLOCK_2D ,0x3000 }, + {GLAMO_REG_CLOCK_RISC1 ,0x1000 }, + {GLAMO_REG_CLOCK_MPEG ,0x1000 }, + {GLAMO_REG_CLOCK_MPEG ,0x3000 }, + {GLAMO_REG_CLOCK_MPROC ,0x1000 /*0x100f*/ }, + {GLAMO_SCRIPT_WAIT ,2 }, + {GLAMO_REG_CLOCK_HOST ,0x0000 }, + {GLAMO_REG_CLOCK_MEMORY ,0x0000 }, + {GLAMO_REG_CLOCK_LCD ,0x0000 }, + {GLAMO_REG_CLOCK_MMC ,0x0000 }, + {GLAMO_REG_PLL_GEN1 ,0x05db },/* 48MHz */ + {GLAMO_REG_PLL_GEN3 ,0x0aba },/* 90MHz */ + {GLAMO_SCRIPT_LOCK_PLL ,0 }, +/* +* b9 of this register MUST be zero to get any interrupts on INT# +* the other set bits enable all the engine interrupt sources +*/ + {GLAMO_REG_IRQ_ENABLE ,0x0100 }, + {GLAMO_REG_CLOCK_GEN6 ,0x2000 }, + {GLAMO_REG_CLOCK_GEN7 ,0x0101 }, + {GLAMO_REG_CLOCK_GEN8 ,0x0100 }, + {GLAMO_REG_CLOCK_HOST ,0x000d }, +/* +* b7..b4 = 0 = no wait states on read or write +* b0 = 1 select PLL2 for Host interface, b1 = enable it +*/ + {GLAMO_REG_HOSTBUS (1 ),0x0e03 /* this is replaced by script parser */ }, + {GLAMO_REG_HOSTBUS (2 ),0x07ff },/* TODO: Disable all */ + {GLAMO_REG_HOSTBUS (10 ),0x0000 }, + {GLAMO_REG_HOSTBUS (11 ),0x4000 }, + {GLAMO_REG_HOSTBUS (12 ),0xf00e }, + +/* S-Media recommended "set tiling mode to 512 mode for memory access +* more efficiency when 640x480" */ + {GLAMO_REG_MEM_TYPE ,0x0c74 },/* 8MB, 16 word pg wr+rd */ + {GLAMO_REG_MEM_GEN ,0xafaf },/* 63 grants min + max */ + + {GLAMO_REG_MEM_TIMING1 ,0x0108 }, + {GLAMO_REG_MEM_TIMING2 ,0x0010 },/* Taa = 3 MCLK */ + {GLAMO_REG_MEM_TIMING3 ,0x0000 }, + {GLAMO_REG_MEM_TIMING4 ,0x0000 },/* CE1# delay fall/rise */ + {GLAMO_REG_MEM_TIMING5 ,0x0000 },/* UB# LB# */ + {GLAMO_REG_MEM_TIMING6 ,0x0000 },/* OE# */ + {GLAMO_REG_MEM_TIMING7 ,0x0000 },/* WE# */ + {GLAMO_REG_MEM_TIMING8 ,0x1002 },/* MCLK delay, was 0x1000 */ + {GLAMO_REG_MEM_TIMING9 ,0x6006 }, + {GLAMO_REG_MEM_TIMING10 ,0x00ff }, + {GLAMO_REG_MEM_TIMING11 ,0x0001 },
drivers/mfd/glamo-core.c line 873
Quoted 10 lines
drivers/mfd/glamo-core.c new file +10
-0+ { GLAMO_REG_MEM_POWER1, 0x0020 }, + { GLAMO_REG_MEM_POWER2, 0x0000 }, + { GLAMO_REG_MEM_DRAM1, 0x0000 }, + { GLAMO_SCRIPT_WAIT, 1 }, + { GLAMO_REG_MEM_DRAM1, 0xc100 }, + { GLAMO_SCRIPT_WAIT, 1 }, + { GLAMO_REG_MEM_DRAM1, 0xe100 }, + { GLAMO_REG_MEM_DRAM2, 0x01d6 }, + { GLAMO_REG_CLOCK_MEMORY, 0x000b }, +};
Shouldnt those values be set by your platform bootloader ? They're obviously not, but I find it weird.
Quoted 18 lines
drivers/mfd/glamo-core.c new file +18
-0+#ifdef CONFIG_PM +#if 0 +static struct glamo_script glamo_resume_script[] = { + + {GLAMO_REG_PLL_GEN1 ,0x05db },/* 48MHz */ + {GLAMO_REG_PLL_GEN3 ,0x0aba },/* 90MHz */ + {GLAMO_REG_DFT_GEN6 ,1 }, + {0xfffe ,100 }, + {0xfffd ,0 }, + {0x200 ,0x0e03 }, + +/* +* b9 of this register MUST be zero to get any interrupts on INT# +* the other set bits enable all the engine interrupt sources +*/ + {GLAMO_REG_IRQ_ENABLE ,0x01ff }, + {GLAMO_REG_CLOCK_HOST ,0x0018 }, + { GLAMO_REG_CLOCK_GEN5_1, 0x18b1 },
drivers/mfd/glamo-core.c line 1106
Quoted 10 lines
drivers/mfd/glamo-core.c new file +10
-0+ + { GLAMO_REG_MEM_DRAM1, 0x0000 }, + { 0xfffe, 1 }, + { GLAMO_REG_MEM_DRAM1, 0xc100 }, + { 0xfffe, 1 }, + { GLAMO_REG_MEM_DRAM1, 0xe100 }, + { GLAMO_REG_MEM_DRAM2, 0x01d6 }, + { GLAMO_REG_CLOCK_MEMORY, 0x000b }, +}; +#endif
Please remove all #if 0 code from this driver.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 1/4] Smedia Glamo 3362 core/resource driver
Quoted 1 line · Samuel Ortiz
Hi Thibaut,
Hi!
Quoted 11 lines · Thibaut Girka
drivers/mfd/glamo-core.c line 61
Quoted 9 lines
drivers/mfd/glamo-core.c new file +9
-0+#define GLAMO_IRQ_HOSTBUS 0 +#define GLAMO_IRQ_JPEG 1 +#define GLAMO_IRQ_MPEG 2 +#define GLAMO_IRQ_MPROC1 3 +#define GLAMO_IRQ_MPROC0 4 +#define GLAMO_IRQ_CMDQUEUE 5 +#define GLAMO_IRQ_2D 6 +#define GLAMO_IRQ_MMC 7 +#define GLAMO_IRQ_RISC 8This is conflicting with enum
glamo_irq, please fix your namespaces.
Fixed.
Quoted 5 lines
Quoted 5 lines
drivers/mfd/glamo-core.c new file +5
-0+ +/* +* Glamo internal settings +* +* We run the memory interface from the faster PLLB on 2.6.28 kernels and
Quoted 8 lines
Quoted 3 lines
+ * above. Couple of GTA02 users report trouble with memory bus when they
+ * upgraded from 2.6.24. So this parameter allows reversion to 2.6.24
+ * scheme if their Glamo chip needs it.So you're saying that a couple users reported a bug on a specific kernel revision, with the same HW, but all other users haven't ? Couldnt that be related to a specific HW revision ?
Also, this code should be scheduled for 2.6.37, and we're not going to carry code to allow it to run on 2.6.28.
Well, OpenMoko, the project behind this driver, has been carrying its own linux tree for years, now, and "2.6.28" and "2.6.24" are referring to the whole branch, glamo-core included.
So, it hasn't really something to do with the kernel version, but with the version of the driver itself.
It is not here to allow the driver to run on a specific kernel version.
Quoted 11 lines
Quoted 11 lines
drivers/mfd/glamo-core.c new file +11
-0+static const struct reg_range reg_range[] = { + {0x0000 ,0x76 ,"General" ,1 }, + {0x0200 ,0x18 ,"Host Bus" ,1 }, + {0x0300 ,0x38 ,"Memory" ,1 }, +/* { 0x0400, 0x100, "Sensor", 0 }, */ +/* { 0x0500, 0x300, "ISP", 0 }, */ +/* { 0x0800, 0x400, "JPEG", 0 }, */ +/* { 0x0c00, 0xcc, "MPEG", 0 }, */ + {0x1100 ,0xb2 ,"LCD 1" ,0 }, + {0x1200 ,0x64 ,"LCD 2" ,0 }, + {0x1400 ,0x42 ,"MMC" ,0 },
Quoted 8 lines
drivers/mfd/glamo-core.c line 105
Quoted 7 lines
drivers/mfd/glamo-core.c new file +7
-0+/* { 0x1500, 0x080, "MPU 0", 0 }, +{ 0x1580, 0x080, "MPU 1", 0 }, +{ 0x1600, 0x080, "Cmd Queue", 0 }, +{ 0x1680, 0x080, "RISC CPU", 0 },*/ + { 0x1700, 0x400, "2D Unit", 0 }, +/* { 0x1b00, 0x900, "3D Unit", 0 }, */ +};Please remove the commented code from this array.
Hm, well, that may be useful, for "documentation" and future work, but we can remove it.
Quoted 32 lines
Quoted 32 lines
drivers/mfd/glamo-core.c new file +32
-0+static void glamo_irq_demux_handler (unsigned int irq,struct irq_desc *desc) +{ +struct glamo_core *glamo =get_irq_desc_data (desc); + desc->status &= ~(IRQ_REPLAY |IRQ_WAITING ); + +if (unlikely (desc->status &IRQ_INPROGRESS )) { + desc->status |= (IRQ_PENDING |IRQ_MASKED ); + desc->chip->mask (irq); + desc->chip->ack (irq); +return ; + } +kstat_incr_irqs_this_cpu (irq, desc); + + desc->chip->ack (irq); + desc->status |=IRQ_INPROGRESS ; + + do { + uint16_t irqstatus; + int i; + + if (unlikely((desc->status & + (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) == + (IRQ_PENDING | IRQ_MASKED))) { + /* dealing with pending IRQ, unmasking */ + desc->chip->unmask(irq); + desc->status &= ~IRQ_MASKED; + } + + desc->status &= ~IRQ_PENDING; + + /* read IRQ status register */ + irqstatus = __reg_read(glamo, GLAMO_REG_IRQ_STATUS);
Quoted 8 lines
drivers/mfd/glamo-core.c line 317
Quoted 6 lines
drivers/mfd/glamo-core.c new file +6
-0+for (i =0 ; i <9 ; ++i) { +if (irqstatus &BIT (i)) +generic_handle_irq (glamo->irq_base + i); + } + + }while ((desc->status & (IRQ_PENDING |IRQ_DISABLED )) ==IRQ_PENDING );So here you're busy looping in an interrupt handler, and that's not recommended.
Hm, ok... Not sure how to do that otherwise, but I'll have a look.
Quoted 9 lines
drivers/mfd/glamo-core.c line 390
Quoted 7 lines
drivers/mfd/glamo-core.c new file +6
-0+#ifdef CONFIG_DEBUG_FS +struct glamo_engine_reg_set { +uint16_t reg; +uint16_t mask_suspended; +uint16_t mask_enabled; +};I think you want this definition outside of the DEBUGFS if.else.endif scope. Have you tried building this driver without DEBUGFS enabled ?
Yes, indeed, it should be outside of the DEBUGFS scope. Fixed.
Quoted 28 lines
Quoted 6 lines
drivers/mfd/glamo-core.c new file +6
-0+static const struct glamo_engine_reg_set glamo_lcd_regs[] = { + {GLAMO_REG_CLOCK_LCD , +GLAMO_CLOCK_LCD_EN_M5CLK | +GLAMO_CLOCK_LCD_DG_M5CLK | +GLAMO_CLOCK_LCD_EN_DMCLK , +drivers/mfd/glamo-core.c line 440
Quoted 10 lines
drivers/mfd/glamo-core.c new file +10
-0+GLAMO_CLOCK_LCD_EN_DHCLK | +GLAMO_CLOCK_LCD_EN_DCLK + }, + { GLAMO_REG_CLOCK_GEN5_1, +GLAMO_CLOCK_GEN51_EN_DIV_DMCLK , + +GLAMO_CLOCK_GEN51_EN_DIV_DHCLK | + GLAMO_CLOCK_GEN51_EN_DIV_DCLK + } +};Identation could be clearer here:
static const struct glamo_engine_reg_set glamo_lcd_regs[] = { { GLAMO_REG_CLOCK_LCD, GLAMO_CLOCK_LCD_EN_M5CLK | GLAMO_CLOCK_LCD_DG_M5CLK | GLAMO_CLOCK_LCD_EN_DMCLK, GLAMO_CLOCK_LCD_EN_DHCLK | GLAMO_CLOCK_LCD_EN_DCLK },
Quoted 1 line
[...]
Done.
Quoted 16 lines
drivers/mfd/glamo-core.c line 754
Quoted 13 lines
drivers/mfd/glamo-core.c new file +12
-0+/*********************************************************************** +* script support +***********************************************************************/ + +#define GLAMO_SCRIPT_END 0xffff +#define GLAMO_SCRIPT_WAIT 0xfffe +#define GLAMO_SCRIPT_LOCK_PLL 0xfffd + +/* +* couple of people reported artefacts with 2.6.28 changes, this +* allows reversion to 2.6.24 settings +*/ Same remark as with the module option: This is going to be a 2.6.37 driver, and I'd like you to check if you're still seeing those issues before carrying these kind of hacks.
As stated before, it hasn't anything to do with kernel version. Though, I'm not sure this module parameter is still being used. I'll either get rid of that, or make it clear in the comments.
Quoted 65 lines
Quoted 65 lines
drivers/mfd/glamo-core.c new file +65
-0+static const struct glamo_script glamo_init_script[] = { + {GLAMO_REG_CLOCK_HOST ,0x1000 }, + {GLAMO_SCRIPT_WAIT ,2 }, + {GLAMO_REG_CLOCK_MEMORY ,0x1000 }, + {GLAMO_REG_CLOCK_MEMORY ,0x2000 }, + {GLAMO_REG_CLOCK_LCD ,0x1000 }, + {GLAMO_REG_CLOCK_MMC ,0x1000 }, + {GLAMO_REG_CLOCK_ISP ,0x1000 }, + {GLAMO_REG_CLOCK_ISP ,0x3000 }, + {GLAMO_REG_CLOCK_JPEG ,0x1000 }, + {GLAMO_REG_CLOCK_3D ,0x1000 }, + {GLAMO_REG_CLOCK_3D ,0x3000 }, + {GLAMO_REG_CLOCK_2D ,0x1000 }, + {GLAMO_REG_CLOCK_2D ,0x3000 }, + {GLAMO_REG_CLOCK_RISC1 ,0x1000 }, + {GLAMO_REG_CLOCK_MPEG ,0x1000 }, + {GLAMO_REG_CLOCK_MPEG ,0x3000 }, + {GLAMO_REG_CLOCK_MPROC ,0x1000 /*0x100f*/ }, + {GLAMO_SCRIPT_WAIT ,2 }, + {GLAMO_REG_CLOCK_HOST ,0x0000 }, + {GLAMO_REG_CLOCK_MEMORY ,0x0000 }, + {GLAMO_REG_CLOCK_LCD ,0x0000 }, + {GLAMO_REG_CLOCK_MMC ,0x0000 }, + {GLAMO_REG_PLL_GEN1 ,0x05db },/* 48MHz */ + {GLAMO_REG_PLL_GEN3 ,0x0aba },/* 90MHz */ + {GLAMO_SCRIPT_LOCK_PLL ,0 }, +/* +* b9 of this register MUST be zero to get any interrupts on INT# +* the other set bits enable all the engine interrupt sources +*/ + {GLAMO_REG_IRQ_ENABLE ,0x0100 }, + {GLAMO_REG_CLOCK_GEN6 ,0x2000 }, + {GLAMO_REG_CLOCK_GEN7 ,0x0101 }, + {GLAMO_REG_CLOCK_GEN8 ,0x0100 }, + {GLAMO_REG_CLOCK_HOST ,0x000d }, +/* +* b7..b4 = 0 = no wait states on read or write +* b0 = 1 select PLL2 for Host interface, b1 = enable it +*/ + {GLAMO_REG_HOSTBUS (1 ),0x0e03 /* this is replaced by script parser */ }, + {GLAMO_REG_HOSTBUS (2 ),0x07ff },/* TODO: Disable all */ + {GLAMO_REG_HOSTBUS (10 ),0x0000 }, + {GLAMO_REG_HOSTBUS (11 ),0x4000 }, + {GLAMO_REG_HOSTBUS (12 ),0xf00e }, + +/* S-Media recommended "set tiling mode to 512 mode for memory access +* more efficiency when 640x480" */ + {GLAMO_REG_MEM_TYPE ,0x0c74 },/* 8MB, 16 word pg wr+rd */ + {GLAMO_REG_MEM_GEN ,0xafaf },/* 63 grants min + max */ + + {GLAMO_REG_MEM_TIMING1 ,0x0108 }, + {GLAMO_REG_MEM_TIMING2 ,0x0010 },/* Taa = 3 MCLK */ + {GLAMO_REG_MEM_TIMING3 ,0x0000 }, + {GLAMO_REG_MEM_TIMING4 ,0x0000 },/* CE1# delay fall/rise */ + {GLAMO_REG_MEM_TIMING5 ,0x0000 },/* UB# LB# */ + {GLAMO_REG_MEM_TIMING6 ,0x0000 },/* OE# */ + {GLAMO_REG_MEM_TIMING7 ,0x0000 },/* WE# */ + {GLAMO_REG_MEM_TIMING8 ,0x1002 },/* MCLK delay, was 0x1000 */ + {GLAMO_REG_MEM_TIMING9 ,0x6006 }, + {GLAMO_REG_MEM_TIMING10 ,0x00ff }, + {GLAMO_REG_MEM_TIMING11 ,0x0001 }, + {GLAMO_REG_MEM_POWER1 ,0x0020 }, + {GLAMO_REG_MEM_POWER2 ,0x0000 }, + {GLAMO_REG_MEM_DRAM1 ,0x0000 }, + {GLAMO_SCRIPT_WAIT ,1 },
Quoted 8 lines
drivers/mfd/glamo-core.c line 873
Quoted 6 lines
drivers/mfd/glamo-core.c new file +6
-0+ { GLAMO_REG_MEM_DRAM1, 0xc100 }, + { GLAMO_SCRIPT_WAIT, 1 }, + { GLAMO_REG_MEM_DRAM1, 0xe100 }, + { GLAMO_REG_MEM_DRAM2, 0x01d6 }, + { GLAMO_REG_CLOCK_MEMORY, 0x000b }, +};Shouldnt those values be set by your platform bootloader ? They're obviously not, but I find it weird.
I'm not sure, I have to check.
There are at least two bootloader for the FreeRunner, and one of them is meant to do as little as possible.
Furthermore, the code in the default bootloader is mostly based on a copy of an old version of this driver.
Quoted 1 line
Please remove all #if 0 code from this driver.
Hm, ok, checking that, but again, it can be of help for future work (some sort of documentation).
Quoted 2 lines
Cheers,
Samuel.
PATCH 2/4 Smedia Glamo 3362 MMC/SD Card Interface driver
In reply to Thibaut Girka--- drivers/mmc/host/Kconfig | 11 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/glamo-mci.c | 985 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 997 insertions(+), 0 deletions(-) create mode 100644 drivers/mmc/host/glamo-mci.c
drivers/mmc/host/Kconfig +11 -0
@@ -365,6 +365,17 @@ config MMC_S3C_PIODMA endchoice +config MMC_GLAMO + tristate "Glamo S3C SD/MMC Card Interface support" + depends on MFD_GLAMO && MMC && REGULATOR + select CRC7 + help + This selects a driver for the MCI interface found in + the S-Media GLAMO chip, as used in Openmoko + neo1973 GTA-02. + + If unsure, say N. + config MMC_SDRICOH_CS tristate "MMC/SD driver for Ricoh Bay1Controllers (EXPERIMENTAL)" depends on EXPERIMENTAL && PCI && PCMCIA
drivers/mmc/host/Makefile +1 -0
@@ -30,6 +30,7 @@ ifeq ($(CONFIG_OF),y) obj-$(CONFIG_MMC_SPI) += of_mmc_spi.o endif obj-$(CONFIG_MMC_S3C) += s3cmci.o +obj-$(CONFIG_MMC_GLAMO) += glamo-mci.o obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o obj-$(CONFIG_MMC_CB710) += cb710-mmc.o
drivers/mmc/host/glamo-mci.c new file +985 -0
985 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 3/4 Smedia Glamo 3362 GPIO interface driver
In reply to Thibaut Girka--- drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/glamo-gpio.c | 284 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 291 insertions(+), 0 deletions(-) create mode 100644 drivers/gpio/glamo-gpio.c
drivers/gpio/Kconfig +6 -0
@@ -70,6 +70,12 @@ config GPIO_MAX730X comment "Memory mapped GPIO expanders:" +config GPIO_GLAMO + tristate "Glamo GPIO support" + depends on MFD_GLAMO + help + Say yes here to support GPIO functionality of the Smedia Glamo. + config GPIO_IT8761E tristate "IT8761E GPIO support" depends on GPIOLIB
drivers/gpio/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_GPIOLIB) += gpiolib.o obj-$(CONFIG_GPIO_ADP5520) += adp5520-gpio.o obj-$(CONFIG_GPIO_ADP5588) += adp5588-gpio.o +obj-$(CONFIG_GPIO_GLAMO) += glamo-gpio.o obj-$(CONFIG_GPIO_LANGWELL) += langwell_gpio.o obj-$(CONFIG_GPIO_MAX730X) += max730x.o obj-$(CONFIG_GPIO_MAX7300) += max7300.o
drivers/gpio/glamo-gpio.c new file +284 -0
284 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 4/4 Smedia Glamo 3362 Framebuffer driver
In reply to Thibaut Girka--- drivers/video/Kconfig | 17 + drivers/video/Makefile | 1 + drivers/video/glamo-fb.c | 943 ++++++++++++++++++++++++++++++++++++++++++++++ include/linux/fb.h | 1 + include/linux/glamofb.h | 21 + 5 files changed, 983 insertions(+), 0 deletions(-) create mode 100644 drivers/video/glamo-fb.c create mode 100644 include/linux/glamofb.h
drivers/video/Kconfig +17 -0
@@ -2229,6 +2229,23 @@ config FB_BROADSHEET and could also have been called by other names when coupled with a bridge adapter. +config FB_GLAMO + tristate "Smedia Glamo 336x/337x framebuffer support" + depends on FB && MFD_GLAMO + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + help + Frame buffer driver for the LCD controller in the Smedia Glamo + 336x/337x. + + This driver is also available as a module ( = code which can be + inserted and removed from the running kernel whenever you want). The + module will be called glamofb. If you want to compile it as a module, + say M here and read <file:Documentation/modules.txt>. + + If unsure, say N. + source "drivers/video/omap/Kconfig" source "drivers/video/omap2/Kconfig"
drivers/video/Makefile +1 -0
@@ -131,6 +131,7 @@ obj-$(CONFIG_FB_CARMINE) += carminefb.o obj-$(CONFIG_FB_MB862XX) += mb862xx/ obj-$(CONFIG_FB_MSM) += msm/ obj-$(CONFIG_FB_NUC900) += nuc900fb.o +obj-$(CONFIG_FB_GLAMO) += glamo-fb.o # Platform or fallback drivers go here obj-$(CONFIG_FB_UVESA) += uvesafb.o
drivers/video/glamo-fb.c new file +943 -0
943 lines not on this page · raw message
include/linux/fb.h +1 -0
@@ -132,6 +132,7 @@#define FB_ACCEL_NEOMAGIC_NM2360 97/* NeoMagic NM2360 */ #define FB_ACCEL_NEOMAGIC_NM2380 98/* NeoMagic NM2380 */ #define FB_ACCEL_PXA3XX 99/* PXA3xx */ +#define FB_ACCEL_GLAMO 100/* Smedia Glamo 3362 */ #define FB_ACCEL_SAVAGE4 0x80/* S3 Savage4 */ #define FB_ACCEL_SAVAGE3D 0x81/* S3 Savage3D */
include/linux/glamofb.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef _LINUX_GLAMOFB_H +#define _LINUX_GLAMOFB_H + +#ifdef __KERNEL__ + +#include <linux/fb.h> + +struct glamo_fb_platform_data { +int width, height; + +int num_modes; +struct fb_videomode *modes; +}; + +#endif + +#define GLAMOFB_ENGINE_ENABLE _IOW('F', 0x1, __u32) +#define GLAMOFB_ENGINE_DISABLE _IOW('F', 0x2, __u32) +#define GLAMOFB_ENGINE_RESET _IOW('F', 0x3, __u32) + +#endif
Signature · 1 line
1.7.1
Hi Thibaut,
Quoted 8 lines · Thibaut Girka
Those drivers provide MMC and display functionalities of the Smedia Glamo 3362, a multi-function device used in the Neo FreeRunner.
First patch is for the glamo core driver, needed for every other driver. The second is for MMC support.
The third is for the GPIO interface.
The last one is for the framebuffer driver. In the case of the FreeRunner, it is only useful with the glamo-gpio driver.
I finally reviewed the MFD driver. Sorry for being so lazy. Could you please re-send the other ones with the corresponding maintainers Cc'ed ? I can have a look at the GPIO one, but the MMC and the framebuffer ones are out of my league.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/