ARM: Add basic architecture support for VIA/WonderMedia 85xx SoC's
Subsystems (10)
Alexey Charkov
maintainer2010/12/21 Ryan Mallon <[email protected]>:
Quoted 95 lines · Alexey Charkov
Quoted 80 lines
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 71 lines · Alexey Charkov
Quoted 43 lines
2010/12/20 Ryan Mallon <[email protected]>:
Quoted 19 lines · Alexey Charkov
Quoted 7 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Quoted 7 lines
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>Hi Alexey,
Quick review below.
<snip>
Quoted 12 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+void __init wmt_set_resources(void) +{ + ? ? resources_lcdc[0].start = wmt_current_regs->lcdc; + ? ? resources_lcdc[0].end = wmt_current_regs->lcdc + SZ_1K - 1; + ? ? resources_lcdc[1].start = wmt_current_irqs->lcdc; + ? ? resources_lcdc[1].end = wmt_current_irqs->lcdc;Ah, this makes more sense. But why have all the indirection? The
wmt_regmapstable could just be replaced with #defines and then have separate device files for the VT8500 and the WM8505. This would also make clearer which variants have which peripherals.This was the way I implemented it originally. However, Arnd made quite a valid suggestion to allow runtime selection of the chip variant, thus registers and interrupts need to be held in an indexed data type instead of just compile-time macros. In addition, there is now some overall movement towards unification of binary kernel images for different ARM variants (as far as I can see), so this would be required in any case.
Quoted 4 lines
Furthermore, as with many unbranded Chinese products, it's somewhat difficult to reliably determine the exact chip version used in your netbook without disassembling it. Reading a hardware register for identification is easier :)
Okay, that makes sense. I still think there must be a better way than having a massive indirect table with all the values. Why not detect the variant in the core code and then have something like:
int
init_devices(void)
{
? ? ? ?intboard_type=detect_board_type();? ? ? ?switch (
board_type) {
? ? ? ?caseBOARD_TYPE_VT8500:
? ? ? ? ? ? ? ?returnvt8500_init_devices();? ? ? ?case
BOARD_TYPE_WM8505:
? ? ? ? ? ? ? ?returnwm8500_init_devices();
? ? ? ?}? ? ? ?pr_err("Unknown board type\n");
? ? ? ?BUG(); /*panic()? */
? ? ? ?while (1)
? ? ? ? ? ? ? ?;
}Quoted 7 lines
Then you can have the peripheral setup for each of the variants in their own files and use #defines. It may get tricky in a couple of places if you need to be able to access some value directly which is different on each of the variants, but that can be handled on a case by case basis. The majority of the numbers will be passed into drivers via the resource structs.
Quoted 7 lines
This is more or less what I'm doing right now - except for the separation between different files. I tried to avoid duplication of similar things here. Is the indirect table really a big issue? I'm a bit reluctant to copy about the whole
devices.cfor each chip variant, which would be otherwise required. Further, it would add more complexity to the timer, irq, gpio, i8042 and probably some other places.Yeah, agreed about the duplication. My approach would require the common peripherals to be defined for each variant. I'm not entirely against the indirect table (and am even starting to think it may be the best overall solution), it's just that it can be a bit difficult to follow because to add a device you need to do the following:
Quoted 5 lines
?- Add a partially empty resource/platform_device struct ?- Add resource entries to the resource table definition ?- Add resource values to the resource table
?- Add assignment of resource values to device init code
That's actually only one step more than what machines with static resource definitions require (the last one). Flexibility does come at a cost, so there should be a mathematical limit to optimization of this thing :)
Quoted 37 lines
The indirection also makes it harder to quickly determine the IRQ number of memory address of a peripheral.
The current solution using the indirect table is okay, but it would be nice to find a solution which reduces some of this effort.
Quoted 31 lines
Quoted 30 lines
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-vt8500/pwm.c new file +8
-0+} + +int pwm_config (struct pwm_device *pwm,int duty_ns,int period_ns) +{ + ? ? unsigned long long c; + ? ? unsigned long period_cycles, prescale, pv, dc; + + ? ? if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)Quoted 9 lines
Quoted 6 lines
+ ? ? ? ? ? ? return
-EINVAL;
+
+ ? ? c = 25000000/2; /* wild guess --- need to implement clocks */
+ ? ? c = c *period_ns;
+ ? ?do_div(c, 1000000000);
+ ? ?period_cycles= c;This looks like it could be reworked to remove the
do_divcall.Quoted 4 lines
I just followed PXA implementation in this regard. Are there any specific suggestions? Note that c should not be a complie-time constant eventually, as this is the guessed PWM base frequency (should be read from the hardware, but the code for clocks is not yet in).
I didn't have a particular solution in mind, but often by changing the units used and rearranging the math a bit you can often avoid having to do horrible multiplies and divides.
For now at least you could avoid the
do_divby assigningperiod_cyclesdirectly.
Quoted 9 lines
Quoted 2 lines
It depends on
period_ns, which is passed in as an argument from whatever uses PWM, so I'm not sure it can be assigned directly.Ah. How big a number is
period_ns? Can you do something like this instead?? ? ? ?period_cycles = ((250 / 2) *
period_ns) / 10000;and still safely avoid overflows?
The only current in-kernel user of PWM is the backlight, and that currently uses period_ns = 250000. At this value it does not overflow. However, in a general case the base frequency will also be returned as a large number (like 12500000) as per CLK infrastructure conventions (once that part is implemented). Further, I can't see any built-in reasons for period_ns to be bounded by anything below sizeof(int). The hardware will work with up to 4096*1024*1000000000/base_frequency (see the code for constraints), so it can in principle overflow with 32 bit arithmetics.
Best regards,
Alexey
Alexey Charkov
maintainer2010/12/21 Alexey Charkov <[email protected]>:
Quoted 47 lines
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 36 lines · Alexey Charkov
Quoted 35 lines
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 33 lines · Alexey Charkov
Quoted 20 lines
2010/12/20 Ryan Mallon <[email protected]>:
Quoted 9 lines · Alexey Charkov
Quoted 8 lines
(quoted diff) +8
-0+} + +int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) +{ + ? ? unsigned long long c; + ? ? unsigned long period_cycles, prescale, pv, dc; + + ? ? if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)Quoted 9 lines
Quoted 6 lines
+ ? ? ? ? ? ? return
-EINVAL;
+
+ ? ? c = 25000000/2; /* wild guess --- need to implement clocks */
+ ? ? c = c *period_ns;
+ ? ?do_div(c, 1000000000);
+ ? ?period_cycles= c;This looks like it could be reworked to remove the
do_divcall.Quoted 4 lines
I just followed PXA implementation in this regard. Are there any specific suggestions? Note that c should not be a complie-time constant eventually, as this is the guessed PWM base frequency (should be read from the hardware, but the code for clocks is not yet in).
I didn't have a particular solution in mind, but often by changing the units used and rearranging the math a bit you can often avoid having to do horrible multiplies and divides.
For now at least you could avoid the
do_divby assigningperiod_cyclesdirectly.Quoted 9 lines
Quoted 2 lines
It depends on
period_ns, which is passed in as an argument from whatever uses PWM, so I'm not sure it can be assigned directly.Ah. How big a number is
period_ns? Can you do something like this instead?? ? ? ?period_cycles = ((250 / 2) *
period_ns) / 10000;and still safely avoid overflows?
Quoted 10 lines
The only current in-kernel user of PWM is the backlight, and that currently uses
period_ns= 250000. At this value it does not overflow. However, in a general case the base frequency will also be returned as a large number (like 12500000) as per CLK infrastructure conventions (once that part is implemented). Further, I can't see any built-in reasons forperiod_nsto be bounded by anything below sizeof(int). The hardware will work with up to 4096*1024*1000000000/base_frequency (see the code for constraints), so it can in principle overflow with 32 bit arithmetics.
This discussion led me to look closer at the duty counter calculation:
if period_ns and duty_ns are both large and close to each other (about 0.3 seconds, rare but possible use case for PWM), then (pv * duty_ns) can overflow in 32 bit multiplication for permissible argument values. Should I use do_div((u64)pv * (u64)duty_ns, period_ns) here?
Best regards,
Alexey
Quoted 102 lines · Alexey Charkov
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 95 lines · Alexey Charkov
Quoted 80 lines
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 71 lines · Alexey Charkov
Quoted 43 lines
2010/12/20 Ryan Mallon <[email protected]>:
Quoted 19 lines · Alexey Charkov
Quoted 7 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Quoted 7 lines
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>Hi Alexey,
Quick review below.
<snip>
Quoted 12 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+void __init wmt_set_resources(void) +{ + resources_lcdc[0].start = wmt_current_regs->lcdc; + resources_lcdc[0].end = wmt_current_regs->lcdc + SZ_1K - 1; + resources_lcdc[1].start = wmt_current_irqs->lcdc; + resources_lcdc[1].end = wmt_current_irqs->lcdc;Ah, this makes more sense. But why have all the indirection? The
wmt_regmapstable could just be replaced with #defines and then have separate device files for the VT8500 and the WM8505. This would also make clearer which variants have which peripherals.This was the way I implemented it originally. However, Arnd made quite a valid suggestion to allow runtime selection of the chip variant, thus registers and interrupts need to be held in an indexed data type instead of just compile-time macros. In addition, there is now some overall movement towards unification of binary kernel images for different ARM variants (as far as I can see), so this would be required in any case.
Quoted 4 lines
Furthermore, as with many unbranded Chinese products, it's somewhat difficult to reliably determine the exact chip version used in your netbook without disassembling it. Reading a hardware register for identification is easier :)
Okay, that makes sense. I still think there must be a better way than having a massive indirect table with all the values. Why not detect the variant in the core code and then have something like:
int
init_devices(void){ int board_type = detect_board_type(); switch (board_type) { case BOARD_TYPE_VT8500: return vt8500_init_devices(); case BOARD_TYPE_WM8505: return wm8500_init_devices(); } pr_err("Unknown board type\n"); BUG(); /* panic()? */ while (1) ; }Quoted 7 lines
Then you can have the peripheral setup for each of the variants in their own files and use #defines. It may get tricky in a couple of places if you need to be able to access some value directly which is different on each of the variants, but that can be handled on a case by case basis. The majority of the numbers will be passed into drivers via the resource structs.
Quoted 7 lines
This is more or less what I'm doing right now - except for the separation between different files. I tried to avoid duplication of similar things here. Is the indirect table really a big issue? I'm a bit reluctant to copy about the whole
devices.cfor each chip variant, which would be otherwise required. Further, it would add more complexity to the timer, irq, gpio, i8042 and probably some other places.Yeah, agreed about the duplication. My approach would require the common peripherals to be defined for each variant. I'm not entirely against the indirect table (and am even starting to think it may be the best overall solution), it's just that it can be a bit difficult to follow because to add a device you need to do the following:
Quoted 5 lines
- Add a partially empty resource/platform_device struct
- Add resource entries to the resource table definition
- Add resource values to the resource table
- Add assignment of resource values to device init code
Quoted 4 lines
That's actually only one step more than what machines with static resource definitions require (the last one). Flexibility does come at a cost, so there should be a mathematical limit to optimization of this thing :)
No it isn't. You don't have the massive table, which requires modifications to both the definition and declaration, on machines with static resource definitions.
How about using the resource structures directly rather than introducing the table which is effectively holding the same information? Something like this?
In vt8500_resources.c (and similarly for wm8505_resources.c):
static struct resource vt8500_resources_uart0[] __initdata = {
[0] = {
.flags = IORESOURCE_MEM,
.start = VT8500_UART0_PHYS_BASE,
.end = VT8500_UART0_PHYS_BASE + 0xff,
},
[1] = {
.flags = IORESOURCE_IRQ,
.start = VT8500_UART0_IRQ,
.end = VT8500_UART0_IRQ,
},
};struct resource *vt8500_resources[] __initdata = {
[VT8500_UART0] = &vt8500_resources_uart0,
...
};In devices.c:
extern struct resource *vt8500_resources;
extern struct resource *wm8505_resources;
/* Set this pointer according to board variant */
static struct resource *resources;
void __init wmt_set_resources(void)
{
vt8500_device_uart0.resource = resources[VT8500_UART0];
...
}This way we only have a single externed resource structure per board-variant, there is no additional table needed, and the resource definitions can be read clearly. Alternatively the wmt_regmaps/wmt_irqs tables could be modified to use struct resource rather than individual fields which would simplify the assignments later.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Alexey Charkov
maintainer2010/12/21 Ryan Mallon <[email protected]>:
Quoted 150 lines · Alexey Charkov
Quoted 102 lines
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 95 lines · Alexey Charkov
Quoted 80 lines
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 71 lines · Alexey Charkov
Quoted 43 lines
2010/12/20 Ryan Mallon <[email protected]>:
Quoted 19 lines · Alexey Charkov
Quoted 7 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Quoted 7 lines
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>Hi Alexey,
Quick review below.
<snip>
Quoted 12 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+void __init wmt_set_resources(void) +{ + ? ? resources_lcdc[0].start = wmt_current_regs->lcdc; + ? ? resources_lcdc[0].end = wmt_current_regs->lcdc + SZ_1K - 1; + ? ? resources_lcdc[1].start = wmt_current_irqs->lcdc; + ? ? resources_lcdc[1].end = wmt_current_irqs->lcdc;Ah, this makes more sense. But why have all the indirection? The
wmt_regmapstable could just be replaced with #defines and then have separate device files for the VT8500 and the WM8505. This would also make clearer which variants have which peripherals.This was the way I implemented it originally. However, Arnd made quite a valid suggestion to allow runtime selection of the chip variant, thus registers and interrupts need to be held in an indexed data type instead of just compile-time macros. In addition, there is now some overall movement towards unification of binary kernel images for different ARM variants (as far as I can see), so this would be required in any case.
Quoted 4 lines
Furthermore, as with many unbranded Chinese products, it's somewhat difficult to reliably determine the exact chip version used in your netbook without disassembling it. Reading a hardware register for identification is easier :)
Okay, that makes sense. I still think there must be a better way than having a massive indirect table with all the values. Why not detect the variant in the core code and then have something like:
int
init_devices(void)
{
? ? ? ?intboard_type=detect_board_type();? ? ? ?switch (
board_type) {
? ? ? ?caseBOARD_TYPE_VT8500:
? ? ? ? ? ? ? ?returnvt8500_init_devices();? ? ? ?case
BOARD_TYPE_WM8505:
? ? ? ? ? ? ? ?returnwm8500_init_devices();
? ? ? ?}? ? ? ?pr_err("Unknown board type\n");
? ? ? ?BUG(); /*panic()? */
? ? ? ?while (1)
? ? ? ? ? ? ? ?;
}Quoted 7 lines
Then you can have the peripheral setup for each of the variants in their own files and use #defines. It may get tricky in a couple of places if you need to be able to access some value directly which is different on each of the variants, but that can be handled on a case by case basis. The majority of the numbers will be passed into drivers via the resource structs.
Quoted 7 lines
This is more or less what I'm doing right now - except for the separation between different files. I tried to avoid duplication of similar things here. Is the indirect table really a big issue? I'm a bit reluctant to copy about the whole
devices.cfor each chip variant, which would be otherwise required. Further, it would add more complexity to the timer, irq, gpio, i8042 and probably some other places.Yeah, agreed about the duplication. My approach would require the common peripherals to be defined for each variant. I'm not entirely against the indirect table (and am even starting to think it may be the best overall solution), it's just that it can be a bit difficult to follow because to add a device you need to do the following:
Quoted 5 lines
?- Add a partially empty resource/platform_device struct ?- Add resource entries to the resource table definition ?- Add resource values to the resource table
?- Add assignment of resource values to device init codeQuoted 4 lines
That's actually only one step more than what machines with static resource definitions require (the last one). Flexibility does come at a cost, so there should be a mathematical limit to optimization of this thing :)
No it isn't. You don't have the massive table, which requires modifications to both the definition and declaration, on machines with static resource definitions.
How about using the resource structures directly rather than introducing the table which is effectively holding the same information? Something like this?
In
vt8500_resources.c(and similarly forwm8505_resources.c):static struct resource vt8500_resources_uart0[]
__initdata= { ? ? ? ?[0] = {
? ? ? ? ? ? ? ?.flags ?=IORESOURCE_MEM,
? ? ? ? ? ? ? ?.start ?=VT8500_UART0_PHYS_BASE,
? ? ? ? ? ? ? ?.end ? ?=VT8500_UART0_PHYS_BASE+0xff, ? ? ? ?},
? ? ? ?[1] = {
? ? ? ? ? ? ? ?.flags ?=IORESOURCE_IRQ,
? ? ? ? ? ? ? ?.start ?=VT8500_UART0_IRQ,
? ? ? ? ? ? ? ?.end ? ?=VT8500_UART0_IRQ,
? ? ? ?},
};struct resource *vt8500_resources[]
__initdata= { ? ? ? ?[VT8500_UART0] =&vt8500_resources_uart0, ? ? ? ?...
};In
devices.c:extern struct resource
*vt8500_resources;
extern struct resource*wm8505_resources;/* Set this pointer according to board variant */
static struct resource *resources;void
__initwmt_set_resources(void)
{
? ? ? ?vt8500_device_uart0.resource = resources[VT8500_UART0]; ? ? ? ?...
}
Quoted 5 lines
This way we only have a single externed resource structure per board-variant, there is no additional table needed, and the resource definitions can be read clearly. Alternatively the wmt_regmaps/wmt_irqs tables could be modified to use struct resource rather than individual fields which would simplify the assignments later.
This way we will again duplicate quite much: those files will mostly differ in just the macro definitions of specific registers/irqs.
What if I just move all the initializations inside my runtime helper function, and add a macro to save space and improve readability? Something along the lines of:
static struct resource resources_lcdc[2] __initdata;
#define WMT_MMIO_RES(__start, __size) \
{\
.flags = IORESOURCE_MEM,\
.start = __start,\
.end = __start + __size - 1,\
}
#define WMT_IRQ_RES(__irq) \
{\
.flags = IORESOURCE_IRQ,\
.start = __irq,\
.end = __irq,\
}void __init wmt_set_resources(void)
{
resources_lcdc[0] = WMT_MMIO_RES(wmt_current_regs->lcdc, SZ_1K);
resources_lcdc[1] = WMT_IRQ_RES(wmt_current_irqs->lcdc);...
}
Then there will be no half-empty initializations scattered around separate from the other assignments (which is probably the worst thing in current configuration).
Best regards,
Alexey
Quoted 11 lines · On Tuesday 21 December 2010 11:00:43 Alexey Charkov wrote:
#define
WMT_IRQ_RES(__irq)\{\ .flags = IORESOURCE_IRQ,\ .start = __irq,\ .end = __irq,\ }void
__initwmt_set_resources(void){ resources_lcdc[0] = WMT_MMIO_RES(wmt_current_regs->lcdc, SZ_1K); resources_lcdc[1] = WMT_IRQ_RES(wmt_current_irqs->lcdc);
Quoted 6 lines
...
}Then there will be no half-empty initializations scattered around separate from the other assignments (which is probably the worst thing in current configuration).
If you use platform_device_add_resources() to add the resource at a later point, or platform_device_register_simple, you don't even need to statically allocate the resource structure, which may also make this simpler because you can keep all the data structures local to the function filling them out.
Arnd
Quoted 196 lines · Alexey Charkov
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 159 lines · Alexey Charkov
Quoted 111 lines
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 102 lines · Alexey Charkov
Quoted 87 lines
2010/12/21 Ryan Mallon <[email protected]>:
Quoted 76 lines · Alexey Charkov
Quoted 48 lines
2010/12/20 Ryan Mallon <[email protected]>:
Quoted 21 lines · Alexey Charkov
Quoted 8 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Quoted 8 lines
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>Hi Alexey,
Quick review below.
<snip>
Quoted 13 lines
Review
Quoted 7 lines
(quoted diff) +6
-0+void __init wmt_set_resources(void) +{ + resources_lcdc[0].start = wmt_current_regs->lcdc; + resources_lcdc[0].end = wmt_current_regs->lcdc + SZ_1K - 1; + resources_lcdc[1].start = wmt_current_irqs->lcdc; + resources_lcdc[1].end = wmt_current_irqs->lcdc;Ah, this makes more sense. But why have all the indirection? The
wmt_regmapstable could just be replaced with #defines and then have separate device files for the VT8500 and the WM8505. This would also make clearer which variants have which peripherals.This was the way I implemented it originally. However, Arnd made quite a valid suggestion to allow runtime selection of the chip variant, thus registers and interrupts need to be held in an indexed data type instead of just compile-time macros. In addition, there is now some overall movement towards unification of binary kernel images for different ARM variants (as far as I can see), so this would be required in any case.
Quoted 5 lines
Furthermore, as with many unbranded Chinese products, it's somewhat difficult to reliably determine the exact chip version used in your netbook without disassembling it. Reading a hardware register for identification is easier :)
Okay, that makes sense. I still think there must be a better way than having a massive indirect table with all the values. Why not detect the variant in the core code and then have something like:
int
init_devices(void){ int board_type = detect_board_type(); switch (board_type) { case BOARD_TYPE_VT8500: return vt8500_init_devices(); case BOARD_TYPE_WM8505: return wm8500_init_devices(); } pr_err("Unknown board type\n"); BUG(); /* panic()? */ while (1) ; }Quoted 8 lines
Then you can have the peripheral setup for each of the variants in their own files and use #defines. It may get tricky in a couple of places if you need to be able to access some value directly which is different on each of the variants, but that can be handled on a case by case basis. The majority of the numbers will be passed into drivers via the resource structs.
Quoted 8 lines
This is more or less what I'm doing right now - except for the separation between different files. I tried to avoid duplication of similar things here. Is the indirect table really a big issue? I'm a bit reluctant to copy about the whole
devices.cfor each chip variant, which would be otherwise required. Further, it would add more complexity to the timer, irq, gpio, i8042 and probably some other places.Yeah, agreed about the duplication. My approach would require the common peripherals to be defined for each variant. I'm not entirely against the indirect table (and am even starting to think it may be the best overall solution), it's just that it can be a bit difficult to follow because to add a device you need to do the following:
Quoted 6 lines
- Add a partially empty resource/platform_device struct
- Add resource entries to the resource table definition
- Add resource values to the resource table
- Add assignment of resource values to device init codeQuoted 5 lines
That's actually only one step more than what machines with static resource definitions require (the last one). Flexibility does come at a cost, so there should be a mathematical limit to optimization of this thing :)
No it isn't. You don't have the massive table, which requires modifications to both the definition and declaration, on machines with static resource definitions.
How about using the resource structures directly rather than introducing the table which is effectively holding the same information? Something like this?
In
vt8500_resources.c(and similarly forwm8505_resources.c):static struct resource vt8500_resources_uart0[] __initdata = { [0] = { .flags = IORESOURCE_MEM, .start = VT8500_UART0_PHYS_BASE, .end = VT8500_UART0_PHYS_BASE + 0xff, }, [1] = { .flags = IORESOURCE_IRQ, .start = VT8500_UART0_IRQ, .end = VT8500_UART0_IRQ, }, };struct resource *vt8500_resources[] __initdata = { [VT8500_UART0] = &vt8500_resources_uart0, ... };In
devices.c:extern struct resource
*vt8500_resources;
extern struct resource*wm8505_resources;/* Set this pointer according to board variant */
static struct resource *resources;void
__initwmt_set_resources(void){ vt8500_device_uart0.resource = resources[VT8500_UART0]; ... }Quoted 6 lines
This way we only have a single externed resource structure per board-variant, there is no additional table needed, and the resource definitions can be read clearly. Alternatively the wmt_regmaps/wmt_irqs tables could be modified to use struct resource rather than individual fields which would simplify the assignments later.
This way we will again duplicate quite much: those files will mostly differ in just the macro definitions of specific registers/irqs.
What if I just move all the initializations inside my runtime helper function, and add a macro to save space and improve readability? Something along the lines of:
static struct resource resources_lcdc[2]
__initdata;#define
WMT_MMIO_RES(__start, __size)\{\ .flags = IORESOURCE_MEM,\ .start = __start,\ .end = __start + __size - 1,\ } #define WMT_IRQ_RES(__irq) \ {\ .flags = IORESOURCE_IRQ,\ .start = __irq,\ .end = __irq,\ }void
__initwmt_set_resources(void){ resources_lcdc[0] = WMT_MMIO_RES(wmt_current_regs->lcdc, SZ_1K); resources_lcdc[1] = WMT_IRQ_RES(wmt_current_irqs->lcdc);...
}
Quoted 7 lines
Then there will be no half-empty initializations scattered around separate from the other assignments (which is probably the worst thing in current configuration).
Best regards,
Alexey
Sure, that works. In this case, can we remove the wmt_current_regs table and just have a switch statement with the two board variants in place? The latter will actually be half as much code because the struct definition for the table is no longer needed and each resource assignment is still one line. i.e.:
void __init wmt_set_resources(void)
{
switch (board_type) {
case BOARD_TYPE_VT8500:
resources_lcdc[0] = WMT_MMIO_RES(VT8500_LCDC_BASE, SZ_1K);
resources_lcdc[1] = WMT_IRQ_RES(VT8500_LCDC_IRQ);
...
break;
case BOARD_TYPE_WM8505:
resources_lcdc[0] = WMT_MMIO_RES(WM8505_LCDC_BASE, SZ_1K);
resources_lcdc[1] = WMT_IRQ_RES(WM8505_LCDC_IRQ);
...
break;
}
} ~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Alexey Charkov
maintainerPATCH v10 1/6 ARM: Add basic architecture support for VIA/WonderMedia 85xx SoC's
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
---
Welcome the jubilee tenth revision of this patch ;-)
I've tried to incorporate the suggestions by Ryan and Arnd, hope that there is nothing left out. There was a massive reorganization of code to remove less-than-obvious magic with MMIO registers and irqs being held in huge structs, now they are again macro definitions. Those macros are, however, only included in single isolated files, and actual values to use are chosen at runtime by calling the respective routines at machine initialization. There are also stylistic changes all around, where Ryan suggested.
As a result, i8042 should again be adjusted a bit to reflect the new place to find respective register/irq definitions, that one will be sent in the respective thread shortly.
Best regards,
Alexey
arch/arm/Kconfig | 12 + arch/arm/Makefile | 1 + arch/arm/boot/compressed/Makefile | 4 + arch/arm/boot/compressed/head-vt8500.S | 46 ++++ arch/arm/mach-vt8500/Kconfig | 73 ++++++ arch/arm/mach-vt8500/Makefile | 9 + arch/arm/mach-vt8500/Makefile.boot | 3 + arch/arm/mach-vt8500/bv07.c | 77 +++++++ arch/arm/mach-vt8500/devices-vt8500.c | 117 ++++++++++ arch/arm/mach-vt8500/devices-wm8505.c | 125 +++++++++++ arch/arm/mach-vt8500/devices.c | 270 +++++++++++++++++++++++ arch/arm/mach-vt8500/devices.h | 59 +++++ arch/arm/mach-vt8500/gpio.c | 233 +++++++++++++++++++ arch/arm/mach-vt8500/include/mach/debug-macro.S | 31 +++ arch/arm/mach-vt8500/include/mach/entry-macro.S | 32 +++ arch/arm/mach-vt8500/include/mach/gpio.h | 6 + arch/arm/mach-vt8500/include/mach/hardware.h | 12 + arch/arm/mach-vt8500/include/mach/i8042.h | 18 ++ arch/arm/mach-vt8500/include/mach/io.h | 28 +++ arch/arm/mach-vt8500/include/mach/irqs.h | 22 ++ arch/arm/mach-vt8500/include/mach/memory.h | 28 +++ arch/arm/mach-vt8500/include/mach/system.h | 18 ++ arch/arm/mach-vt8500/include/mach/timex.h | 26 +++ arch/arm/mach-vt8500/include/mach/uncompress.h | 37 +++ arch/arm/mach-vt8500/include/mach/vmalloc.h | 20 ++ arch/arm/mach-vt8500/include/mach/vt8500_irqs.h | 88 ++++++++ arch/arm/mach-vt8500/include/mach/vt8500_regs.h | 79 +++++++ arch/arm/mach-vt8500/include/mach/vt8500fb.h | 31 +++ arch/arm/mach-vt8500/include/mach/wm8505_irqs.h | 115 ++++++++++ arch/arm/mach-vt8500/include/mach/wm8505_regs.h | 78 +++++++ arch/arm/mach-vt8500/irq.c | 177 +++++++++++++++ arch/arm/mach-vt8500/pwm.c | 265 ++++++++++++++++++++++ arch/arm/mach-vt8500/timer.c | 155 +++++++++++++ arch/arm/mach-vt8500/wm8505_7in.c | 77 +++++++ 34 files changed, 2372 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/compressed/head-vt8500.S create mode 100644 arch/arm/mach-vt8500/Kconfig create mode 100644 arch/arm/mach-vt8500/Makefile create mode 100644 arch/arm/mach-vt8500/Makefile.boot create mode 100644 arch/arm/mach-vt8500/bv07.c create mode 100644 arch/arm/mach-vt8500/devices-vt8500.c create mode 100644 arch/arm/mach-vt8500/devices-wm8505.c create mode 100644 arch/arm/mach-vt8500/devices.c create mode 100644 arch/arm/mach-vt8500/devices.h create mode 100644 arch/arm/mach-vt8500/gpio.c create mode 100644 arch/arm/mach-vt8500/include/mach/debug-macro.S create mode 100644 arch/arm/mach-vt8500/include/mach/entry-macro.S create mode 100644 arch/arm/mach-vt8500/include/mach/gpio.h create mode 100644 arch/arm/mach-vt8500/include/mach/hardware.h create mode 100644 arch/arm/mach-vt8500/include/mach/i8042.h create mode 100644 arch/arm/mach-vt8500/include/mach/io.h create mode 100644 arch/arm/mach-vt8500/include/mach/irqs.h create mode 100644 arch/arm/mach-vt8500/include/mach/memory.h create mode 100644 arch/arm/mach-vt8500/include/mach/system.h create mode 100644 arch/arm/mach-vt8500/include/mach/timex.h create mode 100644 arch/arm/mach-vt8500/include/mach/uncompress.h create mode 100644 arch/arm/mach-vt8500/include/mach/vmalloc.h create mode 100644 arch/arm/mach-vt8500/include/mach/vt8500_irqs.h create mode 100644 arch/arm/mach-vt8500/include/mach/vt8500_regs.h create mode 100644 arch/arm/mach-vt8500/include/mach/vt8500fb.h create mode 100644 arch/arm/mach-vt8500/include/mach/wm8505_irqs.h create mode 100644 arch/arm/mach-vt8500/include/mach/wm8505_regs.h create mode 100644 arch/arm/mach-vt8500/irq.c create mode 100644 arch/arm/mach-vt8500/pwm.c create mode 100644 arch/arm/mach-vt8500/timer.c create mode 100644 arch/arm/mach-vt8500/wm8505_7in.c
arch/arm/Kconfig +12 -0
@@ -843,6 +843,16 @@ config PLAT_SPEAR help Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx). +config ARCH_VT8500 + bool "VIA/WonderMedia 85xx" + select CPU_ARM926T + select GENERIC_GPIO + select ARCH_HAS_CPUFREQ + select GENERIC_CLOCKEVENTS + select ARCH_REQUIRE_GPIOLIB + select HAVE_PWM + help + Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. endchoice #
@@ -973,6 +983,8 @@ source "arch/arm/mach-versatile/Kconfig" source "arch/arm/mach-vexpress/Kconfig" +source "arch/arm/mach-vt8500/Kconfig" + source "arch/arm/mach-w90x900/Kconfig" # Definitions to make life easier
arch/arm/Makefile +1 -0
@@ -189,6 +189,7 @@ machine-$(CONFIG_ARCH_U300) := u300 machine-$(CONFIG_ARCH_U8500) := ux500 machine-$(CONFIG_ARCH_VERSATILE) := versatile machine-$(CONFIG_ARCH_VEXPRESS) := vexpress +machine-$(CONFIG_ARCH_VT8500) := vt8500 machine-$(CONFIG_ARCH_W90X900) := w90x900 machine-$(CONFIG_ARCH_NUC93X) := nuc93x machine-$(CONFIG_FOOTBRIDGE) := footbridge
arch/arm/boot/compressed/Makefile +4 -0
@@ -29,6 +29,10 @@ ifeq ($(CONFIG_ARCH_SA1100),y) OBJS += head-sa1100.o endif +ifeq ($(CONFIG_ARCH_VT8500),y) +OBJS += head-vt8500.o +endif + ifeq ($(CONFIG_CPU_XSCALE),y) OBJS += head-xscale.o endif
arch/arm/boot/compressed/head-vt8500.S new file +46 -0
46 lines not on this page · raw message
arch/arm/mach-vt8500/Kconfig new file +73 -0
73 lines not on this page · raw message
arch/arm/mach-vt8500/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +obj-y += devices.o gpio.o irq.o timer.o + +obj-$(CONFIG_VTWM_VERSION_VT8500) += devices-vt8500.o +obj-$(CONFIG_VTWM_VERSION_WM8505) += devices-wm8505.o + +obj-$(CONFIG_MACH_BV07) += bv07.o +obj-$(CONFIG_MACH_WM8505_7IN_NETBOOK) += wm8505_7in.o + +obj-$(CONFIG_HAVE_PWM) += pwm.o
arch/arm/mach-vt8500/Makefile.boot new file +3 -0
@@ -0,0 +1,3 @@ + zreladdr-y := 0x00008000 +params_phys-y := 0x00000100 +initrd_phys-y := 0x01000000
arch/arm/mach-vt8500/bv07.c new file +77 -0
77 lines not on this page · raw message
arch/arm/mach-vt8500/devices-vt8500.c new file +117 -0
117 lines not on this page · raw message
arch/arm/mach-vt8500/devices-wm8505.c new file +125 -0
125 lines not on this page · raw message
arch/arm/mach-vt8500/devices.c new file +270 -0
270 lines not on this page · raw message
arch/arm/mach-vt8500/devices.h new file +59 -0
59 lines not on this page · raw message
arch/arm/mach-vt8500/gpio.c new file +233 -0
233 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/debug-macro.S new file +31 -0
@@ -0,0 +1,31 @@ +/* + * arch/arm/mach-vt8500/include/mach/debug-macro.S + * + * Copyright (C) 2010 Alexey Charkov <[email protected]> + * + * Debugging macro include header + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * +*/ + + .macro addruart, rp, rv + mov \rp, #0x00200000 + orr \rv, \rp, #0xf8000000 + orr \rp, \rp, #0xd8000000 + .endm + + .macro senduart,rd,rx + strb \rd, [\rx, #0] + .endm + + .macro busyuart,rd,rx +1001: ldr \rd, [\rx, #0x1c] + ands \rd, \rd, #0x2 + bne 1001b + .endm + + .macro waituart,rd,rx + .endm
arch/arm/mach-vt8500/include/mach/entry-macro.S new file +32 -0
@@ -0,0 +1,32 @@ +/* + * arch/arm/mach-vt8500/include/mach/entry-macro.S + * + * Low-level IRQ helper macros for VIA VT8500 + * + * 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. + */ + + .macro disable_fiq + .endm + + .macro get_irqnr_preamble, base, tmp + @ physical 0xd8140000 is virtual 0xf8140000 + mov \base, #0xf8000000 + orr \base, \base, #0x00140000 + .endm + + .macro arch_ret_to_user, tmp1, tmp2 + .endm + + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp + ldr \irqnr, [\base] + cmp \irqnr, #63 @ may be false positive, check interrupt status + bne 1001f + ldr \irqstat, [\base, #0x84] + ands \irqstat, #0x80000000 + moveq \irqnr, #0 +1001: + .endm +
arch/arm/mach-vt8500/include/mach/gpio.h new file +6 -0
@@ -0,0 +1,6 @@ +#include <asm-generic/gpio.h> + +#define gpio_get_value __gpio_get_value +#define gpio_set_value __gpio_set_value +#define gpio_cansleep __gpio_cansleep +#define gpio_to_irq __gpio_to_irq
arch/arm/mach-vt8500/include/mach/hardware.h new file +12 -0
@@ -0,0 +1,12 @@ +/* arch/arm/mach-vt8500/include/mach/hardware.h +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/
arch/arm/mach-vt8500/include/mach/i8042.h new file +18 -0
@@ -0,0 +1,18 @@ +/* arch/arm/mach-vt8500/include/mach/i8042.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +extern unsigned long wmt_i8042_base__initdata ; +extern int wmt_i8042_kbd_irq; +extern int wmt_i8042_aux_irq;
arch/arm/mach-vt8500/include/mach/io.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* arch/arm/mach-vt8500/include/mach/io.h +* +* Copyright (C) 2010 Alexey Charkov +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffff + +#define __io (a) __typesafe_io((a) + 0xf0000000) +#define __mem_pci (a) (a) + +#endif
arch/arm/mach-vt8500/include/mach/irqs.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* arch/arm/mach-vt8500/include/mach/irqs.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* This value is just to make the core happy, never used otherwise */ +#define NR_IRQS 128
arch/arm/mach-vt8500/include/mach/memory.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* arch/arm/mach-vt8500/include/mach/memory.h +* +* Copyright (C) 2003 ARM Limited +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +/* +* Physical DRAM offset. +*/ +#define PHYS_OFFSET UL(0x00000000) + +#endif
arch/arm/mach-vt8500/include/mach/system.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* arch/arm/mach-vt8500/include/mach/system.h +* +*/ +#include <asm/io.h> + +/* PM Software Reset request register */ +#define VT8500_PMSR_VIRT 0xf8130060 + +static inline void arch_idle (void ) +{ +cpu_do_idle (); +} + +static inline void arch_reset (char mode,const char *cmd) +{ +writel (1 ,VT8500_PMSR_VIRT ); +}
arch/arm/mach-vt8500/include/mach/timex.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* arch/arm/mach-vt8500/include/mach/timex.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef MACH_TIMEX_H +#define MACH_TIMEX_H + +#define CLOCK_TICK_RATE (3000000) + +#endif /* MACH_TIMEX_H */
arch/arm/mach-vt8500/include/mach/uncompress.h new file +37 -0
@@ -0,0 +1,37 @@ +/* arch/arm/mach-vt8500/include/mach/uncompress.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* Based on arch/arm/mach-dove/include/mach/uncompress.h +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#define UART0_PHYS 0xd8200000 +#include <asm/io.h> + +static void putc (const char c) +{ +while (readb (UART0_PHYS +0x1c ) &0x2 ) +/* Tx busy, wait and poll */ ; + +writeb (c,UART0_PHYS ); +} + +static void flush (void ) +{ +} + +/* +* nothing to do +*/ +#define arch_decomp_setup () +#define arch_decomp_wdog ()
arch/arm/mach-vt8500/include/mach/vmalloc.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* arch/arm/mach-vt8500/include/mach/vmalloc.h +* +* Copyright (C) 2000 Russell King. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#define VMALLOC_END 0xd0000000UL
arch/arm/mach-vt8500/include/mach/vt8500_irqs.h new file +88 -0
88 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/vt8500_regs.h new file +79 -0
79 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/vt8500fb.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* VT8500/WM8505 Frame Buffer platform data definitions +* +* Copyright (C) 2010 Ed Spiridonov <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _VT8500FB_H +#define _VT8500FB_H + +#include <linux/fb.h> + +struct vt8500fb_platform_data { +struct fb_videomode mode; +u32 xres_virtual; +u32 yres_virtual; +u32 bpp; +unsigned long video_mem_phys; +void *video_mem_virt; +unsigned long video_mem_len; +}; + +#endif /* _VT8500FB_H */
arch/arm/mach-vt8500/include/mach/wm8505_irqs.h new file +115 -0
115 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/wm8505_regs.h new file +78 -0
78 lines not on this page · raw message
arch/arm/mach-vt8500/irq.c new file +177 -0
177 lines not on this page · raw message
arch/arm/mach-vt8500/pwm.c new file +265 -0
265 lines not on this page · raw message
arch/arm/mach-vt8500/timer.c new file +155 -0
155 lines not on this page · raw message
arch/arm/mach-vt8500/wm8505_7in.c new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
1.7.3.4
Quoted 33 lines · Alexey Charkov
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>---
Welcome the jubilee tenth revision of this patch ;-)
I've tried to incorporate the suggestions by Ryan and Arnd, hope that there is nothing left out. There was a massive reorganization of code to remove less-than-obvious magic with MMIO registers and irqs being held in huge structs, now they are again macro definitions. Those macros are, however, only included in single isolated files, and actual values to use are chosen at runtime by calling the respective routines at machine initialization. There are also stylistic changes all around, where Ryan suggested.
As a result, i8042 should again be adjusted a bit to reflect the new place to find respective register/irq definitions, that one will be sent in the respective thread shortly.
Best regards,
Alexey
<snip>
Quoted 25 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +22
-0@@ -0,0 +1,117 @@ +/* linux/arch/arm/mach-vt8500/devices-vt8500.c +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#include <linux/platform_device.h> + +#include <mach/vt8500_regs.h> +#include <mach/vt8500_irqs.h> +#include <mach/i8042.h> +#include "devices.h" +
arch/arm/mach-vt8500/devices-vt8500.c line 32
Quoted 10 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +10
-0+static inline struct resource WMT_MMIO_RES (u32 start,u32 size) +{ +struct resource tmp = { + .flags =IORESOURCE_MEM , + .start = start, + .end = start + size -1 , + }; + +return tmp; +}
These functions can be marked __init (though I guess they already are if marked inline?). They should also have lower case names since they are proper functions.
Do these functions generate warnings about returning temporary values off the stack? If so, they could be rewritten as:
static __init void wmt_mmio_res(struct resource *res,
u32 start, u32 size)
{
res->flags = IORESOURCE_MEM;
res->start = start;
res->end = start + size - 1;
}You could also make these functions static inline in devices.h to avoid having to define them for each board.
Quoted 5 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +5
-0+ +static inline struct resource WMT_IRQ_RES (int irq) +{ +struct resource tmp = { + .flags =IORESOURCE_IRQ ,
arch/arm/mach-vt8500/devices-vt8500.c line 47
Quoted 10 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +10
-0+ .start = irq, + .end = irq, + }; + +return tmp; +} + +#define WMT_RES_ADD (__device, __resource, __num) \ +if (platform_device_add_resources(__device, __resource, __num)) \ + pr_err("Failed to assign resources to __device##\n");
This could be written as a proper function. The resource add is unlikely to fail. Maybe keep the warning but don't worry about printing the device name?
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Alexey Charkov
maintainer2010/12/23 Ryan Mallon <[email protected]>:
Quoted 68 lines · Alexey Charkov
Quoted 33 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>---
Welcome the jubilee tenth revision of this patch ;-)
I've tried to incorporate the suggestions by Ryan and Arnd, hope that there is nothing left out. There was a massive reorganization of code to remove less-than-obvious magic with MMIO registers and irqs being held in huge structs, now they are again macro definitions. Those macros are, however, only included in single isolated files, and actual values to use are chosen at runtime by calling the respective routines at machine initialization. There are also stylistic changes all around, where Ryan suggested.
As a result, i8042 should again be adjusted a bit to reflect the new place to find respective register/irq definitions, that one will be sent in the respective thread shortly.
Best regards,
Alexey<snip>
Quoted 31 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +28
-0@@ -0,0 +1,117 @@ +/* linux/arch/arm/mach-vt8500/devices-vt8500.c +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the +* GNU General Public License for more details. +* +*/ + +#include <linux/platform_device.h> + +#include <mach/vt8500_regs.h> +#include <mach/vt8500_irqs.h> +#include <mach/i8042.h> +#include "devices.h" + +static inline struct resource WMT_MMIO_RES (u32 start,u32 size) +{ + ? ? struct resource tmp = { + ? ? ? ? ? ? .flags = IORESOURCE_MEM, + ? ? ? ? ? ? .start = start, + ? ? ? ? ? ? .end = start + size - 1,
Quoted 9 lines
arch/arm/mach-vt8500/devices-vt8500.c line 32
Quoted 4 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +4
-0+ ? ? }; + + ? ? return tmp; +}These functions can be marked
__init(though I guess they already are if marked inline?). They should also have lower case names since they are proper functions.
As inline functions are unrolled into the caller at compile time, and the caller is __init, I would expect their code to be freed after init as well. I could be wrong, though :)
Quoted 3 lines
Do these functions generate warnings about returning temporary values off the stack? If so, they could be rewritten as:
Should those be compile-time or run-time? I did not see any.
Quoted 11 lines
static
__initvoidwmt_mmio_res(struct resource *res, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?u32 start, u32 size){
? ? ? ?res->flags =IORESOURCE_MEM;
? ? ? ?res->start = start;
? ? ? ?res->end ? = start + size - 1;
}You could also make these functions static inline in
devices.hto avoid having to define them for each board.
Agreed.
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +11
-0+ +static inline struct resource WMT_IRQ_RES (int irq) +{ + ? ? struct resource tmp = { + ? ? ? ? ? ? .flags = IORESOURCE_IRQ, + ? ? ? ? ? ? .start = irq, + ? ? ? ? ? ? .end = irq, + ? ? }; + + ? ? return tmp; +}
Quoted 9 lines
arch/arm/mach-vt8500/devices-vt8500.c
Quoted 4 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +4
-0+ +#define WMT_RES_ADD (__device, __resource, __num) \ +if (platform_device_add_resources(__device, __resource, __num)) \ + ? ? pr_err("Failed to assign resources to __device##\n");This could be written as a proper function. The resource add is unlikely to fail. Maybe keep the warning but don't worry about printing the device name?
There is memory allocation inside platform_device_add_resources, so probably there is scope for failure. I could add unlikely(), though.
Thanks,
Alexey
Quoted 78 lines · Alexey Charkov
2010/12/23 Ryan Mallon <[email protected]>:
Quoted 68 lines · Alexey Charkov
Quoted 33 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>---
Welcome the jubilee tenth revision of this patch ;-)
I've tried to incorporate the suggestions by Ryan and Arnd, hope that there is nothing left out. There was a massive reorganization of code to remove less-than-obvious magic with MMIO registers and irqs being held in huge structs, now they are again macro definitions. Those macros are, however, only included in single isolated files, and actual values to use are chosen at runtime by calling the respective routines at machine initialization. There are also stylistic changes all around, where Ryan suggested.
As a result, i8042 should again be adjusted a bit to reflect the new place to find respective register/irq definitions, that one will be sent in the respective thread shortly.
Best regards,
Alexey<snip>
Quoted 31 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +28
-0@@ -0,0 +1,117 @@ +/* linux/arch/arm/mach-vt8500/devices-vt8500.c +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#include <linux/platform_device.h> + +#include <mach/vt8500_regs.h> +#include <mach/vt8500_irqs.h> +#include <mach/i8042.h> +#include "devices.h" + +static inline struct resource WMT_MMIO_RES (u32 start,u32 size) +{ +struct resource tmp = { + .flags =IORESOURCE_MEM , + .start = start, + .end = start + size -1 ,Quoted 8 lines
arch/arm/mach-vt8500/devices-vt8500.c line 32
Quoted 4 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +4
-0+ }; + +return tmp; +}These functions can be marked
__init(though I guess they already are if marked inline?). They should also have lower case names since they are proper functions.
Quoted 3 lines
As inline functions are unrolled into the caller at compile time, and the caller is
__init, I would expect their code to be freed after init as well. I could be wrong, though :)
If the compiler decided not to inline them for whatever reason they would stick around. They should also probably be marked __init to make it clear that they are not permanent functions.
Quoted 5 lines
Quoted 3 lines
Do these functions generate warnings about returning temporary values off the stack? If so, they could be rewritten as:
Should those be compile-time or run-time? I did not see any.
I thought you might get compile time warnings. Returning things off the stack in general is error prone. I think passing a pointer to the resource into the function (as below) maybe a bit better.
Quoted 35 lines
Quoted 11 lines
static
__initvoid wmt_mmio_res(struct resource *res,u32 start, u32 size) { res->flags = IORESOURCE_MEM; res->start = start; res->end = start + size - 1; }You could also make these functions static inline in
devices.hto avoid having to define them for each board.Agreed.
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +11
-0+ +static inline struct resource WMT_IRQ_RES (int irq) +{ +struct resource tmp = { + .flags =IORESOURCE_IRQ , + .start = irq, + .end = irq, + }; + +return tmp; +}Quoted 9 lines
arch/arm/mach-vt8500/devices-vt8500.c line 47
Quoted 4 lines
arch/arm/mach-vt8500/devices-vt8500.c new file +4
-0+ +#define WMT_RES_ADD (__device, __resource, __num) \ +if (platform_device_add_resources(__device, __resource, __num)) \ + pr_err("Failed to assign resources to __device##\n");This could be written as a proper function. The resource add is unlikely to fail. Maybe keep the warning but don't worry about printing the device name?
Quoted 2 lines
There is memory allocation inside
platform_device_add_resources, so probably there is scope for failure. I could addunlikely(), though.
I meant more in terms of losing the device name in the error which seems to be the sole point of the macro. i.e it could be rewritten as:
static void wmt_add_resource(struct platform_device *pdev,
const struct resource *res, unsigned num)
{
if (platform_device_add_resources(pdev, res, num))
pr_err("Failed to add device resource\n");
}Because the add resource failing would indicate some serious problem you may even want to BUG().
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Alexey Charkov
maintainerPATCH v11 1/6 ARM: Add basic architecture support for VIA/WonderMedia 85xx SoC's
In reply to Ryan MallonThis adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
---
This incorporates latest comments by Ryan regarding helper inlines in devices-{vt8500,wm8505}.c
Best regards,
Alexey
arch/arm/Kconfig | 12 + arch/arm/Makefile | 1 + arch/arm/boot/compressed/Makefile | 4 + arch/arm/boot/compressed/head-vt8500.S | 46 ++++ arch/arm/mach-vt8500/Kconfig | 73 ++++++ arch/arm/mach-vt8500/Makefile | 9 + arch/arm/mach-vt8500/Makefile.boot | 3 + arch/arm/mach-vt8500/bv07.c | 77 +++++++ arch/arm/mach-vt8500/devices-vt8500.c | 91 ++++++++ arch/arm/mach-vt8500/devices-wm8505.c | 99 +++++++++ arch/arm/mach-vt8500/devices.c | 270 +++++++++++++++++++++++ arch/arm/mach-vt8500/devices.h | 88 ++++++++ arch/arm/mach-vt8500/gpio.c | 233 +++++++++++++++++++ arch/arm/mach-vt8500/include/mach/debug-macro.S | 31 +++ arch/arm/mach-vt8500/include/mach/entry-macro.S | 32 +++ arch/arm/mach-vt8500/include/mach/gpio.h | 6 + arch/arm/mach-vt8500/include/mach/hardware.h | 12 + arch/arm/mach-vt8500/include/mach/i8042.h | 18 ++ arch/arm/mach-vt8500/include/mach/io.h | 28 +++ arch/arm/mach-vt8500/include/mach/irqs.h | 22 ++ arch/arm/mach-vt8500/include/mach/memory.h | 28 +++ arch/arm/mach-vt8500/include/mach/system.h | 18 ++ arch/arm/mach-vt8500/include/mach/timex.h | 26 +++ arch/arm/mach-vt8500/include/mach/uncompress.h | 37 +++ arch/arm/mach-vt8500/include/mach/vmalloc.h | 20 ++ arch/arm/mach-vt8500/include/mach/vt8500_irqs.h | 88 ++++++++ arch/arm/mach-vt8500/include/mach/vt8500_regs.h | 79 +++++++ arch/arm/mach-vt8500/include/mach/vt8500fb.h | 31 +++ arch/arm/mach-vt8500/include/mach/wm8505_irqs.h | 115 ++++++++++ arch/arm/mach-vt8500/include/mach/wm8505_regs.h | 78 +++++++ arch/arm/mach-vt8500/irq.c | 177 +++++++++++++++ arch/arm/mach-vt8500/pwm.c | 265 ++++++++++++++++++++++ arch/arm/mach-vt8500/timer.c | 155 +++++++++++++ arch/arm/mach-vt8500/wm8505_7in.c | 77 +++++++ 34 files changed, 2349 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/compressed/head-vt8500.S create mode 100644 arch/arm/mach-vt8500/Kconfig create mode 100644 arch/arm/mach-vt8500/Makefile create mode 100644 arch/arm/mach-vt8500/Makefile.boot create mode 100644 arch/arm/mach-vt8500/bv07.c create mode 100644 arch/arm/mach-vt8500/devices-vt8500.c create mode 100644 arch/arm/mach-vt8500/devices-wm8505.c create mode 100644 arch/arm/mach-vt8500/devices.c create mode 100644 arch/arm/mach-vt8500/devices.h create mode 100644 arch/arm/mach-vt8500/gpio.c create mode 100644 arch/arm/mach-vt8500/include/mach/debug-macro.S create mode 100644 arch/arm/mach-vt8500/include/mach/entry-macro.S create mode 100644 arch/arm/mach-vt8500/include/mach/gpio.h create mode 100644 arch/arm/mach-vt8500/include/mach/hardware.h create mode 100644 arch/arm/mach-vt8500/include/mach/i8042.h create mode 100644 arch/arm/mach-vt8500/include/mach/io.h create mode 100644 arch/arm/mach-vt8500/include/mach/irqs.h create mode 100644 arch/arm/mach-vt8500/include/mach/memory.h create mode 100644 arch/arm/mach-vt8500/include/mach/system.h create mode 100644 arch/arm/mach-vt8500/include/mach/timex.h create mode 100644 arch/arm/mach-vt8500/include/mach/uncompress.h create mode 100644 arch/arm/mach-vt8500/include/mach/vmalloc.h create mode 100644 arch/arm/mach-vt8500/include/mach/vt8500_irqs.h create mode 100644 arch/arm/mach-vt8500/include/mach/vt8500_regs.h create mode 100644 arch/arm/mach-vt8500/include/mach/vt8500fb.h create mode 100644 arch/arm/mach-vt8500/include/mach/wm8505_irqs.h create mode 100644 arch/arm/mach-vt8500/include/mach/wm8505_regs.h create mode 100644 arch/arm/mach-vt8500/irq.c create mode 100644 arch/arm/mach-vt8500/pwm.c create mode 100644 arch/arm/mach-vt8500/timer.c create mode 100644 arch/arm/mach-vt8500/wm8505_7in.c
arch/arm/Kconfig +12 -0
@@ -843,6 +843,16 @@ config PLAT_SPEAR help Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx). +config ARCH_VT8500 + bool "VIA/WonderMedia 85xx" + select CPU_ARM926T + select GENERIC_GPIO + select ARCH_HAS_CPUFREQ + select GENERIC_CLOCKEVENTS + select ARCH_REQUIRE_GPIOLIB + select HAVE_PWM + help + Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. endchoice #
@@ -973,6 +983,8 @@ source "arch/arm/mach-versatile/Kconfig" source "arch/arm/mach-vexpress/Kconfig" +source "arch/arm/mach-vt8500/Kconfig" + source "arch/arm/mach-w90x900/Kconfig" # Definitions to make life easier
arch/arm/Makefile +1 -0
@@ -189,6 +189,7 @@ machine-$(CONFIG_ARCH_U300) := u300 machine-$(CONFIG_ARCH_U8500) := ux500 machine-$(CONFIG_ARCH_VERSATILE) := versatile machine-$(CONFIG_ARCH_VEXPRESS) := vexpress +machine-$(CONFIG_ARCH_VT8500) := vt8500 machine-$(CONFIG_ARCH_W90X900) := w90x900 machine-$(CONFIG_ARCH_NUC93X) := nuc93x machine-$(CONFIG_FOOTBRIDGE) := footbridge
arch/arm/boot/compressed/Makefile +4 -0
@@ -29,6 +29,10 @@ ifeq ($(CONFIG_ARCH_SA1100),y) OBJS += head-sa1100.o endif +ifeq ($(CONFIG_ARCH_VT8500),y) +OBJS += head-vt8500.o +endif + ifeq ($(CONFIG_CPU_XSCALE),y) OBJS += head-xscale.o endif
arch/arm/boot/compressed/head-vt8500.S new file +46 -0
46 lines not on this page · raw message
arch/arm/mach-vt8500/Kconfig new file +73 -0
73 lines not on this page · raw message
arch/arm/mach-vt8500/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +obj-y += devices.o gpio.o irq.o timer.o + +obj-$(CONFIG_VTWM_VERSION_VT8500) += devices-vt8500.o +obj-$(CONFIG_VTWM_VERSION_WM8505) += devices-wm8505.o + +obj-$(CONFIG_MACH_BV07) += bv07.o +obj-$(CONFIG_MACH_WM8505_7IN_NETBOOK) += wm8505_7in.o + +obj-$(CONFIG_HAVE_PWM) += pwm.o
arch/arm/mach-vt8500/Makefile.boot new file +3 -0
@@ -0,0 +1,3 @@ + zreladdr-y := 0x00008000 +params_phys-y := 0x00000100 +initrd_phys-y := 0x01000000
arch/arm/mach-vt8500/bv07.c new file +77 -0
77 lines not on this page · raw message
arch/arm/mach-vt8500/devices-vt8500.c new file +91 -0
91 lines not on this page · raw message
arch/arm/mach-vt8500/devices-wm8505.c new file +99 -0
99 lines not on this page · raw message
arch/arm/mach-vt8500/devices.c new file +270 -0
270 lines not on this page · raw message
arch/arm/mach-vt8500/devices.h new file +88 -0
88 lines not on this page · raw message
arch/arm/mach-vt8500/gpio.c new file +233 -0
233 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/debug-macro.S new file +31 -0
@@ -0,0 +1,31 @@ +/* + * arch/arm/mach-vt8500/include/mach/debug-macro.S + * + * Copyright (C) 2010 Alexey Charkov <[email protected]> + * + * Debugging macro include header + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * +*/ + + .macro addruart, rp, rv + mov \rp, #0x00200000 + orr \rv, \rp, #0xf8000000 + orr \rp, \rp, #0xd8000000 + .endm + + .macro senduart,rd,rx + strb \rd, [\rx, #0] + .endm + + .macro busyuart,rd,rx +1001: ldr \rd, [\rx, #0x1c] + ands \rd, \rd, #0x2 + bne 1001b + .endm + + .macro waituart,rd,rx + .endm
arch/arm/mach-vt8500/include/mach/entry-macro.S new file +32 -0
@@ -0,0 +1,32 @@ +/* + * arch/arm/mach-vt8500/include/mach/entry-macro.S + * + * Low-level IRQ helper macros for VIA VT8500 + * + * 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. + */ + + .macro disable_fiq + .endm + + .macro get_irqnr_preamble, base, tmp + @ physical 0xd8140000 is virtual 0xf8140000 + mov \base, #0xf8000000 + orr \base, \base, #0x00140000 + .endm + + .macro arch_ret_to_user, tmp1, tmp2 + .endm + + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp + ldr \irqnr, [\base] + cmp \irqnr, #63 @ may be false positive, check interrupt status + bne 1001f + ldr \irqstat, [\base, #0x84] + ands \irqstat, #0x80000000 + moveq \irqnr, #0 +1001: + .endm +
arch/arm/mach-vt8500/include/mach/gpio.h new file +6 -0
@@ -0,0 +1,6 @@ +#include <asm-generic/gpio.h> + +#define gpio_get_value __gpio_get_value +#define gpio_set_value __gpio_set_value +#define gpio_cansleep __gpio_cansleep +#define gpio_to_irq __gpio_to_irq
arch/arm/mach-vt8500/include/mach/hardware.h new file +12 -0
@@ -0,0 +1,12 @@ +/* arch/arm/mach-vt8500/include/mach/hardware.h +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/
arch/arm/mach-vt8500/include/mach/i8042.h new file +18 -0
@@ -0,0 +1,18 @@ +/* arch/arm/mach-vt8500/include/mach/i8042.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +extern unsigned long wmt_i8042_base__initdata ; +extern int wmt_i8042_kbd_irq; +extern int wmt_i8042_aux_irq;
arch/arm/mach-vt8500/include/mach/io.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* arch/arm/mach-vt8500/include/mach/io.h +* +* Copyright (C) 2010 Alexey Charkov +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffff + +#define __io (a) __typesafe_io((a) + 0xf0000000) +#define __mem_pci (a) (a) + +#endif
arch/arm/mach-vt8500/include/mach/irqs.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* arch/arm/mach-vt8500/include/mach/irqs.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* This value is just to make the core happy, never used otherwise */ +#define NR_IRQS 128
arch/arm/mach-vt8500/include/mach/memory.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* arch/arm/mach-vt8500/include/mach/memory.h +* +* Copyright (C) 2003 ARM Limited +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +/* +* Physical DRAM offset. +*/ +#define PHYS_OFFSET UL(0x00000000) + +#endif
arch/arm/mach-vt8500/include/mach/system.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* arch/arm/mach-vt8500/include/mach/system.h +* +*/ +#include <asm/io.h> + +/* PM Software Reset request register */ +#define VT8500_PMSR_VIRT 0xf8130060 + +static inline void arch_idle (void ) +{ +cpu_do_idle (); +} + +static inline void arch_reset (char mode,const char *cmd) +{ +writel (1 ,VT8500_PMSR_VIRT ); +}
arch/arm/mach-vt8500/include/mach/timex.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* arch/arm/mach-vt8500/include/mach/timex.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef MACH_TIMEX_H +#define MACH_TIMEX_H + +#define CLOCK_TICK_RATE (3000000) + +#endif /* MACH_TIMEX_H */
arch/arm/mach-vt8500/include/mach/uncompress.h new file +37 -0
@@ -0,0 +1,37 @@ +/* arch/arm/mach-vt8500/include/mach/uncompress.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* Based on arch/arm/mach-dove/include/mach/uncompress.h +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#define UART0_PHYS 0xd8200000 +#include <asm/io.h> + +static void putc (const char c) +{ +while (readb (UART0_PHYS +0x1c ) &0x2 ) +/* Tx busy, wait and poll */ ; + +writeb (c,UART0_PHYS ); +} + +static void flush (void ) +{ +} + +/* +* nothing to do +*/ +#define arch_decomp_setup () +#define arch_decomp_wdog ()
arch/arm/mach-vt8500/include/mach/vmalloc.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* arch/arm/mach-vt8500/include/mach/vmalloc.h +* +* Copyright (C) 2000 Russell King. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#define VMALLOC_END 0xd0000000UL
arch/arm/mach-vt8500/include/mach/vt8500_irqs.h new file +88 -0
88 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/vt8500_regs.h new file +79 -0
79 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/vt8500fb.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* VT8500/WM8505 Frame Buffer platform data definitions +* +* Copyright (C) 2010 Ed Spiridonov <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _VT8500FB_H +#define _VT8500FB_H + +#include <linux/fb.h> + +struct vt8500fb_platform_data { +struct fb_videomode mode; +u32 xres_virtual; +u32 yres_virtual; +u32 bpp; +unsigned long video_mem_phys; +void *video_mem_virt; +unsigned long video_mem_len; +}; + +#endif /* _VT8500FB_H */
arch/arm/mach-vt8500/include/mach/wm8505_irqs.h new file +115 -0
115 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/wm8505_regs.h new file +78 -0
78 lines not on this page · raw message
arch/arm/mach-vt8500/irq.c new file +177 -0
177 lines not on this page · raw message
arch/arm/mach-vt8500/pwm.c new file +265 -0
265 lines not on this page · raw message
arch/arm/mach-vt8500/timer.c new file +155 -0
155 lines not on this page · raw message
arch/arm/mach-vt8500/wm8505_7in.c new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
1.7.3.4
Quoted 13 lines · Alexey Charkov
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Quoted 8 lines
Signed-off-by Alexey Charkov <[email protected]>---
This incorporates latest comments by Ryan regarding helper inlines in devices-{vt8500,wm8505}.c
Best regards,
Alexey
One final nitpick :-).
arch/arm/mach-vt8500/gpio.c line 64
Quoted 8 lines
arch/arm/mach-vt8500/gpio.c new file +8
-0+static int vt8500_muxed_gpio_direction_input (struct gpio_chip *chip, +unsigned offset) +{ +struct vt8500_gpio_chip *vt8500_chip =to_vt8500 (chip); +unsigned val =readl (regbase +0x20 + vt8500_chip->regoff); + + val &= ~(1 << vt8500_chip->shift << offset); +writel (val, regbase +0x20 + vt8500_chip->regoff);
The magic numbers (0x20) in the gpio functions should probably be #defined as register names. I'm guessing this is the input enable register? Often people do helper functions for this, i.e:
static inline void gpio_write_reg(struct vt8500_gpio_chip *chip,
unsigned val, unsigned reg)
{
writel(val, regbase + chip->regoff + reg);
}Other than that, looks good.
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Alexey Charkov
maintainerPATCH v12 1/6 ARM: Add basic architecture support for VIA/WonderMedia 85xx SoC's
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
---
This fixes magic numbers in gpio.c
Thanks,
Alexey
arch/arm/Kconfig | 12 + arch/arm/Makefile | 1 + arch/arm/boot/compressed/Makefile | 4 + arch/arm/boot/compressed/head-vt8500.S | 46 ++++ arch/arm/mach-vt8500/Kconfig | 73 ++++++ arch/arm/mach-vt8500/Makefile | 9 + arch/arm/mach-vt8500/Makefile.boot | 3 + arch/arm/mach-vt8500/bv07.c | 77 +++++++ arch/arm/mach-vt8500/devices-vt8500.c | 91 ++++++++ arch/arm/mach-vt8500/devices-wm8505.c | 99 +++++++++ arch/arm/mach-vt8500/devices.c | 270 +++++++++++++++++++++++ arch/arm/mach-vt8500/devices.h | 88 ++++++++ arch/arm/mach-vt8500/gpio.c | 240 ++++++++++++++++++++ arch/arm/mach-vt8500/include/mach/debug-macro.S | 31 +++ arch/arm/mach-vt8500/include/mach/entry-macro.S | 32 +++ arch/arm/mach-vt8500/include/mach/gpio.h | 6 + arch/arm/mach-vt8500/include/mach/hardware.h | 12 + arch/arm/mach-vt8500/include/mach/i8042.h | 18 ++ arch/arm/mach-vt8500/include/mach/io.h | 28 +++ arch/arm/mach-vt8500/include/mach/irqs.h | 22 ++ arch/arm/mach-vt8500/include/mach/memory.h | 28 +++ arch/arm/mach-vt8500/include/mach/system.h | 18 ++ arch/arm/mach-vt8500/include/mach/timex.h | 26 +++ arch/arm/mach-vt8500/include/mach/uncompress.h | 37 +++ arch/arm/mach-vt8500/include/mach/vmalloc.h | 20 ++ arch/arm/mach-vt8500/include/mach/vt8500_irqs.h | 88 ++++++++ arch/arm/mach-vt8500/include/mach/vt8500_regs.h | 79 +++++++ arch/arm/mach-vt8500/include/mach/vt8500fb.h | 31 +++ arch/arm/mach-vt8500/include/mach/wm8505_irqs.h | 115 ++++++++++ arch/arm/mach-vt8500/include/mach/wm8505_regs.h | 78 +++++++ arch/arm/mach-vt8500/irq.c | 177 +++++++++++++++ arch/arm/mach-vt8500/pwm.c | 265 ++++++++++++++++++++++ arch/arm/mach-vt8500/timer.c | 155 +++++++++++++ arch/arm/mach-vt8500/wm8505_7in.c | 77 +++++++ 34 files changed, 2356 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/compressed/head-vt8500.S create mode 100644 arch/arm/mach-vt8500/Kconfig create mode 100644 arch/arm/mach-vt8500/Makefile create mode 100644 arch/arm/mach-vt8500/Makefile.boot create mode 100644 arch/arm/mach-vt8500/bv07.c create mode 100644 arch/arm/mach-vt8500/devices-vt8500.c create mode 100644 arch/arm/mach-vt8500/devices-wm8505.c create mode 100644 arch/arm/mach-vt8500/devices.c create mode 100644 arch/arm/mach-vt8500/devices.h create mode 100644 arch/arm/mach-vt8500/gpio.c create mode 100644 arch/arm/mach-vt8500/include/mach/debug-macro.S create mode 100644 arch/arm/mach-vt8500/include/mach/entry-macro.S create mode 100644 arch/arm/mach-vt8500/include/mach/gpio.h create mode 100644 arch/arm/mach-vt8500/include/mach/hardware.h create mode 100644 arch/arm/mach-vt8500/include/mach/i8042.h create mode 100644 arch/arm/mach-vt8500/include/mach/io.h create mode 100644 arch/arm/mach-vt8500/include/mach/irqs.h create mode 100644 arch/arm/mach-vt8500/include/mach/memory.h create mode 100644 arch/arm/mach-vt8500/include/mach/system.h create mode 100644 arch/arm/mach-vt8500/include/mach/timex.h create mode 100644 arch/arm/mach-vt8500/include/mach/uncompress.h create mode 100644 arch/arm/mach-vt8500/include/mach/vmalloc.h create mode 100644 arch/arm/mach-vt8500/include/mach/vt8500_irqs.h create mode 100644 arch/arm/mach-vt8500/include/mach/vt8500_regs.h create mode 100644 arch/arm/mach-vt8500/include/mach/vt8500fb.h create mode 100644 arch/arm/mach-vt8500/include/mach/wm8505_irqs.h create mode 100644 arch/arm/mach-vt8500/include/mach/wm8505_regs.h create mode 100644 arch/arm/mach-vt8500/irq.c create mode 100644 arch/arm/mach-vt8500/pwm.c create mode 100644 arch/arm/mach-vt8500/timer.c create mode 100644 arch/arm/mach-vt8500/wm8505_7in.c
arch/arm/Kconfig +12 -0
@@ -843,6 +843,16 @@ config PLAT_SPEAR help Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx). +config ARCH_VT8500 + bool "VIA/WonderMedia 85xx" + select CPU_ARM926T + select GENERIC_GPIO + select ARCH_HAS_CPUFREQ + select GENERIC_CLOCKEVENTS + select ARCH_REQUIRE_GPIOLIB + select HAVE_PWM + help + Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. endchoice #
@@ -973,6 +983,8 @@ source "arch/arm/mach-versatile/Kconfig" source "arch/arm/mach-vexpress/Kconfig" +source "arch/arm/mach-vt8500/Kconfig" + source "arch/arm/mach-w90x900/Kconfig" # Definitions to make life easier
arch/arm/Makefile +1 -0
@@ -189,6 +189,7 @@ machine-$(CONFIG_ARCH_U300) := u300 machine-$(CONFIG_ARCH_U8500) := ux500 machine-$(CONFIG_ARCH_VERSATILE) := versatile machine-$(CONFIG_ARCH_VEXPRESS) := vexpress +machine-$(CONFIG_ARCH_VT8500) := vt8500 machine-$(CONFIG_ARCH_W90X900) := w90x900 machine-$(CONFIG_ARCH_NUC93X) := nuc93x machine-$(CONFIG_FOOTBRIDGE) := footbridge
arch/arm/boot/compressed/Makefile +4 -0
@@ -29,6 +29,10 @@ ifeq ($(CONFIG_ARCH_SA1100),y) OBJS += head-sa1100.o endif +ifeq ($(CONFIG_ARCH_VT8500),y) +OBJS += head-vt8500.o +endif + ifeq ($(CONFIG_CPU_XSCALE),y) OBJS += head-xscale.o endif
arch/arm/boot/compressed/head-vt8500.S new file +46 -0
46 lines not on this page · raw message
arch/arm/mach-vt8500/Kconfig new file +73 -0
73 lines not on this page · raw message
arch/arm/mach-vt8500/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +obj-y += devices.o gpio.o irq.o timer.o + +obj-$(CONFIG_VTWM_VERSION_VT8500) += devices-vt8500.o +obj-$(CONFIG_VTWM_VERSION_WM8505) += devices-wm8505.o + +obj-$(CONFIG_MACH_BV07) += bv07.o +obj-$(CONFIG_MACH_WM8505_7IN_NETBOOK) += wm8505_7in.o + +obj-$(CONFIG_HAVE_PWM) += pwm.o
arch/arm/mach-vt8500/Makefile.boot new file +3 -0
@@ -0,0 +1,3 @@ + zreladdr-y := 0x00008000 +params_phys-y := 0x00000100 +initrd_phys-y := 0x01000000
arch/arm/mach-vt8500/bv07.c new file +77 -0
77 lines not on this page · raw message
arch/arm/mach-vt8500/devices-vt8500.c new file +91 -0
91 lines not on this page · raw message
arch/arm/mach-vt8500/devices-wm8505.c new file +99 -0
99 lines not on this page · raw message
arch/arm/mach-vt8500/devices.c new file +270 -0
270 lines not on this page · raw message
arch/arm/mach-vt8500/devices.h new file +88 -0
88 lines not on this page · raw message
arch/arm/mach-vt8500/gpio.c new file +240 -0
240 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/debug-macro.S new file +31 -0
@@ -0,0 +1,31 @@ +/* + * arch/arm/mach-vt8500/include/mach/debug-macro.S + * + * Copyright (C) 2010 Alexey Charkov <[email protected]> + * + * Debugging macro include header + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * +*/ + + .macro addruart, rp, rv + mov \rp, #0x00200000 + orr \rv, \rp, #0xf8000000 + orr \rp, \rp, #0xd8000000 + .endm + + .macro senduart,rd,rx + strb \rd, [\rx, #0] + .endm + + .macro busyuart,rd,rx +1001: ldr \rd, [\rx, #0x1c] + ands \rd, \rd, #0x2 + bne 1001b + .endm + + .macro waituart,rd,rx + .endm
arch/arm/mach-vt8500/include/mach/entry-macro.S new file +32 -0
@@ -0,0 +1,32 @@ +/* + * arch/arm/mach-vt8500/include/mach/entry-macro.S + * + * Low-level IRQ helper macros for VIA VT8500 + * + * 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. + */ + + .macro disable_fiq + .endm + + .macro get_irqnr_preamble, base, tmp + @ physical 0xd8140000 is virtual 0xf8140000 + mov \base, #0xf8000000 + orr \base, \base, #0x00140000 + .endm + + .macro arch_ret_to_user, tmp1, tmp2 + .endm + + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp + ldr \irqnr, [\base] + cmp \irqnr, #63 @ may be false positive, check interrupt status + bne 1001f + ldr \irqstat, [\base, #0x84] + ands \irqstat, #0x80000000 + moveq \irqnr, #0 +1001: + .endm +
arch/arm/mach-vt8500/include/mach/gpio.h new file +6 -0
@@ -0,0 +1,6 @@ +#include <asm-generic/gpio.h> + +#define gpio_get_value __gpio_get_value +#define gpio_set_value __gpio_set_value +#define gpio_cansleep __gpio_cansleep +#define gpio_to_irq __gpio_to_irq
arch/arm/mach-vt8500/include/mach/hardware.h new file +12 -0
@@ -0,0 +1,12 @@ +/* arch/arm/mach-vt8500/include/mach/hardware.h +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/
arch/arm/mach-vt8500/include/mach/i8042.h new file +18 -0
@@ -0,0 +1,18 @@ +/* arch/arm/mach-vt8500/include/mach/i8042.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +extern unsigned long wmt_i8042_base__initdata ; +extern int wmt_i8042_kbd_irq; +extern int wmt_i8042_aux_irq;
arch/arm/mach-vt8500/include/mach/io.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* arch/arm/mach-vt8500/include/mach/io.h +* +* Copyright (C) 2010 Alexey Charkov +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffff + +#define __io (a) __typesafe_io((a) + 0xf0000000) +#define __mem_pci (a) (a) + +#endif
arch/arm/mach-vt8500/include/mach/irqs.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* arch/arm/mach-vt8500/include/mach/irqs.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* This value is just to make the core happy, never used otherwise */ +#define NR_IRQS 128
arch/arm/mach-vt8500/include/mach/memory.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* arch/arm/mach-vt8500/include/mach/memory.h +* +* Copyright (C) 2003 ARM Limited +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +/* +* Physical DRAM offset. +*/ +#define PHYS_OFFSET UL(0x00000000) + +#endif
arch/arm/mach-vt8500/include/mach/system.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* arch/arm/mach-vt8500/include/mach/system.h +* +*/ +#include <asm/io.h> + +/* PM Software Reset request register */ +#define VT8500_PMSR_VIRT 0xf8130060 + +static inline void arch_idle (void ) +{ +cpu_do_idle (); +} + +static inline void arch_reset (char mode,const char *cmd) +{ +writel (1 ,VT8500_PMSR_VIRT ); +}
arch/arm/mach-vt8500/include/mach/timex.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* arch/arm/mach-vt8500/include/mach/timex.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef MACH_TIMEX_H +#define MACH_TIMEX_H + +#define CLOCK_TICK_RATE (3000000) + +#endif /* MACH_TIMEX_H */
arch/arm/mach-vt8500/include/mach/uncompress.h new file +37 -0
@@ -0,0 +1,37 @@ +/* arch/arm/mach-vt8500/include/mach/uncompress.h +* +* Copyright (C) 2010 Alexey Charkov <[email protected]> +* +* Based on arch/arm/mach-dove/include/mach/uncompress.h +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#define UART0_PHYS 0xd8200000 +#include <asm/io.h> + +static void putc (const char c) +{ +while (readb (UART0_PHYS +0x1c ) &0x2 ) +/* Tx busy, wait and poll */ ; + +writeb (c,UART0_PHYS ); +} + +static void flush (void ) +{ +} + +/* +* nothing to do +*/ +#define arch_decomp_setup () +#define arch_decomp_wdog ()
arch/arm/mach-vt8500/include/mach/vmalloc.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* arch/arm/mach-vt8500/include/mach/vmalloc.h +* +* Copyright (C) 2000 Russell King. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#define VMALLOC_END 0xd0000000UL
arch/arm/mach-vt8500/include/mach/vt8500_irqs.h new file +88 -0
88 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/vt8500_regs.h new file +79 -0
79 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/vt8500fb.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* VT8500/WM8505 Frame Buffer platform data definitions +* +* Copyright (C) 2010 Ed Spiridonov <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _VT8500FB_H +#define _VT8500FB_H + +#include <linux/fb.h> + +struct vt8500fb_platform_data { +struct fb_videomode mode; +u32 xres_virtual; +u32 yres_virtual; +u32 bpp; +unsigned long video_mem_phys; +void *video_mem_virt; +unsigned long video_mem_len; +}; + +#endif /* _VT8500FB_H */
arch/arm/mach-vt8500/include/mach/wm8505_irqs.h new file +115 -0
115 lines not on this page · raw message
arch/arm/mach-vt8500/include/mach/wm8505_regs.h new file +78 -0
78 lines not on this page · raw message
arch/arm/mach-vt8500/irq.c new file +177 -0
177 lines not on this page · raw message
arch/arm/mach-vt8500/pwm.c new file +265 -0
265 lines not on this page · raw message
arch/arm/mach-vt8500/timer.c new file +155 -0
155 lines not on this page · raw message
arch/arm/mach-vt8500/wm8505_7in.c new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
1.7.3.4
Alexey Charkov
maintainer2010/12/23 Alexey Charkov <[email protected]>:
Quoted 7 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Quoted 7 lines
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>
Russell, will you take this for .38? Please note that the last revision of this patch was also submitted to the ARM Linux patch tracking system:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6597/1
Best regards,
Alexey
Alexey Charkov
maintainer Reviewed-by Arnd Bergmann Reviewed-by Ryan Mallon Acked-by Dmitry Torokhov2010/12/28 Alexey Charkov <[email protected]>:
Quoted 16 lines
2010/12/23 Alexey Charkov <[email protected]>:
Quoted 7 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Quoted 7 lines
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>
Quoted 9 lines
Russell, will you take this for .38? Please note that the last revision of this patch was also submitted to the ARM Linux patch tracking system:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6597/1
Best regards,
Alexey
Russell, I realize that there are quite a lot of other things to worry about currently in the ARM Linux world, but could you please still consider merging this patch before .38 window closes?
It has been (at different stages):
There's also a patch to the i8042 input controller that Dmitry Torokhov wished to be merged together with this code. That one is:
and available at:
http://lists.arm.linux.org.uk/lurker/message/20101222.214141.c745816a.en.html
Best regards,
Alexey
Quoted 23 lines · Alexey Charkov
2010/12/28 Alexey Charkov <[email protected]>:
Quoted 22 lines
2010/12/23 Alexey Charkov <[email protected]>:
Quoted 7 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Quoted 7 lines
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>Russell, will you take this for .38? Please note that the last revision of this patch was also submitted to the ARM Linux patch tracking system:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6597/1
Quoted 7 lines
Quoted 3 lines
Best regards,
AlexeyRussell, I realize that there are quite a lot of other things to worry about currently in the ARM Linux world, but could you please still consider merging this patch before .38 window closes?
It got lost in the patch system in the middle of the SPEAR deluge - and after that deluge I did say on list that it would result in things being missed. I've basically been ignoring everything in there since beyond the top few newest entries.
In any case, I believe it's too late in this merge window with only four days left to start merging large amounts of code. I'd get moaned at by Linus. Sorry.
Alexey Charkov
maintainer<previous response went off-list by mistake, sorry for that>
2011/1/15 Russell King - ARM Linux <[email protected]>:
Quoted 32 lines · Alexey Charkov
Quoted 23 lines
2010/12/28 Alexey Charkov <[email protected]>:
Quoted 22 lines
2010/12/23 Alexey Charkov <[email protected]>:
Quoted 7 lines
This adds support for the family of Systems-on-Chip produced initially by VIA and now its subsidiary WonderMedia that have recently become widespread in lower-end Chinese ARM-based tablets and netbooks.
Support is included for both VT8500 and WM8505, selectable by a configuration switch at kernel build time.
Quoted 7 lines
Included are basic machine initialization files, register and interrupt definitions, support for the on-chip interrupt controller, high-precision OS timer, GPIO lines, necessary macros for early debug, pulse-width-modulated outputs control, as well as platform device configurations for the specific drivers implemented elsewhere.
Signed-off-by Alexey Charkov <[email protected]>Russell, will you take this for .38? Please note that the last revision of this patch was also submitted to the ARM Linux patch tracking system:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6597/1
Quoted 7 lines
Quoted 3 lines
Best regards,
AlexeyRussell, I realize that there are quite a lot of other things to worry about currently in the ARM Linux world, but could you please still consider merging this patch before .38 window closes?
Quoted 9 lines
It got lost in the patch system in the middle of the SPEAR deluge - and after that deluge I did say on list that it would result in things being missed. ?I've basically been ignoring everything in there since beyond the top few newest entries.
In any case, I believe it's too late in this merge window with only four days left to start merging large amounts of code. ?I'd get moaned at by Linus. ?Sorry.
Ok, life is life. Could you then please take these to your tree for .39?
Best regards,
Alexey
Quoted 1 line · Alexey Charkov
Ok, life is life. Could you then please take these to your tree for .39?
Taken. However, Lennert has been converting ARM to use the new irq_* irq_chip methods, which your code has missed out on. Any chance of a follow-up patch to switch it over?
Quoted 13 lines · Alexey Charkov
arch/arm/mach-vt8500/devices.c new file +13
-0+static struct map_desc vt8500_io_desc[]__initdata = { +/* SoC MMIO registers, to be filled in later */ + [0 ] = { + .type =MT_DEVICE + }, +/* PCI I/O space, numbers tied to those in <mach/io.h> */ + [1 ] = { + .virtual =0xf0000000 , + .pfn =__phys_to_pfn (0xc0000000 ), + .length =SZ_64K , + .type =MT_DEVICE + }, +};
...
arch/arm/mach-vt8500/include/mach/io.h line 26
Quoted 12 lines
arch/arm/mach-vt8500/include/mach/io.h new file +7
-0+#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffff + +#define __io (a) ((void __iomem *)((a) + 0xf0000000)) +#define __mem_pci (a) (a)
Can you explain why you seem to have PCI IO space, yet don't have CONFIG_PCI selected? Do you have any drivers which use this space without CONFIG_PCI=y?
Thanks.
Alexey Charkov
maintainer2011/7/6 Russell King - ARM Linux <[email protected]>:
Quoted 15 lines · Alexey Charkov
Quoted 13 lines
(quoted diff) +13
-0+static struct map_desc vt8500_io_desc[] __initdata = { + ? ? /* SoC MMIO registers, to be filled in later */ + ? ? [0] = { + ? ? ? ? ? ? .type ? ? ? ? ? = MT_DEVICE + ? ? }, + ? ? /* PCI I/O space, numbers tied to those in <mach/io.h> */ + ? ? [1] = { + ? ? ? ? ? ? .virtual ? ? ? ?= 0xf0000000, + ? ? ? ? ? ? .pfn ? ? ? ? ? ?= __phys_to_pfn(0xc0000000), + ? ? ? ? ? ? .length ? ? ? ? = SZ_64K, + ? ? ? ? ? ? .type ? ? ? ? ? = MT_DEVICE + ? ? }, +};...
Quoted 15 lines
arch/arm/mach-vt8500/include/mach/io.h line 26
Quoted 12 lines
arch/arm/mach-vt8500/include/mach/io.h new file +7
-0+#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffff + +#define __io (a) ? ? ? ? ? ? ?((void __iomem *)((a) + 0xf0000000)) +#define __mem_pci (a) (a)Can you explain why you seem to have PCI IO space, yet don't have
CONFIG_PCIselected? ?Do you have any drivers which use this space withoutCONFIG_PCI=y?
We have not yet created support for the PCI bridge (or even verified its existence on the chip). These numbers are derived bit by bit from vendor-published kernel sources and rather intended as a reference in case somebody wishes to try and implement PCI support.
All the peripherals on these chips that I know of are statically mapped platform devices programmed via MMIO registers. There may be some boards which have support for external PCI devices, but I haven't seen them.
Best,
Alexey
Quoted 21 lines · On Thursday 07 July 2011 09:13:26 Alexey Charkov wrote:
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-vt8500/include/mach/io.h new file +2
-0+#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_HQuoted 8 lines
arch/arm/mach-vt8500/include/mach/io.h line 26
Quoted 5 lines
arch/arm/mach-vt8500/include/mach/io.h new file +5
-0+ +#define IO_SPACE_LIMIT 0xffff + +#define __io (a) ((void __iomem *)((a) + 0xf0000000)) +#define __mem_pci (a) (a)Can you explain why you seem to have PCI IO space, yet don't have
CONFIG_PCIselected? Do you have any drivers which use this space withoutCONFIG_PCI=y?We have not yet created support for the PCI bridge (or even verified its existence on the chip). These numbers are derived bit by bit from vendor-published kernel sources and rather intended as a reference in case somebody wishes to try and implement PCI support.
Quoted 4 lines
All the peripherals on these chips that I know of are statically mapped platform devices programmed via MMIO registers. There may be some boards which have support for external PCI devices, but I haven't seen them.
Actually, we did discuss this when I first reviewed your patches. FWIW, WM8505, WM8510 and VT8500 don't seem to have PCI, but VT8430 has PCI, according to the data sheet and the patch provided by VIA.
What made this a little hard to understand is the way that VIA provided an emulated PCI bus even on those platforms that didn't have the hardware, apparently because it didn't occur to them to add platform device support to the network driver (via velocity, iirc). They just faked a configuration space for the USB and network devices to make them work with the regular PCI drivers.
Arnd
Quoted 31 lines · Arnd Bergmann
Quoted 21 lines · On Thursday 07 July 2011 09:13:26 Alexey Charkov wrote:
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-vt8500/include/mach/io.h new file +2
-0+#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_HQuoted 8 lines
arch/arm/mach-vt8500/include/mach/io.h line 26
Quoted 5 lines
arch/arm/mach-vt8500/include/mach/io.h new file +5
-0+ +#define IO_SPACE_LIMIT 0xffff + +#define __io (a) ((void __iomem *)((a) + 0xf0000000)) +#define __mem_pci (a) (a)Can you explain why you seem to have PCI IO space, yet don't have
CONFIG_PCIselected? Do you have any drivers which use this space withoutCONFIG_PCI=y?We have not yet created support for the PCI bridge (or even verified its existence on the chip). These numbers are derived bit by bit from vendor-published kernel sources and rather intended as a reference in case somebody wishes to try and implement PCI support.
Quoted 4 lines
All the peripherals on these chips that I know of are statically mapped platform devices programmed via MMIO registers. There may be some boards which have support for external PCI devices, but I haven't seen them.
Actually, we did discuss this when I first reviewed your patches. FWIW, WM8505, WM8510 and VT8500 don't seem to have PCI, but VT8430 has PCI, according to the data sheet and the patch provided by VIA.
Quoted 6 lines
What made this a little hard to understand is the way that VIA provided an emulated PCI bus even on those platforms that didn't have the hardware, apparently because it didn't occur to them to add platform device support to the network driver (via velocity, iirc). They just faked a configuration space for the USB and network devices to make them work with the regular PCI drivers.
Ok, so it can use the default value I've created for IO_SPACE_LIMIT based on whether CONFIG_PCI is enabled or not.
Thanks.
Quoted 11 lines · On Thursday 07 July 2011 09:59:54 Russell King - ARM Linux wrote:
Quoted 10 lines
Actually, we did discuss this when I first reviewed your patches. FWIW, WM8505, WM8510 and VT8500 don't seem to have PCI, but VT8430 has PCI, according to the data sheet and the patch provided by VIA.
What made this a little hard to understand is the way that VIA provided an emulated PCI bus even on those platforms that didn't have the hardware, apparently because it didn't occur to them to add platform device support to the network driver (via velocity, iirc). They just faked a configuration space for the USB and network devices to make them work with the regular PCI drivers.
Quoted 3 lines
Ok, so it can use the default value I've created for
IO_SPACE_LIMITbased on whetherCONFIG_PCIis enabled or not.
Yes, correct.
Arnd
A couple of other points - sorry, should've been in the last mail.
arch/arm/mach-vt8500/Kconfig line 5
Quoted 11 lines · Alexey Charkov
arch/arm/mach-vt8500/Kconfig new file +5
-0@@ -0,0 +1,65 @@ +if ARCH_VT8500 + +config VTWM_VERSION_VT8500 + bool + default n
n is the default anyway, so specifying this is redundant.
arch/arm/mach-vt8500/Kconfig line 10
Quoted 5 lines
arch/arm/mach-vt8500/Kconfig new file +5
-0+void __init bv07_init(void) +{ +#ifdef CONFIG_FB_VT8500 + void __iomem *gpio_mux_reg = ioremap(wmt_current_regs->gpio + + 0x200, 4);
ioremap() is generally regarded as a function which can fail, and therefore needs its return value checked. There seems to be multiple instances of this through this patch.
Alexey Charkov
maintainer2010/11/7 Russell King - ARM Linux <[email protected]>:
Quoted 17 lines
A couple of other points - sorry, should've been in the last mail.
arch/arm/mach-vt8500/Kconfig line 5
Quoted 11 lines · Alexey Charkov
arch/arm/mach-vt8500/Kconfig new file +5
-0@@ -0,0 +1,65 @@ +if ARCH_VT8500 + +config VTWM_VERSION_VT8500 + ? ? bool + ? ? default nn is the default anyway, so specifying this is redundant.
Great, I'll drop it then.
Quoted 10 lines
arch/arm/mach-vt8500/Kconfig line 10
Quoted 5 lines
arch/arm/mach-vt8500/Kconfig new file +5
-0+void __init bv07_init(void) +{ +#ifdef CONFIG_FB_VT8500 + ? ? void __iomem *gpio_mux_reg = ioremap(wmt_current_regs->gpio + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?+ 0x200, 4);
ioremap()is generally regarded as a function which can fail, and therefore needs its return value checked. ?There seems to be multiple instances of this through this patch.
Is it OK to simply skip the code that uses the relevant pointer if ioremap fails (possibly issuing an error via printk)? The problem is that these are void functions, so I can't just return -ENODEV on failure.